一周菜谱
This commit is contained in:
parent
91033c7c3f
commit
517f628838
|
|
@ -0,0 +1,22 @@
|
|||
//package com.bonus.oss;
|
||||
//
|
||||
//import lombok.Data;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//
|
||||
//@ConfigurationProperties(
|
||||
// prefix = "oss"
|
||||
//)
|
||||
//@Data
|
||||
//public class OssProperties {
|
||||
// private String endpoint;
|
||||
// private String customDomain;
|
||||
// private Boolean pathStyleAccess = true;
|
||||
// private String appId;
|
||||
// private String region;
|
||||
// private String accessKey;
|
||||
// private String secretKey;
|
||||
// private String bucketName = "lnyst";
|
||||
// private Boolean useHttp = false;
|
||||
// private Integer expiresTime = 604800;
|
||||
// private Boolean useToken = false;
|
||||
//}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
//package com.bonus.oss;
|
||||
//
|
||||
//import org.springframework.beans.factory.InitializingBean;
|
||||
//import org.springframework.data.redis.core.convert.Bucket;
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.io.InputStream;
|
||||
//import java.net.URL;
|
||||
//import java.util.*;
|
||||
//
|
||||
//public class OssTemplate implements InitializingBean {
|
||||
// private final OssProperties ossProperties;
|
||||
// private AmazonS3 amazonS3;
|
||||
//
|
||||
// public InputStream getObject(String bucketName, String objectName) {
|
||||
// try {
|
||||
// return this.amazonS3.getObject(bucketName, objectName).getObjectContent();
|
||||
// } catch (Throwable var4) {
|
||||
// throw var4;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void removeObject(String bucketName, String objectName) throws Exception {
|
||||
// this.amazonS3.deleteObject(bucketName, objectName);
|
||||
// }
|
||||
//
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
// AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(this.ossProperties.getEndpoint(), this.ossProperties.getRegion());
|
||||
// AWSCredentials awsCredentials = new BasicAWSCredentials(this.ossProperties.getAccessKey(), this.ossProperties.getSecretKey());
|
||||
// AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
|
||||
// if (this.ossProperties.getUseHttp()) {
|
||||
// System.setProperty("com.amazonaws.sdk.disableCertChecking", "true");
|
||||
// }
|
||||
//
|
||||
// this.amazonS3 = (AmazonS3)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)).withClientConfiguration(clientConfiguration)).withCredentials(awsCredentialsProvider)).disableChunkedEncoding()).withPathStyleAccessEnabled(this.ossProperties.getPathStyleAccess())).build();
|
||||
// }
|
||||
//
|
||||
// public OssTemplate(final OssProperties ossProperties) {
|
||||
// this.ossProperties = ossProperties;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
//package com.bonus.service;
|
||||
//
|
||||
//import com.bonus.common.core.constant.CacheConstants;
|
||||
//import com.bonus.common.core.utils.StringUtils;
|
||||
//import com.bonus.common.core.utils.VerificationCodeUtils;
|
||||
//import com.bonus.common.redis.service.RedisService;
|
||||
//import com.bonus.common.security.config.VerificationCodeConfig;
|
||||
//import org.springframework.mail.SimpleMailMessage;
|
||||
//import org.springframework.mail.javamail.JavaMailSender;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//
|
||||
//import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
|
||||
//
|
||||
///**
|
||||
// * @author bonus
|
||||
// */
|
||||
//@Service
|
||||
//public class EmailService {
|
||||
// @Resource
|
||||
// private VerificationCodeConfig verificationCodeConfig;
|
||||
// @Resource
|
||||
// private RedisService redisService;
|
||||
// @Resource
|
||||
// private JavaMailSender mailSender;
|
||||
//
|
||||
// /**
|
||||
// * 发送简单邮件
|
||||
// *
|
||||
// * @param to 接收者邮箱地址
|
||||
// */
|
||||
// public String sendSimpleEmail(String to) {
|
||||
// String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
|
||||
// String str = verificationCodeConfig.getContent().replace("<code>", code);
|
||||
// str = str.replace("<time>", verificationCodeConfig.getTime().toString());
|
||||
// SimpleMailMessage message = new SimpleMailMessage();
|
||||
// // 发件人邮箱地址
|
||||
// message.setFrom("2642480752@qq.com");
|
||||
// // 收件人邮箱地址
|
||||
// message.setTo(to);
|
||||
// // 邮件主题
|
||||
// message.setSubject(verificationCodeConfig.getTitle());
|
||||
// // 邮件内容
|
||||
// message.setText(str);
|
||||
// // 发送邮件
|
||||
// mailSender.send(message);
|
||||
// String uuid = StringUtils.randomUUID();
|
||||
// String verifyKey = CacheConstants.VERIFICATION_CODE + uuid;
|
||||
// redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
|
||||
// return uuid;
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
//package com.bonus.service;
|
||||
//
|
||||
//import com.bonus.common.core.constant.CacheConstants;
|
||||
//import com.bonus.common.core.exception.CaptchaException;
|
||||
//import com.bonus.common.core.utils.StringUtils;
|
||||
//import com.bonus.common.core.utils.VerificationCodeUtils;
|
||||
//import com.bonus.common.core.utils.sms.SmsUtils;
|
||||
//import com.bonus.common.redis.service.RedisService;
|
||||
//import com.bonus.common.security.config.VerificationCodeConfig;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//
|
||||
//import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
|
||||
//
|
||||
///**
|
||||
// * @author bonus
|
||||
// */
|
||||
//@Component
|
||||
//public class SmsService {
|
||||
// @Resource
|
||||
// private VerificationCodeConfig verificationCodeConfig;
|
||||
// @Resource
|
||||
// private RedisService redisService;
|
||||
//
|
||||
// /**
|
||||
// * 生成手机验证码
|
||||
// *
|
||||
// * @return AjaxResult
|
||||
// * @throws CaptchaException 自定义captcha 异常
|
||||
// */
|
||||
// public void sendSimplePhone(String to) {
|
||||
// if (StringUtils.isEmpty(to)) {
|
||||
// throw new CaptchaException("手机号不能为空");
|
||||
// }
|
||||
// String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
|
||||
// String str = verificationCodeConfig.getContent().replace("<code>", code);
|
||||
// str = str.replace("<time>", verificationCodeConfig.getTime().toString());
|
||||
// String s = SmsUtils.smsToken(to, str, "");
|
||||
// if (StringUtils.isNotEmpty(s)) {
|
||||
// if (s.contains("ok")) {
|
||||
// String verifyKey = CacheConstants.VERIFICATION_CODE + StringUtils.nvl(to, "");
|
||||
// redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
|
||||
// } else {
|
||||
// throw new CaptchaException("获取短信失败");
|
||||
// }
|
||||
// } else {
|
||||
// throw new CaptchaException("获取短信失败");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
//package net.xnzn.service;
|
||||
//
|
||||
//import cn.hutool.core.util.ObjectUtil;
|
||||
//import com.bonus.common.core.constant.SecurityConstants;
|
||||
//import com.bonus.common.core.utils.JwtUtils;
|
||||
//import com.bonus.common.core.utils.ServletUtils;
|
||||
//import com.bonus.common.core.utils.StringUtils;
|
||||
//import com.bonus.common.core.utils.ip.IpUtils;
|
||||
//import com.bonus.common.core.utils.uuid.IdUtils;
|
||||
//import com.bonus.common.core.web.domain.AjaxResult;
|
||||
//import com.bonus.common.redis.service.RedisService;
|
||||
//import com.bonus.common.security.utils.SecurityUtils;
|
||||
//import com.bonus.config.SystemConfig;
|
||||
//import com.bonus.system.api.RemoteUserService;
|
||||
//import com.bonus.system.api.domain.SysUser;
|
||||
//import com.bonus.system.api.model.LoginUser;
|
||||
//import net.xnzn.domain.CustInfoAppIdLoginVO;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import javax.annotation.Resource;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.util.Date;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//
|
||||
///**
|
||||
// * token验证处理
|
||||
// *
|
||||
// * @author bonus
|
||||
// */
|
||||
//@Component
|
||||
//public class TokenService {
|
||||
//
|
||||
// @Resource
|
||||
// private SystemConfig systemConfig;
|
||||
//
|
||||
// private static final Logger log = LoggerFactory.getLogger(TokenService.class);
|
||||
//
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
//
|
||||
// @Resource
|
||||
// RemoteUserService remoteUserService;
|
||||
//
|
||||
// protected static final long MILLIS_SECOND = 1000;
|
||||
//
|
||||
// protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
|
||||
//
|
||||
// private final static long EXPIRETIME = 720L;
|
||||
//
|
||||
// private final static String CUST_ACCESS_TOKEN = "cust_login_tokens:";
|
||||
//
|
||||
// private final static String CUST_LOGIN_USER_KEY = "cust_login_users:";
|
||||
//
|
||||
// private final static Long MILLIS_MINUTE_TEN = 120L * MILLIS_MINUTE;
|
||||
//
|
||||
// private static final String DETAILS_USER_ID = "user_id";
|
||||
// private static final String DETAILS_USERNAME = "username";
|
||||
// private static final String USER_KEY = "user_key";
|
||||
// private static final String LOGIN_USER = "login_user";
|
||||
//
|
||||
// /**
|
||||
// * 创建令牌
|
||||
// */
|
||||
// public Map<String, Object> createToken(CustInfoAppIdLoginVO loginUser) {
|
||||
// // 检查并删除已有的token
|
||||
// delExistingToken(loginUser.getCustId());
|
||||
// String token = IdUtils.fastUUID();
|
||||
// Long custId = loginUser.getCustId();
|
||||
// String userName = loginUser.getCustName();
|
||||
// loginUser.setToken(token);
|
||||
// loginUser.setCustId(custId);
|
||||
// loginUser.setCustName(userName);
|
||||
// loginUser.setIpaddr(IpUtils.getIpAddr());
|
||||
// refreshToken(loginUser);
|
||||
// // Jwt存储信息
|
||||
// Map<String, Object> claimsMap = new HashMap<String, Object>(16);
|
||||
// claimsMap.put(USER_KEY, token);
|
||||
// claimsMap.put(DETAILS_USER_ID, custId);
|
||||
// claimsMap.put(DETAILS_USERNAME, userName);
|
||||
// String accessToken = JwtUtils.createToken(claimsMap);
|
||||
// Map<String, Object> rspMap = new HashMap<String, Object>(16);
|
||||
// rspMap.put("cust_access_token", accessToken);
|
||||
// rspMap.put("expires_in", EXPIRETIME);
|
||||
// rspMap.put("isLogin", isLogin(String.valueOf(custId)));
|
||||
// long tokenTime = getTokenTime();
|
||||
// //对token进行存储
|
||||
// redisService.setCacheObject(CUST_LOGIN_USER_KEY + custId, token, tokenTime, TimeUnit.MINUTES);
|
||||
// return rspMap;
|
||||
// }
|
||||
//
|
||||
// public boolean isLogin(String userId) {
|
||||
// String existingTokenKey = redisService.getCacheObject(CUST_LOGIN_USER_KEY + userId);
|
||||
// return existingTokenKey != null;
|
||||
// }
|
||||
//
|
||||
// public boolean isKey(String key) {
|
||||
// return redisService.hasKey(getTokenKey(key));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除已有的token
|
||||
// */
|
||||
// public void delExistingToken(Long userId) {
|
||||
// String existingTokenKey = redisService.getCacheObject(CUST_LOGIN_USER_KEY + userId);
|
||||
// if (existingTokenKey != null) {
|
||||
// redisService.deleteObject(getTokenKey(existingTokenKey));
|
||||
// redisService.deleteObject(CUST_LOGIN_USER_KEY + userId);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取用户身份信息
|
||||
// *
|
||||
// * @return 用户信息
|
||||
// */
|
||||
// public CustInfoAppIdLoginVO getLoginUser() {
|
||||
// return getLoginUser(ServletUtils.getRequest());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取用户身份信息
|
||||
// *
|
||||
// * @return 用户信息
|
||||
// */
|
||||
// public CustInfoAppIdLoginVO getLoginUser(HttpServletRequest request) {
|
||||
// // 获取请求携带的令牌
|
||||
// String token = SecurityUtils.getToken(request);
|
||||
// return getLoginUser(token);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取用户身份信息
|
||||
// *
|
||||
// * @return 用户信息
|
||||
// */
|
||||
// public CustInfoAppIdLoginVO getLoginUser(String token) {
|
||||
// CustInfoAppIdLoginVO user = null;
|
||||
// try {
|
||||
// if (StringUtils.isNotEmpty(token)) {
|
||||
// String userkey = JwtUtils.getUserKey(token);
|
||||
// user = redisService.getCacheObject(getTokenKey(userkey));
|
||||
// return user;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取用户信息异常'{}'", e.getMessage());
|
||||
// }
|
||||
// return user;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 设置用户身份信息
|
||||
// */
|
||||
// public void setLoginUser(CustInfoAppIdLoginVO loginUser) {
|
||||
// if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) {
|
||||
// refreshToken(loginUser);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除用户缓存信息
|
||||
// */
|
||||
// public void delLoginUser(String token) {
|
||||
// if (StringUtils.isNotEmpty(token)) {
|
||||
// String userkey = JwtUtils.getUserKey(token);
|
||||
// redisService.deleteObject(getTokenKey(userkey));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 验证令牌有效期,相差不足120分钟,自动刷新缓存
|
||||
// *
|
||||
// * @param loginUser
|
||||
// */
|
||||
// public void verifyToken(CustInfoAppIdLoginVO loginUser) {
|
||||
// long expireTime = loginUser.getExpireTime();
|
||||
// long currentTime = System.currentTimeMillis();
|
||||
// if (expireTime - currentTime <= MILLIS_MINUTE_TEN) {
|
||||
// refreshToken(loginUser);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 刷新令牌有效期
|
||||
// *
|
||||
// * @param loginUser 登录信息
|
||||
// */
|
||||
// public void refreshToken(CustInfoAppIdLoginVO loginUser) {
|
||||
// long tokenTime = getTokenTime();
|
||||
// loginUser.setLoginTime(System.currentTimeMillis());
|
||||
// loginUser.setExpireTime(loginUser.getLoginTime() + tokenTime * MILLIS_MINUTE);
|
||||
// // 根据uuid将loginUser缓存
|
||||
// String userKey = getTokenKey(loginUser.getToken());
|
||||
// redisService.setCacheObject(userKey, loginUser, tokenTime, TimeUnit.MINUTES);
|
||||
// }
|
||||
//
|
||||
// private String getTokenKey(String token) {
|
||||
// return CUST_ACCESS_TOKEN + token;
|
||||
// }
|
||||
//
|
||||
// private Long getTokenTime(){
|
||||
// long tokenTime = 20L;
|
||||
// String redisResult = redisService.getCacheObject("sys_config:"+ "sys.visit.tokentime");
|
||||
// if(!redisResult.isEmpty()) {
|
||||
// tokenTime = Long.parseLong(redisResult);
|
||||
// }else {
|
||||
// Long result = systemConfig.getTokenTime();
|
||||
// if (!ObjectUtil.isEmpty(result)){
|
||||
// tokenTime = result;
|
||||
// }
|
||||
// }
|
||||
// return tokenTime;
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bonus.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Lazy(false)
|
||||
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
|
||||
private static final Logger log = LoggerFactory.getLogger(SpringContextHolder.class);
|
||||
private static ApplicationContext applicationContext = null;
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
SpringContextHolder.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public static <T> T getBean(String name) {
|
||||
return (T) applicationContext.getBean(name);
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> requiredType) {
|
||||
return applicationContext.getBean(requiredType);
|
||||
}
|
||||
|
||||
public static void clearHolder() {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("清除SpringContextHolder中的ApplicationContext:" + String.valueOf(applicationContext));
|
||||
}
|
||||
|
||||
applicationContext = null;
|
||||
}
|
||||
|
||||
public static void publishEvent(ApplicationEvent event) {
|
||||
if (applicationContext != null) {
|
||||
applicationContext.publishEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
clearHolder();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
//package com.bonus.core.common.enums;
|
||||
//
|
||||
//public enum DelFlagEnum {
|
||||
// DEL_TRUE(1, "删除"),
|
||||
// DEL_FALSE(2, "正常");
|
||||
//
|
||||
// private final Integer key;
|
||||
// private final String value;
|
||||
//
|
||||
// private DelFlagEnum(Integer key, String value) {
|
||||
// this.key = key;
|
||||
// this.value = value;
|
||||
// }
|
||||
//
|
||||
// public Integer key() {
|
||||
// return this.key;
|
||||
// }
|
||||
//
|
||||
// public String value() {
|
||||
// return this.value;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -2,6 +2,9 @@
|
|||
//
|
||||
//import cn.hutool.core.text.CharSequenceUtil;
|
||||
//import javax.annotation.PostConstruct;
|
||||
//import com.bonus.oss.OssProperties;
|
||||
//import com.bonus.oss.OssTemplate;
|
||||
//import com.bonus.utils.SpringContextHolder;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -112,7 +115,7 @@
|
|||
// }
|
||||
//
|
||||
// public static OssTemplate getOssTemplate() {
|
||||
// return (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
|
||||
// return (OssTemplate) SpringContextHolder.getBean(OssTemplate.class);
|
||||
// }
|
||||
//
|
||||
// public static OssProperties getOssProperties() {
|
||||
|
|
@ -124,7 +127,7 @@
|
|||
// return url;
|
||||
// } else {
|
||||
// try {
|
||||
// String decodedUrl = URLDecoder.decode(url, StandardCharsets.UTF_8);
|
||||
// String decodedUrl = URLDecoder.decode(url);
|
||||
// return !decodedUrl.equals(url) ? decodedUrl : url;
|
||||
// } catch (IllegalArgumentException var2) {
|
||||
// log.info("图片url解码失败,图片url:{},异常信息_:{},详情_:", new Object[]{url, var2.getMessage(), var2});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import org.springframework.web.context.request.RequestContextHolder;
|
||||
//import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
//
|
||||
//import java.util.Objects;
|
||||
//
|
||||
//public class SysUtilProxy {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ import java.util.List;
|
|||
public class MktEffectiveUserVO implements Serializable {
|
||||
private Long effId;
|
||||
private Integer userType;
|
||||
// private Long orgId;
|
||||
// private Integer psnType;
|
||||
private List<Long> orgIdList;
|
||||
private List<Integer> psnTypeList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,4 @@ public class AppletWeekCanteenVO {
|
|||
private String stallImgUrl;
|
||||
@ApiModelProperty("档口标签")
|
||||
private List<String> labelList;
|
||||
// @ApiModelProperty("档口标签")
|
||||
// private String labelName;
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue