Commit 076069ca by huluobin

update

parent 59a09478
......@@ -17,8 +17,8 @@ import com.gogirl.domain.user.customer.CustomerMessage;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.WxProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.config.property.WxProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.order.mall.MallOrderMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper;
......
......@@ -15,8 +15,8 @@ import com.gogirl.domain.order.mall.MallRefundOrder;
import com.gogirl.domain.order.mall.MallRefundOrderDetail;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.WxProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.config.property.WxProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.order.mall.MallRefundOrderMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
......
......@@ -19,7 +19,7 @@ import com.gogirl.domain.user.customer.CustomerBalance;
import com.gogirl.domain.user.customer.CustomerBalanceRecord;
import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.market.discount.DiscountConfigMapper;
import com.gogirl.infrastructure.mapper.order.member.ChargeOrderMapper;
......
......@@ -9,7 +9,7 @@
//import com.gogirl.domain.order.serve.OrderManage;
//import com.gogirl.domain.user.customer.CustomerBalance;
//import com.gogirl.infrastructure.common.exception.RRException;
//import com.gogirl.infrastructure.config.GogirlProperties;
//import com.gogirl.infrastructure.config.property.GogirlProperties;
//import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
//import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper;
//import com.gogirl.shared.member.order.command.BalanceWxPayQuery;
......
......@@ -14,7 +14,7 @@ import com.gogirl.domain.user.customer.CustomerBalance;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.infrastructure.common.util.RandomUtil;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.market.discount.DiscountConfigMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper;
......
......@@ -30,7 +30,7 @@ import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.CloneUtil;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.common.util.StringUtils;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.mapper.market.discount.LeisureDiscountConfigMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper;
import com.gogirl.infrastructure.mapper.order.serve.ScheduleManageMapper;
......
package com.gogirl.application.xcx.impl;
import com.gogirl.infrastructure.config.WxProperties;
import com.gogirl.infrastructure.config.property.WxProperties;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
......
......@@ -2,7 +2,7 @@ package com.gogirl.application.xcx.impl;
import com.github.binarywang.utils.qrcode.MatrixToImageWriter;
import com.gogirl.application.xcx.QRCodeService;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.util.ImageUtil;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix;
......
......@@ -3,7 +3,7 @@ package com.gogirl.application.xcx.impl;
import com.gogirl.application.xcx.WechatService;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.infrastructure.config.WxProperties;
import com.gogirl.infrastructure.config.property.WxProperties;
import com.gogirl.infrastructure.constant.WxUrlType;
import com.gogirl.shared.member.wx.query.dto.Code2SessionResult;
import lombok.AllArgsConstructor;
......
//package com.gogirl.infrastructure.config;
//
//import com.fasterxml.jackson.annotation.JsonAutoDetect;
//import com.fasterxml.jackson.annotation.PropertyAccessor;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.springframework.cache.CacheManager;
//import org.springframework.cache.annotation.CachingConfigurerSupport;
//import org.springframework.cache.interceptor.KeyGenerator;
//import org.springframework.context.annotation.Bean;
//import org.springframework.data.redis.cache.RedisCacheConfiguration;
//import org.springframework.data.redis.cache.RedisCacheManager;
//import org.springframework.data.redis.cache.RedisCacheWriter;
//import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
//
//import java.lang.reflect.Method;
//
//public class CacheConfig extends CachingConfigurerSupport {
//
// /**
// * 自定义缓存key的生成策略。默认的生成策略是看不懂的(乱码内容) 通过Spring 的依赖注入特性进行自定义的配置注入并且此类是一个配置类可以更多程度的自定义配置
// *
// * @return
// */
// @Bean
// @Override
// public KeyGenerator keyGenerator() {
// return new KeyGenerator() {
// @Override
// public Object generate(Object target, Method method, Object... params) {
// StringBuilder sb = new StringBuilder();
// sb.append(target.getClass().getName());
// sb.append(method.getName());
// for (Object obj : params) {
// sb.append(obj.toString());
// }
// return sb.toString();
// }
// };
// }
//
// /**
// * 缓存配置管理器
// */
// @Bean
// public CacheManager cacheManager(LettuceConnectionFactory factory) {
// //以锁写入的方式创建RedisCacheWriter对象
// RedisCacheWriter writer = RedisCacheWriter.lockingRedisCacheWriter(factory);
// /*
// 设置CacheManager的Value序列化方式为JdkSerializationRedisSerializer,
// 但其实RedisCacheConfiguration默认就是使用
// StringRedisSerializer序列化key,
// JdkSerializationRedisSerializer序列化value,
// 所以以下注释代码就是默认实现,没必要写,直接注释掉
// */
// // RedisSerializationContext.SerializationPair pair = RedisSerializationContext.SerializationPair.fromSerializer(new JdkSerializationRedisSerializer(this.getClass().getClassLoader()));
// // RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair);
// //创建默认缓存配置对象
// RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();
// RedisCacheManager cacheManager = new RedisCacheManager(writer, config);
// return cacheManager;
// }
//
// /**
// * 获取缓存操作助手对象
// *
// * @return
// */
// @Bean
// public RedisTemplate<String, String> redisTemplate(LettuceConnectionFactory factory) {
// //创建Redis缓存操作助手RedisTemplate对象
// StringRedisTemplate template = new StringRedisTemplate();
// template.setConnectionFactory(factory);
// //以下代码为将RedisTemplate的Value序列化方式由JdkSerializationRedisSerializer更换为Jackson2JsonRedisSerializer
// //此种序列化方式结果清晰、容易阅读、存储字节少、速度快,所以推荐更换
// Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
// ObjectMapper om = new ObjectMapper();
// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
// jackson2JsonRedisSerializer.setObjectMapper(om);
// template.setValueSerializer(jackson2JsonRedisSerializer);
// template.afterPropertiesSet();
// //StringRedisTemplate是RedisTempLate<String, String>的子类
// return template;
// }
//}
\ No newline at end of file
package com.gogirl.infrastructure.config;
import com.gogirl.infrastructure.interceptor.AuthHandlerInterceptor;
import com.gogirl.infrastructure.interceptor.LogHandlerInterceptor;
import com.gogirl.infrastructure.interceptor.LoginHandlerInterceptor;
import com.gogirl.infrastructure.interceptor.SessionHandlerInterceptor;
......@@ -16,6 +17,7 @@ public class MvcInterceptorConfig extends WebMvcConfigurationSupport {
private final LoginHandlerInterceptor loginHandlerInterceptor;
private final LogHandlerInterceptor logHandlerInterceptor;
private final SessionHandlerInterceptor sessionHandlerInterceptor;
private final AuthHandlerInterceptor authHandlerInterceptor;
@Override
protected void addInterceptors(InterceptorRegistry registry) {
......@@ -71,9 +73,70 @@ public class MvcInterceptorConfig extends WebMvcConfigurationSupport {
registry.addInterceptor(logHandlerInterceptor);
registry.addInterceptor(sessionHandlerInterceptor);
registry.addInterceptor(authHandlerInterceptor)
.addPathPatterns("/**")
.excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**", "/error")
//登陆
.excludePathPatterns("/customer/message/loginLog")
.excludePathPatterns("/customer/message/pageIn")
.excludePathPatterns("/customer/message/pageOut")
.excludePathPatterns("/customer/message/logoutLog")
.excludePathPatterns("/customer/leisure/queryMinDiscount")
.excludePathPatterns("/customer/xcx/login")
.excludePathPatterns("/customer/csrf")
.excludePathPatterns("/customer/mallCategory/getCategoryTree")
.excludePathPatterns("/customer/mallCategory/getCategoryList")
.excludePathPatterns("/customer/mallProduct/queryPageProduct")
.excludePathPatterns("/customer/mallProduct/queryProduct")
.excludePathPatterns("/customer/serve/no_queryNewServePage")
.excludePathPatterns("/customer/serve/queryServeForPage")
.excludePathPatterns("/customer/broadcast/queryBroadcast")
.excludePathPatterns("/customer/shop/queryShopEnvironmentPhotos")
//回调
.excludePathPatterns("/customer/pay/notifyTimesCard")
.excludePathPatterns("/customer/pay/notifyCharge")
.excludePathPatterns("/customer/mallOrderPay/notifyMallOrder")
.excludePathPatterns("/customer/pay/notifyOrder")
.excludePathPatterns("/customer/pay/notifyBalanceWxPay")
.excludePathPatterns("/customer/xcx/authorized1")
.excludePathPatterns("/customer/xcx/authorizedPhone")
.excludePathPatterns("/customer/message/queryPageMessage")
//退款
.excludePathPatterns("/customer/mallOrderPay/refund/*")
.excludePathPatterns("/customer/xcx/upload")
.excludePathPatterns("/technician/xcx/login")
.excludePathPatterns("/csrf")
.excludePathPatterns("/technician/xcx/login_t")
.excludePathPatterns("/technician/phone/bindPhone_t")
.excludePathPatterns("/technician/phone/getBindCode")
.excludePathPatterns("/technician/xcx/upload")
.excludePathPatterns("/technician/xcx/getUserInfo_t")
.excludePathPatterns("/technician/xcx/choseStore")
.excludePathPatterns("/technician/xcx/getTechnicianShopList")
.excludePathPatterns("/customer/produce/queryProduceDetail")
.excludePathPatterns("/customer/shop/queryShopForPage")
.excludePathPatterns("/customer/mallCart/listMallShoppingCart")
.excludePathPatterns("/customer/queryPageLeisureScheduleServe")
.excludePathPatterns("/customer/getMyCoupon")
.excludePathPatterns("/customer/timescard/getMyTimesCardList")
.excludePathPatterns("/customer/selectAllDiscount")
.excludePathPatterns("/customer/xcx/getUserInfo")
;
super.addInterceptors(registry);
}
//
// https://t.begogirls.com/customer/produce/queryProduceDetail2?id=265&token=1240914668441079809
// https://t.begogirls.com/customer/shop/queryShopForPage?pageNum=1&pageSize=10&longitude=113.36199&latitude=23.12463&token=1240914668441079809
// https://t.begogirls.com/customer/mallCart/listMallShoppingCart
// https://t.begogirls.com/customer/queryPageLeisureScheduleServe
// https://t.begogirls.com/customer/getMyCoupon?state=1&token=1240914668441079809
// https://t.begogirls.com/customer/timescard/getMyTimesCardList?token=1240914668441079809
// https://t.begogirls.com/customer/selectAllDiscount?token=1240914668441079809
// https://t.begogirls.com/customer/xcx/getUserInfo?token=1240914668441079809
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
......
......@@ -3,6 +3,7 @@ package com.gogirl.infrastructure.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig;
import com.gogirl.infrastructure.config.property.WxMaProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
......@@ -3,6 +3,7 @@ package com.gogirl.infrastructure.config;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
import com.gogirl.infrastructure.config.property.WxPayProperties;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
......@@ -12,7 +13,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Binary Wang
* 微信支付配置
*/
@Configuration
@ConditionalOnClass(WxPayService.class)
......
package com.gogirl.infrastructure.config;
package com.gogirl.infrastructure.config.property;
import lombok.Data;
......
package com.gogirl.infrastructure.config;
package com.gogirl.infrastructure.config.property;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
......
package com.gogirl.infrastructure.config;
package com.gogirl.infrastructure.config.property;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* wxpay pay properties
* 微信支付配置属性
*
* @author Binary Wang
*/
@Data
@ConfigurationProperties(prefix = "wx.pay")
public class WxPayProperties {
/**
* 设置微信公众号或者小程序等的appid
*/
......
package com.gogirl.infrastructure.config;
package com.gogirl.infrastructure.config.property;
import lombok.Data;
......@@ -45,12 +45,23 @@ public class WxProperties {
*/
private String orderPayNotifyTpl;
/**
* 问卷调查消息模版
*/
public String testPaperTpl;
/**
* 店铺预约小程序订阅消息模版
*/
private String shopScheduleTpl;
/**
* 店铺预约超时小程序消息模版
*/
private String shopOverScheduleTpl;
/**
* 用户取消店铺小程序订阅消息模版
*/
private String shopCancelScheduleTpl;
}
......@@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
public class AuthHandlerInterceptor implements HandlerInterceptor {
private final GogirlTokenService gogirlTokenService;
private final StoreManageMapper storeManageMapper;
private final CustomerMapper customerMapper;
@Override
......
......@@ -2,11 +2,9 @@ package com.gogirl.infrastructure.interceptor;
import com.gogirl.application.xcx.GogirlTokenService;
import com.gogirl.domain.store.store.StoreManage;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.common.util.StringUtils;
import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
import lombok.AllArgsConstructor;
......@@ -44,12 +42,13 @@ public class LoginHandlerInterceptor implements HandlerInterceptor {
GogirlToken gogirlToken = gogirlTokenService.getByToken(token);
if (gogirlToken == null) {
throw new RRException(2000, "token失效,请重新登陆");
} else {
Customer customer = customerMapper.selectById(gogirlToken.getCustomerId());
if (customer != null && StringUtils.isEmpty(customer.getPhone())) {
throw new RRException(1001, "请授权手机号码");
}
}
// else {
// Customer customer = customerMapper.selectById(gogirlToken.getCustomerId());
// if (customer != null && StringUtils.isEmpty(customer.getPhone())) {
// throw new RRException(1001, "请授权手机号码");
// }
// }
}
if (sourceFrom.equals("technician")) {
GogirlToken gogirlToken = gogirlTokenService.getByToken(token);
......
......@@ -23,7 +23,7 @@ import com.gogirl.domain.user.customer.Customer;
import com.gogirl.domain.user.customer.CustomerBalanceRecord;
import com.gogirl.domain.xcx.WeekConfig;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMapper;
import com.gogirl.infrastructure.mapper.order.mall.MallOrderMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper;
......
package com.gogirl.infrastructure.subscribe.impl;
import com.gogirl.application.xcx.impl.AccessTokenService;
import com.gogirl.infrastructure.config.WxProperties;
import com.gogirl.infrastructure.config.property.WxProperties;
import com.gogirl.infrastructure.feign.wx.WxSubscribeControllerFeign;
import com.gogirl.infrastructure.subscribe.SubscribeService;
import com.gogirl.shared.wx.*;
......
......@@ -8,8 +8,8 @@ import com.github.binarywang.wxpay.exception.WxPayException;
import com.gogirl.application.order.mall.*;
import com.gogirl.application.xcx.GogirlTokenService;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.WxProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.config.property.WxProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
import com.gogirl.infrastructure.util.SessionUtils;
......
......@@ -18,7 +18,7 @@ import com.gogirl.infrastructure.common.annotation.GogirlMember;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.common.util.ListUtil;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.market.discount.DiscountConfigMapper;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardCustomerRelevanceMapper;
......
......@@ -15,7 +15,7 @@ import com.gogirl.domain.user.customer.CustomerBalanceRecord;
import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.exception.RRException;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.feign.wx.WxPayControllerFeign;
import com.gogirl.infrastructure.mapper.store.store.UserManageMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper;
......
......@@ -7,7 +7,7 @@ import com.gogirl.domain.store.store.StoreManage;
import com.gogirl.domain.store.store.StoreTechnician;
import com.gogirl.domain.user.customer.Customer;
import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.config.GogirlProperties;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMapper;
import com.gogirl.infrastructure.util.ImageUtil;
import com.gogirl.shared.user.query.qry.CustomerQuery;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment