From b69d6e3a519ac31bb0675e1bf04f1904af2d028c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 15 Jan 2021 14:52:30 +0800 Subject: [PATCH 01/71] =?UTF-8?q?user=E5=BA=93staff=5Fwechat=E8=A1=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/StaffWechatDTO.java | 5 +++++ .../src/main/java/com/epmet/entity/StaffWechatEntity.java | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java index b129857f74..fb6582df9f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java @@ -38,6 +38,11 @@ public class StaffWechatDTO implements Serializable { */ private String id; + /** + * 客户Id + */ + private String customerId; + /** * 用户Id user.id */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java index 905ab9e741..7bebcf6377 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java @@ -39,6 +39,11 @@ public class StaffWechatDTO implements Serializable { */ private String id; + /** + * 客户Id + */ + private String customerId; + /** * 用户Id user.id */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java index d2ebd5c411..c0fad998ec 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java @@ -35,6 +35,11 @@ public class StaffWechatEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * 客户Id + */ + private String customerId; + /** * 用户Id user.id */ From b0107f0e54957b9dcae99be83ed98c736a01ebc7 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 15 Jan 2021 15:07:18 +0800 Subject: [PATCH 02/71] =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/RoleOperationDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/RoleScopeDTO.java | 5 +++++ .../epmet/dto/form/InitDefaultOperationsFormDTO.java | 2 +- .../java/com/epmet/entity/RoleOperationEntity.java | 5 +++++ .../main/java/com/epmet/entity/RoleScopeEntity.java | 4 ++++ .../epmet/service/impl/RoleOperationServiceImpl.java | 12 ++++++++---- .../java/com/epmet/dto/CustomerHomeDetailDTO.java | 5 +++++ .../com/epmet/entity/CustomerHomeDetailEntity.java | 5 ++++- .../epmet/service/impl/CustomerHomeServiceImpl.java | 1 + .../epmet/service/impl/GovStaffRoleServiceImpl.java | 1 + 10 files changed, 39 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java index bda4931386..8b6cad6c1d 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java @@ -39,6 +39,11 @@ public class RoleOperationDTO implements Serializable { */ private String id; + /** + * 客户ID + */ + private String customerId; + /** * 角色ID */ diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java index 17f8866215..ee9a3dfa6e 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java @@ -33,6 +33,11 @@ public class RoleScopeDTO implements Serializable { private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** * */ diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/InitDefaultOperationsFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/InitDefaultOperationsFormDTO.java index d7b487ad67..670f26d2ce 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/InitDefaultOperationsFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/InitDefaultOperationsFormDTO.java @@ -13,7 +13,7 @@ public class InitDefaultOperationsFormDTO { public static class InitDefaultOpesRoleDTO { public InitDefaultOpesRoleDTO() { } - + private String customerId; private String roleId; private String roleKey; } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java index 96f70de1be..e18ff011b5 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java @@ -38,6 +38,11 @@ public class RoleOperationEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** * 角色ID */ diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java index 2c3c6f21dc..c6e7b291e9 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java @@ -37,6 +37,10 @@ import java.util.Date; public class RoleScopeEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; /** * 角色ID diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java index 28943e74b8..393bfdb12f 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java @@ -128,11 +128,12 @@ public class RoleOperationServiceImpl extends BaseServiceImpl defaultOperations = roleOperationDefaultDao.listByRoleKey(roleKey); if (!CollectionUtils.isEmpty(defaultOperations)) { // 有的角色并没有配置默认的操作权限,应该忽略 - initDefaultOperationsForRole(roleId, defaultOperations); - initDefaultOperationScopesForRole(roleId, roleKey, defaultOperations); + initDefaultOperationsForRole(roleId, customerId, defaultOperations); + initDefaultOperationScopesForRole(roleId, roleKey, customerId, defaultOperations); } } } @@ -140,13 +141,15 @@ public class RoleOperationServiceImpl extends BaseServiceImpl operations) { + public void initDefaultOperationsForRole(String roleId, String customerId, List operations) { for (RoleOperationDefaultResultDTO operation : operations) { RoleOperationEntity entity = new RoleOperationEntity(); entity.setOperationKey(operation.getOperationKey()); entity.setRoleId(roleId); + entity.setCustomerId(customerId); roleOperationDao.insert(entity); } } @@ -157,7 +160,7 @@ public class RoleOperationServiceImpl extends BaseServiceImpl operations) { + public void initDefaultOperationScopesForRole(String roleId, String roleKey, String customerId, List operations) { HashMap> opeScopeMap = listDefaultOpeScopesMap(roleKey); for (RoleOperationDefaultResultDTO operation : operations) { // 该角色,该操作的操作范围列表 @@ -168,6 +171,7 @@ public class RoleOperationServiceImpl extends BaseServiceImpl list = tempList.stream().map(temp -> { CustomerHomeDetailEntity detailEntity = new CustomerHomeDetailEntity(); + detailEntity.setCustomerId(customerId); detailEntity.setHomeId(entity.getId()); detailEntity.setComponentId(temp.getComponentId()); detailEntity.setConfiguration(temp.getConfiguration()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 726be2370d..00e6008bcf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -154,6 +154,7 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl Date: Fri, 15 Jan 2021 15:41:31 +0800 Subject: [PATCH 03/71] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=E7=99=BB?= =?UTF-8?q?=E9=99=86=E6=A8=A1=E5=9D=97=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 --- .../java/com/epmet/service/impl/GovLoginServiceImpl.java | 7 ++++--- .../java/com/epmet/service/impl/ThirdLoginServiceImpl.java | 7 ++++--- .../main/java/com/epmet/dto/form/StaffWechatFormDTO.java | 5 +++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index ee60b3c22f..1bedcc9a7a 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 @@ -152,7 +152,7 @@ public class GovLoginServiceImpl implements GovLoginService { } StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); //2、记录staff_wechat - this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid()); + this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid(), staffLatestAgencyResultDTO.getCustomerId()); //3、记录登录日志 this.saveStaffLoginRecord(staffLatestAgencyResultDTO); //4、获取用户token @@ -276,7 +276,7 @@ public class GovLoginServiceImpl implements GovLoginService { WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode(), formDTO.getAppId()); //3、记录staff_wechat,并记录用户激活状态,激活时间 - this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), formDTO.getCustomerId()); //4、记录登录日志 this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); //5.1、获取用户token @@ -401,10 +401,11 @@ public class GovLoginServiceImpl implements GovLoginService { * @Description 保存微信和当前登录用户关系 * @Date 2020/4/18 22:54 **/ - private Result savestaffwechat(String userId, String openid) { + private Result savestaffwechat(String userId, String openid, String customerId) { StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); staffWechatFormDTO.setUserId(userId); staffWechatFormDTO.setWxOpenId(openid); + staffWechatFormDTO.setCustomerId(customerId); return epmetUserFeignClient.saveStaffWechat(staffWechatFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index d1cc70552e..024010f05b 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 @@ -153,7 +153,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); //3.记录staff_wechat - this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), userWechatDTO.getWxOpenId()); + this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), userWechatDTO.getWxOpenId(), staffLatestAgencyResultDTO.getCustomerId()); //4.记录登录日志 this.saveStaffLoginRecord(staffLatestAgencyResultDTO); @@ -175,10 +175,11 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { * @Author sun * @Description 保存微信和当前登录用户关系 **/ - private Result savestaffwechat(String userId, String openid) { + private Result savestaffwechat(String userId, String openid, String customerId) { StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); staffWechatFormDTO.setUserId(userId); staffWechatFormDTO.setWxOpenId(openid); + staffWechatFormDTO.setCustomerId(customerId); return epmetUserOpenFeignClient.saveStaffWechat(staffWechatFormDTO); } @@ -366,7 +367,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { wxMaJscode2SessionResult.setUnionid(""); // end //3、记录staff_wechat,并记录用户激活状态,激活时间 - this.savestaffwechat(customerStaff.getUserId(), userWechatDTO.getWxOpenId()); + this.savestaffwechat(customerStaff.getUserId(), userWechatDTO.getWxOpenId(), formDTO.getCustomerId()); //4、记录登录日志 StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = new StaffLatestAgencyResultDTO(); staffLatestAgencyResultDTO.setCustomerId(formDTO.getCustomerId()); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffWechatFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffWechatFormDTO.java index 37687e0b1b..2810e342ba 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffWechatFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffWechatFormDTO.java @@ -24,5 +24,10 @@ public class StaffWechatFormDTO implements Serializable { */ @NotBlank(message = "openId不能为空") private String wxOpenId; + + /** + * 客户Id + */ + private String customerId; } From 2f11a76d5291629db74ab6d34e7a9e93fcc18317 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 15 Jan 2021 16:32:58 +0800 Subject: [PATCH 04/71] =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataaggre/dto/govproject/ProjectOrgRelationDTO.java | 5 +++++ .../dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java | 5 +++++ .../java/com/epmet/dto/project/ProjectOrgRelationDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java | 5 +++++ .../main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java | 5 +++++ .../main/java/com/epmet/entity/ProjectOrgRelationEntity.java | 5 +++++ .../java/com/epmet/entity/ProjectRelatedPersonnelEntity.java | 4 ++++ .../com/epmet/service/impl/ProjectProcessServiceImpl.java | 2 ++ .../main/java/com/epmet/service/impl/ProjectServiceImpl.java | 4 ++++ 9 files changed, 40 insertions(+) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java index 917aee0760..1ced09d849 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java @@ -39,6 +39,11 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String id; + /** + * 客户ID + */ + private String customerId; + /** * 关联PROJECT_STAFF,由此ID可以关联出PROJECT_ID、CUSTOMER_ID、PROCESS_ID */ diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java index 87ed6f6173..f54e950517 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java @@ -38,6 +38,11 @@ public class ProjectRelatedPersonnelDTO implements Serializable { */ private String id; + /** + * 客户ID + */ + private String customerId; + /** * 项目ID */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectOrgRelationDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectOrgRelationDTO.java index 208112c9ab..e3445fc5f0 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectOrgRelationDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectOrgRelationDTO.java @@ -39,6 +39,11 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String id; + /** + * 客户ID + */ + private String customerId; + /** * 关联PROJECT_STAFF,由此ID可以关联出PROJECT_ID、CUSTOMER_ID、PROCESS_ID */ diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java index a092793cf2..1c6ba7c69c 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java @@ -38,6 +38,11 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String id; + /** + * 客户ID + */ + private String customerId; + /** * 关联PROJECT_STAFF,由此ID可以关联出PROJECT_ID、CUSTOMER_ID、PROCESS_ID */ diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java index 4ac72f72cc..530ac957cc 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java @@ -38,6 +38,11 @@ public class ProjectRelatedPersonnelDTO implements Serializable { */ private String id; + /** + * 客户ID + */ + private String customerId; + /** * 项目ID */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java index 23e190ab90..f6a2dbd3d2 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java @@ -38,6 +38,11 @@ public class ProjectOrgRelationEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** * 关联PROJECT_STAFF,由此ID可以关联出PROJECT_ID、CUSTOMER_ID、PROCESS_ID */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java index 6b99f72f4a..dbee089587 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java @@ -37,6 +37,10 @@ import java.util.Date; public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; /** * 项目ID diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index 8575f2d4a8..9d0d6e930a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -345,6 +345,7 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl relationList = new LinkedList<>(); entityList.forEach(staff -> { ProjectOrgRelationEntity relation = new ProjectOrgRelationEntity(); + relation.setCustomerId(staffEntity.getCustomerId()); relation.setProjectStaffId(staff.getId()); relation.setInformedDate(current); relation.setSourceOperation(ProjectConstant.OPERATION_TRANSFER); @@ -691,6 +692,7 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl relationList = new LinkedList<>(); entityList.forEach(staff -> { ProjectOrgRelationEntity relation = new ProjectOrgRelationEntity(); + relation.setCustomerId(staffEntity.getCustomerId()); relation.setProjectStaffId(staff.getId()); relation.setInformedDate(current); relation.setSourceOperation(ProjectConstant.OPERATION_TRANSFER); diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index a72ad4c6f2..e61170726b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -737,6 +737,7 @@ public class ProjectServiceImpl extends BaseServiceImpl list = new ArrayList<>(); ProjectRelatedPersonnelEntity entity1 = new ProjectRelatedPersonnelEntity(); + entity1.setCustomerId(issueDTO.getCustomerId()); entity1.setProjectId(projectEntity.getId()); entity1.setApp(AppClientConstant.APP_RESI); entity1.setGridId(issueDTO.getGridId()); @@ -1765,6 +1768,7 @@ public class ProjectServiceImpl extends BaseServiceImpl Date: Fri, 15 Jan 2021 17:39:33 +0800 Subject: [PATCH 05/71] =?UTF-8?q?EPMET=5FUSER=E5=BA=93=E4=B8=AD=EF=BC=8Cus?= =?UTF-8?q?er=E8=A1=A8=E3=80=81staff=5Frole=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E3=80=90=E5=AE=A2=E6=88=B7Id=E3=80=91=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/StaffRoleDTO.java | 2 ++ .../src/main/java/com/epmet/dto/UserDTO.java | 1 + .../src/main/java/com/epmet/entity/StaffRoleEntity.java | 4 ++++ .../src/main/java/com/epmet/entity/UserEntity.java | 5 ++++- .../src/main/java/com/epmet/entity/UserWechatEntity.java | 2 +- .../com/epmet/service/impl/CustomerStaffServiceImpl.java | 2 ++ .../main/java/com/epmet/service/impl/UserServiceImpl.java | 1 + 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java index 59d649f970..53d3b7e868 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java @@ -83,4 +83,6 @@ public class StaffRoleDTO implements Serializable { */ private Date updatedTime; + + private String customerId; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java index ab7f652268..7509214f74 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java @@ -63,4 +63,5 @@ public class UserDTO implements Serializable{ */ private Date updatedTime; + private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java index 20f828a52d..1d330d8d5b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java @@ -53,4 +53,8 @@ public class StaffRoleEntity extends BaseEpmetEntity { */ private String orgId; + /** + * 客户Id + */ + private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java index 47c11d3a60..8993da30e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java @@ -29,6 +29,9 @@ public class UserEntity extends BaseEpmetEntity { * */ private String fromClient; - + /** + * 客户Id + */ + private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java index 218d7a879d..5132184b49 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java @@ -74,5 +74,5 @@ public class UserWechatEntity extends BaseEpmetEntity { */ private String language; - + private String customerId; } 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 e592642c97..13d5067e52 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 @@ -303,6 +303,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl implem UserEntity userEntity = new UserEntity(); userEntity.setFromApp(UserConstant.APP_RESI); userEntity.setFromClient(UserConstant.CLIENT_WX); + userEntity.setCustomerId(userWechatDTO.getCustomerId()); baseDao.insert(userEntity); userWechatEntity.setUserId(userEntity.getId()); userWechatDao.insert(userWechatEntity); From ec8259f0f455b7f8fe1fec1996109552bd078c37 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 15 Jan 2021 17:42:08 +0800 Subject: [PATCH 06/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0CUSTOMER=5FID=E7=9A=84=E5=A1=AB=E5=85=85=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/handler/FieldMetaObjectHandler.java | 8 ++++++++ .../tools/security/dto/BaseTokenDto.java | 5 +++++ .../commons/tools/security/dto/GovTokenDto.java | 5 ----- .../commons/tools/security/dto/TokenDto.java | 5 ----- .../tools/security/user/LoginUserUtil.java | 17 +++++++++++++++++ .../com/epmet/auth/InternalAuthProcessor.java | 3 ++- .../src/main/resources/logback-spring.xml | 2 +- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java index b1f8dc53fc..f0afe84833 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java @@ -51,6 +51,7 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { Date date = new Date(); if (metaObject.getOriginalObject() instanceof BaseEpmetEntity) { // epmet项目新增的 + setFieldValByName(FieldConstant.CUSTOMER_ID_HUMP, getCustomerIdByFieldValue(metaObject), metaObject); setFieldValByName(FieldConstant.CREATED_TIME_HUMP, getCreatedTimeByFieldValue(metaObject), metaObject); setFieldValByName(FieldConstant.CREATED_BY_HUMP, getCreatedByFieldValue(metaObject), metaObject); setFieldValByName(FieldConstant.UPDATED_TIME_HUMP, getUpdatedTimeByFieldValue(metaObject), metaObject); @@ -95,6 +96,13 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { return value; } + public Object getCustomerIdByFieldValue(MetaObject metaObject) { + if (metaObject.hasSetter(FieldConstant.CUSTOMER_ID_HUMP)) { + return loginUserUtil.getLoginUserCustomerId(); + } + return null; + } + public Object getCreatedTimeByFieldValue(MetaObject metaObject) { Object createdTime = null; if (metaObject.hasGetter(FieldConstant.CREATED_TIME_HUMP)) { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java index c3065c7200..c5dba7e16b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java @@ -24,6 +24,11 @@ public class BaseTokenDto { */ private String token; + /** + * 客户id + */ + private String customerId; + public BaseTokenDto() { } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index c0fe871d08..b664acab2a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -31,11 +31,6 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { */ private String unionId; - /** - * 当前工作人员进入的客户id - */ - private String customerId; - /** * 过期时间戳 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java index 6db5a629cd..642bad2941 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java @@ -40,11 +40,6 @@ public class TokenDto extends BaseTokenDto implements Serializable { */ private long updateTime; - /** - * 当前工作人员进入的客户id - */ - private String customerId; - @Override public String toString() { return JSON.toJSONString(this); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java index 088a26eb73..70307f6551 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java @@ -68,6 +68,23 @@ public class LoginUserUtil { return client; } + /** + * 获取用户customerId + * @return + */ + public String getLoginUserCustomerId() { + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + if (request == null) { + return null; + } + + String client = request.getHeader(AppClientConstant.CUSTOMER_ID); + if (StringUtils.isBlank(client)) { + return null; + } + return client; + } + /** * 获取用户的部门ID列表 * @return diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java index 2ee22426f6..ec38fe805c 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -109,7 +109,8 @@ public class InternalAuthProcessor extends AuthProcessor { .header(Constant.APP_USER_KEY, redisKey) .header(AppClientConstant.APP,baseTokenDto.getApp()) .header(AppClientConstant.CLIENT,baseTokenDto.getClient()) - .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()); + .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()) + .header(AppClientConstant.CUSTOMER_ID,baseTokenDto.getCustomerId()); if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端 if(StringUtils.isNotBlank(customerId)){ diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/logback-spring.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/logback-spring.xml index 0c531843f6..2b2af13d83 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/logback-spring.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + From c66e9a6b1e34402a958f77ec4cfb4475bb47592d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 18 Jan 2021 10:19:59 +0800 Subject: [PATCH 07/71] =?UTF-8?q?role=5Foperation=E3=80=81role=5Fscope?= =?UTF-8?q?=E3=80=81customer=5Fhome=5Fdetail=E3=80=81project=5Forg=5Frelat?= =?UTF-8?q?ion=E3=80=81project=5Frelated=5Fpersonnel=E3=80=81staff=5Fwecha?= =?UTF-8?q?t=E3=80=81user=E3=80=81staff=5Frole=E3=80=81user=5Fwechat=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7ID=20=20=E5=AF=B9=E5=BA=94s?= =?UTF-8?q?ql=E8=84=9A=E6=9C=AC=E8=BF=98=E6=9C=AA=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dataaggre/dto/epmetuser/StaffRoleDTO.java | 5 +++++ .../com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java | 5 +++++ .../main/java/com/epmet/dataaggre/dto/epmetuser/UserDTO.java | 5 +++++ .../com/epmet/dataaggre/dto/epmetuser/UserWechatDTO.java | 5 +++++ .../dataaggre/dto/govproject/ProjectOrgRelationDTO.java | 5 +++++ .../dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java | 5 +++++ .../epmet/dataaggre/entity/epmetuser/StaffRoleEntity.java | 5 +++++ .../epmet/dataaggre/entity/epmetuser/StaffWechatEntity.java | 5 +++++ .../com/epmet/dataaggre/entity/epmetuser/UserEntity.java | 5 +++++ .../epmet/dataaggre/entity/epmetuser/UserWechatEntity.java | 5 +++++ .../entity/govproject/ProjectOrgRelationEntity.java | 5 +++++ .../entity/govproject/ProjectRelatedPersonnelEntity.java | 5 +++++ .../src/main/java/com/epmet/dto/RoleOperationDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/RoleScopeDTO.java | 5 +++++ .../src/main/java/com/epmet/entity/RoleOperationEntity.java | 5 +++++ .../src/main/java/com/epmet/entity/RoleScopeEntity.java | 5 +++++ .../src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java | 5 +++++ .../main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java | 5 +++++ .../main/java/com/epmet/entity/ProjectOrgRelationEntity.java | 5 +++++ .../java/com/epmet/entity/ProjectRelatedPersonnelEntity.java | 5 +++++ .../src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java | 5 +++++ .../main/java/com/epmet/entity/CustomerHomeDetailEntity.java | 5 +++++ .../src/main/java/com/epmet/dto/StaffRoleDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/StaffWechatDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/UserDTO.java | 5 +++++ .../src/main/java/com/epmet/entity/StaffRoleEntity.java | 5 +++++ .../src/main/java/com/epmet/entity/StaffWechatEntity.java | 5 +++++ .../src/main/java/com/epmet/entity/UserEntity.java | 5 ++++- .../src/main/java/com/epmet/entity/UserWechatEntity.java | 5 +++++ 29 files changed, 144 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffRoleDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffRoleDTO.java index 472615f6b1..fee3786630 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffRoleDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffRoleDTO.java @@ -83,4 +83,9 @@ public class StaffRoleDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java index b129857f74..b5afb3476d 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java @@ -123,4 +123,9 @@ public class StaffWechatDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserDTO.java index 6d79de576b..f8596020d1 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserDTO.java @@ -78,4 +78,9 @@ public class UserDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserWechatDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserWechatDTO.java index 6ddad76885..6731f94132 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserWechatDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserWechatDTO.java @@ -123,4 +123,9 @@ public class UserWechatDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java index 917aee0760..8540d12b56 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java @@ -111,4 +111,9 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String updatedBy; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java index 87ed6f6173..b8332124ec 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java @@ -98,4 +98,9 @@ public class ProjectRelatedPersonnelDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffRoleEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffRoleEntity.java index c8a27e515f..9cfbbe1ea8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffRoleEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffRoleEntity.java @@ -53,4 +53,9 @@ public class StaffRoleEntity extends BaseEpmetEntity { */ private String orgId; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffWechatEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffWechatEntity.java index 33771a607f..b4085694fc 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffWechatEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffWechatEntity.java @@ -93,4 +93,9 @@ public class StaffWechatEntity extends BaseEpmetEntity { */ private String language; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserEntity.java index fbec7cb293..f58f84e9c7 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserEntity.java @@ -48,4 +48,9 @@ public class UserEntity extends BaseEpmetEntity { */ private String fromClient; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserWechatEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserWechatEntity.java index b319057238..30cab00c14 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserWechatEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/UserWechatEntity.java @@ -93,4 +93,9 @@ public class UserWechatEntity extends BaseEpmetEntity { */ private String language; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectOrgRelationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectOrgRelationEntity.java index 975d2282a0..247d85b928 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectOrgRelationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectOrgRelationEntity.java @@ -80,4 +80,9 @@ public class ProjectOrgRelationEntity extends BaseEpmetEntity { */ private String operation; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectRelatedPersonnelEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectRelatedPersonnelEntity.java index 95259997cf..c77447baa6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectRelatedPersonnelEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectRelatedPersonnelEntity.java @@ -68,4 +68,9 @@ public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { */ private String userId; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java index bda4931386..d658ebcb34 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java @@ -79,4 +79,9 @@ public class RoleOperationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java index 17f8866215..2ac1638384 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java @@ -83,4 +83,9 @@ public class RoleScopeDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java index 96f70de1be..c6d5243f1a 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java @@ -48,4 +48,9 @@ public class RoleOperationEntity extends BaseEpmetEntity { */ private String operationKey; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java index 2c3c6f21dc..88da4a22f6 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java @@ -53,4 +53,9 @@ public class RoleScopeEntity extends BaseEpmetEntity { */ private String scopeKey; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java index a092793cf2..2bbe26cc3a 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java @@ -110,4 +110,9 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String updatedBy; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java index 4ac72f72cc..55bbe13d02 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java @@ -98,4 +98,9 @@ public class ProjectRelatedPersonnelDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java index 23e190ab90..ef504461c9 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java @@ -80,4 +80,9 @@ public class ProjectOrgRelationEntity extends BaseEpmetEntity { */ private String operation; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java index 6b99f72f4a..e4b12243b7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java @@ -68,4 +68,9 @@ public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { */ private String sourceId; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java index 82f5b1d9ce..1081a4e145 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java @@ -93,4 +93,9 @@ public class CustomerHomeDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java index e6a753278b..b804a3be7b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java @@ -68,4 +68,9 @@ public class CustomerHomeDetailEntity extends BaseEpmetEntity { */ private Integer displayOrder; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java index 59d649f970..753bc36884 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java @@ -83,4 +83,9 @@ public class StaffRoleDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java index 905ab9e741..b60ce23bbe 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java @@ -124,4 +124,9 @@ public class StaffWechatDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java index ab7f652268..e8dd099611 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserDTO.java @@ -63,4 +63,9 @@ public class UserDTO implements Serializable{ */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java index 20f828a52d..c9c12afea9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java @@ -53,4 +53,9 @@ public class StaffRoleEntity extends BaseEpmetEntity { */ private String orgId; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java index d2ebd5c411..5b490a9555 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java @@ -90,4 +90,9 @@ public class StaffWechatEntity extends BaseEpmetEntity { */ private String language; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java index 47c11d3a60..b034dc8c3e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java @@ -29,6 +29,9 @@ public class UserEntity extends BaseEpmetEntity { * */ private String fromClient; - + /** + * 客户ID + */ + private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java index 218d7a879d..8b05ffbf97 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java @@ -74,5 +74,10 @@ public class UserWechatEntity extends BaseEpmetEntity { */ private String language; + /** + * 客户ID + */ + private String customerId; + } From a1c3b79edba57427027bfeefba14f3301fc337d2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 18 Jan 2021 16:10:43 +0800 Subject: [PATCH 08/71] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java index 93776b744e..1c6ba7c69c 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectOrgRelationDTO.java @@ -115,9 +115,4 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String updatedBy; - /** - * 客户ID - */ - private String customerId; - } \ No newline at end of file From eae6cd44e27b2ef1204b83e2f1a2154e2d0f4ec1 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 Jan 2021 13:54:39 +0800 Subject: [PATCH 09/71] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81=20en?= =?UTF-8?q?tity=E6=B7=BB=E5=8A=A0=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java | 5 ----- .../dataaggre/dto/govproject/ProjectOrgRelationDTO.java | 5 ----- .../dto/govproject/ProjectRelatedPersonnelDTO.java | 4 ---- .../src/main/java/com/epmet/dto/RoleOperationDTO.java | 5 ----- .../src/main/java/com/epmet/dto/RoleScopeDTO.java | 5 ----- .../main/java/com/epmet/entity/RoleOperationEntity.java | 8 +++----- .../src/main/java/com/epmet/entity/RoleScopeEntity.java | 7 +++---- .../java/com/epmet/dto/ProjectRelatedPersonnelDTO.java | 5 ----- .../java/com/epmet/entity/ProjectOrgRelationEntity.java | 8 +++----- .../com/epmet/entity/ProjectRelatedPersonnelEntity.java | 7 +++---- .../main/java/com/epmet/dto/CustomerHomeDetailDTO.java | 5 ----- .../java/com/epmet/entity/CustomerHomeDetailEntity.java | 8 ++++---- .../src/main/java/com/epmet/dto/StaffWechatDTO.java | 5 ----- .../src/main/java/com/epmet/entity/StaffRoleEntity.java | 3 +++ .../src/main/java/com/epmet/entity/StaffWechatEntity.java | 8 +++----- .../src/main/java/com/epmet/entity/UserEntity.java | 3 +++ .../src/main/java/com/epmet/entity/UserWechatEntity.java | 3 +++ 17 files changed, 28 insertions(+), 66 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java index 4ca1317325..b5afb3476d 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffWechatDTO.java @@ -38,11 +38,6 @@ public class StaffWechatDTO implements Serializable { */ private String id; - /** - * 客户Id - */ - private String customerId; - /** * 用户Id user.id */ diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java index 8e46560521..1ced09d849 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectOrgRelationDTO.java @@ -116,9 +116,4 @@ public class ProjectOrgRelationDTO implements Serializable { */ private String updatedBy; - /** - * 客户ID - */ - private String customerId; - } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java index b05737cee6..ba9a30d334 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectRelatedPersonnelDTO.java @@ -103,9 +103,5 @@ public class ProjectRelatedPersonnelDTO implements Serializable { */ private Date updatedTime; - /** - * 客户ID - */ - private String customerId; } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java index c4f5ecbc93..d658ebcb34 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java @@ -39,11 +39,6 @@ public class RoleOperationDTO implements Serializable { */ private String id; - /** - * 客户ID - */ - private String customerId; - /** * 角色ID */ diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java index 795109f94a..2ac1638384 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java @@ -33,11 +33,6 @@ public class RoleScopeDTO implements Serializable { private static final long serialVersionUID = 1L; - /** - * 客户ID - */ - private String customerId; - /** * */ diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java index 547d5f9378..24bef0d80b 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -38,11 +40,6 @@ public class RoleOperationEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户ID - */ - private String customerId; - /** * 角色ID */ @@ -56,6 +53,7 @@ public class RoleOperationEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java index 22c3683bc3..2ee49f8ede 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -37,10 +39,6 @@ import java.util.Date; public class RoleScopeEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户ID - */ - private String customerId; /** * 角色ID @@ -60,6 +58,7 @@ public class RoleScopeEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java index 2f29de39a1..55bbe13d02 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java @@ -38,11 +38,6 @@ public class ProjectRelatedPersonnelDTO implements Serializable { */ private String id; - /** - * 客户ID - */ - private String customerId; - /** * 项目ID */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java index fd41ef8dc4..e541e454fa 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectOrgRelationEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -38,11 +40,6 @@ public class ProjectOrgRelationEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户ID - */ - private String customerId; - /** * 关联PROJECT_STAFF,由此ID可以关联出PROJECT_ID、CUSTOMER_ID、PROCESS_ID */ @@ -88,6 +85,7 @@ public class ProjectOrgRelationEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java index f38dd32967..6291ac0d65 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -37,10 +39,6 @@ import java.util.Date; public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户ID - */ - private String customerId; /** * 项目ID @@ -75,6 +73,7 @@ public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java index ec794dd190..1081a4e145 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerHomeDetailDTO.java @@ -38,11 +38,6 @@ public class CustomerHomeDetailDTO implements Serializable { */ private String id; - /** - * 客户ID - */ - private String customerId; - /** * 界面ID customer_home.ID */ diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java index d9711da5b2..1bc64f2b91 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerHomeDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -37,10 +39,7 @@ import java.util.Date; public class CustomerHomeDetailEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户ID - */ - private String customerId; + /** * 界面ID customer_home.ID */ @@ -74,6 +73,7 @@ public class CustomerHomeDetailEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java index 32204c9bd6..7bebcf6377 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffWechatDTO.java @@ -129,9 +129,4 @@ public class StaffWechatDTO implements Serializable { */ private Date updatedTime; - /** - * 客户ID - */ - private String customerId; - } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java index c9c12afea9..61e8db0fcd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -56,6 +58,7 @@ public class StaffRoleEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java index 8b0cc1516e..b7c4e13c99 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffWechatEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -35,11 +37,6 @@ public class StaffWechatEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户Id - */ - private String customerId; - /** * 用户Id user.id */ @@ -98,6 +95,7 @@ public class StaffWechatEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java index b034dc8c3e..167f2c8bde 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java @@ -1,5 +1,7 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -32,6 +34,7 @@ public class UserEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java index 8b05ffbf97..58437ea0e3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserWechatEntity.java @@ -1,5 +1,7 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -77,6 +79,7 @@ public class UserWechatEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; From 5fdf6126c31f2e1c798cd099c14a3a5e2d6f2b1e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 Jan 2021 15:42:05 +0800 Subject: [PATCH 10/71] =?UTF-8?q?=E9=99=8C=E7=94=9F=E4=BA=BA=E5=AF=BC?= =?UTF-8?q?=E8=A7=88=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/StrangerAccessRecordDTO.java | 5 +++++ .../java/com/epmet/entity/StrangerAccessRecordEntity.java | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java index 183bc5fb2f..302ed0a3d5 100644 --- a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/StrangerAccessRecordDTO.java @@ -108,4 +108,9 @@ public class StrangerAccessRecordDTO implements Serializable { */ private Date updatedTime; + /** + * 客户Id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java index f9788d9b36..b9cec3537b 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -78,4 +80,9 @@ public class StrangerAccessRecordEntity extends BaseEpmetEntity { * */ private String area; + /** + * 客户Id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } From 551cc7e6d5981d08184725eaa87d6ea12029c323 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 20 Jan 2021 16:17:11 +0800 Subject: [PATCH 11/71] =?UTF-8?q?resi-group=E5=BA=93=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8customerId=E7=9A=84=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=AF=B9=E5=BA=94?= =?UTF-8?q?DTO=E5=92=8CEntity=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/resi/group/dto/group/ResiGroupOperationDTO.java | 5 +++++ .../resi/group/dto/group/ResiGroupStatisticalDTO.java | 5 +++++ .../resi/group/dto/invitation/GroupInvitationDTO.java | 5 +++++ .../resi/group/dto/member/GroupMemeberOperationDTO.java | 5 +++++ .../resi/group/dto/topic/ResiTopicAttachmentDTO.java | 5 +++++ .../epmet/resi/group/dto/topic/ResiTopicCommentDTO.java | 5 +++++ .../java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java | 5 +++++ .../epmet/resi/group/dto/topic/ResiTopicOperationDTO.java | 5 +++++ .../modules/comment/entity/ResiTopicCommentEntity.java | 8 ++++++++ .../modules/group/entity/ResiGroupOperationEntity.java | 8 ++++++++ .../modules/group/entity/ResiGroupStatisticalEntity.java | 8 ++++++++ .../modules/invitation/entity/GroupInvitationEntity.java | 8 ++++++++ .../member/entity/GroupMemeberOperationEntity.java | 8 ++++++++ .../modules/member/entity/ResiGroupMemberEntity.java | 8 ++++++++ .../modules/topic/entity/ResiTopicAttachmentEntity.java | 7 +++++++ .../com/epmet/modules/topic/entity/ResiTopicEntity.java | 8 ++++++++ .../modules/topic/entity/ResiTopicOperationEntity.java | 8 ++++++++ 17 files changed, 111 insertions(+) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java index 35f15243dc..dac5b78dac 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java @@ -97,4 +97,9 @@ public class ResiGroupOperationDTO implements Serializable { * 消息通知内容 * */ private String messageText; + + /** + * 客户ID + */ + private String customerId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java index c5fb79590d..7dad502e68 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupStatisticalDTO.java @@ -103,4 +103,9 @@ public class ResiGroupStatisticalDTO implements Serializable { */ private String updatedBy; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java index f157c439d1..68e8ceb627 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/invitation/GroupInvitationDTO.java @@ -103,4 +103,9 @@ public class GroupInvitationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java index 78f7c8fe77..7e68ec4850 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupMemeberOperationDTO.java @@ -110,4 +110,9 @@ public class GroupMemeberOperationDTO implements Serializable { * OPERATE_USER_ID操作人id */ private String operateUserId; + + /** + * 客户ID + */ + private String customerId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java index 60d086d6fc..fc67091945 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicAttachmentDTO.java @@ -103,4 +103,9 @@ public class ResiTopicAttachmentDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java index bfe36f8c40..ce8b30e3f6 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java @@ -83,4 +83,9 @@ public class ResiTopicCommentDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java index f60ac86651..03ca7df8d6 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java @@ -118,4 +118,9 @@ public class ResiTopicDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicOperationDTO.java index 8b6dcb5ddb..6462f01473 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicOperationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicOperationDTO.java @@ -78,4 +78,9 @@ public class ResiTopicOperationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java index 040f966e2d..04cbfeff0d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.comment.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class ResiTopicCommentEntity extends BaseEpmetEntity { */ private String status; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java index b3d2c0151f..29f255f504 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.group.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -67,4 +69,10 @@ public class ResiGroupOperationEntity extends BaseEpmetEntity { * 消息通知内容 * */ private String messageText; + + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java index 9396bda454..95ea48a3aa 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupStatisticalEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.group.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -73,4 +75,10 @@ public class ResiGroupStatisticalEntity extends BaseEpmetEntity { */ private Integer totalNormalMemebers; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java index bba85a4635..7f6fbe80d4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/entity/GroupInvitationEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.invitation.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -73,4 +75,10 @@ public class GroupInvitationEntity extends BaseEpmetEntity { */ private String invitationType; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java index 8483de6627..74fb815cbe 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupMemeberOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.member.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -80,4 +82,10 @@ Ps: 1) 入群被拒绝之后,如果再申请是插入一条新的审核中的 * OPERATE_USER_ID操作人id */ private String operateUserId; + + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java index ebcceb9566..3d9a9ac553 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.member.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -68,4 +70,10 @@ public class ResiGroupMemberEntity extends BaseEpmetEntity { */ private String status; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java index 6b63177921..bfc91f3abb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicAttachmentEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.topic.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -73,4 +75,9 @@ public class ResiTopicAttachmentEntity extends BaseEpmetEntity { * */ private Integer duration; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java index 1214e5d71a..886b5d1ed1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.topic.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -98,4 +100,10 @@ public class ResiTopicEntity extends BaseEpmetEntity { * */ private Boolean shiftIssue; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicOperationEntity.java index 8a9cb25de9..c99f601bf8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicOperationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.topic.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -52,4 +54,10 @@ public class ResiTopicOperationEntity extends BaseEpmetEntity { * 屏蔽理由(非必填) * */ private String operationReason; + + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } From 6eef4c0d7a839968a8b00833b16400dd0d75ba3e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 Jan 2021 16:57:17 +0800 Subject: [PATCH 12/71] =?UTF-8?q?resi=5Fpartymember=E5=BA=93=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AE=A2=E6=88=B7Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/partymember/PartyBranchMembersDTO.java | 5 +++++ .../dto/partymember/PartymemberConfirmAutoDTO.java | 5 +++++ .../partymember/entity/PartyBranchMembersEntity.java | 8 ++++++++ .../partymember/entity/PartymemberConfirmAutoEntity.java | 8 ++++++++ 4 files changed, 26 insertions(+) diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartyBranchMembersDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartyBranchMembersDTO.java index 946e0ea1fa..57d8800e74 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartyBranchMembersDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartyBranchMembersDTO.java @@ -78,4 +78,9 @@ public class PartyBranchMembersDTO implements Serializable { */ private Date updatedTime; + /** + * 客户Id (customer.id) + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartymemberConfirmAutoDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartymemberConfirmAutoDTO.java index 2499990b59..304ba36eab 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartymemberConfirmAutoDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/PartymemberConfirmAutoDTO.java @@ -140,4 +140,9 @@ public class PartymemberConfirmAutoDTO implements Serializable { */ private Boolean comparisonResults; + /** + * 客户Id (customer.id) + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartyBranchMembersEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartyBranchMembersEntity.java index 4ab74c40bc..5578600dcb 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartyBranchMembersEntity.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartyBranchMembersEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.partymember.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -48,4 +50,10 @@ public class PartyBranchMembersEntity extends BaseEpmetEntity { */ private String partymemberBaseInfoId; + /** + * 客户Id (customer.id) + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartymemberConfirmAutoEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartymemberConfirmAutoEntity.java index 102a5ad21f..c4aed17def 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartymemberConfirmAutoEntity.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/entity/PartymemberConfirmAutoEntity.java @@ -17,6 +17,8 @@ package com.epmet.modules.partymember.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -104,4 +106,10 @@ public class PartymemberConfirmAutoEntity extends BaseEpmetEntity { */ private Date contrastTime; + /** + * 客户Id (customer.id) + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From ad4a86da21ef125315b0ad91b268f750dbc06abd Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 20 Jan 2021 17:23:26 +0800 Subject: [PATCH 13/71] =?UTF-8?q?resi-group=E5=BA=93=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8customerId=E7=9A=84=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=AF=B9=E5=BA=94?= =?UTF-8?q?DTO=E5=92=8CEntity=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dataaggre/dto/resigroup/GroupInvitationDTO.java | 5 +++++ .../dataaggre/dto/resigroup/GroupMemeberOperationDTO.java | 5 +++++ .../dto/resigroup/InvitationAccessRecordDTO.java | 5 +++++ .../epmet/dataaggre/dto/resigroup/ResiGroupMemberDTO.java | 5 +++++ .../dataaggre/dto/resigroup/ResiGroupOperationDTO.java | 5 +++++ .../dataaggre/dto/resigroup/ResiGroupStatisticalDTO.java | 5 +++++ .../dataaggre/dto/resigroup/ResiTopicAttachmentDTO.java | 5 +++++ .../dataaggre/dto/resigroup/ResiTopicCommentDTO.java | 5 +++++ .../com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java | 5 +++++ .../dataaggre/dto/resigroup/ResiTopicOperationDTO.java | 5 +++++ .../dataaggre/entity/resigroup/GroupInvitationEntity.java | 8 ++++++++ .../entity/resigroup/GroupMemeberOperationEntity.java | 8 ++++++++ .../entity/resigroup/InvitationAccessRecordEntity.java | 8 ++++++++ .../dataaggre/entity/resigroup/ResiGroupMemberEntity.java | 8 ++++++++ .../entity/resigroup/ResiGroupOperationEntity.java | 8 ++++++++ .../entity/resigroup/ResiGroupStatisticalEntity.java | 7 +++++++ .../entity/resigroup/ResiTopicAttachmentEntity.java | 8 ++++++++ .../entity/resigroup/ResiTopicCommentEntity.java | 8 ++++++++ .../epmet/dataaggre/entity/resigroup/ResiTopicEntity.java | 7 +++++++ .../entity/resigroup/ResiTopicOperationEntity.java | 8 ++++++++ 20 files changed, 128 insertions(+) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupInvitationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupInvitationDTO.java index 23ba23aeb8..3e2435179d 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupInvitationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupInvitationDTO.java @@ -103,4 +103,9 @@ public class GroupInvitationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupMemeberOperationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupMemeberOperationDTO.java index c9c2ed3f88..69c822c5ab 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupMemeberOperationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/GroupMemeberOperationDTO.java @@ -111,4 +111,9 @@ Ps: 1) 入群被拒绝之后,如果再申请是插入一条新的审核中的 */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/InvitationAccessRecordDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/InvitationAccessRecordDTO.java index fcada6acf6..0732284ccf 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/InvitationAccessRecordDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/InvitationAccessRecordDTO.java @@ -83,4 +83,9 @@ public class InvitationAccessRecordDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupMemberDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupMemberDTO.java index 126b85c8e8..519e09389f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupMemberDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupMemberDTO.java @@ -98,4 +98,9 @@ public class ResiGroupMemberDTO implements Serializable { */ private String updatedBy; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupOperationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupOperationDTO.java index f9db3273e3..f84df8eb4e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupOperationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupOperationDTO.java @@ -98,4 +98,9 @@ public class ResiGroupOperationDTO implements Serializable { */ private String messageText; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupStatisticalDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupStatisticalDTO.java index 357df74487..2bb74bf9bb 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupStatisticalDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupStatisticalDTO.java @@ -103,4 +103,9 @@ public class ResiGroupStatisticalDTO implements Serializable { */ private String updatedBy; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicAttachmentDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicAttachmentDTO.java index 58a0c9046b..d176a49809 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicAttachmentDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicAttachmentDTO.java @@ -103,4 +103,9 @@ public class ResiTopicAttachmentDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java index b84e9d8f10..deae8e0ffd 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java @@ -83,4 +83,9 @@ public class ResiTopicCommentDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java index 87692d1263..0cabbf91b7 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java @@ -128,4 +128,9 @@ public class ResiTopicDTO implements Serializable { */ private String issueId; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicOperationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicOperationDTO.java index 74d8b5bd66..6bb6bc0640 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicOperationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicOperationDTO.java @@ -83,4 +83,9 @@ public class ResiTopicOperationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupInvitationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupInvitationEntity.java index 1edd70783f..45edf9174c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupInvitationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupInvitationEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -73,4 +75,10 @@ public class GroupInvitationEntity extends BaseEpmetEntity { */ private Date validEndTime; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupMemeberOperationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupMemeberOperationEntity.java index b947e1bdb4..55a976df65 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupMemeberOperationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/GroupMemeberOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -81,4 +83,10 @@ Ps: 1) 入群被拒绝之后,如果再申请是插入一条新的审核中的 */ private String operateUserId; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java index 9db8112806..c1317f423e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class InvitationAccessRecordEntity extends BaseEpmetEntity { */ private String state; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupMemberEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupMemberEntity.java index 101f61bf37..3736c8ebaa 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupMemberEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupMemberEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -68,4 +70,10 @@ public class ResiGroupMemberEntity extends BaseEpmetEntity { */ private String status; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupOperationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupOperationEntity.java index 941d59bb88..db99ac76f4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupOperationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -68,4 +70,10 @@ public class ResiGroupOperationEntity extends BaseEpmetEntity { */ private String messageText; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupStatisticalEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupStatisticalEntity.java index ff0d8e57d5..baa8ec6846 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupStatisticalEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupStatisticalEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -73,4 +75,9 @@ public class ResiGroupStatisticalEntity extends BaseEpmetEntity { */ private Integer totalNormalMemebers; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicAttachmentEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicAttachmentEntity.java index 3f0b97e1d1..19bcf9837b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicAttachmentEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicAttachmentEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -73,4 +75,10 @@ public class ResiTopicAttachmentEntity extends BaseEpmetEntity { */ private Integer duration; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java index ff12b3fb1a..5097beb4a9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class ResiTopicCommentEntity extends BaseEpmetEntity { */ private String status; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicEntity.java index 1056f72771..d5ae0ea960 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -98,4 +100,9 @@ public class ResiTopicEntity extends BaseEpmetEntity { */ private String issueId; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicOperationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicOperationEntity.java index 261ebd0b39..612dc96087 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicOperationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicOperationEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.resigroup; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class ResiTopicOperationEntity extends BaseEpmetEntity { */ private String operationReason; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From fe9305576094fb3ab52564986a2ba61a0a014022 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 21 Jan 2021 10:27:55 +0800 Subject: [PATCH 14/71] =?UTF-8?q?oss=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/entity/OssEntity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/entity/OssEntity.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/entity/OssEntity.java index abeb56c49a..49c9003d8b 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/entity/OssEntity.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/entity/OssEntity.java @@ -8,6 +8,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -29,4 +31,10 @@ public class OssEntity extends BaseEpmetEntity { */ private String url; + /** + * 客户Id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From 9961a4f9a87cee974bba86a0797a250e3233b092 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 21 Jan 2021 14:58:09 +0800 Subject: [PATCH 15/71] =?UTF-8?q?message=E5=BA=93=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/SysSmsDTO.java | 4 ++++ .../src/main/java/com/epmet/entity/SysSmsEntity.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/SysSmsDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/SysSmsDTO.java index d698373e9f..302474874c 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/SysSmsDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/SysSmsDTO.java @@ -58,4 +58,8 @@ public class SysSmsDTO implements Serializable { * 短信模板编码 来源于SmsTemplateConstant */ private String aliyunTemplateCode; + /** + * 客户id + */ + private String customerId; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SysSmsEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SysSmsEntity.java index a7ea2368a2..f31327c695 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SysSmsEntity.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SysSmsEntity.java @@ -8,6 +8,7 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -57,5 +58,10 @@ public class SysSmsEntity extends BaseEpmetEntity { * 发送状态 0:失败 1:成功 */ private Integer status; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } From 4e11250575a294812ecb56643581e201024853d6 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 22 Jan 2021 09:35:53 +0800 Subject: [PATCH 16/71] =?UTF-8?q?gov-issue=E5=BA=93=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8customerId=E7=9A=84=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=AF=B9=E5=BA=94?= =?UTF-8?q?DTO=E5=92=8CEntity=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/IssueProcessDTO.java | 5 +++++ .../main/java/com/epmet/dto/IssueProjectRelationDTO.java | 5 +++++ .../java/com/epmet/dto/IssueSatisfactionDetailDTO.java | 5 +++++ .../com/epmet/dto/IssueSatisfactionStatisticalDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/IssueVoteDetailDTO.java | 5 +++++ .../main/java/com/epmet/dto/IssueVoteStatisticalDTO.java | 5 +++++ .../java/com/epmet/dto/IssueVoteStatisticalDailyDTO.java | 5 +++++ .../main/java/com/epmet/entity/IssueProcessEntity.java | 8 ++++++++ .../java/com/epmet/entity/IssueProjectRelationEntity.java | 8 ++++++++ .../com/epmet/entity/IssueSatisfactionDetailEntity.java | 8 ++++++++ .../epmet/entity/IssueSatisfactionStatisticalEntity.java | 8 ++++++++ .../main/java/com/epmet/entity/IssueVoteDetailEntity.java | 8 ++++++++ .../com/epmet/entity/IssueVoteStatisticalDailyEntity.java | 8 ++++++++ .../java/com/epmet/entity/IssueVoteStatisticalEntity.java | 8 ++++++++ 14 files changed, 91 insertions(+) diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProcessDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProcessDTO.java index a0eeb2df09..4b89f406df 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProcessDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProcessDTO.java @@ -98,4 +98,9 @@ public class IssueProcessDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectRelationDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectRelationDTO.java index dc58cbb60c..0bbe068ff0 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectRelationDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectRelationDTO.java @@ -78,4 +78,9 @@ public class IssueProjectRelationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionDetailDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionDetailDTO.java index ddf04a4ece..9b6497af48 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionDetailDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionDetailDTO.java @@ -83,4 +83,9 @@ public class IssueSatisfactionDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionStatisticalDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionStatisticalDTO.java index 935feef5cd..0580fef1c8 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionStatisticalDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueSatisfactionStatisticalDTO.java @@ -88,4 +88,9 @@ public class IssueSatisfactionStatisticalDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteDetailDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteDetailDTO.java index 777f2dfbbc..f1ae3bca96 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteDetailDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteDetailDTO.java @@ -78,4 +78,9 @@ public class IssueVoteDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDTO.java index 3c25a4dcd5..565cafe7d4 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDTO.java @@ -88,4 +88,9 @@ public class IssueVoteStatisticalDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDailyDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDailyDTO.java index 1434cef2db..e648ec8f50 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDailyDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueVoteStatisticalDailyDTO.java @@ -113,4 +113,9 @@ public class IssueVoteStatisticalDailyDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProcessEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProcessEntity.java index 3dceb5a1e3..3da427a48e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProcessEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProcessEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -68,4 +70,10 @@ public class IssueProcessEntity extends BaseEpmetEntity { * */ private String orgName; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectRelationEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectRelationEntity.java index c1fcf5f579..0a12f9f253 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectRelationEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectRelationEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -48,4 +50,10 @@ public class IssueProjectRelationEntity extends BaseEpmetEntity { */ private String projectId; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionDetailEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionDetailEntity.java index d36fdababc..592fdb69dc 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionDetailEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class IssueSatisfactionDetailEntity extends BaseEpmetEntity { */ private String satisfaction; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionStatisticalEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionStatisticalEntity.java index 243b1e441a..1e688a7f9b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionStatisticalEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueSatisfactionStatisticalEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,10 @@ public class IssueSatisfactionStatisticalEntity extends BaseEpmetEntity { */ private Integer badCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteDetailEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteDetailEntity.java index 1f3381b687..8556dd1c80 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteDetailEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -48,4 +50,10 @@ public class IssueVoteDetailEntity extends BaseEpmetEntity { */ private String attitude; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalDailyEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalDailyEntity.java index 92feff0236..181fae4e3e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalDailyEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalDailyEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -83,4 +85,10 @@ public class IssueVoteStatisticalDailyEntity extends BaseEpmetEntity { */ private Integer votableCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalEntity.java index d287eddf27..c0c3dc8654 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueVoteStatisticalEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,10 @@ public class IssueVoteStatisticalEntity extends BaseEpmetEntity { */ private Integer votableCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From c8500ba1297c7b3c28c1f7fc736cd2a54a0e7c66 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 22 Jan 2021 09:47:58 +0800 Subject: [PATCH 17/71] =?UTF-8?q?gov-project=E5=BA=93=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8customerId=E7=9A=84=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=AF=B9=E5=BA=94?= =?UTF-8?q?DTO=E5=92=8CEntity=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/ProjectSatisfactionDetailDTO.java | 5 +++++ .../com/epmet/dto/ProjectSatisfactionStatisticsDTO.java | 5 +++++ .../com/epmet/entity/ProjectSatisfactionDetailEntity.java | 8 ++++++++ .../epmet/entity/ProjectSatisfactionStatisticsEntity.java | 7 +++++++ 4 files changed, 25 insertions(+) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionDetailDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionDetailDTO.java index 27437172ed..c74b05c16f 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionDetailDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionDetailDTO.java @@ -83,4 +83,9 @@ public class ProjectSatisfactionDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionStatisticsDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionStatisticsDTO.java index 5af3de6cbc..27c2a68a7a 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionStatisticsDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSatisfactionStatisticsDTO.java @@ -88,4 +88,9 @@ public class ProjectSatisfactionStatisticsDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionDetailEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionDetailEntity.java index 6150cd43eb..3947ab57a4 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionDetailEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class ProjectSatisfactionDetailEntity extends BaseEpmetEntity { */ private String satisfaction; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java index 51132be956..5474b38c88 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,9 @@ public class ProjectSatisfactionStatisticsEntity extends BaseEpmetEntity { */ private Integer badCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } From a61c5f4442943edca90bffba9c644be1e48e840a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 Jan 2021 10:06:44 +0800 Subject: [PATCH 18/71] =?UTF-8?q?user=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dataaggre/dto/epmetuser/UserAdviceImgDTO.java | 5 +++++ .../epmet/dataaggre/dto/epmetuser/UserBaseInfoDTO.java | 5 +++++ .../epmet/dataaggre/dto/epmetuser/UserResiInfoDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/UserAdviceImgDTO.java | 8 +++++++- .../src/main/java/com/epmet/dto/UserBaseInfoDTO.java | 5 +++++ .../main/java/com/epmet/entity/UserAdviceImgEntity.java | 9 +++++++++ .../main/java/com/epmet/entity/UserBaseInfoEntity.java | 8 ++++++++ .../main/java/com/epmet/entity/UserResiInfoEntity.java | 8 ++++++++ 8 files changed, 52 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserAdviceImgDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserAdviceImgDTO.java index 029dbac2ee..e3073e113f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserAdviceImgDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserAdviceImgDTO.java @@ -83,4 +83,9 @@ public class UserAdviceImgDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserBaseInfoDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserBaseInfoDTO.java index d610234056..f78f064bd5 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserBaseInfoDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserBaseInfoDTO.java @@ -128,4 +128,9 @@ public class UserBaseInfoDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserResiInfoDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserResiInfoDTO.java index 48474f547f..9051ef7ef9 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserResiInfoDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/UserResiInfoDTO.java @@ -108,4 +108,9 @@ public class UserResiInfoDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java index cb39a925d5..7fbc7cac56 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceImgDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -83,4 +84,9 @@ public class UserAdviceImgDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBaseInfoDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBaseInfoDTO.java index 1530f1f3c9..4fec7858ae 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBaseInfoDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBaseInfoDTO.java @@ -129,4 +129,9 @@ public class UserBaseInfoDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java index 849b0ba467..02215059c4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceImgEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,11 @@ public class UserAdviceImgEntity extends BaseEpmetEntity { */ private String imgUrl; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBaseInfoEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBaseInfoEntity.java index 9a20ef3395..3679656168 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBaseInfoEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBaseInfoEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -97,4 +99,10 @@ public class UserBaseInfoEntity extends BaseEpmetEntity { */ private String headImgUrl; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserResiInfoEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserResiInfoEntity.java index d8896cfa16..7c4266e3c7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserResiInfoEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserResiInfoEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -78,4 +80,10 @@ public class UserResiInfoEntity extends BaseEpmetEntity { */ private String resiVisitId; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From 2d74bb42d073743f3b76861f1ee7fb4a28eb5559 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 Jan 2021 10:19:57 +0800 Subject: [PATCH 19/71] =?UTF-8?q?point=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/PointVerificationLogDTO.java | 5 +++++ .../main/java/com/epmet/entity/PointAdjustmentLogEntity.java | 5 +++++ .../java/com/epmet/entity/PointVerificationLogEntity.java | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java index 3f75c7fecc..1f94db9ccd 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java @@ -103,4 +103,9 @@ public class PointAdjustmentLogDTO implements Serializable { */ private String updatedBy; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java index 9a570898db..80e0e2bad1 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java @@ -118,4 +118,9 @@ public class PointVerificationLogDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java index 2cfdbf6e3b..e013bf7548 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java @@ -73,4 +73,9 @@ public class PointAdjustmentLogEntity extends BaseEpmetEntity { */ private String userId; + /** + * 客户ID + */ + private String customerId; + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java index 531bf9ca93..0b920fbaff 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java @@ -88,4 +88,9 @@ public class PointVerificationLogEntity extends BaseEpmetEntity { */ private String address; + /** + * 客户ID + */ + private String customerId; + } From 0aa52c9c1ba9e64ccc9e6043eaa99cc49f1eb7a4 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 Jan 2021 10:24:07 +0800 Subject: [PATCH 20/71] =?UTF-8?q?=E6=BC=8F=E6=8F=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/entity/PointAdjustmentLogEntity.java | 3 +++ .../main/java/com/epmet/entity/PointVerificationLogEntity.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java index e013bf7548..fcd110bcf0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -76,6 +78,7 @@ public class PointAdjustmentLogEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java index 0b920fbaff..edddc8768f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -91,6 +93,7 @@ public class PointVerificationLogEntity extends BaseEpmetEntity { /** * 客户ID */ + @TableField(fill = FieldFill.INSERT) private String customerId; } From 2785d868d409616513256e2e0f208c2da4bbcb58 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 22 Jan 2021 11:11:32 +0800 Subject: [PATCH 21/71] =?UTF-8?q?gov-project,gov-issue=E5=BA=93=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8customerId=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E5=BA=94DTO=E5=92=8CEntity=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dataaggre/dto/govissue/IssueProcessDTO.java | 5 +++++ .../dataaggre/dto/govissue/IssueProjectRelationDTO.java | 5 +++++ .../dto/govissue/IssueSatisfactionDetailDTO.java | 5 +++++ .../dto/govissue/IssueSatisfactionStatisticalDTO.java | 5 +++++ .../epmet/dataaggre/dto/govissue/IssueVoteDetailDTO.java | 5 +++++ .../dataaggre/dto/govissue/IssueVoteStatisticalDTO.java | 4 ++++ .../dto/govissue/IssueVoteStatisticalDailyDTO.java | 5 +++++ .../dto/govproject/ProjectSatisfactionDetailDTO.java | 5 +++++ .../dto/govproject/ProjectSatisfactionStatisticsDTO.java | 5 +++++ .../dataaggre/entity/govissue/IssueProcessEntity.java | 8 ++++++++ .../entity/govissue/IssueProjectRelationEntity.java | 8 ++++++++ .../entity/govissue/IssueSatisfactionDetailEntity.java | 8 ++++++++ .../govissue/IssueSatisfactionStatisticalEntity.java | 8 ++++++++ .../dataaggre/entity/govissue/IssueVoteDetailEntity.java | 8 ++++++++ .../entity/govissue/IssueVoteStatisticalDailyEntity.java | 8 ++++++++ .../entity/govissue/IssueVoteStatisticalEntity.java | 8 ++++++++ .../govproject/ProjectSatisfactionDetailEntity.java | 8 ++++++++ .../govproject/ProjectSatisfactionStatisticsEntity.java | 8 ++++++++ 18 files changed, 116 insertions(+) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProcessDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProcessDTO.java index 268b2b673c..84987ed9ae 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProcessDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProcessDTO.java @@ -99,4 +99,9 @@ public class IssueProcessDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectRelationDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectRelationDTO.java index 3e3d53ee6e..5635ecfb7e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectRelationDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectRelationDTO.java @@ -79,4 +79,9 @@ public class IssueProjectRelationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionDetailDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionDetailDTO.java index 626afb8f37..60fa8b8e8f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionDetailDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionDetailDTO.java @@ -84,4 +84,9 @@ public class IssueSatisfactionDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionStatisticalDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionStatisticalDTO.java index f80a037561..323fc596ed 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionStatisticalDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueSatisfactionStatisticalDTO.java @@ -89,4 +89,9 @@ public class IssueSatisfactionStatisticalDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteDetailDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteDetailDTO.java index 47e582c324..49a796de58 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteDetailDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteDetailDTO.java @@ -79,4 +79,9 @@ public class IssueVoteDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDTO.java index fdf0e660f3..446c5f9960 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDTO.java @@ -89,4 +89,8 @@ public class IssueVoteStatisticalDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDailyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDailyDTO.java index 0575ed5585..9d450721ae 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDailyDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueVoteStatisticalDailyDTO.java @@ -114,4 +114,9 @@ public class IssueVoteStatisticalDailyDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionDetailDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionDetailDTO.java index 96498ad3ca..9993fd7fd3 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionDetailDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionDetailDTO.java @@ -83,4 +83,9 @@ public class ProjectSatisfactionDetailDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionStatisticsDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionStatisticsDTO.java index 4498a44038..8e2f609f3e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionStatisticsDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectSatisfactionStatisticsDTO.java @@ -88,4 +88,9 @@ public class ProjectSatisfactionStatisticsDTO implements Serializable { */ private Date updatedTime; + /** + * 客户ID + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProcessEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProcessEntity.java index ccb48cb036..d428dd23b2 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProcessEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProcessEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -65,4 +67,10 @@ public class IssueProcessEntity extends BaseEpmetEntity { * */ private String orgName; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProjectRelationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProjectRelationEntity.java index 71152d440e..87b6e925c5 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProjectRelationEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueProjectRelationEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -45,4 +47,10 @@ public class IssueProjectRelationEntity extends BaseEpmetEntity { */ private String projectId; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionDetailEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionDetailEntity.java index 478dd4b6be..0d619ee1e6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionDetailEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -50,4 +52,10 @@ public class IssueSatisfactionDetailEntity extends BaseEpmetEntity { */ private String satisfaction; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionStatisticalEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionStatisticalEntity.java index f97a43be33..455f8ae8f8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionStatisticalEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueSatisfactionStatisticalEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -55,4 +57,10 @@ public class IssueSatisfactionStatisticalEntity extends BaseEpmetEntity { */ private Integer badCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteDetailEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteDetailEntity.java index bb5f005d19..12b62e66d6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteDetailEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -45,4 +47,10 @@ public class IssueVoteDetailEntity extends BaseEpmetEntity { */ private String attitude; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalDailyEntity.java index 6bdcb15195..d2629d0e3e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalDailyEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalDailyEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -82,4 +84,10 @@ public class IssueVoteStatisticalDailyEntity extends BaseEpmetEntity { */ private Integer votableCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalEntity.java index 3cbbfd50d2..61aa3e6e98 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govissue/IssueVoteStatisticalEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govissue; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -55,4 +57,10 @@ public class IssueVoteStatisticalEntity extends BaseEpmetEntity { */ private Integer votableCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionDetailEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionDetailEntity.java index 8017977d0a..2335585826 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionDetailEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionDetailEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govproject; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class ProjectSatisfactionDetailEntity extends BaseEpmetEntity { */ private String satisfaction; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionStatisticsEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionStatisticsEntity.java index 2c0cd8dd2b..6af728022a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionStatisticsEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectSatisfactionStatisticsEntity.java @@ -17,6 +17,8 @@ package com.epmet.dataaggre.entity.govproject; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,10 @@ public class ProjectSatisfactionStatisticsEntity extends BaseEpmetEntity { */ private Integer badCount; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From 7621e513c4706f8611bbaa13517983e41bcd435e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 Jan 2021 14:05:50 +0800 Subject: [PATCH 22/71] =?UTF-8?q?heart=E5=BA=93=E6=B7=BB=E5=8A=A0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7Id=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ActContentDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActLivePicDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActLiveRecDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActOperationRecDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActPointLogDTO.java | 6 ++++++ .../src/main/java/com/epmet/dto/ActSignInPicDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActSignInRecDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActStatisticalDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActSummaryDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActUserLogDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/ActUserRelationDTO.java | 5 +++++ .../src/main/java/com/epmet/dto/LatestActContentDTO.java | 5 +++++ .../src/main/java/com/epmet/entity/ActContentEntity.java | 8 ++++++++ .../src/main/java/com/epmet/entity/ActLivePicEntity.java | 8 ++++++++ .../src/main/java/com/epmet/entity/ActLiveRecEntity.java | 8 ++++++++ .../java/com/epmet/entity/ActOperationRecEntity.java | 8 ++++++++ .../main/java/com/epmet/entity/ActPointLogEntity.java | 8 ++++++++ .../main/java/com/epmet/entity/ActSignInPicEntity.java | 9 +++++++++ .../main/java/com/epmet/entity/ActSignInRecEntity.java | 8 ++++++++ .../main/java/com/epmet/entity/ActStatisticalEntity.java | 8 ++++++++ .../src/main/java/com/epmet/entity/ActSummaryEntity.java | 8 ++++++++ .../src/main/java/com/epmet/entity/ActUserLogEntity.java | 8 ++++++++ .../java/com/epmet/entity/ActUserRelationEntity.java | 8 ++++++++ .../java/com/epmet/entity/LatestActContentEntity.java | 8 ++++++++ .../java/com/epmet/entity/UserKindnessTimeLogEntity.java | 8 ++++++++ 25 files changed, 166 insertions(+) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActContentDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActContentDTO.java index 4ca6b53a0d..34b2b31423 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActContentDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActContentDTO.java @@ -89,4 +89,9 @@ public class ActContentDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLivePicDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLivePicDTO.java index 3ce290e641..01d2cfc1da 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLivePicDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLivePicDTO.java @@ -83,4 +83,9 @@ public class ActLivePicDTO implements Serializable { */ private String delFlag; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLiveRecDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLiveRecDTO.java index 46a30b97d6..6cf15c2095 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLiveRecDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActLiveRecDTO.java @@ -99,4 +99,9 @@ public class ActLiveRecDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file 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 955997a340..e0c20d99b2 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 @@ -92,4 +92,9 @@ public class ActOperationRecDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file 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 6b6daf74c2..28676fae30 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,4 +94,10 @@ public class ActPointLogDTO implements Serializable { * 更新时间 */ private Date updatedTime; + + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInPicDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInPicDTO.java index 632b3f09ec..bcc31e2525 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInPicDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInPicDTO.java @@ -83,4 +83,9 @@ public class ActSignInPicDTO implements Serializable { */ private String delFlag; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInRecDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInRecDTO.java index e8cb87fa83..ab374cddfe 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInRecDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSignInRecDTO.java @@ -109,4 +109,9 @@ public class ActSignInRecDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ 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 b1bc9f1898..d6d6ecdb90 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 @@ -114,4 +114,9 @@ public class ActStatisticalDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSummaryDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSummaryDTO.java index 2de3fd0ce7..41bb47f832 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSummaryDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActSummaryDTO.java @@ -88,4 +88,9 @@ public class ActSummaryDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file 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 a7bff8713b..6816c05f9d 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 @@ -96,4 +96,9 @@ public class ActUserLogDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java index 2c7c7a2d8d..a28349c126 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java @@ -133,4 +133,9 @@ public class ActUserRelationDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActContentDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActContentDTO.java index 79d7f858d1..bf365960a4 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActContentDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActContentDTO.java @@ -88,4 +88,9 @@ public class LatestActContentDTO implements Serializable { */ private Date updatedTime; + /** + * 客户id + */ + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActContentEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActContentEntity.java index a39d4a48c5..c963c888df 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActContentEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActContentEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,10 @@ public class ActContentEntity extends BaseEpmetEntity { */ private Integer orderNum; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLivePicEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLivePicEntity.java index 07c47eff6f..23fa13cc21 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLivePicEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLivePicEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class ActLivePicEntity extends BaseEpmetEntity { */ private Integer sort; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLiveRecEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLiveRecEntity.java index 8d3373cd76..ae2ecbc7e2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLiveRecEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActLiveRecEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -69,4 +71,10 @@ public class ActLiveRecEntity extends BaseEpmetEntity { */ private String desc; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } 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 5a54f8f5c5..bb747c2310 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 @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -57,4 +59,10 @@ public class ActOperationRecEntity extends BaseEpmetEntity { * 备注,取消活动时此列有值 */ private String remark; + + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } 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 e18170b8a3..fb558c602e 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 @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -61,4 +63,10 @@ public class ActPointLogEntity extends BaseEpmetEntity { */ private String remark; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInPicEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInPicEntity.java index fd95c558cc..58fc1fbe95 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInPicEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInPicEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,11 @@ public class ActSignInPicEntity extends BaseEpmetEntity { */ private Integer sort; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInRecEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInRecEntity.java index 9ceb0bb53a..c22b7322ee 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInRecEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSignInRecEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -79,4 +81,10 @@ public class ActSignInRecEntity extends BaseEpmetEntity { */ private String liveId; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } 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 cc1a41fa9a..3ea3a14cd2 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 @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -80,4 +82,10 @@ public class ActStatisticalEntity extends BaseEpmetEntity { */ private Integer denyRewardUserNum; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSummaryEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSummaryEntity.java index 6a50b01aae..a3e46a4196 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSummaryEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActSummaryEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,10 @@ public class ActSummaryEntity extends BaseEpmetEntity { */ private Integer orderNum; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } 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 751f535f5f..8f9ba15304 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 @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -62,4 +64,10 @@ public class ActUserLogEntity extends BaseEpmetEntity { */ private String reason; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java index f5af4a176d..bbb73239f9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -102,4 +104,10 @@ public class ActUserRelationEntity extends BaseEpmetEntity { */ private String denyRewardReason; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActContentEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActContentEntity.java index 0ccb343b75..0d78cdb59d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActContentEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActContentEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -58,4 +60,10 @@ public class LatestActContentEntity extends BaseEpmetEntity { */ private Integer orderNum; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java index a1c8c8dcd6..79f151aaf4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/UserKindnessTimeLogEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -53,4 +55,10 @@ public class UserKindnessTimeLogEntity extends BaseEpmetEntity { */ private Integer kindnessTime; + /** + * 客户id + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From 730a3d45f9f874beb8ceff7f2ffb0a839b228016 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 26 Jan 2021 11:21:08 +0800 Subject: [PATCH 23/71] =?UTF-8?q?=E6=B7=BB=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/IndexGroupDetailTemplateEntity.java | 8 ++++++++ .../evaluationindex/screen/IndexGroupTemplateEntity.java | 8 ++++++++ .../screen/ScreenDifficultyImgDataEntity.java | 8 ++++++++ .../evaluationindex/screen/ScreenEventImgDataEntity.java | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java index e75d36927b..9e821ff068 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity.evaluationindex.screen; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -82,4 +84,10 @@ public class IndexGroupDetailTemplateEntity extends BaseEpmetEntity { */ private String correlation; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java index f8cdc843c5..6e8421aa35 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity.evaluationindex.screen; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -60,4 +62,10 @@ public class IndexGroupTemplateEntity extends BaseEpmetEntity { */ private String allIndexCodePath; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyImgDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyImgDataEntity.java index 469670b67f..bddf4e912a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyImgDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyImgDataEntity.java @@ -1,5 +1,7 @@ package com.epmet.entity.evaluationindex.screen; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.AllArgsConstructor; @@ -26,4 +28,10 @@ public class ScreenDifficultyImgDataEntity extends BaseEpmetEntity { private String eventImgUrl; private Integer sort; + + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenEventImgDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenEventImgDataEntity.java index 8609b4f1b9..5e15be47eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenEventImgDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenEventImgDataEntity.java @@ -17,6 +17,8 @@ package com.epmet.entity.evaluationindex.screen; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; @@ -50,4 +52,10 @@ public class ScreenEventImgDataEntity extends BaseEpmetEntity { */ private Integer sort; + /** + * 客户ID + */ + @TableField(fill = FieldFill.INSERT) + private String customerId; + } From 037bfde241cab1b0e90d38ae27c9b5c459ff73df Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 26 Jan 2021 15:48:57 +0800 Subject: [PATCH 24/71] =?UTF-8?q?=E7=BB=99header=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=EF=BC=8C=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=9C=89customerI?= =?UTF-8?q?d=E5=86=8D=E6=B7=BB=E5=8A=A0=E5=88=B0header=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/auth/InternalAuthProcessor.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java index ec38fe805c..30e8d2b457 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -105,12 +105,15 @@ public class InternalAuthProcessor extends AuthProcessor { if (baseTokenDto != null) { String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId(); logger.info("redisKey=" + redisKey); - exchange.getRequest().mutate() - .header(Constant.APP_USER_KEY, redisKey) - .header(AppClientConstant.APP,baseTokenDto.getApp()) - .header(AppClientConstant.CLIENT,baseTokenDto.getClient()) - .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()) - .header(AppClientConstant.CUSTOMER_ID,baseTokenDto.getCustomerId()); + + ServerHttpRequest.Builder builder = exchange.getRequest().mutate(); + builder.header(Constant.APP_USER_KEY, redisKey); + builder.header(AppClientConstant.APP,baseTokenDto.getApp()); + builder.header(AppClientConstant.CLIENT,baseTokenDto.getClient()); + builder.header(AppClientConstant.USER_ID,baseTokenDto.getUserId()); + if (StringUtils.isNotBlank(baseTokenDto.getCustomerId())) { + builder.header(AppClientConstant.CUSTOMER_ID,baseTokenDto.getCustomerId()); + } if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端 if(StringUtils.isNotBlank(customerId)){ From c9d326311a12c7fb68ab1abab5b91471ea27020b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 26 Jan 2021 16:53:06 +0800 Subject: [PATCH 25/71] =?UTF-8?q?=E6=B7=BB=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/IndexGroupDetailTemplateEntity.java | 6 ------ .../evaluationindex/screen/IndexGroupTemplateEntity.java | 6 ------ 2 files changed, 12 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java index 9e821ff068..f8e3831864 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupDetailTemplateEntity.java @@ -84,10 +84,4 @@ public class IndexGroupDetailTemplateEntity extends BaseEpmetEntity { */ private String correlation; - /** - * 客户ID - */ - @TableField(fill = FieldFill.INSERT) - private String customerId; - } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java index 6e8421aa35..0db5a3da18 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexGroupTemplateEntity.java @@ -62,10 +62,4 @@ public class IndexGroupTemplateEntity extends BaseEpmetEntity { */ private String allIndexCodePath; - /** - * 客户ID - */ - @TableField(fill = FieldFill.INSERT) - private String customerId; - } From 906ab6d097cdf9f17e46a92d8d89208c517e52bf Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 1 Feb 2021 09:27:35 +0800 Subject: [PATCH 26/71] =?UTF-8?q?=E8=AF=9D=E9=A2=98insertOne=20=20?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=B7=BB=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PointAdjustmentLogServiceImpl.java | 1 + .../impl/ResiTopicCommentServiceImpl.java | 6 ++++ .../service/impl/ResiTopicServiceImpl.java | 29 ++++++++++++++++++- .../mapper/topic/ResiTopicAttachmentDao.xml | 6 ++++ .../resources/mapper/topic/ResiTopicDao.xml | 6 ++++ .../mapper/topic/ResiTopicOperationDao.xml | 6 ++++ 6 files changed, 53 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java index cdbf4e882b..3d943ba887 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java @@ -219,6 +219,7 @@ public class PointAdjustmentLogServiceImpl extends BaseServiceImpl statisticalWrapper = new QueryWrapper<>(); @@ -678,6 +700,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl ids = new ArrayList<>(); List topicOperationList = new ArrayList<>(); ResiTopicOperationEntity resiTopicOperationEntity = null; + //2021/1/29 客户Id + String customerId = loginUserUtil.getLoginUserCustomerId(); for (ResiTopicDTO dto : list) { ids.add(dto.getId()); resiTopicOperationEntity = new ResiTopicOperationEntity(); @@ -985,6 +1011,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl sort, + + customer_id, + created_by, @@ -59,6 +62,9 @@ #{sort}, + + #{customerId}, + #{createdBy}, diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml index a60dd51a97..b06e35bcf6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml @@ -58,6 +58,9 @@ dimension, + + customer_id, + created_by, @@ -97,6 +100,9 @@ #{dimension}, + + #{customerId}, + #{createdBy}, diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml index be6c114d66..90ab9bffd2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml @@ -22,6 +22,9 @@ operation_reason, + + customer_id, + created_by, @@ -42,6 +45,9 @@ #{operationReason}, + + #{customerId}, + #{createdBy}, From f86d92acf55bafe70b88428d896c484f350f7fd1 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 1 Feb 2021 11:06:19 +0800 Subject: [PATCH 27/71] =?UTF-8?q?=E6=B7=BB=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...reenGrassrootsGovernDataAbsorptionServiceImpl.java | 4 +++- .../screen/impl/ShiBeiScreenCollServiceImpl.java | 5 +++++ .../screen/ScreenDifficultyDataDao.xml | 2 ++ .../evaluationindex/screen/ScreenEventImgDataDao.xml | 2 ++ .../com/epmet/service/impl/ActLiveRecServiceImpl.java | 2 ++ .../epmet/service/impl/ActSignInRecServiceImpl.java | 2 ++ .../src/main/resources/mapper/ActLiveRecDao.xml | 2 ++ .../src/main/resources/mapper/ActSignInRecDao.xml | 2 ++ .../epmet/dto/result/IssuesToBeCountedResultDTO.java | 2 ++ .../epmet/service/impl/IssueProcessServiceImpl.java | 3 ++- .../java/com/epmet/service/impl/IssueServiceImpl.java | 1 + .../impl/IssueVoteStatisticalDailyServiceImpl.java | 3 ++- .../service/impl/IssueVoteStatisticalServiceImpl.java | 11 ++++++++--- .../resources/mapper/IssueVoteStatisticalDailyDao.xml | 1 + .../com/epmet/service/impl/ProjectServiceImpl.java | 1 + .../main/resources/mapper/ProjectOrgRelationDao.xml | 4 ++++ .../dto/topic/form/ResiTopicTurnIssueFromDTO.java | 2 ++ .../modules/topic/controller/ResiTopicController.java | 7 ++++++- .../service/impl/ResiTopicCommentServiceImpl.java | 2 +- .../topic/service/impl/ResiTopicServiceImpl.java | 3 +++ .../topic/service/impl/TopicDraftServiceImpl.java | 1 + .../resources/mapper/topic/ResiTopicAttachmentDao.xml | 2 ++ .../resources/mapper/topic/ResiTopicOperationDao.xml | 6 ++++++ 23 files changed, 62 insertions(+), 8 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index 5a560cd05c..4a3642c618 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -185,7 +185,9 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr imgMap.values().forEach(list -> {imgList.addAll(list);}); difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); - + imgList.forEach(item -> { + item.setCustomerId(param.getCustomerId()); + }); screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java index cd26e20bd2..cacc9ac2ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java @@ -33,6 +33,7 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerBizOrgEntity; import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; +import com.epmet.service.evaluationindex.screen.ScreenEventImgDataService; import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -94,6 +95,8 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { private ScreenIndexDataYearlyDao screenIndexDataYearlyDao; @Autowired private ScreenPublicPartiTotalDataDao screenPublicPartiTotalDataDao; + @Autowired + private ScreenEventImgDataService screenEventImgDataService; @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @@ -194,6 +197,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { for (int j = NumConstant.ZERO; j < formDTO.getDataList().get(i).getImgDataList().size(); j++) { // 新增 中央区-事件数据图片数据 表 ScreenEventImgDataEntity imgDataEntity = new ScreenEventImgDataEntity(); + imgDataEntity.setCustomerId(customerId); imgDataEntity.setEventId(formDTO.getDataList().get(i).getImgDataList().get(j).getEventId()); imgDataEntity.setEventImgUrl(formDTO.getDataList().get(i).getImgDataList().get(j).getImgUrl()); imgDataEntity.setSort(formDTO.getDataList().get(i).getImgDataList().get(j).getSort()); @@ -205,6 +209,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { if (isImgUrl) { screenEventImgDataDao.delEventImgDataByEvent(events); screenEventImgDataDao.batchInsertEventImgData(eventImgDataList); +// screenEventImgDataService.insertBatch(eventImgDataList); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml index 100a2c29dd..9860bee6f3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml @@ -193,6 +193,7 @@ insert into screen_difficulty_img_data ( ID, + CUSTOMER_ID, EVENT_ID, EVENT_IMG_URL, SORT, @@ -206,6 +207,7 @@ ( (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, #{item.eventId}, #{item.eventImgUrl}, #{item.sort}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenEventImgDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenEventImgDataDao.xml index bc5228b426..e472b40ac1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenEventImgDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenEventImgDataDao.xml @@ -16,6 +16,7 @@ insert into screen_event_img_data ( ID, + CUSTOMER_ID, EVENT_ID, EVENT_IMG_URL, SORT, @@ -29,6 +30,7 @@ ( (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, #{item.eventId}, #{item.eventImgUrl}, #{item.sort}, 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 30d9b151ec..aeb67a2314 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 @@ -152,6 +152,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl INSERT INTO act_live_rec ( ID, + CUSTOMER_ID, ACT_ID, USER_ID, LONGITUDE, @@ -67,6 +68,7 @@ UPDATED_TIME) VALUES ( #{id}, + #{customerId}, #{actId}, #{userId}, #{longitude}, 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 c1e6956935..7127695f2d 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 @@ -24,6 +24,7 @@ INSERT INTO act_sign_in_rec ( ID, + CUSTOMER_ID, ACT_ID, USER_ID, LONGITUDE, @@ -40,6 +41,7 @@ UPDATED_TIME) VALUES ( #{id}, + #{customerId}, #{actId}, #{userId}, #{longitude}, diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssuesToBeCountedResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssuesToBeCountedResultDTO.java index 9d6b823ec7..1385f8a056 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssuesToBeCountedResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssuesToBeCountedResultDTO.java @@ -18,6 +18,8 @@ public class IssuesToBeCountedResultDTO implements Serializable { * */ private String issueId; + private String customerId; + /** * 议题状态 * */ diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java index db8fb0d7eb..6fd7d09d5e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProcessServiceImpl.java @@ -124,7 +124,8 @@ public class IssueProcessServiceImpl extends BaseServiceImpl imp //2.新增议题流程 IssueProcessDTO issueProcessDTO = new IssueProcessDTO(); + issueProcessDTO.setCustomerId(issueShiftedFromTopicFormDTO.getCustomerId()); issueProcessDTO.setIssueId(issueDTO.getId()); issueProcessDTO.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING); issueProcessDTO.setOrgType(ModuleConstants.ISSUE_PROCESS_ORG_TYPE_GRID); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java index f751546313..a20e36eeec 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java @@ -161,6 +161,7 @@ public class IssueVoteStatisticalDailyServiceImpl extends BaseServiceImpl NumConstant.ZERO){ - baseDao.insertBatch(dailyListToInsert); + insertBatch(dailyListToInsert); } if(dailyListToUpdate.size() > NumConstant.ZERO){ baseDao.updateBatch(dailyListToUpdate); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index fc8a5138de..2eb7a22ad7 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -51,12 +51,12 @@ import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.IssueVoteDetailService; import com.epmet.service.IssueVoteStatisticalService; import com.epmet.utils.ModuleConstants; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; 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.time.LocalDate; import java.time.LocalDateTime; @@ -376,7 +376,11 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl issueVoteStatisticalEntityList = ConvertUtils.sourceToTarget(summary, + IssueVoteStatisticalEntity.class); + insertBatch(issueVoteStatisticalEntityList); + } } } else if (ids.size() < statisiticalIds.size()) { @@ -407,8 +411,9 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl listToAdd = new ArrayList<>(); setVotableCountsAndUpdateCache(listToAdd,issues,votableCountMap); + List issueVoteStatisticalEntityList = ConvertUtils.sourceToTarget(listToAdd, IssueVoteStatisticalEntity.class); // 批量新增listToAdd - baseDao.insertBatch(listToAdd); + insertBatch(issueVoteStatisticalEntityList); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml index 84d66f138b..5a986e4576 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml @@ -28,6 +28,7 @@ SELECT issue.ID AS ISSUE_ID, issue.ISSUE_STATUS, + issue.CUSTOMER_ID, vote.ATTITUDE, IFNULL(vote.VOTE_COUNT,0)AS VOTE_COUNT, totalvote.ATTITUDE AS ATTITUDE_UP_TO_YESTERDAY, diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index e61170726b..e4981a09a6 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -1282,6 +1282,7 @@ public class ProjectServiceImpl extends BaseServiceImpl INSERT INTO project_org_relation( ID, + CUSTOMER_ID, PROJECT_STAFF_ID, INFORMED_DATE, CREATED_TIME, @@ -61,6 +62,7 @@ ( (SELECT REPLACE(UUID(),'-','') as id), + #{item.customerId}, #{item.projectStaffId}, @@ -108,6 +110,7 @@ INSERT INTO project_org_relation( ID, + CUSTOMER_ID, PROJECT_STAFF_ID, INFORMED_DATE, HANDLED_DATE, @@ -124,6 +127,7 @@ ( (SELECT REPLACE(UUID(),'-','') as id), + #{item.customerId}, #{item.projectStaffId}, #{item.informedDate}, #{item.handledDate}, diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicTurnIssueFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicTurnIssueFromDTO.java index 62b7f4f4a7..63c91c86ee 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicTurnIssueFromDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicTurnIssueFromDTO.java @@ -48,4 +48,6 @@ public class ResiTopicTurnIssueFromDTO implements Serializable { private String actionType; + private String customerId; + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index 564e43b98e..a104d2a7f4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -241,6 +241,7 @@ public class ResiTopicController { @PostMapping("turnintoissue") public Result turnIntoIssue(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO){ topicTurnIssueFromDTO.setUserId(tokenDto.getUserId()); + topicTurnIssueFromDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(topicTurnIssueFromDTO); topicService.shiftIssue(topicTurnIssueFromDTO); return new Result(); @@ -256,6 +257,7 @@ public class ResiTopicController { @PostMapping("turnintoissuev2") public Result turnIntoIssueV2(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO){ topicTurnIssueFromDTO.setUserId(tokenDto.getUserId()); + topicTurnIssueFromDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(topicTurnIssueFromDTO); return new Result().ok(topicService.shiftIssueV2(topicTurnIssueFromDTO)); } @@ -271,6 +273,7 @@ public class ResiTopicController { @PostMapping("editissueapplication") public Result editIssueApplication(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicTurnIssueFromDTO param){ param.setUserId(tokenDto.getUserId()); + param.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(param); return new Result().ok(topicService.shiftIssueV2(param)); } @@ -283,7 +286,9 @@ public class ResiTopicController { * @date 2020.11.23 03:08 */ @PostMapping("fetchtopicinfowhenauditissue") - public Result fetchTopicInfoWhenAuditIssue(@RequestBody ResiTopicTurnIssueFromDTO param){ + public Result fetchTopicInfoWhenAuditIssue(@LoginUser TokenDto tokenDto, + @RequestBody ResiTopicTurnIssueFromDTO param){ + param.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(topicService.getIssueInfoWhenAudit(param)); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java index 6d2c8d25b2..fbb9b92955 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java @@ -237,7 +237,7 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl topicAttachments = ConvertUtils.sourceToTarget(attachmentList, ResiTopicAttachmentEntity.class); topicAttachments.forEach(item -> { item.setId(null); + item.setCustomerId(tokenDto.getCustomerId()); item.setTopicId(resiTopic.getId()); item.setCreatedBy(draft.getCreatedBy()); item.setUpdatedBy(draft.getCreatedBy()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml index 42224c71f0..fbfc2e09eb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicAttachmentDao.xml @@ -82,6 +82,7 @@ insert into resi_topic_attachment ( id, + customer_id, topic_id, attachment_name, attachment_format, @@ -99,6 +100,7 @@ ( (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, #{item.topicId}, #{item.attachmentName}, #{item.attachmentFormat}, diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml index 90ab9bffd2..52475c6e72 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicOperationDao.xml @@ -78,6 +78,9 @@ operation_reason, + + customer_id, + created_by, @@ -104,6 +107,9 @@ #{operationReason}, + + #{customerId}, + #{createdBy}, From 1ca8cc7178e974ca3a479b66b8132b8b5ad15fe3 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 4 Mar 2021 17:50:55 +0800 Subject: [PATCH 28/71] =?UTF-8?q?issue=20vote=20=E6=8C=89=E6=97=A5?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?customerId=E5=A1=AB=E5=85=85=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IssueVoteStatisticalDailyServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java index a20e36eeec..31e445c149 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalDailyServiceImpl.java @@ -148,10 +148,12 @@ public class IssueVoteStatisticalDailyServiceImpl extends BaseServiceImpl Date: Mon, 8 Mar 2021 14:37:40 +0800 Subject: [PATCH 29/71] =?UTF-8?q?=E8=BD=AC=E8=AE=AE=E9=A2=98bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/IssueServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 3534785c92..dccdc4026a 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -280,7 +280,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp issueShiftedFromTopicFormDTO.getIssueTitle() )); int issueProcessAffectedRow = issueProcessService.insertOne(issueProcessDTO); - if(issueProcessAffectedRow != NumConstant.ONE || StringUtils.isBlank(issueProcessDTO.getId())){ + if(issueProcessAffectedRow != NumConstant.ONE ){ logger.warn(String.format( ModuleConstants.FAILURE_TO_ADD_ISSUE_PROCESS_LOG_TEMPLATE,issueDTO.getId())); throw new RenException(ModuleConstants.FAILURE_TO_ADD_ISSUE_PROCESS); From 7dc05e518358b244c2e6962bac618d9dbbf2bc5b Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 8 Mar 2021 15:59:38 +0800 Subject: [PATCH 30/71] =?UTF-8?q?=E8=AF=9D=E9=A2=98=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BB=8Etoken=E8=8E=B7?= =?UTF-8?q?=E5=8F=96customerId=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/modules/topic/service/impl/TopicDraftServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java index e3e6f53f53..4ee3f577b9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java @@ -752,7 +752,6 @@ public class TopicDraftServiceImpl extends BaseServiceImpl topicAttachments = ConvertUtils.sourceToTarget(attachmentList, ResiTopicAttachmentEntity.class); topicAttachments.forEach(item -> { item.setId(null); - item.setCustomerId(tokenDto.getCustomerId()); item.setTopicId(resiTopic.getId()); item.setCreatedBy(draft.getCreatedBy()); item.setUpdatedBy(draft.getCreatedBy()); From 0856178eba669d94aa7762848999feacd15f7f2f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 8 Mar 2021 16:28:38 +0800 Subject: [PATCH 31/71] =?UTF-8?q?user=E3=80=81user=5Fwechat=E8=A1=A8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE=E8=B5=8B=E5=80=BCcustomerI?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/UserServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index 784a414729..2914ce40b1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java @@ -246,12 +246,14 @@ public class UserServiceImpl extends BaseServiceImpl implem UserEntity userEntity = new UserEntity(); userEntity.setFromApp(UserConstant.APP_RESI); userEntity.setFromClient(UserConstant.CLIENT_WX); + userEntity.setCustomerId(wechatDTO.getCustomerId()); if (baseDao.insert(userEntity) < NumConstant.ONE) { log.error("小程序登陆,居民端user表新增数据失败"); throw new RenException(UserConstant.SAVE_USER); } //user_wechat表新增 userWechatEntity.setUserId(userEntity.getId()); + userWechatEntity.setCustomerId(wechatDTO.getCustomerId()); if (userWechatDao.insert(userWechatEntity) < NumConstant.ONE) { log.error("小程序登陆,居民端user_wechat表新增数据失败"); throw new RenException(UserConstant.SAVE_USER_WECHAT); From e2c870b89dcdcb7c91d7bdacc1334cde08353d85 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 15 Mar 2021 10:53:45 +0800 Subject: [PATCH 32/71] =?UTF-8?q?customerId=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/service/impl/SsoServiceImpl.java | 1 + .../src/main/java/com/epmet/dto/form/UserInfoFormDTO.java | 5 +++++ .../src/main/java/com/epmet/entity/UserEntity.java | 2 +- .../main/java/com/epmet/service/impl/UserServiceImpl.java | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index c05df9f3a2..f6f9e52dc5 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java @@ -111,6 +111,7 @@ public class SsoServiceImpl implements SsoService { userInfoFormDTO.setUid(userInfo.getOpenId()); userInfoFormDTO.setName(userInfo.getName()); userInfoFormDTO.setMobile(userInfo.getMobile()); + userInfoFormDTO.setCustomerId(customerId); Result userDTOResult = epmetUserOpenFeignClient.saveUserInfo(userInfoFormDTO); if (!userDTOResult.success()){ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserInfoFormDTO.java index 6c349d424e..a2f7a2772b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserInfoFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserInfoFormDTO.java @@ -37,4 +37,9 @@ public class UserInfoFormDTO implements Serializable { private String account; private String userId; + + /** + * 客户ID + */ + private String customerId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java index 167f2c8bde..c8a6f1d574 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserEntity.java @@ -35,6 +35,6 @@ public class UserEntity extends BaseEpmetEntity { * 客户ID */ @TableField(fill = FieldFill.INSERT) - private String customerId; + private String customerId = ""; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index 2914ce40b1..58a48ca9ac 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java @@ -298,11 +298,13 @@ public class UserServiceImpl extends BaseServiceImpl implem UserEntity userEntity = new UserEntity(); userEntity.setFromApp(UserConstant.APP_RESI); userEntity.setFromClient(UserConstant.APP); + userEntity.setCustomerId(formDTO.getCustomerId()); if (baseDao.insert(userEntity) < NumConstant.ONE) { log.error("小程序登陆,居民端user表新增数据失败"); throw new RenException(UserConstant.SAVE_USER); } UserWechatEntity entity = new UserWechatEntity(); + entity.setCustomerId(formDTO.getCustomerId()); entity.setMobile(formDTO.getMobile()); entity.setUserId(userEntity.getId()); entity.setNickname(formDTO.getName()); From fd8a83dd0a733e98b97dfde1d38bd27f4c0924b2 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 15 Mar 2021 13:34:55 +0800 Subject: [PATCH 33/71] =?UTF-8?q?customerId=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/UserWechatDao.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index f59dc05973..06491cfb66 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -49,7 +49,8 @@ MOBILE = #{mobile}, UPDATED_BY = #{userId}, - UPDATED_TIME = NOW() + UPDATED_TIME = NOW(), + CUSTOMER_ID = #{customerId} WHERE DEL_FLAG = 0 From e1a415720ac85acb667c77d973a3b90d815b89dc Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 15 Mar 2021 13:56:17 +0800 Subject: [PATCH 34/71] =?UTF-8?q?=E8=B5=8B=E5=80=BCcustomerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/topic/service/impl/TopicDraftServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java index 4ee3f577b9..43819c1c4f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java @@ -831,6 +831,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl Date: Mon, 15 Mar 2021 16:13:24 +0800 Subject: [PATCH 35/71] =?UTF-8?q?saveconfig=E5=92=8Csaveroleopes=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/AccessConfigOpesFormDTO.java | 2 ++ .../java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java | 3 +++ .../java/com/epmet/controller/AccessConfigController.java | 5 +++-- .../main/java/com/epmet/service/AccessConfigService.java | 4 ++-- .../com/epmet/service/impl/AccessConfigServiceImpl.java | 6 ++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOpesFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOpesFormDTO.java index 8a84ddf960..648fbea210 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOpesFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOpesFormDTO.java @@ -11,6 +11,8 @@ public class AccessConfigOpesFormDTO { @NotBlank(message = "角色ID不能为空") private String roleId; + @NotBlank(message = "客户ID不能为空") + private String customerId; private List opes; } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java index 6a918b5bb2..b2e2881fe7 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java @@ -15,4 +15,7 @@ public class AccessConfigSaveConfigDTO { private Set scopeKeys; private Set settingKeys; + @NotBlank(message = "客户ID不能为空") + private String customerId; + } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java index 0983ca46a4..49ab6f6f9d 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java @@ -51,7 +51,7 @@ public class AccessConfigController { */ @PostMapping("saveroleopes") public Result saveRoleOpes(@RequestBody AccessConfigOpesFormDTO formDTO) { - accessConfigService.saveRoleOpes(formDTO.getRoleId(), formDTO.getOpes()); + accessConfigService.saveRoleOpes(formDTO.getRoleId(), formDTO.getOpes(), formDTO.getCustomerId()); return new Result(); } @@ -77,7 +77,8 @@ public class AccessConfigController { String roleId = config.getRoleId(); String operationKey = config.getOperationKey(); Set scopeKeys = config.getScopeKeys(); - accessConfigService.saveConfig(roleId, operationKey, scopeKeys); + String customerId = config.getCustomerId(); + accessConfigService.saveConfig(roleId, operationKey, scopeKeys, customerId); return new Result(); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java index a2b1850e04..4d50c59ebe 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java @@ -12,11 +12,11 @@ import java.util.Set; public interface AccessConfigService { List listOpesByRole(String roleId); - void saveRoleOpes(String roleId, List opes); + void saveRoleOpes(String roleId, List opes, String customerId); AccessConfigOptionsResultDTO listScopeOptionsForAccessConfig(String roleId, String operationKey); - void saveConfig(String roleId, String operationKey, Set scopeKeys); + void saveConfig(String roleId, String operationKey, Set scopeKeys, String customerId); List listRoleDefaultOpsByRoleKey(String roleKey); diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java index 52a0ae282c..ab5ef83012 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java @@ -54,7 +54,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { @Override @Transactional(rollbackFor = Exception.class) - public void saveRoleOpes(String roleId, List opes) { + public void saveRoleOpes(String roleId, List opes, String customerId) { List operationsDB = roleOperationDao.listOperationsByRoleId(roleId); Set opeKeysDB = operationsDB.stream().map(opeDB -> opeDB.getOperationKey()).collect(Collectors.toSet()); Set opeKeysForm = opes.stream().map(opeForm -> opeForm.getOperationKey()).collect(Collectors.toSet()); @@ -80,6 +80,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { RoleOperationEntity newRoleOpe = new RoleOperationEntity(); newRoleOpe.setRoleId(roleId); newRoleOpe.setOperationKey(s); + newRoleOpe.setCustomerId(customerId); roleOperationDao.insert(newRoleOpe); } } @@ -100,7 +101,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { @Override @Transactional - public void saveConfig(String roleId, String operationKey, Set scopeKeys) { + public void saveConfig(String roleId, String operationKey, Set scopeKeys, String customerId) { List scopesDB = roleScopeDao.listScopeEntities(roleId, operationKey); // 数据库中已有的scopeKey列表 Set scopeKeysDB = scopesDB.stream().map(scope -> scope.getScopeKey()).collect(Collectors.toSet()); @@ -119,6 +120,7 @@ public class AccessConfigServiceImpl implements AccessConfigService { rs2Add.setRoleId(roleId); rs2Add.setOperationKey(operationKey); rs2Add.setScopeKey(scopeKey); + rs2Add.setCustomerId(customerId); roleScopeDao.insert(rs2Add); } }); From f1ffb73dd9180d986dead5d9d3dc1d4909d9d6ba Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 15 Mar 2021 17:30:28 +0800 Subject: [PATCH 36/71] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E8=AE=BE=E7=BD=AE=20customer=5Fhome=5Fdetail=E8=A1=A8?= =?UTF-8?q?=E5=AE=A2=E6=88=B7Id=E6=9C=AA=E8=B5=8B=E5=80=BC=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/HomeServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java index c2163d560c..edac1cfd95 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/HomeServiceImpl.java @@ -118,7 +118,10 @@ public class HomeServiceImpl implements HomeService { customerHomeDetailDao.deleteCustomerHomeDetailByHomeId(customerHomeEntity.getId()); List list = ConvertUtils.sourceToTarget(formDTO.getComponentList(), CustomerHomeDetailEntity.class); - list.forEach(homeDetail -> homeDetail.setHomeId(customerHomeEntity.getId())); + list.forEach(homeDetail -> { + homeDetail.setHomeId(customerHomeEntity.getId()); + homeDetail.setCustomerId(formDTO.getCustomerId()); + }); //将数据存入客户首页详情表 customerHomeDetailService.insertBatch(list); From 155344781fbe12c878c208ad5359d8aa135612bc Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 23 Mar 2021 11:05:48 +0800 Subject: [PATCH 37/71] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=201.=E8=8E=B7?= =?UTF-8?q?=E5=8F=96open-api=20accessToken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-security/pom.xml | 26 ++++ .../commons/security/jwt/JwtTokenUtils.java | 112 ++++++++++++++++++ .../sign/openapi/OpenApiSignUtils.java | 76 ++++++++++++ .../tools/exception/EpmetErrorCode.java | 5 +- .../epmet/commons/tools/redis/RedisKeys.java | 10 ++ .../commons/tools/utils/ConvertUtils.java | 40 ++++++- epmet-commons/pom.xml | 3 +- .../epmet/dto/form/AccessTokenFormDTO.java | 19 +++ .../epmet-ext/epmet-ext-server/pom.xml | 10 ++ .../java/com/epmet/config/OpenApiConfig.java | 15 +++ .../OpenApiAccessTokenController.java | 88 ++++++++++++++ .../service/OpenApiAccessTokenService.java | 15 +++ .../impl/OpenApiAccessTokenServiceImpl.java | 44 +++++++ .../src/main/resources/bootstrap.yml | 5 + 14 files changed, 462 insertions(+), 6 deletions(-) create mode 100644 epmet-commons/epmet-commons-security/pom.xml create mode 100644 epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java create mode 100644 epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java create mode 100644 epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/OpenApiConfig.java create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java diff --git a/epmet-commons/epmet-commons-security/pom.xml b/epmet-commons/epmet-commons-security/pom.xml new file mode 100644 index 0000000000..a4bebe4c54 --- /dev/null +++ b/epmet-commons/epmet-commons-security/pom.xml @@ -0,0 +1,26 @@ + + + + epmet-commons + com.epmet + 2.0.0 + + 4.0.0 + + epmet-commons-security + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + io.jsonwebtoken + jjwt + 0.7.0 + + + \ No newline at end of file diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java new file mode 100644 index 0000000000..8cbae20749 --- /dev/null +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

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

+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.security.jwt; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Jwt工具类 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class JwtTokenUtils { + private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class); + + public Claims getClaimByToken(String token, String secret) { + try { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } catch (Exception e) { + logger.debug("validate is token error, token = " + token, e); + return null; + } + } + + /** + * @return java.util.Date + * @param token + * @Author yinzuomei + * @Description 获取token的有效期截止时间 + * @Date 2020/3/18 22:17 + **/ + public Date getExpiration(String token, String secret){ + try { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody().getExpiration(); + } catch (Exception e) { + logger.debug("validate is token error, token = " + token, e); + return null; + } + } + + /** + * @return java.lang.String + * @Author yinzuomei + * @Description 根据app+client+userId生成token + * @Date 2020/3/18 22:29 + **/ + public String createToken(Map claims, int expire, String secret) { + return Jwts.builder() + .setHeaderParam("typ", "JWT") + .setClaims(claims) + .setIssuedAt(new Date()) + .setExpiration(DateTime.now().plusSeconds(expire).toDate()) + .signWith(SignatureAlgorithm.HS512, secret) + .compact(); + } + + /** + * token是否过期 + * + * @return true:过期 + */ + public boolean isTokenExpired(Date expiration) { + return expiration.before(new Date()); + } + + public static void main(String[] args) { + Map map=new HashMap<>(); + map.put("app","gov"); + map.put("client","wxmp"); + map.put("userId","100526ABC"); + String tokenStr=Jwts.builder() + .setHeaderParam("typ", "JWT") + .setClaims(map) + .setIssuedAt(new Date()) + .setExpiration(DateTime.now().plusSeconds(604800).toDate()) + .signWith(SignatureAlgorithm.HS512, "7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]") + .compact(); + System.out.println(tokenStr); + Claims claims= Jwts.parser() + .setSigningKey("7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]") + .parseClaimsJws(tokenStr) + .getBody(); + System.out.println("app="+ claims.get("app")); + System.out.println("client="+ claims.get("client")); + System.out.println("userId="+ claims.get("userId")); + } + +} diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java new file mode 100644 index 0000000000..33b82b1a23 --- /dev/null +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -0,0 +1,76 @@ +package com.epmet.commons.security.sign.openapi; + +import com.epmet.commons.tools.utils.Md5Util; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * OpenApi签名工具 + */ +public class OpenApiSignUtils { + + /** + * @Description 创建签名 + * @return + * @author wxz + * @date 2021.03.22 16:47 + */ + public static String createSign(Map contentMap, String signKey) { + String str2beSigned = mapToSignStr(contentMap); + str2beSigned = str2beSigned.concat("&signKey=").concat(signKey); + return Md5Util.md5(str2beSigned); + } + + /** + * @Description 验签 + * @return + * @author wxz + * @date 2021.03.22 16:51 + */ + public static boolean checkSign(Map contentMap, String signKey) { + String newSign = createSign(contentMap, signKey); + return newSign.equals(contentMap.get("sign")); + } + + /** + * @Description map转化为签名明文 + * @return + * @author wxz + * @date 2021.03.22 16:47 + */ + public static String mapToSignStr(Map map) { + Set keySet = map.keySet(); + String[] keyArray = (String[])keySet.toArray(new String[keySet.size()]); + Arrays.sort(keyArray); + StringBuilder sb = new StringBuilder(); + + for(int i = 0; i < keyArray.length; ++i) { + String key = keyArray[i]; + String val = (String)map.get(key); + if (val != null && val.trim().length() > 0 && !"sign".equals(key)) { + if (!sb.toString().isEmpty()) { + sb.append("&"); + } + + sb.append(key).append("=").append((String)map.get(key)); + } + } + + return sb.toString(); + } + + + public static void main(String[] args) { + + HashMap content = new HashMap<>(); + content.put("appId", "7d98b8af2d05752b4225709c4cfd4bd0"); + + String secret = "3209ee9f41704482be1a1fb5873a25376f2899191ca846119d44168316bc3e44"; + + String sign = createSign(content, secret); + System.out.println(sign); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index ac6d50bd9f..47546c0e81 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 @@ -143,7 +143,10 @@ public enum EpmetErrorCode { TOPIC_SHIFTED_TO_ISSUE_UNDER_AUDITING(9004,"当前话题正在转议题审核"), TOPIC_ALREADY_SHIFTED_TO_ISSUE(9005,"该话题已被转为议题,请勿重复操作"), TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"), - TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"); + TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"), + + // open api异常 + OPEN_API_SIGN_ERROR(9100, "签名错误"); private int code; private String msg; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 098dd1c14d..20bde9e05f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -370,4 +370,14 @@ public class RedisKeys { public static String getCustomerApiServiceKey(String customerId) { return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId); } + + /** + * @Description 获取openApi的accessToken的key + * @return + * @author wxz + * @date 2021.03.23 10:25 + */ + public static String getOpenApiAccessTokenKey(String appId) { + return rootPrefix.concat("openapi:accesstoken:").concat(appId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ConvertUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ConvertUtils.java index 93c653e178..6d2e509797 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ConvertUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ConvertUtils.java @@ -12,11 +12,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.*; /** * 转换工具类 @@ -87,4 +90,33 @@ public class ConvertUtils { } return t; } + + /** + * @Description entity转map + * @return + * @author wxz + * @date 2021.03.22 16:38 + */ + public static Map entityToMap(Object bean) throws IntrospectionException, InvocationTargetException, IllegalAccessException { + Class type = bean.getClass(); + Map returnMap = new HashMap(16); + BeanInfo beanInfo = Introspector.getBeanInfo(type); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + + for(int i = 0; i < propertyDescriptors.length; ++i) { + PropertyDescriptor descriptor = propertyDescriptors[i]; + String propertyName = descriptor.getName(); + if (!"class".equals(propertyName)) { + Method readMethod = descriptor.getReadMethod(); + Object result = readMethod.invoke(bean); + if (result != null) { + returnMap.put(propertyName, String.valueOf(result)); + } else { + returnMap.put(propertyName, ""); + } + } + } + + return returnMap; + } } diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml index 636480c48f..b495dd438e 100644 --- a/epmet-commons/pom.xml +++ b/epmet-commons/pom.xml @@ -25,6 +25,7 @@ epmet-commons-extapp-auth epmet-commons-thirdplat epmet-commons-rocketmq - + epmet-commons-security + diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java new file mode 100644 index 0000000000..4b315ae326 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class AccessTokenFormDTO { + + public interface GetAccessTokenGroup {} + + // 签名字符串密文 + @NotBlank(message = "签名字段不能为空", groups = { GetAccessTokenGroup.class }) + private String sign; + + // 应用id + @NotBlank(message = "AppId字段不能为空", groups = { GetAccessTokenGroup.class }) + private String appId; +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/pom.xml b/epmet-module/epmet-ext/epmet-ext-server/pom.xml index f33a428e27..d12766c5e9 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/pom.xml +++ b/epmet-module/epmet-ext/epmet-ext-server/pom.xml @@ -21,6 +21,16 @@ + + com.epmet + common-service-client + 2.0.0 + + + com.epmet + epmet-commons-security + 2.0.0 + com.epmet epmet-ext-client diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/OpenApiConfig.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/OpenApiConfig.java new file mode 100644 index 0000000000..706c01af35 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/OpenApiConfig.java @@ -0,0 +1,15 @@ +package com.epmet.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + +@Component +@Data +public class OpenApiConfig { + + @Value("${openApi.accessToken.expire}") + private int accessTokenExpire; + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java new file mode 100644 index 0000000000..1580ca1b6a --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java @@ -0,0 +1,88 @@ +package com.epmet.controller; + +import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.AccessTokenFormDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.service.OpenApiAccessTokenService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.beans.IntrospectionException; +import java.lang.reflect.InvocationTargetException; + +@RestController +@RequestMapping("open-api") +public class OpenApiAccessTokenController { + + @Autowired + private OpenApiAccessTokenService openApiAccessTokenService; + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + @Autowired + private RedisUtils redisUtils; + + private Logger logger = LoggerFactory.getLogger(OpenApiAccessTokenController.class); + + /** + * @Description 获取AccessToken + * @return + * @author wxz + * @date 2021.03.23 09:52 + */ + @PostMapping("get-access-token") + public Result getAccessToken(@RequestBody AccessTokenFormDTO input) { + // 1.校验参数 + ValidatorUtils.validateEntity(input); + String appId = input.getAppId(); + + // 2.取secret + String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); + if (StringUtils.isBlank(secret)) { + Result result = commonServiceOpenFeignClient.getSecret(appId); + if (!result.success()) { + throw new RenException("调用common service查询secret失败"); + } + secret = result.getData(); + if (StringUtils.isBlank(secret)) { + throw new RenException(String.format("根据appId%s没有找到对应的secret", appId)); + } + redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); + } + + // 3.验签 + try { + if (!OpenApiSignUtils.checkSign(ConvertUtils.entityToMap(input), secret)) { + throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode(), EpmetErrorCode.OPEN_API_SIGN_ERROR.getMsg()); + } + } catch (RenException e) { + // 如果是自己抛出的异常则继续抛出 + throw e; + } catch (Exception e) { + // 是其他意外发生的异常 + String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); + logger.error("验签发生未知异常:{}", errorStackTrace); + throw new RenException("验签发生未知异常,请查看ext服务详细日志"); + } + + //4.生成token + String accessToken = openApiAccessTokenService.getAccessToken(appId, secret); + return new Result().ok(accessToken); + } + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java new file mode 100644 index 0000000000..56c3bd4630 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + +/** + * access token的service + */ +public interface OpenApiAccessTokenService { + + /** + * @Description 获取AccessToken + * @return + * @author wxz + * @date 2021.03.22 22:57 + */ + String getAccessToken(String appId, String secret); +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java new file mode 100644 index 0000000000..8610eb2ce0 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java @@ -0,0 +1,44 @@ +package com.epmet.service.impl; + +import com.epmet.commons.security.jwt.JwtTokenUtils; +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.redis.RedisUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.config.OpenApiConfig; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.service.OpenApiAccessTokenService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.HashMap; + +@Service +public class OpenApiAccessTokenServiceImpl implements OpenApiAccessTokenService { + + @Autowired + private JwtTokenUtils jwtTokenUtils; + + @Autowired + private OpenApiConfig openApiConfig; + + @Autowired + private RedisUtils redisUtils; + + @Override + public String getAccessToken(String appId, String secret) { + HashMap claim = new HashMap<>(); + claim.put("appId", appId); + + String token = jwtTokenUtils.createToken(claim, openApiConfig.getAccessTokenExpire(), secret); + + // 缓存token + redisUtils.set(RedisKeys.getOpenApiAccessTokenKey(appId), token, openApiConfig.getAccessTokenExpire()); + + return token; + } +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml index 7a067d1606..9696f37468 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml @@ -110,3 +110,8 @@ shutdown: graceful: enable: true #是否开启优雅停机 waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 + +# 对外开放接口配置 +openApi: + accessToken: + expire: 7200000 From 604c78541a3fe656c79acb8850c5e0bade3c25f3 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 24 Mar 2021 10:49:07 +0800 Subject: [PATCH 38/71] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=89=8B=E5=8A=A8=E9=AA=8C=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jwt/{JwtTokenUtils.java => JwtUtils.java} | 4 +- .../sign/openapi/OpenApiSignUtils.java | 3 +- .../tools/exception/EpmetErrorCode.java | 3 +- .../epmet/commons/tools/redis/RedisKeys.java | 4 +- epmet-gateway/pom.xml | 9 +- .../auth/ExtAppFetchTokenAuthProcessor.java | 84 +++++++++++++++++++ .../com/epmet/auth/ExternalAuthProcessor.java | 30 +++++-- .../src/main/resources/bootstrap.yml | 4 + .../EpmetCommonServiceOpenFeignClient.java | 2 +- .../dto/form/openapi/GetOrgDetailFormDTO.java | 15 ++++ .../dto/form/openapi/OpenApiBaseFormDTO.java | 13 +++ .../controller/OpenApiOrgController.java | 63 ++++++++++++++ .../impl/OpenApiAccessTokenServiceImpl.java | 13 +-- 13 files changed, 220 insertions(+), 27 deletions(-) rename epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/{JwtTokenUtils.java => JwtUtils.java} (98%) create mode 100644 epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java create mode 100644 epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/GetOrgDetailFormDTO.java create mode 100644 epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java similarity index 98% rename from epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java rename to epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java index 8cbae20749..23b738d623 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtTokenUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java @@ -28,8 +28,8 @@ import java.util.Map; * @since 1.0.0 */ @Component -public class JwtTokenUtils { - private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class); +public class JwtUtils { + private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class); public Claims getClaimByToken(String token, String secret) { try { diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index 33b82b1a23..306bb5ab3d 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -66,7 +66,8 @@ public class OpenApiSignUtils { public static void main(String[] args) { HashMap content = new HashMap<>(); - content.put("appId", "7d98b8af2d05752b4225709c4cfd4bd0"); + content.put("orgId", "aaa"); + content.put("test", ""); String secret = "3209ee9f41704482be1a1fb5873a25376f2899191ca846119d44168316bc3e44"; 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 47546c0e81..e22f5f7983 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 @@ -146,7 +146,8 @@ public enum EpmetErrorCode { TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"), // open api异常 - OPEN_API_SIGN_ERROR(9100, "签名错误"); + OPEN_API_SIGN_ERROR(9100, "签名错误"), + OPEN_API_SIGN_TOKEN_EXPIRED(9101, "Token过期"); private int code; private String msg; 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 20bde9e05f..5ba36b541b 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 @@ -377,7 +377,7 @@ public class RedisKeys { * @author wxz * @date 2021.03.23 10:25 */ - public static String getOpenApiAccessTokenKey(String appId) { - return rootPrefix.concat("openapi:accesstoken:").concat(appId); + public static String getOpenApiAccessTokenKey(String accessToken) { + return rootPrefix.concat("openapi:accesstoken:").concat(accessToken); } } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 08eda7167e..560063fe23 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -13,6 +13,11 @@ jar + + com.epmet + epmet-commons-security + 2.0.0 + com.epmet epmet-commons-tools @@ -329,8 +334,8 @@ lb://epmet-point-server - lb://epmet-ext-server - + + http://127.0.0.1:8113 lb://data-aggregator-server diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java new file mode 100644 index 0000000000..236914ccb2 --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java @@ -0,0 +1,84 @@ +package com.epmet.auth; + +import com.epmet.commons.security.jwt.JwtUtils; +import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; +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.redis.RedisUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +/** + * 外部应用认证处理器:来平台token的方式 + */ +@Component +public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { + + @Autowired + private JwtUtils jwtTokenUtils; + + @Autowired + private RedisUtils redisUtils; + + @Override + public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { + // 这种方式不需要其他平台传appId,因此我们自己从redis中取 + appId = (String) redisUtils.get(RedisKeys.getOpenApiAccessTokenKey(token)); + + // 1.token过期校验 + if (StringUtils.isBlank(appId)) { + throw new RenException(EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getCode(), + EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getMsg()); + } + + String secret = getSecret(appId); + + if (jwtTokenUtils.isTokenExpired(jwtTokenUtils.getExpiration(token, secret))) { + throw new RenException(EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getCode(), + EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getMsg()); + } + + // 2.验签 + // 验签暂时放到具体接口中 + //openApiSignUtils.checkSign(); + + // 2. 获取claims + Claims claims = jwtTokenUtils.getClaimByToken(token, secret); + appId = claims.get("appId", String.class); + + if (!StringUtils.isBlank(appId)) { + ServerHttpRequest.Builder mutate = exchange.getRequest().mutate(); + mutate.header("appId", appId); + exchange.mutate().request(mutate.build()).build(); + } + } + + /** + * @Description 获取秘钥 + * @return + * @author wxz + * @date 2021.03.23 14:12 + */ + private String getSecret(String appId) { + EpmetCommonServiceOpenFeignClient commonService = SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class); + Result result = commonService.getSecret(appId); + if (result == null || !result.success()) { + throw new RenException("fetchToken方式的外部应用认证,获取secret失败"); + } + String secret = result.getData(); + if (StringUtils.isBlank(secret)) { + throw new RenException("fetchToken方式的外部应用认证,获取secret失败"); + } + + return secret; + } +} diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index 8af2cdd5ef..b2ac9f477e 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -31,9 +31,15 @@ public class ExternalAuthProcessor extends AuthProcessor { public static final String APP_ID_CUSTOMER_ID_KEY = "CustomerId"; public static final String APP_ID_AUTY_TYPE_KEY = "AuthType"; - // 认证方式 + /** + * 认证方式 + */ + // 调用方生成jwt public static final String APP_AUTH_TYPE_JWT = "jwt"; + // 调用方生成md5 public static final String APP_AUTH_TYPE_MD5 = "md5"; + // 获取token方式 + public static final String APP_AUTH_TYPE_FETCH_TOKEN = "fetchToken"; @Autowired @@ -42,6 +48,9 @@ public class ExternalAuthProcessor extends AuthProcessor { @Autowired private ExtAppMD5AuthProcessor md5AuthProcessor; + @Autowired + private ExtAppFetchTokenAuthProcessor fetchTokenAuthProcessor; + private final AntPathMatcher antPathMatcher = new AntPathMatcher(); @Autowired @@ -68,24 +77,29 @@ public class ExternalAuthProcessor extends AuthProcessor { HttpHeaders headers = request.getHeaders(); String token = headers.getFirst(ACCESS_TOKEN_HEADER_KEY); - String appId = headers.getFirst(APP_ID_HEADER_KEY); String ts = headers.getFirst(APP_ID_TIMESTAMP_KEY); String customerId = headers.getFirst(APP_ID_CUSTOMER_ID_KEY); String authType = headers.getFirst(APP_ID_AUTY_TYPE_KEY); - if (StringUtils.isAnyBlank(token, appId)) { - throw new RenException(EpmetErrorCode.ERR401.getCode(), "请求头中的AccessToken和AppId不能为空"); - } - - logger.info("外部应用请求认证拦截Aspect执行,appId:{}, token:{}, ts:{}, customerId:{}, authType:{}", - appId, token, ts, customerId, authType); + logger.info("外部应用请求认证拦截Aspect执行,token:{}, ts:{}, customerId:{}, authType:{}", + token, ts, customerId, authType); // 没传authType或者传的jwt都用jwtprocessor处理 try { if (StringUtils.isBlank(authType) || APP_AUTH_TYPE_JWT.equals(authType)) { + String appId = headers.getFirst(APP_ID_HEADER_KEY); + if (StringUtils.isAnyBlank(token, appId)) { + throw new RenException(EpmetErrorCode.ERR401.getCode(), "请求头中的AccessToken和AppId不能为空"); + } jwtAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else if (APP_AUTH_TYPE_MD5.equals(authType)) { + String appId = headers.getFirst(APP_ID_HEADER_KEY); + if (StringUtils.isAnyBlank(token, appId)) { + throw new RenException(EpmetErrorCode.ERR401.getCode(), "请求头中的AccessToken和AppId不能为空"); + } md5AuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); + } else if (APP_AUTH_TYPE_FETCH_TOKEN.equals(authType)) { + fetchTokenAuthProcessor.auth(null, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else { throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "未知的外部认证类型"); } diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 7a6c236128..1e59675b46 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -422,6 +422,10 @@ feign: httpclient: enabled: true +logging: + level: + com.epmet: debug + hystrix: command: default: diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index 66a1f46ee7..296489af6e 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -20,7 +20,7 @@ import java.util.Map; * @date 2020/6/4 10:28 */ @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) -// @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") + //@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://192.168.1.132:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/GetOrgDetailFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/GetOrgDetailFormDTO.java new file mode 100644 index 0000000000..820225682a --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/GetOrgDetailFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form.openapi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class GetOrgDetailFormDTO extends OpenApiBaseFormDTO { + + @NotBlank(message = "orgId不能为空") + private String orgId; + + private String test; + +} diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java new file mode 100644 index 0000000000..c9385ece77 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.form.openapi; + +import lombok.Data; + +/** + * open api基础类 + */ +@Data +public class OpenApiBaseFormDTO { + + private String sign; + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java new file mode 100644 index 0000000000..e3f0c9fdcd --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java @@ -0,0 +1,63 @@ +package com.epmet.controller; + +import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; +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.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.openapi.GetOrgDetailFormDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +@RestController +@RequestMapping("open-api") +public class OpenApiOrgController { + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + @Autowired + private RedisUtils redisUtils; + + @PostMapping("/get-org-detail") + public Result getOrgDetail(@RequestBody GetOrgDetailFormDTO input, + @RequestHeader("appId") String appId) { + // 验签 + Map params = null; + try { + params = ConvertUtils.entityToMap(input); + } catch (Exception e) { + e.printStackTrace(); + } + + if (!OpenApiSignUtils.checkSign(params, getSecret(appId))) { + // 验签失败,抛出异常提示 + throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode()); + } + + return new Result().ok("测试org"); + } + + private String getSecret(String appId) { + String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); + if (StringUtils.isBlank(secret)) { + Result result = commonServiceOpenFeignClient.getSecret(appId); + if (!result.success()) { + throw new RenException("调用common service查询secret失败"); + } + secret = result.getData(); + if (StringUtils.isBlank(secret)) { + throw new RenException(String.format("根据appId%s没有找到对应的secret", appId)); + } + redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); + } + return secret; + } + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java index 8610eb2ce0..4cdee0c279 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java @@ -1,18 +1,11 @@ package com.epmet.service.impl; -import com.epmet.commons.security.jwt.JwtTokenUtils; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.security.jwt.JwtUtils; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.config.OpenApiConfig; -import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.OpenApiAccessTokenService; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -21,7 +14,7 @@ import java.util.HashMap; public class OpenApiAccessTokenServiceImpl implements OpenApiAccessTokenService { @Autowired - private JwtTokenUtils jwtTokenUtils; + private JwtUtils jwtTokenUtils; @Autowired private OpenApiConfig openApiConfig; @@ -37,7 +30,7 @@ public class OpenApiAccessTokenServiceImpl implements OpenApiAccessTokenService String token = jwtTokenUtils.createToken(claim, openApiConfig.getAccessTokenExpire(), secret); // 缓存token - redisUtils.set(RedisKeys.getOpenApiAccessTokenKey(appId), token, openApiConfig.getAccessTokenExpire()); + redisUtils.set(RedisKeys.getOpenApiAccessTokenKey(token), appId, openApiConfig.getAccessTokenExpire()); return token; } From 9cc61899a0a9578b7f8db1562986b951148c1e87 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 24 Mar 2021 10:54:51 +0800 Subject: [PATCH 39/71] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 1e59675b46..1e6189861c 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -422,9 +422,9 @@ feign: httpclient: enabled: true -logging: - level: - com.epmet: debug +#logging: +# level: +# com.epmet: debug hystrix: command: From 0e0f3142e474fa028510b330dad2b290347d495f Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 24 Mar 2021 13:52:18 +0800 Subject: [PATCH 40/71] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=20=E9=AA=8C?= =?UTF-8?q?=E7=AD=BE=E6=B3=A8=E8=A7=A3=E5=92=8CAOP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/ExtAppFetchTokenAuthProcessor.java | 2 +- .../epmet/annotation/OpenApiCheckSign.java | 13 ++ .../epmet/aspect/OpenApiCheckSignAspect.java | 125 ++++++++++++++++++ .../controller/OpenApiOrgController.java | 56 ++------ 4 files changed, 149 insertions(+), 47 deletions(-) create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/annotation/OpenApiCheckSign.java create mode 100644 epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java index 236914ccb2..728c3b54e0 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java @@ -57,7 +57,7 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { if (!StringUtils.isBlank(appId)) { ServerHttpRequest.Builder mutate = exchange.getRequest().mutate(); - mutate.header("appId", appId); + mutate.header("AppId", appId); exchange.mutate().request(mutate.build()).build(); } } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/annotation/OpenApiCheckSign.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/annotation/OpenApiCheckSign.java new file mode 100644 index 0000000000..10bbcc156e --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/annotation/OpenApiCheckSign.java @@ -0,0 +1,13 @@ +package com.epmet.annotation; + +import java.lang.annotation.*; + +/** + * OpenApi验签注解 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface OpenApiCheckSign { + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java new file mode 100644 index 0000000000..21953df71a --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java @@ -0,0 +1,125 @@ +package com.epmet.aspect; + +import com.epmet.commons.mybatis.aspect.DataFilterAspect; +import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; +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.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.beans.IntrospectionException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.Arrays; +import java.util.Map; +import java.util.Set; + +@Aspect +@Component +@Order(1) +public class OpenApiCheckSignAspect { + + @Autowired + private RedisUtils redisUtils; + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + private static final Logger log = LoggerFactory.getLogger(DataFilterAspect.class); + + /** + * @Description 验签 + * @return + * @author wxz + * @date 2021.03.24 13:39 + */ + @Before("execution(* com.epmet.controller.*Controller*.*(..)) && @annotation(com.epmet.annotation.OpenApiCheckSign)") + public void checkSign(JoinPoint point) { + Object[] args = point.getArgs(); + MethodSignature methodSignature = (MethodSignature) point.getSignature(); + Method method = methodSignature.getMethod(); + Parameter[] parameters = method.getParameters(); + for (int i = 0; i < parameters.length; i++) { + if (parameters[i].isAnnotationPresent(RequestBody.class)) { + Map argMap = null; + try { + argMap = ConvertUtils.entityToMap(args[i]); + } catch (Exception e) { + throw new RenException("验签参数转化发生异常"); + } + if (!OpenApiSignUtils.checkSign(argMap, getSecret(getAppId()))) { + // 验签失败 + throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode()); + } + } + } + } + + /** + * @return + * @Description 取secret + * @author wxz + * @date 2021.03.24 12:49 + */ + private String getSecret(String appId) { + String secret = (String) redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); + if (StringUtils.isBlank(secret)) { + Result result = commonServiceOpenFeignClient.getSecret(appId); + if (!result.success()) { + throw new RenException("调用common service查询secret失败"); + } + secret = result.getData(); + if (StringUtils.isBlank(secret)) { + throw new RenException(String.format("根据appId%s没有找到对应的secret", appId)); + } + redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); + } + return secret; + } + + /** + * @return + * @Description 获取request + * @author wxz + * @date 2021.03.24 12:52 + */ + public HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) requestAttributes; + return sra.getRequest(); + } + + /** + * @return + * @Description 获取appId + * @author wxz + * @date 2021.03.24 12:53 + */ + public String getAppId() { + HttpServletRequest request = getRequest(); + String appId = request.getHeader("AppId"); + if (StringUtils.isBlank(appId)) { + throw new RenException("请求头中未携带AppId"); + } + return appId; + } +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java index e3f0c9fdcd..30e97da2bf 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiOrgController.java @@ -1,63 +1,27 @@ package com.epmet.controller; -import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; -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.redis.RedisUtils; -import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.annotation.OpenApiCheckSign; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.openapi.GetOrgDetailFormDTO; -import com.epmet.feign.EpmetCommonServiceOpenFeignClient; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Map; - @RestController @RequestMapping("open-api") public class OpenApiOrgController { - @Autowired - private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; - - @Autowired - private RedisUtils redisUtils; - + /** + * @Description OpenApiCheckSign是验签注解,OpenApi的接口请加上该注解 + * @return + * @author wxz + * @date 2021.03.24 12:55 + */ + @OpenApiCheckSign @PostMapping("/get-org-detail") public Result getOrgDetail(@RequestBody GetOrgDetailFormDTO input, - @RequestHeader("appId") String appId) { - // 验签 - Map params = null; - try { - params = ConvertUtils.entityToMap(input); - } catch (Exception e) { - e.printStackTrace(); - } - - if (!OpenApiSignUtils.checkSign(params, getSecret(appId))) { - // 验签失败,抛出异常提示 - throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode()); - } - + @RequestHeader("AppId") String appId) { return new Result().ok("测试org"); } - private String getSecret(String appId) { - String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); - if (StringUtils.isBlank(secret)) { - Result result = commonServiceOpenFeignClient.getSecret(appId); - if (!result.success()) { - throw new RenException("调用common service查询secret失败"); - } - secret = result.getData(); - if (StringUtils.isBlank(secret)) { - throw new RenException(String.format("根据appId%s没有找到对应的secret", appId)); - } - redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); - } - return secret; - } + } From e9377ae529e3485045df16723df6cb51ed755bc3 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 25 Mar 2021 16:52:44 +0800 Subject: [PATCH 41/71] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Aepmet-commons-?= =?UTF-8?q?openapi=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-openapi/pom.xml | 17 +++++++++++++++++ .../openapi/constants/HeaderFieldKeys.java | 7 +++++++ .../openapi/constants/RequestBodyFieldKeys.java | 10 ++++++++++ .../openapi/constants/RequestParamKeys.java | 11 +++++++++++ 4 files changed, 45 insertions(+) create mode 100644 epmet-commons/epmet-commons-openapi/pom.xml create mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java create mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java create mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java diff --git a/epmet-commons/epmet-commons-openapi/pom.xml b/epmet-commons/epmet-commons-openapi/pom.xml new file mode 100644 index 0000000000..61a6197357 --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/pom.xml @@ -0,0 +1,17 @@ + + + + 2.0.0 + + epmet-commons + com.epmet + 2.0.0 + + 4.0.0 + + epmet-commons-openapi + + + \ No newline at end of file diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java new file mode 100644 index 0000000000..35dfff71db --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java @@ -0,0 +1,7 @@ +package com.epmet.commons.openapi.constants; + +public interface HeaderFieldKeys { + + String APP_ID = "AppId"; + +} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java new file mode 100644 index 0000000000..3c461a6c69 --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java @@ -0,0 +1,10 @@ +package com.epmet.commons.openapi.constants; + +/** + * 请求体字段key + */ +public interface RequestBodyFieldKeys { + + String APP_ID = "appId"; + +} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java new file mode 100644 index 0000000000..08c6c092b1 --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java @@ -0,0 +1,11 @@ +package com.epmet.commons.openapi.constants; + +/** + * url请求参数key + */ +public class RequestParamKeys { + + public static String APP_ID = "app_id"; + public static String AUTH_TYPE = "auth_type"; + +} From e3eae2955768d17947f6465599200a4337f509e4 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 25 Mar 2021 16:57:36 +0800 Subject: [PATCH 42/71] =?UTF-8?q?=E5=BC=95=E5=85=A5openApi=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 560063fe23..5414a2cb14 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -70,6 +70,11 @@ common-service-client 2.0.0 + + com.epmet + epmet-commons-openapi + 2.0.0 + From dfaf657c44f328783ff2ffe5bfccb06f8e7423d3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 25 Mar 2021 18:00:58 +0800 Subject: [PATCH 43/71] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20commons=20openapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-openapi/pom.xml | 4 +--- .../openapi/constants => openapi}/HeaderFieldKeys.java | 2 +- .../openapi/constants => openapi}/RequestBodyFieldKeys.java | 2 +- .../openapi/constants => openapi}/RequestParamKeys.java | 2 +- epmet-commons/pom.xml | 3 ++- epmet-gateway/pom.xml | 1 + 6 files changed, 7 insertions(+), 7 deletions(-) rename epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/{commons/openapi/constants => openapi}/HeaderFieldKeys.java (60%) rename epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/{commons/openapi/constants => openapi}/RequestBodyFieldKeys.java (69%) rename epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/{commons/openapi/constants => openapi}/RequestParamKeys.java (78%) diff --git a/epmet-commons/epmet-commons-openapi/pom.xml b/epmet-commons/epmet-commons-openapi/pom.xml index 61a6197357..41093f03fa 100644 --- a/epmet-commons/epmet-commons-openapi/pom.xml +++ b/epmet-commons/epmet-commons-openapi/pom.xml @@ -2,8 +2,6 @@ - - 2.0.0 epmet-commons com.epmet @@ -14,4 +12,4 @@ epmet-commons-openapi - \ No newline at end of file + diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java similarity index 60% rename from epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java rename to epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java index 35dfff71db..9360c5f51f 100644 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java @@ -1,4 +1,4 @@ -package com.epmet.commons.openapi.constants; +package com.epmet.openapi; public interface HeaderFieldKeys { diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java similarity index 69% rename from epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java rename to epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java index 3c461a6c69..3ce4555283 100644 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java @@ -1,4 +1,4 @@ -package com.epmet.commons.openapi.constants; +package com.epmet.openapi; /** * 请求体字段key diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java similarity index 78% rename from epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java rename to epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java index 08c6c092b1..a503713682 100644 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java @@ -1,4 +1,4 @@ -package com.epmet.commons.openapi.constants; +package com.epmet.openapi; /** * url请求参数key diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml index b495dd438e..9e0d315827 100644 --- a/epmet-commons/pom.xml +++ b/epmet-commons/pom.xml @@ -26,6 +26,7 @@ epmet-commons-thirdplat epmet-commons-rocketmq epmet-commons-security - + epmet-commons-openapi + diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 5414a2cb14..d901d0940e 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -74,6 +74,7 @@ com.epmet epmet-commons-openapi 2.0.0 + compile From 64aca2e5defd9df4ec9a31b471a179aa7c454e8c Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 25 Mar 2021 20:38:52 +0800 Subject: [PATCH 44/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9=20half?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-openapi/pom.xml | 17 ---- .../openapi/constants/HeaderFieldKeys.java | 7 -- .../constants/RequestBodyFieldKeys.java | 10 -- .../openapi/constants/RequestParamKeys.java | 11 --- .../sign/openapi/OpenApiSignUtils.java | 36 ++++++-- .../tools/exception/EpmetErrorCode.java | 4 +- .../epmet/commons/tools/redis/RedisKeys.java | 10 ++ .../auth/ExtAppFetchTokenAuthProcessor.java | 29 +++--- .../com/epmet/auth/ExternalAuthProcessor.java | 17 +++- .../filter/CpAuthGatewayFilterFactory.java | 6 ++ .../java/com/epmet/filter/CpProperty.java | 5 + .../epmet/utils/ServerHttpRequestUtils.java | 19 ++++ .../src/main/resources/bootstrap.yml | 5 + .../epmet/dto/form/AccessTokenFormDTO.java | 9 +- .../dto/form/openapi/OpenApiBaseFormDTO.java | 18 ++++ ...ct.java => OpenApiRequestCheckAspect.java} | 91 ++++++++++++++++--- .../OpenApiAccessTokenController.java | 20 +--- pom.xml | 2 +- 18 files changed, 212 insertions(+), 104 deletions(-) delete mode 100644 epmet-commons/epmet-commons-openapi/pom.xml delete mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java delete mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java delete mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java create mode 100644 epmet-gateway/src/main/java/com/epmet/utils/ServerHttpRequestUtils.java rename epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/{OpenApiCheckSignAspect.java => OpenApiRequestCheckAspect.java} (59%) diff --git a/epmet-commons/epmet-commons-openapi/pom.xml b/epmet-commons/epmet-commons-openapi/pom.xml deleted file mode 100644 index 61a6197357..0000000000 --- a/epmet-commons/epmet-commons-openapi/pom.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - 2.0.0 - - epmet-commons - com.epmet - 2.0.0 - - 4.0.0 - - epmet-commons-openapi - - - \ No newline at end of file diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java deleted file mode 100644 index 35dfff71db..0000000000 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/HeaderFieldKeys.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.epmet.commons.openapi.constants; - -public interface HeaderFieldKeys { - - String APP_ID = "AppId"; - -} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java deleted file mode 100644 index 3c461a6c69..0000000000 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestBodyFieldKeys.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.epmet.commons.openapi.constants; - -/** - * 请求体字段key - */ -public interface RequestBodyFieldKeys { - - String APP_ID = "appId"; - -} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java deleted file mode 100644 index 08c6c092b1..0000000000 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/commons/openapi/constants/RequestParamKeys.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.epmet.commons.openapi.constants; - -/** - * url请求参数key - */ -public class RequestParamKeys { - - public static String APP_ID = "app_id"; - public static String AUTH_TYPE = "auth_type"; - -} diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index 306bb5ab3d..9a64226174 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -2,10 +2,7 @@ package com.epmet.commons.security.sign.openapi; import com.epmet.commons.tools.utils.Md5Util; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * OpenApi签名工具 @@ -62,16 +59,41 @@ public class OpenApiSignUtils { return sb.toString(); } - public static void main(String[] args) { + //generateGetAccessTokenSign(); + generateGetOrgDetailSign(); + } + + private static void generateGetAccessTokenSign() { + long now = System.currentTimeMillis(); + System.out.println(now); HashMap content = new HashMap<>(); - content.put("orgId", "aaa"); - content.put("test", ""); + content.put("appId", "7d98b8af2d05752b4225709c4cfd4bd0"); + content.put("timestamp", String.valueOf(now)); + content.put("nonce", "aaa"); String secret = "3209ee9f41704482be1a1fb5873a25376f2899191ca846119d44168316bc3e44"; String sign = createSign(content, secret); System.out.println(sign); } + + private static void generateGetOrgDetailSign() { + long now = System.currentTimeMillis(); + String uuid = UUID.randomUUID().toString(); + System.out.println("时间戳:" + now); + System.out.println("随机数:" + uuid); + + HashMap content = new HashMap<>(); + content.put("orgId", "aaa"); + content.put("test", null); + content.put("timestamp", String.valueOf(now)); + content.put("nonce", uuid); + + String secret = "3209ee9f41704482be1a1fb5873a25376f2899191ca846119d44168316bc3e44"; + + String sign = createSign(content, secret); + System.out.println("签名:" + sign); + } } 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 e22f5f7983..f83a55d32f 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 @@ -147,7 +147,9 @@ public enum EpmetErrorCode { // open api异常 OPEN_API_SIGN_ERROR(9100, "签名错误"), - OPEN_API_SIGN_TOKEN_EXPIRED(9101, "Token过期"); + OPEN_API_TOKEN_EXPIRED(9101, "Token过期"), + OPEN_API_PARAMS_MISSING(9102, "参数不完整"), + OPEN_API_PARAMS_APPID_DIFF(9103, "app_id不一致"); // app_id在请求参数中和在token中不一致 private int code; private String msg; 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 4d21946025..dd5ca2e18a 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 @@ -396,4 +396,14 @@ public class RedisKeys { public static String getOpenApiAccessTokenKey(String accessToken) { return rootPrefix.concat("openapi:accesstoken:").concat(accessToken); } + + /** + * @Description 获取OpenApi请求随机数nonce + * @return + * @author wxz + * @date 2021.03.24 17:49 + */ + public static String getOpenApiNonceKey(String nonce) { + return rootPrefix.concat("openapi:nonce:").concat(nonce); + } } diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java index 728c3b54e0..5954b2bd30 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java @@ -26,25 +26,19 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { @Autowired private JwtUtils jwtTokenUtils; - @Autowired - private RedisUtils redisUtils; - @Override public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { - // 这种方式不需要其他平台传appId,因此我们自己从redis中取 - appId = (String) redisUtils.get(RedisKeys.getOpenApiAccessTokenKey(token)); - // 1.token过期校验 if (StringUtils.isBlank(appId)) { - throw new RenException(EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getCode(), - EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getMsg()); + throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), + EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); } String secret = getSecret(appId); if (jwtTokenUtils.isTokenExpired(jwtTokenUtils.getExpiration(token, secret))) { - throw new RenException(EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getCode(), - EpmetErrorCode.OPEN_API_SIGN_TOKEN_EXPIRED.getMsg()); + throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), + EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); } // 2.验签 @@ -53,13 +47,18 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { // 2. 获取claims Claims claims = jwtTokenUtils.getClaimByToken(token, secret); - appId = claims.get("appId", String.class); + String appIdInAccessToken = claims.get("appId", String.class); - if (!StringUtils.isBlank(appId)) { - ServerHttpRequest.Builder mutate = exchange.getRequest().mutate(); - mutate.header("AppId", appId); - exchange.mutate().request(mutate.build()).build(); + if (!appId.equals(appIdInAccessToken)) { + // 参数列表的appId和token中封装的不一致 + throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), + EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); } + + // 3.将app_id放入header中 + ServerHttpRequest.Builder mutate = exchange.getRequest().mutate(); + mutate.header("AppId", appId); + exchange.mutate().request(mutate.build()).build(); } /** diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index b2ac9f477e..1b928ac295 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.filter.CpProperty; +import com.epmet.utils.ServerHttpRequestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,6 +14,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.util.AntPathMatcher; +import org.springframework.util.MultiValueMap; import org.springframework.web.server.ServerWebExchange; /** @@ -67,6 +69,7 @@ public class ExternalAuthProcessor extends AuthProcessor { for (String url : cpProperty.getExternalOpenUrls()) { if (antPathMatcher.match(url, requestUri)) { inPaths = true; + break; } } @@ -74,6 +77,13 @@ public class ExternalAuthProcessor extends AuthProcessor { throw new RenException(EpmetErrorCode.ERR401.getCode(), "所请求的url并未对外部应用开放"); } + // 放行白名单 + for (String url : cpProperty.getExternalAuthUrlsWhiteList()) { + if (antPathMatcher.match(url, requestUri)) { + return exchange; + } + } + HttpHeaders headers = request.getHeaders(); String token = headers.getFirst(ACCESS_TOKEN_HEADER_KEY); @@ -99,7 +109,12 @@ public class ExternalAuthProcessor extends AuthProcessor { } md5AuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else if (APP_AUTH_TYPE_FETCH_TOKEN.equals(authType)) { - fetchTokenAuthProcessor.auth(null, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); + String paramName = "app_id"; + String appId = ServerHttpRequestUtils.getRequestParam(request, paramName); + if (StringUtils.isBlank(appId)) { + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(),"缺少参数".concat(paramName)); + } + fetchTokenAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else { throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "未知的外部认证类型"); } diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index bb97dc2be7..c01c553b75 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -10,6 +10,7 @@ import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.AuthTypeConstant; import com.epmet.constant.TokenHeaderKeyConstant; +import com.epmet.utils.ServerHttpRequestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -111,6 +112,11 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory externalOpenUrls; + /** + * 对外开放url白名单 + */ + private List externalAuthUrlsWhiteList; + /** * 不处理token,直接通过 */ diff --git a/epmet-gateway/src/main/java/com/epmet/utils/ServerHttpRequestUtils.java b/epmet-gateway/src/main/java/com/epmet/utils/ServerHttpRequestUtils.java new file mode 100644 index 0000000000..334134baa1 --- /dev/null +++ b/epmet-gateway/src/main/java/com/epmet/utils/ServerHttpRequestUtils.java @@ -0,0 +1,19 @@ +package com.epmet.utils; + +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.util.MultiValueMap; + +public class ServerHttpRequestUtils { + + /** + * @Description 从url中获取appId + * @return + * @author wxz + * @date 2021.03.25 15:13 + */ + public static String getRequestParam(ServerHttpRequest request, String paramName) { + MultiValueMap queryParams = request.getQueryParams(); + return queryParams.getFirst(paramName); + } + +} diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index ce7d55ae65..436d4d9225 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -474,6 +474,11 @@ epmet: - /epmetuser/customerstaff/customerlist - /message/template/** - /data/aggregator/project/projectdistribution + + # 对外开放接口认证白名单 + externalAuthUrlsWhiteList: + - /epmet/ext/open-api/get-access-token + swaggerUrls: jwt: diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java index 4b315ae326..9fe569e75e 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java @@ -1,17 +1,12 @@ package com.epmet.dto.form; +import com.epmet.dto.form.openapi.OpenApiBaseFormDTO; import lombok.Data; import javax.validation.constraints.NotBlank; @Data -public class AccessTokenFormDTO { - - public interface GetAccessTokenGroup {} - - // 签名字符串密文 - @NotBlank(message = "签名字段不能为空", groups = { GetAccessTokenGroup.class }) - private String sign; +public class AccessTokenFormDTO extends OpenApiBaseFormDTO { // 应用id @NotBlank(message = "AppId字段不能为空", groups = { GetAccessTokenGroup.class }) diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java index c9385ece77..68f46e351b 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/openapi/OpenApiBaseFormDTO.java @@ -2,12 +2,30 @@ package com.epmet.dto.form.openapi; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + /** * open api基础类 */ @Data public class OpenApiBaseFormDTO { + public interface GetAccessTokenGroup {} + + @NotBlank(message = "签名不能为空", groups = { GetAccessTokenGroup.class }) private String sign; + /** + * 时间戳,ms + */ + @NotNull(message = "时间戳不能为空", groups = { GetAccessTokenGroup.class }) + private Long timestamp; + + /** + * 随机数,每次请求唯一 + */ + @NotBlank(message = "随机字段nonce不能为空", groups = { GetAccessTokenGroup.class }) + private String nonce; + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java similarity index 59% rename from epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java rename to epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java index 21953df71a..22f3280c25 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiCheckSignAspect.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java @@ -26,6 +26,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.beans.IntrospectionException; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; @@ -33,10 +34,15 @@ import java.util.Arrays; import java.util.Map; import java.util.Set; +/** + * OpenApi检查请求切面 + * 1.验签防止参数篡改 + * 2.timestamp+nonce防止请求重放攻击 + */ @Aspect @Component @Order(1) -public class OpenApiCheckSignAspect { +public class OpenApiRequestCheckAspect { @Autowired private RedisUtils redisUtils; @@ -53,27 +59,60 @@ public class OpenApiCheckSignAspect { * @date 2021.03.24 13:39 */ @Before("execution(* com.epmet.controller.*Controller*.*(..)) && @annotation(com.epmet.annotation.OpenApiCheckSign)") - public void checkSign(JoinPoint point) { + public void check(JoinPoint point) { Object[] args = point.getArgs(); MethodSignature methodSignature = (MethodSignature) point.getSignature(); Method method = methodSignature.getMethod(); Parameter[] parameters = method.getParameters(); + + HttpServletRequest request = getRequest(); + String appId = request.getHeader("AppId"); + for (int i = 0; i < parameters.length; i++) { if (parameters[i].isAnnotationPresent(RequestBody.class)) { - Map argMap = null; + Map argMap; try { argMap = ConvertUtils.entityToMap(args[i]); } catch (Exception e) { throw new RenException("验签参数转化发生异常"); } - if (!OpenApiSignUtils.checkSign(argMap, getSecret(getAppId()))) { + + argMap.put(""); + + if (!OpenApiSignUtils.checkSign(argMap, getSecret(appId))) { // 验签失败 throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode()); } + checkRepeatRequest(argMap); } } } + /** + * 检查请求重放 + * @param argMap + */ + void checkRepeatRequest(Map argMap) { + String timestampStr = argMap.get("timestamp"); + if (StringUtils.isBlank(timestampStr)) { + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode()); + } + long timestamp = Long.valueOf(timestampStr).longValue(); + long now = System.currentTimeMillis(); + long requestTimeDiff = 60000; + if (Math.abs(now - timestamp) > requestTimeDiff) { + // 只允许1分钟之内的请求,允许服务器之间时差为1分钟 + throw new RenException(String.format("请求已过时,允许时差为%s ms", requestTimeDiff)); + } + String nonce = argMap.get("nonce"); + String nonceInCache = redisUtils.getString(RedisKeys.getOpenApiNonceKey(nonce)); + if (StringUtils.isNotBlank(nonceInCache)) { + throw new RenException("请求重复"); + } + //将nonce缓存到redis,有效期1分钟 + redisUtils.set(RedisKeys.getOpenApiNonceKey(nonce), "1", requestTimeDiff); + } + /** * @return * @Description 取secret @@ -114,12 +153,42 @@ public class OpenApiCheckSignAspect { * @author wxz * @date 2021.03.24 12:53 */ - public String getAppId() { - HttpServletRequest request = getRequest(); - String appId = request.getHeader("AppId"); - if (StringUtils.isBlank(appId)) { - throw new RenException("请求头中未携带AppId"); - } - return appId; + //public String getAppId(Parameter[] parameters, Object[] args) { + // HttpServletRequest request = getRequest(); + // String appId = request.getHeader("AppId"); + // if (StringUtils.isBlank(appId)) { + // for (int i = 0; i < parameters.length; i++) { + // if (parameters[i].isAnnotationPresent(RequestBody.class)) { + // Object arg = args[i]; + // try { + // appId = getAppIdFromDTO(arg); + // } catch (IllegalAccessException e) { + // e.printStackTrace(); + // } + // } + // } + // } + // if (StringUtils.isBlank(appId)) { + // throw new RenException("未携带AppId"); + // } + // return appId; + //} + + //private String getAppIdFromDTO(Object dto) throws IllegalAccessException { + // Field[] declaredFields = dto.getClass().getDeclaredFields(); + // for (int i = 0; i < declaredFields.length; i++) { + // Field field = declaredFields[i]; + // String fieldName = field.getName(); + // if ("appId".equals(fieldName)) { + // field.setAccessible(true); + // String value = (String) field.get(dto); + // return value; + // } + // } + // return null; + //} + + public static void main(String[] args) { + System.out.println(System.currentTimeMillis()); } } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java index 1580ca1b6a..c189e2fb3b 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.annotation.OpenApiCheckSign; import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -10,6 +11,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.AccessTokenFormDTO; +import com.epmet.dto.form.openapi.OpenApiBaseFormDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.OpenApiAccessTokenService; import org.apache.commons.lang3.StringUtils; @@ -45,10 +47,11 @@ public class OpenApiAccessTokenController { * @author wxz * @date 2021.03.23 09:52 */ + @OpenApiCheckSign @PostMapping("get-access-token") public Result getAccessToken(@RequestBody AccessTokenFormDTO input) { // 1.校验参数 - ValidatorUtils.validateEntity(input); + ValidatorUtils.validateEntity(input, OpenApiBaseFormDTO.GetAccessTokenGroup.class); String appId = input.getAppId(); // 2.取secret @@ -65,21 +68,6 @@ public class OpenApiAccessTokenController { redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); } - // 3.验签 - try { - if (!OpenApiSignUtils.checkSign(ConvertUtils.entityToMap(input), secret)) { - throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode(), EpmetErrorCode.OPEN_API_SIGN_ERROR.getMsg()); - } - } catch (RenException e) { - // 如果是自己抛出的异常则继续抛出 - throw e; - } catch (Exception e) { - // 是其他意外发生的异常 - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error("验签发生未知异常:{}", errorStackTrace); - throw new RenException("验签发生未知异常,请查看ext服务详细日志"); - } - //4.生成token String accessToken = openApiAccessTokenService.getAccessToken(appId, secret); return new Result().ok(accessToken); diff --git a/pom.xml b/pom.xml index b0d6621300..9420c9ff24 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ epmet-module epmet-user epmet-openapi - + UTF-8 From 8afaecaee60ae021fa08beb47edf2e177581b133 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 25 Mar 2021 20:44:01 +0800 Subject: [PATCH 45/71] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-openapi-adv-client/pom.xml | 16 - .../epmet-openapi-adv-server/Dockerfile | 11 - .../deploy/docker-compose-dev.yml | 18 - .../deploy/docker-compose-prod.yml | 18 - .../deploy/docker-compose-test.yml | 18 - .../epmet-openapi-adv-server/pom.xml | 227 ------ .../java/com/epmet/adv/AdvApplication.java | 15 - .../epmet/adv/aspect/RequestLogAspect.java | 40 - .../epmet/adv/config/ModuleConfigImpl.java | 26 - .../adv/controller/AdvVideoController.java | 28 - .../java/com/epmet/adv/dao/AdvVedioDao.java | 33 - .../com/epmet/adv/entity/AdvVedioEntity.java | 56 -- .../epmet/adv/service/AdvVedioService.java | 7 - .../adv/service/impl/AdvVedioServiceImpl.java | 18 - .../src/main/resources/bootstrap.yml | 140 ---- .../db/migration/V0.0.1__createAdvVedio.sql | 18 - .../src/main/resources/logback-spring.xml | 169 ---- .../src/main/resources/mapper/AdvVedioDao.xml | 35 - epmet-openapi/epmet-openapi-adv/pom.xml | 21 - epmet-openapi/epmet-openapi-scan/Dockerfile | 11 - .../deploy/docker-compose-dev.yml | 18 - .../deploy/docker-compose-prod.yml | 18 - .../deploy/docker-compose-test.yml | 18 - epmet-openapi/epmet-openapi-scan/pom.xml | 208 ----- .../epmet/openapi/scan/ScanApplication.java | 30 - .../openapi/scan/aspect/RequestLogAspect.java | 40 - .../scan/common/constant/SysConstant.java | 30 - .../scan/common/enu/CommonErrorCodeEnum.java | 68 -- .../openapi/scan/common/enu/ImgSceneEnum.java | 47 -- .../openapi/scan/common/enu/LabelEnum.java | 66 -- .../openapi/scan/common/enu/RegionIdEnum.java | 49 -- .../scan/common/enu/SuggestionEnum.java | 48 -- .../scan/common/enu/SysResponseEnum.java | 46 -- .../scan/common/enu/TextSceneEnum.java | 46 -- .../scan/common/enu/VideoSceneEnum.java | 50 -- .../scan/common/enu/VoiceSceneEnum.java | 47 -- .../exception/ExecuteHttpException.java | 29 - .../openapi/scan/common/redis/RedisKeys.java | 38 - .../scan/common/util/HttpClientManager.java | 171 ---- .../scan/common/util/IAcsClientUtil.java | 67 -- .../openapi/scan/common/util/MapUtil.java | 55 -- .../openapi/scan/config/ModuleConfigImpl.java | 26 - .../openapi/scan/config/WebAppConfig.java | 31 - .../scan/controller/BackDoorController.java | 32 - .../scan/controller/ScanController.java | 116 --- .../interceptor/ScanApiAuthInterceptor.java | 60 -- .../scan/service/impl/ScanService.java | 69 -- .../scan/service/impl/ScanServiceImpl.java | 734 ------------------ .../scan/support/param/ImgScanParam.java | 48 -- .../openapi/scan/support/param/ImgTask.java | 31 - .../scan/support/param/TextScanParam.java | 48 -- .../openapi/scan/support/param/TextTask.java | 33 - .../support/param/VoiceAsyncScanParam.java | 68 -- .../openapi/scan/support/param/VoiceTask.java | 31 - .../param/video/VideoAsyncScanParam.java | 76 -- .../param/video/VideoAsyncScanTask.java | 30 - .../support/result/ImgAsyncScanResult.java | 24 - .../scan/support/result/ScanTaskResult.java | 28 - .../support/result/SceneDetailResult.java | 31 - .../scan/support/result/SyncScanResult.java | 42 - .../result/VoiceAsyncScanDetailDTO.java | 47 -- .../support/result/VoiceAsyncScanResult.java | 89 --- .../result/VoiceAsyncScanResultDTO.java | 57 -- .../result/VoiceAsyncScanTaskDataDTO.java | 40 - .../result/VoiceAsyncScanTaskResult.java | 46 -- .../video/VideoAsyncScanTaskDataDTO.java | 41 - .../video/VideoAsyncScanTaskResultDTO.java | 45 -- .../support/result/video/VideoResultDTO.java | 48 -- .../result/video/VideoScanOriginDetail.java | 53 -- .../video/VideoScanOriginalResultDTO.java | 51 -- .../src/main/resources/bootstrap.yml | 91 --- .../src/main/resources/logback-spring.xml | 169 ---- .../src/main/resources/readme | 7 - .../src/test/java/BaseSample.java | 50 -- .../java/ImageAsyncScanRequestSample.java | 95 --- .../java/ImageAsyncScanResultsSample.java | 83 -- .../test/java/ImageSyncScanRequestSample.java | 101 --- .../java/VoiceAsyncScanRequestSample.java | 90 --- .../VoiceAsyncScanResultsRequestSample.java | 113 --- epmet-openapi/pom.xml | 19 - 80 files changed, 5007 deletions(-) delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml delete mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml delete mode 100644 epmet-openapi/epmet-openapi-adv/pom.xml delete mode 100644 epmet-openapi/epmet-openapi-scan/Dockerfile delete mode 100644 epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml delete mode 100644 epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml delete mode 100644 epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml delete mode 100644 epmet-openapi/epmet-openapi-scan/pom.xml delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml delete mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/readme delete mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java delete mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java delete mode 100644 epmet-openapi/pom.xml diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml deleted file mode 100644 index 5c57808384..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - epmet-openapi-adv - com.epmet - 2.0.0 - ../pom.xml - - 4.0.0 - - epmet-openapi-adv-client - - - \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile deleted file mode 100644 index d15b865820..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM java:8 - -RUN export LANG="zh_CN.UTF-8" -RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -RUN echo 'Asia/Shanghai' > /etc/timezone - -COPY ./target/*.jar ./epmet-openapi-adv.jar - -EXPOSE 8115 - -ENTRYPOINT ["sh", "-c", "exec $RUN_INSTRUCT"] \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml deleted file mode 100644 index 55c505363d..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "3.7" -services: - epmet-openapi-adv-server: - container_name: epmet-openapi-adv-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-adv-server:version_placeholder - ports: - - "8015:8015" - network_mode: host # 不会创建新的网络 - volumes: - - "/opt/epmet-cloud-logs/dev:/logs" - environment: - RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-adv.jar" - restart: "unless-stopped" - deploy: - resources: - limits: - cpus: '0.1' - memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml deleted file mode 100644 index b5a13e04e3..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "3.7" -services: - epmet-openapi-adv-server: - container_name: epmet-openapi-adv-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-adv-server:0.3.3 - ports: - - "8015:8015" - network_mode: host # 不会创建新的网络 - volumes: - - "/opt/epmet-cloud-logs/prod:/logs" - environment: - RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./epmet-openapi-adv.jar" - restart: "unless-stopped" - deploy: - resources: - limits: - cpus: '0.1' - memory: 600M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml deleted file mode 100644 index 45d536cb2f..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "3.7" -services: - epmet-openapi-adv-server: - container_name: epmet-openapi-adv-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-adv-server:version_placeholder - ports: - - "8015:8015" - network_mode: host # 不会创建新的网络 - volumes: - - "/opt/epmet-cloud-logs/test:/logs" - environment: - RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-adv.jar" - restart: "unless-stopped" - deploy: - resources: - limits: - cpus: '0.1' - memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml deleted file mode 100644 index 8dd1602e70..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml +++ /dev/null @@ -1,227 +0,0 @@ - - - - 0.3.3 - - epmet-openapi-adv - com.epmet - 2.0.0 - ../pom.xml - - 4.0.0 - - epmet-openapi-adv-server - - - - com.epmet - epmet-commons-mybatis - 2.0.0 - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-context-support - - - org.springframework.boot - spring-boot-starter-actuator - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - - io.github.openfeign - feign-httpclient - 10.3.0 - - - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - ${project.basedir}/src/main/java - - - true - ${basedir}/src/main/resources - - - - - - - dev - - 8115 - dev - - - - - - epmet_adv_user - EpmEt-db-UsEr - - 0 - 192.168.1.130 - 6379 - 123456 - - true - 192.168.1.130:8848 - 6ceab336-d004-4acf-89c6-e121d06f4988 - - - false - - - false - - - https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c - - SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 - - - - - local - - true - - - 8115 - local - - - - - - epmet_adv_user - EpmEt-db-UsEr - - 0 - 118.190.150.119 - 47379 - 123456 - - false - 192.168.1.130:8848 - 6ceab336-d004-4acf-89c6-e121d06f4988 - - - false - - - false - - - https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c - - SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 - - https://epmet-dev.elinkservice.cn/api/epmetscan/api - - - - test - - - 8115 - test - - - - - - epmet - elink@833066 - - 0 - r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com - 6379 - EpmEtrEdIs!q@w - - true - 192.168.10.150:8848 - 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae - - - false - - - true - - - https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c - - SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 - - - - - prod - - 8115 - prod - - - - - - epmet_adv_user - EpmEt-db-UsEr - - 0 - r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com - 6379 - EpmEtclOUdrEdIs!Q2w - - true - 192.168.11.180:8848 - bd205d23-e696-47be-b995-916313f86e99 - - - false - - - true - - - - https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c - - SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 - - - - - - \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java deleted file mode 100644 index 61c5d3b4b8..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.epmet; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableFeignClients -public class AdvApplication { - public static void main(String[] args) { - SpringApplication.run(AdvApplication.class, args); - } -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java deleted file mode 100644 index e06fdc2c95..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.epmet.adv.aspect; - -import com.epmet.commons.tools.aspect.BaseRequestLogAspect; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.servlet.http.HttpServletRequest; - -/** - * 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 - */ -@Aspect -@Component -@Order(0) -public class RequestLogAspect extends BaseRequestLogAspect { - - @Override - @Around(value = "execution(* com.epmet.adv.controller.*Controller*.*(..)) ") - public Object proceed(ProceedingJoinPoint point) throws Throwable { - return super.proceed(point, getRequest()); - } - - /** - * 获取Request对象 - * - * @return - */ - private HttpServletRequest getRequest() { - RequestAttributes ra = RequestContextHolder.getRequestAttributes(); - ServletRequestAttributes sra = (ServletRequestAttributes) ra; - return sra.getRequest(); - } - -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java deleted file mode 100644 index 8d88549b66..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - -package com.epmet.adv.config; - -import com.epmet.commons.tools.config.ModuleConfig; -import org.springframework.stereotype.Service; - -/** - * 模块配置信息 - * - * @author Mark sunlightcs@gmail.com - * @since 1.0.0 - */ -@Service -public class ModuleConfigImpl implements ModuleConfig { - @Override - public String getName() { - return "adv"; - } -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java deleted file mode 100644 index 5c032ad562..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.epmet.adv.controller; - -import com.epmet.adv.entity.AdvVedioEntity; -import com.epmet.adv.service.AdvVedioService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.io.IOException; - -@Controller -@RequestMapping("video") -public class AdvVideoController { - - @Autowired - private AdvVedioService advVedioService; - - @GetMapping("company-adv") - public String toVedio() throws IOException { - AdvVedioEntity enableAdvVedioEntity = advVedioService.getEnableAdvVedioEntity(); - String redirectUrl = enableAdvVedioEntity != null ? enableAdvVedioEntity.getPath() : "404"; - return String.format("redirect:%s", redirectUrl); - //response.sendRedirect("www.baidu.com"); - } - -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java deleted file mode 100644 index c14da09d52..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java +++ /dev/null @@ -1,33 +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.adv.dao; - -import com.epmet.adv.entity.AdvVedioEntity; -import com.epmet.commons.mybatis.dao.BaseDao; -import org.apache.ibatis.annotations.Mapper; - -/** - * 宣传视频 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-12-30 - */ -@Mapper -public interface AdvVedioDao extends BaseDao { - AdvVedioEntity getEnableAdvVedioEntity(); -} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java deleted file mode 100644 index a25c6ea77e..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java +++ /dev/null @@ -1,56 +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.adv.entity; - -import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -/** - * 宣传视频 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-12-30 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("adv_vedio") -public class AdvVedioEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 存储路径 - */ - private String path; - - /** - * 存储类型。aliyun_oss,local - */ - private String storeType; - - /** - * 是否启用 - */ - private Integer enable; - -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java deleted file mode 100644 index 38091ee496..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.epmet.adv.service; - -import com.epmet.adv.entity.AdvVedioEntity; - -public interface AdvVedioService { - AdvVedioEntity getEnableAdvVedioEntity(); -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java deleted file mode 100644 index cecc710c39..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.epmet.adv.service.impl; - -import com.epmet.adv.dao.AdvVedioDao; -import com.epmet.adv.entity.AdvVedioEntity; -import com.epmet.adv.service.AdvVedioService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class AdvVedioServiceImpl implements AdvVedioService { - @Autowired - private AdvVedioDao advVedioDao; - - public AdvVedioEntity getEnableAdvVedioEntity() { - return advVedioDao.getEnableAdvVedioEntity(); - } - -} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml deleted file mode 100644 index 0bd40dcca7..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,140 +0,0 @@ -server: - port: @server.port@ - version: @version@ - servlet: - context-path: /adv - -spring: - main: - allow-bean-definition-overriding: true - application: - name: epmet-openapi-adv-server - #环境 dev|test|prod - profiles: - active: @spring.profiles.active@ - messages: - encoding: UTF-8 - basename: i18n/messages_common - jackson: - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - redis: - database: @spring.redis.index@ - host: @spring.redis.host@ - port: @spring.redis.port@ - password: @spring.redis.password@ - timeout: 30s - datasource: - druid: - #MySQL - driver-class-name: com.mysql.cj.jdbc.Driver - url: @spring.datasource.druid.url@ - username: @spring.datasource.druid.username@ - password: @spring.datasource.druid.password@ - initial-size: 10 - max-active: 100 - min-idle: 10 - max-wait: 60000 - pool-prepared-statements: true - max-pool-prepared-statement-per-connection-size: 20 - time-between-eviction-runs-millis: 60000 - min-evictable-idle-time-millis: 300000 - #Oracle需要打开注释 - #validation-query: SELECT 1 FROM DUAL - test-while-idle: true - test-on-borrow: false - test-on-return: false - filter: - stat: - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: false - wall: - config: - multi-statement-allow: true - # 数据迁移工具flyway - flyway: - enabled: @spring.flyway.enabled@ - locations: classpath:db/migration - url: @spring.datasource.druid.url@ - user: @spring.datasource.druid.username@ - password: @spring.datasource.druid.password@ - baseline-on-migrate: true - baseline-version: 0 - cloud: - nacos: - discovery: - server-addr: @nacos.server-addr@ - #nacos的命名空间ID,默认是public - namespace: @nacos.discovery.namespace@ - #不把自己注册到注册中心的地址 - register-enabled: @nacos.register-enabled@ - ip: @nacos.ip@ - config: - enabled: @nacos.config-enabled@ - server-addr: @nacos.server-addr@ - namespace: @nacos.config.namespace@ - group: @nacos.config.group@ - file-extension: yaml -management: - endpoints: - web: - exposure: - include: "*" - endpoint: - health: - show-details: ALWAYS - -mybatis-plus: - mapper-locations: classpath:/mapper/**/*.xml - #实体扫描,多个package用逗号或者分号分隔 - typeAliasesPackage: com.epmet.entity - global-config: - #数据库相关配置 - db-config: - #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; - id-type: ID_WORKER - #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" - field-strategy: NOT_NULL - #驼峰下划线转换 - column-underline: true - banner: false - #原生配置 - configuration: - map-underscore-to-camel-case: true - cache-enabled: false - call-setters-on-nulls: true - jdbc-type-for-null: 'null' - -feign: - hystrix: - enabled: true - client: - config: - default: - loggerLevel: BASIC - okhttp: - enabled: true - - -hystrix: - command: - default: - execution: - isolation: - thread: - timeoutInMilliseconds: 60000 #缺省为1000 - -ribbon: - ReadTimeout: 300000 - ConnectTimeout: 300000 - -#pageHelper分页插件 -pagehelper: - helper-dialect: mysql - reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 - -dingTalk: - robot: - webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql deleted file mode 100644 index 007c12b55f..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql +++ /dev/null @@ -1,18 +0,0 @@ --- create database epmet_adv default character set utf8mb4; - --- CREATE USER epmet_adv_user@'%' IDENTIFIED BY 'EpmEt-db-UsEr'; --- GRANT ALL ON `epmet_adv%`.* TO 'epmet_adv_user'@'%'; --- flush privileges; - -CREATE TABLE `adv_vedio` ( - `ID` varchar(64) NOT NULL COMMENT 'id' primary key , - `PATH` varchar(255) NOT NULL COMMENT '存储路径', - `STORE_TYPE` varchar(30) NOT NULL COMMENT '存储类型。aliyun_oss,local', - `ENABLE` tinyint(1) NOT NULL COMMENT '是否启用', - `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', - `DEL_FLAG` int(11) unsigned DEFAULT NULL COMMENT '删除标识 0:未删除 1:删除', - `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 '更新时间' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宣传视频' \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml deleted file mode 100644 index 06a21d317c..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - ${appname} - - - - - - - - - debug - - - ${CONSOLE_LOG_PATTERN} - - UTF-8 - - - - - - - - ${log.path}/debug.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - - ${log.path}/debug-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - debug - ACCEPT - DENY - - - - - - - ${log.path}/info.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - - ${log.path}/info-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - info - ACCEPT - DENY - - - - - - - ${log.path}/warn.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/warn-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - warn - ACCEPT - DENY - - - - - - - ${log.path}/error.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/error-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - ERROR - ACCEPT - DENY - ${webHook} - ${secret} - ${appname} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml deleted file mode 100644 index 92a4993b9f..0000000000 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/pom.xml b/epmet-openapi/epmet-openapi-adv/pom.xml deleted file mode 100644 index 13490687d1..0000000000 --- a/epmet-openapi/epmet-openapi-adv/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - epmet-openapi - com.epmet - 2.0.0 - - pom - 4.0.0 - - epmet-openapi-adv - - - epmet-openapi-adv-client - epmet-openapi-adv-server - - - - \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/Dockerfile b/epmet-openapi/epmet-openapi-scan/Dockerfile deleted file mode 100644 index 868fc70ac1..0000000000 --- a/epmet-openapi/epmet-openapi-scan/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM java:8 - -RUN export LANG="zh_CN.UTF-8" -RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -RUN echo 'Asia/Shanghai' > /etc/timezone - -COPY ./target/*.jar ./epmet-openapi-scan.jar - -EXPOSE 8107 - -ENTRYPOINT ["sh", "-c", "exec $RUN_INSTRUCT"] \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml deleted file mode 100644 index 4e86ab5e89..0000000000 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ /dev/null @@ -1,18 +0,0 @@ -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:version_placeholder - ports: - - "8107:8107" - network_mode: host # 不会创建新的网络 - volumes: - - "/opt/epmet-cloud-logs/dev:/logs" - environment: - RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-scan.jar" - restart: "unless-stopped" - deploy: - resources: - limits: - cpus: '0.1' - memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml deleted file mode 100644 index 69873777e7..0000000000 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ /dev/null @@ -1,18 +0,0 @@ -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.24 - ports: - - "8107:8107" - network_mode: host # 不会创建新的网络 - volumes: - - "/opt/epmet-cloud-logs/prod:/logs" - environment: - RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./epmet-openapi-scan.jar" - restart: "unless-stopped" - deploy: - resources: - limits: - cpus: '0.1' - memory: 600M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml deleted file mode 100644 index 49ce30a8c1..0000000000 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ /dev/null @@ -1,18 +0,0 @@ -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:version_placeholder - ports: - - "8107:8107" - network_mode: host # 不会创建新的网络 - volumes: - - "/opt/epmet-cloud-logs/test:/logs" - environment: - RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-scan.jar" - restart: "unless-stopped" - deploy: - resources: - limits: - cpus: '0.1' - memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml deleted file mode 100644 index b80b8a843e..0000000000 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - 4.0.0 - 0.3.24 - epmet-openapi-scan - jar - - - epmet-openapi - com.epmet - 2.0.0 - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-context-support - - - org.springframework.boot - spring-boot-starter-actuator - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - com.epmet - epmet-commons-tools - 2.0.0 - - - - com.aliyun - aliyun-java-sdk-core - 4.1.1 - - - com.aliyun - aliyun-java-sdk-green - 3.5.1 - - - - org.apache.httpcomponents - httpclient - 4.5.2 - - - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - ${project.basedir}/src/main/java - - - true - ${basedir}/src/main/resources - - - - - - - dev - - 8107 - dev - - - - 0 - 192.168.1.130 - 6379 - 123456 - - true - 192.168.1.130:8848 - 6ceab336-d004-4acf-89c6-e121d06f4988 - - - false - - - - https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c - - SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 - - - - - local - - true - - - 8107 - dev - - - - 0 - 192.168.1.130 - 6379 - 123456 - - false - 192.168.1.130:8848 - 6ceab336-d004-4acf-89c6-e121d06f4988 - - - false - - - - https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c - - SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 - - - - - test - - 8107 - test - - - 0 - r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com - 6379 - EpmEtrEdIs!q@w - - true - 192.168.10.150:8848 - 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae - - - false - - - - https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c - - SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 - - - - - - prod - - - 8107 - prod - - - 0 - r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com - 6379 - EpmEtclOUdrEdIs!Q2w - - true - 192.168.11.180:8848 - bd205d23-e696-47be-b995-916313f86e99 - - - false - - - - - - https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c - - SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 - - - - - - \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java deleted file mode 100644 index 38f55211d2..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - -package com.epmet.openapi.scan; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; - -/** - * 管理后台 - * - * @author Mark sunlightcs@gmail.com - * @since 1.0.0 - */ - -@SpringBootApplication -@ComponentScan(basePackages = "com.epmet") -public class ScanApplication { - - public static void main(String[] args) { - SpringApplication.run(ScanApplication.class, args); - } - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java deleted file mode 100644 index ae6960a52d..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.epmet.openapi.scan.aspect; - -import com.epmet.commons.tools.aspect.BaseRequestLogAspect; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.servlet.http.HttpServletRequest; - -/** - * 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 - */ -@Aspect -@Component -@Order(0) -public class RequestLogAspect extends BaseRequestLogAspect { - - @Override - @Around(value = "execution(* com.epmet.openapi.scan.controller.*Controller*.*(..)) ") - public Object proceed(ProceedingJoinPoint point) throws Throwable { - return super.proceed(point, getRequest()); - } - - /** - * 获取Request对象 - * - * @return - */ - private HttpServletRequest getRequest() { - RequestAttributes ra = RequestContextHolder.getRequestAttributes(); - ServletRequestAttributes sra = (ServletRequestAttributes) ra; - return sra.getRequest(); - } - -} 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 deleted file mode 100644 index 387294c23b..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.epmet.openapi.scan.common.constant; - -/** - * 系统常量 - * - * @author jianjun liu - * @date 2020-06-05 10:42 - **/ -public class SysConstant { - - public static final String UTF8 = "utf-8"; - /** - * 文本审核最大任务数 - */ - public static final Integer MAX_TASK_SIZE = 100; - - /** - * 图片审核最大任务数 - */ - public static final Integer MAX_SCAN_IMG_TASK_SIZE = 10; - - public static final String CODE = "code"; - public static final String DATA = "data"; - - - /** - * 任务正在执行中,建议您等待一段时间(例如5s)后再查询结果。 - */ - public static final int PROCESSING=280; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java deleted file mode 100644 index 8ebed5781f..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import com.epmet.commons.tools.constant.StrConstant; - -/** - * 公共错误码 - * - * @author yinzuomei@elink-cn.com - * @date 2021/1/10 19:43 - */ -public enum CommonErrorCodeEnum { - OK(200, "请求成功。"), - PROCESSING(280, "任务正在执行中,建议您等待一段时间(例如5s)后再查询结果。"), - BAD_REQUEST(400, "请求有误,通常由于请求参数不正确导致,请仔细检查请求参数。"), - NOT_ALLOWED(401, "请求失败,通常是由于使用了不安全的图片、视频、语音链接地址。"), - FORBIDDEN(403, "请求访问失败,通常由于您的图片、视频、语音链接无法访问导致,请确认公网是否可访问,并且无防盗链策略。"), - NOT_FOUND(404, "待检测内容未找到,通常是由于您的图片、视频、语音内容无法下载导致,请确认内容可通过公网访问到。"), - DOWNLOAD_FAILED(480, "下载失败,请确认待检测内容的大小、分辨率(如果有)在API的限制范围内。"), - GENERAL_ERROR(500, "一般是服务端临时出错。建议重试,若持续返回该错误码,请通过工单联系我们。"), - DB_FAILED(580, "数据库操作失败。建议重试,若持续返回该错误码,请通过工单联系我们。"), - TIMEOUT(581, "超时。建议重试,若持续返回该错误码,请通过工单联系我们。"), - CACHE_FAILED(585, "缓存出错。建议重试,若持续返回该错误码,请通过工单联系我们。"), - ALGO_FAILED(586, "算法出错。请通过工单联系我们。"), - MQ_FAILED(587, "中间件出错。请通过工单联系我们。"), - EXCEED_QUOTA(588, "请求频率超出配额。默认配额:图片检测50张/秒,视频检测20路/秒,语音检测20路/秒,文本检测100条/秒。如果需要调整配额,请通过工单联系我们。"), - TOO_LARGE(589, "待检测内容过大,请确保检测的内容在API的限制范围内。建议重试,若持续返回该错误码,请通过工单联系我们。"), - BAD_FORMAT(590, "待检测内容格式错误,请确保检测的内容在API的限制范围内。"), - CONNECTION_POOL_FULL(591, "连接池满。请通过工单联系我们。"), - DOWNLOAD_TIMEOUT(592, "下载超时,下载时间限制为3s,请确保检测的内容大小在API的限制范围内。"), - EXPIRED(594, "任务过期,如taskId过期。"), - CATCH_FRAME_FAILED(595, "截帧失败,请通过工单联系我们。"), - PERMISSION_DENY(596, "账号未授权、账号欠费、账号未开通、账号被禁等原因,具体可以参考返回的msg。"); - - - private Integer code; - private String desc; - - CommonErrorCodeEnum(Integer code, String desc) { - this.code = code; - this.desc = desc; - } - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public static String getErrorMsg(Integer value) { - CommonErrorCodeEnum[] codeEnums = values(); - for (CommonErrorCodeEnum commonErrorCodeEnum : codeEnums) { - if (commonErrorCodeEnum.getCode().equals(value)) { - return commonErrorCodeEnum.getDesc(); - } - } - return StrConstant.EPMETY_STR; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java deleted file mode 100644 index cfb8d77ac2..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import java.util.ArrayList; -import java.util.List; - -/** - * desc:图片检测场景 - * @author jianjun liu - * @date 2020-06-04 21:39 - **/ -public enum ImgSceneEnum { - PORN("porn", "图片智能鉴黄"), - TERRORISM("terrorism", "图片暴恐涉政识别"); - - private String code; - private String desc; - - ImgSceneEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - - public static List getImgSceneList() { - List result = new ArrayList<>(); - ImgSceneEnum[] values = ImgSceneEnum.values(); - for (ImgSceneEnum v : values) { - result.add(v.getCode()); - } - return result; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java deleted file mode 100644 index 7ad96f3171..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import java.util.ArrayList; -import java.util.List; - -/** - * 阿里检测结果的分类字典 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/18 14:04 - */ -public enum LabelEnum { - NORMAL("normal", "正常文本"), - SPAM("spam", "含垃圾信息"), - AD("ad", "广告"), - POLITICS("politics","涉政"), - TERRORISM("terrorism","暴恐"), - ABUSE("abuse","辱骂"), - PORN("porn","色情"), - FLOOD("flood","灌水"), - CONTRABAND("contraband","违禁"), - MEANINGLESS("meaningless","无意义"), - CUSTOMIZED("customized","自定义"); - - private String code; - private String desc; - - LabelEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - - public static List getLabelEnumList() { - List result = new ArrayList<>(); - LabelEnum[] values = LabelEnum.values(); - for (LabelEnum v : values) { - result.add(v.getCode()); - } - return result; - } - - public static String getDesc(String code) { - LabelEnum[] businessModeEnums = values(); - for (LabelEnum labelEnum : businessModeEnums) { - if (labelEnum.getCode().equals(code)) { - return labelEnum.getDesc(); - } - } - return ""; - } - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java deleted file mode 100644 index e1dbd5897b..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -/** - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-04 21:39 - **/ -public enum RegionIdEnum { - SHANG_HAI("cn-shanghai","green.cn-shanghai.aliyuncs.com"), - BEI_JING("cn-beijing","green.cn-beijing.aliyuncs.com"), - AP_SOUTHEAST_1("ap-southeast-1","green.ap-southeast-1.aliyuncs.com"), - US_WEST_1("us-west-1","green.us-west-1.aliyuncs.com"); - - private String regionId; - private String domain; - RegionIdEnum(String regionId, String domain){ - this.regionId = regionId; - this.domain = domain; - } - - public static String getDoMain(String regionId){ - if (regionId == null) { - return SHANG_HAI.getDomain(); - } - RegionIdEnum[] values = RegionIdEnum.values(); - for (RegionIdEnum v : values) { - if (regionId.equals(v.getDomain())) { - return v.getDomain(); - } - } - return SHANG_HAI.getDomain(); - } - - public String getRegionId() { - return regionId; - } - - public void setRegionId(String regionId) { - this.regionId = regionId; - } - - public String getDomain() { - return domain; - } - - public void setDomain(String domain) { - this.domain = domain; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java deleted file mode 100644 index 3881508341..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import java.util.ArrayList; -import java.util.List; - -/** - * desc:检测建议 - * @author jianjun liu - * @date 2020-06-04 21:39 - **/ -public enum SuggestionEnum { - PASS("pass", "正常"), - REVIEW("review", "需要人工审核"), - BLOCK("block", "内容违规"); - - private String code; - private String desc; - - SuggestionEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - - public static List getImgSceneList() { - List result = new ArrayList<>(); - SuggestionEnum[] values = SuggestionEnum.values(); - for (SuggestionEnum v : values) { - result.add(v.getCode()); - } - return result; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java deleted file mode 100644 index f906186333..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -/** - * @author jianjun liu - * @date 2020-06-04 21:39 - **/ -public enum SysResponseEnum { - /** - * - * 业务代码枚举类 - * - * 编码样式:【CCCBBOOXX】 - * 编码示例说明: - * CCC 中心编码&业务系统 (110-内容扫描服务中心服务) - * BB 业务类型(00-默认 ) - * OO 操作类型(00-默认) - * XX 具体编码(00-成功,01-失败,02-参数错误,10-异常 99-系统错误) - * - */ - /*通用枚举 */ - EXCEPTION(10001,"系统异常"), - THIRD_PLATFORM_SERVER_ERROR(10002,"第三方检测服务异常,请稍候重试"), - THIRD_PLATFORM_RESP_STATUS_ERROR(10003,"第三方检测服务响应异常,请稍候重试"), - THIRD_PLATFORM_RESP_CODE_ERROR(10004,"第三方检测服务检测异常,请稍候重试"), - - - /*审核内容 业务 01*/ - SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表长度超过限制"), - SCAN_PARAM_ERROR(110010002,"参数格式不正确"), - ; - - 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-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java deleted file mode 100644 index 263d6e25ed..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import java.util.ArrayList; -import java.util.List; - -/** - * desc:文本检测场景 - * @author jianjun liu - * @date 2020-06-04 21:39 - **/ -public enum TextSceneEnum { - ANTISPAM("antispam", "文本垃圾内容检测"); - - private String code; - private String desc; - - TextSceneEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - - public static List getTextSceneList() { - List result = new ArrayList<>(); - TextSceneEnum[] values = TextSceneEnum.values(); - for (TextSceneEnum v : values) { - result.add(v.getCode()); - } - return result; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java deleted file mode 100644 index 864d137dd2..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import java.util.ArrayList; -import java.util.List; - -/** - * desc:视频检测场景 - * @author yinzuomei@elink-cn.com - * @date 2020/12/29 13:47 - **/ -public enum VideoSceneEnum { - PORN("porn", "视频智能鉴黄"), - TERRORISM("terrorism", "视频暴恐涉政"), - LIVE("live","视频不良场景"), - LOGO("logo","视频logo"), - AD("ad","视频图文违规"); - - private String code; - private String desc; - - VideoSceneEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - - public static List getVideoSceneList() { - List result = new ArrayList<>(); - VideoSceneEnum[] values = VideoSceneEnum.values(); - for (VideoSceneEnum v : values) { - result.add(v.getCode()); - } - return result; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java deleted file mode 100644 index 777b92f0d7..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.epmet.openapi.scan.common.enu; - -import java.util.ArrayList; -import java.util.List; - -/** - * 语音异步检测场景 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 10:12 - */ -public enum VoiceSceneEnum { - ANTISPAM("antispam", "检测场景,取值:antispam"); - - private String code; - private String desc; - - VoiceSceneEnum(String code, String desc) { - this.code = code; - this.desc = desc; - } - - public static List getVoiceSceneList() { - List result = new ArrayList<>(); - VoiceSceneEnum[] values = VoiceSceneEnum.values(); - for (VoiceSceneEnum v : values) { - result.add(v.getCode()); - } - return result; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java deleted file mode 100644 index a5694da79c..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.epmet.openapi.scan.common.exception; - -import com.epmet.openapi.scan.common.enu.SysResponseEnum; - -/** - * @author jianjun liu - * @date 2020-06-05 10:31 - **/ -public class ExecuteHttpException extends RuntimeException { - private int code; - private String msg; - - public ExecuteHttpException(String msg) { - this(SysResponseEnum.EXCEPTION.getCode(), msg); - } - - public ExecuteHttpException(int code, String msg) { - this.code = code; - this.msg = msg; - } - - public int getCode() { - return code; - } - - public String getMsg() { - return msg; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java deleted file mode 100644 index 2939bd62eb..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - *

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

- * 版权所有,侵权必究! - */ - -package com.epmet.openapi.scan.common.redis; - -/** - * @author Mark sunlightcs@gmail.com - * @since 1.0.0 - */ -public class RedisKeys { - - /** - * 党群e事通redis前缀 - */ - private static String rootPrefix = "epmet:"; - - /** - * desc:白名单Key - * @return - */ - public static String getWhiteList () { - return rootPrefix.concat("openapi:scan:whitelist"); - } - - /** - * desc: 语音检测任务,异步回调,需要根据taskId获取存储seed的Key - * @param taskId 提交检测任务API接口返回的taskId eg:1001 - * @return epmet:openapi:scan:voice:seed:1001 - */ - public static String getVoiceScanSeedKey(String taskId){ - return rootPrefix.concat("openapi:scan:voice:seed:").concat(taskId); - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java deleted file mode 100644 index 7ca0302331..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.epmet.openapi.scan.common.util; - -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.utils.Result; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -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; -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.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.springframework.util.CollectionUtils; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * desc: http 工具类 - * date: 2020/6/4 22:27 - * - * @author: jianjun liu - */ -@Slf4j -public class HttpClientManager { - private static int connectionTimeout = 3000;// 连接超时时间,毫秒 - private static int soTimeout = 10000;// 读取数据超时时间,毫秒 - /** - * HttpClient对象 - */ - private static CloseableHttpClient httpclient = HttpClients.custom().disableAutomaticRetries().build(); - - /*** 超时设置 ****/ - private static RequestConfig requestConfig = RequestConfig.custom() - .setSocketTimeout(soTimeout) - .setConnectTimeout(connectionTimeout) - .build();//设置请求和传输超时时间 - - public static HttpClientManager getInstance() { - return SingleClass.instance; - } - - private static class SingleClass { - private final static HttpClientManager instance = new HttpClientManager(); - } - - /** - * desc: 发送json post 请求 - * param: url,jsonStrParam - * return: Result - * date: 2019/2/21 9:12 - * - * @author: jianjun liu - */ - public Result sendPost(String url, Map paramsMap) { - - try { - HttpPost httppost = new HttpPost(url); - httppost.setConfig(requestConfig); - httppost.addHeader("Content-Type", "application/x-www-form-urlencoded charset=utf-8"); - - List list = new ArrayList(); - for (String key : paramsMap.keySet()) { - list.add(new BasicNameValuePair(key, String.valueOf(paramsMap.get(key)))); - } - UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(list, "utf-8"); - httppost.setEntity(urlEncodedFormEntity); - - return execute(httppost); - } catch (Exception e) { - e.printStackTrace(); - log.error("send exception", e); - return new Result().error(8000, e.getMessage()); - } - - } - - /** - * desc: 发送json post 请求 - * param: url,jsonStrParam - * return: Result - * date: 2019/2/21 9:12 - * - * @author: jianjun liu - */ - public Result sendPostByJSON(String url, String jsonStrParam) { - - try { - HttpPost httppost = new HttpPost(url); - httppost.setConfig(requestConfig); - httppost.addHeader("Content-Type", "application/json; charset=utf-8"); - if (StringUtils.isNotEmpty(jsonStrParam)) { - StringEntity se = new StringEntity(jsonStrParam, "utf-8"); - httppost.setEntity(se); - } - return execute(httppost); - } catch (Exception e) { - e.printStackTrace(); - log.error("send exception", e); - return new Result().error(8000, e.getMessage()); - } - - } - - /** - * desc: 发送get请求 - * param:url, params - * return: Result - * date: 2019/2/21 9:16 - * - * @author: jianjun liu - */ - public Result sendGet(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 execute(httpGet); - } catch (Exception e) { - log.error("sendGet exception", e); - return new Result().error(8000, e.getMessage()); - } - } - - private Result execute(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) { - String result = EntityUtils.toString(response.getEntity()); - return new Result().ok(result); - } else { - log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); - } - } - } catch (Exception e) { - log.error("execute exception", e); - } finally { - httpMethod.releaseConnection(); - try { - if (response != null) { - response.close(); - } - } catch (IOException e) { - } - } - return new Result().error(8000, "系统异常"); - } -} - - diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java deleted file mode 100644 index c0c8362727..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.epmet.openapi.scan.common.util; - -/** - * @author jianjun liu - * @date 2020-06-05 10:03 - **/ - -import com.aliyuncs.DefaultAcsClient; -import com.aliyuncs.IAcsClient; -import com.aliyuncs.exceptions.ClientException; -import com.aliyuncs.profile.DefaultProfile; -import com.aliyuncs.profile.IClientProfile; -import com.epmet.openapi.scan.common.enu.RegionIdEnum; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; - -@Slf4j -@Component -public class IAcsClientUtil { - private static String accessKeyId; - private static String secret; - private static String product = "Green"; - - private static String regionId; - private static String endpointName = ""; - - private static IClientProfile profile; - - - @PostConstruct - private void initProFile() { - profile = DefaultProfile.getProfile(regionId, accessKeyId, secret); - try { - DefaultProfile.addEndpoint(endpointName, regionId, product, RegionIdEnum.getDoMain(regionId)); - } catch (ClientException e) { - log.error("initProFile exception", e.getMessage()); - } - } - - - public static IAcsClient getIAcsClient() { - return new DefaultAcsClient(profile); - } - - @Value("${aliyun.green.accessKeyId}") - public void setAccessKeyId(String accessKeyId) { - IAcsClientUtil.accessKeyId = accessKeyId; - } - - @Value("${aliyun.green.accessKeySecret}") - public void setSecret(String secret) { - IAcsClientUtil.secret = secret; - } - - @Value("${aliyun.green.regionId}") - public void setRegionId(String regionId) { - IAcsClientUtil.regionId = regionId; - } - - @Value("${aliyun.green.regionId}") - public void setEndpointName(String endpointName) { - IAcsClientUtil.endpointName = endpointName; - } -} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java deleted file mode 100644 index e98dbfd7a2..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.epmet.openapi.scan.common.util; - -import org.apache.commons.lang3.StringUtils; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author jianjun liu - * @date 2020-06-05 16:44 - **/ -public class MapUtil { - /** - * 将url参数转换成map - * - * @param param aa=11&bb=22&cc=33 - * @return - */ - public static Map getUrlParams(String param) { - Map map = new HashMap<>(0); - if (StringUtils.isBlank(param)) { - return map; - } - String[] params = param.split("&"); - for (int i = 0; i < params.length; i++) { - String[] p = params[i].split("="); - if (p.length == 2) { - map.put(p[0], p[1]); - } - } - return map; - } - - /** - * 将map转换成url - * - * @param map - * @return - */ - public static String getUrlParamsByMap(Map map) { - if (map == null) { - return ""; - } - StringBuffer sb = new StringBuffer(); - for (Map.Entry entry : map.entrySet()) { - sb.append(entry.getKey() + "=" + entry.getValue()); - sb.append("&"); - } - String s = sb.toString(); - if (s.endsWith("&")) { - s = StringUtils.substringBeforeLast(s, "&"); - } - return s; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java deleted file mode 100644 index 68532b7819..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - -package com.epmet.openapi.scan.config; - -import com.epmet.commons.tools.config.ModuleConfig; -import org.springframework.stereotype.Service; - -/** - * 模块配置信息 - * - * @author Mark sunlightcs@gmail.com - * @since 1.0.0 - */ -@Service -public class ModuleConfigImpl implements ModuleConfig { - @Override - public String getName() { - return "epmetscan"; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java deleted file mode 100644 index c955a7f555..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.epmet.openapi.scan.config; - -import com.epmet.openapi.scan.interceptor.ScanApiAuthInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-08 14:30 - **/ - - @Configuration - public class WebAppConfig implements WebMvcConfigurer{ - @Autowired - private ScanApiAuthInterceptor scanApiAuthInterceptor; - - // 多个拦截器组成一个拦截器链 - // addPathPatterns 用于添加拦截规则 - // excludePathPatterns 用户排除拦截 - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(scanApiAuthInterceptor)//添加拦截器 - .addPathPatterns("/**") //拦截所有请求 - .excludePathPatterns("/opback/**");//对应的不拦截的请求 - } - } - diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java deleted file mode 100644 index 433ff1b06d..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.epmet.openapi.scan.controller; - -import com.alibaba.fastjson.JSON; -import com.epmet.openapi.scan.common.redis.RedisKeys; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.SetOperations; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Set; - -/** - * @author jianjun liu - * @date 2020-06-04 20:39 - **/ -@RestController -@RequestMapping("opback") -public class BackDoorController { - @Autowired - private RedisTemplate redisTemplate; - - @RequestMapping("addWhite") - public String addWhite(@RequestParam String ip) { - SetOperations setOperations = redisTemplate.opsForSet(); - String whiteList = RedisKeys.getWhiteList(); - Long add = setOperations.add(whiteList, ip); - Set members = setOperations.members(whiteList); - return "ip:" + ip + "添加" + (add > 0 ? "成功" : "失败") + ",当前所有列表:" + JSON.toJSONString(members); - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java deleted file mode 100644 index cee27d28b8..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.epmet.openapi.scan.controller; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.openapi.scan.common.constant.SysConstant; -import com.epmet.openapi.scan.common.enu.SysResponseEnum; -import com.epmet.openapi.scan.service.impl.ScanService; -import com.epmet.openapi.scan.support.param.ImgScanParam; -import com.epmet.openapi.scan.support.param.TextScanParam; -import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; -import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; -import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; -import com.epmet.openapi.scan.support.result.SyncScanResult; -import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; -import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; -import com.epmet.openapi.scan.support.result.video.VideoAsyncScanTaskResultDTO; -import com.epmet.openapi.scan.support.result.video.VideoResultDTO; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-05 10:39 - **/ -@RestController -@RequestMapping("api") -public class ScanController { - - @Autowired - private ScanService scanService; - - /** - * desc:图片同步检测接口 - * - * @param param - * @return - */ - @RequestMapping("imgSyncScan") - public Result ImgSyncScan(@RequestBody ImgScanParam param) { - ValidatorUtils.validateEntity(param); - return scanService.sendSyncImgScan(param); - } - - /** - * desc:文本同步检测接口 - * - * @param param - * @return - */ - @RequestMapping("textSyncScan") - public Result textSyncScan(@RequestBody TextScanParam param) { - ValidatorUtils.validateEntity(param); - return scanService.sendTextScan(param); - } - - //@RequestMapping("imgAsyncScan") - public Result ImgAsyncScan(@RequestBody ImgScanParam param) { - return null;//scanService.sendASyncImgScan(param); - } - - - /** - * @description 语音异步检测 - * @Date 2020/12/9 9:14 - **/ - @PostMapping("voiceAsyncScan") - public Result voiceAsyncScan(@RequestBody VoiceAsyncScanParam param){ - ValidatorUtils.validateEntity(param); - return scanService.sendVoiceAsyncScan(param); - } - - /** - * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 - * @author yinzuomei - * @description 语音异步检测结果查询 - * @Date 2020/12/9 11:16 - **/ - @PostMapping("voiceResults") - public Result> voiceResults(@RequestBody List taskIds){ - return scanService.voiceResults(taskIds); - } - - /** - * @author yinzuomei - * @description 视频检测-异步检测 - **/ - @PostMapping("videoAsyncScan") - public Result videoAsyncScan(@RequestBody VideoAsyncScanParam param) { - ValidatorUtils.validateEntity(param); - return scanService.videoAsyncScan(param); - } - - /** - * @author yinzuomei - * @description 视频异步检测结果查询接口 - **/ - @PostMapping("videoResults") - public Result videoResults(@RequestBody List taskIds) { - if (CollectionUtils.isEmpty(taskIds)) { - return new Result<>(); - } - //检测对象不能为空,且最多支持100个元素 - if (org.springframework.util.CollectionUtils.isEmpty(taskIds) || taskIds.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())); - } - return scanService.videoResults(taskIds); - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java deleted file mode 100644 index 6ce851a45e..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.epmet.openapi.scan.interceptor; - -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.utils.IpUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.openapi.scan.common.redis.RedisKeys; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -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.Component; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author jianjun liu - * @date 2020-06-05 16:36 - **/ -@Component -public class ScanApiAuthInterceptor implements HandlerInterceptor { - private static final Logger log = LoggerFactory.getLogger(ScanApiAuthInterceptor.class); - @Autowired - private RedisTemplate redisTemplate; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - String ip = IpUtils.getIpAddr(request); - SetOperations setOperations = redisTemplate.opsForSet(); - if (!setOperations.isMember(RedisKeys.getWhiteList(), ip)) { - log.warn("preHandle ip:{} is not in whitelist", ip); - String result = JSON.toJSONString(new Result<>().error(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg())); - responseJson(response, result); - return false; - } - return true; - } - - private void responseJson(HttpServletResponse response, String json) throws Exception { - PrintWriter writer = null; - response.setCharacterEncoding("UTF-8"); - response.setContentType("text/json; charset=utf-8"); - try { - writer = response.getWriter(); - writer.print(json); - } catch (IOException e) { - log.error(e.toString()); - } finally { - if (writer != null) { - writer.close(); - } - } - } - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java deleted file mode 100644 index 4a3e734893..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.epmet.openapi.scan.service.impl; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.openapi.scan.support.param.ImgScanParam; -import com.epmet.openapi.scan.support.param.TextScanParam; -import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; -import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; -import com.epmet.openapi.scan.support.result.SyncScanResult; -import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; -import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; -import com.epmet.openapi.scan.support.result.video.VideoAsyncScanTaskResultDTO; -import com.epmet.openapi.scan.support.result.video.VideoResultDTO; - -import java.util.List; - -/** - * desc:内容扫描接口 - * - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-05 13:12 - **/ -public interface ScanService { - /** - * desc:扫描文本内容 同步 - * @param textScanParam - * @return ImgAsyncScanResult - */ - public Result sendTextScan(TextScanParam textScanParam); - - - /** - * desc:扫描图片内容 同步 - * @param imgScanParam - * @return - */ - public Result sendSyncImgScan(ImgScanParam imgScanParam); - - /** - * 语音异步检测 - * - * @param param - * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult - */ - Result sendVoiceAsyncScan(VoiceAsyncScanParam param); - - /** - * 语音异步检测结果查询 - * - * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 - * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanResult - */ - Result> voiceResults(List taskIds); - - /** - * desc:视频检测-异步检测 - * @param videoAsyncScanParam - * @return 异步检测)返回数据:taskId<=>dataId - */ - Result videoAsyncScan(VideoAsyncScanParam videoAsyncScanParam); - - /** - * @param taskIds - * @author yinzuomei - * @description 视频异步检测结果查询接口 - * @Date 2020/12/29 16:10 - **/ - Result videoResults(List taskIds); -} 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 deleted file mode 100644 index 44dd0da3de..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ /dev/null @@ -1,734 +0,0 @@ -package com.epmet.openapi.scan.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.aliyuncs.AcsRequest; -import com.aliyuncs.green.model.v20180509.*; -import com.aliyuncs.http.FormatType; -import com.aliyuncs.http.HttpResponse; -import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.aliyuncs.http.MethodType; -import com.epmet.commons.tools.utils.Result; -import com.epmet.openapi.scan.common.constant.SysConstant; -import com.epmet.openapi.scan.common.enu.*; -import com.epmet.openapi.scan.common.exception.ExecuteHttpException; -import com.epmet.openapi.scan.common.redis.RedisKeys; -import com.epmet.openapi.scan.common.util.IAcsClientUtil; -import com.epmet.openapi.scan.support.param.*; -import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; -import com.epmet.openapi.scan.support.param.video.VideoAsyncScanTask; -import com.epmet.openapi.scan.support.result.*; -import com.epmet.openapi.scan.support.result.video.*; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.ListUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpStatus; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.ValueOperations; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -/** - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-05 13:16 - **/ -@Slf4j -@Service -public class ScanServiceImpl implements ScanService { - @Value("${aliyun.green.regionId}") - private String regionId; - @Value("${aliyun.green.bizType}") - private String bizType; - @Autowired - private RedisTemplate redisTemplate; - @Override - public Result sendTextScan(TextScanParam textScanParam) { - //默认参数 - // 鉴黄 暴恐涉政 - textScanParam.setScenes(TextSceneEnum.getTextSceneList()); - textScanParam.setBizType(bizType); - - List textTasks = textScanParam.getTasks(); - 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 = 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()); - } - - try { - SyncScanResult textScanResult = executeSyncText(textScanRequest); - return new Result().ok(textScanResult); - } catch (ExecuteHttpException e) { - log.error("sendTextScan execute Exception", e); - return new Result().error(e.getCode(), e.getMsg()); - } - } - - 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) { - //默认参数 - // 鉴黄 暴恐涉政 - imgScanParam.setScenes(ImgSceneEnum.getImgSceneList()); - imgScanParam.setBizType(bizType); - - List imgTasks = imgScanParam.getTasks(); - 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) { - log.error("sendSyncImgScan parse param exception", e); - return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); - } - - try { - SyncScanResult scanResult = executeSyncImg(imageSyncScanRequest); - return new Result().ok(scanResult); - } catch (ExecuteHttpException e) { - log.error("sendImgScan execute exception,param:{},fail msg:{}", JSON.toJSONString(imgScanParam), e.getMsg()); - return new Result().error(e.getCode(), e.getMsg()); - } - } - - 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 { - HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(textScanRequest); - - if (httpResponse.isSuccess()) { - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8)); - if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { - //任务 列表 - List scanTaskResults = scrResponse.getJSONArray(SysConstant.DATA).toJavaList(ScanTaskResult.class); - for (ScanTaskResult taskResult : scanTaskResults) { - result.getDetails().add(taskResult); - //又根据场景不同 - if (HttpStatus.SC_OK != taskResult.getCode()) { - if (!result.getFailDataIds().contains(taskResult.getDataId())) { - result.getFailDataIds().add(taskResult.getDataId()); - log.warn("executeSyncText task process fail:code:{},result:{}", taskResult.getCode(), JSON.toJSONString(taskResult)); - } - continue; - } - //如果是多个场景 则为对个 BaseScanResult - List sceneResults = taskResult.getResults(); - //是文本检测 目前就一种场景 - boolean isSuccess = true; - for (SceneDetailResult sceneResult : sceneResults) { - String suggestion = sceneResult.getSuggestion(); - if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { - isSuccess = false; - break; - } - } - if (isSuccess) { - result.getSuccessDataIds().add(taskResult.getDataId()); - } else { - log.warn("executeSyncText dataId:{} block:{}", taskResult.getDataId(), JSON.toJSONString(taskResult.getResults())); - result.getFailDataIds().add(taskResult.getDataId()); - } - } - return result; - } else { - log.warn("executeSyncText response not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } else { - log.warn("executeSyncText response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } catch (Exception e) { - log.error("executeSyncText exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); - } - } - - private SyncScanResult executeSyncImg(AcsRequest request) { - SyncScanResult result = new SyncScanResult(); - try { - HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request); - if (httpResponse.isSuccess()) { - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8)); - if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { - JSONArray taskResults = scrResponse.getJSONArray(SysConstant.DATA); - List scanTaskResults = taskResults.toJavaList(ScanTaskResult.class); - for (ScanTaskResult taskResult : scanTaskResults) { - result.getDetails().add(taskResult); - if (HttpStatus.SC_OK != taskResult.getCode()) { - if (!result.getFailDataIds().contains(taskResult.getDataId())) { - result.getFailDataIds().add(taskResult.getDataId()); - log.warn("executeSyncImg detect not success. code:{},result:{}", taskResult.getCode(), JSON.toJSONString(taskResult)); - } - continue; - } - //如果是多个场景 则为对个 BaseScanResult - List sceneResults = taskResult.getResults(); - - boolean isSuccess = true; - for (SceneDetailResult sceneResult : sceneResults) { - String suggestion = sceneResult.getSuggestion(); - if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { - isSuccess = false; - break; - } - } - if (isSuccess) { - result.getSuccessDataIds().add(taskResult.getDataId()); - } else { - log.warn("executeSyncImg dataId:{} block:{}", taskResult.getDataId(), JSON.toJSONString(taskResult.getResults())); - result.getFailDataIds().add(taskResult.getDataId()); - } - } - return result; - } else { - log.warn("executeSyncImg detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } else { - log.warn("executeSyncImg response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } catch (Exception e) { - log.error("executeSyncImg exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); - } - } - - /** - * @author yinzuomei - * @description 语音异步检测 - * @Date 2020/12/9 10:02 - */ - @Override - public Result sendVoiceAsyncScan(VoiceAsyncScanParam voiceAsyncScanParam) { - //检测对象不能为空,且最多支持100个元素 - List voiceTasks = voiceAsyncScanParam.getTasks(); - if (CollectionUtils.isEmpty(voiceTasks) || voiceTasks.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())); - } - - //默认参数 - voiceAsyncScanParam.setScenes(VoiceSceneEnum.getVoiceSceneList()); - voiceAsyncScanParam.setBizType(bizType); - // 如果是语音流检测,则修改为true。现在默认为音频文件检测false - voiceAsyncScanParam.setLive(false); - voiceAsyncScanParam.setSeed(UUID.randomUUID().toString().replace("-", "")); - - VoiceAsyncScanRequest voiceAsyncScanRequest=getVoiceAsyncScanRequest(); - - try { - voiceAsyncScanRequest.setHttpContent(JSON.toJSONString(voiceAsyncScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); - } catch (UnsupportedEncodingException e) { - log.error("sendVoiceAsyncScan parse param exception", e); - return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); - } - log.info("语音异步检测入参:"+JSON.toJSONString(voiceAsyncScanParam,true)); - List taskList; - try { - taskList = executeSyncVoice(voiceAsyncScanRequest); - log.info("语音异步检测返参taskList:"+JSON.toJSONString(taskList,true)); - } catch (ExecuteHttpException e) { - log.error("sendVoiceAsyncScan execute Exception", e); - return new Result().error(e.getCode(), e.getMsg()); - } - //成功返回 - VoiceAsyncScanTaskResult resultDto=new VoiceAsyncScanTaskResult(); - resultDto.setSeed(voiceAsyncScanParam.getSeed()); - List successList = new ArrayList<>(); - List failedList = new ArrayList<>(); - taskList.forEach(taskDetail -> { - if (HttpStatus.SC_OK == taskDetail.getCode()) { - successList.add(taskDetail); - } else { - failedList.add(taskDetail); - } - }); - resultDto.setSuccessTasks(successList); - resultDto.setFailTasks(failedList); - resultDto.setAllSuccess(resultDto.isAllSuccess()); - if (StringUtils.isNotBlank(voiceAsyncScanParam.getCallback())) { - // 存储seed和 任务id、dataId的关系 用于回调鉴权 - log.info("need to save seed and taskId、dataId的关系"); - ValueOperations valueOperations=redisTemplate.opsForValue(); - taskList.forEach(task -> { - String seedKey = RedisKeys.getVoiceScanSeedKey(task.getTaskId()); - valueOperations.set(seedKey,voiceAsyncScanParam.getSeed()); - }); - } - return new Result().ok(resultDto); - } - - /** - * @param - * @author yinzuomei - * @description 构造语音异步检测请求对象 - * @Date 2020/12/9 10:44 - **/ - private VoiceAsyncScanRequest getVoiceAsyncScanRequest() { - VoiceAsyncScanRequest voiceAsyncScanRequest = new VoiceAsyncScanRequest(); - // 指定api返回格式 - voiceAsyncScanRequest.setAcceptFormat(FormatType.JSON); - // 指定请求方法 - voiceAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); - voiceAsyncScanRequest.setEncoding(SysConstant.UTF8); - voiceAsyncScanRequest.setRegionId(regionId); - voiceAsyncScanRequest.setConnectTimeout(3000); - voiceAsyncScanRequest.setReadTimeout(6000); - return voiceAsyncScanRequest; - } - - /** - * @param voiceAsyncScanRequest - * @author yinzuomei - * @description 解析返参 - * @Date 2020/12/9 10:44 - **/ - private List executeSyncVoice(AcsRequest voiceAsyncScanRequest) { - try { - HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(voiceAsyncScanRequest); - - if (httpResponse.isSuccess()) { - - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - //后面注释掉此日志 - log.info("VoiceAsyncScanRequest原生接口返参:" + JSON.toJSONString(scrResponse, true)); - - if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { - - //获取data列表 - JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); - List resultList = dataResults.toJavaList(VoiceAsyncScanTaskDataDTO.class); - //成功返回 - return resultList; - - } else { - - log.warn("executeSyncVoice detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - - } else { - log.warn("executeSyncVoice response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - - } catch (Exception e) { - log.error("executeSyncVoice exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); - } - } - - - /** - * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 - * @author yinzuomei - * @description 语音异步检测结果查询 - * @Date 2020/12/9 11:17 - **/ - @Override - public Result> voiceResults(List taskIds) { - //检测对象不能为空,且最多支持100个元素 - if (CollectionUtils.isEmpty(taskIds) || taskIds.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())); - } - - VoiceAsyncScanResultsRequest request=getVoiceAsyncScanResultsRequest(); - try { - request.setHttpContent(JSON.toJSONString(taskIds).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); - } catch (UnsupportedEncodingException e) { - log.error("voiceResults parse param exception", e); - return new Result>().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); - } - - // log.info("语音异步检测结果查询入参:"+JSON.toJSONString(taskIds,true)); - - try { - HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request); - if (httpResponse.isSuccess()) { - - JSONObject scrResponse=JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - //后面注释掉此返参 - log.info("VoiceAsyncScanResultsRequest原生接口返参:"+JSON.toJSONString(scrResponse, true)); - if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { - //获取data列表 - JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); - List resultList = dataResults.toJavaList(VoiceAsyncScanResult.class); - List resultData=processVoiceAsyncScanResult(resultList); - //成功返回 - return new Result>().ok(resultData); - - }else{ - - log.warn("voiceResults detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - - } else { - log.warn("语音异步检测结果查询预警 getVoiceAsyncScanResult response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } catch (Exception e) { - log.error("voiceResults exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); - } - - } - - private List processVoiceAsyncScanResult(List resultList) { - List list = new ArrayList<>(); - for (VoiceAsyncScanResult voiceAsyncScanResult : resultList) { - if (SysConstant.PROCESSING == voiceAsyncScanResult.getCode()) { - //280:表示处理中,需要继续轮询 - continue; - } - VoiceAsyncScanResult dto = ConvertUtils.sourceToTarget(voiceAsyncScanResult, VoiceAsyncScanResult.class); - if (HttpStatus.SC_OK == voiceAsyncScanResult.getCode()) { - if (!CollectionUtils.isEmpty(voiceAsyncScanResult.getResults()) && voiceAsyncScanResult.getResults().size() > NumConstant.ZERO) { - //目前只有一个检测场景,所以只判断返回来的第一个场景 - VoiceAsyncScanResultDTO voiceAsyncScanResultDTO = voiceAsyncScanResult.getResults().get(NumConstant.ZERO); - if (null != voiceAsyncScanResultDTO) { - dto.setLabel(voiceAsyncScanResultDTO.getLabel()); - dto.setLabelDesc(LabelEnum.getDesc(voiceAsyncScanResultDTO.getLabel())); - dto.setSuggestion(voiceAsyncScanResultDTO.getSuggestion()); - } - } - } else if(HttpStatus.SC_NOT_FOUND == voiceAsyncScanResult.getCode()) { - dto.setSuggestion(SuggestionEnum.REVIEW.getCode()); - dto.setLabel(NumConstant.EMPTY_STR); - dto.setLabelDesc("智能检测任务失败,结果已失效," + SuggestionEnum.REVIEW.getDesc()); - }else{ - //其他:表示任务失败 - dto.setSuggestion(SuggestionEnum.REVIEW.getCode()); - dto.setLabel(NumConstant.EMPTY_STR); - dto.setLabelDesc("智能检测任务失败," + SuggestionEnum.REVIEW.getDesc()); - } - list.add(dto); - } - return list; - } - - private VoiceAsyncScanResultsRequest getVoiceAsyncScanResultsRequest(){ - VoiceAsyncScanResultsRequest getResultsRequest = new VoiceAsyncScanResultsRequest(); - // 指定API返回格式。 - getResultsRequest.setAcceptFormat(FormatType.JSON); - // 指定请求方法。 - getResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); - getResultsRequest.setEncoding(SysConstant.UTF8); - getResultsRequest.setRegionId(regionId); - /** - * 请务必设置超时时间。 - */ - getResultsRequest.setConnectTimeout(3000); - getResultsRequest.setReadTimeout(6000); - return getResultsRequest; - } - - /** - * desc:视频检测-异步检测 - * - * @param videoAsyncScanParam - * @return - */ - @Override - public Result videoAsyncScan(VideoAsyncScanParam videoAsyncScanParam) { - //一次至多提交100个检测对象 - List videoTasks = videoAsyncScanParam.getTasks(); - if (CollectionUtils.isEmpty(videoTasks) || videoTasks.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())); - } - //默认参数赋值 - videoAsyncScanParam.setScenes(VideoSceneEnum.getVideoSceneList()); - videoAsyncScanParam.setBizType(bizType); - videoAsyncScanParam.setAudioScenes(VoiceSceneEnum.getVoiceSceneList()); - videoAsyncScanParam.setSeed(UUID.randomUUID().toString().replace("-", "")); - //API文档没写限制多少最大多少,应该与图片一致 - if (videoTasks.size() <= SysConstant.MAX_SCAN_IMG_TASK_SIZE) { - return doScanVideo(videoAsyncScanParam); - } - log.info("videoAsyncScan tasks size:{} over 10", videoTasks.size()); - //分组调用,一次提交10个 - List> partition = ListUtils.partition(videoTasks, SysConstant.MAX_SCAN_IMG_TASK_SIZE); - VideoAsyncScanTaskResultDTO finalResult = new VideoAsyncScanTaskResultDTO(); - for (List tasks : partition) { - VideoAsyncScanParam videParam = new VideoAsyncScanParam(); - videParam.setBizType(videoAsyncScanParam.getBizType()); - videParam.setScenes(videoAsyncScanParam.getScenes()); - videParam.setTasks(tasks); - videParam.setCallback(videoAsyncScanParam.getCallback()); - videParam.setSeed(videoAsyncScanParam.getSeed()); - videParam.setAudioScenes(videoAsyncScanParam.getAudioScenes()); - Result partResult = doScanVideo(videParam); - try { - Thread.sleep(5L); - } catch (InterruptedException e) { - log.error("videoAsyncScan InterruptedException"); - } - if (partResult.success()) { - VideoAsyncScanTaskResultDTO data = partResult.getData(); - finalResult.setSeed(data.getSeed()); - finalResult.getSuccessTasks().addAll(data.getSuccessTasks()); - finalResult.getFailTasks().addAll(data.getFailTasks()); - } else { - return partResult; - } - } - return new Result().ok(finalResult); - } - - private Result doScanVideo(VideoAsyncScanParam videoAsyncScanParam) { - VideoAsyncScanRequest videoAsyncScanRequest = getVideoAsyncScanRequest(); - try { - videoAsyncScanRequest.setHttpContent(JSON.toJSONString(videoAsyncScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); - } catch (UnsupportedEncodingException e) { - log.error("doScanVideo parse param exception", e); - return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); - } - - try { - VideoAsyncScanTaskResultDTO scanResult = executeAsyncVideo(videoAsyncScanRequest); - scanResult.setSeed(videoAsyncScanParam.getSeed()); - return new Result().ok(scanResult); - } catch (ExecuteHttpException e) { - log.error("doScanVideo execute exception,param:{},fail msg:{}", JSON.toJSONString(videoAsyncScanParam), e.getMsg()); - return new Result().error(e.getCode(), e.getMsg()); - } - } - - private VideoAsyncScanRequest getVideoAsyncScanRequest() { - VideoAsyncScanRequest videoAsyncScanRequest = new VideoAsyncScanRequest(); - videoAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 - videoAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 - /** - * 请务必设置超时时间。 - */ - videoAsyncScanRequest.setConnectTimeout(3000); - videoAsyncScanRequest.setReadTimeout(6000); - return videoAsyncScanRequest; - } - - private VideoAsyncScanTaskResultDTO executeAsyncVideo(VideoAsyncScanRequest videoAsyncScanRequest) { - try { - HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(videoAsyncScanRequest); - if (httpResponse.isSuccess()) { - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { - //获取data列表 - JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); - List dataList = dataResults.toJavaList(VideoAsyncScanTaskDataDTO.class); - VideoAsyncScanTaskResultDTO result=new VideoAsyncScanTaskResultDTO(); - dataList.forEach(data->{ - if (HttpStatus.SC_OK == data.getCode()) { - result.getSuccessTasks().add(data); - } else { - result.getFailTasks().add(data); - } - }); - return result; - } else { - log.warn("executeAsyncVideo detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } else { - log.warn("executeAsyncVideo response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } catch (Exception e) { - log.error("executeAsyncVideo exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); - } - } - - /** - * @param taskIds - * @author yinzuomei - * @description 视频异步检测结果查询接口 - * @Date 2020/12/29 16:10 - **/ - @Override - public Result videoResults(List taskIds) { - VideoAsyncScanResultsRequest videoAsyncScanResultsRequest = new VideoAsyncScanResultsRequest(); - videoAsyncScanResultsRequest.setAcceptFormat(FormatType.JSON); - videoAsyncScanResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); - videoAsyncScanResultsRequest.setConnectTimeout(3000); - videoAsyncScanResultsRequest.setReadTimeout(6000); - try { - videoAsyncScanResultsRequest.setHttpContent(JSON.toJSONString(taskIds).getBytes("UTF-8"), "UTF-8", FormatType.JSON); - } catch (UnsupportedEncodingException e) { - log.error("videoResults parse param exception", e); - return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); - } - try { - HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(videoAsyncScanResultsRequest); - if (httpResponse.isSuccess()) { - JSONObject responseObject = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - log.info("查询视频检测结果返参"+JSON.toJSONString(responseObject)); - if (HttpStatus.SC_OK == responseObject.getInteger(SysConstant.CODE)) { - //获取data列表 - JSONArray dataResults = responseObject.getJSONArray(SysConstant.DATA); - List resultList = dataResults.toJavaList(VideoScanOriginalResultDTO.class); - //解析数据 - VideoResultDTO resultDTO = processVideoResults(resultList); - //成功返回 - return new Result().ok(resultDTO); - } else { - log.warn("查询视频检测结果,接口返回code=" + responseObject.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } else { - log.warn("查询视频检测结果,API返回失败"); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), - SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); - } - } catch (Exception e) { - log.error("videoResults exception ", e); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); - } - } - - /** - * @author yinzuomei - * @description - **/ - private VideoResultDTO processVideoResults(List resultList) { - VideoResultDTO videoResultDTO = new VideoResultDTO(); - resultList.forEach(result -> { - result.setCodeDesc(CommonErrorCodeEnum.getErrorMsg(result.getCode())); - if (result.getCode().equals(CommonErrorCodeEnum.PROCESSING.getCode())) { - //任务正在检测中,继续轮询 - } else if (result.getCode().equals(CommonErrorCodeEnum.OK.getCode())) { - //成功=>分析结果 - boolean videoPassFlag = getVideoFlag(result.getResults()); - boolean voicePassFlag = getVoiceFlag(result.getAudioScanResults()); - if (videoPassFlag && voicePassFlag) { - videoResultDTO.getPassDataIds().add(result.getDataId()); - videoResultDTO.getPassTaskIds().add(result.getTaskId()); - } else { - videoResultDTO.getNoPassDataIds().add(result.getDataId()); - videoResultDTO.getNoPassTaskIds().add(result.getTaskId()); - } - } else { - //检测结果走丢了.... (*^▽^*) 默认失败 - videoResultDTO.getNoPassDataIds().add(result.getDataId()); - videoResultDTO.getNoPassTaskIds().add(result.getTaskId()); - } - }); - videoResultDTO.setDetails(resultList); - return videoResultDTO; - } - - /** - * @return boolean - * @author yinzuomei - * @description 视频检测结果判断 - **/ - private boolean getVideoFlag(List results) { - for(VideoScanOriginDetail videoRes:results){ - if (!SuggestionEnum.PASS.getCode().equals(videoRes.getSuggestion())) { - return false; - } - } - return true; - } - - /** - * @return boolean true:内容通过; 建议为内容违规或者需要人工审核的统一视为不通过,返回false - * @author yinzuomei - * @description 返回视频语音检测结果 - **/ - private boolean getVoiceFlag(List audioScanResults) { - if (CollectionUtils.isEmpty(audioScanResults)) { - return true; - } - for(VoiceAsyncScanResultDTO m:audioScanResults){ - //人工审核或者内容违规,统一视为不通过 - if (!SuggestionEnum.PASS.getCode().equals(m.getSuggestion())) { - return false; - } - } - return true; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java deleted file mode 100644 index 82036797e3..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.epmet.openapi.scan.support.param; - -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotEmpty; -import java.io.Serializable; -import java.util.List; - -/** - * 审查参数 - * - * @author jianjun liu - * @date 2020-06-04 21:57 - **/ -@Data -public class ImgScanParam implements Serializable { - - private static final long serialVersionUID = 958801658335909745L; - /** - * 业务类型 - */ - private String bizType; - /** - * 场景 必填 - * - * @see com.epmet.openapi.scan.common.enu.ImgSceneEnum; - */ - private List scenes; - - /** - * 要检测的内容列表,必填 - * remark:一组任务列表中的taskId不能相同 - */ - @Valid - @NotEmpty(message = "任务列表不能为空") - private List tasks; - - /** - * 异步检测结果回调地址,执行异步审查内容时 必填 - */ - private String callback; - - /** - * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 - */ - private String seed; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java deleted file mode 100644 index 487485b7fc..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.epmet.openapi.scan.support.param; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 任务参数 - * - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-04 22:13 - **/ -@Data -public class ImgTask implements Serializable { - - private static final long serialVersionUID = -747206284930578105L; - /** - * 要检测的数据id 非必填 - * - * */ - @NotBlank(message = "dataId不能为空") - private String dataId; - - /** - * 图片url 必填 - */ - @NotBlank(message = "图片URL不能为空") - private String url; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java deleted file mode 100644 index 2b05d34e20..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.epmet.openapi.scan.support.param; - -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotEmpty; -import java.io.Serializable; -import java.util.List; - -/** - * 文本审查参数 - * - * @author jianjun liu - * @date 2020-06-05 11:17 - **/ -@Data -public class TextScanParam implements Serializable { - private static final long serialVersionUID = -3568903097975113166L; - - /** - * 业务类型 - */ - private String bizType; - /** - * 场景 必填 - * - * @see com.epmet.openapi.scan.common.enu.ImgSceneEnum; - */ - private List scenes; - - /** - * 要检测的内容列表,必填 - * remark:一组任务列表中的taskId不能相同 - */ - @Valid - @NotEmpty(message = "任务列表不能为空") - private List tasks; - - /** - * 异步检测结果回调地址,执行异步审查内容时 必填 - */ - private String callback; - - /** - * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 - */ - private String seed; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java deleted file mode 100644 index 08215e3e5b..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.epmet.openapi.scan.support.param; - -import lombok.Data; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 任务参数 - * - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-04 22:13 - **/ -@Data -public class TextTask implements Serializable { - - private static final long serialVersionUID = 6957195274696018630L; - /** - * 要检测的数据id 非必填 - * - * */ - @NotBlank(message = "dataId不能为空") - private String dataId; - - /** - * 文本内容 必填 最多不能超过10000 - */ - @NotBlank(message = "待检测文本不能为空") - @Length(max = 10000,message = "待检测文本最大为10000") - private String content; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java deleted file mode 100644 index baa8e51be0..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.epmet.openapi.scan.support.param; - -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.NotEmpty; -import java.io.Serializable; -import java.util.List; - -/** - * 音频审查 入参 - * 参考文档:https://help.aliyun.com/document_detail/89630.html?spm=a2c4g.11186623.2.12.51a32dbfW6AdqV#reference-bcf-3nk-z2b - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 9:07 - */ -@Data -public class VoiceAsyncScanParam implements Serializable { - private static final long serialVersionUID = 3408043673247901184L; - - /** - * 是否开启回调 - */ - private Boolean openCallBack; - - /** - * 不必填 - * 该字段用于标识您的业务场景。您可以通过内容安全控制台创建业务场景(具体操作,请参见自定义机审标准),或者提交工单联系我们帮助您创建业务场景。 - */ - private String bizType; - - /** - * 必填 - * 检测场景,取值:antispam。 - */ - private List scenes; - - /** - * 不必填 - * 是否为语音流(例如直播流)检测。取值: - * true:表示语音流检测。 - * false(默认):表示音频文件检测。 - */ - private Boolean live; - - /** - * 不必填 - * 是否为近线检测模式。 取值: - * true:表示近线检测模式。近线检测模式下,您提交的任务不保证能够实时处理,但是可以排队并在24小时内开始检测。 - * false(默认):表示实时检测模式。对于超过了并发路数限制的检测请求会直接拒绝。 - * 说明 该参数仅适用于音频文件检测,不适用于语音流检测。 - */ - private Boolean offline; - - /** - * 异步检测结果回调地址,执行异步审查内容时 必填 - */ - private String callback; - - /** - * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 - */ - private String seed; - - @Valid - @NotEmpty(message = "任务列表不能为空") - private List tasks; - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java deleted file mode 100644 index 89f4333bba..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.epmet.openapi.scan.support.param; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 语音异步检测 对象 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 10:16 - */ -@Data -public class VoiceTask implements Serializable { - /** - * 不必填 - * 要检测的数据id 非必填 - * 检测对象对应的数据ID。 - * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 - * */ - @NotBlank(message = "dataId不能为空") - private String dataId; - - /** - * 必填 - * 需要检测的音频文件或语音流的下载地址。 - */ - @NotBlank(message = "音频URL不能为空") - private String url; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java deleted file mode 100644 index c0315f8c17..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.epmet.openapi.scan.support.param.video; - -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import java.io.Serializable; -import java.util.List; - -/** - * 视频审核-异步检测入参DTO - * - * @author yinzuomei@elink-cn.com - */ -@Data -public class VideoAsyncScanParam implements Serializable { - private static final long serialVersionUID = -7635290200099445362L; - - /** - * 是否开启回调 - */ - private Boolean openCallBack; - - /** - * 不必填 - * 该字段用于标识您的业务场景。您可以通过内容安全控制台创建业务场景(具体操作,请参见自定义机审标准),或者提交工单联系我们帮助您创建业务场景。 - */ - private String bizType; - - /** - * 不必填 - * 是否为语音流(例如直播流)检测。取值: - * true:表示语音流检测。 - * false(默认):表示音频文件检测。 - */ - private Boolean live; - - /** - * 不必填 - * 是否为近线检测模式。 取值: - * true:表示近线检测模式。近线检测模式下,您提交的任务不保证能够实时处理,但是可以排队并在24小时内开始检测。 - * false(默认):表示实时检测模式。对于超过了并发路数限制的检测请求会直接拒绝。 - * 说明 该参数仅适用于音频文件检测,不适用于语音流检测。 - */ - private Boolean offline; - - /** - * 必填 - * 指定视频检测场景。取值: - * porn:视频智能鉴黄 - * terrorism:视频暴恐涉政 - * live:视频不良场景 - * logo:视频logo - * ad:视频图文违规 - */ - private List scenes; - - /** - * 不必填 - * 指定视频语音检测场景,唯一取值:antispam,表示语音反垃圾。不传入该参数时仅检测视频图像内容;如果传入该参数,则在检测视频中图像的同时,对视频中语音进行检测。 - * 说明 如果需要检测视频语音,则不支持通过上传视频截帧序列的方式(即在task中传入frames)进行检测,您必须传入视频或视频流的URL地址(即在task中传入url)进行检测。 - */ - private List audioScenes; - - /** - * 异步检测结果回调地址,执行异步审查内容时 必填 - */ - private String callback; - - /** - * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 - */ - private String seed; - - @NotEmpty(message = "检测对象不能为空") - private List tasks; -} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java deleted file mode 100644 index 38a4584d94..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.epmet.openapi.scan.support.param.video; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 视频审核-异步检测入参-检测对象 - * - * @author yinzuomei@elink-cn.com - */ -@Data -public class VideoAsyncScanTask implements Serializable { - /** - * 建议必填 - * 要检测的数据id 非必填 - * 检测对象对应的数据ID。 - * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 - * */ - @NotBlank(message = "dataId不能为空") - private String dataId; - - /** - * 必填 - * 待检测视频的URL。该字段不能和frames同时为空,也不能和frames同时有值。 - */ - @NotBlank(message = "音频URL不能为空") - private String url; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java deleted file mode 100644 index d988cf7a88..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -import java.util.List; - -/** - * 检测结果 - * - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-05 10:52 - **/ -@Data -public class ImgAsyncScanResult { - /** - * 执行成功的任务Id集合 - */ - private List successTaskIds; - /** - * 执行失败的任务Id集合 - */ - private List failTaskIds; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java deleted file mode 100644 index d358a570fa..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * desc:文本检测返回结果 - * @author jianjun liu - * @email liujianjun@yunzongnet.com - * @date 2020-06-05 14:24 - **/ -@Data -public class ScanTaskResult implements Serializable { - - private static final long serialVersionUID = -7905091710384256911L; - private Integer code; - - - private String msg; - - - private String dataId; - - - private List results; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java deleted file mode 100644 index 4023153d10..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -/** - * desc:场景扫描结果 - * @author jianjun liu - * @date 2020-06-05 14:24 - **/ -@Data -public class SceneDetailResult { - /** - * 结果为该分类的概率 - */ - private Double rate; - - /** - * 建议用户执行的操作 - */ - private String suggestion; - - /** - * 场景 - */ - private String scene; - - /** - * 标签 - */ - private String label; -} 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 deleted file mode 100644 index 8dcb757f64..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 检测结果 - * - * @author jianjun liu - * @date 2020-06-05 10:52 - **/ -@Data -public class SyncScanResult implements Serializable { - /** - * 执行成功的任务Id集合 - */ - private List successDataIds = new ArrayList<>(); - /** - * 执行失败的任务Id集合 - */ - private List failDataIds = new ArrayList<>(); - - /** - * desc:检测详情 - */ - private List details = new ArrayList<>(); - - /** - * 本地是否全部通过 - */ - private boolean isAllPass; - - public boolean isAllPass() { - if (failDataIds.isEmpty() && !successDataIds.isEmpty()) { - return true; - } - return isAllPass; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java deleted file mode 100644 index 7e74caf5a6..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -import java.io.Serializable; - -/** - * 语音异步检测结果查询结果返参 -data-result-detail详情 - * 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 11:11 - */ -@Data -public class VoiceAsyncScanDetailDTO implements Serializable { - private static final long serialVersionUID = -2664219492371705160L; - /** - * 句子开始的时间,单位:秒。 - */ - private Integer startTime; - - /** - * 句子结束的时间,单位:秒。 - */ - private Integer endTime; - - /** - * 语音转换成文本的结果。 - */ - private String text; - - /** - * 检测结果的分类。取值: - * normal:正常文本 - * spam:含垃圾信息 - * ad:广告 - * politics:涉政 - * terrorism:暴恐 - * abuse:辱骂 - * porn:色情 - * flood:灌水 - * contraband:违禁 - * meaningless:无意义 - * customized:自定义(例如命中自定义关键词) - */ - private String label; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java deleted file mode 100644 index 1cbf3dab4a..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 语音异步检测结果查询结果返参 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 10:56 - */ -@Data -public class VoiceAsyncScanResult implements Serializable { - private static final long serialVersionUID = 8702129292884498023L; - - /** - * 检测对象对应的数据ID。 - */ - private String dataId; - - /** - * 检测任务的ID - */ - private String taskId; - - /** - * 检测结果的分类。取值: - * normal:正常文本 - * spam:含垃圾信息 - * ad:广告 - * politics:涉政 - * terrorism:暴恐 - * abuse:辱骂 - * porn:色情 - * flood:灌水 - * contraband:违禁 - * meaningless:无意义 - * customized:自定义(例如命中自定义关键词) - */ - private String label; - - /** - * labelDesc是对label的说明,包含两种特殊说明: - * (1)如果检测任务失败labelDesc:智能检测任务失败,结果已失效,需要人工审核 - * (2)如果检测结果失效labelDesc:智能检测任务失败,需要人工审核 - */ - private String labelDesc; - - /** - * 建议您执行的后续操作。取值: - * pass:结果正常,无需进行其余操作。 - * review:结果不确定,需要进行人工审核。 - * block:结果违规,建议直接删除或者限制公开。 - */ - private String suggestion; - - - /** - * 错误码,和HTTP状态码一致。 - * 200:表示检测成功。 - * 280:表示处理中,需要继续轮询。 - * 其他:表示任务失败。 - * 更多信息,请参见公共错误码。 - */ - @JsonIgnore - private Integer code; - /** - * 错误描述信息。 - */ - @JsonIgnore - private String msg; - - /** - * 暂时没用,所以返回忽略 - */ - @JsonIgnore - private String url; - - /** - * 检测成功(code=200)时,返回的检测结果。该结果包含一个或多个元素,每个元素是个结构体,对应一个场景。关于每个元素的结构描述,请参见result。 - * 暂时不展示审核结果明细 - */ - @JsonIgnore - private List results; - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java deleted file mode 100644 index 34f3280a6f..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 语音异步检测结果查询结果返参 -data-result详情 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 11:07 - */ -@Data -public class VoiceAsyncScanResultDTO implements Serializable { - private static final long serialVersionUID = 4602226363259983753L; - /** - * 检测场景,和调用请求中的场景对应。取值:antispam。 - */ - private String scene; - - /** - * 检测结果的分类。取值: - * normal:正常文本 - * spam:含垃圾信息 - * ad:广告 - * politics:涉政 - * terrorism:暴恐 - * abuse:辱骂 - * porn:色情 - * flood:灌水 - * contraband:违禁 - * meaningless:无意义 - * customized:自定义(例如命中自定义关键词) - */ - private String label; - - /** - * 建议您执行的后续操作。取值: - * pass:结果正常,无需进行其余操作。 - * review:结果不确定,需要进行人工审核。 - * block:结果违规,建议直接删除或者限制公开。 - */ - private String suggestion; - - /** - * 置信度分数,取值范围:0(表示置信度最低)~100(表示置信度最高)。 - * 如果suggestion为pass,则置信度越高,表示内容正常的可能性越高;如果suggestion为review或block,则置信度越高,表示内容违规的可能性越高。 - * 注意 该值仅作为参考,强烈建议您不要在业务中使用。建议您参考suggestion和label(或者部分接口返回的sublabel)结果用于内容违规判定。 - */ - private Float rate; - - /** - * 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述, - */ - private List details; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java deleted file mode 100644 index ce43fec932..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -import java.io.Serializable; - -/** - * 语音异步检测,返回检测对象列表 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 16:38 - */ -@Data -public class VoiceAsyncScanTaskDataDTO implements Serializable { - /** - * 错误码,和HTTP状态码一致。 - * 更多信息,请参见公共错误码。 - */ - private Integer code; - /** - * 错误描述信息。 - */ - private String msg; - /** - * 检测对象对应的数据ID。 - */ - private String dataId; - - /** - * 检测任务的ID - */ - private String taskId; - - /** - * 暂时没用,所以返回忽略 - */ - @JsonIgnore - private String url; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java deleted file mode 100644 index 2dcbecc398..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.epmet.openapi.scan.support.result; - -import lombok.Data; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 语音异步检测,返参 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/9 9:23 - */ -@Data -public class VoiceAsyncScanTaskResult implements Serializable { - private static final long serialVersionUID = 8702129292884498023L; - /** - * 随机字符串,该值用于回调通知请求中的签名。 - */ - private String seed; - - /** - * 提交成功的失败对象 - */ - private List successTasks=new ArrayList<>(); - - /** - * 提交失败的检测对象 - */ - private List failTasks=new ArrayList<>(); - - /** - * 是否全部提交成功 - */ - private boolean isAllSuccess; - - public boolean isAllSuccess() { - if (failTasks.isEmpty() && !successTasks.isEmpty()) { - return true; - } - return isAllSuccess; - } - - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java deleted file mode 100644 index 1d559a31cd..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.epmet.openapi.scan.support.result.video; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -import java.io.Serializable; - -/** - * 视频审核-异步检测任务提交返参详情 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/29 13:42 - */ -@Data -public class VideoAsyncScanTaskDataDTO implements Serializable { - private static final long serialVersionUID = 8430710131685814181L; - /** - * 错误码,和HTTP状态码一致。 - * 更多信息,请参见公共错误码。 - */ - private Integer code; - /** - * 错误描述信息。 - */ - private String msg; - /** - * 检测对象对应的数据ID。 - */ - private String dataId; - - /** - * 检测任务的ID - */ - private String taskId; - - /** - * 暂时没用,所以返回忽略 - */ - @JsonIgnore - private String url; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java deleted file mode 100644 index 75ecd6e84f..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.epmet.openapi.scan.support.result.video; - -import lombok.Data; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 视频审核-异步检测任务提交返参 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/29 13:38 - */ -@Data -public class VideoAsyncScanTaskResultDTO implements Serializable { - private static final long serialVersionUID = -467990806428860191L; - - /** - * 随机字符串,该值用于回调通知请求中的签名。 - */ - private String seed; - - /** - * 提交成功的失败对象 - */ - private List successTasks=new ArrayList<>(); - - /** - * 提交失败的检测对象 - */ - private List failTasks=new ArrayList<>(); - - /** - * 是否全部提交成功 - */ - private Boolean isAllSuccess; - - public boolean isAllSuccess() { - if (failTasks.isEmpty() && !successTasks.isEmpty()) { - return true; - } - return isAllSuccess; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java deleted file mode 100644 index 0e781bf463..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.epmet.openapi.scan.support.result.video; - -import lombok.Data; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 视频异步检测结果查询接口返参 - * 正在检测中的不返回,调用方继续轮询查询结果 - * @author yinzuomei@elink-cn.com - * @date 2020/12/29 15:37 - */ -@Data -public class VideoResultDTO implements Serializable { - private static final long serialVersionUID = -3451342817149956488L; - - /** - * 执行成功的任务Id集合 - * code=200,且所有语音+视频所有场景返回结果都为pass时则为成功 - */ - private List passDataIds = new ArrayList<>(); - /** - * 执行失败的任务Id集合 - */ - private List noPassDataIds = new ArrayList<>(); - - private List passTaskIds = new ArrayList<>(); - private List noPassTaskIds = new ArrayList<>(); - - /** - * desc:阿里内容审核API返回结果详情 - */ - private List details = new ArrayList<>(); - - /** - * 本地是否全部通过 - */ - private Boolean isAllPass; - - public boolean isAllPass() { - if (noPassTaskIds.isEmpty() && !passTaskIds.isEmpty()) { - return true; - } - return isAllPass; - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java deleted file mode 100644 index 78916c1fe6..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.epmet.openapi.scan.support.result.video; - -import lombok.Data; - -import java.io.Serializable; - -/** - * 视频异步检测结果查询接口原生返参-视频检测结果 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/29 16:39 - */ -@Data -public class VideoScanOriginDetail implements Serializable { - private static final long serialVersionUID = 5547706236158849091L; - /** - * 视频检测场景,和调用请求中的场景对应。取值: - * porn:视频智能鉴黄 - * terrorism:视频暴恐涉政 - * live:视频不良场景 - * logo:视频logo - * ad:视频图文违规 - */ - private String scene; - - /** - * 视频检测结果的分类。不同检测场景的结果分类不同,具体如下: - * 视频智能鉴黄(porn)结果分类: - * normal:正常 - * porn:色情 - * 视频暴恐涉政(terrorism)结果分类: - * normal:正常 - * terrorism:暴恐涉政 - * 视频不良场景(live)结果分类: - * normal:正常 - * live:包含不良场景 - * 视频logo(logo)结果分类: - * normal:正常 - * logo:包含logo - * 视频图文违规(ad)结果分类: - * normal:正常 - * ad:包含广告或文字违规信息 - */ - private String label; - - /** - * 建议您执行的后续操作。取值: - * pass:结果正常,无需进行其余操作。 - * review:结果不确定,需要进行人工审核。 - * block:结果违规,建议直接删除或者限制公开。 - */ - private String suggestion; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java deleted file mode 100644 index 8964d5fe00..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.epmet.openapi.scan.support.result.video; - -import com.epmet.openapi.scan.support.result.VoiceAsyncScanResultDTO; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 视频异步检测结果查询接口原生返参 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/29 15:48 - */ -@Data -public class VideoScanOriginalResultDTO implements Serializable { - private static final long serialVersionUID = -1565008507757551616L; - - /** - * 错误码,和HTTP状态码一致。 - * 更多信息,请参见公共错误码。 - */ - private Integer code; - - private String codeDesc; - - /** - * 错误描述信息。 - */ - private String msg; - /** - * 检测对象对应的数据ID。 - */ - private String dataId; - - /** - * 检测任务的ID - */ - private String taskId; - - /** - * 返回结果,调用成功时(code=200),返回结果中包含一个或多个元素。每个元素是个结构体,具体结构描述,请参见result。 - * 说明 视频流检测场景中,code返回280表示在检测中,返回200表示检测完成。在检测中状态时,检测结果中包含从开始检测到当前时间的检测到结果。 - */ - private List results; - - /** - * 视频语音检测结果。具体结构描述,请参见audioScanResult。 - */ - private List audioScanResults; -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml deleted file mode 100644 index 0aa0583c97..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,91 +0,0 @@ -server: - port: @server.port@ - version: @version@ - servlet: - context-path: /epmetscan - -spring: - main: - allow-bean-definition-overriding: true - application: - name: epmet-openapi-scan - #环境 dev|test|prod - profiles: - active: @spring.profiles.active@ - messages: - encoding: UTF-8 - basename: i18n/messages_common - jackson: - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - redis: - database: @spring.redis.index@ - host: @spring.redis.host@ - port: @spring.redis.port@ - password: @spring.redis.password@ - timeout: 30s - cloud: - nacos: - discovery: - server-addr: @nacos.server-addr@ - #nacos的命名空间ID,默认是public - namespace: @nacos.discovery.namespace@ - #不把自己注册到注册中心的地址 - register-enabled: @nacos.register-enabled@ - ip: @nacos.ip@ - config: - enabled: @nacos.config-enabled@ - server-addr: @nacos.server-addr@ - namespace: @nacos.config.namespace@ - group: @nacos.config.group@ - file-extension: yaml -management: - endpoints: - web: - exposure: - include: "*" - endpoint: - health: - show-details: ALWAYS - -feign: - hystrix: - enabled: true - client: - config: - default: - loggerLevel: BASIC - okhttp: - enabled: true - - -hystrix: - command: - default: - execution: - isolation: - thread: - timeoutInMilliseconds: 60000 #缺省为1000 - -ribbon: - ReadTimeout: 300000 - ConnectTimeout: 300000 - -aliyun: - green: - accessKeyId: LTAI4G6Fv6uTzQbpsayATHq4 - accessKeySecret: QevMw1RYCwQUG3RSMPq1J6EAfmSblo - regionId: cn-shanghai - bizType: epmet_img_text - -dingTalk: - robot: - webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ - -# 停机选项 -shutdown: - graceful: - enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 - diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml b/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml deleted file mode 100644 index 9d2ad51e14..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - ${appname} - - - - - - - - - debug - - - ${CONSOLE_LOG_PATTERN} - - UTF-8 - - - - - - - - ${log.path}/debug.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - - ${log.path}/debug-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - debug - ACCEPT - DENY - - - - - - - ${log.path}/info.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - - ${log.path}/info-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - info - ACCEPT - DENY - - - - - - - ${log.path}/warn.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/warn-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - warn - ACCEPT - DENY - - - - - - - ${log.path}/error.log - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n - UTF-8 - - - - ${log.path}/error-%d{yyyy-MM-dd}.%i.log - - 100MB - - - 15 - - - - ERROR - ACCEPT - DENY - ${webHook} - ${secret} - ${appname} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/readme b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme deleted file mode 100644 index 384fca6dfc..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/resources/readme +++ /dev/null @@ -1,7 +0,0 @@ -#访问openApi 需要向redis中 添加白名单 -sadd epmet:openapi:scan:whitelist "客户端ip地址" -#eg: -sadd epmet:openapi:scan:whitelist "\"192.168.1.1\"" - -#del -srem 'epmet:openapi:scan:whitelist' "\"116.179.32.197\"" "\"27.219.156.47\"" \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java deleted file mode 100644 index 8c0774030d..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java +++ /dev/null @@ -1,50 +0,0 @@ -import java.io.IOException; -import java.util.Properties; - -/** - * Created by liuhai.lh on 17/01/12. - */ -public class BaseSample { - - protected static String accessKeyId = "123"; - protected static String accessKeySecret = "456"; - - protected static String regionId = "cn-shanghai"; - - static { - Properties properties = new Properties(); - - try { - properties.load(BaseSample.class.getResourceAsStream("bootstrap.yml")); - accessKeyId = properties.getProperty("aliyun.green.accessKeyId"); - accessKeySecret = properties.getProperty("aliyun.green.accessKeySecret"); - regionId = properties.getProperty("aliyun.green.url"); - } catch(IOException e) { - e.printStackTrace(); - } - - } - protected static String getDomain(){ - if("cn-shanghai".equals(regionId)){ - return "green.cn-shanghai.aliyuncs.com"; - } - - if ("cn-beijing".equals(regionId)) { - return "green.cn-beijing.aliyuncs.com"; - } - - if ("ap-southeast-1".equals(regionId)) { - return "green.ap-southeast-1.aliyuncs.com"; - } - - if ("us-west-1".equals(regionId)) { - return "green.us-west-1.aliyuncs.com"; - } - - return "green.cn-shanghai.aliyuncs.com"; - } - protected static String getEndPointName(){ - return regionId; - } - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java deleted file mode 100644 index acba42e763..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java +++ /dev/null @@ -1,95 +0,0 @@ -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.aliyuncs.DefaultAcsClient; -import com.aliyuncs.IAcsClient; -import com.aliyuncs.exceptions.ClientException; -import com.aliyuncs.exceptions.ServerException; -import com.aliyuncs.green.model.v20180509.ImageAsyncScanRequest; -import com.aliyuncs.http.FormatType; -import com.aliyuncs.http.HttpResponse; -import com.aliyuncs.profile.DefaultProfile; -import com.aliyuncs.profile.IClientProfile; -import com.epmet.openapi.scan.common.enu.RegionIdEnum; - -import java.util.*; - -/** - * Created by liuhai.lh on 2017/2/17. - * 图片异步检测接口 - * @author liuhai.lh - * @date 2017/02/17 - */ -public class ImageAsyncScanRequestSample extends BaseSample{ - - public static void main(String[] args) throws Exception { - //请替换成你自己的accessKeyId、accessKeySecret - IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); - DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", RegionIdEnum.getDoMain(regionId)); - IAcsClient client = new DefaultAcsClient(profile); - - ImageAsyncScanRequest imageAsyncScanRequest = new ImageAsyncScanRequest(); - imageAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - imageAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - imageAsyncScanRequest.setEncoding("utf-8"); - imageAsyncScanRequest.setRegionId(regionId); - - - List> tasks = new ArrayList>(); - Map task1 = new LinkedHashMap(); - task1.put("dataId", UUID.randomUUID().toString()); - task1.put("url", "https://img.alicdn.com/tfs/TB1Xk_qvwmTBuNjy1XbXXaMrVXa-550-407.jpg"); - task1.put("time", new Date()); - - tasks.add(task1); - JSONObject data = new JSONObject(); - /** - * porn: 色情 - * terrorism: 暴恐 - * qrcode: 二维码 - * ad: 图片广告 - * ocr: 文字识别 - */ - data.put("scenes", Arrays.asList("porn", "ocr", "qrcode", "sface")); - data.put("tasks", tasks); - - imageAsyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); - - /** - * 请务必设置超时时间 - */ - imageAsyncScanRequest.setConnectTimeout(3000); - imageAsyncScanRequest.setReadTimeout(6000); - - try { - HttpResponse httpResponse = client.doAction(imageAsyncScanRequest); - - if(httpResponse.isSuccess()){ - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - System.out.println(JSON.toJSONString(scrResponse, true)); - if (200 == scrResponse.getInteger("code")) { - JSONArray taskResults = scrResponse.getJSONArray("data"); - for (Object taskResult : taskResults) { - if(200 == ((JSONObject)taskResult).getInteger("code")){ - String taskId = ((JSONObject)taskResult).getString("taskId"); - // 将taskId 保存下来,间隔一段时间来轮询结果, 参照ImageAsyncScanResultsRequest - System.out.println("args = [" + taskId + "]"); - }else{ - System.out.println("task process fail:" + ((JSONObject)taskResult).getInteger("code")); - } - } - } else { - System.out.println("detect not success. code:" + scrResponse.getInteger("code")); - } - }else{ - System.out.println("response not success. status:" + httpResponse.getStatus()); - } - } catch (ServerException e) { - e.printStackTrace(); - } catch (ClientException e) { - e.printStackTrace(); - } catch (Exception e){ - e.printStackTrace(); - } - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java deleted file mode 100644 index 27e0b6e233..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java +++ /dev/null @@ -1,83 +0,0 @@ -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.aliyuncs.DefaultAcsClient; -import com.aliyuncs.IAcsClient; -import com.aliyuncs.exceptions.ClientException; -import com.aliyuncs.exceptions.ServerException; -import com.aliyuncs.green.model.v20180509.ImageAsyncScanResultsRequest; -import com.aliyuncs.http.FormatType; -import com.aliyuncs.http.HttpResponse; -import com.aliyuncs.profile.DefaultProfile; -import com.aliyuncs.profile.IClientProfile; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by liuhai.lh on 2017/2/17. - * 获取图片异步检测结果接口 - * @author liuhai.lh - * @date 2017/02/17 - */ -public class ImageAsyncScanResultsSample extends BaseSample{ - - public static void main(String[] args) throws Exception { - //请替换成你自己的accessKeyId、accessKeySecret - IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); - DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", getDomain()); - IAcsClient client = new DefaultAcsClient(profile); - - ImageAsyncScanResultsRequest imageAsyncScanResultsRequest = new ImageAsyncScanResultsRequest(); - imageAsyncScanResultsRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - imageAsyncScanResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - imageAsyncScanResultsRequest.setEncoding("utf-8"); - imageAsyncScanResultsRequest.setRegionId(regionId); - - - List taskIds = new ArrayList(); - taskIds.add("img1hdP5Wn0QC@7wW0n$VX0R@-1p3mnZ"); - imageAsyncScanResultsRequest.setHttpContent(JSON.toJSONString(taskIds).getBytes("UTF-8"), "UTF-8", FormatType.JSON); - - /** - * 请务必设置超时时间 - */ - imageAsyncScanResultsRequest.setConnectTimeout(3000); - imageAsyncScanResultsRequest.setReadTimeout(6000); - - try { - HttpResponse httpResponse = client.doAction(imageAsyncScanResultsRequest); - - if(httpResponse.isSuccess()){ - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - System.out.println(JSON.toJSONString(scrResponse, true)); - if (200 == scrResponse.getInteger("code")) { - JSONArray taskResults = scrResponse.getJSONArray("data"); - for (Object taskResult : taskResults) { - if(200 == ((JSONObject)taskResult).getInteger("code")){ - JSONArray sceneResults = ((JSONObject)taskResult).getJSONArray("results"); - for (Object sceneResult : sceneResults) { - String scene = ((JSONObject)sceneResult).getString("scene"); - String suggestion = ((JSONObject)sceneResult).getString("suggestion"); - //根据scene和suggetion做相关的处理 - //do something - } - }else{ - System.out.println("task process fail:" + ((JSONObject)taskResult).getInteger("code")); - } - } - } else { - System.out.println("detect not success. code:" + scrResponse.getInteger("code")); - } - }else{ - System.out.println("response not success. status:" + httpResponse.getStatus()); - } - } catch (ServerException e) { - e.printStackTrace(); - } catch (ClientException e) { - e.printStackTrace(); - } catch (Exception e){ - e.printStackTrace(); - } - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java deleted file mode 100644 index ec418154d9..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java +++ /dev/null @@ -1,101 +0,0 @@ -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.aliyuncs.DefaultAcsClient; -import com.aliyuncs.IAcsClient; -import com.aliyuncs.exceptions.ClientException; -import com.aliyuncs.exceptions.ServerException; -import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest; -import com.aliyuncs.http.FormatType; -import com.aliyuncs.http.HttpResponse; -import com.aliyuncs.profile.DefaultProfile; -import com.aliyuncs.profile.IClientProfile; - -import java.util.*; - -/** - * Created by liuhai.lh on 2017/2/17. - * 图片同步检测接口 - * @author liuhai.lh - * @date 2017/02/17 - */ -public class ImageSyncScanRequestSample extends BaseSample { - - - public static void main(String[] args) throws Exception { - //请替换成你自己的accessKeyId、accessKeySecret - IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); - DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", getDomain()); - IAcsClient client = new DefaultAcsClient(profile); - - ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); - imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - imageSyncScanRequest.setEncoding("utf-8"); - imageSyncScanRequest.setRegionId(regionId); - - - List> tasks = new ArrayList>(); - Map task = new LinkedHashMap(); - task.put("dataId", UUID.randomUUID().toString()); - task.put("url", "http://f.hiphotos.baidu.com/image/pic/item/aa18972bd40735fa13899ac392510fb30f24084b.jpg"); - task.put("time", new Date()); - - tasks.add(task); - JSONObject data = new JSONObject(); - /** - * porn: 色情 - * terrorism: 暴恐 - * qrcode: 二维码 - * ad: 图片广告 - * ocr: 文字识别 - */ - data.put("scenes", Arrays.asList("porn","terrorism")); - data.put("tasks", tasks); - - imageSyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); - - /** - * 请务必设置超时时间 - */ - imageSyncScanRequest.setConnectTimeout(3000); - imageSyncScanRequest.setReadTimeout(10000); - - try { - HttpResponse httpResponse = client.doAction(imageSyncScanRequest); - - if (httpResponse.isSuccess()) { - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - System.out.println(JSON.toJSONString(scrResponse, true)); - if (200 == scrResponse.getInteger("code")) { - JSONArray taskResults = scrResponse.getJSONArray("data"); - for (Object taskResult : taskResults) { - if(200 == ((JSONObject)taskResult).getInteger("code")){ - JSONArray sceneResults = ((JSONObject)taskResult).getJSONArray("results"); - for (Object sceneResult : sceneResults) { - String scene = ((JSONObject)sceneResult).getString("scene"); - String suggestion = ((JSONObject)sceneResult).getString("suggestion"); - //根据scene和suggetion做相关的处理 - //do something - System.out.println("args = [" + scene + "]"); - System.out.println("args = [" + suggestion + "]"); - } - }else{ - System.out.println("task process fail:" + ((JSONObject)taskResult).getInteger("code")); - } - } - } else { - System.out.println("detect not success. code:" + scrResponse.getInteger("code")); - } - } else { - System.out.println("response not success. status:" + httpResponse.getStatus()); - } - } catch (ServerException e) { - e.printStackTrace(); - } catch (ClientException e) { - e.printStackTrace(); - } catch (Exception e){ - e.printStackTrace(); - } - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java deleted file mode 100644 index 617e6246d1..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java +++ /dev/null @@ -1,90 +0,0 @@ -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.aliyuncs.DefaultAcsClient; -import com.aliyuncs.IAcsClient; -import com.aliyuncs.green.model.v20180509.VoiceAsyncScanRequest; -import com.aliyuncs.http.FormatType; -import com.aliyuncs.http.HttpResponse; -import com.aliyuncs.profile.DefaultProfile; -import com.aliyuncs.profile.IClientProfile; - -import java.util.*; - -/** - * 提交语音异步检测任务 demo - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/8 21:51 - */ -public class VoiceAsyncScanRequestSample extends BaseSample { - - - - public static void main(String[] args) throws Exception { - - //请替换成您自己的AccessKey ID、AccessKey Secret。 - IClientProfile profile = DefaultProfile.getProfile("cn-shanghai", - "LTAI4G6Fv6uTzQbpsayATHq4", //您自己的AccessKey ID - "QevMw1RYCwQUG3RSMPq1J6EAfmSblo");//您自己的AccessKey Secret - final IAcsClient client = new DefaultAcsClient(profile); - - VoiceAsyncScanRequest asyncScanRequest = new VoiceAsyncScanRequest(); //class different vs common - asyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 - asyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 - asyncScanRequest.setRegionId("cn-shanghai"); - asyncScanRequest.setConnectTimeout(3000); - asyncScanRequest.setReadTimeout(6000); - - List> tasks = new ArrayList>(); - Map task1 = new LinkedHashMap(); - // 请将下面的地址修改为要检测的语音文件的地址。 - task1.put("dataId","voice1"); - task1.put("url", "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/6480bd6be9f14a458162218cea84dfa5.aac"); - - Map task2 = new LinkedHashMap(); - task2.put("dataId","voice2"); - task2.put("url", "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/b566d94fd7114ffb9a203e80c22ebb96.aac"); - - tasks.add(task1); - tasks.add(task2); - - JSONObject data = new JSONObject(); - - System.out.println("==========Task count:" + tasks.size()); - data.put("scenes", Arrays.asList("antispam")); - data.put("tasks", tasks); - // 如果是语音流检测,则修改为true。 - data.put("live", false); - asyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); - System.out.println("接口入参:"+JSON.toJSONString(data, true)); - - try { - HttpResponse httpResponse = client.doAction(asyncScanRequest); - - if (httpResponse.isSuccess()) { - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - System.out.println("接口返参:"+JSON.toJSONString(scrResponse, true)); - if (200 == scrResponse.getInteger("code")) { - JSONArray taskResults = scrResponse.getJSONArray("data"); - for (Object taskResult : taskResults) { - Integer code = ((JSONObject) taskResult).getInteger("code"); - if (200 == code) { - final String taskId = ((JSONObject) taskResult).getString("taskId"); - System.out.println("submit async task success, taskId = [" + taskId + "]"); - } else { - System.out.println("task process fail: " + code); - } - } - } else { - System.out.println("detect not success. code: " + scrResponse.getInteger("code")); - } - } else { - System.out.println("response not success. status: " + httpResponse.getStatus()); - } - } catch (Exception e) { - e.printStackTrace(); - } - - } -} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java deleted file mode 100644 index 85d268f175..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java +++ /dev/null @@ -1,113 +0,0 @@ -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.aliyuncs.DefaultAcsClient; -import com.aliyuncs.IAcsClient; -import com.aliyuncs.green.model.v20180509.VoiceAsyncScanResultsRequest; -import com.aliyuncs.http.FormatType; -import com.aliyuncs.http.HttpResponse; -import com.aliyuncs.profile.DefaultProfile; -import com.aliyuncs.profile.IClientProfile; - -import java.util.*; - -/** - * 查询异步语音检测结果。 - * - * @author yinzuomei@elink-cn.com - * @date 2020/12/8 22:08 - */ -public class VoiceAsyncScanResultsRequestSample extends BaseSample { - - - public static void main(String[] args) throws Exception { - // 请替换成您自己的AccessKey ID、AccessKey Secret。 - IClientProfile profile = DefaultProfile - .getProfile("cn-shanghai", - "LTAI4G6Fv6uTzQbpsayATHq4", - "QevMw1RYCwQUG3RSMPq1J6EAfmSblo"); - final IAcsClient client = new DefaultAcsClient(profile); - //提交语音异步检测任务后返回的taskId - pollingScanResult(client, Arrays.asList("vc_f_7WZZ01BCH0q6ZnM3g1OKGG-1tAaZ7", "vc_f_6AKaBxy4HdG5bruQ0JwweV-1tAaJi")); - // pollingScanResult(client, "vc_f_6AKaBxy4HdG5bruQ0JwweV-1tAaJi"); - } - - public static void pollingScanResult(IAcsClient client, List taskIdList) throws InterruptedException { - int failCount = 0; - boolean stop = false; - do { - // 设置每10秒查询一次。 - Thread.sleep(10 * 1000); - JSONObject scanResult = getScanResult(client, taskIdList); - System.out.println("接口完整返参:"+JSON.toJSONString(scanResult, true)); - if (scanResult == null || 200 != scanResult.getInteger("code")) { - failCount++; - System.out.println("请求失败,get result fail, failCount=" + failCount); - if (scanResult != null) { - System.out.println("请求失败,错误信息errorMsg:" + scanResult.getString("msg")); - } - if (failCount > 20) { - break; - } - continue; - } - - JSONArray taskResults = scanResult.getJSONArray("data"); - if (taskResults.isEmpty()) { - System.out.println("请求成功,but data is empty"); - break; - } - System.out.println("data.size=" + taskResults.size()); - for (Object taskResult : taskResults) { - JSONObject result = (JSONObject) taskResult; - Integer code = result.getInteger("code"); - String taskId = result.getString("taskId"); - if (280 == code) { - System.out.println("taskId=" + taskId + ": processing status: " + result.getString("msg")); - } else if (200 == code) { - System.out.println("taskId=" + taskId + "请求成功,返参:" + JSON.toJSONString(taskResult, true)); - stop = true; - } else { - System.out.println("taskId=" + taskId + "请求失败,返参:" + JSON.toJSONString(taskResult, true)); - stop = true; - } - } - } while (!stop); - } - - private static JSONObject getScanResult(IAcsClient client, List taskIdList) { - VoiceAsyncScanResultsRequest getResultsRequest = new VoiceAsyncScanResultsRequest(); - getResultsRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 - getResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 - getResultsRequest.setEncoding("utf-8"); - getResultsRequest.setRegionId("cn-shanghai"); - - - List> tasks = new ArrayList>(); - for (String taskId : taskIdList) { - Map task1 = new LinkedHashMap(); - task1.put("taskId", taskId); - tasks.add(task1); - } - - /** - * 请务必设置超时时间。 - */ - getResultsRequest.setConnectTimeout(3000); - getResultsRequest.setReadTimeout(6000); - - try { - getResultsRequest.setHttpContent(JSON.toJSONString(tasks).getBytes("UTF-8"), "UTF-8", FormatType.JSON); - - HttpResponse httpResponse = client.doAction(getResultsRequest); - if (httpResponse.isSuccess()) { - return JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); - } else { - System.out.println("response not success. status: " + httpResponse.getStatus()); - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/epmet-openapi/pom.xml b/epmet-openapi/pom.xml deleted file mode 100644 index fd15705343..0000000000 --- a/epmet-openapi/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - epmet-cloud - com.epmet - 2.0.0 - - 4.0.0 - pom - - epmet-openapi - - epmet-openapi-scan - epmet-openapi-adv - - - \ No newline at end of file From 8de86b07164ed870463a92c08a19782cf3041b3a Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 26 Mar 2021 00:55:31 +0800 Subject: [PATCH 46/71] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=8C=E4=BA=86openA?= =?UTF-8?q?pi=E5=8F=82=E6=95=B0=E6=A8=A1=E5=BC=8F=EF=BC=8C=E5=BE=85?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/openapi/HeaderFieldKeys.java | 7 ---- .../epmet/openapi/RequestBodyFieldKeys.java | 10 ----- .../com/epmet/openapi/RequestParamKeys.java | 11 ----- .../com/epmet/openapi/constant/AuthTypes.java | 8 ++++ .../openapi/constant/InClusterHeaderKeys.java | 10 +++++ .../openapi/constant/RequestParamKeys.java | 14 +++++++ .../sign/openapi/OpenApiSignUtils.java | 15 +++++-- epmet-gateway/pom.xml | 13 ++++-- .../auth/ExtAppFetchTokenAuthProcessor.java | 16 +++----- .../com/epmet/auth/ExternalAuthProcessor.java | 22 ++++++---- .../filter/CpAuthGatewayFilterFactory.java | 6 ++- .../common-service-server/pom.xml | 6 +-- .../epmet/dto/form/AccessTokenFormDTO.java | 14 ------- .../epmet-ext/epmet-ext-server/pom.xml | 11 +++-- .../aspect/OpenApiRequestCheckAspect.java | 41 +++++++++++++------ .../OpenApiAccessTokenController.java | 23 ++--------- .../impl/OpenApiAccessTokenServiceImpl.java | 2 +- 17 files changed, 121 insertions(+), 108 deletions(-) delete mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java delete mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java delete mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java create mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/AuthTypes.java create mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/InClusterHeaderKeys.java create mode 100644 epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/RequestParamKeys.java delete mode 100644 epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java deleted file mode 100644 index 9360c5f51f..0000000000 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/HeaderFieldKeys.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.epmet.openapi; - -public interface HeaderFieldKeys { - - String APP_ID = "AppId"; - -} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java deleted file mode 100644 index 3ce4555283..0000000000 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestBodyFieldKeys.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.epmet.openapi; - -/** - * 请求体字段key - */ -public interface RequestBodyFieldKeys { - - String APP_ID = "appId"; - -} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java deleted file mode 100644 index a503713682..0000000000 --- a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/RequestParamKeys.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.epmet.openapi; - -/** - * url请求参数key - */ -public class RequestParamKeys { - - public static String APP_ID = "app_id"; - public static String AUTH_TYPE = "auth_type"; - -} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/AuthTypes.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/AuthTypes.java new file mode 100644 index 0000000000..4f1c94af10 --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/AuthTypes.java @@ -0,0 +1,8 @@ +package com.epmet.openapi.constant; + +/** + * 认证方式 + */ +public interface AuthTypes { + String TAKE_TOKEN = "take_token"; +} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/InClusterHeaderKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/InClusterHeaderKeys.java new file mode 100644 index 0000000000..e2d0b2ca18 --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/InClusterHeaderKeys.java @@ -0,0 +1,10 @@ +package com.epmet.openapi.constant; + +/** + * 集群内的Header key + */ +public interface InClusterHeaderKeys { + + String APP_ID = "AppId"; + +} diff --git a/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/RequestParamKeys.java b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/RequestParamKeys.java new file mode 100644 index 0000000000..b1d6bae806 --- /dev/null +++ b/epmet-commons/epmet-commons-openapi/src/main/java/com/epmet/openapi/constant/RequestParamKeys.java @@ -0,0 +1,14 @@ +package com.epmet.openapi.constant; + +/** + * url请求参数key + */ +public class RequestParamKeys { + + public static String APP_ID = "app_id"; + public static String AUTH_TYPE = "auth_type"; + public static String TIMESTAMP = "timestamp"; + public static String SIGN = "sign"; + public static String NONCE = "nonce"; + +} diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index 9a64226174..785c2a0578 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -17,7 +17,7 @@ public class OpenApiSignUtils { */ public static String createSign(Map contentMap, String signKey) { String str2beSigned = mapToSignStr(contentMap); - str2beSigned = str2beSigned.concat("&signKey=").concat(signKey); + str2beSigned = str2beSigned.concat("&sign_key=").concat(signKey); return Md5Util.md5(str2beSigned); } @@ -68,15 +68,21 @@ public class OpenApiSignUtils { long now = System.currentTimeMillis(); System.out.println(now); + String uuid = UUID.randomUUID().toString(); + HashMap content = new HashMap<>(); - content.put("appId", "7d98b8af2d05752b4225709c4cfd4bd0"); + content.put("app_id", "7d98b8af2d05752b4225709c4cfd4bd0"); content.put("timestamp", String.valueOf(now)); - content.put("nonce", "aaa"); + content.put("nonce", uuid); + content.put("auth_type", "take_token"); String secret = "3209ee9f41704482be1a1fb5873a25376f2899191ca846119d44168316bc3e44"; String sign = createSign(content, secret); - System.out.println(sign); + + System.out.println("时间戳:" + now); + System.out.println("随机数:" + uuid); + System.out.println("签名:" + sign); } private static void generateGetOrgDetailSign() { @@ -90,6 +96,7 @@ public class OpenApiSignUtils { content.put("test", null); content.put("timestamp", String.valueOf(now)); content.put("nonce", uuid); + content.put("auth_type", "take_token"); String secret = "3209ee9f41704482be1a1fb5873a25376f2899191ca846119d44168316bc3e44"; diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index d901d0940e..8c9a652412 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -76,6 +76,11 @@ 2.0.0 compile + + com.epmet + epmet-commons-openapi + 2.0.0 + @@ -237,8 +242,8 @@ 0 - 192.168.1.130 - 6379 + 118.190.150.119 + 47379 123456 false @@ -309,8 +314,8 @@ lb://gov-project-server - lb://common-service-server - + + http://localhost:8103 lb://resi-home-server diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java index 5954b2bd30..acc9f056ca 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java @@ -9,6 +9,8 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.openapi.constant.InClusterHeaderKeys; +import com.epmet.openapi.constant.RequestParamKeys; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import org.apache.commons.lang3.StringUtils; @@ -28,12 +30,6 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { @Override public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { - // 1.token过期校验 - if (StringUtils.isBlank(appId)) { - throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), - EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); - } - String secret = getSecret(appId); if (jwtTokenUtils.isTokenExpired(jwtTokenUtils.getExpiration(token, secret))) { @@ -47,7 +43,7 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { // 2. 获取claims Claims claims = jwtTokenUtils.getClaimByToken(token, secret); - String appIdInAccessToken = claims.get("appId", String.class); + String appIdInAccessToken = claims.get(RequestParamKeys.APP_ID, String.class); if (!appId.equals(appIdInAccessToken)) { // 参数列表的appId和token中封装的不一致 @@ -57,16 +53,16 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { // 3.将app_id放入header中 ServerHttpRequest.Builder mutate = exchange.getRequest().mutate(); - mutate.header("AppId", appId); + mutate.header(InClusterHeaderKeys.APP_ID, new String[]{appId}); exchange.mutate().request(mutate.build()).build(); } /** - * @Description 获取秘钥 * @return + * @Description 获取秘钥 * @author wxz * @date 2021.03.23 14:12 - */ + */ private String getSecret(String appId) { EpmetCommonServiceOpenFeignClient commonService = SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class); Result result = commonService.getSecret(appId); diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index 1b928ac295..bfd7da5de5 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -4,6 +4,8 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.filter.CpProperty; +import com.epmet.openapi.constant.AuthTypes; +import com.epmet.openapi.constant.RequestParamKeys; import com.epmet.utils.ServerHttpRequestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -40,9 +42,6 @@ public class ExternalAuthProcessor extends AuthProcessor { public static final String APP_AUTH_TYPE_JWT = "jwt"; // 调用方生成md5 public static final String APP_AUTH_TYPE_MD5 = "md5"; - // 获取token方式 - public static final String APP_AUTH_TYPE_FETCH_TOKEN = "fetchToken"; - @Autowired private ExtAppJwtAuthProcessor jwtAuthProcessor; @@ -89,7 +88,7 @@ public class ExternalAuthProcessor extends AuthProcessor { String token = headers.getFirst(ACCESS_TOKEN_HEADER_KEY); String ts = headers.getFirst(APP_ID_TIMESTAMP_KEY); String customerId = headers.getFirst(APP_ID_CUSTOMER_ID_KEY); - String authType = headers.getFirst(APP_ID_AUTY_TYPE_KEY); + String authType = getAuthType(headers, request); logger.info("外部应用请求认证拦截Aspect执行,token:{}, ts:{}, customerId:{}, authType:{}", token, ts, customerId, authType); @@ -108,11 +107,10 @@ public class ExternalAuthProcessor extends AuthProcessor { throw new RenException(EpmetErrorCode.ERR401.getCode(), "请求头中的AccessToken和AppId不能为空"); } md5AuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); - } else if (APP_AUTH_TYPE_FETCH_TOKEN.equals(authType)) { - String paramName = "app_id"; - String appId = ServerHttpRequestUtils.getRequestParam(request, paramName); + } else if (AuthTypes.TAKE_TOKEN.equals(authType)) { + String appId = ServerHttpRequestUtils.getRequestParam(request, RequestParamKeys.APP_ID); if (StringUtils.isBlank(appId)) { - throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(),"缺少参数".concat(paramName)); + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(),"缺少参数".concat(RequestParamKeys.APP_ID)); } fetchTokenAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else { @@ -129,4 +127,12 @@ public class ExternalAuthProcessor extends AuthProcessor { return exchange; } + + private String getAuthType(HttpHeaders headers, ServerHttpRequest request) { + String authType = ServerHttpRequestUtils.getRequestParam(request, RequestParamKeys.AUTH_TYPE); + if (StringUtils.isBlank(authType)) { + authType = headers.getFirst(APP_ID_AUTY_TYPE_KEY); + } + return authType; + } } diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index c01c553b75..9e6d7ef077 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -10,6 +10,8 @@ import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.AuthTypeConstant; import com.epmet.constant.TokenHeaderKeyConstant; +import com.epmet.openapi.constant.AuthTypes; +import com.epmet.openapi.constant.RequestParamKeys; import com.epmet.utils.ServerHttpRequestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -112,8 +114,8 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory - + @@ -158,8 +158,8 @@ EpmEt-db-UsEr 0 - 192.168.1.130 - 6379 + 118.190.150.119 + 47379 123456 false diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java deleted file mode 100644 index 9fe569e75e..0000000000 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/AccessTokenFormDTO.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.epmet.dto.form; - -import com.epmet.dto.form.openapi.OpenApiBaseFormDTO; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -@Data -public class AccessTokenFormDTO extends OpenApiBaseFormDTO { - - // 应用id - @NotBlank(message = "AppId字段不能为空", groups = { GetAccessTokenGroup.class }) - private String appId; -} diff --git a/epmet-module/epmet-ext/epmet-ext-server/pom.xml b/epmet-module/epmet-ext/epmet-ext-server/pom.xml index d12766c5e9..e36faba1f1 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/pom.xml +++ b/epmet-module/epmet-ext/epmet-ext-server/pom.xml @@ -21,6 +21,11 @@ + + com.epmet + epmet-commons-openapi + 2.0.0 + com.epmet common-service-client @@ -239,14 +244,14 @@ - + epmet_third_user EpmEt-db-UsEr 0 - 192.168.1.130 - 6379 + 118.190.150.119 + 47379 123456 false diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java index 22f3280c25..10e5989d77 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.openapi.constant.RequestParamKeys; import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; @@ -31,6 +32,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.util.Arrays; +import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -66,26 +68,41 @@ public class OpenApiRequestCheckAspect { Parameter[] parameters = method.getParameters(); HttpServletRequest request = getRequest(); - String appId = request.getHeader("AppId"); + Map argMap = new HashMap<>(); for (int i = 0; i < parameters.length; i++) { if (parameters[i].isAnnotationPresent(RequestBody.class)) { - Map argMap; try { argMap = ConvertUtils.entityToMap(args[i]); } catch (Exception e) { throw new RenException("验签参数转化发生异常"); } - argMap.put(""); - - if (!OpenApiSignUtils.checkSign(argMap, getSecret(appId))) { - // 验签失败 - throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode()); - } - checkRepeatRequest(argMap); + break; } } + + fillRequestParamsInfoArgMap(argMap, request); + if (!OpenApiSignUtils.checkSign(argMap, getSecret(argMap.get(RequestParamKeys.APP_ID)))) { + // 验签失败 + throw new RenException(EpmetErrorCode.OPEN_API_SIGN_ERROR.getCode()); + } + checkRepeatRequest(argMap); + } + + private void fillRequestParamsInfoArgMap(Map argMap, HttpServletRequest request) { + fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.APP_ID); + fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.AUTH_TYPE); + fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.NONCE); + fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.TIMESTAMP); + fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.SIGN); + } + + private void fillRequestParamsInfoArgMap(Map argMap, HttpServletRequest request, String paramName) { + String paramValue = request.getParameter(paramName); + if (StringUtils.isNotBlank(paramName)) { + argMap.put(paramName, paramValue); + } } /** @@ -93,7 +110,7 @@ public class OpenApiRequestCheckAspect { * @param argMap */ void checkRepeatRequest(Map argMap) { - String timestampStr = argMap.get("timestamp"); + String timestampStr = argMap.get(RequestParamKeys.TIMESTAMP); if (StringUtils.isBlank(timestampStr)) { throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode()); } @@ -104,13 +121,13 @@ public class OpenApiRequestCheckAspect { // 只允许1分钟之内的请求,允许服务器之间时差为1分钟 throw new RenException(String.format("请求已过时,允许时差为%s ms", requestTimeDiff)); } - String nonce = argMap.get("nonce"); + String nonce = argMap.get(RequestParamKeys.NONCE); String nonceInCache = redisUtils.getString(RedisKeys.getOpenApiNonceKey(nonce)); if (StringUtils.isNotBlank(nonceInCache)) { throw new RenException("请求重复"); } //将nonce缓存到redis,有效期1分钟 - redisUtils.set(RedisKeys.getOpenApiNonceKey(nonce), "1", requestTimeDiff); + redisUtils.set(RedisKeys.getOpenApiNonceKey(nonce), System.currentTimeMillis(), requestTimeDiff); } /** diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java index c189e2fb3b..587dd99318 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java @@ -1,16 +1,11 @@ package com.epmet.controller; import com.epmet.annotation.OpenApiCheckSign; -import com.epmet.commons.security.sign.openapi.OpenApiSignUtils; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.AccessTokenFormDTO; import com.epmet.dto.form.openapi.OpenApiBaseFormDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.OpenApiAccessTokenService; @@ -18,13 +13,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.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.beans.IntrospectionException; -import java.lang.reflect.InvocationTargetException; +import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("open-api") @@ -49,12 +38,8 @@ public class OpenApiAccessTokenController { */ @OpenApiCheckSign @PostMapping("get-access-token") - public Result getAccessToken(@RequestBody AccessTokenFormDTO input) { - // 1.校验参数 - ValidatorUtils.validateEntity(input, OpenApiBaseFormDTO.GetAccessTokenGroup.class); - String appId = input.getAppId(); - - // 2.取secret + public Result getAccessToken(@RequestParam("app_id") String appId) { + // 1.取secret String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); if (StringUtils.isBlank(secret)) { Result result = commonServiceOpenFeignClient.getSecret(appId); @@ -68,7 +53,7 @@ public class OpenApiAccessTokenController { redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); } - //4.生成token + //2.生成token String accessToken = openApiAccessTokenService.getAccessToken(appId, secret); return new Result().ok(accessToken); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java index 4cdee0c279..98409b0b36 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java @@ -30,7 +30,7 @@ public class OpenApiAccessTokenServiceImpl implements OpenApiAccessTokenService String token = jwtTokenUtils.createToken(claim, openApiConfig.getAccessTokenExpire(), secret); // 缓存token - redisUtils.set(RedisKeys.getOpenApiAccessTokenKey(token), appId, openApiConfig.getAccessTokenExpire()); + redisUtils.set(RedisKeys.getOpenApiAccessTokenKey(appId), token, openApiConfig.getAccessTokenExpire()); return token; } From e794248fd308ad45c6012614b30e9df814e768c9 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 26 Mar 2021 09:17:12 +0800 Subject: [PATCH 47/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84db=E5=92=8Credis=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 4 ++-- .../epmet-common-service/common-service-server/pom.xml | 6 +++--- epmet-module/epmet-ext/epmet-ext-server/pom.xml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 8c9a652412..af02a2054c 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -242,8 +242,8 @@ 0 - 118.190.150.119 - 47379 + 192.168.1.130 + 6379 123456 false 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 2c58b44a91..c863208d25 100644 --- a/epmet-module/epmet-common-service/common-service-server/pom.xml +++ b/epmet-module/epmet-common-service/common-service-server/pom.xml @@ -150,7 +150,7 @@ - + @@ -158,8 +158,8 @@ EpmEt-db-UsEr 0 - 118.190.150.119 - 47379 + 192.168.1.130 + 6379 123456 false diff --git a/epmet-module/epmet-ext/epmet-ext-server/pom.xml b/epmet-module/epmet-ext/epmet-ext-server/pom.xml index e36faba1f1..9eda7325be 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/pom.xml +++ b/epmet-module/epmet-ext/epmet-ext-server/pom.xml @@ -244,14 +244,14 @@ - + epmet_third_user EpmEt-db-UsEr 0 - 118.190.150.119 - 47379 + 192.168.1.130 + 6379 123456 false From 41c0a15f8fd1bedd682ffd23986de581588ae23e Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 26 Mar 2021 10:38:23 +0800 Subject: [PATCH 48/71] =?UTF-8?q?openApi=E5=9F=BA=E6=9C=AC=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/sign/openapi/OpenApiSignUtils.java | 1 + .../epmet/commons/tools/redis/RedisKeys.java | 4 ++-- ...r.java => ExtAppTakeTokenAuthProcessor.java} | 17 ++++++++++++----- .../com/epmet/auth/ExternalAuthProcessor.java | 4 ++-- .../epmet/aspect/OpenApiRequestCheckAspect.java | 13 +++++++------ .../impl/OpenApiAccessTokenServiceImpl.java | 3 ++- 6 files changed, 26 insertions(+), 16 deletions(-) rename epmet-gateway/src/main/java/com/epmet/auth/{ExtAppFetchTokenAuthProcessor.java => ExtAppTakeTokenAuthProcessor.java} (81%) diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index 785c2a0578..ef3e31f6aa 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -94,6 +94,7 @@ public class OpenApiSignUtils { HashMap content = new HashMap<>(); content.put("orgId", "aaa"); content.put("test", null); + content.put("app_id", "7d98b8af2d05752b4225709c4cfd4bd0"); content.put("timestamp", String.valueOf(now)); content.put("nonce", uuid); content.put("auth_type", "take_token"); 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 dd5ca2e18a..d923bf5ba7 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 @@ -393,8 +393,8 @@ public class RedisKeys { * @author wxz * @date 2021.03.23 10:25 */ - public static String getOpenApiAccessTokenKey(String accessToken) { - return rootPrefix.concat("openapi:accesstoken:").concat(accessToken); + public static String getOpenApiAccessTokenKey(String appId) { + return rootPrefix.concat("openapi:accesstoken:").concat(appId); } /** diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java similarity index 81% rename from epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java rename to epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java index acc9f056ca..433b5ef01b 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppFetchTokenAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java @@ -23,22 +23,29 @@ import org.springframework.web.server.ServerWebExchange; * 外部应用认证处理器:来平台token的方式 */ @Component -public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { +public class ExtAppTakeTokenAuthProcessor extends ExtAppAuthProcessor { @Autowired private JwtUtils jwtTokenUtils; + @Autowired + private RedisUtils redisUtils; + @Override public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { String secret = getSecret(appId); - if (jwtTokenUtils.isTokenExpired(jwtTokenUtils.getExpiration(token, secret))) { + // 1.过期验证 + String accessTokenInCache = redisUtils.getString(RedisKeys.getOpenApiAccessTokenKey(appId)); + if (StringUtils.isBlank(accessTokenInCache) || + jwtTokenUtils.isTokenExpired(jwtTokenUtils.getExpiration(token, secret))) { + throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); } // 2.验签 - // 验签暂时放到具体接口中 + // 验签暂时放到具体接口中,不放在gateway //openApiSignUtils.checkSign(); // 2. 获取claims @@ -47,8 +54,8 @@ public class ExtAppFetchTokenAuthProcessor extends ExtAppAuthProcessor { if (!appId.equals(appIdInAccessToken)) { // 参数列表的appId和token中封装的不一致 - throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), - EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_APPID_DIFF.getCode(), + EpmetErrorCode.OPEN_API_PARAMS_APPID_DIFF.getMsg()); } // 3.将app_id放入header中 diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index bfd7da5de5..72fbfe5c9e 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -50,7 +50,7 @@ public class ExternalAuthProcessor extends AuthProcessor { private ExtAppMD5AuthProcessor md5AuthProcessor; @Autowired - private ExtAppFetchTokenAuthProcessor fetchTokenAuthProcessor; + private ExtAppTakeTokenAuthProcessor takeTokenAuthProcessor; private final AntPathMatcher antPathMatcher = new AntPathMatcher(); @@ -112,7 +112,7 @@ public class ExternalAuthProcessor extends AuthProcessor { if (StringUtils.isBlank(appId)) { throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(),"缺少参数".concat(RequestParamKeys.APP_ID)); } - fetchTokenAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); + takeTokenAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else { throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "未知的外部认证类型"); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java index 10e5989d77..3ef87a5c04 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java @@ -26,15 +26,10 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; -import java.beans.IntrospectionException; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import java.util.Set; /** * OpenApi检查请求切面 @@ -90,6 +85,12 @@ public class OpenApiRequestCheckAspect { checkRepeatRequest(argMap); } + /** + * @Description 填充url请求参数到map中,用来签名 + * @return + * @author wxz + * @date 2021.03.26 10:13 + */ private void fillRequestParamsInfoArgMap(Map argMap, HttpServletRequest request) { fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.APP_ID); fillRequestParamsInfoArgMap(argMap, request, RequestParamKeys.AUTH_TYPE); @@ -116,7 +117,7 @@ public class OpenApiRequestCheckAspect { } long timestamp = Long.valueOf(timestampStr).longValue(); long now = System.currentTimeMillis(); - long requestTimeDiff = 60000; + long requestTimeDiff = 120000; if (Math.abs(now - timestamp) > requestTimeDiff) { // 只允许1分钟之内的请求,允许服务器之间时差为1分钟 throw new RenException(String.format("请求已过时,允许时差为%s ms", requestTimeDiff)); diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java index 98409b0b36..b00e5ca6d9 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java @@ -4,6 +4,7 @@ import com.epmet.commons.security.jwt.JwtUtils; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.config.OpenApiConfig; +import com.epmet.openapi.constant.RequestParamKeys; import com.epmet.service.OpenApiAccessTokenService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -25,7 +26,7 @@ public class OpenApiAccessTokenServiceImpl implements OpenApiAccessTokenService @Override public String getAccessToken(String appId, String secret) { HashMap claim = new HashMap<>(); - claim.put("appId", appId); + claim.put(RequestParamKeys.APP_ID, appId); String token = jwtTokenUtils.createToken(claim, openApiConfig.getAccessTokenExpire(), secret); From eec82464990ba18ba7d643a6e2e743d09af4b8ea Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 26 Mar 2021 14:08:31 +0800 Subject: [PATCH 49/71] =?UTF-8?q?=E8=8E=B7=E5=8F=96token=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E5=B0=86=E7=BB=93=E6=9E=9C=E5=B0=81=E8=A3=85=E6=88=90?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/security/jwt/JwtUtils.java | 19 +++++++++++++++++++ .../sign/openapi/OpenApiSignUtils.java | 4 ++-- .../openapi/GetAccessTokenResultDTO.java | 12 ++++++++++++ .../OpenApiAccessTokenController.java | 7 ++++--- .../service/OpenApiAccessTokenService.java | 4 +++- .../impl/OpenApiAccessTokenServiceImpl.java | 15 +++++++++++---- 6 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/openapi/GetAccessTokenResultDTO.java diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java index 23b738d623..8df0b6cd8f 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/jwt/JwtUtils.java @@ -78,6 +78,25 @@ public class JwtUtils { .compact(); } + /** + * @Description 创建Token + * @return Token + * @param claims 载荷信息 + * @param expireTime 过期时间 + * @param secret 秘钥 + * @author wxz + * @date 2021.03.26 13:33 + */ + public String createToken(Map claims, Date expireTime, String secret) { + return Jwts.builder() + .setHeaderParam("typ", "JWT") + .setClaims(claims) + .setIssuedAt(new Date()) + .setExpiration(expireTime) + .signWith(SignatureAlgorithm.HS512, secret) + .compact(); + } + /** * token是否过期 * diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index ef3e31f6aa..f96a3777bb 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -60,8 +60,8 @@ public class OpenApiSignUtils { } public static void main(String[] args) { - //generateGetAccessTokenSign(); - generateGetOrgDetailSign(); + generateGetAccessTokenSign(); + //generateGetOrgDetailSign(); } private static void generateGetAccessTokenSign() { diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/openapi/GetAccessTokenResultDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/openapi/GetAccessTokenResultDTO.java new file mode 100644 index 0000000000..a913b25945 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/openapi/GetAccessTokenResultDTO.java @@ -0,0 +1,12 @@ +package com.epmet.dto.result.openapi; + +import lombok.Data; + +@Data +public class GetAccessTokenResultDTO { + + private String accessToken; + + private Long expireTime; + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java index 587dd99318..27c44ae532 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.openapi.OpenApiBaseFormDTO; +import com.epmet.dto.result.openapi.GetAccessTokenResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.OpenApiAccessTokenService; import org.apache.commons.lang3.StringUtils; @@ -38,7 +39,7 @@ public class OpenApiAccessTokenController { */ @OpenApiCheckSign @PostMapping("get-access-token") - public Result getAccessToken(@RequestParam("app_id") String appId) { + public Result getAccessToken(@RequestParam("app_id") String appId) { // 1.取secret String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); if (StringUtils.isBlank(secret)) { @@ -54,8 +55,8 @@ public class OpenApiAccessTokenController { } //2.生成token - String accessToken = openApiAccessTokenService.getAccessToken(appId, secret); - return new Result().ok(accessToken); + GetAccessTokenResultDTO content = openApiAccessTokenService.getAccessToken(appId, secret); + return new Result().ok(content); } } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java index 56c3bd4630..2b6d362636 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenApiAccessTokenService.java @@ -1,5 +1,7 @@ package com.epmet.service; +import com.epmet.dto.result.openapi.GetAccessTokenResultDTO; + /** * access token的service */ @@ -11,5 +13,5 @@ public interface OpenApiAccessTokenService { * @author wxz * @date 2021.03.22 22:57 */ - String getAccessToken(String appId, String secret); + GetAccessTokenResultDTO getAccessToken(String appId, String secret); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java index b00e5ca6d9..fad64083db 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenApiAccessTokenServiceImpl.java @@ -4,11 +4,14 @@ import com.epmet.commons.security.jwt.JwtUtils; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.config.OpenApiConfig; +import com.epmet.dto.result.openapi.GetAccessTokenResultDTO; import com.epmet.openapi.constant.RequestParamKeys; import com.epmet.service.OpenApiAccessTokenService; +import org.joda.time.DateTime; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.HashMap; @Service @@ -24,15 +27,19 @@ public class OpenApiAccessTokenServiceImpl implements OpenApiAccessTokenService private RedisUtils redisUtils; @Override - public String getAccessToken(String appId, String secret) { + public GetAccessTokenResultDTO getAccessToken(String appId, String secret) { HashMap claim = new HashMap<>(); claim.put(RequestParamKeys.APP_ID, appId); - String token = jwtTokenUtils.createToken(claim, openApiConfig.getAccessTokenExpire(), secret); - + Date expireTime = DateTime.now().plusSeconds(openApiConfig.getAccessTokenExpire()).toDate(); + String token = jwtTokenUtils.createToken(claim, expireTime, secret); // 缓存token redisUtils.set(RedisKeys.getOpenApiAccessTokenKey(appId), token, openApiConfig.getAccessTokenExpire()); - return token; + GetAccessTokenResultDTO content = new GetAccessTokenResultDTO(); + content.setAccessToken(token); + content.setExpireTime(expireTime.getTime()); + + return content; } } From 02d5a0c7cf141052aa751164b142a6e64317a378 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 30 Mar 2021 09:22:35 +0800 Subject: [PATCH 50/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Aaccess=20token?= =?UTF-8?q?=E6=9C=89=E6=95=88=E6=9C=9F=E9=85=8D=E7=BD=AEde=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml index 71e2a5ff55..881881db27 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml @@ -114,4 +114,4 @@ shutdown: # 对外开放接口配置 openApi: accessToken: - expire: 7200000 + expire: 7200 From 98806364b496c1b3f337f89cfbcc36968e63a7c0 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 30 Mar 2021 14:50:32 +0800 Subject: [PATCH 51/71] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Ajwt=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=8F=96=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=BA=E7=A9=BA=EF=BC=8C=E9=80=A0=E6=88=90?= =?UTF-8?q?=E7=9A=84=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/sign/openapi/OpenApiSignUtils.java | 7 ++++--- .../epmet/auth/ExtAppTakeTokenAuthProcessor.java | 7 ++++++- .../com/epmet/aspect/OpenApiRequestCheckAspect.java | 13 +++++++++---- .../controller/OpenApiAccessTokenController.java | 2 -- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index f96a3777bb..8551289868 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -61,14 +61,15 @@ public class OpenApiSignUtils { public static void main(String[] args) { generateGetAccessTokenSign(); - //generateGetOrgDetailSign(); + System.out.println("=============="); + generateGetOrgDetailSign(); } private static void generateGetAccessTokenSign() { long now = System.currentTimeMillis(); System.out.println(now); - String uuid = UUID.randomUUID().toString(); + String uuid = UUID.randomUUID().toString().replace("-", ""); HashMap content = new HashMap<>(); content.put("app_id", "7d98b8af2d05752b4225709c4cfd4bd0"); @@ -87,7 +88,7 @@ public class OpenApiSignUtils { private static void generateGetOrgDetailSign() { long now = System.currentTimeMillis(); - String uuid = UUID.randomUUID().toString(); + String uuid = UUID.randomUUID().toString().replace("-", "");; System.out.println("时间戳:" + now); System.out.println("随机数:" + uuid); diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java index 433b5ef01b..6b527dc074 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExtAppTakeTokenAuthProcessor.java @@ -19,6 +19,8 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.web.server.ServerWebExchange; +import java.util.Date; + /** * 外部应用认证处理器:来平台token的方式 */ @@ -37,8 +39,11 @@ public class ExtAppTakeTokenAuthProcessor extends ExtAppAuthProcessor { // 1.过期验证 String accessTokenInCache = redisUtils.getString(RedisKeys.getOpenApiAccessTokenKey(appId)); + Date expiration = jwtTokenUtils.getExpiration(token, secret); if (StringUtils.isBlank(accessTokenInCache) || - jwtTokenUtils.isTokenExpired(jwtTokenUtils.getExpiration(token, secret))) { + expiration == null || + jwtTokenUtils.isTokenExpired(expiration) + ) { throw new RenException(EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getCode(), EpmetErrorCode.OPEN_API_TOKEN_EXPIRED.getMsg()); diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java index 3ef87a5c04..6661ac747d 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java @@ -47,6 +47,11 @@ public class OpenApiRequestCheckAspect { @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + //请求时差单位:s + long requestTimeSecDiff = 120; + //请求时差,单位:ms + long requestTimeMillSecDiff = requestTimeSecDiff * 1000;//单位:ms + private static final Logger log = LoggerFactory.getLogger(DataFilterAspect.class); /** @@ -117,10 +122,10 @@ public class OpenApiRequestCheckAspect { } long timestamp = Long.valueOf(timestampStr).longValue(); long now = System.currentTimeMillis(); - long requestTimeDiff = 120000; - if (Math.abs(now - timestamp) > requestTimeDiff) { + + if (Math.abs(now - timestamp) > requestTimeMillSecDiff) { // 只允许1分钟之内的请求,允许服务器之间时差为1分钟 - throw new RenException(String.format("请求已过时,允许时差为%s ms", requestTimeDiff)); + throw new RenException(String.format("请求已过时,允许时差为%s s", requestTimeSecDiff)); } String nonce = argMap.get(RequestParamKeys.NONCE); String nonceInCache = redisUtils.getString(RedisKeys.getOpenApiNonceKey(nonce)); @@ -128,7 +133,7 @@ public class OpenApiRequestCheckAspect { throw new RenException("请求重复"); } //将nonce缓存到redis,有效期1分钟 - redisUtils.set(RedisKeys.getOpenApiNonceKey(nonce), System.currentTimeMillis(), requestTimeDiff); + redisUtils.set(RedisKeys.getOpenApiNonceKey(nonce), System.currentTimeMillis(), requestTimeSecDiff); } /** diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java index 27c44ae532..5f24502bfa 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenApiAccessTokenController.java @@ -5,8 +5,6 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.openapi.OpenApiBaseFormDTO; import com.epmet.dto.result.openapi.GetAccessTokenResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.OpenApiAccessTokenService; From 8e54b66bfd33a548f5983a89a2b3c89271a74977 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 1 Apr 2021 00:09:22 +0800 Subject: [PATCH 52/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9Aopenapi?= =?UTF-8?q?=E6=9C=AA=E4=BC=A0=E9=80=92token=EF=BC=8C=E5=88=99=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=B7=E6=B1=82=E6=9C=AA=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/exception/EpmetErrorCode.java | 9 +++++---- .../main/java/com/epmet/auth/ExternalAuthProcessor.java | 5 ++++- 2 files changed, 9 insertions(+), 5 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 f83a55d32f..bb16d73456 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 @@ -146,10 +146,11 @@ public enum EpmetErrorCode { TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"), // open api异常 - OPEN_API_SIGN_ERROR(9100, "签名错误"), - OPEN_API_TOKEN_EXPIRED(9101, "Token过期"), - OPEN_API_PARAMS_MISSING(9102, "参数不完整"), - OPEN_API_PARAMS_APPID_DIFF(9103, "app_id不一致"); // app_id在请求参数中和在token中不一致 + OPEN_API_UNAUTHENTICATED(9100, "请求未认证"), + OPEN_API_TOKEN_EXPIRED(9102, "Token过期"), + OPEN_API_PARAMS_MISSING(9103, "参数不完整"), + OPEN_API_SIGN_ERROR(9104, "签名错误"), + OPEN_API_PARAMS_APPID_DIFF(9105, "app_id不一致"); // app_id在请求参数中和在token中不一致 private int code; private String msg; diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index 72fbfe5c9e..d21ec692c5 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -108,9 +108,12 @@ public class ExternalAuthProcessor extends AuthProcessor { } md5AuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else if (AuthTypes.TAKE_TOKEN.equals(authType)) { + if (StringUtils.isBlank(token)) { + throw new RenException(EpmetErrorCode.OPEN_API_UNAUTHENTICATED.getCode()); + } String appId = ServerHttpRequestUtils.getRequestParam(request, RequestParamKeys.APP_ID); if (StringUtils.isBlank(appId)) { - throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(),"缺少参数".concat(RequestParamKeys.APP_ID)); + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(),"缺少参数:".concat(RequestParamKeys.APP_ID)); } takeTokenAuthProcessor.auth(appId, token, StringUtils.isNotBlank(ts) ? new Long(ts) : null, exchange); } else { From 2baa2c0a63be1d49fc595cdb3ce321c39ef130d0 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 6 Apr 2021 17:53:55 +0800 Subject: [PATCH 53/71] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java index fe270e280c..5e4d21d072 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java @@ -240,6 +240,8 @@ public class SysSmsServiceImpl extends BaseServiceImpl SysSmsDTO sysSmsDTO = new SysSmsDTO(); sysSmsDTO.setMobile(dto.getMobile()); sysSmsDTO.setAliyunTemplateCode(dto.getAliyunTemplateCode()); + sysSmsDTO.setParams1("syc测试1"); + sysSmsDTO.setParams2("syc测试2"); //推送短信 this.sendMsg(sysSmsDTO); }); From cd1661ed7368d50b4de853d23b4cf5ffe3a6526e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Apr 2021 09:51:47 +0800 Subject: [PATCH 54/71] =?UTF-8?q?=E5=8F=82=E8=A7=82=E7=BB=84sql=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V0.0.14__visit_group.sql | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql new file mode 100644 index 0000000000..3cfae6815c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS `group_visitor`; +CREATE TABLE `group_visitor` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组id', + `GRID_ID` varchar(64) NOT NULL COMMENT '小组所属网格id', + `USER_ID` varchar(64) NOT NULL COMMENT '用户id', + `LATEST_VISIT_TIME` datetime NOT NULL COMMENT '最近一次访问的时间', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '当前操作人id即组长id', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间:第一次参观的时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组参观者记录'; + +DROP TABLE IF EXISTS `group_visit_record`; +CREATE TABLE `group_visit_record` ( + `ID` varchar(64) NOT NULL COMMENT '主键(点击参观,加入记录)', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `GRID_ID` varchar(64) NOT NULL COMMENT '小组所属网格id', + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组id', + `USER_ID` varchar(64) NOT NULL COMMENT '用户id', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '当前访问用户id', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组参观记录表'; + + +alter table resi_group add COLUMN VISIT_SWITCH VARCHAR(6) +NOT NULL DEFAULT 'closed' comment '小组是否允许参观:允许:open;不允许:closed' AFTER AUDIT_SWITCH; \ No newline at end of file From 1b2bec280eba438188211c9e2d7e4fc891615d36 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Apr 2021 10:11:50 +0800 Subject: [PATCH 55/71] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataaggre/dto/resigroup/ResiGroupDTO.java | 7 +- .../entity/resigroup/ResiGroupEntity.java | 4 + .../resi/group/dto/group/ResiGroupDTO.java | 8 +- .../group/dto/member/GroupVisitRecordDTO.java | 92 ++++++++++++++++++ .../group/dto/member/GroupVisitorDTO.java | 97 +++++++++++++++++++ .../modules/group/entity/ResiGroupEntity.java | 4 + .../member/dao/GroupVisitRecordDao.java | 33 +++++++ .../modules/member/dao/GroupVisitorDao.java | 33 +++++++ .../member/entity/GroupVisitRecordEntity.java | 58 +++++++++++ .../member/entity/GroupVisitorEntity.java | 66 +++++++++++++ .../service/GroupVisitRecordService.java | 85 ++++++++++++++++ .../member/service/GroupVisitorService.java | 85 ++++++++++++++++ .../impl/GroupVisitRecordServiceImpl.java | 92 ++++++++++++++++++ .../service/impl/GroupVisitorServiceImpl.java | 93 ++++++++++++++++++ .../mapper/member/GroupVisitRecordDao.xml | 8 ++ .../mapper/member/GroupVisitorDao.xml | 8 ++ 16 files changed, 771 insertions(+), 2 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml create mode 100644 epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java index 43e46572bb..9b6288ab98 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java @@ -17,9 +17,10 @@ package com.epmet.dataaggre.dto.resigroup; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -109,4 +110,8 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private Date updatedTime; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java index a49d9506d7..7fc47655e4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java @@ -79,4 +79,8 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private String auditSwitch; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java index be61d33c2a..b2d57ecc1d 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java @@ -17,9 +17,10 @@ package com.epmet.resi.group.dto.group; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -79,6 +80,11 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private String auditSwitch; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; + /** * 删除标记 0:未删除,1:已删除 */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.java new file mode 100644 index 0000000000..d896c8b5f9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.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.resi.group.dto.member; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +public class GroupVisitRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键(点击参观,加入记录) + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + + /** + * 用户id + */ + private String userId; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 当前访问用户id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java new file mode 100644 index 0000000000..2fc7cb896a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.member; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +public class GroupVisitorDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 用户id + */ + private String userId; + + /** + * 最近一次访问的时间 + */ + private Date latestVisitTime; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 当前操作人id即组长id + */ + private String createdBy; + + /** + * 创建时间:第一次参观的时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java index 8dfa5e2db8..1c80c117eb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java @@ -79,4 +79,8 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private String auditSwitch; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java new file mode 100644 index 0000000000..729e885b7e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Mapper +public interface GroupVisitRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java new file mode 100644 index 0000000000..b2b8eed76b --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.member.entity.GroupVisitorEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Mapper +public interface GroupVisitorDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java new file mode 100644 index 0000000000..b4ebd7869f --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java @@ -0,0 +1,58 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_visit_record") +public class GroupVisitRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + + /** + * 用户id + */ + private String userId; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java new file mode 100644 index 0000000000..0f72355c82 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_visitor") +public class GroupVisitorEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 用户id + */ + private String userId; + + /** + * 最近一次访问的时间 + */ + private Date latestVisitTime; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java new file mode 100644 index 0000000000..5a1b54156c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java @@ -0,0 +1,85 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import com.epmet.resi.group.dto.member.GroupVisitRecordDTO; + +import java.util.List; +import java.util.Map; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +public interface GroupVisitRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-07 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-07 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupVisitRecordDTO + * @author generator + * @date 2021-04-07 + */ + GroupVisitRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void save(GroupVisitRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void update(GroupVisitRecordDTO dto); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java new file mode 100644 index 0000000000..7c59b434a7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java @@ -0,0 +1,85 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.member.entity.GroupVisitorEntity; +import com.epmet.resi.group.dto.member.GroupVisitorDTO; + +import java.util.List; +import java.util.Map; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +public interface GroupVisitorService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-07 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-07 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupVisitorDTO + * @author generator + * @date 2021-04-07 + */ + GroupVisitorDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void save(GroupVisitorDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void update(GroupVisitorDTO dto); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.java new file mode 100644 index 0000000000..88bb0b5778 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.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.modules.member.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.member.dao.GroupVisitRecordDao; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import com.epmet.modules.member.service.GroupVisitRecordService; +import com.epmet.resi.group.dto.member.GroupVisitRecordDTO; +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; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Service +public class GroupVisitRecordServiceImpl extends BaseServiceImpl implements GroupVisitRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupVisitRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupVisitRecordDTO.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 GroupVisitRecordDTO get(String id) { + GroupVisitRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupVisitRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupVisitRecordDTO dto) { + GroupVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupVisitRecordDTO dto) { + GroupVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitRecordEntity.class); + updateById(entity); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java new file mode 100644 index 0000000000..83f8f6e1d4 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.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.modules.member.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.member.dao.GroupVisitorDao; +import com.epmet.modules.member.entity.GroupVisitorEntity; +import com.epmet.modules.member.service.GroupVisitorService; +import com.epmet.resi.group.dto.member.GroupVisitorDTO; +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; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Service +public class GroupVisitorServiceImpl extends BaseServiceImpl implements GroupVisitorService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupVisitorDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupVisitorDTO.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 GroupVisitorDTO get(String id) { + GroupVisitorEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupVisitorDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupVisitorDTO dto) { + GroupVisitorEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitorEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupVisitorDTO dto) { + GroupVisitorEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitorEntity.class); + updateById(entity); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml new file mode 100644 index 0000000000..f4b395b5a5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml new file mode 100644 index 0000000000..82303b9699 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file From 97914ad8d3256f9c826e7063c72268af16dc35fe Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Apr 2021 10:46:31 +0800 Subject: [PATCH 56/71] =?UTF-8?q?groupvisitor=E6=BC=8F=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GroupVisitorController.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java new file mode 100644 index 0000000000..5140967fb6 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.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.modules.member.controller; + +import com.epmet.modules.member.service.GroupVisitorService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@RestController +@RequestMapping("groupvisitor") +public class GroupVisitorController { + + @Autowired + private GroupVisitorService groupVisitorService; + + +} \ No newline at end of file From 3d30bc57234dafcbf97304bdc1f0b7473f3b5979 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 7 Apr 2021 10:51:07 +0800 Subject: [PATCH 57/71] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=BB=9E=E7=95=99?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E6=8E=A8=E9=80=81=E9=80=BB=E8=BE=91=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/SysSmsService.java | 9 +++ .../epmet/service/impl/SysSmsServiceImpl.java | 49 ++++++++++++-- .../com/epmet/sms/AbstractSmsService.java | 23 +++++++ .../java/com/epmet/sms/AliyunSmsService.java | 64 +++++++++++++++++++ .../java/com/epmet/sms/QcloudSmsService.java | 56 ++++++++++++++++ 5 files changed, 196 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java index 8bb9cb2a8e..1327aff692 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java @@ -44,6 +44,15 @@ public interface SysSmsService extends BaseService { * @param status 发送状态 */ void save(Integer platform, String mobile, LinkedHashMap params, Integer status); + /** + * 保存短信发送记录 + * @param platform 平台 + * @param mobile 手机号 + * @param params 短信参数 + * @param status 发送状态 + * @param customerId 客户Id + */ + void save(Integer platform, String mobile, LinkedHashMap params, Integer status, String customerId); /** * 发送短信验证码 diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java index 5e4d21d072..08233fc452 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java @@ -19,6 +19,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.SysSmsConstant; import com.epmet.dao.SysSmsDao; import com.epmet.dto.SysSmsDTO; @@ -132,6 +133,34 @@ public class SysSmsServiceImpl extends BaseServiceImpl baseDao.insert(sms); } + @Override + public void save(Integer platform, String mobile, LinkedHashMap params, Integer status, String customerId) { + SysSmsEntity sms = new SysSmsEntity(); + sms.setPlatform(platform); + sms.setMobile(mobile); + sms.setCustomerId(customerId); + + //设置短信参数 + if(MapUtil.isNotEmpty(params)){ + int index = 1; + for(String value : params.values()){ + if(index == 1){ + sms.setParams1(value); + }else if(index == 2){ + sms.setParams2(value); + }else if(index == 3){ + sms.setParams3(value); + }else if(index == 4){ + sms.setParams4(value); + } + index++; + } + } + + sms.setStatus(status); + baseDao.insert(sms); + } + @Override public Result sendSmsCaptcha(String mobile) { Integer code = (int) ((Math.random() * 9 + 1) * 100000); @@ -240,8 +269,19 @@ public class SysSmsServiceImpl extends BaseServiceImpl SysSmsDTO sysSmsDTO = new SysSmsDTO(); sysSmsDTO.setMobile(dto.getMobile()); sysSmsDTO.setAliyunTemplateCode(dto.getAliyunTemplateCode()); - sysSmsDTO.setParams1("syc测试1"); - sysSmsDTO.setParams2("syc测试2"); + sysSmsDTO.setCustomerId(customerId); + HashMap map = new HashMap<>(); + try{ + if(SmsTemplateConstant.PROJECT_TRANSFER.equals(dto.getAliyunTemplateCode())){ + map.put("params1", "【党群e事通】您有新的被吹哨任务,请尽快处理。"); + }else if(SmsTemplateConstant.PROJECT_OVERDUE.equals(dto.getAliyunTemplateCode())){ + map.put("params1", "【党群e事通】您有项目即将超期,请尽快处理。"); + } + String paramJson = new ObjectMapper().writeValueAsString(map); + sysSmsDTO.setParams(paramJson); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } //推送短信 this.sendMsg(sysSmsDTO); }); @@ -271,7 +311,6 @@ public class SysSmsServiceImpl extends BaseServiceImpl **/ private void sendMsg(SysSmsDTO sysSmsDTO) { logger.info(String.format("固定短信模板推送短信信息接口入参:%s", JSON.toJSONString(sysSmsDTO))); - LinkedHashMap map = null; try { //短信服务 AbstractSmsService service = SmsFactory.build(); @@ -280,9 +319,9 @@ public class SysSmsServiceImpl extends BaseServiceImpl } //发送短信 if (StringUtils.isNotBlank(sysSmsDTO.getAliyunTemplateCode())) { - service.sendSmsByAliyunTemplateCode(sysSmsDTO.getMobile(), map, sysSmsDTO.getAliyunTemplateCode()); + service.sendSmsByAliyunTemplateCodeMsg(sysSmsDTO); } else { - service.sendSms(sysSmsDTO.getMobile(), map); + service.sendSmsMsg(sysSmsDTO); } } catch (Exception e) { logger.error(String.format("项目提醒发送短信失败,失败手机号:%s,ErrorCode:%s", sysSmsDTO.getMobile(), e.getMessage())); diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AbstractSmsService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AbstractSmsService.java index e1a07530fb..bcdeb1e466 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AbstractSmsService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AbstractSmsService.java @@ -8,6 +8,8 @@ package com.epmet.sms; +import com.epmet.dto.SysSmsDTO; + import java.util.LinkedHashMap; /** @@ -50,4 +52,25 @@ public abstract class AbstractSmsService { public abstract void sendSmsByAliyunTemplateCode(String mobile, LinkedHashMap params, String aliyunTemplateCode); + /** + * 发送短信 + * @param sysSmsDTO 短信对象 + */ + public abstract void sendSmsMsg(SysSmsDTO sysSmsDTO); + + /** + * + * 发送短信 + * @param sysSmsDTO 短信对象 + * @param signName 短信签名 + * @param template 短信模板 + */ + public abstract void sendSmsMsg(SysSmsDTO sysSmsDTO, String signName, String template); + + /** + * @return void + * @param sysSmsDTO 短信对象 + * @description sun + **/ + public abstract void sendSmsByAliyunTemplateCodeMsg(SysSmsDTO sysSmsDTO); } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AliyunSmsService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AliyunSmsService.java index 9ec5c16cd5..3ffa06f8c8 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AliyunSmsService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/AliyunSmsService.java @@ -19,8 +19,10 @@ import com.aliyuncs.http.MethodType; import com.aliyuncs.profile.DefaultProfile; import com.aliyuncs.profile.IClientProfile; import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dto.SysSmsDTO; import com.epmet.enums.PlatformEnum; import com.epmet.exception.ModuleErrorCode; import com.epmet.service.SysSmsService; @@ -118,4 +120,66 @@ public class AliyunSmsService extends AbstractSmsService { } this.sendSms(mobile, params, config.getAliyunSignName(), config.getAliyunTemplateCode()); } + + @Override + public void sendSmsMsg(SysSmsDTO sysSmsDTO) { + this.sendSmsMsg(sysSmsDTO, config.getAliyunSignName(), config.getAliyunTemplateCode()); + } + @Override + public void sendSmsMsg(SysSmsDTO sysSmsDTO, String signName, String template) { + System.setProperty("sun.net.client.defaultConnectTimeout", "30000"); + System.setProperty("sun.net.client.defaultReadTimeout", "30000"); + + LinkedHashMap params; + try { + params = JSON.parseObject(sysSmsDTO.getParams(), LinkedHashMap.class); + }catch (Exception e){ + throw new RenException(ErrorCode.JSON_FORMAT_ERROR); + } + + //组装请求对象 + SendSmsRequest request = new SendSmsRequest(); + request.setMethod(MethodType.POST); + //待发送手机号,支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式 + //发送国际/港澳台消息时,接收号码格式为00+国际区号+号码,如"0085200000000" + request.setPhoneNumbers(sysSmsDTO.getMobile()); + //短信签名-可在短信控制台中找到 + request.setSignName(signName); + //短信模板-可在短信控制台中找到 + request.setTemplateCode(template); + //参数 + if(MapUtil.isNotEmpty(params)){ + request.setTemplateParam(JSON.toJSONString(params)); + } + + SendSmsResponse response; + try { + IAcsClient acsClient = new DefaultAcsClient(profile); + response = acsClient.getAcsResponse(request); + } catch (ClientException e) { + throw new RenException(ModuleErrorCode.SEND_SMS_ERROR, e, ""); + } + + int status = Constant.SUCCESS; + if(!Constant.OK.equalsIgnoreCase(response.getCode())){ + status = Constant.FAIL; + } + + //保存短信记录 + SysSmsService sysSmsService = SpringContextUtils.getBean(SysSmsService.class); + sysSmsService.save(PlatformEnum.ALIYUN.value(), sysSmsDTO.getMobile(), params, status, sysSmsDTO.getCustomerId()); + + if(status == Constant.FAIL){ + throw new RenException(ModuleErrorCode.SEND_SMS_ERROR, response.getMessage()); + } + } + + @Override + public void sendSmsByAliyunTemplateCodeMsg(SysSmsDTO sysSmsDTO) { + if(StringUtils.isNotBlank(sysSmsDTO.getAliyunTemplateCode())){ + this.sendSmsMsg(sysSmsDTO, config.getAliyunSignName(), sysSmsDTO.getAliyunTemplateCode()); + return; + } + this.sendSmsMsg(sysSmsDTO, config.getAliyunSignName(), config.getAliyunTemplateCode()); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/QcloudSmsService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/QcloudSmsService.java index a3e33d6557..84ab8bb41e 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/QcloudSmsService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/sms/QcloudSmsService.java @@ -9,6 +9,9 @@ package com.epmet.sms; import cn.hutool.core.map.MapUtil; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.dto.SysSmsDTO; import com.github.qcloudsms.SmsSingleSender; import com.github.qcloudsms.SmsSingleSenderResult; import com.epmet.commons.tools.constant.Constant; @@ -77,4 +80,57 @@ public class QcloudSmsService extends AbstractSmsService { } this.sendSms(mobile, params, config.getAliyunSignName(), config.getAliyunTemplateCode()); } + + @Override + public void sendSmsMsg(SysSmsDTO sysSmsDTO) { + this.sendSmsMsg(sysSmsDTO, config.getAliyunSignName(), config.getAliyunTemplateCode()); + } + + @Override + public void sendSmsMsg(SysSmsDTO sysSmsDTO, String signName, String template) { + SmsSingleSender sender = new SmsSingleSender(config.getQcloudAppId(), config.getQcloudAppKey()); + + LinkedHashMap params; + try { + params = JSON.parseObject(sysSmsDTO.getParams(), LinkedHashMap.class); + }catch (Exception e){ + throw new RenException(ErrorCode.JSON_FORMAT_ERROR); + } + + //短信参数 + ArrayList paramsList = new ArrayList<>(); + if(MapUtil.isNotEmpty(params)){ + for(String value : params.values()){ + paramsList.add(value); + } + } + SmsSingleSenderResult result; + try { + result = sender.sendWithParam("86", sysSmsDTO.getMobile(), Integer.parseInt(template), paramsList, signName, null, null); + } catch (Exception e) { + throw new RenException(ModuleErrorCode.SEND_SMS_ERROR, e, ""); + } + + int status = Constant.SUCCESS; + if(result.result != 0){ + status = Constant.FAIL; + } + + //保存短信记录 + SysSmsService sysSmsService = SpringContextUtils.getBean(SysSmsService.class); + sysSmsService.save(PlatformEnum.QCLOUD.value(), sysSmsDTO.getMobile(), params, status); + + if(status == Constant.FAIL){ + throw new RenException(ModuleErrorCode.SEND_SMS_ERROR, result.errMsg); + } + } + + @Override + public void sendSmsByAliyunTemplateCodeMsg(SysSmsDTO sysSmsDTO) { + if(StringUtils.isNotBlank(sysSmsDTO.getAliyunTemplateCode())){ + this.sendSmsMsg(sysSmsDTO, config.getAliyunSignName(), sysSmsDTO.getAliyunTemplateCode()); + return; + } + this.sendSmsMsg(sysSmsDTO, config.getAliyunSignName(), config.getAliyunTemplateCode()); + } } From 5bddd701795450af16f3423e53b07d7c74475f4a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 7 Apr 2021 12:18:13 +0800 Subject: [PATCH 58/71] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=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 --- .../com/epmet/resi/group/constant/GroupStateConstant.java | 2 ++ .../resi/group/dto/group/form/ApplyCreateGroupFormDTO.java | 4 ++++ .../modules/group/service/impl/ResiGroupServiceImpl.java | 1 + 3 files changed, 7 insertions(+) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java index ee3bcda420..6d93e5a010 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java @@ -57,4 +57,6 @@ public interface GroupStateConstant { * 进组审核open开启;close关闭 */ String AUDIT_SWITCH_CLOSED = "close"; + + String CLOSED="closed"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java index fd2b239ea8..69efcf295c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java @@ -65,4 +65,8 @@ public class ApplyCreateGroupFormDTO implements Serializable { @NotBlank(message = "app不能为空") private String app; + /** + * 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 4ee54bcd43..084c99afd9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -517,6 +517,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 7 Apr 2021 14:07:38 +0800 Subject: [PATCH 59/71] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=98=AF=E5=90=A6=E5=85=81=E8=AE=B8=E5=8F=82?= =?UTF-8?q?=E8=A7=82=20=E5=B0=8F=E7=BB=84=E7=AE=A1=E7=90=86-=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/group/form/ManageInitFormDTO.java | 16 ++++++++ .../dto/group/result/ManageInitResultDTO.java | 16 ++++++++ .../group/controller/ResiGroupController.java | 25 ++++++++++++ .../group/service/ResiGroupService.java | 18 +++++++++ .../service/impl/ResiGroupServiceImpl.java | 38 +++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java new file mode 100644 index 0000000000..509f2bf6f1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/4/7 10:54 + */ +@Data +public class ManageInitFormDTO implements Serializable { + private static final long serialVersionUID = -5535489295806473761L; + private String groupId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java new file mode 100644 index 0000000000..36e9e2ad4c --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java @@ -0,0 +1,16 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/4/7 10:55 + */ +@Data +public class ManageInitResultDTO implements Serializable { + private static final long serialVersionUID = 2981099696943155870L; + private String visitSwitch; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index 569a9137b3..23ffab9d29 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -477,4 +477,29 @@ public class ResiGroupController { return new Result>().ok(resiGroupService.getGroupInfo(groupIds)); } + /** + * 小组管理-界面初始化 + * @author zhaoqifeng + * @date 2021/4/7 10:56 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("manageinit") + public Result manageInit(@RequestBody ManageInitFormDTO formDTO){ + return new Result().ok(resiGroupService.manageInit(formDTO)); + } + + /** + * 小组管理-设置是否允许参观 + * @author zhaoqifeng + * @date 2021/4/7 13:50 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("setvisitswitch") + public Result setVisitSwitch(@RequestBody ManageInitFormDTO formDTO){ + resiGroupService.setVisitSwitch(formDTO); + return new Result(); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index 0fd92bf582..b4bccf14e9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -352,4 +352,22 @@ public interface ResiGroupService extends BaseService { * @Date 2020/11/23 10:03 **/ HashMap getGroupInfo(List groupIds); + + /** + * 小组管理-界面初始化 + * @author zhaoqifeng + * @date 2021/4/7 10:57 + * @param formDTO + * @return com.epmet.resi.group.dto.group.result.ManageInitResultDTO + */ + ManageInitResultDTO manageInit(ManageInitFormDTO formDTO); + + /** + * 小组管理-设置是否允许参观 + * @author zhaoqifeng + * @date 2021/4/7 13:50 + * @param formDTO + * @return void + */ + void setVisitSwitch(ManageInitFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 084c99afd9..a8e6e03150 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -1128,6 +1128,44 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 7 Apr 2021 15:03:51 +0800 Subject: [PATCH 60/71] setvisitswitch --- .../modules/group/service/impl/ResiGroupServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index a8e6e03150..26f1b8c746 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -1155,7 +1155,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl Date: Wed, 7 Apr 2021 15:13:46 +0800 Subject: [PATCH 61/71] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E6=A8=A1=E5=BC=8F=EF=BC=88=E5=8F=91=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E3=80=81=E5=88=86=E4=BA=AB=E3=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=EF=BC=89=20=E5=8F=82=E8=A7=82?= =?UTF-8?q?=E5=B0=8F=E7=BB=84(=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/constant/GroupVisitConstant.java | 23 ++++++ .../member/form/UserAndGroupRelFormDTO.java | 24 ++++++ .../group/dto/member/form/VisitFormDTO.java | 30 ++++++++ .../dto/member/result/GroupInfoResultDTO.java | 20 +++++ .../result/UserAndGroupRelResultDTO.java | 21 ++++++ .../dto/member/result/VisitResultDTO.java | 25 +++++++ .../controller/GroupVisitorController.java | 40 ++++++++++ .../modules/member/dao/GroupVisitorDao.java | 28 +++++++ .../member/service/GroupVisitorService.java | 22 ++++++ .../service/impl/GroupVisitorServiceImpl.java | 75 +++++++++++++++++++ .../mapper/member/GroupVisitorDao.xml | 27 +++++++ 11 files changed, 335 insertions(+) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java new file mode 100644 index 0000000000..ef0e2b92e7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java @@ -0,0 +1,23 @@ +package com.epmet.resi.group.constant; + +/** + * @Author zxc + * @DateTime 2021/4/7 下午1:47 + * @DESC + */ +public interface GroupVisitConstant { + + /** + * 小组是否允许参观:允许:open;不允许:closed + */ + String VISIT_SWITCH_OPEN = "open"; + String VISIT_SWITCH_CLOSED = "closed"; + + /** + * 参观模式:visit ; 已入组: in_group;未知:unknown + */ + String VISIT = "visit"; + String VISIT_IN_GROUP = "in_group"; + String VISIT_UNKNOWN = "unknown"; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java new file mode 100644 index 0000000000..c3e45edacb --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午11:02 + * @DESC + */ +@Data +public class UserAndGroupRelFormDTO implements Serializable { + + private static final long serialVersionUID = -8406731503470703549L; + + public interface UserAndGroupRelForm{} + + @NotBlank(message = "小组ID不能为空",groups = UserAndGroupRelForm.class) + private String groupId; + + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java new file mode 100644 index 0000000000..ad68712854 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午10:49 + * @DESC + */ +@Data +public class VisitFormDTO implements Serializable { + + private static final long serialVersionUID = 3516659225931215600L; + + public interface VisitForm{} + + /** + * 小组ID + */ + @NotBlank(message = "小组ID不能为空",groups = VisitForm.class) + private String groupId; + + private String userId; + + private String customerId; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java new file mode 100644 index 0000000000..7e9ae3eff8 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 下午2:08 + * @DESC + */ +@Data +public class GroupInfoResultDTO implements Serializable { + + private static final long serialVersionUID = -6300305692117164080L; + + private String visitSwitch; + + private String gridId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java new file mode 100644 index 0000000000..e7b6ac3cc3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午11:05 + * @DESC + */ +@Data +public class UserAndGroupRelResultDTO implements Serializable { + + private static final long serialVersionUID = 8162347909790178255L; + + /** + * 参观模式:visit ; 已入组: in_group;未知:unknown + */ + private String pattern; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java new file mode 100644 index 0000000000..13563e27b5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午10:52 + * @DESC + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class VisitResultDTO implements Serializable { + + private static final long serialVersionUID = -6532744066209112808L; + + /** + * 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java index 5140967fb6..81ad57760b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java @@ -17,8 +17,18 @@ package com.epmet.modules.member.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.member.service.GroupVisitorService; +import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; +import com.epmet.resi.group.dto.member.form.VisitFormDTO; +import com.epmet.resi.group.dto.member.result.UserAndGroupRelResultDTO; +import com.epmet.resi.group.dto.member.result.VisitResultDTO; 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; @@ -36,5 +46,35 @@ public class GroupVisitorController { @Autowired private GroupVisitorService groupVisitorService; + /** + * @Description 参观小组(记录日志) + * 推荐小组界面,点击参观按钮,调用此接口 如果开关开启的情况下,需要记录到 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2021/4/7 上午10:57 + */ + @PostMapping("visit") + public Result visit(@RequestBody VisitFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, VisitFormDTO.VisitForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(groupVisitorService.visit(formDTO)); + } + + /** + * @Description 获取当前在组模式(发话题、分享、评论时调用) + * 发表话题、评论话题、分享话题按下,先调用此接口 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午11:09 + */ + @PostMapping("userandgrouprel") + public Result userAndGroupRel(@RequestBody UserAndGroupRelFormDTO formDTO,@LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, UserAndGroupRelFormDTO.UserAndGroupRelForm.class); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(groupVisitorService.userAndGroupRel(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java index b2b8eed76b..b3576877c9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java @@ -19,7 +19,9 @@ package com.epmet.modules.member.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.member.entity.GroupVisitorEntity; +import com.epmet.resi.group.dto.member.result.GroupInfoResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 小组参观者记录 @@ -29,5 +31,31 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface GroupVisitorDao extends BaseDao { + + /** + * @Description 查询小组是否允许参观:允许:open;不允许:closed + * @Param groupId + * @author zxc + * @date 2021/4/7 下午1:44 + */ + GroupInfoResultDTO selectVisitSwitch(@Param("groupId")String groupId); + + /** + * @Description 查询用户是否访问过此小组 + * @Param userId + * @Param groupId + * @author zxc + * @date 2021/4/7 下午2:02 + */ + Integer selectVisitCount(@Param("userId")String userId,@Param("groupId")String groupId); + + /** + * @Description 更新最后一次访问时间 + * @Param userId + * @Param groupId + * @author zxc + * @date 2021/4/7 下午2:13 + */ + void updateLatestTime(@Param("userId")String userId,@Param("groupId")String groupId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java index 7c59b434a7..0f6f8c4754 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java @@ -21,6 +21,10 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.modules.member.entity.GroupVisitorEntity; import com.epmet.resi.group.dto.member.GroupVisitorDTO; +import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; +import com.epmet.resi.group.dto.member.form.VisitFormDTO; +import com.epmet.resi.group.dto.member.result.UserAndGroupRelResultDTO; +import com.epmet.resi.group.dto.member.result.VisitResultDTO; import java.util.List; import java.util.Map; @@ -82,4 +86,22 @@ public interface GroupVisitorService extends BaseService { * @date 2021-04-07 */ void update(GroupVisitorDTO dto); + + /** + * @Description 参观小组(记录日志) + * 推荐小组界面,点击参观按钮,调用此接口 如果开关开启的情况下,需要记录到 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午10:58 + */ + VisitResultDTO visit( VisitFormDTO formDTO); + + /** + * @Description 获取当前在组模式(发话题、分享、评论时调用) + * 发表话题、评论话题、分享话题按下,先调用此接口 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午11:09 + */ + UserAndGroupRelResultDTO userAndGroupRel(UserAndGroupRelFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java index 83f8f6e1d4..662505859e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java @@ -21,16 +21,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.member.dao.GroupVisitRecordDao; import com.epmet.modules.member.dao.GroupVisitorDao; +import com.epmet.modules.member.dao.ResiGroupMemberDao; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; import com.epmet.modules.member.entity.GroupVisitorEntity; import com.epmet.modules.member.service.GroupVisitorService; +import com.epmet.resi.group.constant.GroupVisitConstant; import com.epmet.resi.group.dto.member.GroupVisitorDTO; +import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; +import com.epmet.resi.group.dto.member.form.VisitFormDTO; +import com.epmet.resi.group.dto.member.result.GroupInfoResultDTO; +import com.epmet.resi.group.dto.member.result.UserAndGroupRelResultDTO; +import com.epmet.resi.group.dto.member.result.VisitResultDTO; 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.Date; import java.util.List; import java.util.Map; @@ -43,6 +55,10 @@ import java.util.Map; @Service public class GroupVisitorServiceImpl extends BaseServiceImpl implements GroupVisitorService { + @Autowired + private GroupVisitRecordDao groupVisitRecordDao; + @Autowired + private ResiGroupMemberDao resiGroupMemberDao; @Override public PageData page(Map params) { @@ -89,5 +105,64 @@ public class GroupVisitorServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + // 已存在记录,更新最近一次访问时间 + baseDao.updateLatestTime(formDTO.getUserId(),formDTO.getGroupId()); + }else { + // 插入一条新纪录 + GroupVisitorEntity entity = new GroupVisitorEntity(); + entity.setLatestVisitTime(new Date()); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setGridId(visitSwitch.getGridId()); + entity.setGroupId(formDTO.getGroupId()); + entity.setUserId(formDTO.getUserId()); + baseDao.insert(entity); + } + GroupVisitRecordEntity groupVisitRecordEntity = new GroupVisitRecordEntity(); + groupVisitRecordEntity.setCustomerId(formDTO.getCustomerId()); + groupVisitRecordEntity.setGridId(visitSwitch.getGridId()); + groupVisitRecordEntity.setGroupId(formDTO.getGroupId()); + groupVisitRecordEntity.setUserId(formDTO.getUserId()); + groupVisitRecordDao.insert(groupVisitRecordEntity); + return new VisitResultDTO(visitSwitch.getVisitSwitch()); + } + + /** + * @Description 获取当前在组模式(发话题、分享、评论时调用) + * 发表话题、评论话题、分享话题按下,先调用此接口 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午11:09 + */ + @Override + public UserAndGroupRelResultDTO userAndGroupRel(UserAndGroupRelFormDTO formDTO) { + Integer userInGroup = resiGroupMemberDao.checkUserInGroup(formDTO.getUserId(), formDTO.getGroupId()); + UserAndGroupRelResultDTO result = new UserAndGroupRelResultDTO(); + if (NumConstant.ZERO == userInGroup){ + result.setPattern(GroupVisitConstant.VISIT); + }else if (NumConstant.ZERO < userInGroup){ + result.setPattern(GroupVisitConstant.VISIT_IN_GROUP); + }else { + result.setPattern(GroupVisitConstant.VISIT_UNKNOWN); + } + return result; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml index 82303b9699..992cadedb4 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml @@ -3,6 +3,33 @@ + + + UPDATE group_visitor + SET latest_visit_time = NOW() + WHERE DEL_FLAG = '0' + AND GROUP_ID = #{groupId} + AND user_id = #{userId} + + + + + + \ No newline at end of file From e7fcddb3614d06462c79dda2026ba28b99d9cac9 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Apr 2021 13:51:42 +0800 Subject: [PATCH 62/71] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E6=A8=A1=E5=BC=8F=EF=BC=88=E5=8F=91=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E3=80=81=E5=88=86=E4=BA=AB=E3=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=EF=BC=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GroupVisitorServiceImpl.java | 24 ++++++++++++------- .../mapper/member/ResiGroupMemberDao.xml | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java index 662505859e..7064f3ccaa 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java @@ -22,16 +22,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.member.dao.GroupVisitRecordDao; import com.epmet.modules.member.dao.GroupVisitorDao; -import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.member.entity.GroupVisitRecordEntity; import com.epmet.modules.member.entity.GroupVisitorEntity; import com.epmet.modules.member.service.GroupVisitorService; +import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.resi.group.constant.GroupVisitConstant; +import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.member.GroupVisitorDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; import com.epmet.resi.group.dto.member.form.VisitFormDTO; import com.epmet.resi.group.dto.member.result.GroupInfoResultDTO; @@ -58,8 +63,9 @@ public class GroupVisitorServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -152,14 +158,16 @@ public class GroupVisitorServiceImpl extends BaseServiceImpl From 49c95a791c8ce910c8b24dd0ff060d82ce4f2b6c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Apr 2021 14:06:23 +0800 Subject: [PATCH 63/71] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E6=A8=A1=E5=BC=8F=EF=BC=88=E5=8F=91=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E3=80=81=E5=88=86=E4=BA=AB=E3=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=EF=BC=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/member/GroupVisitorDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml index 992cadedb4..ef77eeb936 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml @@ -6,7 +6,7 @@ UPDATE group_visitor - SET latest_visit_time = NOW() + SET latest_visit_time = NOW(),UPDATED_TIME=NOW() WHERE DEL_FLAG = '0' AND GROUP_ID = #{groupId} AND user_id = #{userId} From 14d5bb7a15fd09b22f44ca5d767730215ce79334 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Apr 2021 14:09:07 +0800 Subject: [PATCH 64/71] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E6=A8=A1=E5=BC=8F=EF=BC=88=E5=8F=91=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E3=80=81=E5=88=86=E4=BA=AB=E3=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=EF=BC=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resi/group/dto/member/form/UserAndGroupRelFormDTO.java | 1 + .../com/epmet/resi/group/dto/member/form/VisitFormDTO.java | 2 ++ .../modules/member/controller/GroupVisitorController.java | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java index c3e45edacb..a83ddd342d 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java @@ -20,5 +20,6 @@ public class UserAndGroupRelFormDTO implements Serializable { @NotBlank(message = "小组ID不能为空",groups = UserAndGroupRelForm.class) private String groupId; + @NotBlank(message = "tokenDto获取userId为空",groups = UserAndGroupRelForm.class) private String userId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java index ad68712854..acb32c589c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java @@ -23,8 +23,10 @@ public class VisitFormDTO implements Serializable { @NotBlank(message = "小组ID不能为空",groups = VisitForm.class) private String groupId; + @NotBlank(message = "tokenDto获取userId为空",groups = VisitForm.class) private String userId; + @NotBlank(message = "tokenDto获取customerId为空",groups = VisitForm.class) private String customerId; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java index 81ad57760b..de212ce491 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupVisitorController.java @@ -55,10 +55,10 @@ public class GroupVisitorController { * @date 2021/4/7 上午10:57 */ @PostMapping("visit") - public Result visit(@RequestBody VisitFormDTO formDTO, @LoginUser TokenDto tokenDto){ - ValidatorUtils.validateEntity(formDTO, VisitFormDTO.VisitForm.class); + public Result visit(@RequestBody VisitFormDTO formDTO, @LoginUser TokenDto tokenDto) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, VisitFormDTO.VisitForm.class); return new Result().ok(groupVisitorService.visit(formDTO)); } @@ -71,8 +71,8 @@ public class GroupVisitorController { */ @PostMapping("userandgrouprel") public Result userAndGroupRel(@RequestBody UserAndGroupRelFormDTO formDTO,@LoginUser TokenDto tokenDto){ - ValidatorUtils.validateEntity(formDTO, UserAndGroupRelFormDTO.UserAndGroupRelForm.class); formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, UserAndGroupRelFormDTO.UserAndGroupRelForm.class); return new Result().ok(groupVisitorService.userAndGroupRel(formDTO)); } From e0291b6e617c760dc2db6260309d82bb2485f570 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 8 Apr 2021 14:18:35 +0800 Subject: [PATCH 65/71] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E6=A8=A1=E5=BC=8F=EF=BC=88=E5=8F=91=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E3=80=81=E5=88=86=E4=BA=AB=E3=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=EF=BC=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/impl/GroupVisitorServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java index 7064f3ccaa..b22a79fd21 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java @@ -163,11 +163,14 @@ public class GroupVisitorServiceImpl extends BaseServiceImpl NumConstant.ZERO) { + result.setPattern(GroupVisitConstant.VISIT); + } } return result; } From 894dd33d5d94f5984c99973a627c3ba8bb9dda16 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 9 Apr 2021 09:57:24 +0800 Subject: [PATCH 66/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=A1=E9=AA=8C=EF=BC=8C=E6=89=93=E5=8D=B0error?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=89=93=E5=8D=B0warn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/aspect/BaseRequestLogAspect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index 4b3496ee36..38a70d6582 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -77,7 +77,7 @@ public abstract class BaseRequestLogAspect { return result; } catch (ValidateException e) { result = handleValidateException(e); - resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); + resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); } catch (DuplicateKeyException e) { result = handlerDuplicateKeyException(e); resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMessage(), ExceptionUtils.getErrorStackTrace(e)); From 6ceb2eca4927f3844e145e4ee7b9e8db5feb453e Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 9 Apr 2021 14:30:56 +0800 Subject: [PATCH 67/71] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0-=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/ThirdPlatformDTO.java | 57 +++++++++ .../com/epmet/dto/form/CustomerFormDTO.java | 18 +++ .../epmet/dto/form/PlatformNameFormDTO.java | 15 +++ .../dto/form/PlatformRegisterFormDTO.java | 29 +++++ .../dto/form/PlatformUnregisterFormDTO.java | 27 ++++ .../controller/ThirdPlatformController.java | 118 +++++++++++++++++- .../dao/ThirdplatformCustomerRegisterDao.java | 26 +++- .../java/com/epmet/dao/ThirdplatformDao.java | 47 ++++++- .../epmet/service/ThirdPlatformService.java | 80 +++++++++++- .../impl/ThirdPlatformServiceImpl.java | 65 +++++++++- .../ThirdplatformCustomerRegisterDao.xml | 42 ++++++- .../resources/mapper/ThirdplatformDao.xml | 67 +++++++++- 12 files changed, 576 insertions(+), 15 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java new file mode 100644 index 0000000000..7a8efc43cd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class ThirdPlatformDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 平台名称 + */ + @NotBlank(message = "平台名称 不能为空") + private String platformName; + + /** + * 平台唯一KEY + */ + @NotBlank(message = "平台唯一KEY 不能为空") + private String platformKey; + + /** + * 平台秘钥 + */ + @NotBlank(message = "平台秘钥 不能为空") + private String platformSecret; + + /** + * apiservice + */ + @NotBlank(message = "apiservice 不能为空") + private String apiService; + + /** + * 基础url + */ + @NotBlank(message = "基础url 不能为空") + private String baseUrl; + + /** + * icon + */ + @NotBlank(message = "icon 不能为空") + private String icon; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java new file mode 100644 index 0000000000..d2defb259d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 客户 共用入参 + **/ +@Data +public class CustomerFormDTO { + + /** + * 客户id + **/ + @NotBlank(message = "客户id 不能为空") + private String customerId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java new file mode 100644 index 0000000000..2fe4f8ed45 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class PlatformNameFormDTO { + + /** + * 平台名称,用于模糊搜索 + **/ + @NotBlank(message = "平台名称 不能为空") + private String platformName; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java new file mode 100644 index 0000000000..9f7afda3ae --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 第三方平台-新增客户接入的第三方平台 + * + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class PlatformRegisterFormDTO { + + /** + * 客户id + */ + @NotBlank(message = "客户id 不能为空") + private String customerId; + + /** + * 平台id列表 + */ + @NotNull(message = "平台id列表 不能为空") + private List platformIdList; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java new file mode 100644 index 0000000000..04cc64ae77 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 解除客户接入的平台 + * + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class PlatformUnregisterFormDTO { + + /** + * 客户id + */ + @NotBlank(message = "客户id 不能为空") + private String customerId; + + /** + * 平台ID + */ + @NotBlank(message = "平台ID 不能为空") + private String platformId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java index f0bdb4d5ab..1ddf6cbc40 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java @@ -1,11 +1,14 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO; -import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -89,4 +92,115 @@ public class ThirdPlatformController { thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms()); return new Result(); } + + /** + * 第三方平台-平台列表模糊查询 + * + * @param formsDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:13 2021-04-08 + **/ + @PostMapping("list-platforms") + public Result> listPlatforms(@RequestBody PlatformNameFormDTO formsDTO) { + ValidatorUtils.validateEntity(formsDTO); + return new Result>().ok(thirdPlatformService.listPlatforms(formsDTO.getPlatformName())); + } + + /** + * 第三方平台-修改平台 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 17:31 2021-04-08 + **/ + @PostMapping("update-platform") + public Result updatePlatform(@RequestBody ThirdPlatformDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (StringUtils.isBlank(formDTO.getId())) { + throw new RenException("主键不能为空"); + } + thirdPlatformService.updatePlatform(formDTO); + return new Result(); + } + + /** + * 第三方平台-新增平台 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 17:31 2021-04-08 + **/ + @PostMapping("add-platform") + public Result addPlatform(@RequestBody ThirdPlatformDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(thirdPlatformService.addPlatform(formDTO)); + } + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/registrable-platform-list") + public Result> registrablePlatformList(@RequestBody CustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(thirdPlatformService.listRegistrablePlatform(formDTO)); + } + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/registered-platform-list") + public Result> registeredPlatformList(@RequestBody CustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(thirdPlatformService.listRegisteredPlatform(formDTO)); + } + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/unregister-platform") + public Result unregisterPlatform(@RequestBody PlatformUnregisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + thirdPlatformService.unregisterPlatformCustomer(formDTO); + return new Result(); + } + + /** + * 第三方平台-新增客户接入的第三方平台 + * 注:新增该客户要接入的第三方平台。thirdplatform_customer_register表新增数据。customized_xxx默认从thirdplatform表取过来 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:34 2021-04-09 + **/ + @PostMapping("customer/register-platform") + public Result registerPlatform(@RequestBody PlatformRegisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (formDTO.getPlatformIdList().size() == NumConstant.ZERO) { + throw new RenException("formDTO.getPlatformIdList().size() == 0;平台id列表不能为空"); + } + thirdPlatformService.registerThirdPlatformCustomer(formDTO); + return new Result(); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java index cbae094292..3dc3001baf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java @@ -18,7 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * + * * * @author generator generator@elink-cn.com * @since v1.0.0 2021-03-15 @@ -35,4 +35,24 @@ import java.util.List; public interface ThirdplatformCustomerRegisterDao extends BaseDao { ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); -} \ No newline at end of file + + /** + * 批量新增 + * @param list + * @return int + * @Author zhangyong + * @Date 11:05 2021-04-09 + **/ + int batchInsertThirdplatformCustomerRegister(@Param("list") List list); + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除.thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java index 8b5e7840cc..74b53823b3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ThirdPlatformDTO; import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.ThirdplatformEntity; import org.apache.ibatis.annotations.Mapper; @@ -26,7 +27,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * + * * * @author generator generator@elink-cn.com * @since v1.0.0 2021-03-15 @@ -43,4 +44,46 @@ public interface ThirdplatformDao extends BaseDao { List listAvailablePlatformsByCustomerAndAction(@Param("customerId") String customerId, @Param("actionKey") String actionKey); List listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey); -} \ No newline at end of file + + /** + * 第三方平台-平台列表模糊查询 + * + * @param platformName 平台名称,用于模糊搜索 + * @return java.util.List + * @Author zhangyong + * @Date 17:14 2021-04-08 + **/ + List selectListPlatforms(@Param("platformName") String platformName); + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List selectListRegistrablePlatform(@Param("customerId") String customerId); + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List selectListRegisteredPlatform(@Param("customerId") String customerId); + + /** + * 查询第三方平台 + * + * @param platformIds + * @return java.util.List + * @Author zhangyong + * @Date 10:51 2021-04-09 + **/ + List selectListThirdPlatform(@Param("platformIds") List platformIds); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java index 9a0042f6e7..570ce04d49 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java @@ -1,6 +1,10 @@ package com.epmet.service; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.form.PlatformRegisterFormDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; import com.epmet.dto.result.ThirdplatformResultDTO; import java.util.List; @@ -22,4 +26,78 @@ public interface ThirdPlatformService { void updateCustomizePlatformInfo(ThirdPlatformFormDTO input); void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List platforms); -} \ No newline at end of file + + /** + * 第三方平台-平台列表模糊查询 + * + * @param platformName 平台名称,用于模糊搜索 + * @return java.util.List + * @Author zhangyong + * @Date 17:14 2021-04-08 + **/ + List listPlatforms(String platformName); + + /** + * 第三方平台-修改平台 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 17:43 2021-04-08 + **/ + void updatePlatform(ThirdPlatformDTO formDTO); + + /** + * 第三方平台-新增平台 + * + * @param formDTO + * @return com.epmet.dto.ThirdPlatformDTO + * @Author zhangyong + * @Date 17:43 2021-04-08 + **/ + ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO); + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List listRegistrablePlatform(CustomerFormDTO formDTO); + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List listRegisteredPlatform(CustomerFormDTO formDTO); + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除.thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO); + + /** + * 第三方平台-新增客户接入的第三方平台 + * 注:新增该客户要接入的第三方平台。thirdplatform_customer_register表新增数据。customized_xxx默认从thirdplatform表取过来 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java index 7e92c34223..3d6393e17e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java @@ -2,24 +2,27 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.ThirdplatformCustomerActionDao; import com.epmet.dao.ThirdplatformCustomerRegisterDao; import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.form.PlatformRegisterFormDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; import com.epmet.dto.result.ThirdplatformResultDTO; -import com.epmet.entity.ThirdplatformActionEntity; import com.epmet.entity.ThirdplatformCustomerActionEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +import com.epmet.entity.ThirdplatformEntity; import com.epmet.service.ThirdPlatformService; -import jodd.util.CollectionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import javax.validation.constraints.NotBlank; +import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; @Service public class ThirdPlatformServiceImpl implements ThirdPlatformService { @@ -105,4 +108,56 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService { entity.setCustomizedPlatformIcon(platformFormDTO.getIcon()); thirdplatformCustomerRegisterDao.update(entity, conditions); } + + @Override + public List listPlatforms(String platformName) { + return thirdplatformDao.selectListPlatforms(platformName); + } + + @Override + public void updatePlatform(ThirdPlatformDTO formDTO) { + ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class); + thirdplatformDao.updateById(entity); + } + + @Override + public ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO) { + ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class); + thirdplatformDao.insert(entity); + formDTO.setId(entity.getId()); + return formDTO; + } + + @Override + public List listRegistrablePlatform(CustomerFormDTO formDTO) { + return thirdplatformDao.selectListRegistrablePlatform(formDTO.getCustomerId()); + } + + @Override + public List listRegisteredPlatform(CustomerFormDTO formDTO) { + return thirdplatformDao.selectListRegisteredPlatform(formDTO.getCustomerId()); + } + + @Override + public void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO) { + thirdplatformCustomerRegisterDao.unregisterPlatformCustomer(formDTO); + } + + @Override + public void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO) { + List entityList = new ArrayList<>(); + + List thirdPlatforms = thirdplatformDao.selectListThirdPlatform(formDTO.getPlatformIdList()); + for (ThirdPlatformDTO dto : thirdPlatforms) { + ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPlatformId(dto.getId()); + entity.setCustomizedPlatformName(dto.getPlatformName()); + entity.setCustomizedPlatformIcon(dto.getIcon()); + entityList.add(entity); + } + if (entityList.size() > NumConstant.ZERO) { + thirdplatformCustomerRegisterDao.batchInsertThirdplatformCustomerRegister(entityList); + } + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml index e4cdddc98d..9ab368a8bc 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml @@ -35,4 +35,44 @@ and PLATFORM_ID = #{platformId} and DEL_FLAG = 0 - \ No newline at end of file + + + insert into thirdplatform_customer_register + ( + ID, + CUSTOMER_ID, + PLATFORM_ID, + CUSTOMIZED_PLATFORM_NAME, + CUSTOMIZED_PLATFORM_ICON, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.platformId}, + #{item.customizedPlatformName}, + #{item.customizedPlatformIcon}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + + + UPDATE thirdplatform_customer_register + SET DEL_FLAG = '1' + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} AND PLATFORM_ID = #{platformId} + + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml index beec9ed36d..e27f550f11 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml @@ -87,4 +87,69 @@ and ta.ACTION_KEY = #{actionKey} and tcr.DEL_FLAG = 0 - \ No newline at end of file + + + + + + + + + From eeee230cb086cb0f365f03687f312127d2c995d6 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 12 Apr 2021 09:34:02 +0800 Subject: [PATCH 68/71] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/AreaCodeServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index 5e865cfc44..f34ff30605 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -593,6 +593,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl list = childDao.selectByPCodeAndName(formDTO.getParentAreaCode().trim(), formDTO.getName().trim()); if (CollUtil.isNotEmpty(list)) { throw new RenException("name已存在"); From e27fbc3c1ab1337bb0e4b3d272c297f502797a21 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 13 Apr 2021 13:48:17 +0800 Subject: [PATCH 69/71] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9AopenApi?= =?UTF-8?q?=E9=AA=8C=E7=AD=BE=E9=83=A8=E5=88=86=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/security/sign/openapi/OpenApiSignUtils.java | 5 +++-- .../com/epmet/commons/tools/exception/EpmetErrorCode.java | 4 +++- .../java/com/epmet/aspect/OpenApiRequestCheckAspect.java | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java index 8551289868..1de1b04f73 100644 --- a/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java +++ b/epmet-commons/epmet-commons-security/src/main/java/com/epmet/commons/security/sign/openapi/OpenApiSignUtils.java @@ -93,8 +93,9 @@ public class OpenApiSignUtils { System.out.println("随机数:" + uuid); HashMap content = new HashMap<>(); - content.put("orgId", "aaa"); - content.put("test", null); + //content.put("orgId", "aaa"); + //content.put("test", null); + content.put("gridId", "12128e0f614f1c00a058ea9a107033b2"); content.put("app_id", "7d98b8af2d05752b4225709c4cfd4bd0"); content.put("timestamp", String.valueOf(now)); content.put("nonce", uuid); 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 26834d4458..5673b272f1 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 @@ -156,7 +156,9 @@ public enum EpmetErrorCode { OPEN_API_TOKEN_EXPIRED(10102, "Token过期"), OPEN_API_PARAMS_MISSING(10103, "参数不完整"), OPEN_API_SIGN_ERROR(10104, "签名错误"), - OPEN_API_PARAMS_APPID_DIFF(10105, "app_id不一致"); // app_id在请求参数中和在token中不一致 + OPEN_API_PARAMS_APPID_DIFF(10105, "app_id不一致"), // app_id在请求参数中和在token中不一致 + OPEN_API_REQUEST_EXPIRED(10106, "请求过期"), + OPEN_API_REQUEST_REPEAT(10107, "请求重复"); private int code; private String msg; diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java index 6661ac747d..c6f23cc779 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/OpenApiRequestCheckAspect.java @@ -125,12 +125,13 @@ public class OpenApiRequestCheckAspect { if (Math.abs(now - timestamp) > requestTimeMillSecDiff) { // 只允许1分钟之内的请求,允许服务器之间时差为1分钟 - throw new RenException(String.format("请求已过时,允许时差为%s s", requestTimeSecDiff)); + throw new RenException(EpmetErrorCode.OPEN_API_REQUEST_EXPIRED.getCode(), + String.format("请求已过期,允许时差为%s s", requestTimeSecDiff)); } String nonce = argMap.get(RequestParamKeys.NONCE); String nonceInCache = redisUtils.getString(RedisKeys.getOpenApiNonceKey(nonce)); if (StringUtils.isNotBlank(nonceInCache)) { - throw new RenException("请求重复"); + throw new RenException(EpmetErrorCode.OPEN_API_REQUEST_REPEAT.getCode()); } //将nonce缓存到redis,有效期1分钟 redisUtils.set(RedisKeys.getOpenApiNonceKey(nonce), System.currentTimeMillis(), requestTimeSecDiff); From 3f5e3c665ae68f939f908c0b9267a35e71301317 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 13 Apr 2021 14:14:28 +0800 Subject: [PATCH 70/71] =?UTF-8?q?dev=E5=88=86=E6=94=AF=E5=90=88=E5=88=B0de?= =?UTF-8?q?v=5Fadd=5Fcustomer=5Fid=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index ff37731933..187eaee664 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -409,7 +409,6 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl Date: Tue, 13 Apr 2021 15:18:59 +0800 Subject: [PATCH 71/71] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=AF=E5=88=A0=E7=9A=84=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-openapi-adv-client/pom.xml | 16 + .../epmet-openapi-adv-server/Dockerfile | 11 + .../deploy/docker-compose-dev.yml | 18 + .../deploy/docker-compose-prod.yml | 18 + .../deploy/docker-compose-test.yml | 18 + .../epmet-openapi-adv-server/pom.xml | 227 ++++++ .../java/com/epmet/adv/AdvApplication.java | 15 + .../epmet/adv/aspect/RequestLogAspect.java | 40 + .../epmet/adv/config/ModuleConfigImpl.java | 26 + .../adv/controller/AdvVideoController.java | 28 + .../java/com/epmet/adv/dao/AdvVedioDao.java | 33 + .../com/epmet/adv/entity/AdvVedioEntity.java | 56 ++ .../epmet/adv/service/AdvVedioService.java | 7 + .../adv/service/impl/AdvVedioServiceImpl.java | 18 + .../src/main/resources/bootstrap.yml | 140 ++++ .../db/migration/V0.0.1__createAdvVedio.sql | 18 + .../src/main/resources/logback-spring.xml | 169 ++++ .../src/main/resources/mapper/AdvVedioDao.xml | 35 + epmet-openapi/epmet-openapi-adv/pom.xml | 21 + epmet-openapi/epmet-openapi-scan/Dockerfile | 11 + .../deploy/docker-compose-dev.yml | 18 + .../deploy/docker-compose-prod.yml | 18 + .../deploy/docker-compose-test.yml | 18 + epmet-openapi/epmet-openapi-scan/pom.xml | 208 +++++ .../epmet/openapi/scan/ScanApplication.java | 30 + .../openapi/scan/aspect/RequestLogAspect.java | 40 + .../scan/common/constant/SysConstant.java | 30 + .../scan/common/enu/CommonErrorCodeEnum.java | 68 ++ .../openapi/scan/common/enu/ImgSceneEnum.java | 47 ++ .../openapi/scan/common/enu/LabelEnum.java | 66 ++ .../openapi/scan/common/enu/RegionIdEnum.java | 49 ++ .../scan/common/enu/SuggestionEnum.java | 48 ++ .../scan/common/enu/SysResponseEnum.java | 46 ++ .../scan/common/enu/TextSceneEnum.java | 46 ++ .../scan/common/enu/VideoSceneEnum.java | 50 ++ .../scan/common/enu/VoiceSceneEnum.java | 47 ++ .../exception/ExecuteHttpException.java | 29 + .../openapi/scan/common/redis/RedisKeys.java | 38 + .../scan/common/util/HttpClientManager.java | 171 ++++ .../scan/common/util/IAcsClientUtil.java | 67 ++ .../openapi/scan/common/util/MapUtil.java | 55 ++ .../openapi/scan/config/ModuleConfigImpl.java | 26 + .../openapi/scan/config/WebAppConfig.java | 31 + .../scan/controller/BackDoorController.java | 32 + .../scan/controller/ScanController.java | 116 +++ .../interceptor/ScanApiAuthInterceptor.java | 60 ++ .../scan/service/impl/ScanService.java | 69 ++ .../scan/service/impl/ScanServiceImpl.java | 734 ++++++++++++++++++ .../scan/support/param/ImgScanParam.java | 48 ++ .../openapi/scan/support/param/ImgTask.java | 31 + .../scan/support/param/TextScanParam.java | 48 ++ .../openapi/scan/support/param/TextTask.java | 33 + .../support/param/VoiceAsyncScanParam.java | 68 ++ .../openapi/scan/support/param/VoiceTask.java | 31 + .../param/video/VideoAsyncScanParam.java | 76 ++ .../param/video/VideoAsyncScanTask.java | 30 + .../support/result/ImgAsyncScanResult.java | 24 + .../scan/support/result/ScanTaskResult.java | 28 + .../support/result/SceneDetailResult.java | 31 + .../scan/support/result/SyncScanResult.java | 42 + .../result/VoiceAsyncScanDetailDTO.java | 47 ++ .../support/result/VoiceAsyncScanResult.java | 89 +++ .../result/VoiceAsyncScanResultDTO.java | 57 ++ .../result/VoiceAsyncScanTaskDataDTO.java | 40 + .../result/VoiceAsyncScanTaskResult.java | 46 ++ .../video/VideoAsyncScanTaskDataDTO.java | 41 + .../video/VideoAsyncScanTaskResultDTO.java | 45 ++ .../support/result/video/VideoResultDTO.java | 48 ++ .../result/video/VideoScanOriginDetail.java | 53 ++ .../video/VideoScanOriginalResultDTO.java | 51 ++ .../src/main/resources/bootstrap.yml | 91 +++ .../src/main/resources/logback-spring.xml | 169 ++++ .../src/main/resources/readme | 7 + .../src/test/java/BaseSample.java | 50 ++ .../java/ImageAsyncScanRequestSample.java | 95 +++ .../java/ImageAsyncScanResultsSample.java | 83 ++ .../test/java/ImageSyncScanRequestSample.java | 101 +++ .../java/VoiceAsyncScanRequestSample.java | 90 +++ .../VoiceAsyncScanResultsRequestSample.java | 113 +++ epmet-openapi/pom.xml | 19 + 80 files changed, 5007 insertions(+) create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml create mode 100644 epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml create mode 100644 epmet-openapi/epmet-openapi-adv/pom.xml create mode 100644 epmet-openapi/epmet-openapi-scan/Dockerfile create mode 100644 epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml create mode 100644 epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml create mode 100644 epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml create mode 100644 epmet-openapi/epmet-openapi-scan/pom.xml create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/readme create mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java create mode 100644 epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java create mode 100644 epmet-openapi/pom.xml diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml new file mode 100644 index 0000000000..5c57808384 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-client/pom.xml @@ -0,0 +1,16 @@ + + + + epmet-openapi-adv + com.epmet + 2.0.0 + ../pom.xml + + 4.0.0 + + epmet-openapi-adv-client + + + \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile new file mode 100644 index 0000000000..d15b865820 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/Dockerfile @@ -0,0 +1,11 @@ +FROM java:8 + +RUN export LANG="zh_CN.UTF-8" +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone + +COPY ./target/*.jar ./epmet-openapi-adv.jar + +EXPOSE 8115 + +ENTRYPOINT ["sh", "-c", "exec $RUN_INSTRUCT"] \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml new file mode 100644 index 0000000000..55c505363d --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-dev.yml @@ -0,0 +1,18 @@ +version: "3.7" +services: + epmet-openapi-adv-server: + container_name: epmet-openapi-adv-server-dev + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-adv-server:version_placeholder + ports: + - "8015:8015" + network_mode: host # 不会创建新的网络 + volumes: + - "/opt/epmet-cloud-logs/dev:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-adv.jar" + restart: "unless-stopped" + deploy: + resources: + limits: + cpus: '0.1' + memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml new file mode 100644 index 0000000000..b5a13e04e3 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-prod.yml @@ -0,0 +1,18 @@ +version: "3.7" +services: + epmet-openapi-adv-server: + container_name: epmet-openapi-adv-server-prod + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-adv-server:0.3.3 + ports: + - "8015:8015" + network_mode: host # 不会创建新的网络 + volumes: + - "/opt/epmet-cloud-logs/prod:/logs" + environment: + RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./epmet-openapi-adv.jar" + restart: "unless-stopped" + deploy: + resources: + limits: + cpus: '0.1' + memory: 600M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml new file mode 100644 index 0000000000..45d536cb2f --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/deploy/docker-compose-test.yml @@ -0,0 +1,18 @@ +version: "3.7" +services: + epmet-openapi-adv-server: + container_name: epmet-openapi-adv-server-test + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-adv-server:version_placeholder + ports: + - "8015:8015" + network_mode: host # 不会创建新的网络 + volumes: + - "/opt/epmet-cloud-logs/test:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-adv.jar" + restart: "unless-stopped" + deploy: + resources: + limits: + cpus: '0.1' + memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml new file mode 100644 index 0000000000..8dd1602e70 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/pom.xml @@ -0,0 +1,227 @@ + + + + 0.3.3 + + epmet-openapi-adv + com.epmet + 2.0.0 + ../pom.xml + + 4.0.0 + + epmet-openapi-adv-server + + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev + + 8115 + dev + + + + + + epmet_adv_user + EpmEt-db-UsEr + + 0 + 192.168.1.130 + 6379 + 123456 + + true + 192.168.1.130:8848 + 6ceab336-d004-4acf-89c6-e121d06f4988 + + + false + + + false + + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + + + local + + true + + + 8115 + local + + + + + + epmet_adv_user + EpmEt-db-UsEr + + 0 + 118.190.150.119 + 47379 + 123456 + + false + 192.168.1.130:8848 + 6ceab336-d004-4acf-89c6-e121d06f4988 + + + false + + + false + + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + https://epmet-dev.elinkservice.cn/api/epmetscan/api + + + + test + + + 8115 + test + + + + + + epmet + elink@833066 + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + true + + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + + + prod + + 8115 + prod + + + + + + epmet_adv_user + EpmEt-db-UsEr + + 0 + r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com + 6379 + EpmEtclOUdrEdIs!Q2w + + true + 192.168.11.180:8848 + bd205d23-e696-47be-b995-916313f86e99 + + + false + + + true + + + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + + + + \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java new file mode 100644 index 0000000000..61c5d3b4b8 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/AdvApplication.java @@ -0,0 +1,15 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class AdvApplication { + public static void main(String[] args) { + SpringApplication.run(AdvApplication.class, args); + } +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java new file mode 100644 index 0000000000..e06fdc2c95 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/aspect/RequestLogAspect.java @@ -0,0 +1,40 @@ +package com.epmet.adv.aspect; + +import com.epmet.commons.tools.aspect.BaseRequestLogAspect; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 + */ +@Aspect +@Component +@Order(0) +public class RequestLogAspect extends BaseRequestLogAspect { + + @Override + @Around(value = "execution(* com.epmet.adv.controller.*Controller*.*(..)) ") + public Object proceed(ProceedingJoinPoint point) throws Throwable { + return super.proceed(point, getRequest()); + } + + /** + * 获取Request对象 + * + * @return + */ + private HttpServletRequest getRequest() { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + return sra.getRequest(); + } + +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..8d88549b66 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.adv.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "adv"; + } +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java new file mode 100644 index 0000000000..5c032ad562 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/controller/AdvVideoController.java @@ -0,0 +1,28 @@ +package com.epmet.adv.controller; + +import com.epmet.adv.entity.AdvVedioEntity; +import com.epmet.adv.service.AdvVedioService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; + +@Controller +@RequestMapping("video") +public class AdvVideoController { + + @Autowired + private AdvVedioService advVedioService; + + @GetMapping("company-adv") + public String toVedio() throws IOException { + AdvVedioEntity enableAdvVedioEntity = advVedioService.getEnableAdvVedioEntity(); + String redirectUrl = enableAdvVedioEntity != null ? enableAdvVedioEntity.getPath() : "404"; + return String.format("redirect:%s", redirectUrl); + //response.sendRedirect("www.baidu.com"); + } + +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java new file mode 100644 index 0000000000..c14da09d52 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/dao/AdvVedioDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.adv.dao; + +import com.epmet.adv.entity.AdvVedioEntity; +import com.epmet.commons.mybatis.dao.BaseDao; +import org.apache.ibatis.annotations.Mapper; + +/** + * 宣传视频 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Mapper +public interface AdvVedioDao extends BaseDao { + AdvVedioEntity getEnableAdvVedioEntity(); +} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.java new file mode 100644 index 0000000000..a25c6ea77e --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/entity/AdvVedioEntity.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.adv.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 宣传视频 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("adv_vedio") +public class AdvVedioEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 存储路径 + */ + private String path; + + /** + * 存储类型。aliyun_oss,local + */ + private String storeType; + + /** + * 是否启用 + */ + private Integer enable; + +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java new file mode 100644 index 0000000000..38091ee496 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/AdvVedioService.java @@ -0,0 +1,7 @@ +package com.epmet.adv.service; + +import com.epmet.adv.entity.AdvVedioEntity; + +public interface AdvVedioService { + AdvVedioEntity getEnableAdvVedioEntity(); +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java new file mode 100644 index 0000000000..cecc710c39 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/java/com/epmet/adv/service/impl/AdvVedioServiceImpl.java @@ -0,0 +1,18 @@ +package com.epmet.adv.service.impl; + +import com.epmet.adv.dao.AdvVedioDao; +import com.epmet.adv.entity.AdvVedioEntity; +import com.epmet.adv.service.AdvVedioService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AdvVedioServiceImpl implements AdvVedioService { + @Autowired + private AdvVedioDao advVedioDao; + + public AdvVedioEntity getEnableAdvVedioEntity() { + return advVedioDao.getEnableAdvVedioEntity(); + } + +} diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..0bd40dcca7 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml @@ -0,0 +1,140 @@ +server: + port: @server.port@ + version: @version@ + servlet: + context-path: /adv + +spring: + main: + allow-bean-definition-overriding: true + application: + name: epmet-openapi-adv-server + #环境 dev|test|prod + profiles: + active: @spring.profiles.active@ + messages: + encoding: UTF-8 + basename: i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + datasource: + druid: + #MySQL + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + # 数据迁移工具flyway + flyway: + enabled: @spring.flyway.enabled@ + locations: classpath:db/migration + url: @spring.datasource.druid.url@ + user: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + baseline-on-migrate: true + baseline-version: 0 + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.epmet.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ID_WORKER + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + okhttp: + enabled: true + + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + +#pageHelper分页插件 +pagehelper: + helper-dialect: mysql + reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 + +dingTalk: + robot: + webHook: @dingTalk.robot.webHook@ + secret: @dingTalk.robot.secret@ diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql new file mode 100644 index 0000000000..007c12b55f --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/db/migration/V0.0.1__createAdvVedio.sql @@ -0,0 +1,18 @@ +-- create database epmet_adv default character set utf8mb4; + +-- CREATE USER epmet_adv_user@'%' IDENTIFIED BY 'EpmEt-db-UsEr'; +-- GRANT ALL ON `epmet_adv%`.* TO 'epmet_adv_user'@'%'; +-- flush privileges; + +CREATE TABLE `adv_vedio` ( + `ID` varchar(64) NOT NULL COMMENT 'id' primary key , + `PATH` varchar(255) NOT NULL COMMENT '存储路径', + `STORE_TYPE` varchar(30) NOT NULL COMMENT '存储类型。aliyun_oss,local', + `ENABLE` tinyint(1) NOT NULL COMMENT '是否启用', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `DEL_FLAG` int(11) unsigned DEFAULT NULL COMMENT '删除标识 0:未删除 1:删除', + `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 '更新时间' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宣传视频' \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..06a21d317c --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/logback-spring.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + ${appname} + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + ${webHook} + ${secret} + ${appname} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml new file mode 100644 index 0000000000..92a4993b9f --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/mapper/AdvVedioDao.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-adv/pom.xml b/epmet-openapi/epmet-openapi-adv/pom.xml new file mode 100644 index 0000000000..13490687d1 --- /dev/null +++ b/epmet-openapi/epmet-openapi-adv/pom.xml @@ -0,0 +1,21 @@ + + + + epmet-openapi + com.epmet + 2.0.0 + + pom + 4.0.0 + + epmet-openapi-adv + + + epmet-openapi-adv-client + epmet-openapi-adv-server + + + + \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/Dockerfile b/epmet-openapi/epmet-openapi-scan/Dockerfile new file mode 100644 index 0000000000..868fc70ac1 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/Dockerfile @@ -0,0 +1,11 @@ +FROM java:8 + +RUN export LANG="zh_CN.UTF-8" +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone + +COPY ./target/*.jar ./epmet-openapi-scan.jar + +EXPOSE 8107 + +ENTRYPOINT ["sh", "-c", "exec $RUN_INSTRUCT"] \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml new file mode 100644 index 0000000000..4e86ab5e89 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -0,0 +1,18 @@ +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:version_placeholder + ports: + - "8107:8107" + network_mode: host # 不会创建新的网络 + volumes: + - "/opt/epmet-cloud-logs/dev:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-scan.jar" + restart: "unless-stopped" + deploy: + resources: + limits: + cpus: '0.1' + memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml new file mode 100644 index 0000000000..69873777e7 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -0,0 +1,18 @@ +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.24 + ports: + - "8107:8107" + network_mode: host # 不会创建新的网络 + volumes: + - "/opt/epmet-cloud-logs/prod:/logs" + environment: + RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./epmet-openapi-scan.jar" + restart: "unless-stopped" + deploy: + resources: + limits: + cpus: '0.1' + memory: 600M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml new file mode 100644 index 0000000000..49ce30a8c1 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -0,0 +1,18 @@ +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:version_placeholder + ports: + - "8107:8107" + network_mode: host # 不会创建新的网络 + volumes: + - "/opt/epmet-cloud-logs/test:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./epmet-openapi-scan.jar" + restart: "unless-stopped" + deploy: + resources: + limits: + cpus: '0.1' + memory: 300M \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml new file mode 100644 index 0000000000..b80b8a843e --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -0,0 +1,208 @@ + + + + 4.0.0 + 0.3.24 + epmet-openapi-scan + jar + + + epmet-openapi + com.epmet + 2.0.0 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + com.epmet + epmet-commons-tools + 2.0.0 + + + + com.aliyun + aliyun-java-sdk-core + 4.1.1 + + + com.aliyun + aliyun-java-sdk-green + 3.5.1 + + + + org.apache.httpcomponents + httpclient + 4.5.2 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev + + 8107 + dev + + + + 0 + 192.168.1.130 + 6379 + 123456 + + true + 192.168.1.130:8848 + 6ceab336-d004-4acf-89c6-e121d06f4988 + + + false + + + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + + + local + + true + + + 8107 + dev + + + + 0 + 192.168.1.130 + 6379 + 123456 + + false + 192.168.1.130:8848 + 6ceab336-d004-4acf-89c6-e121d06f4988 + + + false + + + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + + + test + + 8107 + test + + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + + + + prod + + + 8107 + prod + + + 0 + r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com + 6379 + EpmEtclOUdrEdIs!Q2w + + true + 192.168.11.180:8848 + bd205d23-e696-47be-b995-916313f86e99 + + + false + + + + + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + + + + \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java new file mode 100644 index 0000000000..38f55211d2 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.openapi.scan; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +/** + * 管理后台 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ + +@SpringBootApplication +@ComponentScan(basePackages = "com.epmet") +public class ScanApplication { + + public static void main(String[] args) { + SpringApplication.run(ScanApplication.class, args); + } + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java new file mode 100644 index 0000000000..ae6960a52d --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java @@ -0,0 +1,40 @@ +package com.epmet.openapi.scan.aspect; + +import com.epmet.commons.tools.aspect.BaseRequestLogAspect; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 + */ +@Aspect +@Component +@Order(0) +public class RequestLogAspect extends BaseRequestLogAspect { + + @Override + @Around(value = "execution(* com.epmet.openapi.scan.controller.*Controller*.*(..)) ") + public Object proceed(ProceedingJoinPoint point) throws Throwable { + return super.proceed(point, getRequest()); + } + + /** + * 获取Request对象 + * + * @return + */ + private HttpServletRequest getRequest() { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + return sra.getRequest(); + } + +} 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 new file mode 100644 index 0000000000..387294c23b --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java @@ -0,0 +1,30 @@ +package com.epmet.openapi.scan.common.constant; + +/** + * 系统常量 + * + * @author jianjun liu + * @date 2020-06-05 10:42 + **/ +public class SysConstant { + + public static final String UTF8 = "utf-8"; + /** + * 文本审核最大任务数 + */ + public static final Integer MAX_TASK_SIZE = 100; + + /** + * 图片审核最大任务数 + */ + public static final Integer MAX_SCAN_IMG_TASK_SIZE = 10; + + public static final String CODE = "code"; + public static final String DATA = "data"; + + + /** + * 任务正在执行中,建议您等待一段时间(例如5s)后再查询结果。 + */ + public static final int PROCESSING=280; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java new file mode 100644 index 0000000000..8ebed5781f --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java @@ -0,0 +1,68 @@ +package com.epmet.openapi.scan.common.enu; + +import com.epmet.commons.tools.constant.StrConstant; + +/** + * 公共错误码 + * + * @author yinzuomei@elink-cn.com + * @date 2021/1/10 19:43 + */ +public enum CommonErrorCodeEnum { + OK(200, "请求成功。"), + PROCESSING(280, "任务正在执行中,建议您等待一段时间(例如5s)后再查询结果。"), + BAD_REQUEST(400, "请求有误,通常由于请求参数不正确导致,请仔细检查请求参数。"), + NOT_ALLOWED(401, "请求失败,通常是由于使用了不安全的图片、视频、语音链接地址。"), + FORBIDDEN(403, "请求访问失败,通常由于您的图片、视频、语音链接无法访问导致,请确认公网是否可访问,并且无防盗链策略。"), + NOT_FOUND(404, "待检测内容未找到,通常是由于您的图片、视频、语音内容无法下载导致,请确认内容可通过公网访问到。"), + DOWNLOAD_FAILED(480, "下载失败,请确认待检测内容的大小、分辨率(如果有)在API的限制范围内。"), + GENERAL_ERROR(500, "一般是服务端临时出错。建议重试,若持续返回该错误码,请通过工单联系我们。"), + DB_FAILED(580, "数据库操作失败。建议重试,若持续返回该错误码,请通过工单联系我们。"), + TIMEOUT(581, "超时。建议重试,若持续返回该错误码,请通过工单联系我们。"), + CACHE_FAILED(585, "缓存出错。建议重试,若持续返回该错误码,请通过工单联系我们。"), + ALGO_FAILED(586, "算法出错。请通过工单联系我们。"), + MQ_FAILED(587, "中间件出错。请通过工单联系我们。"), + EXCEED_QUOTA(588, "请求频率超出配额。默认配额:图片检测50张/秒,视频检测20路/秒,语音检测20路/秒,文本检测100条/秒。如果需要调整配额,请通过工单联系我们。"), + TOO_LARGE(589, "待检测内容过大,请确保检测的内容在API的限制范围内。建议重试,若持续返回该错误码,请通过工单联系我们。"), + BAD_FORMAT(590, "待检测内容格式错误,请确保检测的内容在API的限制范围内。"), + CONNECTION_POOL_FULL(591, "连接池满。请通过工单联系我们。"), + DOWNLOAD_TIMEOUT(592, "下载超时,下载时间限制为3s,请确保检测的内容大小在API的限制范围内。"), + EXPIRED(594, "任务过期,如taskId过期。"), + CATCH_FRAME_FAILED(595, "截帧失败,请通过工单联系我们。"), + PERMISSION_DENY(596, "账号未授权、账号欠费、账号未开通、账号被禁等原因,具体可以参考返回的msg。"); + + + private Integer code; + private String desc; + + CommonErrorCodeEnum(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getErrorMsg(Integer value) { + CommonErrorCodeEnum[] codeEnums = values(); + for (CommonErrorCodeEnum commonErrorCodeEnum : codeEnums) { + if (commonErrorCodeEnum.getCode().equals(value)) { + return commonErrorCodeEnum.getDesc(); + } + } + return StrConstant.EPMETY_STR; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java new file mode 100644 index 0000000000..cfb8d77ac2 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java @@ -0,0 +1,47 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * desc:图片检测场景 + * @author jianjun liu + * @date 2020-06-04 21:39 + **/ +public enum ImgSceneEnum { + PORN("porn", "图片智能鉴黄"), + TERRORISM("terrorism", "图片暴恐涉政识别"); + + private String code; + private String desc; + + ImgSceneEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getImgSceneList() { + List result = new ArrayList<>(); + ImgSceneEnum[] values = ImgSceneEnum.values(); + for (ImgSceneEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java new file mode 100644 index 0000000000..7ad96f3171 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/LabelEnum.java @@ -0,0 +1,66 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * 阿里检测结果的分类字典 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/18 14:04 + */ +public enum LabelEnum { + NORMAL("normal", "正常文本"), + SPAM("spam", "含垃圾信息"), + AD("ad", "广告"), + POLITICS("politics","涉政"), + TERRORISM("terrorism","暴恐"), + ABUSE("abuse","辱骂"), + PORN("porn","色情"), + FLOOD("flood","灌水"), + CONTRABAND("contraband","违禁"), + MEANINGLESS("meaningless","无意义"), + CUSTOMIZED("customized","自定义"); + + private String code; + private String desc; + + LabelEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getLabelEnumList() { + List result = new ArrayList<>(); + LabelEnum[] values = LabelEnum.values(); + for (LabelEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public static String getDesc(String code) { + LabelEnum[] businessModeEnums = values(); + for (LabelEnum labelEnum : businessModeEnums) { + if (labelEnum.getCode().equals(code)) { + return labelEnum.getDesc(); + } + } + return ""; + } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java new file mode 100644 index 0000000000..e1dbd5897b --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java @@ -0,0 +1,49 @@ +package com.epmet.openapi.scan.common.enu; + +/** + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-04 21:39 + **/ +public enum RegionIdEnum { + SHANG_HAI("cn-shanghai","green.cn-shanghai.aliyuncs.com"), + BEI_JING("cn-beijing","green.cn-beijing.aliyuncs.com"), + AP_SOUTHEAST_1("ap-southeast-1","green.ap-southeast-1.aliyuncs.com"), + US_WEST_1("us-west-1","green.us-west-1.aliyuncs.com"); + + private String regionId; + private String domain; + RegionIdEnum(String regionId, String domain){ + this.regionId = regionId; + this.domain = domain; + } + + public static String getDoMain(String regionId){ + if (regionId == null) { + return SHANG_HAI.getDomain(); + } + RegionIdEnum[] values = RegionIdEnum.values(); + for (RegionIdEnum v : values) { + if (regionId.equals(v.getDomain())) { + return v.getDomain(); + } + } + return SHANG_HAI.getDomain(); + } + + public String getRegionId() { + return regionId; + } + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java new file mode 100644 index 0000000000..3881508341 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java @@ -0,0 +1,48 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * desc:检测建议 + * @author jianjun liu + * @date 2020-06-04 21:39 + **/ +public enum SuggestionEnum { + PASS("pass", "正常"), + REVIEW("review", "需要人工审核"), + BLOCK("block", "内容违规"); + + private String code; + private String desc; + + SuggestionEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getImgSceneList() { + List result = new ArrayList<>(); + SuggestionEnum[] values = SuggestionEnum.values(); + for (SuggestionEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java new file mode 100644 index 0000000000..f906186333 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java @@ -0,0 +1,46 @@ +package com.epmet.openapi.scan.common.enu; + +/** + * @author jianjun liu + * @date 2020-06-04 21:39 + **/ +public enum SysResponseEnum { + /** + * + * 业务代码枚举类 + * + * 编码样式:【CCCBBOOXX】 + * 编码示例说明: + * CCC 中心编码&业务系统 (110-内容扫描服务中心服务) + * BB 业务类型(00-默认 ) + * OO 操作类型(00-默认) + * XX 具体编码(00-成功,01-失败,02-参数错误,10-异常 99-系统错误) + * + */ + /*通用枚举 */ + EXCEPTION(10001,"系统异常"), + THIRD_PLATFORM_SERVER_ERROR(10002,"第三方检测服务异常,请稍候重试"), + THIRD_PLATFORM_RESP_STATUS_ERROR(10003,"第三方检测服务响应异常,请稍候重试"), + THIRD_PLATFORM_RESP_CODE_ERROR(10004,"第三方检测服务检测异常,请稍候重试"), + + + /*审核内容 业务 01*/ + SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表长度超过限制"), + SCAN_PARAM_ERROR(110010002,"参数格式不正确"), + ; + + 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-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java new file mode 100644 index 0000000000..263d6e25ed --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java @@ -0,0 +1,46 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * desc:文本检测场景 + * @author jianjun liu + * @date 2020-06-04 21:39 + **/ +public enum TextSceneEnum { + ANTISPAM("antispam", "文本垃圾内容检测"); + + private String code; + private String desc; + + TextSceneEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getTextSceneList() { + List result = new ArrayList<>(); + TextSceneEnum[] values = TextSceneEnum.values(); + for (TextSceneEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java new file mode 100644 index 0000000000..864d137dd2 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java @@ -0,0 +1,50 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * desc:视频检测场景 + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 13:47 + **/ +public enum VideoSceneEnum { + PORN("porn", "视频智能鉴黄"), + TERRORISM("terrorism", "视频暴恐涉政"), + LIVE("live","视频不良场景"), + LOGO("logo","视频logo"), + AD("ad","视频图文违规"); + + private String code; + private String desc; + + VideoSceneEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getVideoSceneList() { + List result = new ArrayList<>(); + VideoSceneEnum[] values = VideoSceneEnum.values(); + for (VideoSceneEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java new file mode 100644 index 0000000000..777b92f0d7 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VoiceSceneEnum.java @@ -0,0 +1,47 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * 语音异步检测场景 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 10:12 + */ +public enum VoiceSceneEnum { + ANTISPAM("antispam", "检测场景,取值:antispam"); + + private String code; + private String desc; + + VoiceSceneEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getVoiceSceneList() { + List result = new ArrayList<>(); + VoiceSceneEnum[] values = VoiceSceneEnum.values(); + for (VoiceSceneEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java new file mode 100644 index 0000000000..a5694da79c --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java @@ -0,0 +1,29 @@ +package com.epmet.openapi.scan.common.exception; + +import com.epmet.openapi.scan.common.enu.SysResponseEnum; + +/** + * @author jianjun liu + * @date 2020-06-05 10:31 + **/ +public class ExecuteHttpException extends RuntimeException { + private int code; + private String msg; + + public ExecuteHttpException(String msg) { + this(SysResponseEnum.EXCEPTION.getCode(), msg); + } + + public ExecuteHttpException(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java new file mode 100644 index 0000000000..2939bd62eb --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/redis/RedisKeys.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

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

+ * 版权所有,侵权必究! + */ + +package com.epmet.openapi.scan.common.redis; + +/** + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public class RedisKeys { + + /** + * 党群e事通redis前缀 + */ + private static String rootPrefix = "epmet:"; + + /** + * desc:白名单Key + * @return + */ + public static String getWhiteList () { + return rootPrefix.concat("openapi:scan:whitelist"); + } + + /** + * desc: 语音检测任务,异步回调,需要根据taskId获取存储seed的Key + * @param taskId 提交检测任务API接口返回的taskId eg:1001 + * @return epmet:openapi:scan:voice:seed:1001 + */ + public static String getVoiceScanSeedKey(String taskId){ + return rootPrefix.concat("openapi:scan:voice:seed:").concat(taskId); + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java new file mode 100644 index 0000000000..7ca0302331 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java @@ -0,0 +1,171 @@ +package com.epmet.openapi.scan.common.util; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +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; +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.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.springframework.util.CollectionUtils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * desc: http 工具类 + * date: 2020/6/4 22:27 + * + * @author: jianjun liu + */ +@Slf4j +public class HttpClientManager { + private static int connectionTimeout = 3000;// 连接超时时间,毫秒 + private static int soTimeout = 10000;// 读取数据超时时间,毫秒 + /** + * HttpClient对象 + */ + private static CloseableHttpClient httpclient = HttpClients.custom().disableAutomaticRetries().build(); + + /*** 超时设置 ****/ + private static RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(soTimeout) + .setConnectTimeout(connectionTimeout) + .build();//设置请求和传输超时时间 + + public static HttpClientManager getInstance() { + return SingleClass.instance; + } + + private static class SingleClass { + private final static HttpClientManager instance = new HttpClientManager(); + } + + /** + * desc: 发送json post 请求 + * param: url,jsonStrParam + * return: Result + * date: 2019/2/21 9:12 + * + * @author: jianjun liu + */ + public Result sendPost(String url, Map paramsMap) { + + try { + HttpPost httppost = new HttpPost(url); + httppost.setConfig(requestConfig); + httppost.addHeader("Content-Type", "application/x-www-form-urlencoded charset=utf-8"); + + List list = new ArrayList(); + for (String key : paramsMap.keySet()) { + list.add(new BasicNameValuePair(key, String.valueOf(paramsMap.get(key)))); + } + UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(list, "utf-8"); + httppost.setEntity(urlEncodedFormEntity); + + return execute(httppost); + } catch (Exception e) { + e.printStackTrace(); + log.error("send exception", e); + return new Result().error(8000, e.getMessage()); + } + + } + + /** + * desc: 发送json post 请求 + * param: url,jsonStrParam + * return: Result + * date: 2019/2/21 9:12 + * + * @author: jianjun liu + */ + public Result sendPostByJSON(String url, String jsonStrParam) { + + try { + HttpPost httppost = new HttpPost(url); + httppost.setConfig(requestConfig); + httppost.addHeader("Content-Type", "application/json; charset=utf-8"); + if (StringUtils.isNotEmpty(jsonStrParam)) { + StringEntity se = new StringEntity(jsonStrParam, "utf-8"); + httppost.setEntity(se); + } + return execute(httppost); + } catch (Exception e) { + e.printStackTrace(); + log.error("send exception", e); + return new Result().error(8000, e.getMessage()); + } + + } + + /** + * desc: 发送get请求 + * param:url, params + * return: Result + * date: 2019/2/21 9:16 + * + * @author: jianjun liu + */ + public Result sendGet(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 execute(httpGet); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(8000, e.getMessage()); + } + } + + private Result execute(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) { + String result = EntityUtils.toString(response.getEntity()); + return new Result().ok(result); + } else { + log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); + } + } + } catch (Exception e) { + log.error("execute exception", e); + } finally { + httpMethod.releaseConnection(); + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + } + } + return new Result().error(8000, "系统异常"); + } +} + + diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java new file mode 100644 index 0000000000..c0c8362727 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java @@ -0,0 +1,67 @@ +package com.epmet.openapi.scan.common.util; + +/** + * @author jianjun liu + * @date 2020-06-05 10:03 + **/ + +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; +import com.epmet.openapi.scan.common.enu.RegionIdEnum; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; + +@Slf4j +@Component +public class IAcsClientUtil { + private static String accessKeyId; + private static String secret; + private static String product = "Green"; + + private static String regionId; + private static String endpointName = ""; + + private static IClientProfile profile; + + + @PostConstruct + private void initProFile() { + profile = DefaultProfile.getProfile(regionId, accessKeyId, secret); + try { + DefaultProfile.addEndpoint(endpointName, regionId, product, RegionIdEnum.getDoMain(regionId)); + } catch (ClientException e) { + log.error("initProFile exception", e.getMessage()); + } + } + + + public static IAcsClient getIAcsClient() { + return new DefaultAcsClient(profile); + } + + @Value("${aliyun.green.accessKeyId}") + public void setAccessKeyId(String accessKeyId) { + IAcsClientUtil.accessKeyId = accessKeyId; + } + + @Value("${aliyun.green.accessKeySecret}") + public void setSecret(String secret) { + IAcsClientUtil.secret = secret; + } + + @Value("${aliyun.green.regionId}") + public void setRegionId(String regionId) { + IAcsClientUtil.regionId = regionId; + } + + @Value("${aliyun.green.regionId}") + public void setEndpointName(String endpointName) { + IAcsClientUtil.endpointName = endpointName; + } +} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java new file mode 100644 index 0000000000..e98dbfd7a2 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java @@ -0,0 +1,55 @@ +package com.epmet.openapi.scan.common.util; + +import org.apache.commons.lang3.StringUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author jianjun liu + * @date 2020-06-05 16:44 + **/ +public class MapUtil { + /** + * 将url参数转换成map + * + * @param param aa=11&bb=22&cc=33 + * @return + */ + public static Map getUrlParams(String param) { + Map map = new HashMap<>(0); + if (StringUtils.isBlank(param)) { + return map; + } + String[] params = param.split("&"); + for (int i = 0; i < params.length; i++) { + String[] p = params[i].split("="); + if (p.length == 2) { + map.put(p[0], p[1]); + } + } + return map; + } + + /** + * 将map转换成url + * + * @param map + * @return + */ + public static String getUrlParamsByMap(Map map) { + if (map == null) { + return ""; + } + StringBuffer sb = new StringBuffer(); + for (Map.Entry entry : map.entrySet()) { + sb.append(entry.getKey() + "=" + entry.getValue()); + sb.append("&"); + } + String s = sb.toString(); + if (s.endsWith("&")) { + s = StringUtils.substringBeforeLast(s, "&"); + } + return s; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..68532b7819 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.openapi.scan.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "epmetscan"; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java new file mode 100644 index 0000000000..c955a7f555 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java @@ -0,0 +1,31 @@ +package com.epmet.openapi.scan.config; + +import com.epmet.openapi.scan.interceptor.ScanApiAuthInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-08 14:30 + **/ + + @Configuration + public class WebAppConfig implements WebMvcConfigurer{ + @Autowired + private ScanApiAuthInterceptor scanApiAuthInterceptor; + + // 多个拦截器组成一个拦截器链 + // addPathPatterns 用于添加拦截规则 + // excludePathPatterns 用户排除拦截 + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(scanApiAuthInterceptor)//添加拦截器 + .addPathPatterns("/**") //拦截所有请求 + .excludePathPatterns("/opback/**");//对应的不拦截的请求 + } + } + diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java new file mode 100644 index 0000000000..433ff1b06d --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java @@ -0,0 +1,32 @@ +package com.epmet.openapi.scan.controller; + +import com.alibaba.fastjson.JSON; +import com.epmet.openapi.scan.common.redis.RedisKeys; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.SetOperations; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Set; + +/** + * @author jianjun liu + * @date 2020-06-04 20:39 + **/ +@RestController +@RequestMapping("opback") +public class BackDoorController { + @Autowired + private RedisTemplate redisTemplate; + + @RequestMapping("addWhite") + public String addWhite(@RequestParam String ip) { + SetOperations setOperations = redisTemplate.opsForSet(); + String whiteList = RedisKeys.getWhiteList(); + Long add = setOperations.add(whiteList, ip); + Set members = setOperations.members(whiteList); + return "ip:" + ip + "添加" + (add > 0 ? "成功" : "失败") + ",当前所有列表:" + JSON.toJSONString(members); + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java new file mode 100644 index 0000000000..cee27d28b8 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java @@ -0,0 +1,116 @@ +package com.epmet.openapi.scan.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.openapi.scan.common.constant.SysConstant; +import com.epmet.openapi.scan.common.enu.SysResponseEnum; +import com.epmet.openapi.scan.service.impl.ScanService; +import com.epmet.openapi.scan.support.param.ImgScanParam; +import com.epmet.openapi.scan.support.param.TextScanParam; +import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; +import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; +import com.epmet.openapi.scan.support.result.SyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; +import com.epmet.openapi.scan.support.result.video.VideoAsyncScanTaskResultDTO; +import com.epmet.openapi.scan.support.result.video.VideoResultDTO; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-05 10:39 + **/ +@RestController +@RequestMapping("api") +public class ScanController { + + @Autowired + private ScanService scanService; + + /** + * desc:图片同步检测接口 + * + * @param param + * @return + */ + @RequestMapping("imgSyncScan") + public Result ImgSyncScan(@RequestBody ImgScanParam param) { + ValidatorUtils.validateEntity(param); + return scanService.sendSyncImgScan(param); + } + + /** + * desc:文本同步检测接口 + * + * @param param + * @return + */ + @RequestMapping("textSyncScan") + public Result textSyncScan(@RequestBody TextScanParam param) { + ValidatorUtils.validateEntity(param); + return scanService.sendTextScan(param); + } + + //@RequestMapping("imgAsyncScan") + public Result ImgAsyncScan(@RequestBody ImgScanParam param) { + return null;//scanService.sendASyncImgScan(param); + } + + + /** + * @description 语音异步检测 + * @Date 2020/12/9 9:14 + **/ + @PostMapping("voiceAsyncScan") + public Result voiceAsyncScan(@RequestBody VoiceAsyncScanParam param){ + ValidatorUtils.validateEntity(param); + return scanService.sendVoiceAsyncScan(param); + } + + /** + * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 + * @author yinzuomei + * @description 语音异步检测结果查询 + * @Date 2020/12/9 11:16 + **/ + @PostMapping("voiceResults") + public Result> voiceResults(@RequestBody List taskIds){ + return scanService.voiceResults(taskIds); + } + + /** + * @author yinzuomei + * @description 视频检测-异步检测 + **/ + @PostMapping("videoAsyncScan") + public Result videoAsyncScan(@RequestBody VideoAsyncScanParam param) { + ValidatorUtils.validateEntity(param); + return scanService.videoAsyncScan(param); + } + + /** + * @author yinzuomei + * @description 视频异步检测结果查询接口 + **/ + @PostMapping("videoResults") + public Result videoResults(@RequestBody List taskIds) { + if (CollectionUtils.isEmpty(taskIds)) { + return new Result<>(); + } + //检测对象不能为空,且最多支持100个元素 + if (org.springframework.util.CollectionUtils.isEmpty(taskIds) || taskIds.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())); + } + return scanService.videoResults(taskIds); + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java new file mode 100644 index 0000000000..6ce851a45e --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java @@ -0,0 +1,60 @@ +package com.epmet.openapi.scan.interceptor; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.utils.IpUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.openapi.scan.common.redis.RedisKeys; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; + +/** + * @author jianjun liu + * @date 2020-06-05 16:36 + **/ +@Component +public class ScanApiAuthInterceptor implements HandlerInterceptor { + private static final Logger log = LoggerFactory.getLogger(ScanApiAuthInterceptor.class); + @Autowired + private RedisTemplate redisTemplate; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + String ip = IpUtils.getIpAddr(request); + SetOperations setOperations = redisTemplate.opsForSet(); + if (!setOperations.isMember(RedisKeys.getWhiteList(), ip)) { + log.warn("preHandle ip:{} is not in whitelist", ip); + String result = JSON.toJSONString(new Result<>().error(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg())); + responseJson(response, result); + return false; + } + return true; + } + + private void responseJson(HttpServletResponse response, String json) throws Exception { + PrintWriter writer = null; + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/json; charset=utf-8"); + try { + writer = response.getWriter(); + writer.print(json); + } catch (IOException e) { + log.error(e.toString()); + } finally { + if (writer != null) { + writer.close(); + } + } + } + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java new file mode 100644 index 0000000000..4a3e734893 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java @@ -0,0 +1,69 @@ +package com.epmet.openapi.scan.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.openapi.scan.support.param.ImgScanParam; +import com.epmet.openapi.scan.support.param.TextScanParam; +import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; +import com.epmet.openapi.scan.support.result.SyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; +import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; +import com.epmet.openapi.scan.support.result.video.VideoAsyncScanTaskResultDTO; +import com.epmet.openapi.scan.support.result.video.VideoResultDTO; + +import java.util.List; + +/** + * desc:内容扫描接口 + * + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-05 13:12 + **/ +public interface ScanService { + /** + * desc:扫描文本内容 同步 + * @param textScanParam + * @return ImgAsyncScanResult + */ + public Result sendTextScan(TextScanParam textScanParam); + + + /** + * desc:扫描图片内容 同步 + * @param imgScanParam + * @return + */ + public Result sendSyncImgScan(ImgScanParam imgScanParam); + + /** + * 语音异步检测 + * + * @param param + * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult + */ + Result sendVoiceAsyncScan(VoiceAsyncScanParam param); + + /** + * 语音异步检测结果查询 + * + * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 + * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanResult + */ + Result> voiceResults(List taskIds); + + /** + * desc:视频检测-异步检测 + * @param videoAsyncScanParam + * @return 异步检测)返回数据:taskId<=>dataId + */ + Result videoAsyncScan(VideoAsyncScanParam videoAsyncScanParam); + + /** + * @param taskIds + * @author yinzuomei + * @description 视频异步检测结果查询接口 + * @Date 2020/12/29 16:10 + **/ + Result videoResults(List taskIds); +} 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 new file mode 100644 index 0000000000..44dd0da3de --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -0,0 +1,734 @@ +package com.epmet.openapi.scan.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.AcsRequest; +import com.aliyuncs.green.model.v20180509.*; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.aliyuncs.http.MethodType; +import com.epmet.commons.tools.utils.Result; +import com.epmet.openapi.scan.common.constant.SysConstant; +import com.epmet.openapi.scan.common.enu.*; +import com.epmet.openapi.scan.common.exception.ExecuteHttpException; +import com.epmet.openapi.scan.common.redis.RedisKeys; +import com.epmet.openapi.scan.common.util.IAcsClientUtil; +import com.epmet.openapi.scan.support.param.*; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanTask; +import com.epmet.openapi.scan.support.result.*; +import com.epmet.openapi.scan.support.result.video.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +/** + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-05 13:16 + **/ +@Slf4j +@Service +public class ScanServiceImpl implements ScanService { + @Value("${aliyun.green.regionId}") + private String regionId; + @Value("${aliyun.green.bizType}") + private String bizType; + @Autowired + private RedisTemplate redisTemplate; + @Override + public Result sendTextScan(TextScanParam textScanParam) { + //默认参数 + // 鉴黄 暴恐涉政 + textScanParam.setScenes(TextSceneEnum.getTextSceneList()); + textScanParam.setBizType(bizType); + + List textTasks = textScanParam.getTasks(); + 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 = 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()); + } + + try { + SyncScanResult textScanResult = executeSyncText(textScanRequest); + return new Result().ok(textScanResult); + } catch (ExecuteHttpException e) { + log.error("sendTextScan execute Exception", e); + return new Result().error(e.getCode(), e.getMsg()); + } + } + + 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) { + //默认参数 + // 鉴黄 暴恐涉政 + imgScanParam.setScenes(ImgSceneEnum.getImgSceneList()); + imgScanParam.setBizType(bizType); + + List imgTasks = imgScanParam.getTasks(); + 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) { + log.error("sendSyncImgScan parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + + try { + SyncScanResult scanResult = executeSyncImg(imageSyncScanRequest); + return new Result().ok(scanResult); + } catch (ExecuteHttpException e) { + log.error("sendImgScan execute exception,param:{},fail msg:{}", JSON.toJSONString(imgScanParam), e.getMsg()); + return new Result().error(e.getCode(), e.getMsg()); + } + } + + 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 { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(textScanRequest); + + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8)); + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + //任务 列表 + List scanTaskResults = scrResponse.getJSONArray(SysConstant.DATA).toJavaList(ScanTaskResult.class); + for (ScanTaskResult taskResult : scanTaskResults) { + result.getDetails().add(taskResult); + //又根据场景不同 + if (HttpStatus.SC_OK != taskResult.getCode()) { + if (!result.getFailDataIds().contains(taskResult.getDataId())) { + result.getFailDataIds().add(taskResult.getDataId()); + log.warn("executeSyncText task process fail:code:{},result:{}", taskResult.getCode(), JSON.toJSONString(taskResult)); + } + continue; + } + //如果是多个场景 则为对个 BaseScanResult + List sceneResults = taskResult.getResults(); + //是文本检测 目前就一种场景 + boolean isSuccess = true; + for (SceneDetailResult sceneResult : sceneResults) { + String suggestion = sceneResult.getSuggestion(); + if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { + isSuccess = false; + break; + } + } + if (isSuccess) { + result.getSuccessDataIds().add(taskResult.getDataId()); + } else { + log.warn("executeSyncText dataId:{} block:{}", taskResult.getDataId(), JSON.toJSONString(taskResult.getResults())); + result.getFailDataIds().add(taskResult.getDataId()); + } + } + return result; + } else { + log.warn("executeSyncText response not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } else { + log.warn("executeSyncText response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("executeSyncText exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + private SyncScanResult executeSyncImg(AcsRequest request) { + SyncScanResult result = new SyncScanResult(); + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request); + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8)); + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + JSONArray taskResults = scrResponse.getJSONArray(SysConstant.DATA); + List scanTaskResults = taskResults.toJavaList(ScanTaskResult.class); + for (ScanTaskResult taskResult : scanTaskResults) { + result.getDetails().add(taskResult); + if (HttpStatus.SC_OK != taskResult.getCode()) { + if (!result.getFailDataIds().contains(taskResult.getDataId())) { + result.getFailDataIds().add(taskResult.getDataId()); + log.warn("executeSyncImg detect not success. code:{},result:{}", taskResult.getCode(), JSON.toJSONString(taskResult)); + } + continue; + } + //如果是多个场景 则为对个 BaseScanResult + List sceneResults = taskResult.getResults(); + + boolean isSuccess = true; + for (SceneDetailResult sceneResult : sceneResults) { + String suggestion = sceneResult.getSuggestion(); + if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) { + isSuccess = false; + break; + } + } + if (isSuccess) { + result.getSuccessDataIds().add(taskResult.getDataId()); + } else { + log.warn("executeSyncImg dataId:{} block:{}", taskResult.getDataId(), JSON.toJSONString(taskResult.getResults())); + result.getFailDataIds().add(taskResult.getDataId()); + } + } + return result; + } else { + log.warn("executeSyncImg detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } else { + log.warn("executeSyncImg response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("executeSyncImg exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + /** + * @author yinzuomei + * @description 语音异步检测 + * @Date 2020/12/9 10:02 + */ + @Override + public Result sendVoiceAsyncScan(VoiceAsyncScanParam voiceAsyncScanParam) { + //检测对象不能为空,且最多支持100个元素 + List voiceTasks = voiceAsyncScanParam.getTasks(); + if (CollectionUtils.isEmpty(voiceTasks) || voiceTasks.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())); + } + + //默认参数 + voiceAsyncScanParam.setScenes(VoiceSceneEnum.getVoiceSceneList()); + voiceAsyncScanParam.setBizType(bizType); + // 如果是语音流检测,则修改为true。现在默认为音频文件检测false + voiceAsyncScanParam.setLive(false); + voiceAsyncScanParam.setSeed(UUID.randomUUID().toString().replace("-", "")); + + VoiceAsyncScanRequest voiceAsyncScanRequest=getVoiceAsyncScanRequest(); + + try { + voiceAsyncScanRequest.setHttpContent(JSON.toJSONString(voiceAsyncScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("sendVoiceAsyncScan parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + log.info("语音异步检测入参:"+JSON.toJSONString(voiceAsyncScanParam,true)); + List taskList; + try { + taskList = executeSyncVoice(voiceAsyncScanRequest); + log.info("语音异步检测返参taskList:"+JSON.toJSONString(taskList,true)); + } catch (ExecuteHttpException e) { + log.error("sendVoiceAsyncScan execute Exception", e); + return new Result().error(e.getCode(), e.getMsg()); + } + //成功返回 + VoiceAsyncScanTaskResult resultDto=new VoiceAsyncScanTaskResult(); + resultDto.setSeed(voiceAsyncScanParam.getSeed()); + List successList = new ArrayList<>(); + List failedList = new ArrayList<>(); + taskList.forEach(taskDetail -> { + if (HttpStatus.SC_OK == taskDetail.getCode()) { + successList.add(taskDetail); + } else { + failedList.add(taskDetail); + } + }); + resultDto.setSuccessTasks(successList); + resultDto.setFailTasks(failedList); + resultDto.setAllSuccess(resultDto.isAllSuccess()); + if (StringUtils.isNotBlank(voiceAsyncScanParam.getCallback())) { + // 存储seed和 任务id、dataId的关系 用于回调鉴权 + log.info("need to save seed and taskId、dataId的关系"); + ValueOperations valueOperations=redisTemplate.opsForValue(); + taskList.forEach(task -> { + String seedKey = RedisKeys.getVoiceScanSeedKey(task.getTaskId()); + valueOperations.set(seedKey,voiceAsyncScanParam.getSeed()); + }); + } + return new Result().ok(resultDto); + } + + /** + * @param + * @author yinzuomei + * @description 构造语音异步检测请求对象 + * @Date 2020/12/9 10:44 + **/ + private VoiceAsyncScanRequest getVoiceAsyncScanRequest() { + VoiceAsyncScanRequest voiceAsyncScanRequest = new VoiceAsyncScanRequest(); + // 指定api返回格式 + voiceAsyncScanRequest.setAcceptFormat(FormatType.JSON); + // 指定请求方法 + voiceAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); + voiceAsyncScanRequest.setEncoding(SysConstant.UTF8); + voiceAsyncScanRequest.setRegionId(regionId); + voiceAsyncScanRequest.setConnectTimeout(3000); + voiceAsyncScanRequest.setReadTimeout(6000); + return voiceAsyncScanRequest; + } + + /** + * @param voiceAsyncScanRequest + * @author yinzuomei + * @description 解析返参 + * @Date 2020/12/9 10:44 + **/ + private List executeSyncVoice(AcsRequest voiceAsyncScanRequest) { + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(voiceAsyncScanRequest); + + if (httpResponse.isSuccess()) { + + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + //后面注释掉此日志 + log.info("VoiceAsyncScanRequest原生接口返参:" + JSON.toJSONString(scrResponse, true)); + + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + + //获取data列表 + JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); + List resultList = dataResults.toJavaList(VoiceAsyncScanTaskDataDTO.class); + //成功返回 + return resultList; + + } else { + + log.warn("executeSyncVoice detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + + } else { + log.warn("executeSyncVoice response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + + } catch (Exception e) { + log.error("executeSyncVoice exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + + /** + * @param taskIds 要查询的异步检测任务的taskId列表。数组中的元素个数不超过100个 + * @author yinzuomei + * @description 语音异步检测结果查询 + * @Date 2020/12/9 11:17 + **/ + @Override + public Result> voiceResults(List taskIds) { + //检测对象不能为空,且最多支持100个元素 + if (CollectionUtils.isEmpty(taskIds) || taskIds.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())); + } + + VoiceAsyncScanResultsRequest request=getVoiceAsyncScanResultsRequest(); + try { + request.setHttpContent(JSON.toJSONString(taskIds).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("voiceResults parse param exception", e); + return new Result>().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + + // log.info("语音异步检测结果查询入参:"+JSON.toJSONString(taskIds,true)); + + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request); + if (httpResponse.isSuccess()) { + + JSONObject scrResponse=JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + //后面注释掉此返参 + log.info("VoiceAsyncScanResultsRequest原生接口返参:"+JSON.toJSONString(scrResponse, true)); + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + //获取data列表 + JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); + List resultList = dataResults.toJavaList(VoiceAsyncScanResult.class); + List resultData=processVoiceAsyncScanResult(resultList); + //成功返回 + return new Result>().ok(resultData); + + }else{ + + log.warn("voiceResults detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + + } else { + log.warn("语音异步检测结果查询预警 getVoiceAsyncScanResult response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("voiceResults exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + + } + + private List processVoiceAsyncScanResult(List resultList) { + List list = new ArrayList<>(); + for (VoiceAsyncScanResult voiceAsyncScanResult : resultList) { + if (SysConstant.PROCESSING == voiceAsyncScanResult.getCode()) { + //280:表示处理中,需要继续轮询 + continue; + } + VoiceAsyncScanResult dto = ConvertUtils.sourceToTarget(voiceAsyncScanResult, VoiceAsyncScanResult.class); + if (HttpStatus.SC_OK == voiceAsyncScanResult.getCode()) { + if (!CollectionUtils.isEmpty(voiceAsyncScanResult.getResults()) && voiceAsyncScanResult.getResults().size() > NumConstant.ZERO) { + //目前只有一个检测场景,所以只判断返回来的第一个场景 + VoiceAsyncScanResultDTO voiceAsyncScanResultDTO = voiceAsyncScanResult.getResults().get(NumConstant.ZERO); + if (null != voiceAsyncScanResultDTO) { + dto.setLabel(voiceAsyncScanResultDTO.getLabel()); + dto.setLabelDesc(LabelEnum.getDesc(voiceAsyncScanResultDTO.getLabel())); + dto.setSuggestion(voiceAsyncScanResultDTO.getSuggestion()); + } + } + } else if(HttpStatus.SC_NOT_FOUND == voiceAsyncScanResult.getCode()) { + dto.setSuggestion(SuggestionEnum.REVIEW.getCode()); + dto.setLabel(NumConstant.EMPTY_STR); + dto.setLabelDesc("智能检测任务失败,结果已失效," + SuggestionEnum.REVIEW.getDesc()); + }else{ + //其他:表示任务失败 + dto.setSuggestion(SuggestionEnum.REVIEW.getCode()); + dto.setLabel(NumConstant.EMPTY_STR); + dto.setLabelDesc("智能检测任务失败," + SuggestionEnum.REVIEW.getDesc()); + } + list.add(dto); + } + return list; + } + + private VoiceAsyncScanResultsRequest getVoiceAsyncScanResultsRequest(){ + VoiceAsyncScanResultsRequest getResultsRequest = new VoiceAsyncScanResultsRequest(); + // 指定API返回格式。 + getResultsRequest.setAcceptFormat(FormatType.JSON); + // 指定请求方法。 + getResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); + getResultsRequest.setEncoding(SysConstant.UTF8); + getResultsRequest.setRegionId(regionId); + /** + * 请务必设置超时时间。 + */ + getResultsRequest.setConnectTimeout(3000); + getResultsRequest.setReadTimeout(6000); + return getResultsRequest; + } + + /** + * desc:视频检测-异步检测 + * + * @param videoAsyncScanParam + * @return + */ + @Override + public Result videoAsyncScan(VideoAsyncScanParam videoAsyncScanParam) { + //一次至多提交100个检测对象 + List videoTasks = videoAsyncScanParam.getTasks(); + if (CollectionUtils.isEmpty(videoTasks) || videoTasks.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())); + } + //默认参数赋值 + videoAsyncScanParam.setScenes(VideoSceneEnum.getVideoSceneList()); + videoAsyncScanParam.setBizType(bizType); + videoAsyncScanParam.setAudioScenes(VoiceSceneEnum.getVoiceSceneList()); + videoAsyncScanParam.setSeed(UUID.randomUUID().toString().replace("-", "")); + //API文档没写限制多少最大多少,应该与图片一致 + if (videoTasks.size() <= SysConstant.MAX_SCAN_IMG_TASK_SIZE) { + return doScanVideo(videoAsyncScanParam); + } + log.info("videoAsyncScan tasks size:{} over 10", videoTasks.size()); + //分组调用,一次提交10个 + List> partition = ListUtils.partition(videoTasks, SysConstant.MAX_SCAN_IMG_TASK_SIZE); + VideoAsyncScanTaskResultDTO finalResult = new VideoAsyncScanTaskResultDTO(); + for (List tasks : partition) { + VideoAsyncScanParam videParam = new VideoAsyncScanParam(); + videParam.setBizType(videoAsyncScanParam.getBizType()); + videParam.setScenes(videoAsyncScanParam.getScenes()); + videParam.setTasks(tasks); + videParam.setCallback(videoAsyncScanParam.getCallback()); + videParam.setSeed(videoAsyncScanParam.getSeed()); + videParam.setAudioScenes(videoAsyncScanParam.getAudioScenes()); + Result partResult = doScanVideo(videParam); + try { + Thread.sleep(5L); + } catch (InterruptedException e) { + log.error("videoAsyncScan InterruptedException"); + } + if (partResult.success()) { + VideoAsyncScanTaskResultDTO data = partResult.getData(); + finalResult.setSeed(data.getSeed()); + finalResult.getSuccessTasks().addAll(data.getSuccessTasks()); + finalResult.getFailTasks().addAll(data.getFailTasks()); + } else { + return partResult; + } + } + return new Result().ok(finalResult); + } + + private Result doScanVideo(VideoAsyncScanParam videoAsyncScanParam) { + VideoAsyncScanRequest videoAsyncScanRequest = getVideoAsyncScanRequest(); + try { + videoAsyncScanRequest.setHttpContent(JSON.toJSONString(videoAsyncScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("doScanVideo parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + + try { + VideoAsyncScanTaskResultDTO scanResult = executeAsyncVideo(videoAsyncScanRequest); + scanResult.setSeed(videoAsyncScanParam.getSeed()); + return new Result().ok(scanResult); + } catch (ExecuteHttpException e) { + log.error("doScanVideo execute exception,param:{},fail msg:{}", JSON.toJSONString(videoAsyncScanParam), e.getMsg()); + return new Result().error(e.getCode(), e.getMsg()); + } + } + + private VideoAsyncScanRequest getVideoAsyncScanRequest() { + VideoAsyncScanRequest videoAsyncScanRequest = new VideoAsyncScanRequest(); + videoAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 + videoAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 + /** + * 请务必设置超时时间。 + */ + videoAsyncScanRequest.setConnectTimeout(3000); + videoAsyncScanRequest.setReadTimeout(6000); + return videoAsyncScanRequest; + } + + private VideoAsyncScanTaskResultDTO executeAsyncVideo(VideoAsyncScanRequest videoAsyncScanRequest) { + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(videoAsyncScanRequest); + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + //获取data列表 + JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); + List dataList = dataResults.toJavaList(VideoAsyncScanTaskDataDTO.class); + VideoAsyncScanTaskResultDTO result=new VideoAsyncScanTaskResultDTO(); + dataList.forEach(data->{ + if (HttpStatus.SC_OK == data.getCode()) { + result.getSuccessTasks().add(data); + } else { + result.getFailTasks().add(data); + } + }); + return result; + } else { + log.warn("executeAsyncVideo detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } else { + log.warn("executeAsyncVideo response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("executeAsyncVideo exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + /** + * @param taskIds + * @author yinzuomei + * @description 视频异步检测结果查询接口 + * @Date 2020/12/29 16:10 + **/ + @Override + public Result videoResults(List taskIds) { + VideoAsyncScanResultsRequest videoAsyncScanResultsRequest = new VideoAsyncScanResultsRequest(); + videoAsyncScanResultsRequest.setAcceptFormat(FormatType.JSON); + videoAsyncScanResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); + videoAsyncScanResultsRequest.setConnectTimeout(3000); + videoAsyncScanResultsRequest.setReadTimeout(6000); + try { + videoAsyncScanResultsRequest.setHttpContent(JSON.toJSONString(taskIds).getBytes("UTF-8"), "UTF-8", FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("videoResults parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(videoAsyncScanResultsRequest); + if (httpResponse.isSuccess()) { + JSONObject responseObject = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + log.info("查询视频检测结果返参"+JSON.toJSONString(responseObject)); + if (HttpStatus.SC_OK == responseObject.getInteger(SysConstant.CODE)) { + //获取data列表 + JSONArray dataResults = responseObject.getJSONArray(SysConstant.DATA); + List resultList = dataResults.toJavaList(VideoScanOriginalResultDTO.class); + //解析数据 + VideoResultDTO resultDTO = processVideoResults(resultList); + //成功返回 + return new Result().ok(resultDTO); + } else { + log.warn("查询视频检测结果,接口返回code=" + responseObject.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } else { + log.warn("查询视频检测结果,API返回失败"); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("videoResults exception ", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + /** + * @author yinzuomei + * @description + **/ + private VideoResultDTO processVideoResults(List resultList) { + VideoResultDTO videoResultDTO = new VideoResultDTO(); + resultList.forEach(result -> { + result.setCodeDesc(CommonErrorCodeEnum.getErrorMsg(result.getCode())); + if (result.getCode().equals(CommonErrorCodeEnum.PROCESSING.getCode())) { + //任务正在检测中,继续轮询 + } else if (result.getCode().equals(CommonErrorCodeEnum.OK.getCode())) { + //成功=>分析结果 + boolean videoPassFlag = getVideoFlag(result.getResults()); + boolean voicePassFlag = getVoiceFlag(result.getAudioScanResults()); + if (videoPassFlag && voicePassFlag) { + videoResultDTO.getPassDataIds().add(result.getDataId()); + videoResultDTO.getPassTaskIds().add(result.getTaskId()); + } else { + videoResultDTO.getNoPassDataIds().add(result.getDataId()); + videoResultDTO.getNoPassTaskIds().add(result.getTaskId()); + } + } else { + //检测结果走丢了.... (*^▽^*) 默认失败 + videoResultDTO.getNoPassDataIds().add(result.getDataId()); + videoResultDTO.getNoPassTaskIds().add(result.getTaskId()); + } + }); + videoResultDTO.setDetails(resultList); + return videoResultDTO; + } + + /** + * @return boolean + * @author yinzuomei + * @description 视频检测结果判断 + **/ + private boolean getVideoFlag(List results) { + for(VideoScanOriginDetail videoRes:results){ + if (!SuggestionEnum.PASS.getCode().equals(videoRes.getSuggestion())) { + return false; + } + } + return true; + } + + /** + * @return boolean true:内容通过; 建议为内容违规或者需要人工审核的统一视为不通过,返回false + * @author yinzuomei + * @description 返回视频语音检测结果 + **/ + private boolean getVoiceFlag(List audioScanResults) { + if (CollectionUtils.isEmpty(audioScanResults)) { + return true; + } + for(VoiceAsyncScanResultDTO m:audioScanResults){ + //人工审核或者内容违规,统一视为不通过 + if (!SuggestionEnum.PASS.getCode().equals(m.getSuggestion())) { + return false; + } + } + return true; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java new file mode 100644 index 0000000000..82036797e3 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java @@ -0,0 +1,48 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 审查参数 + * + * @author jianjun liu + * @date 2020-06-04 21:57 + **/ +@Data +public class ImgScanParam implements Serializable { + + private static final long serialVersionUID = 958801658335909745L; + /** + * 业务类型 + */ + private String bizType; + /** + * 场景 必填 + * + * @see com.epmet.openapi.scan.common.enu.ImgSceneEnum; + */ + private List scenes; + + /** + * 要检测的内容列表,必填 + * remark:一组任务列表中的taskId不能相同 + */ + @Valid + @NotEmpty(message = "任务列表不能为空") + private List tasks; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + */ + private String callback; + + /** + * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 + */ + private String seed; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java new file mode 100644 index 0000000000..487485b7fc --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java @@ -0,0 +1,31 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 任务参数 + * + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-04 22:13 + **/ +@Data +public class ImgTask implements Serializable { + + private static final long serialVersionUID = -747206284930578105L; + /** + * 要检测的数据id 非必填 + * + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 图片url 必填 + */ + @NotBlank(message = "图片URL不能为空") + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java new file mode 100644 index 0000000000..2b05d34e20 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java @@ -0,0 +1,48 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 文本审查参数 + * + * @author jianjun liu + * @date 2020-06-05 11:17 + **/ +@Data +public class TextScanParam implements Serializable { + private static final long serialVersionUID = -3568903097975113166L; + + /** + * 业务类型 + */ + private String bizType; + /** + * 场景 必填 + * + * @see com.epmet.openapi.scan.common.enu.ImgSceneEnum; + */ + private List scenes; + + /** + * 要检测的内容列表,必填 + * remark:一组任务列表中的taskId不能相同 + */ + @Valid + @NotEmpty(message = "任务列表不能为空") + private List tasks; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + */ + private String callback; + + /** + * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 + */ + private String seed; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java new file mode 100644 index 0000000000..08215e3e5b --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java @@ -0,0 +1,33 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 任务参数 + * + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-04 22:13 + **/ +@Data +public class TextTask implements Serializable { + + private static final long serialVersionUID = 6957195274696018630L; + /** + * 要检测的数据id 非必填 + * + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 文本内容 必填 最多不能超过10000 + */ + @NotBlank(message = "待检测文本不能为空") + @Length(max = 10000,message = "待检测文本最大为10000") + private String content; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java new file mode 100644 index 0000000000..baa8e51be0 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceAsyncScanParam.java @@ -0,0 +1,68 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 音频审查 入参 + * 参考文档:https://help.aliyun.com/document_detail/89630.html?spm=a2c4g.11186623.2.12.51a32dbfW6AdqV#reference-bcf-3nk-z2b + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 9:07 + */ +@Data +public class VoiceAsyncScanParam implements Serializable { + private static final long serialVersionUID = 3408043673247901184L; + + /** + * 是否开启回调 + */ + private Boolean openCallBack; + + /** + * 不必填 + * 该字段用于标识您的业务场景。您可以通过内容安全控制台创建业务场景(具体操作,请参见自定义机审标准),或者提交工单联系我们帮助您创建业务场景。 + */ + private String bizType; + + /** + * 必填 + * 检测场景,取值:antispam。 + */ + private List scenes; + + /** + * 不必填 + * 是否为语音流(例如直播流)检测。取值: + * true:表示语音流检测。 + * false(默认):表示音频文件检测。 + */ + private Boolean live; + + /** + * 不必填 + * 是否为近线检测模式。 取值: + * true:表示近线检测模式。近线检测模式下,您提交的任务不保证能够实时处理,但是可以排队并在24小时内开始检测。 + * false(默认):表示实时检测模式。对于超过了并发路数限制的检测请求会直接拒绝。 + * 说明 该参数仅适用于音频文件检测,不适用于语音流检测。 + */ + private Boolean offline; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + */ + private String callback; + + /** + * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 + */ + private String seed; + + @Valid + @NotEmpty(message = "任务列表不能为空") + private List tasks; + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java new file mode 100644 index 0000000000..89f4333bba --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/VoiceTask.java @@ -0,0 +1,31 @@ +package com.epmet.openapi.scan.support.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 语音异步检测 对象 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 10:16 + */ +@Data +public class VoiceTask implements Serializable { + /** + * 不必填 + * 要检测的数据id 非必填 + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 必填 + * 需要检测的音频文件或语音流的下载地址。 + */ + @NotBlank(message = "音频URL不能为空") + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java new file mode 100644 index 0000000000..c0315f8c17 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java @@ -0,0 +1,76 @@ +package com.epmet.openapi.scan.support.param.video; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 视频审核-异步检测入参DTO + * + * @author yinzuomei@elink-cn.com + */ +@Data +public class VideoAsyncScanParam implements Serializable { + private static final long serialVersionUID = -7635290200099445362L; + + /** + * 是否开启回调 + */ + private Boolean openCallBack; + + /** + * 不必填 + * 该字段用于标识您的业务场景。您可以通过内容安全控制台创建业务场景(具体操作,请参见自定义机审标准),或者提交工单联系我们帮助您创建业务场景。 + */ + private String bizType; + + /** + * 不必填 + * 是否为语音流(例如直播流)检测。取值: + * true:表示语音流检测。 + * false(默认):表示音频文件检测。 + */ + private Boolean live; + + /** + * 不必填 + * 是否为近线检测模式。 取值: + * true:表示近线检测模式。近线检测模式下,您提交的任务不保证能够实时处理,但是可以排队并在24小时内开始检测。 + * false(默认):表示实时检测模式。对于超过了并发路数限制的检测请求会直接拒绝。 + * 说明 该参数仅适用于音频文件检测,不适用于语音流检测。 + */ + private Boolean offline; + + /** + * 必填 + * 指定视频检测场景。取值: + * porn:视频智能鉴黄 + * terrorism:视频暴恐涉政 + * live:视频不良场景 + * logo:视频logo + * ad:视频图文违规 + */ + private List scenes; + + /** + * 不必填 + * 指定视频语音检测场景,唯一取值:antispam,表示语音反垃圾。不传入该参数时仅检测视频图像内容;如果传入该参数,则在检测视频中图像的同时,对视频中语音进行检测。 + * 说明 如果需要检测视频语音,则不支持通过上传视频截帧序列的方式(即在task中传入frames)进行检测,您必须传入视频或视频流的URL地址(即在task中传入url)进行检测。 + */ + private List audioScenes; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + */ + private String callback; + + /** + * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 + */ + private String seed; + + @NotEmpty(message = "检测对象不能为空") + private List tasks; +} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java new file mode 100644 index 0000000000..38a4584d94 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java @@ -0,0 +1,30 @@ +package com.epmet.openapi.scan.support.param.video; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 视频审核-异步检测入参-检测对象 + * + * @author yinzuomei@elink-cn.com + */ +@Data +public class VideoAsyncScanTask implements Serializable { + /** + * 建议必填 + * 要检测的数据id 非必填 + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 必填 + * 待检测视频的URL。该字段不能和frames同时为空,也不能和frames同时有值。 + */ + @NotBlank(message = "音频URL不能为空") + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java new file mode 100644 index 0000000000..d988cf7a88 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java @@ -0,0 +1,24 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.util.List; + +/** + * 检测结果 + * + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-05 10:52 + **/ +@Data +public class ImgAsyncScanResult { + /** + * 执行成功的任务Id集合 + */ + private List successTaskIds; + /** + * 执行失败的任务Id集合 + */ + private List failTaskIds; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java new file mode 100644 index 0000000000..d358a570fa --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java @@ -0,0 +1,28 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * desc:文本检测返回结果 + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-05 14:24 + **/ +@Data +public class ScanTaskResult implements Serializable { + + private static final long serialVersionUID = -7905091710384256911L; + private Integer code; + + + private String msg; + + + private String dataId; + + + private List results; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java new file mode 100644 index 0000000000..4023153d10 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SceneDetailResult.java @@ -0,0 +1,31 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +/** + * desc:场景扫描结果 + * @author jianjun liu + * @date 2020-06-05 14:24 + **/ +@Data +public class SceneDetailResult { + /** + * 结果为该分类的概率 + */ + private Double rate; + + /** + * 建议用户执行的操作 + */ + private String suggestion; + + /** + * 场景 + */ + private String scene; + + /** + * 标签 + */ + private String label; +} 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 new file mode 100644 index 0000000000..8dcb757f64 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java @@ -0,0 +1,42 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 检测结果 + * + * @author jianjun liu + * @date 2020-06-05 10:52 + **/ +@Data +public class SyncScanResult implements Serializable { + /** + * 执行成功的任务Id集合 + */ + private List successDataIds = new ArrayList<>(); + /** + * 执行失败的任务Id集合 + */ + private List failDataIds = new ArrayList<>(); + + /** + * desc:检测详情 + */ + private List details = new ArrayList<>(); + + /** + * 本地是否全部通过 + */ + private boolean isAllPass; + + public boolean isAllPass() { + if (failDataIds.isEmpty() && !successDataIds.isEmpty()) { + return true; + } + return isAllPass; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java new file mode 100644 index 0000000000..7e74caf5a6 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanDetailDTO.java @@ -0,0 +1,47 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 语音异步检测结果查询结果返参 -data-result-detail详情 + * 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 11:11 + */ +@Data +public class VoiceAsyncScanDetailDTO implements Serializable { + private static final long serialVersionUID = -2664219492371705160L; + /** + * 句子开始的时间,单位:秒。 + */ + private Integer startTime; + + /** + * 句子结束的时间,单位:秒。 + */ + private Integer endTime; + + /** + * 语音转换成文本的结果。 + */ + private String text; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java new file mode 100644 index 0000000000..1cbf3dab4a --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResult.java @@ -0,0 +1,89 @@ +package com.epmet.openapi.scan.support.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 语音异步检测结果查询结果返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 10:56 + */ +@Data +public class VoiceAsyncScanResult implements Serializable { + private static final long serialVersionUID = 8702129292884498023L; + + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; + + /** + * labelDesc是对label的说明,包含两种特殊说明: + * (1)如果检测任务失败labelDesc:智能检测任务失败,结果已失效,需要人工审核 + * (2)如果检测结果失效labelDesc:智能检测任务失败,需要人工审核 + */ + private String labelDesc; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; + + + /** + * 错误码,和HTTP状态码一致。 + * 200:表示检测成功。 + * 280:表示处理中,需要继续轮询。 + * 其他:表示任务失败。 + * 更多信息,请参见公共错误码。 + */ + @JsonIgnore + private Integer code; + /** + * 错误描述信息。 + */ + @JsonIgnore + private String msg; + + /** + * 暂时没用,所以返回忽略 + */ + @JsonIgnore + private String url; + + /** + * 检测成功(code=200)时,返回的检测结果。该结果包含一个或多个元素,每个元素是个结构体,对应一个场景。关于每个元素的结构描述,请参见result。 + * 暂时不展示审核结果明细 + */ + @JsonIgnore + private List results; + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java new file mode 100644 index 0000000000..34f3280a6f --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 语音异步检测结果查询结果返参 -data-result详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 11:07 + */ +@Data +public class VoiceAsyncScanResultDTO implements Serializable { + private static final long serialVersionUID = 4602226363259983753L; + /** + * 检测场景,和调用请求中的场景对应。取值:antispam。 + */ + private String scene; + + /** + * 检测结果的分类。取值: + * normal:正常文本 + * spam:含垃圾信息 + * ad:广告 + * politics:涉政 + * terrorism:暴恐 + * abuse:辱骂 + * porn:色情 + * flood:灌水 + * contraband:违禁 + * meaningless:无意义 + * customized:自定义(例如命中自定义关键词) + */ + private String label; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; + + /** + * 置信度分数,取值范围:0(表示置信度最低)~100(表示置信度最高)。 + * 如果suggestion为pass,则置信度越高,表示内容正常的可能性越高;如果suggestion为review或block,则置信度越高,表示内容违规的可能性越高。 + * 注意 该值仅作为参考,强烈建议您不要在业务中使用。建议您参考suggestion和label(或者部分接口返回的sublabel)结果用于内容违规判定。 + */ + private Float rate; + + /** + * 语音对应的文本详情。每一句文本对应一个元素,包含一个或者多个元素。关于每个元素的结构描述, + */ + private List details; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java new file mode 100644 index 0000000000..ce43fec932 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskDataDTO.java @@ -0,0 +1,40 @@ +package com.epmet.openapi.scan.support.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * 语音异步检测,返回检测对象列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 16:38 + */ +@Data +public class VoiceAsyncScanTaskDataDTO implements Serializable { + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 暂时没用,所以返回忽略 + */ + @JsonIgnore + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java new file mode 100644 index 0000000000..2dcbecc398 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/VoiceAsyncScanTaskResult.java @@ -0,0 +1,46 @@ +package com.epmet.openapi.scan.support.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 语音异步检测,返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/9 9:23 + */ +@Data +public class VoiceAsyncScanTaskResult implements Serializable { + private static final long serialVersionUID = 8702129292884498023L; + /** + * 随机字符串,该值用于回调通知请求中的签名。 + */ + private String seed; + + /** + * 提交成功的失败对象 + */ + private List successTasks=new ArrayList<>(); + + /** + * 提交失败的检测对象 + */ + private List failTasks=new ArrayList<>(); + + /** + * 是否全部提交成功 + */ + private boolean isAllSuccess; + + public boolean isAllSuccess() { + if (failTasks.isEmpty() && !successTasks.isEmpty()) { + return true; + } + return isAllSuccess; + } + + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java new file mode 100644 index 0000000000..1d559a31cd --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java @@ -0,0 +1,41 @@ +package com.epmet.openapi.scan.support.result.video; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * 视频审核-异步检测任务提交返参详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 13:42 + */ +@Data +public class VideoAsyncScanTaskDataDTO implements Serializable { + private static final long serialVersionUID = 8430710131685814181L; + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 暂时没用,所以返回忽略 + */ + @JsonIgnore + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java new file mode 100644 index 0000000000..75ecd6e84f --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.openapi.scan.support.result.video; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 视频审核-异步检测任务提交返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 13:38 + */ +@Data +public class VideoAsyncScanTaskResultDTO implements Serializable { + private static final long serialVersionUID = -467990806428860191L; + + /** + * 随机字符串,该值用于回调通知请求中的签名。 + */ + private String seed; + + /** + * 提交成功的失败对象 + */ + private List successTasks=new ArrayList<>(); + + /** + * 提交失败的检测对象 + */ + private List failTasks=new ArrayList<>(); + + /** + * 是否全部提交成功 + */ + private Boolean isAllSuccess; + + public boolean isAllSuccess() { + if (failTasks.isEmpty() && !successTasks.isEmpty()) { + return true; + } + return isAllSuccess; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java new file mode 100644 index 0000000000..0e781bf463 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.openapi.scan.support.result.video; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 视频异步检测结果查询接口返参 + * 正在检测中的不返回,调用方继续轮询查询结果 + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 15:37 + */ +@Data +public class VideoResultDTO implements Serializable { + private static final long serialVersionUID = -3451342817149956488L; + + /** + * 执行成功的任务Id集合 + * code=200,且所有语音+视频所有场景返回结果都为pass时则为成功 + */ + private List passDataIds = new ArrayList<>(); + /** + * 执行失败的任务Id集合 + */ + private List noPassDataIds = new ArrayList<>(); + + private List passTaskIds = new ArrayList<>(); + private List noPassTaskIds = new ArrayList<>(); + + /** + * desc:阿里内容审核API返回结果详情 + */ + private List details = new ArrayList<>(); + + /** + * 本地是否全部通过 + */ + private Boolean isAllPass; + + public boolean isAllPass() { + if (noPassTaskIds.isEmpty() && !passTaskIds.isEmpty()) { + return true; + } + return isAllPass; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java new file mode 100644 index 0000000000..78916c1fe6 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java @@ -0,0 +1,53 @@ +package com.epmet.openapi.scan.support.result.video; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 视频异步检测结果查询接口原生返参-视频检测结果 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 16:39 + */ +@Data +public class VideoScanOriginDetail implements Serializable { + private static final long serialVersionUID = 5547706236158849091L; + /** + * 视频检测场景,和调用请求中的场景对应。取值: + * porn:视频智能鉴黄 + * terrorism:视频暴恐涉政 + * live:视频不良场景 + * logo:视频logo + * ad:视频图文违规 + */ + private String scene; + + /** + * 视频检测结果的分类。不同检测场景的结果分类不同,具体如下: + * 视频智能鉴黄(porn)结果分类: + * normal:正常 + * porn:色情 + * 视频暴恐涉政(terrorism)结果分类: + * normal:正常 + * terrorism:暴恐涉政 + * 视频不良场景(live)结果分类: + * normal:正常 + * live:包含不良场景 + * 视频logo(logo)结果分类: + * normal:正常 + * logo:包含logo + * 视频图文违规(ad)结果分类: + * normal:正常 + * ad:包含广告或文字违规信息 + */ + private String label; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java new file mode 100644 index 0000000000..8964d5fe00 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.openapi.scan.support.result.video; + +import com.epmet.openapi.scan.support.result.VoiceAsyncScanResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 视频异步检测结果查询接口原生返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 15:48 + */ +@Data +public class VideoScanOriginalResultDTO implements Serializable { + private static final long serialVersionUID = -1565008507757551616L; + + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + + private String codeDesc; + + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 返回结果,调用成功时(code=200),返回结果中包含一个或多个元素。每个元素是个结构体,具体结构描述,请参见result。 + * 说明 视频流检测场景中,code返回280表示在检测中,返回200表示检测完成。在检测中状态时,检测结果中包含从开始检测到当前时间的检测到结果。 + */ + private List results; + + /** + * 视频语音检测结果。具体结构描述,请参见audioScanResult。 + */ + private List audioScanResults; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..0aa0583c97 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml @@ -0,0 +1,91 @@ +server: + port: @server.port@ + version: @version@ + servlet: + context-path: /epmetscan + +spring: + main: + allow-bean-definition-overriding: true + application: + name: epmet-openapi-scan + #环境 dev|test|prod + profiles: + active: @spring.profiles.active@ + messages: + encoding: UTF-8 + basename: i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + okhttp: + enabled: true + + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + +aliyun: + green: + accessKeyId: LTAI4G6Fv6uTzQbpsayATHq4 + accessKeySecret: QevMw1RYCwQUG3RSMPq1J6EAfmSblo + regionId: cn-shanghai + bizType: epmet_img_text + +dingTalk: + robot: + webHook: @dingTalk.robot.webHook@ + secret: @dingTalk.robot.secret@ + +# 停机选项 +shutdown: + graceful: + enable: true #是否开启优雅停机 + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 + diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml b/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..9d2ad51e14 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + ${appname} + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + ${webHook} + ${secret} + ${appname} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/readme b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme new file mode 100644 index 0000000000..384fca6dfc --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme @@ -0,0 +1,7 @@ +#访问openApi 需要向redis中 添加白名单 +sadd epmet:openapi:scan:whitelist "客户端ip地址" +#eg: +sadd epmet:openapi:scan:whitelist "\"192.168.1.1\"" + +#del +srem 'epmet:openapi:scan:whitelist' "\"116.179.32.197\"" "\"27.219.156.47\"" \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java new file mode 100644 index 0000000000..8c0774030d --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java @@ -0,0 +1,50 @@ +import java.io.IOException; +import java.util.Properties; + +/** + * Created by liuhai.lh on 17/01/12. + */ +public class BaseSample { + + protected static String accessKeyId = "123"; + protected static String accessKeySecret = "456"; + + protected static String regionId = "cn-shanghai"; + + static { + Properties properties = new Properties(); + + try { + properties.load(BaseSample.class.getResourceAsStream("bootstrap.yml")); + accessKeyId = properties.getProperty("aliyun.green.accessKeyId"); + accessKeySecret = properties.getProperty("aliyun.green.accessKeySecret"); + regionId = properties.getProperty("aliyun.green.url"); + } catch(IOException e) { + e.printStackTrace(); + } + + } + protected static String getDomain(){ + if("cn-shanghai".equals(regionId)){ + return "green.cn-shanghai.aliyuncs.com"; + } + + if ("cn-beijing".equals(regionId)) { + return "green.cn-beijing.aliyuncs.com"; + } + + if ("ap-southeast-1".equals(regionId)) { + return "green.ap-southeast-1.aliyuncs.com"; + } + + if ("us-west-1".equals(regionId)) { + return "green.us-west-1.aliyuncs.com"; + } + + return "green.cn-shanghai.aliyuncs.com"; + } + protected static String getEndPointName(){ + return regionId; + } + +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java new file mode 100644 index 0000000000..acba42e763 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java @@ -0,0 +1,95 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.exceptions.ServerException; +import com.aliyuncs.green.model.v20180509.ImageAsyncScanRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; +import com.epmet.openapi.scan.common.enu.RegionIdEnum; + +import java.util.*; + +/** + * Created by liuhai.lh on 2017/2/17. + * 图片异步检测接口 + * @author liuhai.lh + * @date 2017/02/17 + */ +public class ImageAsyncScanRequestSample extends BaseSample{ + + public static void main(String[] args) throws Exception { + //请替换成你自己的accessKeyId、accessKeySecret + IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); + DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", RegionIdEnum.getDoMain(regionId)); + IAcsClient client = new DefaultAcsClient(profile); + + ImageAsyncScanRequest imageAsyncScanRequest = new ImageAsyncScanRequest(); + imageAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + imageAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + imageAsyncScanRequest.setEncoding("utf-8"); + imageAsyncScanRequest.setRegionId(regionId); + + + List> tasks = new ArrayList>(); + Map task1 = new LinkedHashMap(); + task1.put("dataId", UUID.randomUUID().toString()); + task1.put("url", "https://img.alicdn.com/tfs/TB1Xk_qvwmTBuNjy1XbXXaMrVXa-550-407.jpg"); + task1.put("time", new Date()); + + tasks.add(task1); + JSONObject data = new JSONObject(); + /** + * porn: 色情 + * terrorism: 暴恐 + * qrcode: 二维码 + * ad: 图片广告 + * ocr: 文字识别 + */ + data.put("scenes", Arrays.asList("porn", "ocr", "qrcode", "sface")); + data.put("tasks", tasks); + + imageAsyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); + + /** + * 请务必设置超时时间 + */ + imageAsyncScanRequest.setConnectTimeout(3000); + imageAsyncScanRequest.setReadTimeout(6000); + + try { + HttpResponse httpResponse = client.doAction(imageAsyncScanRequest); + + if(httpResponse.isSuccess()){ + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + System.out.println(JSON.toJSONString(scrResponse, true)); + if (200 == scrResponse.getInteger("code")) { + JSONArray taskResults = scrResponse.getJSONArray("data"); + for (Object taskResult : taskResults) { + if(200 == ((JSONObject)taskResult).getInteger("code")){ + String taskId = ((JSONObject)taskResult).getString("taskId"); + // 将taskId 保存下来,间隔一段时间来轮询结果, 参照ImageAsyncScanResultsRequest + System.out.println("args = [" + taskId + "]"); + }else{ + System.out.println("task process fail:" + ((JSONObject)taskResult).getInteger("code")); + } + } + } else { + System.out.println("detect not success. code:" + scrResponse.getInteger("code")); + } + }else{ + System.out.println("response not success. status:" + httpResponse.getStatus()); + } + } catch (ServerException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java new file mode 100644 index 0000000000..27e0b6e233 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanResultsSample.java @@ -0,0 +1,83 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.exceptions.ServerException; +import com.aliyuncs.green.model.v20180509.ImageAsyncScanResultsRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by liuhai.lh on 2017/2/17. + * 获取图片异步检测结果接口 + * @author liuhai.lh + * @date 2017/02/17 + */ +public class ImageAsyncScanResultsSample extends BaseSample{ + + public static void main(String[] args) throws Exception { + //请替换成你自己的accessKeyId、accessKeySecret + IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); + DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", getDomain()); + IAcsClient client = new DefaultAcsClient(profile); + + ImageAsyncScanResultsRequest imageAsyncScanResultsRequest = new ImageAsyncScanResultsRequest(); + imageAsyncScanResultsRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + imageAsyncScanResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + imageAsyncScanResultsRequest.setEncoding("utf-8"); + imageAsyncScanResultsRequest.setRegionId(regionId); + + + List taskIds = new ArrayList(); + taskIds.add("img1hdP5Wn0QC@7wW0n$VX0R@-1p3mnZ"); + imageAsyncScanResultsRequest.setHttpContent(JSON.toJSONString(taskIds).getBytes("UTF-8"), "UTF-8", FormatType.JSON); + + /** + * 请务必设置超时时间 + */ + imageAsyncScanResultsRequest.setConnectTimeout(3000); + imageAsyncScanResultsRequest.setReadTimeout(6000); + + try { + HttpResponse httpResponse = client.doAction(imageAsyncScanResultsRequest); + + if(httpResponse.isSuccess()){ + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + System.out.println(JSON.toJSONString(scrResponse, true)); + if (200 == scrResponse.getInteger("code")) { + JSONArray taskResults = scrResponse.getJSONArray("data"); + for (Object taskResult : taskResults) { + if(200 == ((JSONObject)taskResult).getInteger("code")){ + JSONArray sceneResults = ((JSONObject)taskResult).getJSONArray("results"); + for (Object sceneResult : sceneResults) { + String scene = ((JSONObject)sceneResult).getString("scene"); + String suggestion = ((JSONObject)sceneResult).getString("suggestion"); + //根据scene和suggetion做相关的处理 + //do something + } + }else{ + System.out.println("task process fail:" + ((JSONObject)taskResult).getInteger("code")); + } + } + } else { + System.out.println("detect not success. code:" + scrResponse.getInteger("code")); + } + }else{ + System.out.println("response not success. status:" + httpResponse.getStatus()); + } + } catch (ServerException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java new file mode 100644 index 0000000000..ec418154d9 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageSyncScanRequestSample.java @@ -0,0 +1,101 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.exceptions.ServerException; +import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +import java.util.*; + +/** + * Created by liuhai.lh on 2017/2/17. + * 图片同步检测接口 + * @author liuhai.lh + * @date 2017/02/17 + */ +public class ImageSyncScanRequestSample extends BaseSample { + + + public static void main(String[] args) throws Exception { + //请替换成你自己的accessKeyId、accessKeySecret + IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); + DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", getDomain()); + IAcsClient client = new DefaultAcsClient(profile); + + ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); + imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + imageSyncScanRequest.setEncoding("utf-8"); + imageSyncScanRequest.setRegionId(regionId); + + + List> tasks = new ArrayList>(); + Map task = new LinkedHashMap(); + task.put("dataId", UUID.randomUUID().toString()); + task.put("url", "http://f.hiphotos.baidu.com/image/pic/item/aa18972bd40735fa13899ac392510fb30f24084b.jpg"); + task.put("time", new Date()); + + tasks.add(task); + JSONObject data = new JSONObject(); + /** + * porn: 色情 + * terrorism: 暴恐 + * qrcode: 二维码 + * ad: 图片广告 + * ocr: 文字识别 + */ + data.put("scenes", Arrays.asList("porn","terrorism")); + data.put("tasks", tasks); + + imageSyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); + + /** + * 请务必设置超时时间 + */ + imageSyncScanRequest.setConnectTimeout(3000); + imageSyncScanRequest.setReadTimeout(10000); + + try { + HttpResponse httpResponse = client.doAction(imageSyncScanRequest); + + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + System.out.println(JSON.toJSONString(scrResponse, true)); + if (200 == scrResponse.getInteger("code")) { + JSONArray taskResults = scrResponse.getJSONArray("data"); + for (Object taskResult : taskResults) { + if(200 == ((JSONObject)taskResult).getInteger("code")){ + JSONArray sceneResults = ((JSONObject)taskResult).getJSONArray("results"); + for (Object sceneResult : sceneResults) { + String scene = ((JSONObject)sceneResult).getString("scene"); + String suggestion = ((JSONObject)sceneResult).getString("suggestion"); + //根据scene和suggetion做相关的处理 + //do something + System.out.println("args = [" + scene + "]"); + System.out.println("args = [" + suggestion + "]"); + } + }else{ + System.out.println("task process fail:" + ((JSONObject)taskResult).getInteger("code")); + } + } + } else { + System.out.println("detect not success. code:" + scrResponse.getInteger("code")); + } + } else { + System.out.println("response not success. status:" + httpResponse.getStatus()); + } + } catch (ServerException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java new file mode 100644 index 0000000000..617e6246d1 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanRequestSample.java @@ -0,0 +1,90 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.green.model.v20180509.VoiceAsyncScanRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +import java.util.*; + +/** + * 提交语音异步检测任务 demo + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/8 21:51 + */ +public class VoiceAsyncScanRequestSample extends BaseSample { + + + + public static void main(String[] args) throws Exception { + + //请替换成您自己的AccessKey ID、AccessKey Secret。 + IClientProfile profile = DefaultProfile.getProfile("cn-shanghai", + "LTAI4G6Fv6uTzQbpsayATHq4", //您自己的AccessKey ID + "QevMw1RYCwQUG3RSMPq1J6EAfmSblo");//您自己的AccessKey Secret + final IAcsClient client = new DefaultAcsClient(profile); + + VoiceAsyncScanRequest asyncScanRequest = new VoiceAsyncScanRequest(); //class different vs common + asyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 + asyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 + asyncScanRequest.setRegionId("cn-shanghai"); + asyncScanRequest.setConnectTimeout(3000); + asyncScanRequest.setReadTimeout(6000); + + List> tasks = new ArrayList>(); + Map task1 = new LinkedHashMap(); + // 请将下面的地址修改为要检测的语音文件的地址。 + task1.put("dataId","voice1"); + task1.put("url", "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/6480bd6be9f14a458162218cea84dfa5.aac"); + + Map task2 = new LinkedHashMap(); + task2.put("dataId","voice2"); + task2.put("url", "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20201208/b566d94fd7114ffb9a203e80c22ebb96.aac"); + + tasks.add(task1); + tasks.add(task2); + + JSONObject data = new JSONObject(); + + System.out.println("==========Task count:" + tasks.size()); + data.put("scenes", Arrays.asList("antispam")); + data.put("tasks", tasks); + // 如果是语音流检测,则修改为true。 + data.put("live", false); + asyncScanRequest.setHttpContent(data.toJSONString().getBytes("UTF-8"), "UTF-8", FormatType.JSON); + System.out.println("接口入参:"+JSON.toJSONString(data, true)); + + try { + HttpResponse httpResponse = client.doAction(asyncScanRequest); + + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + System.out.println("接口返参:"+JSON.toJSONString(scrResponse, true)); + if (200 == scrResponse.getInteger("code")) { + JSONArray taskResults = scrResponse.getJSONArray("data"); + for (Object taskResult : taskResults) { + Integer code = ((JSONObject) taskResult).getInteger("code"); + if (200 == code) { + final String taskId = ((JSONObject) taskResult).getString("taskId"); + System.out.println("submit async task success, taskId = [" + taskId + "]"); + } else { + System.out.println("task process fail: " + code); + } + } + } else { + System.out.println("detect not success. code: " + scrResponse.getInteger("code")); + } + } else { + System.out.println("response not success. status: " + httpResponse.getStatus()); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java new file mode 100644 index 0000000000..85d268f175 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/test/java/VoiceAsyncScanResultsRequestSample.java @@ -0,0 +1,113 @@ +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.green.model.v20180509.VoiceAsyncScanResultsRequest; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.HttpResponse; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +import java.util.*; + +/** + * 查询异步语音检测结果。 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/8 22:08 + */ +public class VoiceAsyncScanResultsRequestSample extends BaseSample { + + + public static void main(String[] args) throws Exception { + // 请替换成您自己的AccessKey ID、AccessKey Secret。 + IClientProfile profile = DefaultProfile + .getProfile("cn-shanghai", + "LTAI4G6Fv6uTzQbpsayATHq4", + "QevMw1RYCwQUG3RSMPq1J6EAfmSblo"); + final IAcsClient client = new DefaultAcsClient(profile); + //提交语音异步检测任务后返回的taskId + pollingScanResult(client, Arrays.asList("vc_f_7WZZ01BCH0q6ZnM3g1OKGG-1tAaZ7", "vc_f_6AKaBxy4HdG5bruQ0JwweV-1tAaJi")); + // pollingScanResult(client, "vc_f_6AKaBxy4HdG5bruQ0JwweV-1tAaJi"); + } + + public static void pollingScanResult(IAcsClient client, List taskIdList) throws InterruptedException { + int failCount = 0; + boolean stop = false; + do { + // 设置每10秒查询一次。 + Thread.sleep(10 * 1000); + JSONObject scanResult = getScanResult(client, taskIdList); + System.out.println("接口完整返参:"+JSON.toJSONString(scanResult, true)); + if (scanResult == null || 200 != scanResult.getInteger("code")) { + failCount++; + System.out.println("请求失败,get result fail, failCount=" + failCount); + if (scanResult != null) { + System.out.println("请求失败,错误信息errorMsg:" + scanResult.getString("msg")); + } + if (failCount > 20) { + break; + } + continue; + } + + JSONArray taskResults = scanResult.getJSONArray("data"); + if (taskResults.isEmpty()) { + System.out.println("请求成功,but data is empty"); + break; + } + System.out.println("data.size=" + taskResults.size()); + for (Object taskResult : taskResults) { + JSONObject result = (JSONObject) taskResult; + Integer code = result.getInteger("code"); + String taskId = result.getString("taskId"); + if (280 == code) { + System.out.println("taskId=" + taskId + ": processing status: " + result.getString("msg")); + } else if (200 == code) { + System.out.println("taskId=" + taskId + "请求成功,返参:" + JSON.toJSONString(taskResult, true)); + stop = true; + } else { + System.out.println("taskId=" + taskId + "请求失败,返参:" + JSON.toJSONString(taskResult, true)); + stop = true; + } + } + } while (!stop); + } + + private static JSONObject getScanResult(IAcsClient client, List taskIdList) { + VoiceAsyncScanResultsRequest getResultsRequest = new VoiceAsyncScanResultsRequest(); + getResultsRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 + getResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 + getResultsRequest.setEncoding("utf-8"); + getResultsRequest.setRegionId("cn-shanghai"); + + + List> tasks = new ArrayList>(); + for (String taskId : taskIdList) { + Map task1 = new LinkedHashMap(); + task1.put("taskId", taskId); + tasks.add(task1); + } + + /** + * 请务必设置超时时间。 + */ + getResultsRequest.setConnectTimeout(3000); + getResultsRequest.setReadTimeout(6000); + + try { + getResultsRequest.setHttpContent(JSON.toJSONString(tasks).getBytes("UTF-8"), "UTF-8", FormatType.JSON); + + HttpResponse httpResponse = client.doAction(getResultsRequest); + if (httpResponse.isSuccess()) { + return JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + } else { + System.out.println("response not success. status: " + httpResponse.getStatus()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/epmet-openapi/pom.xml b/epmet-openapi/pom.xml new file mode 100644 index 0000000000..fd15705343 --- /dev/null +++ b/epmet-openapi/pom.xml @@ -0,0 +1,19 @@ + + + + epmet-cloud + com.epmet + 2.0.0 + + 4.0.0 + pom + + epmet-openapi + + epmet-openapi-scan + epmet-openapi-adv + + + \ No newline at end of file