浏览代码

代码优化

gaodm 5 年之前
父节点
当前提交
533412041c

+ 5 - 5
xlcs-service/pom.xml

@@ -159,11 +159,11 @@
             <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.github.binarywang</groupId>
-            <artifactId>weixin-java-mp</artifactId>
-            <version>3.6.0</version>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>com.github.binarywang</groupId>-->
+            <!--<artifactId>weixin-java-mp</artifactId>-->
+            <!--<version>3.6.0</version>-->
+        <!--</dependency>-->
 
         <dependency>
             <groupId>io.github.lvyahui8</groupId>

+ 47 - 47
xlcs-service/src/main/java/com/diagbot/config/wx/WxMpConfiguration.java

@@ -1,47 +1,47 @@
-package com.diagbot.config.wx;
-
-import lombok.AllArgsConstructor;
-import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
-import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @author: gaodm
- * @time: 2020/2/5 19:52
- */
-@AllArgsConstructor
-@Configuration
-@EnableConfigurationProperties(WxMpProperties.class)
-public class WxMpConfiguration {
-
-    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("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
-        }
-
-        WxMpService service = new WxMpServiceImpl();
-        service.setMultiConfigStorages(configs
-                .stream().map(a -> {
-                    WxMpDefaultConfigImpl 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;
-    }
-
-}
+//package com.diagbot.config.wx;
+//
+//import lombok.AllArgsConstructor;
+//import me.chanjar.weixin.mp.api.WxMpService;
+//import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
+//import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
+//import org.springframework.boot.context.properties.EnableConfigurationProperties;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//
+//import java.util.List;
+//import java.util.stream.Collectors;
+//
+///**
+// * @Description:
+// * @author: gaodm
+// * @time: 2020/2/5 19:52
+// */
+//@AllArgsConstructor
+//@Configuration
+//@EnableConfigurationProperties(WxMpProperties.class)
+//public class WxMpConfiguration {
+//
+//    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("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
+//        }
+//
+//        WxMpService service = new WxMpServiceImpl();
+//        service.setMultiConfigStorages(configs
+//                .stream().map(a -> {
+//                    WxMpDefaultConfigImpl 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;
+//    }
+//
+//}

+ 46 - 46
xlcs-service/src/main/java/com/diagbot/config/wx/WxMpProperties.java

@@ -1,46 +1,46 @@
-package com.diagbot.config.wx;
-
-import com.diagbot.util.FastJsonUtils;
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.util.List;
-
-/**
- * @Description:
- * @author: gaodm
- * @time: 2020/2/5 20:00
- */
-@Data
-@ConfigurationProperties(prefix = "wx.mp")
-public class WxMpProperties {
-    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;
-    }
-
-    @Override
-    public String toString() {
-        return FastJsonUtils.getBeanToJson(this);
-    }
-}
+//package com.diagbot.config.wx;
+//
+//import com.diagbot.util.FastJsonUtils;
+//import lombok.Data;
+//import org.springframework.boot.context.properties.ConfigurationProperties;
+//
+//import java.util.List;
+//
+///**
+// * @Description:
+// * @author: gaodm
+// * @time: 2020/2/5 20:00
+// */
+//@Data
+//@ConfigurationProperties(prefix = "wx.mp")
+//public class WxMpProperties {
+//    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;
+//    }
+//
+//    @Override
+//    public String toString() {
+//        return FastJsonUtils.getBeanToJson(this);
+//    }
+//}

+ 0 - 19
xlcs-service/src/main/java/com/diagbot/vo/QuestionIds2VO.java

@@ -1,19 +0,0 @@
-package com.diagbot.vo;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.List;
-
-/**
- * @Description:
- * @author: zhoutg
- * @time: 2018/8/6 10:16
- */
-@Getter
-@Setter
-public class QuestionIds2VO {
-    private List<Long> ids;
-    private Integer sexType;
-    private Integer age;
-}

+ 0 - 17
xlcs-service/src/main/java/com/diagbot/vo/QuestionVO.java

@@ -1,17 +0,0 @@
-package com.diagbot.vo;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @Description:
- * @author: zhoutg
- * @time: 2018/8/6 10:16
- */
-@Getter
-@Setter
-public class QuestionVO {
-    private Long id;
-    private Integer sexType;
-    private Integer age;
-}

+ 64 - 64
xlcs-service/src/main/java/com/diagbot/web/WeXinJsSdkController.java

@@ -1,64 +1,64 @@
-package com.diagbot.web;
-
-import com.diagbot.dto.RespDTO;
-import io.swagger.annotations.Api;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.bean.WxJsapiSignature;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.mp.api.WxMpService;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.annotations.ApiIgnore;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @Description:
- * @author: gaodm
- * @time: 2020/2/5 18:03
- */
-@AllArgsConstructor
-@RestController
-@Api(value = "微信验证", tags = { "微信验证API" })
-@SuppressWarnings("unchecked")
-@Slf4j
-@ApiIgnore
-@Deprecated
-@RequestMapping("jssdk/{appid}")
-public class WeXinJsSdkController {
-
-    private final WxMpService wxMpService;
-
-    @RequestMapping(value = "/config", method = RequestMethod.GET)
-    public RespDTO<WxJsapiSignature> wxJsSdkConfig(HttpServletRequest request, @PathVariable String appid, String url) {
-        if (!this.wxMpService.switchover(appid)) {
-            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
-        }
-
-        try { // 直接调用wxMpServer 接口
-            WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url);
-            log.info("createJsapiSignature被调用了~~~");
-            return RespDTO.onSuc(wxJsapiSignature);
-        } catch (WxErrorException e) {
-            return null;
-        }
-    }
-
-    @RequestMapping(value = "/ticket", method = RequestMethod.GET)
-    public RespDTO<String> wxjsapiTicket(HttpServletRequest request, @PathVariable String appid) {
-        if (!this.wxMpService.switchover(appid)) {
-            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
-        }
-
-        try { // 直接调用wxMpServer 接口
-            String jsapiTicket = wxMpService.getJsapiTicket();
-            return RespDTO.onSuc(jsapiTicket);
-        } catch (WxErrorException e) {
-            return null;
-        }
-    }
-
-}
+//package com.diagbot.web;
+//
+//import com.diagbot.dto.RespDTO;
+//import io.swagger.annotations.Api;
+//import lombok.AllArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import me.chanjar.weixin.common.bean.WxJsapiSignature;
+//import me.chanjar.weixin.common.error.WxErrorException;
+//import me.chanjar.weixin.mp.api.WxMpService;
+//import org.springframework.web.bind.annotation.PathVariable;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RequestMethod;
+//import org.springframework.web.bind.annotation.RestController;
+//import springfox.documentation.annotations.ApiIgnore;
+//
+//import javax.servlet.http.HttpServletRequest;
+//
+///**
+// * @Description:
+// * @author: gaodm
+// * @time: 2020/2/5 18:03
+// */
+//@AllArgsConstructor
+//@RestController
+//@Api(value = "微信验证", tags = { "微信验证API" })
+//@SuppressWarnings("unchecked")
+//@Slf4j
+//@ApiIgnore
+//@Deprecated
+//@RequestMapping("jssdk/{appid}")
+//public class WeXinJsSdkController {
+//
+//    private final WxMpService wxMpService;
+//
+//    @RequestMapping(value = "/config", method = RequestMethod.GET)
+//    public RespDTO<WxJsapiSignature> wxJsSdkConfig(HttpServletRequest request, @PathVariable String appid, String url) {
+//        if (!this.wxMpService.switchover(appid)) {
+//            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+//        }
+//
+//        try { // 直接调用wxMpServer 接口
+//            WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url);
+//            log.info("createJsapiSignature被调用了~~~");
+//            return RespDTO.onSuc(wxJsapiSignature);
+//        } catch (WxErrorException e) {
+//            return null;
+//        }
+//    }
+//
+//    @RequestMapping(value = "/ticket", method = RequestMethod.GET)
+//    public RespDTO<String> wxjsapiTicket(HttpServletRequest request, @PathVariable String appid) {
+//        if (!this.wxMpService.switchover(appid)) {
+//            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+//        }
+//
+//        try { // 直接调用wxMpServer 接口
+//            String jsapiTicket = wxMpService.getJsapiTicket();
+//            return RespDTO.onSuc(jsapiTicket);
+//        } catch (WxErrorException e) {
+//            return null;
+//        }
+//    }
+//
+//}