소스 검색

三方平台基础
授权登录

lijilei 3 년 전
부모
커밋
960bb67c26
54개의 변경된 파일3786개의 추가작업 그리고 268개의 파일을 삭제
  1. 13 1
      book-push/pom.xml
  2. 40 0
      book-push/src/main/java/com/book/push/config/RedisConfiguration.java
  3. 60 0
      book-push/src/main/java/com/book/push/config/RedisProperties.java
  4. 0 128
      book-push/src/main/java/com/book/push/config/WxMpConfiguration.java
  5. 0 73
      book-push/src/main/java/com/book/push/config/WxMpProperties.java
  6. 14 0
      book-push/src/main/java/com/book/push/cons/SchemeCons.java
  7. 15 0
      book-push/src/main/java/com/book/push/cons/SiteCons.java
  8. 14 0
      book-push/src/main/java/com/book/push/cons/UrlCons.java
  9. 73 0
      book-push/src/main/java/com/book/push/controller/BookIndexController.java
  10. 0 52
      book-push/src/main/java/com/book/push/controller/MenuIndexController.java
  11. 3 0
      book-push/src/main/java/com/book/push/controller/WxMenuController.java
  12. 2 0
      book-push/src/main/java/com/book/push/controller/WxPortalController.java
  13. 236 12
      book-push/src/main/java/com/book/push/controller/WxRedirectController.java
  14. 25 0
      book-push/src/main/java/com/book/push/dao/mapper/AdminConfigMapper.java
  15. 26 0
      book-push/src/main/java/com/book/push/dao/mapper/ConfigMapper.java
  16. 19 0
      book-push/src/main/java/com/book/push/dao/mapper/OphostMapper.java
  17. 22 0
      book-push/src/main/java/com/book/push/dao/mapper/PlatformMapper.java
  18. 22 0
      book-push/src/main/java/com/book/push/dao/mapper/PtokenDao.java
  19. 4 0
      book-push/src/main/java/com/book/push/dao/mapper/UserMapper.java
  20. 20 0
      book-push/src/main/java/com/book/push/dao/mapper/UserSilentMapper.java
  21. 441 0
      book-push/src/main/java/com/book/push/dao/pojo/AdminConfig.java
  22. 60 0
      book-push/src/main/java/com/book/push/dao/pojo/Config.java
  23. 55 0
      book-push/src/main/java/com/book/push/dao/pojo/Ophost.java
  24. 88 0
      book-push/src/main/java/com/book/push/dao/pojo/Platform.java
  25. 43 0
      book-push/src/main/java/com/book/push/dao/pojo/Ptoken.java
  26. 55 0
      book-push/src/main/java/com/book/push/dao/pojo/UserSilent.java
  27. 16 0
      book-push/src/main/java/com/book/push/service/UserSilentService.java
  28. 25 0
      book-push/src/main/java/com/book/push/service/dao/AdminConfigService.java
  29. 14 0
      book-push/src/main/java/com/book/push/service/dao/ConfigService.java
  30. 15 0
      book-push/src/main/java/com/book/push/service/dao/OpHostService.java
  31. 16 0
      book-push/src/main/java/com/book/push/service/dao/PlatformService.java
  32. 2 0
      book-push/src/main/java/com/book/push/service/dao/UserService.java
  33. 40 0
      book-push/src/main/java/com/book/push/service/dao/impl/AdminConfigServiceImpl.java
  34. 24 0
      book-push/src/main/java/com/book/push/service/dao/impl/ConfigServiceImpl.java
  35. 24 0
      book-push/src/main/java/com/book/push/service/dao/impl/OpHostServiceImpl.java
  36. 30 0
      book-push/src/main/java/com/book/push/service/dao/impl/PlatformServiceImpl.java
  37. 10 0
      book-push/src/main/java/com/book/push/service/dao/impl/UserServiceImpl.java
  38. 14 0
      book-push/src/main/java/com/book/push/service/redis/RedisService.java
  39. 32 0
      book-push/src/main/java/com/book/push/service/redis/impl/RedisServiceImpl.java
  40. 15 0
      book-push/src/main/java/com/book/push/service/wx/WxThirdPartService.java
  41. 29 0
      book-push/src/main/java/com/book/push/service/wx/impl/UserSilentServiceImpl.java
  42. 30 0
      book-push/src/main/java/com/book/push/service/wx/impl/WxThirdPartMessageRouter.java
  43. 129 0
      book-push/src/main/java/com/book/push/service/wx/impl/WxThirdPartServiceImpl.java
  44. 37 0
      book-push/src/main/java/com/book/push/task/CacheTask.java
  45. 18 1
      book-push/src/main/resources/application-dev.yml
  46. 70 0
      book-push/src/main/resources/application-pro.yml
  47. 19 1
      book-push/src/main/resources/application-test.yml
  48. 1068 0
      book-push/src/main/resources/mapper/AdminConfigMapper.xml
  49. 157 0
      book-push/src/main/resources/mapper/ConfigMapper.xml
  50. 133 0
      book-push/src/main/resources/mapper/OphostMapper.xml
  51. 207 0
      book-push/src/main/resources/mapper/PlatformMapper.xml
  52. 102 0
      book-push/src/main/resources/mapper/PtokenDao.xml
  53. 3 0
      book-push/src/main/resources/mapper/UserMapper.xml
  54. 157 0
      book-push/src/main/resources/mapper/UserSilentMapper.xml

+ 13 - 1
book-push/pom.xml

@@ -21,6 +21,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+
                 <configuration>
                     <fork>true</fork>
                     <layout>ZIP</layout>
@@ -111,15 +112,26 @@
             <artifactId>jedis-lock</artifactId>
             <version>1.0.0</version>
         </dependency>
+     <!--   <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>-->
+
+
         <!-- lombok -->
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
             <version>1.18.4</version>
         </dependency>
+    <!--    <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>wx-java-open-spring-boot-starter</artifactId>
+            <version>4.1.0</version>
+        </dependency>-->
         <dependency>
             <groupId>com.github.binarywang</groupId>
-            <artifactId>wx-java-mp-spring-boot-starter</artifactId>
+            <artifactId>weixin-java-open</artifactId>
             <version>4.1.0</version>
         </dependency>
         <dependency>

+ 40 - 0
book-push/src/main/java/com/book/push/config/RedisConfiguration.java

@@ -0,0 +1,40 @@
+package com.book.push.config;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPoolConfig;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Configuration
+@EnableConfigurationProperties(RedisProperties.class)
+public class RedisConfiguration {
+    @Autowired
+    private RedisProperties redisProperties;
+
+    @Bean
+    public JedisPool getJedisPool() {
+        JedisPoolConfig config = new JedisPoolConfig();
+        config.setMaxTotal(redisProperties.getMaxActive());
+        config.setMaxIdle(redisProperties.getMaxIdle());
+        config.setMaxWaitMillis(redisProperties.getMaxWaitMillis());
+
+        JedisPool jedisPool;
+        if (StringUtils.isEmpty(redisProperties.getPassword())) {
+            jedisPool = new JedisPool(config, redisProperties.getHost(), redisProperties.getPort(), redisProperties.getTimeout());
+        } else {
+            jedisPool = new JedisPool(config, redisProperties.getHost(), redisProperties.getPort(), redisProperties.getTimeout(), redisProperties.getPassword());
+        }
+
+        return jedisPool;
+
+    }
+}

+ 60 - 0
book-push/src/main/java/com/book/push/config/RedisProperties.java

@@ -0,0 +1,60 @@
+package com.book.push.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import static com.book.push.config.RedisProperties.PREFIX;
+
+
+/**
+ * created in 2021/8/19
+ * Project: book-store
+ * redis配置
+ *
+ * @author win7
+ */
+@Data
+@ConfigurationProperties(PREFIX)
+public class RedisProperties {
+    public static final String PREFIX = "redis";
+    /**
+     * 主机地址
+     */
+    private String host;
+    /**
+     * 端口号
+     */
+    private int port;
+    /**
+     * 密码
+     */
+    private String password;
+    /**
+     * 超时时间
+     */
+    private int timeout;
+
+    /**
+     * 数据库
+     */
+    private int database;
+    /**
+     * 最大活跃数
+     */
+    private Integer maxActive;
+    /**
+     * 最大空闲连接数
+     */
+    private Integer maxIdle;
+    /**
+     * 最小的空闲链接数
+     */
+    private Integer minIdle;
+    /**
+     * 等待可用连接的最大时间
+     */
+    private Integer maxWaitMillis;
+
+
+
+}

+ 0 - 128
book-push/src/main/java/com/book/push/config/WxMpConfiguration.java

@@ -1,128 +0,0 @@
-package com.book.push.config;
-
-import com.book.push.handler.*;
-import lombok.AllArgsConstructor;
-import me.chanjar.weixin.common.redis.JedisWxRedisOps;
-import me.chanjar.weixin.mp.api.WxMpMessageRouter;
-import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
-import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
-import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.JedisPoolConfig;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static me.chanjar.weixin.common.api.WxConsts.EventType;
-import static me.chanjar.weixin.common.api.WxConsts.EventType.SUBSCRIBE;
-import static me.chanjar.weixin.common.api.WxConsts.EventType.UNSUBSCRIBE;
-import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
-import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT;
-import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*;
-import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY;
-
-/**
- * wechat mp configuration
- *
- * @author win7
- */
-@AllArgsConstructor
-@Configuration
-@EnableConfigurationProperties(WxMpProperties.class)
-public class WxMpConfiguration {
-    private final LogHandler logHandler;
-    private final NullHandler nullHandler;
-    private final KfSessionHandler kfSessionHandler;
-    private final StoreCheckNotifyHandler storeCheckNotifyHandler;
-    private final LocationHandler locationHandler;
-    private final MenuHandler menuHandler;
-    private final MsgHandler msgHandler;
-    private final UnsubscribeHandler unsubscribeHandler;
-    private final SubscribeHandler subscribeHandler;
-    private final ScanHandler scanHandler;
-    private final WxMpProperties properties;
-
-    @Bean
-    public WxMpService wxMpService() {
-        // 代码里 getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
-        final List<WxMpProperties.MpConfig> configs = this.properties.getConfigs();
-        if (configs == null) {
-            throw new RuntimeException("请配置公众号相关参数!");
-        }
-
-        WxMpService service = new WxMpServiceImpl();
-        service.setMultiConfigStorages(configs
-            .stream().map(a -> {
-                WxMpDefaultConfigImpl configStorage;
-                if (this.properties.isUseRedis()) {
-                    final WxMpProperties.RedisConfig redisConfig = this.properties.getRedisConfig();
-                    JedisPoolConfig poolConfig = new JedisPoolConfig();
-                    JedisPool jedisPool = new JedisPool(poolConfig, redisConfig.getHost(), redisConfig.getPort(),
-                       -1, redisConfig.getPassword());
-                    configStorage = new WxMpRedisConfigImpl(new JedisWxRedisOps(jedisPool), a.getAppId());
-                } else {
-                    configStorage = new WxMpDefaultConfigImpl();
-                }
-
-                configStorage.setAppId(a.getAppId());
-                configStorage.setSecret(a.getSecret());
-                configStorage.setToken(a.getToken());
-                configStorage.setAesKey(a.getAesKey());
-                return configStorage;
-            }).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o)));
-
-
-
-        return service;
-    }
-
-    @Bean
-    public WxMpMessageRouter messageRouter(WxMpService wxMpService) {
-        final WxMpMessageRouter newRouter = new WxMpMessageRouter(wxMpService);
-
-        // 记录所有事件的日志 (异步执行)
-        newRouter.rule().handler(this.logHandler).next();
-
-        // 接收客服会话管理事件
-        newRouter.rule().async(false).msgType(EVENT).event(KF_CREATE_SESSION)
-            .handler(this.kfSessionHandler).end();
-        newRouter.rule().async(false).msgType(EVENT).event(KF_CLOSE_SESSION)
-            .handler(this.kfSessionHandler).end();
-        newRouter.rule().async(false).msgType(EVENT).event(KF_SWITCH_SESSION)
-            .handler(this.kfSessionHandler).end();
-
-        // 门店审核事件
-        newRouter.rule().async(false).msgType(EVENT).event(POI_CHECK_NOTIFY).handler(this.storeCheckNotifyHandler).end();
-
-        // 自定义菜单事件
-        newRouter.rule().async(false).msgType(EVENT).event(EventType.CLICK).handler(this.menuHandler).end();
-
-        // 点击菜单连接事件
-        newRouter.rule().async(false).msgType(EVENT).event(EventType.VIEW).handler(this.nullHandler).end();
-
-        // 关注事件
-        newRouter.rule().async(false).msgType(EVENT).event(SUBSCRIBE).handler(this.subscribeHandler).end();
-
-        // 取消关注事件
-        newRouter.rule().async(false).msgType(EVENT).event(UNSUBSCRIBE).handler(this.unsubscribeHandler).end();
-
-        // 上报地理位置事件
-        newRouter.rule().async(false).msgType(EVENT).event(EventType.LOCATION).handler(this.locationHandler).end();
-
-        // 接收地理位置消息
-        newRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(this.locationHandler).end();
-
-        // 扫码事件
-        newRouter.rule().async(false).msgType(EVENT).event(EventType.SCAN).handler(this.scanHandler).end();
-
-        // 默认
-        newRouter.rule().async(false).handler(this.msgHandler).end();
-
-        return newRouter;
-    }
-
-}

+ 0 - 73
book-push/src/main/java/com/book/push/config/WxMpProperties.java

@@ -1,73 +0,0 @@
-package com.book.push.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.util.List;
-
-/**
- * wechat mp properties
- *
- * @author Binary Wang(https://github.com/binarywang)
- */
-@Data
-@ConfigurationProperties(prefix = "wx.mp")
-public class WxMpProperties {
-    /**
-     * 是否使用redis存储access token
-     */
-    private boolean useRedis;
-
-    /**
-     * redis 配置
-     */
-    private RedisConfig redisConfig;
-
-    @Data
-    public static class RedisConfig {
-        /**
-         * redis服务器 主机地址
-         */
-        private String host;
-
-        /**
-         * redis服务器 端口号
-         */
-        private Integer port;
-
-        /**
-         * redis服务器 密码
-         */
-        private String password;
-    }
-
-    /**
-     * 多个公众号配置信息
-     */
-    private List<MpConfig> configs;
-
-    @Data
-    public static class MpConfig {
-        /**
-         * 设置微信公众号的appid
-         */
-        private String appId;
-
-        /**
-         * 设置微信公众号的app secret
-         */
-        private String secret;
-
-        /**
-         * 设置微信公众号的token
-         */
-        private String token;
-
-        /**
-         * 设置微信公众号的EncodingAESKey
-         */
-        private String aesKey;
-    }
-
-
-}

+ 14 - 0
book-push/src/main/java/com/book/push/cons/SchemeCons.java

@@ -0,0 +1,14 @@
+package com.book.push.cons;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public class SchemeCons {
+    public static final String SCHEME_HTTP_PREFIX = "http://";
+    public static final String SCHEME_HTTPS_PREFIX = "https://";
+    public static String default_scheme_prefix = SCHEME_HTTP_PREFIX;
+}

+ 15 - 0
book-push/src/main/java/com/book/push/cons/SiteCons.java

@@ -0,0 +1,15 @@
+package com.book.push.cons;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public class SiteCons {
+    /**
+     * 静默授权的渠道
+     */
+    public static final String SILENT_DEFAULT_CHANNEL = "silent_default_channel";
+}

+ 14 - 0
book-push/src/main/java/com/book/push/cons/UrlCons.java

@@ -0,0 +1,14 @@
+package com.book.push.cons;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public class UrlCons {
+ public static final String OAUTH2_REDIRECT_URL_LOGIN = "%s/wx/redirect/{appid}/login";
+ public static final String OAUTH2_REDIRECT_URL_SLIENT = "%s://%s.%s/wx/redirect/{appid}/slient";
+ public static final String FRONT_URL = "%s://%s.%s/%s?channelId=%d/userId=%s";
+}

+ 73 - 0
book-push/src/main/java/com/book/push/controller/BookIndexController.java

@@ -0,0 +1,73 @@
+package com.book.push.controller;
+
+/**
+ * created in 2021/8/17
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+import com.book.push.cons.UrlCons;
+import com.book.push.dao.pojo.AdminConfig;
+import com.book.push.service.dao.AdminConfigService;
+import com.book.push.service.wx.WxThirdPartService;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.common.api.WxConsts;
+import me.chanjar.weixin.open.api.WxOpenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author
+ */
+@AllArgsConstructor
+@RestController
+@RequestMapping("/index")
+public class BookIndexController {
+    @Autowired
+    private AdminConfigService adminConfigService;
+    @Autowired
+    private WxThirdPartService thirdPartService;
+
+
+    /**
+     * //FIXME
+     * <p>
+     * 重定向urL,需要改
+     */
+
+
+    @GetMapping("/{state}")
+    public String BookMain(HttpServletRequest request, @PathVariable String state) {
+
+        StringBuffer url = request.getRequestURL();
+        String contextUrl = url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
+        String[] split = contextUrl.split("\\.");
+        String appid = split[0];
+
+
+        AdminConfig adminConfig = adminConfigService.selectByAppid(appid);
+        String redirect_url = String.format(UrlCons.OAUTH2_REDIRECT_URL_LOGIN,contextUrl).replace("{appid}", appid);
+
+
+        Integer platformId = adminConfig.getPlatformId();
+        WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
+        String auto2Url = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service()
+                .buildAuthorizationUrl(redirect_url, WxConsts.OAuth2Scope.SNSAPI_BASE, state + "_" + adminConfig.getAdminId());
+        // 静默授权
+
+
+
+
+        return "redirect:" + auto2Url;
+
+
+    }
+
+
+}

+ 0 - 52
book-push/src/main/java/com/book/push/controller/MenuIndexController.java

@@ -1,52 +0,0 @@
-package com.book.push.controller;
-
-/**
- * created in 2021/8/17
- * Project: book-store
- *
- * @author win7
- */
-
-import com.book.push.dao.pojo.User;
-import com.book.push.service.dao.UserService;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author
- */
-@AllArgsConstructor
-@RestController
-@RequestMapping("/menu/index")
-public class MenuIndexController {
-
-    /**
-     * //FIXME
-     *
-     * 重定向urL,需要改
-     */
-    public static final String REDIRECT_URL = "/wx/redirect/{appid}/greet";
-
-    @GetMapping("/{state}")
-    public String BookMain(HttpServletRequest request, @PathVariable String state) {
-
-        StringBuffer url = request.getRequestURL();
-        String contextUrl = url.delete(url.length() - request.getRequestURI().length(), url.length()).append("/").toString();
-        String[] split = contextUrl.split("\\.");
-        String appid = split[0];
-
-        String auto2Url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=SCOPE&state=%s#wechat_redirect ";
-        String redirect_url = REDIRECT_URL.replace("{appid}",appid);
-        String format = String.format(auto2Url, appid, redirect_url, state);
-        return "redirect:" + format;
-
-
-    }
-
-
-}

+ 3 - 0
book-push/src/main/java/com/book/push/controller/WxMenuController.java

@@ -20,7 +20,10 @@ import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType;
 
 /**
  * @author
+ * 创建自定义菜单
+ * 目前版本用不到,暂时废弃
  */
+@Deprecated
 @AllArgsConstructor
 @RestController
 @RequestMapping("/wx/menu/{appid}")

+ 2 - 0
book-push/src/main/java/com/book/push/controller/WxPortalController.java

@@ -11,9 +11,11 @@ import org.springframework.web.bind.annotation.*;
 
 /**
  * 微信认证
+ * java系统现住应该没用,以后需要再放开
  *
  * @author
  */
+@Deprecated
 @Slf4j
 @AllArgsConstructor
 @RestController

+ 236 - 12
book-push/src/main/java/com/book/push/controller/WxRedirectController.java

@@ -1,13 +1,22 @@
 package com.book.push.controller;
 
-import com.book.push.dao.pojo.User;
+import com.book.push.cons.SchemeCons;
+import com.book.push.cons.SiteCons;
+import com.book.push.cons.UrlCons;
+import com.book.push.dao.pojo.*;
+import com.book.push.service.UserSilentService;
+import com.book.push.service.dao.AdminConfigService;
+import com.book.push.service.dao.ConfigService;
+import com.book.push.service.dao.OpHostService;
 import com.book.push.service.dao.UserService;
+import com.book.push.service.wx.WxThirdPartService;
 import lombok.AllArgsConstructor;
-import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
+import me.chanjar.weixin.common.api.WxConsts;
 import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
 import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.mp.api.WxMpService;
-import org.checkerframework.checker.units.qual.A;
+import me.chanjar.weixin.open.api.WxOpenService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
@@ -17,20 +26,32 @@ import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * 接收微信重定向
+ *
  * @author win7
  */
 @AllArgsConstructor
 @Controller
 @RequestMapping("/wx/redirect/{appid}")
 public class WxRedirectController {
-    private final WxMpService wxService;
+    private Logger logger = LoggerFactory.getLogger(getClass());
     @Autowired
     private UserService userService;
+    @Autowired
+    private AdminConfigService adminConfigService;
+    @Autowired
+    private WxThirdPartService thirdPartService;
+    @Autowired
+    private ConfigService configService;
+    @Autowired
+    private OpHostService opHostService;
+    @Autowired
+    private UserSilentService userSilentService;
+
     /**
      * //FIXME
      * 前端页面url
      */
-    private final static String FRONT_URL = "/%s/%s/%d";
+//    private final static String FRONT_URL = "%s://%s%s?channelId=%d/userId=%d";
 
     /**
      * 接收微信静默授权,获取用户信息,跳转前台页面
@@ -40,11 +61,143 @@ public class WxRedirectController {
      * @param map
      * @return
      */
-    @RequestMapping("/greet")
-    public String greetUser(@PathVariable String appid, @RequestParam String code, @RequestParam String state, ModelMap map) {
-        if (!this.wxService.switchover(appid)) {
-            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+    @RequestMapping("/login")
+    public String login(@PathVariable String appid, @RequestParam String code, @RequestParam String state, ModelMap map) {
+
+        String[] s = state.split("_");
+        if (s.length != 2 ) {
+            logger.error("静默登录state错误");
+//            String frontUrl = getFrontUrl(ophost, page, userAdminId, userAdminId);
+            return "error";
         }
+        String page = s[0];
+        Integer channelId = Integer.parseInt(s[1]);
+
+        //来源
+        AdminConfig fromAdminConfig = adminConfigService.selectByAppid(appid);
+        Integer fromPlatformId = fromAdminConfig.getPlatformId();
+
+        //自身
+        AdminConfig adminConfig = adminConfigService.selectByAdminId(channelId);
+        Integer ophostId = adminConfig.getOphostId();
+        Ophost ophost = opHostService.selectById(ophostId);
+        Integer userAdminId = adminConfig.getAdminId();
+
+
+
+        Config config = configService.selectByName(SiteCons.SILENT_DEFAULT_CHANNEL);
+        Integer defaultAdminId = Integer.parseInt(config.getValue());
+        AdminConfig defaultAdminConfig = adminConfigService.selectByAdminId(defaultAdminId);
+
+        WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(fromPlatformId);
+        try {
+            WxOAuth2AccessToken accessToken = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service().getAccessToken(code);
+            String openId = accessToken.getOpenId();
+            User user = userService.selectByOpenId(openId);
+            if (user == null) {
+                user = new User();
+                user.setOpenid(openId);
+                user.setChannelId(channelId);
+
+                //todo 获取基本信息,save
+
+            }
+            if (userSlientExist(user, null, defaultAdminConfig.getAppid())) {
+                String frontUrl = getFrontUrl(adminConfig.getAppid(),ophost, page, userAdminId, String.valueOf(user.getId()));
+                return "redirect:" + frontUrl;
+            } else {
+                if (defaultAdminId.equals(channelId)){
+                    //保存静默授权
+                    saveUserSlitent(user,openId,appid);
+                    String frontUrl = getFrontUrl(adminConfig.getAppid(),ophost, page, userAdminId, String.valueOf(user.getId()));
+                    return "redirect:" + frontUrl;
+                }else {
+                    Integer platformId = defaultAdminConfig.getPlatformId();
+                    String redirect_url = UrlCons.OAUTH2_REDIRECT_URL_SLIENT.replace("{appid}", defaultAdminConfig.getAppid());
+                    Ophost menuHost = opHostService.selectById(defaultAdminConfig.getMenuophostId());
+                    redirect_url = String.format(redirect_url,SchemeCons.default_scheme_prefix,appid,menuHost.getHost());
+
+                    wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
+                    String auto2Url = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(defaultAdminConfig.getAppid()).getOAuth2Service()
+                            .buildAuthorizationUrl(redirect_url, WxConsts.OAuth2Scope.SNSAPI_BASE, page + "_" + user.getId());
+
+                    return "redirect:" + auto2Url;
+                }
+
+
+
+            }
+        } catch (WxErrorException e) {
+            logger.error(e.getMessage());
+            e.printStackTrace();
+            String frontUrl = getFrontUrl(adminConfig.getAppid(),ophost, state, 0, "");
+            return "redirect:" + frontUrl;
+        }
+
+
+       /* if (s.length == 2) {
+
+
+            if (defaultAdminId.equals(userAdminId)) {
+                //不走二次静默授权
+                WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(adminConfig.getPlatformId());
+                try {
+                    WxOAuth2AccessToken accessToken = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service().getAccessToken(code);
+                    String openId = accessToken.getOpenId();
+                    User user = userService.selectByOpenId(openId);
+                    if (user != null) {
+                        String frontUrl = getFrontUrl(ophost, page, userAdminId, userAdminId);
+                        return "redirect:" + frontUrl;
+                    } else {
+                        //todo 创建新用户
+                    }
+                    checkUserSlient(openId, user.getOpenid(), triAppid);
+                } catch (WxErrorException e) {
+                    logger.error(e.getMessage());
+                    e.printStackTrace();
+                    String frontUrl = getFrontUrl(ophost, state, 0, 0);
+                    return "redirect:" + frontUrl;
+                }
+
+            } else {
+                checkUserSlient(user, user.getOpenid(), triAppid);
+                AdminConfig defaultAdmin = adminConfigService.selectByAdminId(defaultAdminId);
+                Integer platformId = defaultAdmin.getPlatformId();
+                String redirect_url = UrlCons.OAUTH2_REDIRECT_URL.replace("{appid}", defaultAdmin.getAppid());
+
+
+                WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
+                String auto2Url = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service()
+                        .buildAuthorizationUrl(redirect_url, WxConsts.OAuth2Scope.SNSAPI_BASE, state + "_" + defaultAdmin.getAdminId());
+
+                return "redirect:" + auto2Url;
+
+
+            }
+        } else if (s.length == 3) {
+            Integer publicAdminId = Integer.parseInt(s[2]);
+            AdminConfig defaultAdmin = adminConfigService.selectByAdminId(publicAdminId);
+            Integer platformId = defaultAdmin.getPlatformId();
+            WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(adminConfig.getPlatformId());
+            try {
+                WxOAuth2AccessToken accessToken = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service().getAccessToken(code);
+                //公共openid
+                String openId = accessToken.getOpenId();
+
+
+            } catch (Exception e) {
+                logger.error("公共静默授权失败");
+            }
+
+        } else {
+            logger.error("静默登录state错误");
+            String frontUrl = getFrontUrl(ophost, page, userAdminId, userAdminId);
+            return "redirect:" + frontUrl;
+        }
+*/
+
+      /*  WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
+        String auto2Url = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service()
 
         try {
             WxOAuth2AccessToken accessToken = wxService.getOAuth2Service().getAccessToken(code);
@@ -53,7 +206,7 @@ public class WxRedirectController {
             User user = new User();
             user.setOpenid(wxOAuth2UserInfo.getOpenid());
             user = userService.selectUserByUser(user);
-            if (user==null){
+            if (user == null) {
                 //todo
             }
             String openid = user.getOpenid();
@@ -61,8 +214,79 @@ public class WxRedirectController {
             return "redirect:" + frontUrl;
         } catch (WxErrorException e) {
             e.printStackTrace();
+        }*/
+
+//        return "greet_user";
+    }
+    @RequestMapping("/slient")
+    public String slient(@PathVariable String appid, @RequestParam String code, @RequestParam String state, ModelMap map) {
+        String[] s = state.split("_");
+        if (s.length != 3 ) {
+            logger.error("静默登录state错误");
+//            String frontUrl = getFrontUrl(ophost, "page", userAdminId, userAdminId);
+            return "error";
+        }
+        String page = s[0];
+        Long userId = Long.parseLong(s[1]);
+
+        User user = userService.selectById(userId);
+        //来源
+        AdminConfig fromAdminConfig = adminConfigService.selectByAppid(appid);
+        Integer fromPlatformId = fromAdminConfig.getPlatformId();
+
+        //自身
+        AdminConfig adminConfig = adminConfigService.selectByAdminId(user.getChannelId());
+        Integer ophostId = adminConfig.getOphostId();
+        Ophost ophost = opHostService.selectById(ophostId);
+        Integer userAdminId = adminConfig.getAdminId();
+
+
+
+
+
+
+        WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(fromPlatformId);
+        try {
+            WxOAuth2AccessToken accessToken = wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appid).getOAuth2Service().getAccessToken(code);
+            String openId = accessToken.getOpenId();
+            saveUserSlitent(user,openId,appid);
+            String frontUrl = getFrontUrl(adminConfig.getAppid(),ophost, page, userAdminId, String.valueOf(user.getId()));
+            return "redirect:" + frontUrl;
+        }catch (Exception e){
+            e.printStackTrace();
+            String frontUrl = getFrontUrl(adminConfig.getAppid(),ophost, page, 0, "");
+            return "redirect:" + frontUrl;
         }
 
-        return "greet_user";
+
+
+    }
+    private void saveUserSlitent(User user, String openId, String appid) {
+        UserSilent userSilent = new UserSilent();
+        userSilent.setUserId(user.getId());
+        userSilent.setChannelId(user.getChannelId());
+        userSilent.setOpenid(user.getOpenid());
+        userSilent.setTriAppid(appid);
+        userSilent.setTriOpenid(openId);
+        userSilentService.insert(userSilent);
+    }
+
+    private boolean userSlientExist(User user, String openId, String appid) {
+        UserSilent userSilent = new UserSilent();
+        userSilent.setUserId(user.getId());
+        userSilent.setChannelId(user.getChannelId());
+        userSilent.setOpenid(user.getOpenid());
+        userSilent.setTriAppid(appid);
+        userSilent.setTriOpenid(openId);
+        UserSilent result = userSilentService.selectByUserSlient(userSilent);
+        return result != null;
+
+
+    }
+
+    private String getFrontUrl(String appid,Ophost ophost, String state, Integer userAdminId, String userId) {
+        String host = ophost.getHost();
+        String frontUrl = String.format(UrlCons.FRONT_URL, SchemeCons.default_scheme_prefix,appid,host, state, userAdminId, userId);
+        return frontUrl;
     }
 }

+ 25 - 0
book-push/src/main/java/com/book/push/dao/mapper/AdminConfigMapper.java

@@ -0,0 +1,25 @@
+package com.book.push.dao.mapper;
+
+import com.book.push.dao.pojo.AdminConfig;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface AdminConfigMapper {
+    int deleteByPrimaryKey(Integer adminId);
+
+    int insert(AdminConfig record);
+
+    int insertSelective(AdminConfig record);
+
+    AdminConfig selectByPrimaryKey(Integer adminId);
+
+    int updateByPrimaryKeySelective(AdminConfig record);
+
+    int updateByPrimaryKey(AdminConfig record);
+
+    List<AdminConfig> selectAll();
+
+    AdminConfig selectByAppid();
+}

+ 26 - 0
book-push/src/main/java/com/book/push/dao/mapper/ConfigMapper.java

@@ -0,0 +1,26 @@
+package com.book.push.dao.mapper;
+
+import com.book.push.dao.pojo.Config;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface ConfigMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(Config record);
+
+    int insertSelective(Config record);
+
+    Config selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(Config record);
+
+    int updateByPrimaryKey(Config record);
+
+    List<Config> selectAll();
+
+    Config selectByName(String name);
+
+}

+ 19 - 0
book-push/src/main/java/com/book/push/dao/mapper/OphostMapper.java

@@ -0,0 +1,19 @@
+package com.book.push.dao.mapper;
+
+import com.book.push.dao.pojo.Ophost;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface OphostMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(Ophost record);
+
+    int insertSelective(Ophost record);
+
+    Ophost selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(Ophost record);
+
+    int updateByPrimaryKey(Ophost record);
+}

+ 22 - 0
book-push/src/main/java/com/book/push/dao/mapper/PlatformMapper.java

@@ -0,0 +1,22 @@
+package com.book.push.dao.mapper;
+
+import com.book.push.dao.pojo.Platform;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface PlatformMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(Platform record);
+
+    int insertSelective(Platform record);
+
+    Platform selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(Platform record);
+
+    int updateByPrimaryKey(Platform record);
+    List<Platform> selectAll();
+}

+ 22 - 0
book-push/src/main/java/com/book/push/dao/mapper/PtokenDao.java

@@ -0,0 +1,22 @@
+package com.book.push.dao.mapper;
+
+import com.book.push.dao.pojo.Ptoken;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+@Repository
+public interface PtokenDao {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(Ptoken record);
+
+    int insertSelective(Ptoken record);
+
+    Ptoken selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(Ptoken record);
+
+    int updateByPrimaryKey(Ptoken record);
+
+    List<Ptoken> selectAll();
+}

+ 4 - 0
book-push/src/main/java/com/book/push/dao/mapper/UserMapper.java

@@ -1,10 +1,12 @@
 package com.book.push.dao.mapper;
 
 import com.book.push.dao.pojo.User;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 @Repository
 public interface UserMapper {
+
     int deleteByPrimaryKey(Long id);
 
     int insert(User record);
@@ -18,4 +20,6 @@ public interface UserMapper {
     int updateByPrimaryKey(User record);
 
     User selectByUser(User user);
+
+    User selectByOpenId(@Param("openid") String openid);
 }

+ 20 - 0
book-push/src/main/java/com/book/push/dao/mapper/UserSilentMapper.java

@@ -0,0 +1,20 @@
+package com.book.push.dao.mapper;
+
+import com.book.push.dao.pojo.UserSilent;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UserSilentMapper {
+    int deleteByPrimaryKey(Long id);
+
+    int insert(UserSilent record);
+
+    int insertSelective(UserSilent record);
+
+    UserSilent selectByPrimaryKey(Long id);
+
+    int updateByPrimaryKeySelective(UserSilent record);
+
+    int updateByPrimaryKey(UserSilent record);
+    UserSilent selectByUserSlient(UserSilent userSilent);
+}

+ 441 - 0
book-push/src/main/java/com/book/push/dao/pojo/AdminConfig.java

@@ -0,0 +1,441 @@
+package com.book.push.dao.pojo;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import lombok.Data;
+
+/**
+ * admin_config
+ * @author 
+ */
+@Data
+public class AdminConfig implements Serializable {
+    /**
+     * 渠道商ID
+     */
+    private Integer adminId;
+
+    /**
+     * 是否强制授权:0=不强制,1=强制
+     */
+    private Object isFouce;
+
+    /**
+     * 入口域名id
+     */
+    private Integer entryhostId;
+
+    /**
+     * 平台列表
+     */
+    private String platformList;
+
+    /**
+     * 平台id
+     */
+    private Integer platformId;
+
+    /**
+     * 菜单平台ID
+     */
+    private Integer menuPlatformId;
+
+    /**
+     * 业务id
+     */
+    private Integer ophostId;
+
+    /**
+     * 支付id
+     */
+    private Integer wxpayId;
+
+    /**
+     * 每天导粉最大数
+     */
+    private Integer fansCount;
+
+    /**
+     * 微信appId
+     */
+    private String appid;
+
+    /**
+     * 微信APP secret
+     */
+    private String secret;
+
+    /**
+     * 微信txt验证文件
+     */
+    private String txt;
+
+    /**
+     * 微信token刷新令牌
+     */
+    private String refreshToken;
+
+    /**
+     * 微信第三方授权返回json数据
+     */
+    private Object json;
+
+    /**
+     * 微信菜单
+     */
+    private Object wxMenu;
+
+    /**
+     * 是否授权:0=未授权,1=已授权
+     */
+    private Object isAuth;
+
+    /**
+     * 公众号二维码
+     */
+    private String qrcodeImage;
+
+    /**
+     * 默认关注章节数
+     */
+    private Integer bookGuideChapterIdx;
+
+    /**
+     * 章节价格
+     */
+    private Integer bookChapterPrice;
+
+    /**
+     * 关注方式:1=强制关注,2=引导关注,3=不关注
+     */
+    private Object subscribeMethod;
+
+    /**
+     * 引导关注链接
+     */
+    private String subscribeUrl;
+
+    /**
+     * 客服资料
+     */
+    private String managerContact;
+
+    /**
+     * 新用户活动状态:0=关闭,1=开启
+     */
+    private Object newUserActivity;
+
+    /**
+     * 未支付提醒:0=关闭,1=开启
+     */
+    private Object unpayTip;
+
+    /**
+     * 定制书籍提醒:0=关闭,1=开启
+     */
+    private Object readTip;
+
+    /**
+     * 继续阅读提醒:0=关闭,1=开启
+     */
+    private Object continuereadTip;
+
+    /**
+     * 签到图文推送:0=关闭,1=开启
+     */
+    private Object signTip;
+
+    /**
+     * 凌晨模式:0=关闭,1=开启
+     */
+    private Object morningPattern;
+
+    /**
+     * 关注图文推送:0=关闭,1=开启
+     */
+    private Object subscribeTip;
+
+    /**
+     * 追更开关:0=关闭,1=开启
+     */
+    private Object updateTip;
+
+    /**
+     * 自动回复书籍搜索:0=关闭,1=打开
+     */
+    private Object searchTip;
+
+    /**
+     * 定时推送开关:0=关闭,1=开启
+     */
+    private Object timingTip;
+
+    /**
+     * 猜你喜欢提醒:0=关闭,1=开启
+     */
+    private Object likeTip;
+
+    /**
+     * 页面模板:0=男女,1=男,2=女
+     */
+    private Object pageSex;
+
+    /**
+     * 页面标题
+     */
+    private Object pageTitle;
+
+    /**
+     * vip扣单间隔
+     */
+    private Integer vipNum;
+
+    /**
+     * 普通扣单间隔
+     */
+    private Integer normalNum;
+
+    /**
+     * 黑名单
+     */
+    private Boolean isBlacklist;
+
+    /**
+     * vip订单间隔
+     */
+    private Integer agentVipNum;
+
+    /**
+     * 普通订单间隔
+     */
+    private Integer agentNormalNum;
+
+    /**
+     * 是否开启:0=关闭,1=开启
+     */
+    private Boolean agentIsBlacklist;
+
+    /**
+     * 创建时间
+     */
+    private Integer createtime;
+
+    /**
+     * 更新时间
+     */
+    private Integer updatetime;
+
+    /**
+     * 微信菜单业务域名
+     */
+    private Integer menuophostId;
+
+    /**
+     * 微信菜单支付域名
+     */
+    private Integer menuwxpayId;
+
+    /**
+     * 虚假业务域名
+     */
+    private Integer fakeophostId;
+
+    /**
+     * 虚假菜单业务域
+     */
+    private Integer fakemenuophostId;
+
+    /**
+     * KL比例
+     */
+    private BigDecimal klRate;
+
+    /**
+     * 自定义商品顺序:0=关闭,1=开启
+     */
+    private Byte customGoods;
+
+    /**
+     * VIP充值开关:0=关闭,1=开启
+     */
+    private Boolean vipState;
+
+    /**
+     * 微信转化数据源接入:0=关闭,1=开启
+     */
+    private Boolean wxAdState;
+
+    /**
+     * VIP充值商品
+     */
+    private Integer vipGoodsId;
+
+    /**
+     * VIP充值页模板
+     */
+    private String vipPayTpl;
+
+    /**
+     * 推广链接第一章外派:0=关闭,1=开启
+     */
+    private Boolean refOutPush;
+
+    /**
+     * 短链域名&倒粉域名开关
+     */
+    private Object guideDomain;
+
+    /**
+     * 微信AD转化数据源ID
+     */
+    private Long wxAdSourceId;
+
+    /**
+     * 自家转移号(智能客服使用)
+     */
+    private Object isAccountSelf;
+
+    /**
+     * 赠币活动开关
+     */
+    private Object giveKandian;
+
+    /**
+     * 自定义活动展示到充值页面:0=关闭,1=开启
+     */
+    private Byte activityShowRechargePage;
+
+    /**
+     * 关注回复延时消息 1关闭 2开启
+     */
+    private Object subscribeDelay;
+
+    /**
+     * 子商户帐号
+     */
+    private Object palmpaySubAccountIds;
+
+    /**
+     * 首充优惠图文推送开关:0=关闭,1=开启
+     */
+    private Object firstRechargeImgtextPost;
+
+    /**
+     * 首充优惠图文推送规则.默认15分钟
+     */
+    private Byte orderUnrechargePostTime;
+
+    /**
+     * 微信菜单是否是二维码图片:0=不是,1=是
+     */
+    private Object isQrcodeMenu;
+
+    /**
+     * 回调时间:1=关注当日所有充值,2=关注后24小时内所有充值,3=关注当日首充,4=关注后24小时内首充
+     */
+    private Byte callbackTimeTout;
+
+    /**
+     * 回调时间:1=关注当日所有充值,2=关注后24小时内所有充值,3=关注当日首充,4=关注后24小时内首充
+     */
+    private Byte callbackTimeMp;
+
+    /**
+     * 回调时间:1=关注当日所有充值,2=关注后24小时内所有充值,3=关注当日首充,4=关注后24小时内首充
+     */
+    private Byte callbackTimeGdt;
+
+    private Double vipCustomMoney;
+
+    /**
+     * 回调时间:1=关注当日所有充值,2=关注后24小时内所有充值,3=关注当日首充,4=关注后24小时内首充
+     */
+    private Byte callbackTimeUc;
+
+    /**
+     * vip自定义商品
+     */
+    private Integer vipGoodsIdCustom;
+
+    /**
+     * GDT-MP回传:0=关闭,1=开启
+     */
+    private Byte gdtMpReportState;
+
+    /**
+     * 是否开启订阅号
+     */
+    private Integer isSubscription;
+
+    /**
+     * VIP关联渠道商默认数量
+     */
+    private Integer vipRelationNum;
+
+    /**
+     * 订阅号数量
+     */
+    private Integer subscriptionNum;
+
+    /**
+     * 书籍收费起始章节
+     */
+    private Integer bookChapterChargeStart;
+
+    /**
+     * 橙子建站回传开关:0=关,1=开
+     */
+    private Byte orangeCallback;
+
+    /**
+     * vipbanner个人中心展示:0=不展示,1=展示
+     */
+    private Byte showVipAtHome;
+
+    /**
+     * ios用户屏蔽支付开关;0:关闭;1:开启。
+     */
+    private Byte blockIosUserSwitch;
+
+    /**
+     * 扩展字段
+     */
+    private Object extend;
+
+    /**
+     * 是否开启ROI全量上报,0=未开启 1=已开启
+     */
+    private Byte callbackTimeMpAll;
+
+    /**
+     * 自定义回传用户大于Y元的订单
+     */
+    private Byte callbackTimeMpMoney;
+
+    /**
+     * 自定义回传用户X小时内的订单
+     */
+    private Byte callbackTimeMpHour;
+
+    /**
+     * 回调时间:1=关注当日所有充值,2=关注后24小时内所有充值,3=关注当日首充,4=关注后24小时内首充
+     */
+    private Byte callbackTimeBaidu;
+
+    /**
+     * 回调时间:1=关注当日所有充值,2=关注后24小时内所有充值,3=关注当日首充,4=关注后24小时内首充
+     */
+    private Byte callbackTimeOppo;
+
+    /**
+     * 百度回传开关:0=关,1=开
+     */
+    private Byte baiduCallback;
+
+    /**
+     * OPPO回传开关:0=关,1=开
+     */
+    private Byte oppoCallback;
+
+    private static final long serialVersionUID = 1L;
+}

+ 60 - 0
book-push/src/main/java/com/book/push/dao/pojo/Config.java

@@ -0,0 +1,60 @@
+package com.book.push.dao.pojo;
+
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * config
+ * @author 
+ */
+@Data
+public class Config implements Serializable {
+    private Integer id;
+
+    /**
+     * 变量名
+     */
+    private String name;
+
+    /**
+     * 分组
+     */
+    private String group;
+
+    /**
+     * 变量标题
+     */
+    private String title;
+
+    /**
+     * 变量描述
+     */
+    private String tip;
+
+    /**
+     * 类型:string,text,int,bool,array,datetime,date,file
+     */
+    private String type;
+
+    /**
+     * 变量值
+     */
+    private String value;
+
+    /**
+     * 变量字典数据
+     */
+    private String content;
+
+    /**
+     * 验证规则
+     */
+    private String rule;
+
+    /**
+     * 扩展属性
+     */
+    private String extend;
+
+    private static final long serialVersionUID = 1L;
+}

+ 55 - 0
book-push/src/main/java/com/book/push/dao/pojo/Ophost.java

@@ -0,0 +1,55 @@
+package com.book.push.dao.pojo;
+
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * ophost
+ * @author 
+ */
+@Data
+public class Ophost implements Serializable {
+    /**
+     * 主键ID
+     */
+    private Integer id;
+
+    /**
+     * 开放平台ID
+     */
+    private Integer platformId;
+
+    /**
+     * 业务域名
+     */
+    private String host;
+
+    /**
+     * 域名校验文件
+     */
+    private String hostfile;
+
+    /**
+     * 是否默认:0=非默认,1=默认
+     */
+    private Object isdefault;
+
+    /**
+     * 状态:0=关闭,1=启用
+     */
+    private Object status;
+
+    /**
+     * 描述
+     */
+    private String pDesc;
+
+    private String sdfsdf;
+
+    /**
+     * 是否加入域名自动切换列表:0=关闭,1=启用
+     */
+    private Object allowChanged;
+
+    private static final long serialVersionUID = 1L;
+}

+ 88 - 0
book-push/src/main/java/com/book/push/dao/pojo/Platform.java

@@ -0,0 +1,88 @@
+package com.book.push.dao.pojo;
+
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * platform
+ * @author 
+ */
+@Data
+public class Platform implements Serializable {
+    /**
+     *  平台ID
+     */
+    private Integer id;
+
+    /**
+     * 平台名称
+     */
+    private String name;
+
+    /**
+     * 平台appid
+     */
+    private String appid;
+
+    /**
+     * 平台密钥
+     */
+    private String secret;
+
+    /**
+     * 消息token
+     */
+    private String token;
+
+    /**
+     * 消息aes_key
+     */
+    private String aesKey;
+
+    /**
+     * 校验文件
+     */
+    private String platfile;
+
+    /**
+     * 状态:0=关闭,1=启用
+     */
+    private Object status;
+
+    /**
+     * 描述
+     */
+    private String pDesc;
+
+    /**
+     * 是否默认:0=非默认,1=默认
+     */
+    private Object isdefault;
+
+    /**
+     * 创建时间
+     */
+    private Integer createtime;
+
+    /**
+     * 更新时间
+     */
+    private Integer updatetime;
+
+    /**
+     * 平台授权域名
+     */
+    private String authhost;
+
+    /**
+     * 代理IP
+     */
+    private String proxyConfig;
+
+    /**
+     * Job代理IP
+     */
+    private String jobProxyConfig;
+
+    private static final long serialVersionUID = 1L;
+}

+ 43 - 0
book-push/src/main/java/com/book/push/dao/pojo/Ptoken.java

@@ -0,0 +1,43 @@
+package com.book.push.dao.pojo;
+
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * ptoken
+ * @author 
+ */
+@Data
+public class Ptoken implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * 平台ID
+     */
+    private Integer platformId;
+
+    /**
+     * 刷新平台tokon
+     */
+    private String refreshToken;
+
+    /**
+     * admin_id
+     */
+    private String adminId;
+
+    /**
+     * 创建时间
+     */
+    private Integer createtime;
+
+    /**
+     * 更新时间
+     */
+    private Integer updatetime;
+
+    private static final long serialVersionUID = 1L;
+}

+ 55 - 0
book-push/src/main/java/com/book/push/dao/pojo/UserSilent.java

@@ -0,0 +1,55 @@
+package com.book.push.dao.pojo;
+
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * user_silent
+ * @author 
+ */
+@Data
+public class UserSilent implements Serializable {
+    private Long id;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 渠道id
+     */
+    private Integer channelId;
+
+    /**
+     * 微信openid
+     */
+    private String openid;
+
+    /**
+     * 引导渠道id
+     */
+    private Integer triChannelId;
+
+    /**
+     * 引导渠道对应的微信openid
+     */
+    private String triOpenid;
+
+    /**
+     * 引导渠道微信appId
+     */
+    private String triAppid;
+
+    /**
+     * 更新时间
+     */
+    private Integer updatetime;
+
+    /**
+     * 创建时间
+     */
+    private Integer createtime;
+
+    private static final long serialVersionUID = 1L;
+}

+ 16 - 0
book-push/src/main/java/com/book/push/service/UserSilentService.java

@@ -0,0 +1,16 @@
+package com.book.push.service;
+
+import com.book.push.dao.pojo.UserSilent;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface UserSilentService {
+    UserSilent selectByUserSlient(UserSilent userSilent);
+
+    void insert(UserSilent userSilent);
+}

+ 25 - 0
book-push/src/main/java/com/book/push/service/dao/AdminConfigService.java

@@ -0,0 +1,25 @@
+package com.book.push.service.dao;
+
+import com.book.push.dao.mapper.AdminConfigMapper;
+import com.book.push.dao.pojo.AdminConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * created in 2021/8/19
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface AdminConfigService {
+     Map<String, AdminConfig> selectAll() ;
+     AdminConfig selectByAppid(String appid);
+     AdminConfig selectByAdminId(Integer adminId);
+
+
+}

+ 14 - 0
book-push/src/main/java/com/book/push/service/dao/ConfigService.java

@@ -0,0 +1,14 @@
+package com.book.push.service.dao;
+
+import com.book.push.dao.pojo.Config;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface ConfigService {
+ Config selectByName(String name);
+}

+ 15 - 0
book-push/src/main/java/com/book/push/service/dao/OpHostService.java

@@ -0,0 +1,15 @@
+package com.book.push.service.dao;
+
+import com.book.push.dao.pojo.Ophost;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface OpHostService {
+
+    Ophost selectById(Integer id);
+}

+ 16 - 0
book-push/src/main/java/com/book/push/service/dao/PlatformService.java

@@ -0,0 +1,16 @@
+package com.book.push.service.dao;
+
+import com.book.push.dao.pojo.Platform;
+
+import java.util.Map;
+
+/**
+ * created in 2021/8/19
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface PlatformService {
+    Map<Integer, Platform> selectAll();
+}

+ 2 - 0
book-push/src/main/java/com/book/push/service/dao/UserService.java

@@ -11,4 +11,6 @@ import com.book.push.dao.pojo.User;
 
 public interface UserService {
      User selectUserByUser(User user);
+     User selectByOpenId(String openId);
+     User selectById(Long id);
 }

+ 40 - 0
book-push/src/main/java/com/book/push/service/dao/impl/AdminConfigServiceImpl.java

@@ -0,0 +1,40 @@
+package com.book.push.service.dao.impl;
+
+import com.book.push.dao.mapper.AdminConfigMapper;
+import com.book.push.dao.pojo.AdminConfig;
+import com.book.push.service.dao.AdminConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * created in 2021/8/19
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service("adminConfigService")
+public class AdminConfigServiceImpl implements AdminConfigService {
+    @Autowired
+    private AdminConfigMapper adminConfigMapper;
+
+    @Override
+    public Map<String, AdminConfig> selectAll() {
+        List<AdminConfig> adminConfigs = adminConfigMapper.selectAll();
+        Map<String, AdminConfig> result = adminConfigs.stream().collect(Collectors.toMap(AdminConfig::getAppid, AdminConfig -> AdminConfig));
+        return result;
+    }
+
+    @Override
+    public AdminConfig selectByAppid(String appid) {
+        return adminConfigMapper.selectByAppid();
+    }
+
+    @Override
+    public AdminConfig selectByAdminId(Integer adminId) {
+        return adminConfigMapper.selectByPrimaryKey(adminId);
+    }
+}

+ 24 - 0
book-push/src/main/java/com/book/push/service/dao/impl/ConfigServiceImpl.java

@@ -0,0 +1,24 @@
+package com.book.push.service.dao.impl;
+
+import com.book.push.dao.mapper.ConfigMapper;
+import com.book.push.dao.pojo.Config;
+import com.book.push.service.dao.ConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service("configService")
+public class ConfigServiceImpl implements ConfigService {
+    @Autowired
+    private ConfigMapper configMapper;
+
+    @Override
+    public Config selectByName(String name) {
+        return configMapper.selectByName(name);
+    }
+}

+ 24 - 0
book-push/src/main/java/com/book/push/service/dao/impl/OpHostServiceImpl.java

@@ -0,0 +1,24 @@
+package com.book.push.service.dao.impl;
+
+import com.book.push.dao.mapper.OphostMapper;
+import com.book.push.dao.pojo.Ophost;
+import com.book.push.service.dao.OpHostService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service("opHostService")
+public class OpHostServiceImpl implements OpHostService {
+    @Autowired
+    private OphostMapper ophostMapper;
+
+    @Override
+    public Ophost selectById(Integer id) {
+        return ophostMapper.selectByPrimaryKey(id);
+    }
+}

+ 30 - 0
book-push/src/main/java/com/book/push/service/dao/impl/PlatformServiceImpl.java

@@ -0,0 +1,30 @@
+package com.book.push.service.dao.impl;
+
+import com.book.push.dao.mapper.PlatformMapper;
+import com.book.push.dao.pojo.Platform;
+import com.book.push.service.dao.PlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * created in 2021/8/19
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service("platformService")
+public class PlatformServiceImpl implements PlatformService {
+    @Autowired
+    private PlatformMapper platformMapper;
+
+    @Override
+    public Map<Integer, Platform> selectAll() {
+        List<Platform> platforms = platformMapper.selectAll();
+        Map<Integer, Platform> collect = platforms.stream().collect(Collectors.toMap(Platform::getId, Platform -> Platform));
+        return collect;
+    }
+}

+ 10 - 0
book-push/src/main/java/com/book/push/service/dao/impl/UserServiceImpl.java

@@ -20,4 +20,14 @@ public class UserServiceImpl implements UserService {
     public User selectUserByUser(User user) {
         return userMapper.selectByUser(user);
     }
+
+    @Override
+    public User selectByOpenId(String openId) {
+        return userMapper.selectByOpenId(openId);
+    }
+
+    @Override
+    public User selectById(Long id) {
+        return userMapper.selectByPrimaryKey(id);
+    }
 }

+ 14 - 0
book-push/src/main/java/com/book/push/service/redis/RedisService.java

@@ -0,0 +1,14 @@
+package com.book.push.service.redis;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface RedisService {
+    void set(String key, String value);
+
+    String get(String key);
+}

+ 32 - 0
book-push/src/main/java/com/book/push/service/redis/impl/RedisServiceImpl.java

@@ -0,0 +1,32 @@
+package com.book.push.service.redis.impl;
+
+import com.book.push.service.redis.RedisService;
+import lombok.Cleanup;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service("redisService")
+public class RedisServiceImpl implements RedisService {
+    @Autowired
+    private JedisPool jedisPool;
+
+    @Override
+    public void set(String key, String value) {
+        @Cleanup Jedis jedis = jedisPool.getResource();
+        jedis.set(key, value);
+    }
+
+    @Override
+    public String get(String key) {
+        @Cleanup Jedis jedis = jedisPool.getResource();
+        return jedis.get(key);
+    }
+}

+ 15 - 0
book-push/src/main/java/com/book/push/service/wx/WxThirdPartService.java

@@ -0,0 +1,15 @@
+package com.book.push.service.wx;
+
+import me.chanjar.weixin.open.api.WxOpenComponentService;
+import me.chanjar.weixin.open.api.WxOpenService;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public interface WxThirdPartService {
+    WxOpenService getWxOpenServiceByPlatFormId(Integer platFormId);
+}

+ 29 - 0
book-push/src/main/java/com/book/push/service/wx/impl/UserSilentServiceImpl.java

@@ -0,0 +1,29 @@
+package com.book.push.service.wx.impl;
+
+import com.book.push.dao.mapper.UserSilentMapper;
+import com.book.push.dao.pojo.UserSilent;
+import com.book.push.service.UserSilentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service("userSilentService")
+public class UserSilentServiceImpl implements UserSilentService {
+    @Autowired
+    private UserSilentMapper userSilentMapper;
+
+    @Override
+    public UserSilent selectByUserSlient(UserSilent userSilent) {
+        return userSilentMapper.selectByUserSlient(userSilent);
+    }
+
+    @Override
+    public void insert(UserSilent userSilent) {
+        userSilentMapper.insert(userSilent);
+    }
+}

+ 30 - 0
book-push/src/main/java/com/book/push/service/wx/impl/WxThirdPartMessageRouter.java

@@ -0,0 +1,30 @@
+package com.book.push.service.wx.impl;
+
+import com.book.push.service.wx.WxThirdPartService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import me.chanjar.weixin.open.api.WxOpenService;
+import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter;
+
+import java.util.Map;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+
+public class WxThirdPartMessageRouter extends WxOpenMessageRouter {
+    private WxThirdPartService wxThirdPartService;
+
+    public WxThirdPartMessageRouter(WxThirdPartService wxThirdPartService) {
+        super(null);
+        this.wxThirdPartService = wxThirdPartService;
+    }
+
+    public WxMpXmlOutMessage route(WxMpXmlMessage wxMessage, Integer platFormId ,Map<String, Object> context, String appId) {
+        return this.route(wxMessage, context, wxThirdPartService.getWxOpenServiceByPlatFormId(platFormId)
+                .getWxOpenComponentService().getWxMpServiceByAppid(appId));
+    }
+}

+ 129 - 0
book-push/src/main/java/com/book/push/service/wx/impl/WxThirdPartServiceImpl.java

@@ -0,0 +1,129 @@
+package com.book.push.service.wx.impl;
+
+import com.book.push.config.RedisProperties;
+import com.book.push.dao.pojo.Platform;
+import com.book.push.handler.*;
+import com.book.push.service.dao.PlatformService;
+import com.book.push.service.wx.WxThirdPartService;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.open.api.WxOpenService;
+import me.chanjar.weixin.open.api.impl.WxOpenInRedisConfigStorage;
+import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.stereotype.Service;
+import redis.clients.jedis.JedisPool;
+
+import javax.annotation.PostConstruct;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static me.chanjar.weixin.common.api.WxConsts.EventType;
+import static me.chanjar.weixin.common.api.WxConsts.EventType.SUBSCRIBE;
+import static me.chanjar.weixin.common.api.WxConsts.EventType.UNSUBSCRIBE;
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT;
+import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*;
+import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY;
+
+/**
+ * created in 2021/8/20
+ * Project: book-store
+ *
+ * @author win7
+ */
+@Service
+@AllArgsConstructor
+@EnableConfigurationProperties(RedisProperties.class)
+public class WxThirdPartServiceImpl implements WxThirdPartService {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    private final LogHandler logHandler;
+    private final NullHandler nullHandler;
+    private final KfSessionHandler kfSessionHandler;
+    private final StoreCheckNotifyHandler storeCheckNotifyHandler;
+    private final LocationHandler locationHandler;
+    private final MenuHandler menuHandler;
+    private final MsgHandler msgHandler;
+    private final UnsubscribeHandler unsubscribeHandler;
+    private final SubscribeHandler subscribeHandler;
+    private final ScanHandler scanHandler;
+    private volatile ConcurrentHashMap<Integer, WxOpenService> wxOpenServiceMap = new ConcurrentHashMap();
+    @Autowired
+    private RedisProperties redisProperties;
+    @Autowired
+    private PlatformService platformService;
+    @Autowired
+    private JedisPool jedisPool;
+
+    private WxThirdPartMessageRouter wxThirdPartMessageRouter;
+public static final String KEY_PREFIX = "platformId_%d" ;
+    @PostConstruct
+    public void load() {
+        Map<Integer, Platform> integerPlatformMap = platformService.selectAll();
+        Set<Integer> platFormIdSet = integerPlatformMap.keySet();
+        ConcurrentHashMap newWxOpenServiceMap = new ConcurrentHashMap<Integer, WxOpenService>();
+        platFormIdSet.stream().forEach(id -> {
+            Platform platform = integerPlatformMap.get(id);
+            WxOpenService wxOpenService = new WxOpenServiceImpl();
+            WxOpenInRedisConfigStorage inRedisConfigStorage = new WxOpenInRedisConfigStorage(jedisPool,String.format(KEY_PREFIX, id));
+            inRedisConfigStorage.setComponentAppId(platform.getAppid());
+            inRedisConfigStorage.setComponentAppSecret(platform.getSecret());
+
+            //FIXME  这里有错误,请注意修改
+            inRedisConfigStorage.setComponentToken(platform.getToken());//错误位置
+            inRedisConfigStorage.setComponentAesKey(platform.getAesKey());
+            wxOpenService.setWxOpenConfigStorage(inRedisConfigStorage);
+            wxOpenServiceMap.put(id, wxOpenService);
+        });
+        wxOpenServiceMap = newWxOpenServiceMap;
+
+        wxThirdPartMessageRouter = new WxThirdPartMessageRouter(this);
+        // 记录所有事件的日志 (异步执行)
+        wxThirdPartMessageRouter.rule().handler(this.logHandler).next();
+
+        // 接收客服会话管理事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(KF_CREATE_SESSION)
+                .handler(this.kfSessionHandler).end();
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(KF_CLOSE_SESSION)
+                .handler(this.kfSessionHandler).end();
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(KF_SWITCH_SESSION)
+                .handler(this.kfSessionHandler).end();
+
+        // 门店审核事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(POI_CHECK_NOTIFY).handler(this.storeCheckNotifyHandler).end();
+
+        // 自定义菜单事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(EventType.CLICK).handler(this.menuHandler).end();
+
+        // 点击菜单连接事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(EventType.VIEW).handler(this.nullHandler).end();
+
+        // 关注事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(SUBSCRIBE).handler(this.subscribeHandler).end();
+
+        // 取消关注事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(UNSUBSCRIBE).handler(this.unsubscribeHandler).end();
+
+        // 上报地理位置事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(EventType.LOCATION).handler(this.locationHandler).end();
+
+        // 接收地理位置消息
+        wxThirdPartMessageRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(this.locationHandler).end();
+
+        // 扫码事件
+        wxThirdPartMessageRouter.rule().async(false).msgType(EVENT).event(EventType.SCAN).handler(this.scanHandler).end();
+
+        // 默认
+        wxThirdPartMessageRouter.rule().async(false).handler(this.msgHandler).end();
+
+
+    }
+
+    @Override
+    public WxOpenService getWxOpenServiceByPlatFormId(Integer platFormId) {
+        return wxOpenServiceMap.get(platFormId);
+    }
+}

+ 37 - 0
book-push/src/main/java/com/book/push/task/CacheTask.java

@@ -0,0 +1,37 @@
+package com.book.push.task;
+
+/**
+ * created in 2021/8/19
+ * Project: book-store
+ * 定时刷新缓存
+ *
+ * @author win7
+ */
+
+import com.book.push.dao.pojo.AdminConfig;
+import com.book.push.dao.pojo.Platform;
+import com.book.push.service.dao.AdminConfigService;
+import com.book.push.service.dao.PlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import java.util.Map;
+
+
+public class CacheTask {
+    @Autowired
+    private AdminConfigService adminConfigService;
+
+    @Autowired
+    private PlatformService platformService;
+    @Scheduled(cron = "0 0/5 * * * ?")
+    public void refreshChannelCache() {
+        Map<String, AdminConfig> stringAdminConfigMap = adminConfigService.selectAll();
+    }
+
+    @Scheduled(cron = "0 0/20 * * * ?")
+    public void refreshPlatform(){
+        Map<Integer, Platform> integerPlatformMap = platformService.selectAll();
+    }
+
+}

+ 18 - 1
book-push/src/main/resources/application-dev.yml

@@ -31,7 +31,7 @@ spring:
       use-global-data-source-stat: true # 合并多个DruidDataSource的监控数据
       stat-view-servlet:
         enabled: true
-        login-username: tianyun
+        loginusername: tianyun
         login-password: tianyunperfect
         allow: # 默认运行所有
         deny: # 默认即可
@@ -43,6 +43,23 @@ mybatis:
   mapper-locations: classpath:mapper/*Mapper.xml
 
 
+redis:
+  host: 127.0.0.1
+  port: 6379
+  database: 0
+  password:
+  timeout: 1000s  # 数据库连接超时时间,2.0 中该参数的类型为Duration,这里在配置的时候需要指明单位
+  # 最大空闲连接数
+  max-idle: 500
+  # 最小空闲连接数
+  min-idle: 50
+  # 等待可用连接的最大时间,负数为不限制
+  max-wait: -1
+  # 最大活跃连接数,负数为不限制
+  max-active: -1
+#  最大连接数
+
+
 # 设置debug模式下打印mysql
 logging:
   level:

+ 70 - 0
book-push/src/main/resources/application-pro.yml

@@ -0,0 +1,70 @@
+server:
+  port: 16063
+
+spring:
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://121.41.100.198:3306/test_cps?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
+    username: root
+    password: root
+    #下面为连接池补充设置
+    druid:
+      initial-size: 5 # 初始化
+      max-active: 5 # 最大
+      min-idle: 5 # 最小
+      max-wait: 6000 # 超时时间
+      time-between-eviction-runs-millis: 60000 # 每分钟检查一次空闲链接
+      min-evictable-idle-time-millis: 300000 # 空闲链接可以保持多久而不被驱逐
+      # 检测链接是否有效的query
+      validation-query: SELECT 1 FROM DUAL
+      test-while-idle: true # 检测到链接空闲时,验证是否有效
+      test-on-borrow: false # 申请链接时,不检测
+      test-on-return: false # 返回链接时,不检测
+      pool-prepared-statements: false # 是否缓存preparedStatement,oracle打开,mysql关闭
+      # 如果上面开启了游标,这里要设置一下大小,例如 50
+      max-pool-prepared-statement-per-connection-size: -1
+      # 统计、监控配置
+      filters: stat,wall # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      # 合并执行的相同sql,避免因为参数不同而统计多条sql语句;开启慢sql记录
+      connect-properties: config.stat.mergeSql=true;config.stat.slowSqlMillis=500
+      use-global-data-source-stat: true # 合并多个DruidDataSource的监控数据
+      stat-view-servlet:
+        enabled: true
+        login-username: tianyun
+        login-password: tianyunperfect
+        allow: # 默认运行所有
+        deny: # 默认即可
+        reset-enable: true
+  redis:
+    host: 39.107.250.174
+    port: 6379
+    database: 0
+    timeout: 1000s  # 数据库连接超时时间,2.0 中该参数的类型为Duration,这里在配置的时候需要指明单位
+    # 连接池配置,2.0中直接使用jedis或者lettuce配置连接池
+    jedis:
+      pool:
+        # 最大空闲连接数
+        max-idle: 500
+        # 最小空闲连接数
+        min-idle: 50
+        # 等待可用连接的最大时间,负数为不限制
+        max-wait: -1
+        # 最大活跃连接数,负数为不限制
+        max-active: -1
+    cache:
+      redis:
+        time-to-live: -1 #毫秒
+
+mybatis:
+  type-aliases-package: com.book.server.entity
+  mapper-locations: classpath:mapper/*Mapper.xml
+
+
+# 设置debug模式下打印mysql
+logging:
+  level:
+    com:
+      book:
+        server:
+          mapper: debug

+ 19 - 1
book-push/src/main/resources/application-test.yml

@@ -36,7 +36,25 @@ spring:
         allow: # 默认运行所有
         deny: # 默认即可
         reset-enable: true
-
+  redis:
+    host: 39.107.250.174
+    port: 6379
+    database: 0
+    timeout: 1000s  # 数据库连接超时时间,2.0 中该参数的类型为Duration,这里在配置的时候需要指明单位
+    # 连接池配置,2.0中直接使用jedis或者lettuce配置连接池
+    jedis:
+      pool:
+        # 最大空闲连接数
+        max-idle: 500
+        # 最小空闲连接数
+        min-idle: 50
+        # 等待可用连接的最大时间,负数为不限制
+        max-wait: -1
+        # 最大活跃连接数,负数为不限制
+        max-active: -1
+    cache:
+      redis:
+        time-to-live: -1 #毫秒
 
 mybatis:
   type-aliases-package: com.book.server.entity

+ 1068 - 0
book-push/src/main/resources/mapper/AdminConfigMapper.xml

@@ -0,0 +1,1068 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.book.push.dao.mapper.AdminConfigMapper">
+    <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.AdminConfig">
+        <id column="admin_id" jdbcType="INTEGER" property="adminId"/>
+        <result column="is_fouce" jdbcType="OTHER" property="isFouce"/>
+        <result column="entryhost_id" jdbcType="INTEGER" property="entryhostId"/>
+        <result column="platform_list" jdbcType="VARCHAR" property="platformList"/>
+        <result column="platform_id" jdbcType="INTEGER" property="platformId"/>
+        <result column="menu_platform_id" jdbcType="INTEGER" property="menuPlatformId"/>
+        <result column="ophost_id" jdbcType="INTEGER" property="ophostId"/>
+        <result column="wxpay_id" jdbcType="INTEGER" property="wxpayId"/>
+        <result column="fans_count" jdbcType="INTEGER" property="fansCount"/>
+        <result column="appid" jdbcType="VARCHAR" property="appid"/>
+        <result column="secret" jdbcType="VARCHAR" property="secret"/>
+        <result column="txt" jdbcType="VARCHAR" property="txt"/>
+        <result column="refresh_token" jdbcType="VARCHAR" property="refreshToken"/>
+        <result column="json" jdbcType="OTHER" property="json"/>
+        <result column="wx_menu" jdbcType="OTHER" property="wxMenu"/>
+        <result column="is_auth" jdbcType="OTHER" property="isAuth"/>
+        <result column="qrcode_image" jdbcType="VARCHAR" property="qrcodeImage"/>
+        <result column="book_guide_chapter_idx" jdbcType="INTEGER" property="bookGuideChapterIdx"/>
+        <result column="book_chapter_price" jdbcType="INTEGER" property="bookChapterPrice"/>
+        <result column="subscribe_method" jdbcType="OTHER" property="subscribeMethod"/>
+        <result column="subscribe_url" jdbcType="VARCHAR" property="subscribeUrl"/>
+        <result column="manager_contact" jdbcType="VARCHAR" property="managerContact"/>
+        <result column="new_user_activity" jdbcType="OTHER" property="newUserActivity"/>
+        <result column="unpay_tip" jdbcType="OTHER" property="unpayTip"/>
+        <result column="read_tip" jdbcType="OTHER" property="readTip"/>
+        <result column="continueread_tip" jdbcType="OTHER" property="continuereadTip"/>
+        <result column="sign_tip" jdbcType="OTHER" property="signTip"/>
+        <result column="morning_pattern" jdbcType="OTHER" property="morningPattern"/>
+        <result column="subscribe_tip" jdbcType="OTHER" property="subscribeTip"/>
+        <result column="update_tip" jdbcType="OTHER" property="updateTip"/>
+        <result column="search_tip" jdbcType="OTHER" property="searchTip"/>
+        <result column="timing_tip" jdbcType="OTHER" property="timingTip"/>
+        <result column="like_tip" jdbcType="OTHER" property="likeTip"/>
+        <result column="page_sex" jdbcType="OTHER" property="pageSex"/>
+        <result column="page_title" jdbcType="OTHER" property="pageTitle"/>
+        <result column="vip_num" jdbcType="INTEGER" property="vipNum"/>
+        <result column="normal_num" jdbcType="INTEGER" property="normalNum"/>
+        <result column="is_blacklist" jdbcType="BOOLEAN" property="isBlacklist"/>
+        <result column="agent_vip_num" jdbcType="INTEGER" property="agentVipNum"/>
+        <result column="agent_normal_num" jdbcType="INTEGER" property="agentNormalNum"/>
+        <result column="agent_is_blacklist" jdbcType="BOOLEAN" property="agentIsBlacklist"/>
+        <result column="createtime" jdbcType="INTEGER" property="createtime"/>
+        <result column="updatetime" jdbcType="INTEGER" property="updatetime"/>
+        <result column="menuophost_id" jdbcType="INTEGER" property="menuophostId"/>
+        <result column="menuwxpay_id" jdbcType="INTEGER" property="menuwxpayId"/>
+        <result column="fakeophost_id" jdbcType="INTEGER" property="fakeophostId"/>
+        <result column="fakemenuophost_id" jdbcType="INTEGER" property="fakemenuophostId"/>
+        <result column="kl_rate" jdbcType="DECIMAL" property="klRate"/>
+        <result column="custom_goods" jdbcType="TINYINT" property="customGoods"/>
+        <result column="vip_state" jdbcType="BOOLEAN" property="vipState"/>
+        <result column="wx_ad_state" jdbcType="BOOLEAN" property="wxAdState"/>
+        <result column="vip_goods_id" jdbcType="INTEGER" property="vipGoodsId"/>
+        <result column="vip_pay_tpl" jdbcType="VARCHAR" property="vipPayTpl"/>
+        <result column="ref_out_push" jdbcType="BOOLEAN" property="refOutPush"/>
+        <result column="guide_domain" jdbcType="OTHER" property="guideDomain"/>
+        <result column="wx_ad_source_id" jdbcType="BIGINT" property="wxAdSourceId"/>
+        <result column="is_account_self" jdbcType="OTHER" property="isAccountSelf"/>
+        <result column="give_kandian" jdbcType="OTHER" property="giveKandian"/>
+        <result column="activity_show_recharge_page" jdbcType="TINYINT" property="activityShowRechargePage"/>
+        <result column="subscribe_delay" jdbcType="OTHER" property="subscribeDelay"/>
+        <result column="palmpay_sub_account_ids" jdbcType="OTHER" property="palmpaySubAccountIds"/>
+        <result column="first_recharge_imgtext_post" jdbcType="OTHER" property="firstRechargeImgtextPost"/>
+        <result column="order_unrecharge_post_time" jdbcType="TINYINT" property="orderUnrechargePostTime"/>
+        <result column="is_qrcode_menu" jdbcType="OTHER" property="isQrcodeMenu"/>
+        <result column="callback_time_tout" jdbcType="TINYINT" property="callbackTimeTout"/>
+        <result column="callback_time_mp" jdbcType="TINYINT" property="callbackTimeMp"/>
+        <result column="callback_time_gdt" jdbcType="TINYINT" property="callbackTimeGdt"/>
+        <result column="vip_custom_money" jdbcType="FLOAT" property="vipCustomMoney"/>
+        <result column="callback_time_uc" jdbcType="TINYINT" property="callbackTimeUc"/>
+        <result column="vip_goods_id_custom" jdbcType="INTEGER" property="vipGoodsIdCustom"/>
+        <result column="gdt_mp_report_state" jdbcType="TINYINT" property="gdtMpReportState"/>
+        <result column="is_subscription" jdbcType="INTEGER" property="isSubscription"/>
+        <result column="vip_relation_num" jdbcType="INTEGER" property="vipRelationNum"/>
+        <result column="subscription_num" jdbcType="INTEGER" property="subscriptionNum"/>
+        <result column="book_chapter_charge_start" jdbcType="INTEGER" property="bookChapterChargeStart"/>
+        <result column="orange_callback" jdbcType="TINYINT" property="orangeCallback"/>
+        <result column="show_vip_at_home" jdbcType="TINYINT" property="showVipAtHome"/>
+        <result column="block_ios_user_switch" jdbcType="TINYINT" property="blockIosUserSwitch"/>
+        <result column="extend" jdbcType="OTHER" property="extend"/>
+        <result column="callback_time_mp_all" jdbcType="TINYINT" property="callbackTimeMpAll"/>
+        <result column="callback_time_mp_money" jdbcType="TINYINT" property="callbackTimeMpMoney"/>
+        <result column="callback_time_mp_hour" jdbcType="TINYINT" property="callbackTimeMpHour"/>
+        <result column="callback_time_baidu" jdbcType="TINYINT" property="callbackTimeBaidu"/>
+        <result column="callback_time_oppo" jdbcType="TINYINT" property="callbackTimeOppo"/>
+        <result column="baidu_callback" jdbcType="TINYINT" property="baiduCallback"/>
+        <result column="oppo_callback" jdbcType="TINYINT" property="oppoCallback"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        admin_id, is_fouce, entryhost_id, platform_list, platform_id, menu_platform_id, ophost_id,
+    wxpay_id, fans_count, appid, secret, txt, refresh_token, json, wx_menu, is_auth, 
+    qrcode_image, book_guide_chapter_idx, book_chapter_price, subscribe_method, subscribe_url, 
+    manager_contact, new_user_activity, unpay_tip, read_tip, continueread_tip, sign_tip, 
+    morning_pattern, subscribe_tip, update_tip, search_tip, timing_tip, like_tip, page_sex, 
+    page_title, vip_num, normal_num, is_blacklist, agent_vip_num, agent_normal_num, agent_is_blacklist, 
+    createtime, updatetime, menuophost_id, menuwxpay_id, fakeophost_id, fakemenuophost_id, 
+    kl_rate, custom_goods, vip_state, wx_ad_state, vip_goods_id, vip_pay_tpl, ref_out_push, 
+    guide_domain, wx_ad_source_id, is_account_self, give_kandian, activity_show_recharge_page, 
+    subscribe_delay, palmpay_sub_account_ids, first_recharge_imgtext_post, order_unrecharge_post_time, 
+    is_qrcode_menu, callback_time_tout, callback_time_mp, callback_time_gdt, vip_custom_money, 
+    callback_time_uc, vip_goods_id_custom, gdt_mp_report_state, is_subscription, vip_relation_num, 
+    subscription_num, book_chapter_charge_start, orange_callback, show_vip_at_home, block_ios_user_switch, 
+    extend, callback_time_mp_all, callback_time_mp_money, callback_time_mp_hour, callback_time_baidu, 
+    callback_time_oppo, baidu_callback, oppo_callback
+    </sql>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from admin_config
+        where admin_id = #{adminId,jdbcType=INTEGER}
+    </select>
+    <select id="selectAll" resultType="com.book.push.dao.pojo.AdminConfig">
+        SELECT *
+        FROM admin_config WHERE agent_is_blacklist=1;
+
+    </select>
+    <select id="selectByAppid" resultType="com.book.push.dao.pojo.AdminConfig" parameterType="string">
+        select *
+        from admin_config
+        where appid = #{appid,jdbcType=VARCHAR}
+
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete
+        from admin_config
+        where admin_id = #{adminId,jdbcType=INTEGER}
+    </delete>
+    <insert id="insert" keyColumn="admin_id" keyProperty="adminId" parameterType="com.book.push.dao.pojo.AdminConfig"
+            useGeneratedKeys="true">
+        insert into admin_config (is_fouce, entryhost_id, platform_list,
+                                  platform_id, menu_platform_id, ophost_id,
+                                  wxpay_id, fans_count, appid,
+                                  secret, txt, refresh_token,
+                                  json, wx_menu, is_auth, qrcode_image,
+                                  book_guide_chapter_idx, book_chapter_price,
+                                  subscribe_method, subscribe_url, manager_contact,
+                                  new_user_activity, unpay_tip, read_tip,
+                                  continueread_tip, sign_tip, morning_pattern,
+                                  subscribe_tip, update_tip, search_tip,
+                                  timing_tip, like_tip, page_sex,
+                                  page_title, vip_num, normal_num,
+                                  is_blacklist, agent_vip_num, agent_normal_num,
+                                  agent_is_blacklist, createtime, updatetime,
+                                  menuophost_id, menuwxpay_id, fakeophost_id,
+                                  fakemenuophost_id, kl_rate, custom_goods,
+                                  vip_state, wx_ad_state, vip_goods_id,
+                                  vip_pay_tpl, ref_out_push, guide_domain,
+                                  wx_ad_source_id, is_account_self, give_kandian,
+                                  activity_show_recharge_page, subscribe_delay,
+                                  palmpay_sub_account_ids, first_recharge_imgtext_post,
+                                  order_unrecharge_post_time, is_qrcode_menu, callback_time_tout,
+                                  callback_time_mp, callback_time_gdt, vip_custom_money,
+                                  callback_time_uc, vip_goods_id_custom, gdt_mp_report_state,
+                                  is_subscription, vip_relation_num, subscription_num,
+                                  book_chapter_charge_start, orange_callback,
+                                  show_vip_at_home, block_ios_user_switch, extend,
+                                  callback_time_mp_all, callback_time_mp_money,
+                                  callback_time_mp_hour, callback_time_baidu,
+                                  callback_time_oppo, baidu_callback, oppo_callback)
+        values (#{isFouce,jdbcType=OTHER}, #{entryhostId,jdbcType=INTEGER}, #{platformList,jdbcType=VARCHAR},
+                #{platformId,jdbcType=INTEGER}, #{menuPlatformId,jdbcType=INTEGER}, #{ophostId,jdbcType=INTEGER},
+                #{wxpayId,jdbcType=INTEGER}, #{fansCount,jdbcType=INTEGER}, #{appid,jdbcType=VARCHAR},
+                #{secret,jdbcType=VARCHAR}, #{txt,jdbcType=VARCHAR}, #{refreshToken,jdbcType=VARCHAR},
+                #{json,jdbcType=OTHER}, #{wxMenu,jdbcType=OTHER}, #{isAuth,jdbcType=OTHER},
+                #{qrcodeImage,jdbcType=VARCHAR},
+                #{bookGuideChapterIdx,jdbcType=INTEGER}, #{bookChapterPrice,jdbcType=INTEGER},
+                #{subscribeMethod,jdbcType=OTHER}, #{subscribeUrl,jdbcType=VARCHAR}, #{managerContact,jdbcType=VARCHAR},
+                #{newUserActivity,jdbcType=OTHER}, #{unpayTip,jdbcType=OTHER}, #{readTip,jdbcType=OTHER},
+                #{continuereadTip,jdbcType=OTHER}, #{signTip,jdbcType=OTHER}, #{morningPattern,jdbcType=OTHER},
+                #{subscribeTip,jdbcType=OTHER}, #{updateTip,jdbcType=OTHER}, #{searchTip,jdbcType=OTHER},
+                #{timingTip,jdbcType=OTHER}, #{likeTip,jdbcType=OTHER}, #{pageSex,jdbcType=OTHER},
+                #{pageTitle,jdbcType=OTHER}, #{vipNum,jdbcType=INTEGER}, #{normalNum,jdbcType=INTEGER},
+                #{isBlacklist,jdbcType=BOOLEAN}, #{agentVipNum,jdbcType=INTEGER}, #{agentNormalNum,jdbcType=INTEGER},
+                #{agentIsBlacklist,jdbcType=BOOLEAN}, #{createtime,jdbcType=INTEGER}, #{updatetime,jdbcType=INTEGER},
+                #{menuophostId,jdbcType=INTEGER}, #{menuwxpayId,jdbcType=INTEGER}, #{fakeophostId,jdbcType=INTEGER},
+                #{fakemenuophostId,jdbcType=INTEGER}, #{klRate,jdbcType=DECIMAL}, #{customGoods,jdbcType=TINYINT},
+                #{vipState,jdbcType=BOOLEAN}, #{wxAdState,jdbcType=BOOLEAN}, #{vipGoodsId,jdbcType=INTEGER},
+                #{vipPayTpl,jdbcType=VARCHAR}, #{refOutPush,jdbcType=BOOLEAN}, #{guideDomain,jdbcType=OTHER},
+                #{wxAdSourceId,jdbcType=BIGINT}, #{isAccountSelf,jdbcType=OTHER}, #{giveKandian,jdbcType=OTHER},
+                #{activityShowRechargePage,jdbcType=TINYINT}, #{subscribeDelay,jdbcType=OTHER},
+                #{palmpaySubAccountIds,jdbcType=OTHER}, #{firstRechargeImgtextPost,jdbcType=OTHER},
+                #{orderUnrechargePostTime,jdbcType=TINYINT}, #{isQrcodeMenu,jdbcType=OTHER},
+                #{callbackTimeTout,jdbcType=TINYINT},
+                #{callbackTimeMp,jdbcType=TINYINT}, #{callbackTimeGdt,jdbcType=TINYINT},
+                #{vipCustomMoney,jdbcType=FLOAT},
+                #{callbackTimeUc,jdbcType=TINYINT}, #{vipGoodsIdCustom,jdbcType=INTEGER},
+                #{gdtMpReportState,jdbcType=TINYINT},
+                #{isSubscription,jdbcType=INTEGER}, #{vipRelationNum,jdbcType=INTEGER},
+                #{subscriptionNum,jdbcType=INTEGER},
+                #{bookChapterChargeStart,jdbcType=INTEGER}, #{orangeCallback,jdbcType=TINYINT},
+                #{showVipAtHome,jdbcType=TINYINT}, #{blockIosUserSwitch,jdbcType=TINYINT}, #{extend,jdbcType=OTHER},
+                #{callbackTimeMpAll,jdbcType=TINYINT}, #{callbackTimeMpMoney,jdbcType=TINYINT},
+                #{callbackTimeMpHour,jdbcType=TINYINT}, #{callbackTimeBaidu,jdbcType=TINYINT},
+                #{callbackTimeOppo,jdbcType=TINYINT}, #{baiduCallback,jdbcType=TINYINT},
+                #{oppoCallback,jdbcType=TINYINT})
+    </insert>
+    <insert id="insertSelective" keyColumn="admin_id" keyProperty="adminId"
+            parameterType="com.book.push.dao.pojo.AdminConfig" useGeneratedKeys="true">
+        insert into admin_config
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="isFouce != null">
+                is_fouce,
+            </if>
+            <if test="entryhostId != null">
+                entryhost_id,
+            </if>
+            <if test="platformList != null">
+                platform_list,
+            </if>
+            <if test="platformId != null">
+                platform_id,
+            </if>
+            <if test="menuPlatformId != null">
+                menu_platform_id,
+            </if>
+            <if test="ophostId != null">
+                ophost_id,
+            </if>
+            <if test="wxpayId != null">
+                wxpay_id,
+            </if>
+            <if test="fansCount != null">
+                fans_count,
+            </if>
+            <if test="appid != null">
+                appid,
+            </if>
+            <if test="secret != null">
+                secret,
+            </if>
+            <if test="txt != null">
+                txt,
+            </if>
+            <if test="refreshToken != null">
+                refresh_token,
+            </if>
+            <if test="json != null">
+                json,
+            </if>
+            <if test="wxMenu != null">
+                wx_menu,
+            </if>
+            <if test="isAuth != null">
+                is_auth,
+            </if>
+            <if test="qrcodeImage != null">
+                qrcode_image,
+            </if>
+            <if test="bookGuideChapterIdx != null">
+                book_guide_chapter_idx,
+            </if>
+            <if test="bookChapterPrice != null">
+                book_chapter_price,
+            </if>
+            <if test="subscribeMethod != null">
+                subscribe_method,
+            </if>
+            <if test="subscribeUrl != null">
+                subscribe_url,
+            </if>
+            <if test="managerContact != null">
+                manager_contact,
+            </if>
+            <if test="newUserActivity != null">
+                new_user_activity,
+            </if>
+            <if test="unpayTip != null">
+                unpay_tip,
+            </if>
+            <if test="readTip != null">
+                read_tip,
+            </if>
+            <if test="continuereadTip != null">
+                continueread_tip,
+            </if>
+            <if test="signTip != null">
+                sign_tip,
+            </if>
+            <if test="morningPattern != null">
+                morning_pattern,
+            </if>
+            <if test="subscribeTip != null">
+                subscribe_tip,
+            </if>
+            <if test="updateTip != null">
+                update_tip,
+            </if>
+            <if test="searchTip != null">
+                search_tip,
+            </if>
+            <if test="timingTip != null">
+                timing_tip,
+            </if>
+            <if test="likeTip != null">
+                like_tip,
+            </if>
+            <if test="pageSex != null">
+                page_sex,
+            </if>
+            <if test="pageTitle != null">
+                page_title,
+            </if>
+            <if test="vipNum != null">
+                vip_num,
+            </if>
+            <if test="normalNum != null">
+                normal_num,
+            </if>
+            <if test="isBlacklist != null">
+                is_blacklist,
+            </if>
+            <if test="agentVipNum != null">
+                agent_vip_num,
+            </if>
+            <if test="agentNormalNum != null">
+                agent_normal_num,
+            </if>
+            <if test="agentIsBlacklist != null">
+                agent_is_blacklist,
+            </if>
+            <if test="createtime != null">
+                createtime,
+            </if>
+            <if test="updatetime != null">
+                updatetime,
+            </if>
+            <if test="menuophostId != null">
+                menuophost_id,
+            </if>
+            <if test="menuwxpayId != null">
+                menuwxpay_id,
+            </if>
+            <if test="fakeophostId != null">
+                fakeophost_id,
+            </if>
+            <if test="fakemenuophostId != null">
+                fakemenuophost_id,
+            </if>
+            <if test="klRate != null">
+                kl_rate,
+            </if>
+            <if test="customGoods != null">
+                custom_goods,
+            </if>
+            <if test="vipState != null">
+                vip_state,
+            </if>
+            <if test="wxAdState != null">
+                wx_ad_state,
+            </if>
+            <if test="vipGoodsId != null">
+                vip_goods_id,
+            </if>
+            <if test="vipPayTpl != null">
+                vip_pay_tpl,
+            </if>
+            <if test="refOutPush != null">
+                ref_out_push,
+            </if>
+            <if test="guideDomain != null">
+                guide_domain,
+            </if>
+            <if test="wxAdSourceId != null">
+                wx_ad_source_id,
+            </if>
+            <if test="isAccountSelf != null">
+                is_account_self,
+            </if>
+            <if test="giveKandian != null">
+                give_kandian,
+            </if>
+            <if test="activityShowRechargePage != null">
+                activity_show_recharge_page,
+            </if>
+            <if test="subscribeDelay != null">
+                subscribe_delay,
+            </if>
+            <if test="palmpaySubAccountIds != null">
+                palmpay_sub_account_ids,
+            </if>
+            <if test="firstRechargeImgtextPost != null">
+                first_recharge_imgtext_post,
+            </if>
+            <if test="orderUnrechargePostTime != null">
+                order_unrecharge_post_time,
+            </if>
+            <if test="isQrcodeMenu != null">
+                is_qrcode_menu,
+            </if>
+            <if test="callbackTimeTout != null">
+                callback_time_tout,
+            </if>
+            <if test="callbackTimeMp != null">
+                callback_time_mp,
+            </if>
+            <if test="callbackTimeGdt != null">
+                callback_time_gdt,
+            </if>
+            <if test="vipCustomMoney != null">
+                vip_custom_money,
+            </if>
+            <if test="callbackTimeUc != null">
+                callback_time_uc,
+            </if>
+            <if test="vipGoodsIdCustom != null">
+                vip_goods_id_custom,
+            </if>
+            <if test="gdtMpReportState != null">
+                gdt_mp_report_state,
+            </if>
+            <if test="isSubscription != null">
+                is_subscription,
+            </if>
+            <if test="vipRelationNum != null">
+                vip_relation_num,
+            </if>
+            <if test="subscriptionNum != null">
+                subscription_num,
+            </if>
+            <if test="bookChapterChargeStart != null">
+                book_chapter_charge_start,
+            </if>
+            <if test="orangeCallback != null">
+                orange_callback,
+            </if>
+            <if test="showVipAtHome != null">
+                show_vip_at_home,
+            </if>
+            <if test="blockIosUserSwitch != null">
+                block_ios_user_switch,
+            </if>
+            <if test="extend != null">
+                extend,
+            </if>
+            <if test="callbackTimeMpAll != null">
+                callback_time_mp_all,
+            </if>
+            <if test="callbackTimeMpMoney != null">
+                callback_time_mp_money,
+            </if>
+            <if test="callbackTimeMpHour != null">
+                callback_time_mp_hour,
+            </if>
+            <if test="callbackTimeBaidu != null">
+                callback_time_baidu,
+            </if>
+            <if test="callbackTimeOppo != null">
+                callback_time_oppo,
+            </if>
+            <if test="baiduCallback != null">
+                baidu_callback,
+            </if>
+            <if test="oppoCallback != null">
+                oppo_callback,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="isFouce != null">
+                #{isFouce,jdbcType=OTHER},
+            </if>
+            <if test="entryhostId != null">
+                #{entryhostId,jdbcType=INTEGER},
+            </if>
+            <if test="platformList != null">
+                #{platformList,jdbcType=VARCHAR},
+            </if>
+            <if test="platformId != null">
+                #{platformId,jdbcType=INTEGER},
+            </if>
+            <if test="menuPlatformId != null">
+                #{menuPlatformId,jdbcType=INTEGER},
+            </if>
+            <if test="ophostId != null">
+                #{ophostId,jdbcType=INTEGER},
+            </if>
+            <if test="wxpayId != null">
+                #{wxpayId,jdbcType=INTEGER},
+            </if>
+            <if test="fansCount != null">
+                #{fansCount,jdbcType=INTEGER},
+            </if>
+            <if test="appid != null">
+                #{appid,jdbcType=VARCHAR},
+            </if>
+            <if test="secret != null">
+                #{secret,jdbcType=VARCHAR},
+            </if>
+            <if test="txt != null">
+                #{txt,jdbcType=VARCHAR},
+            </if>
+            <if test="refreshToken != null">
+                #{refreshToken,jdbcType=VARCHAR},
+            </if>
+            <if test="json != null">
+                #{json,jdbcType=OTHER},
+            </if>
+            <if test="wxMenu != null">
+                #{wxMenu,jdbcType=OTHER},
+            </if>
+            <if test="isAuth != null">
+                #{isAuth,jdbcType=OTHER},
+            </if>
+            <if test="qrcodeImage != null">
+                #{qrcodeImage,jdbcType=VARCHAR},
+            </if>
+            <if test="bookGuideChapterIdx != null">
+                #{bookGuideChapterIdx,jdbcType=INTEGER},
+            </if>
+            <if test="bookChapterPrice != null">
+                #{bookChapterPrice,jdbcType=INTEGER},
+            </if>
+            <if test="subscribeMethod != null">
+                #{subscribeMethod,jdbcType=OTHER},
+            </if>
+            <if test="subscribeUrl != null">
+                #{subscribeUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="managerContact != null">
+                #{managerContact,jdbcType=VARCHAR},
+            </if>
+            <if test="newUserActivity != null">
+                #{newUserActivity,jdbcType=OTHER},
+            </if>
+            <if test="unpayTip != null">
+                #{unpayTip,jdbcType=OTHER},
+            </if>
+            <if test="readTip != null">
+                #{readTip,jdbcType=OTHER},
+            </if>
+            <if test="continuereadTip != null">
+                #{continuereadTip,jdbcType=OTHER},
+            </if>
+            <if test="signTip != null">
+                #{signTip,jdbcType=OTHER},
+            </if>
+            <if test="morningPattern != null">
+                #{morningPattern,jdbcType=OTHER},
+            </if>
+            <if test="subscribeTip != null">
+                #{subscribeTip,jdbcType=OTHER},
+            </if>
+            <if test="updateTip != null">
+                #{updateTip,jdbcType=OTHER},
+            </if>
+            <if test="searchTip != null">
+                #{searchTip,jdbcType=OTHER},
+            </if>
+            <if test="timingTip != null">
+                #{timingTip,jdbcType=OTHER},
+            </if>
+            <if test="likeTip != null">
+                #{likeTip,jdbcType=OTHER},
+            </if>
+            <if test="pageSex != null">
+                #{pageSex,jdbcType=OTHER},
+            </if>
+            <if test="pageTitle != null">
+                #{pageTitle,jdbcType=OTHER},
+            </if>
+            <if test="vipNum != null">
+                #{vipNum,jdbcType=INTEGER},
+            </if>
+            <if test="normalNum != null">
+                #{normalNum,jdbcType=INTEGER},
+            </if>
+            <if test="isBlacklist != null">
+                #{isBlacklist,jdbcType=BOOLEAN},
+            </if>
+            <if test="agentVipNum != null">
+                #{agentVipNum,jdbcType=INTEGER},
+            </if>
+            <if test="agentNormalNum != null">
+                #{agentNormalNum,jdbcType=INTEGER},
+            </if>
+            <if test="agentIsBlacklist != null">
+                #{agentIsBlacklist,jdbcType=BOOLEAN},
+            </if>
+            <if test="createtime != null">
+                #{createtime,jdbcType=INTEGER},
+            </if>
+            <if test="updatetime != null">
+                #{updatetime,jdbcType=INTEGER},
+            </if>
+            <if test="menuophostId != null">
+                #{menuophostId,jdbcType=INTEGER},
+            </if>
+            <if test="menuwxpayId != null">
+                #{menuwxpayId,jdbcType=INTEGER},
+            </if>
+            <if test="fakeophostId != null">
+                #{fakeophostId,jdbcType=INTEGER},
+            </if>
+            <if test="fakemenuophostId != null">
+                #{fakemenuophostId,jdbcType=INTEGER},
+            </if>
+            <if test="klRate != null">
+                #{klRate,jdbcType=DECIMAL},
+            </if>
+            <if test="customGoods != null">
+                #{customGoods,jdbcType=TINYINT},
+            </if>
+            <if test="vipState != null">
+                #{vipState,jdbcType=BOOLEAN},
+            </if>
+            <if test="wxAdState != null">
+                #{wxAdState,jdbcType=BOOLEAN},
+            </if>
+            <if test="vipGoodsId != null">
+                #{vipGoodsId,jdbcType=INTEGER},
+            </if>
+            <if test="vipPayTpl != null">
+                #{vipPayTpl,jdbcType=VARCHAR},
+            </if>
+            <if test="refOutPush != null">
+                #{refOutPush,jdbcType=BOOLEAN},
+            </if>
+            <if test="guideDomain != null">
+                #{guideDomain,jdbcType=OTHER},
+            </if>
+            <if test="wxAdSourceId != null">
+                #{wxAdSourceId,jdbcType=BIGINT},
+            </if>
+            <if test="isAccountSelf != null">
+                #{isAccountSelf,jdbcType=OTHER},
+            </if>
+            <if test="giveKandian != null">
+                #{giveKandian,jdbcType=OTHER},
+            </if>
+            <if test="activityShowRechargePage != null">
+                #{activityShowRechargePage,jdbcType=TINYINT},
+            </if>
+            <if test="subscribeDelay != null">
+                #{subscribeDelay,jdbcType=OTHER},
+            </if>
+            <if test="palmpaySubAccountIds != null">
+                #{palmpaySubAccountIds,jdbcType=OTHER},
+            </if>
+            <if test="firstRechargeImgtextPost != null">
+                #{firstRechargeImgtextPost,jdbcType=OTHER},
+            </if>
+            <if test="orderUnrechargePostTime != null">
+                #{orderUnrechargePostTime,jdbcType=TINYINT},
+            </if>
+            <if test="isQrcodeMenu != null">
+                #{isQrcodeMenu,jdbcType=OTHER},
+            </if>
+            <if test="callbackTimeTout != null">
+                #{callbackTimeTout,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeMp != null">
+                #{callbackTimeMp,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeGdt != null">
+                #{callbackTimeGdt,jdbcType=TINYINT},
+            </if>
+            <if test="vipCustomMoney != null">
+                #{vipCustomMoney,jdbcType=FLOAT},
+            </if>
+            <if test="callbackTimeUc != null">
+                #{callbackTimeUc,jdbcType=TINYINT},
+            </if>
+            <if test="vipGoodsIdCustom != null">
+                #{vipGoodsIdCustom,jdbcType=INTEGER},
+            </if>
+            <if test="gdtMpReportState != null">
+                #{gdtMpReportState,jdbcType=TINYINT},
+            </if>
+            <if test="isSubscription != null">
+                #{isSubscription,jdbcType=INTEGER},
+            </if>
+            <if test="vipRelationNum != null">
+                #{vipRelationNum,jdbcType=INTEGER},
+            </if>
+            <if test="subscriptionNum != null">
+                #{subscriptionNum,jdbcType=INTEGER},
+            </if>
+            <if test="bookChapterChargeStart != null">
+                #{bookChapterChargeStart,jdbcType=INTEGER},
+            </if>
+            <if test="orangeCallback != null">
+                #{orangeCallback,jdbcType=TINYINT},
+            </if>
+            <if test="showVipAtHome != null">
+                #{showVipAtHome,jdbcType=TINYINT},
+            </if>
+            <if test="blockIosUserSwitch != null">
+                #{blockIosUserSwitch,jdbcType=TINYINT},
+            </if>
+            <if test="extend != null">
+                #{extend,jdbcType=OTHER},
+            </if>
+            <if test="callbackTimeMpAll != null">
+                #{callbackTimeMpAll,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeMpMoney != null">
+                #{callbackTimeMpMoney,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeMpHour != null">
+                #{callbackTimeMpHour,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeBaidu != null">
+                #{callbackTimeBaidu,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeOppo != null">
+                #{callbackTimeOppo,jdbcType=TINYINT},
+            </if>
+            <if test="baiduCallback != null">
+                #{baiduCallback,jdbcType=TINYINT},
+            </if>
+            <if test="oppoCallback != null">
+                #{oppoCallback,jdbcType=TINYINT},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.AdminConfig">
+        update admin_config
+        <set>
+            <if test="isFouce != null">
+                is_fouce = #{isFouce,jdbcType=OTHER},
+            </if>
+            <if test="entryhostId != null">
+                entryhost_id = #{entryhostId,jdbcType=INTEGER},
+            </if>
+            <if test="platformList != null">
+                platform_list = #{platformList,jdbcType=VARCHAR},
+            </if>
+            <if test="platformId != null">
+                platform_id = #{platformId,jdbcType=INTEGER},
+            </if>
+            <if test="menuPlatformId != null">
+                menu_platform_id = #{menuPlatformId,jdbcType=INTEGER},
+            </if>
+            <if test="ophostId != null">
+                ophost_id = #{ophostId,jdbcType=INTEGER},
+            </if>
+            <if test="wxpayId != null">
+                wxpay_id = #{wxpayId,jdbcType=INTEGER},
+            </if>
+            <if test="fansCount != null">
+                fans_count = #{fansCount,jdbcType=INTEGER},
+            </if>
+            <if test="appid != null">
+                appid = #{appid,jdbcType=VARCHAR},
+            </if>
+            <if test="secret != null">
+                secret = #{secret,jdbcType=VARCHAR},
+            </if>
+            <if test="txt != null">
+                txt = #{txt,jdbcType=VARCHAR},
+            </if>
+            <if test="refreshToken != null">
+                refresh_token = #{refreshToken,jdbcType=VARCHAR},
+            </if>
+            <if test="json != null">
+                json = #{json,jdbcType=OTHER},
+            </if>
+            <if test="wxMenu != null">
+                wx_menu = #{wxMenu,jdbcType=OTHER},
+            </if>
+            <if test="isAuth != null">
+                is_auth = #{isAuth,jdbcType=OTHER},
+            </if>
+            <if test="qrcodeImage != null">
+                qrcode_image = #{qrcodeImage,jdbcType=VARCHAR},
+            </if>
+            <if test="bookGuideChapterIdx != null">
+                book_guide_chapter_idx = #{bookGuideChapterIdx,jdbcType=INTEGER},
+            </if>
+            <if test="bookChapterPrice != null">
+                book_chapter_price = #{bookChapterPrice,jdbcType=INTEGER},
+            </if>
+            <if test="subscribeMethod != null">
+                subscribe_method = #{subscribeMethod,jdbcType=OTHER},
+            </if>
+            <if test="subscribeUrl != null">
+                subscribe_url = #{subscribeUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="managerContact != null">
+                manager_contact = #{managerContact,jdbcType=VARCHAR},
+            </if>
+            <if test="newUserActivity != null">
+                new_user_activity = #{newUserActivity,jdbcType=OTHER},
+            </if>
+            <if test="unpayTip != null">
+                unpay_tip = #{unpayTip,jdbcType=OTHER},
+            </if>
+            <if test="readTip != null">
+                read_tip = #{readTip,jdbcType=OTHER},
+            </if>
+            <if test="continuereadTip != null">
+                continueread_tip = #{continuereadTip,jdbcType=OTHER},
+            </if>
+            <if test="signTip != null">
+                sign_tip = #{signTip,jdbcType=OTHER},
+            </if>
+            <if test="morningPattern != null">
+                morning_pattern = #{morningPattern,jdbcType=OTHER},
+            </if>
+            <if test="subscribeTip != null">
+                subscribe_tip = #{subscribeTip,jdbcType=OTHER},
+            </if>
+            <if test="updateTip != null">
+                update_tip = #{updateTip,jdbcType=OTHER},
+            </if>
+            <if test="searchTip != null">
+                search_tip = #{searchTip,jdbcType=OTHER},
+            </if>
+            <if test="timingTip != null">
+                timing_tip = #{timingTip,jdbcType=OTHER},
+            </if>
+            <if test="likeTip != null">
+                like_tip = #{likeTip,jdbcType=OTHER},
+            </if>
+            <if test="pageSex != null">
+                page_sex = #{pageSex,jdbcType=OTHER},
+            </if>
+            <if test="pageTitle != null">
+                page_title = #{pageTitle,jdbcType=OTHER},
+            </if>
+            <if test="vipNum != null">
+                vip_num = #{vipNum,jdbcType=INTEGER},
+            </if>
+            <if test="normalNum != null">
+                normal_num = #{normalNum,jdbcType=INTEGER},
+            </if>
+            <if test="isBlacklist != null">
+                is_blacklist = #{isBlacklist,jdbcType=BOOLEAN},
+            </if>
+            <if test="agentVipNum != null">
+                agent_vip_num = #{agentVipNum,jdbcType=INTEGER},
+            </if>
+            <if test="agentNormalNum != null">
+                agent_normal_num = #{agentNormalNum,jdbcType=INTEGER},
+            </if>
+            <if test="agentIsBlacklist != null">
+                agent_is_blacklist = #{agentIsBlacklist,jdbcType=BOOLEAN},
+            </if>
+            <if test="createtime != null">
+                createtime = #{createtime,jdbcType=INTEGER},
+            </if>
+            <if test="updatetime != null">
+                updatetime = #{updatetime,jdbcType=INTEGER},
+            </if>
+            <if test="menuophostId != null">
+                menuophost_id = #{menuophostId,jdbcType=INTEGER},
+            </if>
+            <if test="menuwxpayId != null">
+                menuwxpay_id = #{menuwxpayId,jdbcType=INTEGER},
+            </if>
+            <if test="fakeophostId != null">
+                fakeophost_id = #{fakeophostId,jdbcType=INTEGER},
+            </if>
+            <if test="fakemenuophostId != null">
+                fakemenuophost_id = #{fakemenuophostId,jdbcType=INTEGER},
+            </if>
+            <if test="klRate != null">
+                kl_rate = #{klRate,jdbcType=DECIMAL},
+            </if>
+            <if test="customGoods != null">
+                custom_goods = #{customGoods,jdbcType=TINYINT},
+            </if>
+            <if test="vipState != null">
+                vip_state = #{vipState,jdbcType=BOOLEAN},
+            </if>
+            <if test="wxAdState != null">
+                wx_ad_state = #{wxAdState,jdbcType=BOOLEAN},
+            </if>
+            <if test="vipGoodsId != null">
+                vip_goods_id = #{vipGoodsId,jdbcType=INTEGER},
+            </if>
+            <if test="vipPayTpl != null">
+                vip_pay_tpl = #{vipPayTpl,jdbcType=VARCHAR},
+            </if>
+            <if test="refOutPush != null">
+                ref_out_push = #{refOutPush,jdbcType=BOOLEAN},
+            </if>
+            <if test="guideDomain != null">
+                guide_domain = #{guideDomain,jdbcType=OTHER},
+            </if>
+            <if test="wxAdSourceId != null">
+                wx_ad_source_id = #{wxAdSourceId,jdbcType=BIGINT},
+            </if>
+            <if test="isAccountSelf != null">
+                is_account_self = #{isAccountSelf,jdbcType=OTHER},
+            </if>
+            <if test="giveKandian != null">
+                give_kandian = #{giveKandian,jdbcType=OTHER},
+            </if>
+            <if test="activityShowRechargePage != null">
+                activity_show_recharge_page = #{activityShowRechargePage,jdbcType=TINYINT},
+            </if>
+            <if test="subscribeDelay != null">
+                subscribe_delay = #{subscribeDelay,jdbcType=OTHER},
+            </if>
+            <if test="palmpaySubAccountIds != null">
+                palmpay_sub_account_ids = #{palmpaySubAccountIds,jdbcType=OTHER},
+            </if>
+            <if test="firstRechargeImgtextPost != null">
+                first_recharge_imgtext_post = #{firstRechargeImgtextPost,jdbcType=OTHER},
+            </if>
+            <if test="orderUnrechargePostTime != null">
+                order_unrecharge_post_time = #{orderUnrechargePostTime,jdbcType=TINYINT},
+            </if>
+            <if test="isQrcodeMenu != null">
+                is_qrcode_menu = #{isQrcodeMenu,jdbcType=OTHER},
+            </if>
+            <if test="callbackTimeTout != null">
+                callback_time_tout = #{callbackTimeTout,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeMp != null">
+                callback_time_mp = #{callbackTimeMp,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeGdt != null">
+                callback_time_gdt = #{callbackTimeGdt,jdbcType=TINYINT},
+            </if>
+            <if test="vipCustomMoney != null">
+                vip_custom_money = #{vipCustomMoney,jdbcType=FLOAT},
+            </if>
+            <if test="callbackTimeUc != null">
+                callback_time_uc = #{callbackTimeUc,jdbcType=TINYINT},
+            </if>
+            <if test="vipGoodsIdCustom != null">
+                vip_goods_id_custom = #{vipGoodsIdCustom,jdbcType=INTEGER},
+            </if>
+            <if test="gdtMpReportState != null">
+                gdt_mp_report_state = #{gdtMpReportState,jdbcType=TINYINT},
+            </if>
+            <if test="isSubscription != null">
+                is_subscription = #{isSubscription,jdbcType=INTEGER},
+            </if>
+            <if test="vipRelationNum != null">
+                vip_relation_num = #{vipRelationNum,jdbcType=INTEGER},
+            </if>
+            <if test="subscriptionNum != null">
+                subscription_num = #{subscriptionNum,jdbcType=INTEGER},
+            </if>
+            <if test="bookChapterChargeStart != null">
+                book_chapter_charge_start = #{bookChapterChargeStart,jdbcType=INTEGER},
+            </if>
+            <if test="orangeCallback != null">
+                orange_callback = #{orangeCallback,jdbcType=TINYINT},
+            </if>
+            <if test="showVipAtHome != null">
+                show_vip_at_home = #{showVipAtHome,jdbcType=TINYINT},
+            </if>
+            <if test="blockIosUserSwitch != null">
+                block_ios_user_switch = #{blockIosUserSwitch,jdbcType=TINYINT},
+            </if>
+            <if test="extend != null">
+                extend = #{extend,jdbcType=OTHER},
+            </if>
+            <if test="callbackTimeMpAll != null">
+                callback_time_mp_all = #{callbackTimeMpAll,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeMpMoney != null">
+                callback_time_mp_money = #{callbackTimeMpMoney,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeMpHour != null">
+                callback_time_mp_hour = #{callbackTimeMpHour,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeBaidu != null">
+                callback_time_baidu = #{callbackTimeBaidu,jdbcType=TINYINT},
+            </if>
+            <if test="callbackTimeOppo != null">
+                callback_time_oppo = #{callbackTimeOppo,jdbcType=TINYINT},
+            </if>
+            <if test="baiduCallback != null">
+                baidu_callback = #{baiduCallback,jdbcType=TINYINT},
+            </if>
+            <if test="oppoCallback != null">
+                oppo_callback = #{oppoCallback,jdbcType=TINYINT},
+            </if>
+        </set>
+        where admin_id = #{adminId,jdbcType=INTEGER}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.AdminConfig">
+        update admin_config
+        set is_fouce                    = #{isFouce,jdbcType=OTHER},
+            entryhost_id                = #{entryhostId,jdbcType=INTEGER},
+            platform_list               = #{platformList,jdbcType=VARCHAR},
+            platform_id                 = #{platformId,jdbcType=INTEGER},
+            menu_platform_id            = #{menuPlatformId,jdbcType=INTEGER},
+            ophost_id                   = #{ophostId,jdbcType=INTEGER},
+            wxpay_id                    = #{wxpayId,jdbcType=INTEGER},
+            fans_count                  = #{fansCount,jdbcType=INTEGER},
+            appid                       = #{appid,jdbcType=VARCHAR},
+            secret                      = #{secret,jdbcType=VARCHAR},
+            txt                         = #{txt,jdbcType=VARCHAR},
+            refresh_token               = #{refreshToken,jdbcType=VARCHAR},
+            json                        = #{json,jdbcType=OTHER},
+            wx_menu                     = #{wxMenu,jdbcType=OTHER},
+            is_auth                     = #{isAuth,jdbcType=OTHER},
+            qrcode_image                = #{qrcodeImage,jdbcType=VARCHAR},
+            book_guide_chapter_idx      = #{bookGuideChapterIdx,jdbcType=INTEGER},
+            book_chapter_price          = #{bookChapterPrice,jdbcType=INTEGER},
+            subscribe_method            = #{subscribeMethod,jdbcType=OTHER},
+            subscribe_url               = #{subscribeUrl,jdbcType=VARCHAR},
+            manager_contact             = #{managerContact,jdbcType=VARCHAR},
+            new_user_activity           = #{newUserActivity,jdbcType=OTHER},
+            unpay_tip                   = #{unpayTip,jdbcType=OTHER},
+            read_tip                    = #{readTip,jdbcType=OTHER},
+            continueread_tip            = #{continuereadTip,jdbcType=OTHER},
+            sign_tip                    = #{signTip,jdbcType=OTHER},
+            morning_pattern             = #{morningPattern,jdbcType=OTHER},
+            subscribe_tip               = #{subscribeTip,jdbcType=OTHER},
+            update_tip                  = #{updateTip,jdbcType=OTHER},
+            search_tip                  = #{searchTip,jdbcType=OTHER},
+            timing_tip                  = #{timingTip,jdbcType=OTHER},
+            like_tip                    = #{likeTip,jdbcType=OTHER},
+            page_sex                    = #{pageSex,jdbcType=OTHER},
+            page_title                  = #{pageTitle,jdbcType=OTHER},
+            vip_num                     = #{vipNum,jdbcType=INTEGER},
+            normal_num                  = #{normalNum,jdbcType=INTEGER},
+            is_blacklist                = #{isBlacklist,jdbcType=BOOLEAN},
+            agent_vip_num               = #{agentVipNum,jdbcType=INTEGER},
+            agent_normal_num            = #{agentNormalNum,jdbcType=INTEGER},
+            agent_is_blacklist          = #{agentIsBlacklist,jdbcType=BOOLEAN},
+            createtime                  = #{createtime,jdbcType=INTEGER},
+            updatetime                  = #{updatetime,jdbcType=INTEGER},
+            menuophost_id               = #{menuophostId,jdbcType=INTEGER},
+            menuwxpay_id                = #{menuwxpayId,jdbcType=INTEGER},
+            fakeophost_id               = #{fakeophostId,jdbcType=INTEGER},
+            fakemenuophost_id           = #{fakemenuophostId,jdbcType=INTEGER},
+            kl_rate                     = #{klRate,jdbcType=DECIMAL},
+            custom_goods                = #{customGoods,jdbcType=TINYINT},
+            vip_state                   = #{vipState,jdbcType=BOOLEAN},
+            wx_ad_state                 = #{wxAdState,jdbcType=BOOLEAN},
+            vip_goods_id                = #{vipGoodsId,jdbcType=INTEGER},
+            vip_pay_tpl                 = #{vipPayTpl,jdbcType=VARCHAR},
+            ref_out_push                = #{refOutPush,jdbcType=BOOLEAN},
+            guide_domain                = #{guideDomain,jdbcType=OTHER},
+            wx_ad_source_id             = #{wxAdSourceId,jdbcType=BIGINT},
+            is_account_self             = #{isAccountSelf,jdbcType=OTHER},
+            give_kandian                = #{giveKandian,jdbcType=OTHER},
+            activity_show_recharge_page = #{activityShowRechargePage,jdbcType=TINYINT},
+            subscribe_delay             = #{subscribeDelay,jdbcType=OTHER},
+            palmpay_sub_account_ids     = #{palmpaySubAccountIds,jdbcType=OTHER},
+            first_recharge_imgtext_post = #{firstRechargeImgtextPost,jdbcType=OTHER},
+            order_unrecharge_post_time  = #{orderUnrechargePostTime,jdbcType=TINYINT},
+            is_qrcode_menu              = #{isQrcodeMenu,jdbcType=OTHER},
+            callback_time_tout          = #{callbackTimeTout,jdbcType=TINYINT},
+            callback_time_mp            = #{callbackTimeMp,jdbcType=TINYINT},
+            callback_time_gdt           = #{callbackTimeGdt,jdbcType=TINYINT},
+            vip_custom_money            = #{vipCustomMoney,jdbcType=FLOAT},
+            callback_time_uc            = #{callbackTimeUc,jdbcType=TINYINT},
+            vip_goods_id_custom         = #{vipGoodsIdCustom,jdbcType=INTEGER},
+            gdt_mp_report_state         = #{gdtMpReportState,jdbcType=TINYINT},
+            is_subscription             = #{isSubscription,jdbcType=INTEGER},
+            vip_relation_num            = #{vipRelationNum,jdbcType=INTEGER},
+            subscription_num            = #{subscriptionNum,jdbcType=INTEGER},
+            book_chapter_charge_start   = #{bookChapterChargeStart,jdbcType=INTEGER},
+            orange_callback             = #{orangeCallback,jdbcType=TINYINT},
+            show_vip_at_home            = #{showVipAtHome,jdbcType=TINYINT},
+            block_ios_user_switch       = #{blockIosUserSwitch,jdbcType=TINYINT},
+            extend                      = #{extend,jdbcType=OTHER},
+            callback_time_mp_all        = #{callbackTimeMpAll,jdbcType=TINYINT},
+            callback_time_mp_money      = #{callbackTimeMpMoney,jdbcType=TINYINT},
+            callback_time_mp_hour       = #{callbackTimeMpHour,jdbcType=TINYINT},
+            callback_time_baidu         = #{callbackTimeBaidu,jdbcType=TINYINT},
+            callback_time_oppo          = #{callbackTimeOppo,jdbcType=TINYINT},
+            baidu_callback              = #{baiduCallback,jdbcType=TINYINT},
+            oppo_callback               = #{oppoCallback,jdbcType=TINYINT}
+        where admin_id = #{adminId,jdbcType=INTEGER}
+    </update>
+</mapper>

+ 157 - 0
book-push/src/main/resources/mapper/ConfigMapper.xml

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.book.push.dao.mapper.ConfigMapper">
+    <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.Config">
+        <id column="id" jdbcType="INTEGER" property="id"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="group" jdbcType="VARCHAR" property="group"/>
+        <result column="title" jdbcType="VARCHAR" property="title"/>
+        <result column="tip" jdbcType="VARCHAR" property="tip"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="value" jdbcType="VARCHAR" property="value"/>
+        <result column="content" jdbcType="VARCHAR" property="content"/>
+        <result column="rule" jdbcType="VARCHAR" property="rule"/>
+        <result column="extend" jdbcType="VARCHAR" property="extend"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id, `name`, `group`, title, tip, `type`, `value`, content, `rule`, extend
+    </sql>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from config
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+    <select id="selectAll" resultType="com.book.push.dao.pojo.Config">
+        SELECT *
+        FROM config;
+    </select>
+    <select id="selectByName" resultType="com.book.push.dao.pojo.Config">
+        SELECT *
+        FROM config
+        WHERE name = #{name}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete
+        from config
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Config"
+            useGeneratedKeys="true">
+        insert into config (`name`, `group`, title,
+                            tip, `type`, `value`, content,
+                            `rule`, extend)
+        values (#{name,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
+                #{tip,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR},
+                #{content,jdbcType=VARCHAR},
+                #{rule,jdbcType=VARCHAR}, #{extend,jdbcType=VARCHAR})
+    </insert>
+    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Config"
+            useGeneratedKeys="true">
+        insert into config
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">
+                `name`,
+            </if>
+            <if test="group != null">
+                `group`,
+            </if>
+            <if test="title != null">
+                title,
+            </if>
+            <if test="tip != null">
+                tip,
+            </if>
+            <if test="type != null">
+                `type`,
+            </if>
+            <if test="value != null">
+                `value`,
+            </if>
+            <if test="content != null">
+                content,
+            </if>
+            <if test="rule != null">
+                `rule`,
+            </if>
+            <if test="extend != null">
+                extend,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="group != null">
+                #{group,jdbcType=VARCHAR},
+            </if>
+            <if test="title != null">
+                #{title,jdbcType=VARCHAR},
+            </if>
+            <if test="tip != null">
+                #{tip,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="value != null">
+                #{value,jdbcType=VARCHAR},
+            </if>
+            <if test="content != null">
+                #{content,jdbcType=VARCHAR},
+            </if>
+            <if test="rule != null">
+                #{rule,jdbcType=VARCHAR},
+            </if>
+            <if test="extend != null">
+                #{extend,jdbcType=VARCHAR},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.Config">
+        update config
+        <set>
+            <if test="name != null">
+                `name` = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="group != null">
+                `group` = #{group,jdbcType=VARCHAR},
+            </if>
+            <if test="title != null">
+                title = #{title,jdbcType=VARCHAR},
+            </if>
+            <if test="tip != null">
+                tip = #{tip,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                `type` = #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="value != null">
+                `value` = #{value,jdbcType=VARCHAR},
+            </if>
+            <if test="content != null">
+                content = #{content,jdbcType=VARCHAR},
+            </if>
+            <if test="rule != null">
+                `rule` = #{rule,jdbcType=VARCHAR},
+            </if>
+            <if test="extend != null">
+                extend = #{extend,jdbcType=VARCHAR},
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.Config">
+        update config
+        set `name`  = #{name,jdbcType=VARCHAR},
+            `group` = #{group,jdbcType=VARCHAR},
+            title   = #{title,jdbcType=VARCHAR},
+            tip     = #{tip,jdbcType=VARCHAR},
+            `type`  = #{type,jdbcType=VARCHAR},
+            `value` = #{value,jdbcType=VARCHAR},
+            content = #{content,jdbcType=VARCHAR},
+            `rule`  = #{rule,jdbcType=VARCHAR},
+            extend  = #{extend,jdbcType=VARCHAR}
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+</mapper>

+ 133 - 0
book-push/src/main/resources/mapper/OphostMapper.xml

@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.book.push.dao.mapper.OphostMapper">
+  <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.Ophost">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="platform_id" jdbcType="INTEGER" property="platformId" />
+    <result column="host" jdbcType="VARCHAR" property="host" />
+    <result column="hostfile" jdbcType="VARCHAR" property="hostfile" />
+    <result column="isdefault" jdbcType="OTHER" property="isdefault" />
+    <result column="status" jdbcType="OTHER" property="status" />
+    <result column="p_desc" jdbcType="VARCHAR" property="pDesc" />
+    <result column="sdfsdf" jdbcType="VARCHAR" property="sdfsdf" />
+    <result column="allow_changed" jdbcType="OTHER" property="allowChanged" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, platform_id, `host`, hostfile, isdefault, `status`, p_desc, sdfsdf, allow_changed
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from ophost
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from ophost
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Ophost" useGeneratedKeys="true">
+    insert into ophost (platform_id, `host`, hostfile, 
+      isdefault, `status`, p_desc, 
+      sdfsdf, allow_changed)
+    values (#{platformId,jdbcType=INTEGER}, #{host,jdbcType=VARCHAR}, #{hostfile,jdbcType=VARCHAR}, 
+      #{isdefault,jdbcType=OTHER}, #{status,jdbcType=OTHER}, #{pDesc,jdbcType=VARCHAR}, 
+      #{sdfsdf,jdbcType=VARCHAR}, #{allowChanged,jdbcType=OTHER})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Ophost" useGeneratedKeys="true">
+    insert into ophost
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="platformId != null">
+        platform_id,
+      </if>
+      <if test="host != null">
+        `host`,
+      </if>
+      <if test="hostfile != null">
+        hostfile,
+      </if>
+      <if test="isdefault != null">
+        isdefault,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="pDesc != null">
+        p_desc,
+      </if>
+      <if test="sdfsdf != null">
+        sdfsdf,
+      </if>
+      <if test="allowChanged != null">
+        allow_changed,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="platformId != null">
+        #{platformId,jdbcType=INTEGER},
+      </if>
+      <if test="host != null">
+        #{host,jdbcType=VARCHAR},
+      </if>
+      <if test="hostfile != null">
+        #{hostfile,jdbcType=VARCHAR},
+      </if>
+      <if test="isdefault != null">
+        #{isdefault,jdbcType=OTHER},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=OTHER},
+      </if>
+      <if test="pDesc != null">
+        #{pDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="sdfsdf != null">
+        #{sdfsdf,jdbcType=VARCHAR},
+      </if>
+      <if test="allowChanged != null">
+        #{allowChanged,jdbcType=OTHER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.Ophost">
+    update ophost
+    <set>
+      <if test="platformId != null">
+        platform_id = #{platformId,jdbcType=INTEGER},
+      </if>
+      <if test="host != null">
+        `host` = #{host,jdbcType=VARCHAR},
+      </if>
+      <if test="hostfile != null">
+        hostfile = #{hostfile,jdbcType=VARCHAR},
+      </if>
+      <if test="isdefault != null">
+        isdefault = #{isdefault,jdbcType=OTHER},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=OTHER},
+      </if>
+      <if test="pDesc != null">
+        p_desc = #{pDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="sdfsdf != null">
+        sdfsdf = #{sdfsdf,jdbcType=VARCHAR},
+      </if>
+      <if test="allowChanged != null">
+        allow_changed = #{allowChanged,jdbcType=OTHER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.Ophost">
+    update ophost
+    set platform_id = #{platformId,jdbcType=INTEGER},
+      `host` = #{host,jdbcType=VARCHAR},
+      hostfile = #{hostfile,jdbcType=VARCHAR},
+      isdefault = #{isdefault,jdbcType=OTHER},
+      `status` = #{status,jdbcType=OTHER},
+      p_desc = #{pDesc,jdbcType=VARCHAR},
+      sdfsdf = #{sdfsdf,jdbcType=VARCHAR},
+      allow_changed = #{allowChanged,jdbcType=OTHER}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 207 - 0
book-push/src/main/resources/mapper/PlatformMapper.xml

@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.book.push.dao.mapper.PlatformMapper">
+  <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.Platform">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="appid" jdbcType="VARCHAR" property="appid" />
+    <result column="secret" jdbcType="VARCHAR" property="secret" />
+    <result column="token" jdbcType="VARCHAR" property="token" />
+    <result column="aes_key" jdbcType="VARCHAR" property="aesKey" />
+    <result column="platfile" jdbcType="VARCHAR" property="platfile" />
+    <result column="status" jdbcType="OTHER" property="status" />
+    <result column="p_desc" jdbcType="VARCHAR" property="pDesc" />
+    <result column="isdefault" jdbcType="OTHER" property="isdefault" />
+    <result column="createtime" jdbcType="INTEGER" property="createtime" />
+    <result column="updatetime" jdbcType="INTEGER" property="updatetime" />
+    <result column="authhost" jdbcType="VARCHAR" property="authhost" />
+    <result column="proxy_config" jdbcType="VARCHAR" property="proxyConfig" />
+    <result column="job_proxy_config" jdbcType="VARCHAR" property="jobProxyConfig" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, `name`, appid, secret, token, aes_key, platfile, `status`, p_desc, isdefault, 
+    createtime, updatetime, authhost, proxy_config, job_proxy_config
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from platform
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+    <select id="selectAll" resultType="com.book.push.dao.pojo.Platform">
+      SELECT * FROM platform;
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from platform
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Platform" useGeneratedKeys="true">
+    insert into platform (`name`, appid, secret, 
+      token, aes_key, platfile, 
+      `status`, p_desc, isdefault, 
+      createtime, updatetime, authhost, 
+      proxy_config, job_proxy_config)
+    values (#{name,jdbcType=VARCHAR}, #{appid,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}, 
+      #{token,jdbcType=VARCHAR}, #{aesKey,jdbcType=VARCHAR}, #{platfile,jdbcType=VARCHAR}, 
+      #{status,jdbcType=OTHER}, #{pDesc,jdbcType=VARCHAR}, #{isdefault,jdbcType=OTHER}, 
+      #{createtime,jdbcType=INTEGER}, #{updatetime,jdbcType=INTEGER}, #{authhost,jdbcType=VARCHAR}, 
+      #{proxyConfig,jdbcType=VARCHAR}, #{jobProxyConfig,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Platform" useGeneratedKeys="true">
+    insert into platform
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="name != null">
+        `name`,
+      </if>
+      <if test="appid != null">
+        appid,
+      </if>
+      <if test="secret != null">
+        secret,
+      </if>
+      <if test="token != null">
+        token,
+      </if>
+      <if test="aesKey != null">
+        aes_key,
+      </if>
+      <if test="platfile != null">
+        platfile,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="pDesc != null">
+        p_desc,
+      </if>
+      <if test="isdefault != null">
+        isdefault,
+      </if>
+      <if test="createtime != null">
+        createtime,
+      </if>
+      <if test="updatetime != null">
+        updatetime,
+      </if>
+      <if test="authhost != null">
+        authhost,
+      </if>
+      <if test="proxyConfig != null">
+        proxy_config,
+      </if>
+      <if test="jobProxyConfig != null">
+        job_proxy_config,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="appid != null">
+        #{appid,jdbcType=VARCHAR},
+      </if>
+      <if test="secret != null">
+        #{secret,jdbcType=VARCHAR},
+      </if>
+      <if test="token != null">
+        #{token,jdbcType=VARCHAR},
+      </if>
+      <if test="aesKey != null">
+        #{aesKey,jdbcType=VARCHAR},
+      </if>
+      <if test="platfile != null">
+        #{platfile,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=OTHER},
+      </if>
+      <if test="pDesc != null">
+        #{pDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="isdefault != null">
+        #{isdefault,jdbcType=OTHER},
+      </if>
+      <if test="createtime != null">
+        #{createtime,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=INTEGER},
+      </if>
+      <if test="authhost != null">
+        #{authhost,jdbcType=VARCHAR},
+      </if>
+      <if test="proxyConfig != null">
+        #{proxyConfig,jdbcType=VARCHAR},
+      </if>
+      <if test="jobProxyConfig != null">
+        #{jobProxyConfig,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.Platform">
+    update platform
+    <set>
+      <if test="name != null">
+        `name` = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="appid != null">
+        appid = #{appid,jdbcType=VARCHAR},
+      </if>
+      <if test="secret != null">
+        secret = #{secret,jdbcType=VARCHAR},
+      </if>
+      <if test="token != null">
+        token = #{token,jdbcType=VARCHAR},
+      </if>
+      <if test="aesKey != null">
+        aes_key = #{aesKey,jdbcType=VARCHAR},
+      </if>
+      <if test="platfile != null">
+        platfile = #{platfile,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=OTHER},
+      </if>
+      <if test="pDesc != null">
+        p_desc = #{pDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="isdefault != null">
+        isdefault = #{isdefault,jdbcType=OTHER},
+      </if>
+      <if test="createtime != null">
+        createtime = #{createtime,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        updatetime = #{updatetime,jdbcType=INTEGER},
+      </if>
+      <if test="authhost != null">
+        authhost = #{authhost,jdbcType=VARCHAR},
+      </if>
+      <if test="proxyConfig != null">
+        proxy_config = #{proxyConfig,jdbcType=VARCHAR},
+      </if>
+      <if test="jobProxyConfig != null">
+        job_proxy_config = #{jobProxyConfig,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.Platform">
+    update platform
+    set `name` = #{name,jdbcType=VARCHAR},
+      appid = #{appid,jdbcType=VARCHAR},
+      secret = #{secret,jdbcType=VARCHAR},
+      token = #{token,jdbcType=VARCHAR},
+      aes_key = #{aesKey,jdbcType=VARCHAR},
+      platfile = #{platfile,jdbcType=VARCHAR},
+      `status` = #{status,jdbcType=OTHER},
+      p_desc = #{pDesc,jdbcType=VARCHAR},
+      isdefault = #{isdefault,jdbcType=OTHER},
+      createtime = #{createtime,jdbcType=INTEGER},
+      updatetime = #{updatetime,jdbcType=INTEGER},
+      authhost = #{authhost,jdbcType=VARCHAR},
+      proxy_config = #{proxyConfig,jdbcType=VARCHAR},
+      job_proxy_config = #{jobProxyConfig,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 102 - 0
book-push/src/main/resources/mapper/PtokenDao.xml

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.book.push.dao.mapper.PtokenDao">
+  <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.Ptoken">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="platform_id" jdbcType="INTEGER" property="platformId" />
+    <result column="refresh_token" jdbcType="VARCHAR" property="refreshToken" />
+    <result column="admin_id" jdbcType="VARCHAR" property="adminId" />
+    <result column="createtime" jdbcType="INTEGER" property="createtime" />
+    <result column="updatetime" jdbcType="INTEGER" property="updatetime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, platform_id, refresh_token, admin_id, createtime, updatetime
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from ptoken
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+    <select id="selectAll" resultType="com.book.push.dao.pojo.Ptoken">
+        select * from ptoken;
+
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from ptoken
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Ptoken" useGeneratedKeys="true">
+    insert into ptoken (platform_id, refresh_token, admin_id, 
+      createtime, updatetime)
+    values (#{platformId,jdbcType=INTEGER}, #{refreshToken,jdbcType=VARCHAR}, #{adminId,jdbcType=VARCHAR}, 
+      #{createtime,jdbcType=INTEGER}, #{updatetime,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.Ptoken" useGeneratedKeys="true">
+    insert into ptoken
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="platformId != null">
+        platform_id,
+      </if>
+      <if test="refreshToken != null">
+        refresh_token,
+      </if>
+      <if test="adminId != null">
+        admin_id,
+      </if>
+      <if test="createtime != null">
+        createtime,
+      </if>
+      <if test="updatetime != null">
+        updatetime,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="platformId != null">
+        #{platformId,jdbcType=INTEGER},
+      </if>
+      <if test="refreshToken != null">
+        #{refreshToken,jdbcType=VARCHAR},
+      </if>
+      <if test="adminId != null">
+        #{adminId,jdbcType=VARCHAR},
+      </if>
+      <if test="createtime != null">
+        #{createtime,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.Ptoken">
+    update ptoken
+    <set>
+      <if test="platformId != null">
+        platform_id = #{platformId,jdbcType=INTEGER},
+      </if>
+      <if test="refreshToken != null">
+        refresh_token = #{refreshToken,jdbcType=VARCHAR},
+      </if>
+      <if test="adminId != null">
+        admin_id = #{adminId,jdbcType=VARCHAR},
+      </if>
+      <if test="createtime != null">
+        createtime = #{createtime,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        updatetime = #{updatetime,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.Ptoken">
+    update ptoken
+    set platform_id = #{platformId,jdbcType=INTEGER},
+      refresh_token = #{refreshToken,jdbcType=VARCHAR},
+      admin_id = #{adminId,jdbcType=VARCHAR},
+      createtime = #{createtime,jdbcType=INTEGER},
+      updatetime = #{updatetime,jdbcType=INTEGER}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 3 - 0
book-push/src/main/resources/mapper/UserMapper.xml

@@ -61,6 +61,9 @@
 
 
 
+    </select>
+    <select id="selectByOpenId" resultType="com.book.push.dao.pojo.User">
+      SELECT * from user WHERE openid = #{openid}
     </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from user

+ 157 - 0
book-push/src/main/resources/mapper/UserSilentMapper.xml

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.book.push.dao.mapper.UserSilentMapper">
+  <resultMap id="BaseResultMap" type="com.book.push.dao.pojo.UserSilent">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="user_id" jdbcType="BIGINT" property="userId" />
+    <result column="channel_id" jdbcType="INTEGER" property="channelId" />
+    <result column="openid" jdbcType="VARCHAR" property="openid" />
+    <result column="tri_channel_id" jdbcType="INTEGER" property="triChannelId" />
+    <result column="tri_openid" jdbcType="VARCHAR" property="triOpenid" />
+    <result column="tri_appid" jdbcType="VARCHAR" property="triAppid" />
+    <result column="updatetime" jdbcType="INTEGER" property="updatetime" />
+    <result column="createtime" jdbcType="INTEGER" property="createtime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, user_id, channel_id, openid, tri_channel_id, tri_openid, tri_appid, updatetime, 
+    createtime
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from user_silent
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+    <select id="selectByUserSlient" resultType="com.book.push.dao.pojo.UserSilent">
+      select * from user_silent
+      <trim prefix="WHERE" prefixOverrides="AND | OR">
+        <if test="user_id!=null and user_id!=''">
+          and user_id != #{user_id}
+        </if>
+        <if test="channel_id!=null and channel_id!=''">
+          and channel_id != #{channel_id}
+        </if>
+        <if test="openid!=null and openid!=0">
+          and openid != #{openid}
+        </if>
+        <if test="tri_appid!=null and tri_appid!=0">
+          and tri_appid != #{tri_appid}
+        </if>
+        <if test="tri_openid!=null and tri_openid!=0">
+          and tri_openid != #{tri_openid}
+        </if>
+
+
+      </trim>
+
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from user_silent
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.UserSilent" useGeneratedKeys="true">
+    insert into user_silent (user_id, channel_id, openid, 
+      tri_channel_id, tri_openid, tri_appid, 
+      updatetime, createtime)
+    values (#{userId,jdbcType=BIGINT}, #{channelId,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, 
+      #{triChannelId,jdbcType=INTEGER}, #{triOpenid,jdbcType=VARCHAR}, #{triAppid,jdbcType=VARCHAR}, 
+      #{updatetime,jdbcType=INTEGER}, #{createtime,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.book.push.dao.pojo.UserSilent" useGeneratedKeys="true">
+    insert into user_silent
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="channelId != null">
+        channel_id,
+      </if>
+      <if test="openid != null">
+        openid,
+      </if>
+      <if test="triChannelId != null">
+        tri_channel_id,
+      </if>
+      <if test="triOpenid != null">
+        tri_openid,
+      </if>
+      <if test="triAppid != null">
+        tri_appid,
+      </if>
+      <if test="updatetime != null">
+        updatetime,
+      </if>
+      <if test="createtime != null">
+        createtime,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="userId != null">
+        #{userId,jdbcType=BIGINT},
+      </if>
+      <if test="channelId != null">
+        #{channelId,jdbcType=INTEGER},
+      </if>
+      <if test="openid != null">
+        #{openid,jdbcType=VARCHAR},
+      </if>
+      <if test="triChannelId != null">
+        #{triChannelId,jdbcType=INTEGER},
+      </if>
+      <if test="triOpenid != null">
+        #{triOpenid,jdbcType=VARCHAR},
+      </if>
+      <if test="triAppid != null">
+        #{triAppid,jdbcType=VARCHAR},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=INTEGER},
+      </if>
+      <if test="createtime != null">
+        #{createtime,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.book.push.dao.pojo.UserSilent">
+    update user_silent
+    <set>
+      <if test="userId != null">
+        user_id = #{userId,jdbcType=BIGINT},
+      </if>
+      <if test="channelId != null">
+        channel_id = #{channelId,jdbcType=INTEGER},
+      </if>
+      <if test="openid != null">
+        openid = #{openid,jdbcType=VARCHAR},
+      </if>
+      <if test="triChannelId != null">
+        tri_channel_id = #{triChannelId,jdbcType=INTEGER},
+      </if>
+      <if test="triOpenid != null">
+        tri_openid = #{triOpenid,jdbcType=VARCHAR},
+      </if>
+      <if test="triAppid != null">
+        tri_appid = #{triAppid,jdbcType=VARCHAR},
+      </if>
+      <if test="updatetime != null">
+        updatetime = #{updatetime,jdbcType=INTEGER},
+      </if>
+      <if test="createtime != null">
+        createtime = #{createtime,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.book.push.dao.pojo.UserSilent">
+    update user_silent
+    set user_id = #{userId,jdbcType=BIGINT},
+      channel_id = #{channelId,jdbcType=INTEGER},
+      openid = #{openid,jdbcType=VARCHAR},
+      tri_channel_id = #{triChannelId,jdbcType=INTEGER},
+      tri_openid = #{triOpenid,jdbcType=VARCHAR},
+      tri_appid = #{triAppid,jdbcType=VARCHAR},
+      updatetime = #{updatetime,jdbcType=INTEGER},
+      createtime = #{createtime,jdbcType=INTEGER}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>