commit c8b10b13f296bc921f3d82ad62ee9430b51f5131
Author: zhizhi wu <2377881365@qq.com>
Date: Thu Mar 10 18:24:06 2022 +0800
first commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..073a042
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,43 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Example user template template
+### Example user template
+target
+target/
+target/*
+# IntelliJ project files
+.idea
+.idea/
+.idea/*
+*.iml
+.mvn
+.mvn/
+.mvn/*
+out
+gen
+### Java template
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+mbg.xml
+resources/mbg.xml
+resources/application.yml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..5c98b42
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..6f7d158
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dictionaries/23778.xml b/.idea/dictionaries/23778.xml
new file mode 100644
index 0000000..798db79
--- /dev/null
+++ b/.idea/dictionaries/23778.xml
@@ -0,0 +1,7 @@
+
+
+
+ tencent
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63e9001
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..6560a98
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..e1f9d8f
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/braintraining.iml b/braintraining.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/braintraining.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..e0ec544
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,280 @@
+
+
+ 4.0.0
+
+ com.ccsens
+ braintraining
+ 1.0-SNAPSHOT
+
+
+ 1.8
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.8.RELEASE
+
+
+
+
+ com.ccsensptos
+ wechatutil
+ 1.0-SNAPSHOT
+ compile
+
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
+ com.ccsensptos
+ cloudutil
+
+
+
+
+ org.aspectj
+ aspectjweaver
+
+
+
+
+ io.netty
+ netty-all
+ 4.1.32.Final
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+ org.springframework.boot
+ spring-boot-starter-cache
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-jetty
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+ com.vaadin.external.google
+ android-json
+
+
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ cn.hutool
+ hutool-all
+ 4.1.21
+
+
+
+
+ org.apache.poi
+ poi
+ 3.17
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.17
+
+
+
+ org.springframework.boot
+ spring-boot-starter-websocket
+
+
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.1.1
+
+
+
+ com.github.pagehelper
+ pagehelper
+ 4.1.4
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ com.alibaba
+ druid
+ 1.1.10
+
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.7.0
+
+
+
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-xml
+ 2.9.0
+
+
+
+
+
+
+ org.apache.shiro
+ shiro-spring
+ 1.4.0
+
+
+
+ org.apache.shiro
+ shiro-ehcache
+ 1.4.0
+
+
+
+ net.sourceforge.htmlcleaner
+ htmlcleaner
+ 2.22
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.8.1
+
+
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.9.2
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.9.2
+
+
+
+ org.mybatis.generator
+ mybatis-generator-core
+ 1.3.7
+
+
+
+
+ org.beanshell
+ bsh
+ 2.0b5
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.1
+
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.3
+
+
+
+ com.github.qcloudsms
+ qcloudsms
+ 1.0.5
+
+
+ com.alibaba
+ fastjson
+ 1.2.62
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.mybatis.generator
+ mybatis-generator-maven-plugin
+ 1.3.7
+
+ ${basedir}/src/main/resources/mbg.xml
+ true
+
+
+
+ mysql
+ mysql-connector-java
+ 5.1.34
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/ccsens/braintraining/BrainTrainingApplication.java b/src/main/java/com/ccsens/braintraining/BrainTrainingApplication.java
new file mode 100644
index 0000000..1025534
--- /dev/null
+++ b/src/main/java/com/ccsens/braintraining/BrainTrainingApplication.java
@@ -0,0 +1,24 @@
+package com.ccsens.braintraining;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.ComponentScan;
+
+/**
+ * @description:
+ * @author: whj
+ * @time: 2022/3/4 9:34
+ */
+@MapperScan(basePackages = {"com.ccsens.braintraining.persist.*"})
+@ServletComponentScan
+@EnableCaching
+@SpringBootApplication
+@ComponentScan(basePackages = {"com.ccsens"})
+public class BrainTrainingApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(BrainTrainingApplication.class, args);
+ }
+}
diff --git a/src/main/java/com/ccsens/braintraining/api/DebugController.java b/src/main/java/com/ccsens/braintraining/api/DebugController.java
new file mode 100644
index 0000000..eb19586
--- /dev/null
+++ b/src/main/java/com/ccsens/braintraining/api/DebugController.java
@@ -0,0 +1,40 @@
+package com.ccsens.braintraining.api;
+
+import com.ccsens.util.JsonResponse;
+import com.ccsens.wechatutil.bean.dto.wxofficial.WxQrCodeDto;
+import com.ccsens.wechatutil.bean.vo.wxofficial.WxQrCodeVo;
+import com.ccsens.wechatutil.wxofficial.OfficialQrCodeUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.UUID;
+
+/**
+ * @description:
+ * @author: whj
+ * @time: 2022/3/8 8:42
+ */
+@Api(tags = "DEBUG" , description = "DebugController | ")
+@RestController
+@RequestMapping("/debug")
+@Slf4j
+public class DebugController {
+
+
+ @ApiOperation(value = "/测试",notes = "")
+ @ApiImplicitParams({
+ })
+ @RequestMapping(value="",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
+ public JsonResponse debug(HttpServletRequest request) throws Exception {
+
+
+ return JsonResponse.newInstance().ok("hello world!");
+ }
+
+}
diff --git a/src/main/java/com/ccsens/braintraining/api/WxTencentController.java b/src/main/java/com/ccsens/braintraining/api/WxTencentController.java
new file mode 100644
index 0000000..1feabac
--- /dev/null
+++ b/src/main/java/com/ccsens/braintraining/api/WxTencentController.java
@@ -0,0 +1,102 @@
+package com.ccsens.braintraining.api;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.ccsens.braintraining.service.IWxTencentService;
+import com.ccsens.util.JacksonUtil;
+import com.ccsens.util.JsonResponse;
+import com.ccsens.wechatutil.bean.dto.wxmini.NoticeDto;
+import com.ccsens.wechatutil.bean.dto.wxofficial.WxQrCodeDto;
+import com.ccsens.wechatutil.bean.vo.wxofficial.WxQrCodeVo;
+import com.ccsens.wechatutil.wxofficial.OfficialQrCodeUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.util.UUID;
+
+/**
+ * @description:
+ * @author: whj
+ * @time: 2022/3/8 9:31
+ */
+@Api(tags = "微信公众号相关" )
+@RestController
+@RequestMapping("/wxTencent")
+@Slf4j
+public class WxTencentController {
+
+ private String token = "ccsensChuanKong";
+ private String encodingAesKey = "nysgv5sKS5HPMMsHiVcDOE9BBCtX7Ho5DSv3s0qS9b9";
+
+ @Resource
+ private IWxTencentService wxTencetnService;
+
+
+
+ @ApiOperation(value = "/生成公众号临时二维码",notes = "")
+ @ApiImplicitParams({
+ })
+ @RequestMapping(value="createQrCode",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
+ public JsonResponse createQrCode(Long equipmentId) {
+ WxQrCodeVo.QrCodeUrl url = OfficialQrCodeUtil.send(new WxQrCodeDto.Create(7*24*60*60L, OfficialQrCodeUtil.QR_STR_SCENE, null, UUID.randomUUID().toString()),
+ "wxb3be21dcd7912555", "9213776254878a8065f1a29d1f58a02c");
+ String qrCodeUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + url.getTicket();
+ return JsonResponse.newInstance().ok(qrCodeUrl);
+ }
+
+
+ @ApiOperation(value = "接收公众号消息通知", notes = "")
+ @RequestMapping(value = "/notice", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
+ public String noticeGet(@Validated NoticeDto.ValidMsg validMsg) throws NoSuchAlgorithmException {
+ log.info("接收微信小程序token:{},token:{}",validMsg,token);
+ boolean check = validMsg.check(token);
+ log.info("校验结果:{}", check);
+ return check ? validMsg.getEchostr() : null;
+ }
+
+ @ApiOperation(value = "接收公众号消息通知", notes = "")
+ @RequestMapping(value = "/notice", method = RequestMethod.POST)
+ public String notice(HttpServletRequest request) throws IOException {
+ log.info("接收公众号消息通知:{}", request.getParameterMap());
+
+ BufferedReader reader = request.getReader();
+ StringBuilder builder = new StringBuilder();
+ String line;
+ while ((line = reader.readLine()) != null) {
+ builder.append(line);
+ }
+ log.info("获取参数:{}", builder.toString());
+ NoticeDto.Notice notice = JSONObject.parseObject(JacksonUtil.xmlToJson(builder.toString()), NoticeDto.Notice.class);
+
+
+ log.info("接收公众号消息息通知:{}", notice);
+ if (notice== null || StrUtil.isEmpty(notice.getContent())) {
+ return "success";
+ }
+ switch (notice.getEvent()) {
+ case "subscribe":
+ // 用户未关注时,进行关注后的事件推送
+ // 带参数二维码访问,EventKey有值,普通关注没有
+ break;
+ case "SCAN":
+ // 用户已关注时的事件推送
+ break;
+ case "unsubscribe":
+ // 取消订阅
+ break;
+ }
+ return "success";
+ }
+
+}
diff --git a/src/main/java/com/ccsens/braintraining/config/BeanConfig.java b/src/main/java/com/ccsens/braintraining/config/BeanConfig.java
new file mode 100644
index 0000000..7b181e8
--- /dev/null
+++ b/src/main/java/com/ccsens/braintraining/config/BeanConfig.java
@@ -0,0 +1,44 @@
+package com.ccsens.braintraining.config;
+
+import com.ccsens.braintraining.intercept.MybatisInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+/**
+ * @description:
+ * @author: wuHuiJuan
+ * @create: 2019/12/03 18:01
+ */
+@Configuration
+public class BeanConfig {
+ /**
+ * 注册拦截器
+ */
+ @Bean
+ public MybatisInterceptor mybatisInterceptor() {
+ MybatisInterceptor interceptor = new MybatisInterceptor();
+ return interceptor;
+ }
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ corsConfiguration.addAllowedOrigin("*");
+ corsConfiguration.addAllowedHeader("*");
+ corsConfiguration.addAllowedMethod("*");
+ // 预检请求的有效期,单位为秒。
+ corsConfiguration.setMaxAge(3600L);
+ // 是否支持安全证书(必需参数)
+ corsConfiguration.setAllowCredentials(true);
+ return corsConfiguration;
+ }
+
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+
+}
diff --git a/src/main/java/com/ccsens/braintraining/config/SpringConfig.java b/src/main/java/com/ccsens/braintraining/config/SpringConfig.java
new file mode 100644
index 0000000..3c97929
--- /dev/null
+++ b/src/main/java/com/ccsens/braintraining/config/SpringConfig.java
@@ -0,0 +1,141 @@
+package com.ccsens.braintraining.config;
+
+
+import cn.hutool.core.lang.Snowflake;
+import cn.hutool.core.util.IdUtil;
+import com.ccsens.util.PropUtil;
+import com.ccsens.util.config.DruidProps;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.*;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TimeZone;
+
+/**
+ * @author whj
+ */
+@Configuration
+public class SpringConfig implements WebMvcConfigurer {
+ @Resource
+ private DruidProps druidPropsUtil;
+ @Value("${spring.snowflake.workerId}")
+ private String workerId;
+ @Value("${spring.snowflake.dataCenterId}")
+ private String dataCenterId;
+
+
+ /**
+ * 配置Converter
+ * @return
+ */
+ @Bean
+ public HttpMessageConverter responseStringConverter() {
+ return new StringHttpMessageConverter(
+ Charset.forName("UTF-8"));
+ }
+
+ @Bean
+ public HttpMessageConverter