diff --git a/db/new_message.sql b/db/new_message.sql new file mode 100644 index 0000000..910f0ef --- /dev/null +++ b/db/new_message.sql @@ -0,0 +1,40 @@ +/* + Navicat Premium Data Transfer + + Source Server : 阿里云-育佑 + Source Server Type : MySQL + Source Server Version : 50731 + Source Host : 47.99.218.9:3306 + Source Schema : push + + Target Server Type : MySQL + Target Server Version : 50731 + File Encoding : 65001 + + Date: 22/10/2020 20:35:31 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for xxx_message +-- ---------------------------- +DROP TABLE IF EXISTS `xxx_message`; +CREATE TABLE `xxx_message` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `gmt_create` datetime(0) NULL DEFAULT NULL, + `gmt_modified` datetime(0) NULL DEFAULT NULL, + `rec_id` bigint(20) NULL DEFAULT NULL COMMENT '记录id', + `pnum` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'pnum', + `act_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务名', + `start_time` datetime(0) NULL DEFAULT NULL COMMENT '业务开始时间', + `client_type` tinyint(1) NULL DEFAULT NULL COMMENT '业务类别(1:A,2:B,3:C,4:D,5:E,6:F)', + `app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上游推送用户id', + `push_time` datetime(0) NULL DEFAULT NULL COMMENT '上游推送时间', + `send_status` tinyint(1) NULL DEFAULT 0 COMMENT '下游推送状态', + PRIMARY KEY (`id`) USING BTREE, + INDEX `ind_rec_id`(`rec_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/pom.xml b/pom.xml index 93581ed..a26d697 100644 --- a/pom.xml +++ b/pom.xml @@ -81,6 +81,11 @@ easyexcel 2.2.6 + + com.google.guava + guava + 23.0 + diff --git a/src/main/java/com/yuyou/openapi/openapi/api/ABClient.java b/src/main/java/com/yuyou/openapi/openapi/api/ABClient.java index 6f004a6..cab5ce0 100644 --- a/src/main/java/com/yuyou/openapi/openapi/api/ABClient.java +++ b/src/main/java/com/yuyou/openapi/openapi/api/ABClient.java @@ -187,6 +187,20 @@ public class ABClient { CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); } + @PostMapping("/api/req/taginfo/local") + @ResponseBody + public CommonResponse getDBTagInfoLocal(@RequestBody ABClientInterMessageVO vo) { + // 记录日志 + log.info("====== [ Taginfo local request is comming, request content is {} ] ======", vo.toString()); + // 转换实体类映射 + List dtos = ABMessageConverter.convertABMessageDTOFromVO(vo); + // 调用业务处理接口 返回校验成功的结果 + return abClientService.recordAndSendABClientMsgWxFans(dtos, false) ? + CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); + } + + + /** * AB单补推接口 * @@ -223,13 +237,31 @@ public class ABClient { @ResponseBody public CommonResponse getLieheTagInfo(@RequestBody ABClientInterMessageVO vo) { // 记录日志 - log.info("====== [ one request comming, request content is {} ] ======", vo.toString()); + log.info("====== [ LieheTagInfo request comming, request content is {} ] ======", vo.toString()); // 转换实体类映射 - List dtos = ABMessageConverter.convertABMessageDTOFromVO(vo); + List dtos = ABMessageConverter.convertLieheMessageDTOFromVO(vo); // 调用业务处理接口 返回校验成功的结果 return abClientService.recordAndSendLieheMsg(dtos) ? CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); } + + + /** + * 获取上游公司的AB数据推送接口 + * + * @return 返回调用信息 + */ + @PostMapping("/api/req/taginfo/liehe/quke") + @ResponseBody + public CommonResponse getLieheQukeTagInfo(@RequestBody ABClientInterMessageVO vo) { + // 记录日志 + log.info("====== [ LieheQukeTagInfo request comming, request content is {} ] ======", vo.toString()); + // 转换实体类映射 + List dtos = ABMessageConverter.convertLieheMessageDTOFromVO(vo); + // 调用业务处理接口 返回校验成功的结果 + return abClientService.recordAndSendLieheQKMsg(dtos) ? + CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); + } /** diff --git a/src/main/java/com/yuyou/openapi/openapi/api/enums/LuoShiAppIDEnum.java b/src/main/java/com/yuyou/openapi/openapi/api/enums/LuoShiAppIDEnum.java index 3793ee2..c09e341 100644 --- a/src/main/java/com/yuyou/openapi/openapi/api/enums/LuoShiAppIDEnum.java +++ b/src/main/java/com/yuyou/openapi/openapi/api/enums/LuoShiAppIDEnum.java @@ -13,8 +13,10 @@ public enum LuoShiAppIDEnum { /** * 网易有道 - 数学 */ - LS_WY_MATH("网易有道-数学","A"), - LS_WY_OTHER("其他","B") + LS_WY_MATH("网易有道课-数学-罗实","C"), + LS_WY_OTHER("作业帮-数学-罗实","D"), + LS_QEFD_MATH("企鹅辅导-数学-罗实","E"), + NO_MATCH("不匹配","XX") ; LuoShiAppIDEnum(String actName, String tag) { @@ -34,13 +36,13 @@ public enum LuoShiAppIDEnum { */ public static String tagOf(String matchStr) { if (StrUtil.isBlank(matchStr)) { - return LuoShiAppIDEnum.LS_WY_OTHER.getTag(); + return NO_MATCH.getTag(); } for (LuoShiAppIDEnum luoShiAppIDEnum : LuoShiAppIDEnum.values()) { - if (StringUtils.countMatches(matchStr, luoShiAppIDEnum.getActName()) >= 0){ + if (StringUtils.contains(matchStr, luoShiAppIDEnum.getActName())){ return luoShiAppIDEnum.getTag(); } } - return LuoShiAppIDEnum.LS_WY_OTHER.getTag(); + return NO_MATCH.getTag(); } } diff --git a/src/main/java/com/yuyou/openapi/openapi/common/enums/SourceEnum.java b/src/main/java/com/yuyou/openapi/openapi/common/enums/SourceEnum.java new file mode 100644 index 0000000..dd9d324 --- /dev/null +++ b/src/main/java/com/yuyou/openapi/openapi/common/enums/SourceEnum.java @@ -0,0 +1,20 @@ +package com.yuyou.openapi.openapi.common.enums; + +import lombok.Getter; + +@Getter +public enum SourceEnum { + + + MY_SOURCE_TAG(1, "BY-LH"); + + + private Integer tagCode; + + private String tagValue; + + SourceEnum(Integer tagCode, String tagValue) { + this.tagCode = tagCode; + this.tagValue = tagValue; + } +} diff --git a/src/main/java/com/yuyou/openapi/openapi/dao/LocalDataMessageRepository.java b/src/main/java/com/yuyou/openapi/openapi/dao/LocalDataMessageRepository.java new file mode 100644 index 0000000..4615d96 --- /dev/null +++ b/src/main/java/com/yuyou/openapi/openapi/dao/LocalDataMessageRepository.java @@ -0,0 +1,25 @@ +package com.yuyou.openapi.openapi.dao; + +import com.yuyou.openapi.openapi.model.dataobject.LocalDataMessageDO; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +/** + * Copyright (C), 2012 - 2018, qyx + * FileName: LuoshiMessageRepository + * Author: 钱昱欣 + * Date: 2020/10/22 2:52 PM + * Description: TODO + * History: + *