From c177276c8648629d8e090c902fcd1b824fbc22f8 Mon Sep 17 00:00:00 2001 From: qyx <565485304@qq.com> Date: Wed, 18 Nov 2020 18:56:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B6=E5=8A=A8=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yuyou/openapi/openapi/api/ABClient.java | 36 +++++++- .../openapi/api/enums/LuoShiAppIDEnum.java | 46 ++++++++++ .../dao/JiaDongLiMessageRepository.java | 25 ++++++ .../model/convert/ABMessageConverter.java | 49 +++++++++++ .../model/dataobject/JiaDongLiMessageDO.java | 86 +++++++++++++++++++ .../openapi/service/ABClientService.java | 7 +- .../service/impl/ABClientServiceImpl.java | 28 +++++- .../service/impl/ABClientServiceProxy.java | 9 +- .../openapi/openapi/task/ABDownTask.java | 3 + 9 files changed, 281 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/yuyou/openapi/openapi/api/enums/LuoShiAppIDEnum.java create mode 100644 src/main/java/com/yuyou/openapi/openapi/dao/JiaDongLiMessageRepository.java create mode 100644 src/main/java/com/yuyou/openapi/openapi/model/dataobject/JiaDongLiMessageDO.java 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 b92cf72..6f004a6 100644 --- a/src/main/java/com/yuyou/openapi/openapi/api/ABClient.java +++ b/src/main/java/com/yuyou/openapi/openapi/api/ABClient.java @@ -135,6 +135,24 @@ public class ABClient { CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); } + /** + * 获取上游公司的AB数据推送接口 - 推送到潘达 + * + * @return 返回调用信息 + */ + @PostMapping("/api/req/taginfo/jdl") + @ResponseBody + public CommonResponse getDBTagInfoJiaDongLi(@RequestBody ABClientInterMessageVO vo) { + // 记录日志 + log.info("====== [ JiaDongLi request comming, request content is {} ] ======", vo.toString()); + // 转换实体类映射 + List dtos = ABMessageConverter.convertABMessageDTOFromVO(vo); + // 调用业务处理接口 返回校验成功的结果 + return abClientService.recordAndSendABClientMsgJiaDongLi(dtos) ? + CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); + } + + /** * 获取上游公司的AB数据推送接口 - 推送到微信加粉 * @@ -148,10 +166,26 @@ public class ABClient { // 转换实体类映射 List dtos = ABMessageConverter.convertABMessageDTOFromVO(vo); // 调用业务处理接口 返回校验成功的结果 - return abClientService.recordAndSendABClientMsgWxFans(dtos) ? + return abClientService.recordAndSendABClientMsgWxFans(dtos, true) ? CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); } + /** + * 获取上游公司的AB数据推送接口 - 推送到微信加粉 + * + * @return 返回调用信息 + */ + @PostMapping("/api/req/taginfo/wxfanslocal") + @ResponseBody + public CommonResponse getDBTagInfoWxFansLocal(@RequestBody ABClientInterMessageVO vo) { + // 记录日志 + log.info("====== [ WX fans request comming, request content is {} ] ======", vo.toString()); + // 转换实体类映射 + List dtos = ABMessageConverter.convertABMessageDTOFromVO(vo); + // 调用业务处理接口 返回校验成功的结果 + return abClientService.recordAndSendABClientMsgWxFans(dtos, false) ? + CommonResponse.createBySuccess() : CommonResponse.createByErrorMessage("调用失败请重试"); + } /** * AB单补推接口 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 new file mode 100644 index 0000000..3793ee2 --- /dev/null +++ b/src/main/java/com/yuyou/openapi/openapi/api/enums/LuoShiAppIDEnum.java @@ -0,0 +1,46 @@ +package com.yuyou.openapi.openapi.api.enums; + +import cn.hutool.core.util.StrUtil; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * 罗什下游渠道推送 + */ +@Getter +public enum LuoShiAppIDEnum { + + /** + * 网易有道 - 数学 + */ + LS_WY_MATH("网易有道-数学","A"), + LS_WY_OTHER("其他","B") + ; + + LuoShiAppIDEnum(String actName, String tag) { + this.actName = actName; + this.tag = tag; + } + + private String actName; + + private String tag; + + + /** + * 根据desc获得编码值 + * @param matchStr + * @return + */ + public static String tagOf(String matchStr) { + if (StrUtil.isBlank(matchStr)) { + return LuoShiAppIDEnum.LS_WY_OTHER.getTag(); + } + for (LuoShiAppIDEnum luoShiAppIDEnum : LuoShiAppIDEnum.values()) { + if (StringUtils.countMatches(matchStr, luoShiAppIDEnum.getActName()) >= 0){ + return luoShiAppIDEnum.getTag(); + } + } + return LuoShiAppIDEnum.LS_WY_OTHER.getTag(); + } +} diff --git a/src/main/java/com/yuyou/openapi/openapi/dao/JiaDongLiMessageRepository.java b/src/main/java/com/yuyou/openapi/openapi/dao/JiaDongLiMessageRepository.java new file mode 100644 index 0000000..686eac8 --- /dev/null +++ b/src/main/java/com/yuyou/openapi/openapi/dao/JiaDongLiMessageRepository.java @@ -0,0 +1,25 @@ +package com.yuyou.openapi.openapi.dao; + +import com.yuyou.openapi.openapi.model.dataobject.JiaDongLiMessageDO; +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: HeXiaoXiangMessageRepository + * Author: 钱昱欣 + * Date: 2020/10/22 2:52 PM + * Description: TODO + * History: + *