diff --git a/exam-admin/pom.xml b/exam-admin/pom.xml
index b27b644..0b62a93 100644
--- a/exam-admin/pom.xml
+++ b/exam-admin/pom.xml
@@ -179,6 +179,12 @@
${wechatpay-apiv3.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
org.apache.httpcomponents
diff --git a/exam-admin/src/main/java/com/yf/exam/ability/Constant.java b/exam-admin/src/main/java/com/yf/exam/ability/Constant.java
deleted file mode 100644
index 9880ea6..0000000
--- a/exam-admin/src/main/java/com/yf/exam/ability/Constant.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.yf.exam.ability;
-
-
-/**
- * 通用常量
- * @author bool
- */
-public class Constant {
-
-
- /**
- * 文件上传路径
- */
- public static final String FILE_PREFIX = "/upload/file/";
-}
diff --git a/exam-admin/src/main/java/com/yf/exam/ability/shiro/aop/JwtFilter.java b/exam-admin/src/main/java/com/yf/exam/ability/shiro/aop/JwtFilter.java
index 88cf448..6af1d55 100644
--- a/exam-admin/src/main/java/com/yf/exam/ability/shiro/aop/JwtFilter.java
+++ b/exam-admin/src/main/java/com/yf/exam/ability/shiro/aop/JwtFilter.java
@@ -1,16 +1,14 @@
package com.yf.exam.ability.shiro.aop;
-
import com.yf.exam.ability.shiro.jwt.JwtToken;
import com.yf.exam.aspect.utils.InjectUtils;
-import com.yf.exam.modules.Constant;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
-
+import com.yf.exam.constant.Constants;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
/**
* 鉴权登录拦截器
@@ -42,7 +40,7 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
@Override
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
- String token = httpServletRequest.getHeader(Constant.TOKEN);
+ String token = httpServletRequest.getHeader(Constants.TOKEN);
JwtToken jwtToken = new JwtToken(token);
// 提交给realm进行登入,如果错误他会抛出异常并被捕获
diff --git a/exam-admin/src/main/java/com/yf/exam/ability/upload/controller/UploadController.java b/exam-admin/src/main/java/com/yf/exam/ability/upload/controller/UploadController.java
index d8b7035..7ec989f 100644
--- a/exam-admin/src/main/java/com/yf/exam/ability/upload/controller/UploadController.java
+++ b/exam-admin/src/main/java/com/yf/exam/ability/upload/controller/UploadController.java
@@ -1,14 +1,15 @@
package com.yf.exam.ability.upload.controller;
-
-import com.yf.exam.ability.Constant;
import com.yf.exam.ability.upload.dto.UploadReqDTO;
import com.yf.exam.ability.upload.dto.UploadRespDTO;
import com.yf.exam.ability.upload.service.UploadService;
+import com.yf.exam.constant.Constants;
import com.yf.exam.core.api.ApiRest;
import com.yf.exam.core.api.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -16,9 +17,6 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* 本地文件上传下载请求类
* @author bool
@@ -49,7 +47,7 @@ public class UploadController extends BaseController {
* @param request
* @param response
*/
- @GetMapping(Constant.FILE_PREFIX+"**")
+ @GetMapping(Constants.FILE_PREFIX+"**")
@ApiOperation(value = "文件下载", notes = "文件下载")
public void download(HttpServletRequest request, HttpServletResponse response) {
uploadService.download(request, response);
diff --git a/exam-admin/src/main/java/com/yf/exam/ability/upload/service/impl/UploadServiceImpl.java b/exam-admin/src/main/java/com/yf/exam/ability/upload/service/impl/UploadServiceImpl.java
index 802e8ab..f8cec70 100644
--- a/exam-admin/src/main/java/com/yf/exam/ability/upload/service/impl/UploadServiceImpl.java
+++ b/exam-admin/src/main/java/com/yf/exam/ability/upload/service/impl/UploadServiceImpl.java
@@ -1,6 +1,5 @@
package com.yf.exam.ability.upload.service.impl;
-import com.yf.exam.ability.Constant;
import com.yf.exam.ability.upload.config.UploadConfig;
import com.yf.exam.ability.upload.config.UploadPathConfig;
import com.yf.exam.ability.upload.dto.UploadReqDTO;
@@ -155,7 +154,7 @@ public class UploadServiceImpl implements UploadService {
*/
public String getRealPath(String uri){
- String regx = Constant.FILE_PREFIX+"(.*)";
+ String regx = Constants.FILE_PREFIX+"(.*)";
// 查找全部变量
Pattern pattern = Pattern.compile(regx);
diff --git a/exam-admin/src/main/java/com/yf/exam/config/AppletChatConfig.java b/exam-admin/src/main/java/com/yf/exam/config/AppletChatConfig.java
new file mode 100644
index 0000000..1631b74
--- /dev/null
+++ b/exam-admin/src/main/java/com/yf/exam/config/AppletChatConfig.java
@@ -0,0 +1,48 @@
+package com.yf.exam.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description 微信小程序参数配置类
+ * @Author 纪寒
+ * @Date 2022-09-02 10:52:38
+ * @Version 1.0
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "applet-chat-config")
+public class AppletChatConfig {
+
+ /**
+ * 小程序id
+ */
+ private String appletId;
+
+ /**
+ * 小程序secret
+ */
+ private String secret;
+
+ /**
+ * 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
+ */
+ private String lang;
+
+ /**
+ * 授权类型
+ */
+ private String grantType;
+
+ /**
+ * 微信小程序事件回调令牌
+ */
+ private String token;
+
+ /**
+ * 微信小程序事件回调消息加密密钥
+ */
+ private String encodingAesKey;
+
+}
diff --git a/exam-admin/src/main/java/com/yf/exam/config/ShiroConfig.java b/exam-admin/src/main/java/com/yf/exam/config/ShiroConfig.java
index 0f0e63a..09e081a 100644
--- a/exam-admin/src/main/java/com/yf/exam/config/ShiroConfig.java
+++ b/exam-admin/src/main/java/com/yf/exam/config/ShiroConfig.java
@@ -50,6 +50,9 @@ public class ShiroConfig {
map.put("/exam/api/sys/user/quick-reg", "anon");
map.put("/exam/api/sys/user/info", "anon");
+ // 小程序接口
+ map.put("/examApplet/**", "anon");
+
// 获取网站基本信息
map.put("/exam/api/sys/config/detail", "anon");
diff --git a/exam-admin/src/main/java/com/yf/exam/config/SwaggerConfig.java b/exam-admin/src/main/java/com/yf/exam/config/SwaggerConfig.java
index d4208aa..0c844f3 100644
--- a/exam-admin/src/main/java/com/yf/exam/config/SwaggerConfig.java
+++ b/exam-admin/src/main/java/com/yf/exam/config/SwaggerConfig.java
@@ -2,6 +2,7 @@ package com.yf.exam.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import io.swagger.annotations.ApiOperation;
+import java.util.Collections;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -16,8 +17,6 @@ import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
-import java.util.Collections;
-
/**
* Swagger配置
* @author bool
@@ -37,7 +36,8 @@ public class SwaggerConfig {
.groupName("考试模块接口")
.select()
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
- .paths(PathSelectors.ant("/exam/api/**"))
+ //.paths(PathSelectors.ant("/exam/api/**"))
+ .paths(PathSelectors.any())
.build()
.securitySchemes(Collections.singletonList(securityScheme()));
}
diff --git a/exam-admin/src/main/java/com/yf/exam/config/XinYiLuConfig.java b/exam-admin/src/main/java/com/yf/exam/config/XinYiLuConfig.java
new file mode 100644
index 0000000..fa66031
--- /dev/null
+++ b/exam-admin/src/main/java/com/yf/exam/config/XinYiLuConfig.java
@@ -0,0 +1,578 @@
+package com.yf.exam.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 读取项目相关配置
+ *
+ * @author xinyilu
+ */
+@Component
+@ConfigurationProperties(prefix = "xinyilu")
+public class XinYiLuConfig {
+ /**
+ * 项目名称
+ */
+ private String name;
+
+ /**
+ * 版本
+ */
+ private String version;
+
+ /**
+ * 版权年份
+ */
+ private String copyrightYear;
+
+ /**
+ * 实例演示开关
+ */
+ private boolean demoEnabled;
+
+ /**
+ * 上传路径
+ */
+ private static String profile;
+
+ /**
+ * 获取地址开关
+ */
+ private static boolean addressEnabled;
+
+ /**
+ * 验证码类型
+ */
+ private static String captchaType;
+
+ /**
+ * 柏杏家医云小程序图片存放路径
+ */
+ private String nurserAppletPicture;
+
+ /**
+ * 护理站图片上传存放路径
+ */
+ private String nurserStationPictureUrl;
+
+ /**
+ * 护理站图片上传存放路径
+ */
+ private String nurserStationIntroducePictureUrl;
+
+ /**
+ * 护理站项目图片上传存放路径
+ */
+ private String nurserStationItemPictureUrl;
+
+ /**
+ * 商品图片路径上传存放路径
+ */
+ private String goodsPictureUrl;
+
+ /**
+ * 商品属性图片地址
+ */
+ private String attributePitureUrl;
+
+ /**
+ * 修改会员App用户头像上传
+ */
+ private String headPictureUrl;
+
+ /**
+ * 评价信息图片上传路径
+ */
+ private String evaluatePictureUrl;
+
+ /**
+ * 任务完成上传图片
+ */
+ private String appointmentOrderDetailsUrl;
+
+ /**
+ * 护理机构上传图片
+ */
+ private String nurseStationClassifyUrl;
+
+ /**
+ * 海报图片存放路径
+ */
+ private String posterPictureUrl;
+
+ /**
+ * 海报视频存放路径
+ */
+ private String posterVideoUrl;
+
+ /**
+ * 资讯主缩略图地址
+ */
+ private String leadThumbnailUrl;
+
+ /**
+ * 商品分类图片地址
+ */
+ private String goodsCategoryPicture;
+
+ /**
+ * 护理员App人员头像的上传路径图片上传路径
+ */
+ private String nurseStationAppPersonUrl;
+
+ /**
+ * 获取管理端富文本的上传路径
+ */
+ private String richTextPictureUrl;
+
+ /**
+ * 护理项目分类图标存放地址存放路径
+ */
+ private String nurseItemClassifyUrl;
+
+ /**
+ * 在线客服群二维码存放路径
+ */
+ private String groupQrCodeUrl;
+
+ /**
+ * 科室人员证书图片存放路径
+ */
+ private String certificateUrl;
+
+ /**
+ * 健康咨询 科室人员头像地址
+ */
+ private String personPictureUrl;
+
+ /**
+ * 护理人员证书地址
+ */
+ private String personCertificateUrl;
+
+ /**
+ * 审核护理人员证书地址
+ */
+ private String personCertificateCheckUrl;
+
+ /**
+ * 医路
+ */
+ private String yiLuYouPinStoreName;
+
+ /**
+ * 护理员App上传路径
+ */
+ private String appFileName;
+
+ /**
+ * 泉医到家App文件存放路径
+ */
+ private String appFilePath;
+
+ /**
+ * 培训分类图片路径
+ */
+ private String trainingCategoryPictureUrl;
+
+ /**
+ * 培训项目logo图片路径
+ */
+ private String trainingItemCoverUrl;
+
+ /**
+ * 培训项目海报图片路径
+ */
+ private String trainingItemPosterUrl;
+
+ /**
+ * 培训项目海报图片路径
+ */
+ private String trainingItemContentUrl;
+
+ /**
+ * 培训项目章节视频存放地址
+ */
+ private String itemDirectoryUrl;
+
+ /**
+ * 微信好有邀请二维码存放路径
+ */
+ private String personalWeChatCodeUrl;
+
+ /**
+ * 护理站二维码存放路径
+ */
+ private String stationWechatCodeUrl;
+
+ /**
+ * 实人认证身份证照片地址
+ */
+ private String cardNoPicUrl;
+
+ /**
+ * 预约订单护理项目告知书签字图片地址
+ */
+ private String itemInformUrl;
+
+ public String getItemInformUrl() {
+ return itemInformUrl;
+ }
+
+ public void setItemInformUrl(String itemInformUrl) {
+ this.itemInformUrl = itemInformUrl;
+ }
+
+ public String getCardNoPicUrl() {
+ return cardNoPicUrl;
+ }
+
+ public void setCardNoPicUrl(String cardNoPicUrl) {
+ this.cardNoPicUrl = cardNoPicUrl;
+ }
+
+ public String getStationWechatCodeUrl() {
+ return stationWechatCodeUrl;
+ }
+
+ public void setStationWechatCodeUrl(String stationWechatCodeUrl) {
+ this.stationWechatCodeUrl = stationWechatCodeUrl;
+ }
+
+ public String getPersonalWeChatCodeUrl() {
+ return personalWeChatCodeUrl;
+ }
+
+ public void setPersonalWeChatCodeUrl(String personalWeChatCodeUrl) {
+ this.personalWeChatCodeUrl = personalWeChatCodeUrl;
+ }
+
+ public String getAppFilePath() {
+ return appFilePath;
+ }
+
+ public void setAppFilePath(String appFilePath) {
+ this.appFilePath = appFilePath;
+ }
+
+ public String getYiLuYouPinStoreName() {
+ return yiLuYouPinStoreName;
+ }
+
+ public void setYiLuYouPinStoreName(String yiLuYouPinStoreName) {
+ this.yiLuYouPinStoreName = yiLuYouPinStoreName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getCopyrightYear() {
+ return copyrightYear;
+ }
+
+ public void setCopyrightYear(String copyrightYear) {
+ this.copyrightYear = copyrightYear;
+ }
+
+ public boolean isDemoEnabled() {
+ return demoEnabled;
+ }
+
+ public void setDemoEnabled(boolean demoEnabled) {
+ this.demoEnabled = demoEnabled;
+ }
+
+ public static String getProfile() {
+ return profile;
+ }
+
+ public void setProfile(String profile) {
+ XinYiLuConfig.profile = profile;
+ }
+
+ public static boolean isAddressEnabled() {
+ return addressEnabled;
+ }
+
+ public void setAddressEnabled(boolean addressEnabled) {
+ XinYiLuConfig.addressEnabled = addressEnabled;
+ }
+
+ public static String getCaptchaType() {
+ return captchaType;
+ }
+
+ public void setCaptchaType(String captchaType) {
+ XinYiLuConfig.captchaType = captchaType;
+ }
+
+ /**
+ * 获取导入上传路径
+ */
+ public static String getImportPath() {
+ return getProfile() + "/import";
+ }
+
+ /**
+ * 获取头像上传路径
+ */
+ public static String getAvatarPath() {
+ return getProfile() + "/avatar";
+ }
+
+ /**
+ * 获取下载路径
+ */
+ public static String getDownloadPath() {
+ return getProfile() + "/download/";
+ }
+
+ /**
+ * 获取上传路径
+ */
+ public static String getUploadPath() {
+ return getProfile() + "/upload";
+ }
+
+ public String getNurserAppletPicture() {
+ return nurserAppletPicture;
+ }
+
+ public void setNurserAppletPicture(String nurserAppletPicture) {
+ this.nurserAppletPicture = nurserAppletPicture;
+ }
+
+ public String getNurserStationPictureUrl() {
+ return nurserStationPictureUrl;
+ }
+
+ public void setNurserStationPictureUrl(String nurserStationPictureUrl) {
+ this.nurserStationPictureUrl = nurserStationPictureUrl;
+ }
+
+ public String getNurserStationIntroducePictureUrl() {
+ return nurserStationIntroducePictureUrl;
+ }
+
+ public void setNurserStationIntroducePictureUrl(String nurserStationIntroducePictureUrl) {
+ this.nurserStationIntroducePictureUrl = nurserStationIntroducePictureUrl;
+ }
+
+ public String getNurserStationItemPictureUrl() {
+ return nurserStationItemPictureUrl;
+ }
+
+ public void setNurserStationItemPictureUrl(String nurserStationItemPictureUrl) {
+ this.nurserStationItemPictureUrl = nurserStationItemPictureUrl;
+ }
+
+ public String getGoodsPictureUrl() {
+ return goodsPictureUrl;
+ }
+
+ public void setGoodsPictureUrl(String goodsPictureUrl) {
+ this.goodsPictureUrl = goodsPictureUrl;
+ }
+
+ public String getHeadPictureUrl() {
+ return headPictureUrl;
+ }
+
+ public void setHeadPictureUrl(String headPictureUrl) {
+ this.headPictureUrl = headPictureUrl;
+ }
+
+ public String getAppointmentOrderDetailsUrl() {
+ return appointmentOrderDetailsUrl;
+ }
+
+ public void setAppointmentOrderDetailsUrl(String appointmentOrderDetailsUrl) {
+ this.appointmentOrderDetailsUrl = appointmentOrderDetailsUrl;
+ }
+
+ public String getAttributePitureUrl() {
+ return attributePitureUrl;
+ }
+
+ public void setAttributePitureUrl(String attributePitureUrl) {
+ this.attributePitureUrl = attributePitureUrl;
+ }
+
+
+ public String getAppFileName() {
+ return appFileName;
+ }
+
+ public void setAppFileName(String appFileName) {
+ this.appFileName = appFileName;
+ }
+
+ public String getNurseStationAppPersonUrl() {
+ return nurseStationAppPersonUrl;
+ }
+
+ public void setNurseStationAppPersonUrl(String nurseStationAppPersonUrl) {
+ this.nurseStationAppPersonUrl = nurseStationAppPersonUrl;
+ }
+
+ public String getEvaluatePictureUrl() {
+ return evaluatePictureUrl;
+ }
+
+ public void setEvaluatePictureUrl(String evaluatePictureUrl) {
+ this.evaluatePictureUrl = evaluatePictureUrl;
+ }
+
+ public String getRichTextPictureUrl() {
+ return richTextPictureUrl;
+ }
+
+ public void setRichTextPictureUrl(String richTextPictureUrl) {
+ this.richTextPictureUrl = richTextPictureUrl;
+ }
+
+ public String getGoodsCategoryPicture() {
+ return goodsCategoryPicture;
+ }
+
+ public void setGoodsCategoryPicture(String goodsCategoryPicture) {
+ this.goodsCategoryPicture = goodsCategoryPicture;
+ }
+
+ public String getNurseStationClassifyUrl() {
+ return nurseStationClassifyUrl;
+ }
+
+ public void setNurseStationClassifyUrl(String nurseStationClassifyUrl) {
+ this.nurseStationClassifyUrl = nurseStationClassifyUrl;
+ }
+
+ public String getNurseItemClassifyUrl() {
+ return nurseItemClassifyUrl;
+ }
+
+ public void setNurseItemClassifyUrl(String nurseItemClassifyUrl) {
+ this.nurseItemClassifyUrl = nurseItemClassifyUrl;
+ }
+
+ public String getPosterPictureUrl() {
+ return posterPictureUrl;
+ }
+
+ public void setPosterPictureUrl(String posterPictureUrl) {
+ this.posterPictureUrl = posterPictureUrl;
+ }
+
+ public String getLeadThumbnailUrl() {
+ return leadThumbnailUrl;
+ }
+
+ public void setLeadThumbnailUrl(String leadThumbnailUrl) {
+ this.leadThumbnailUrl = leadThumbnailUrl;
+ }
+
+
+ public String getPosterVideoUrl() {
+ return posterVideoUrl;
+ }
+
+ public void setPosterVideoUrl(String posterVideoUrl) {
+ this.posterVideoUrl = posterVideoUrl;
+ }
+
+
+ public String getGroupQrCodeUrl() {
+ return groupQrCodeUrl;
+ }
+
+ public void setGroupQrCodeUrl(String groupQrCodeUrl) {
+ this.groupQrCodeUrl = groupQrCodeUrl;
+ }
+
+
+ public String getCertificateUrl() {
+ return certificateUrl;
+ }
+
+ public void setCertificateUrl(String certificateUrl) {
+ this.certificateUrl = certificateUrl;
+ }
+
+ public String getPersonPictureUrl() {
+ return personPictureUrl;
+ }
+
+ public void setPersonPictureUrl(String personPictureUrl) {
+ this.personPictureUrl = personPictureUrl;
+ }
+
+ public String getPersonCertificateUrl() {
+ return personCertificateUrl;
+ }
+
+ public void setPersonCertificateUrl(String personCertificateUrl) {
+ this.personCertificateUrl = personCertificateUrl;
+ }
+
+ public String getPersonCertificateCheckUrl() {
+ return personCertificateCheckUrl;
+ }
+
+ public void setPersonCertificateCheckUrl(String personCertificateCheckUrl) {
+ this.personCertificateCheckUrl = personCertificateCheckUrl;
+ }
+
+ public String getTrainingCategoryPictureUrl() {
+ return trainingCategoryPictureUrl;
+ }
+
+ public void setTrainingCategoryPictureUrl(String trainingCategoryPictureUrl) {
+ this.trainingCategoryPictureUrl = trainingCategoryPictureUrl;
+ }
+
+ public String getTrainingItemCoverUrl() {
+ return trainingItemCoverUrl;
+ }
+
+ public void setTrainingItemCoverUrl(String trainingItemCoverUrl) {
+ this.trainingItemCoverUrl = trainingItemCoverUrl;
+ }
+
+ public String getTrainingItemPosterUrl() {
+ return trainingItemPosterUrl;
+ }
+
+ public void setTrainingItemPosterUrl(String trainingItemPosterUrl) {
+ this.trainingItemPosterUrl = trainingItemPosterUrl;
+ }
+
+ public String getTrainingItemContentUrl() {
+ return trainingItemContentUrl;
+ }
+
+ public void setTrainingItemContentUrl(String trainingItemContentUrl) {
+ this.trainingItemContentUrl = trainingItemContentUrl;
+ }
+
+ public String getItemDirectoryUrl() {
+ return itemDirectoryUrl;
+ }
+
+ public void setItemDirectoryUrl(String itemDirectoryUrl) {
+ this.itemDirectoryUrl = itemDirectoryUrl;
+ }
+}
diff --git a/exam-admin/src/main/java/com/yf/exam/config/XylWeChatPaymentConfig.java b/exam-admin/src/main/java/com/yf/exam/config/XylWeChatPaymentConfig.java
index 60f69b0..a66eedb 100644
--- a/exam-admin/src/main/java/com/yf/exam/config/XylWeChatPaymentConfig.java
+++ b/exam-admin/src/main/java/com/yf/exam/config/XylWeChatPaymentConfig.java
@@ -5,7 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
- * @Description 新医路商户号微信支付参数配置类
+ * @Description 山东省公共卫生学会商户号微信支付参数配置类
* @Author 纪寒
* @Date 2022-10-17 16:55:04
* @Version 1.0
@@ -16,27 +16,27 @@ import org.springframework.stereotype.Component;
public class XylWeChatPaymentConfig {
/**
- * 新医路商户号
+ * 山东省公共卫生学会商户号
*/
private String xylMchId;
/**
- * 新医路API证书序号getXylVerifier
+ * 山东省公共卫生学会证书序号getXylVerifier
*/
private String xylMchSerialNo;
/**
- * 新医路私钥文件
+ * 山东省公共卫生学会私钥文件
*/
private String xylPrivateKeyPath;
/**
- * 新医路API V3版本密钥
+ * 山东省公共卫生学会API V3版本密钥
*/
private String xylPaymentKey;
/**
- * 新医路支付回调地址
+ * 山东省公共卫生学会支付回调地址
*/
private String xylWeChatNotifyUrl;
}
diff --git a/exam-admin/src/main/java/com/yf/exam/config/payment/XylWeChatPaymentUtilConfig.java b/exam-admin/src/main/java/com/yf/exam/config/payment/XylWeChatPaymentUtilConfig.java
index 06a5f0f..a378546 100644
--- a/exam-admin/src/main/java/com/yf/exam/config/payment/XylWeChatPaymentUtilConfig.java
+++ b/exam-admin/src/main/java/com/yf/exam/config/payment/XylWeChatPaymentUtilConfig.java
@@ -19,7 +19,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
/**
- * @Description 新医路商户号微信支付核心配置类
+ * @Description 山东省公共卫生学会商户号微信支付核心配置类
* @Author 纪寒
* @Date 2022-10-17 18:56:22
* @Version 1.0
@@ -32,7 +32,7 @@ public class XylWeChatPaymentUtilConfig {
private XylWeChatPaymentConfig xylWeChatPaymentConfig;
/**
- * 获取新医路签名信息
+ * 获取山东省公共卫生学会签名信息
*
* @return 签名信息
* @throws Exception 异常信息
@@ -54,36 +54,36 @@ public class XylWeChatPaymentUtilConfig {
}
/**
- * 获取新医路商户号带有签名的http请求对象
+ * 获取山东省公共卫生学会商户号带有签名的http请求对象
*
* @return CloseableHttpClient对象
*/
@Bean(name = "xinYiLuWeChatPayClient")
public CloseableHttpClient getXinYiLuWeChatPayClient(Verifier xylVerifier) {
- log.info("开始获取新医路商户带有签名信息的http请求对象........");
+ log.info("开始获取山东省公共卫生学会商户带有签名信息的http请求对象........");
//获取商户私钥
PrivateKey privateKey = getPrivateKey(xylWeChatPaymentConfig.getXylPrivateKeyPath());
CloseableHttpClient closeableHttpClient = null;
try {
- log.info("新医路签名验证证书,xinYiLuCertificatesVerifier:{}", xylVerifier);
+ log.info("山东省公共卫生学会签名验证证书,xinYiLuCertificatesVerifier:{}", xylVerifier);
//通过WeChatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签,并进行证书自动更新
closeableHttpClient = WechatPayHttpClientBuilder.create()
.withMerchant(xylWeChatPaymentConfig.getXylMchId(), xylWeChatPaymentConfig.getXylMchSerialNo(), privateKey)
.withValidator(new WechatPay2Validator(xylVerifier)).build();
} catch (Exception e) {
- log.error("新医路验证签名信息失败,失败信息:{}", e.getMessage());
+ log.error("山东省公共卫生学会验证签名信息失败,失败信息:{}", e.getMessage());
}
return closeableHttpClient;
}
/**
- * 获取新医路商户号无签名的http请求对象
+ * 获取山东省公共卫生学会商户号无签名的http请求对象
*
* @return CloseableHttpClient对象
*/
@Bean(name = "xinYiLuWeChatPayNoSignClient")
public CloseableHttpClient getXinYiLuWeChatPayNoSignClient() {
- log.info("获取新医路商户的无签名信息的http请求对象.........");
+ log.info("获取山东省公共卫生学会商户的无签名信息的http请求对象.........");
//获取商户私钥
PrivateKey privateKey = getPrivateKey(xylWeChatPaymentConfig.getXylPrivateKeyPath());
//通过WeChatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签,并进行证书自动更新
@@ -102,8 +102,8 @@ public class XylWeChatPaymentUtilConfig {
try {
return PemUtil.loadPrivateKey(new ClassPathResource(filename).getInputStream());
} catch (Exception e) {
- log.error("新医路商户私钥文件不存在,错误原因:{}", e.getMessage());
- throw new ServiceException("新医路商户私钥文件不存在,请联系管理员!");
+ log.error("山东省公共卫生学会商户私钥文件不存在,错误原因:{}", e.getMessage());
+ throw new ServiceException("山东省公共卫生学会商户私钥文件不存在,请联系管理员!");
}
}
}
diff --git a/exam-admin/src/main/java/com/yf/exam/constant/Constants.java b/exam-admin/src/main/java/com/yf/exam/constant/Constants.java
index c91a1ea..b450366 100644
--- a/exam-admin/src/main/java/com/yf/exam/constant/Constants.java
+++ b/exam-admin/src/main/java/com/yf/exam/constant/Constants.java
@@ -7,6 +7,21 @@ package com.yf.exam.constant;
*/
public class Constants {
+ /**
+ * UTF-8 字符集
+ */
+ public static final String UTF8 = "UTF-8";
+
+ /**
+ * 会话
+ */
+ public static final String TOKEN = "token";
+
+ /**
+ * 文件上传路径
+ */
+ public static final String FILE_PREFIX = "/upload/file/";
+
/**
* 身份证正面照片路径上传
*/
@@ -42,6 +57,11 @@ public class Constants {
*/
public static final String sign_picture_type = "signPictureUrl";
+ /**
+ * 微信小程序ACCESS_TOKEN前缀
+ */
+ public static final String EXAM_APPLET_ACCESS_TOKEN = "EXAM_APPLET_ACCESS_TOKEN:";
+
}
diff --git a/exam-admin/src/main/java/com/yf/exam/core/domain/AjaxResult.java b/exam-admin/src/main/java/com/yf/exam/core/domain/AjaxResult.java
new file mode 100644
index 0000000..f90bd9c
--- /dev/null
+++ b/exam-admin/src/main/java/com/yf/exam/core/domain/AjaxResult.java
@@ -0,0 +1,165 @@
+package com.yf.exam.core.domain;
+
+import java.util.HashMap;
+
+/**
+ * 操作消息提醒
+ *
+ * @author xinyilu
+ */
+public class AjaxResult extends HashMap {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 状态码
+ */
+ public static final String CODE_TAG = "code";
+
+ /**
+ * 返回内容
+ */
+ public static final String MSG_TAG = "msg";
+
+ /**
+ * 数据对象
+ */
+ public static final String DATA_TAG = "data";
+
+ /**
+ * 成功默认消息
+ */
+ private static final Integer CODE_SUCCESS = 0;
+ private static final String MSG_SUCCESS = "操作成功!";
+
+ /**
+ * 失败默认消息
+ */
+ private static final Integer CODE_FAILURE = 1;
+ private static final String MSG_FAILURE = "请求失败!";
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
+ */
+ public AjaxResult() {
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ */
+ public AjaxResult(int code, String msg) {
+ super.put(CODE_TAG, code);
+ super.put(MSG_TAG, msg);
+ }
+
+ /**
+ * 初始化一个新创建的 AjaxResult 对象
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ * @param data 数据对象
+ */
+ public AjaxResult(int code, String msg, Object data) {
+ super.put(CODE_TAG, code);
+ super.put(MSG_TAG, msg);
+ if (!(data == null)) {
+ super.put(DATA_TAG, data);
+ }
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success() {
+ return AjaxResult.success("操作成功");
+ }
+
+ /**
+ * 返回成功数据
+ *
+ * @return 成功消息
+ */
+ public static AjaxResult success(Object data) {
+ return AjaxResult.success("操作成功", data);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg) {
+ return AjaxResult.success(msg, null);
+ }
+
+ /**
+ * 返回成功消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 成功消息
+ */
+ public static AjaxResult success(String msg, Object data) {
+ return new AjaxResult(CODE_SUCCESS, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @return
+ */
+ public static AjaxResult error() {
+ return AjaxResult.error("操作失败");
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg) {
+ return AjaxResult.error(msg, null);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult error(String msg, Object data) {
+ return new AjaxResult(CODE_FAILURE, msg, data);
+ }
+
+ /**
+ * 返回错误消息
+ *
+ * @param code 状态码
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult error(int code, String msg) {
+ return new AjaxResult(code, msg, null);
+ }
+
+ /**
+ * 方便链式调用
+ *
+ * @param key 键
+ * @param value 值
+ * @return 数据对象
+ */
+ @Override
+ public AjaxResult put(String key, Object value) {
+ super.put(key, value);
+ return this;
+ }
+
+}
diff --git a/exam-admin/src/main/java/com/yf/exam/core/redis/RedisCache.java b/exam-admin/src/main/java/com/yf/exam/core/redis/RedisCache.java
new file mode 100644
index 0000000..3b0346d
--- /dev/null
+++ b/exam-admin/src/main/java/com/yf/exam/core/redis/RedisCache.java
@@ -0,0 +1,226 @@
+package com.yf.exam.core.redis;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Resource;
+import org.springframework.data.redis.core.BoundSetOperations;
+import org.springframework.data.redis.core.HashOperations;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.stereotype.Component;
+
+/**
+ * spring redis 工具类
+ *
+ * @author xinyilu
+ **/
+@SuppressWarnings(value = {"unchecked", "rawtypes"})
+@Component
+public class RedisCache {
+ @Resource
+ public RedisTemplate redisTemplate;
+
+ /**
+ * 缓存基本的对象,Integer、String、实体类等
+ *
+ * @param key 缓存的键值
+ * @param value 缓存的值
+ */
+ public void setCacheObject(final String key, final T value) {
+ redisTemplate.opsForValue().set(key, value);
+ }
+
+ /**
+ * 缓存基本的对象,Integer、String、实体类等
+ *
+ * @param key 缓存的键值
+ * @param value 缓存的值
+ * @param timeout 时间
+ * @param timeUnit 时间颗粒度
+ */
+ public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
+ redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
+ }
+
+ /**
+ * 设置有效时间
+ *
+ * @param key Redis键
+ * @param timeout 超时时间
+ * @return true=设置成功;false=设置失败
+ */
+ public boolean expire(final String key, final long timeout) {
+ return expire(key, timeout, TimeUnit.SECONDS);
+ }
+
+ /**
+ * 设置有效时间
+ *
+ * @param key Redis键
+ * @param timeout 超时时间
+ * @param unit 时间单位
+ * @return true=设置成功;false=设置失败
+ */
+ public boolean expire(final String key, final long timeout, final TimeUnit unit) {
+ return redisTemplate.expire(key, timeout, unit);
+ }
+
+ /**
+ * 获得缓存的基本对象。
+ *
+ * @param key 缓存键值
+ * @return 缓存键值对应的数据
+ */
+ public T getCacheObject(final String key) {
+ ValueOperations operation = redisTemplate.opsForValue();
+ return operation.get(key);
+ }
+
+ /**
+ * 删除单个对象
+ *
+ * @param key
+ */
+ public boolean deleteObject(final String key) {
+ return redisTemplate.delete(key);
+ }
+
+ /**
+ * 删除集合对象
+ *
+ * @param collection 多个对象
+ * @return
+ */
+ public long deleteObject(final Collection collection) {
+ return redisTemplate.delete(collection);
+ }
+
+ /**
+ * 缓存List数据
+ *
+ * @param key 缓存的键值
+ * @param dataList 待缓存的List数据
+ * @return 缓存的对象
+ */
+ public long setCacheList(final String key, final List dataList) {
+ Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
+ return count == null ? 0 : count;
+ }
+
+ /**
+ * 获得缓存的list对象
+ *
+ * @param key 缓存的键值
+ * @return 缓存键值对应的数据
+ */
+ public List getCacheList(final String key) {
+ return redisTemplate.opsForList().range(key, 0, -1);
+ }
+
+ /**
+ * 缓存Set
+ *
+ * @param key 缓存键值
+ * @param dataSet 缓存的数据
+ * @return 缓存数据的对象
+ */
+ public BoundSetOperations setCacheSet(final String key, final Set dataSet) {
+ BoundSetOperations setOperation = redisTemplate.boundSetOps(key);
+ Iterator it = dataSet.iterator();
+ while (it.hasNext()) {
+ setOperation.add(it.next());
+ }
+ return setOperation;
+ }
+
+ /**
+ * 获得缓存的set
+ *
+ * @param key
+ * @return
+ */
+ public Set getCacheSet(final String key) {
+ return redisTemplate.opsForSet().members(key);
+ }
+
+ /**
+ * 缓存Map
+ *
+ * @param key
+ * @param dataMap
+ */
+ public void setCacheMap(final String key, final Map dataMap) {
+ if (dataMap != null) {
+ redisTemplate.opsForHash().putAll(key, dataMap);
+ }
+ }
+
+ /**
+ * 获得缓存的Map
+ *
+ * @param key
+ * @return
+ */
+ public Map getCacheMap(final String key) {
+ return redisTemplate.opsForHash().entries(key);
+ }
+
+ /**
+ * 往Hash中存入数据
+ *
+ * @param key Redis键
+ * @param hKey Hash键
+ * @param value 值
+ */
+ public void setCacheMapValue(final String key, final String hKey, final T value) {
+ redisTemplate.opsForHash().put(key, hKey, value);
+ }
+
+ /**
+ * 获取Hash中的数据
+ *
+ * @param key Redis键
+ * @param hKey Hash键
+ * @return Hash中的对象
+ */
+ public T getCacheMapValue(final String key, final String hKey) {
+ HashOperations opsForHash = redisTemplate.opsForHash();
+ return opsForHash.get(key, hKey);
+ }
+
+ /**
+ * 删除Hash中的数据
+ *
+ * @param key
+ * @param hKey
+ */
+ public void delCacheMapValue(final String key, final String hKey) {
+ HashOperations hashOperations = redisTemplate.opsForHash();
+ hashOperations.delete(key, hKey);
+ }
+
+ /**
+ * 获取多个Hash中的数据
+ *
+ * @param key Redis键
+ * @param hKeys Hash键集合
+ * @return Hash对象集合
+ */
+ public List getMultiCacheMapValue(final String key, final Collection