1、搭建了乐益播商家版app的开发框架。

2、开发了用户注册,账号密码登录,手机验证码登录的功能模块。
3、开发了商家模块的部分功能。
4、开发了总部审核用户,禁用,启用用户等功能模块。
5、整合了七牛云存储的功能模块(暂时没有账号,密钥等信息,待测试)。
6、创建了联盟商家,商品的数据库表
This commit is contained in:
2021-12-15 15:14:39 +08:00
commit 6fbb29ed74
108 changed files with 11330 additions and 0 deletions

View File

@ -0,0 +1,13 @@
package com.xkrs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BusinessShoppingApplication {
public static void main(String[] args) {
SpringApplication.run(BusinessShoppingApplication.class, args);
}
}

View File

@ -0,0 +1,36 @@
package com.xkrs.common.account;
/**
* 账户实体
* @author tajochen
*/
public class AccountCredentials {
private String userName;
private String password;
private boolean remember;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isRemember() {
return remember;
}
public void setRemember(boolean remember) {
this.remember = remember;
}
}

View File

@ -0,0 +1,123 @@
package com.xkrs.common.account;
import com.xkrs.model.entity.SysAuthorityEntity;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.service.SysAuthorityService;
import com.xkrs.service.SysRoleService;
import com.xkrs.service.SysUserService;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static com.xkrs.utils.EncryptDecryptUtil.encry256;
/**
* 自定义认证Provider
* @author tajochen
*/
@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {
@Resource
private SysUserService sysUserService;
@Resource
private SysRoleService sysRoleService;
@Resource
private SysAuthorityService sysAuthorityService;
/**
* 初使化时将已静态化的Service实例化
*/
protected static CustomAuthenticationProvider customAuthenticationProvider;
/**
* 通过@PostConstruct实现初始化bean之前进行的操作
*/
@PostConstruct
public void init() {
customAuthenticationProvider = this;
customAuthenticationProvider.sysUserService = this.sysUserService;
customAuthenticationProvider.sysRoleService = this.sysRoleService;
customAuthenticationProvider.sysAuthorityService = this.sysAuthorityService;
}
/**
* 用户认证授权
* @param authentication
* @return
* @throws AuthenticationException
*/
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
// 获取认证的用户名 & 密码
String userName = authentication.getName();
String password = authentication.getCredentials().toString();
SysUserEntity userEntity = customAuthenticationProvider.sysUserService.getSysUserByUserName(userName);
// 检查用户是否存在
if(userEntity == null){
throw new BadCredentialsException("user don't exist");
}
// 检查用户是否激活
if(userEntity.getActiveFlag().intValue() != 0){
throw new DisabledException("user not activated");
}
//检查用户状态是否正常
if(userEntity.getStatusCode() != 0){
throw new DisabledException("user state exception");
}
// 认证逻辑
String encryptPassword = encry256(password + userEntity.getSalt());
if (encryptPassword.equals(userEntity.getPassword())) {
// 设置权限列表
ArrayList<GrantedAuthority> permissions = new ArrayList<>();
List<SysAuthorityEntity> permissionList = customAuthenticationProvider.sysAuthorityService.
getSysAuthorityListByUserName(userName);
for(SysAuthorityEntity sysAuthorityEntity : permissionList) {
permissions.add(new GrantedAuthorityImpl(sysAuthorityEntity.getAuthorityName()));
}
// 生成令牌
Authentication authToken = new UsernamePasswordAuthenticationToken(userName, encryptPassword, permissions);
return authToken;
}else if(password.equals(userEntity.getPassword())){
// 设置权限列表
ArrayList<GrantedAuthority> permissions = new ArrayList<>();
List<SysAuthorityEntity> permissionList = customAuthenticationProvider.sysAuthorityService.
getSysAuthorityListByUserName(userName);
for(SysAuthorityEntity sysAuthorityEntity : permissionList) {
permissions.add(new GrantedAuthorityImpl(sysAuthorityEntity.getAuthorityName()));
}
// 生成令牌
Authentication authToken = new UsernamePasswordAuthenticationToken(userName, encryptPassword, permissions);
return authToken;
}
else {
throw new BadCredentialsException("user password error");
}
}
/**
* 是否可以提供输入类型的认证服务
* @param authentication
* @return
*/
@Override
public boolean supports(Class<?> authentication) {
return authentication.equals(UsernamePasswordAuthenticationToken.class);
}
}

View File

@ -0,0 +1,25 @@
package com.xkrs.common.account;
import org.springframework.security.core.GrantedAuthority;
/**
* 权限认证服务
* @author tajochen
*/
public class GrantedAuthorityImpl implements GrantedAuthority {
private String authority;
public GrantedAuthorityImpl(String authority) {
this.authority = authority;
}
public void setAuthority(String authority) {
this.authority = authority;
}
@Override
public String getAuthority() {
return this.authority;
}
}

View File

@ -0,0 +1,28 @@
package com.xkrs.common.account;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* 拦截所有需要JWT的请求然后调用TokenAuthenticationService类的静态方法去做JWT验证
* @author tajochen
*/
public class JwtAuthenticationFilter extends GenericFilterBean {
@Override
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
Authentication authentication = TokenAuthenticationService.getAuthentication((HttpServletRequest)request);
SecurityContextHolder.getContext().setAuthentication(authentication);
filterChain.doFilter(request,response);
}
}

View File

@ -0,0 +1,132 @@
package com.xkrs.common.account;
import com.xkrs.common.encapsulation.OutputEncapsulation;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.model.vo.SysUserVo;
import com.xkrs.service.SysUserService;
import com.xkrs.utils.IpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.annotation.Resource;
import javax.servlet.FilterChain;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Locale;
/**
* jwt登录过滤器
* @author tajochen
*/
public class JwtLoginFilter extends AbstractAuthenticationProcessingFilter {
private static final Logger logger = LoggerFactory.getLogger(JwtLoginFilter.class);
@Resource
private SysUserService sysUserService;
public JwtLoginFilter(String url, AuthenticationManager authManager) {
super(new AntPathRequestMatcher(url));
setAuthenticationManager(authManager);
}
/**
* 登录时验证
* @param req
* @param res
* @return
*/
@Override
public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) throws UnsupportedEncodingException {
req.setCharacterEncoding("UTF-8");
res.setHeader("Access-Control-Allow-Origin","*");
res.setHeader("Access-Control-Allow-Credentials", "false");
AccountCredentials creds = new AccountCredentials();
//获取表单数据
String userName = req.getParameter("userName");
String password = req.getParameter("password");
String rememberMe = req.getParameter("remember");
//如果用户名密码为空
if(userName == null||password == null|| userName.trim().isEmpty()||password.trim().isEmpty()){
throw new BadCredentialsException("user or password is null");
}
if(rememberMe == null||rememberMe.isEmpty()){
rememberMe = "false";
}
creds.setUserName(userName.trim());
creds.setPassword(password.trim());
creds.setRemember(Boolean.parseBoolean(rememberMe));
// 返回一个验证令牌
return getAuthenticationManager().authenticate(
new UsernamePasswordAuthenticationToken(
creds.getUserName(),
creds.getPassword()
)
);
}
/**
* 验证成功后调用
* @param req
* @param response
* @param chain
* @param auth
* @throws IOException
* @throws ServletException
*/
@Override
protected void successfulAuthentication(
HttpServletRequest req, HttpServletResponse response, FilterChain chain, Authentication auth) {
if(sysUserService==null){
ServletContext servletContext = req.getServletContext();
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
sysUserService = webApplicationContext.getBean(SysUserService.class);
}
//更新用户登录信息
sysUserService.updateSysUserLogin(auth.getName(), IpUtil.getIpAddr(req));
SysUserVo sysUserVo = sysUserService.selectUserByUserName(auth.getName());
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "false");
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
TokenAuthenticationService.addAuthentication(response, auth.getName(),auth.getAuthorities(),sysUserVo);
}
/**
* 验证失败后调用
* @param request
* @param response
* @param failed
* @throws IOException
*/
@Override
protected void unsuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response,
AuthenticationException failed) throws IOException {
Locale locale = LocaleContextHolder.getLocale();
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "false");
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
// 将 JWT 写入 body
PrintWriter out = response.getWriter();
out.append(OutputEncapsulation.outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, failed.getLocalizedMessage(), locale));
response.setStatus(HttpServletResponse.SC_OK);
}
}

View File

@ -0,0 +1,129 @@
package com.xkrs.common.account;
import com.xkrs.common.encapsulation.OutputEncapsulation;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.model.vo.SysUserVo;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import javax.crypto.SecretKey;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
/**
* token认证服务
* @author tajochen
*/
public class TokenAuthenticationService {
private static final Logger logger = LoggerFactory.getLogger(TokenAuthenticationService.class);
/**
* 过期时间6小时
*/
static public final long EXPIRATIONTIME = 21_600_000;
/**
* 加密密钥
*/
static public final String SECRET_KEY = "0Y9H364Q9Y908262F25LMXGIKIN5N858XM3674GWL2DD8X1DS4W6I722IRY8PS4XPNB6U303" +
"45HBVCUL94STG8C3Z53T7A09JJ100I56YE9894CI11PX9J71HIZ8L5Y2O504C4E2K8276425UA8734833F45K36878FXAG799QV9LXU" +
"JOI3XA2046UPG8TB2OT84R5T6ZB127N9ZPJ7AJMC41JVHB2WK2B6H8NL45LZNAZ666KHZH3QUT65UX6F8";
/**
* Token前缀
*/
static public final String TOKEN_PREFIX = "Bearer";
/**
* 存放Token的Header Key
*/
static final String HEADER_STRING = "Authorization";
static SecretKey key = Keys.hmacShaKeyFor(SECRET_KEY.getBytes());
/**
* JWT生成方法
* @param response
* @param userName
* @param authorities
*/
static void addAuthentication(HttpServletResponse response, String userName,
Collection<? extends GrantedAuthority> authorities, SysUserVo sysUserVo) {
Locale locale = new Locale("zh", "CN");
Map map = new HashMap(3);
StringBuffer auths = new StringBuffer();
String authsList = "";
for(GrantedAuthority r : authorities) {
auths.append("," + r.getAuthority());
}
authsList = auths.toString();
if(authsList.length()>1){
authsList=authsList.substring(1,authsList.length());
}else{
logger.warn(userName +" has no permission!");
}
// 生成JWT
String jwt = Jwts.builder()
.setSubject(userName)
.setIssuer("https://www.microservice.com")
.setAudience(userName)
// 保存权限
.claim("auths", authsList)
// 有效期设置
.setExpiration(new Date(System.currentTimeMillis() + EXPIRATIONTIME))
// 签名设置
.signWith(key)
.compact();
// 将 JWT 写入 body
PrintWriter out = null;
try {
out = response.getWriter();
}
catch (IOException e) {
e.printStackTrace();
}
response.setStatus(HttpServletResponse.SC_OK);
map.put("user",sysUserVo);
map.put("token",jwt);
map.put("role",authsList);
out.append(OutputEncapsulation.outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale));
}
/**
* JWT验证方法
* @param request
* @return
*/
static Authentication getAuthentication(HttpServletRequest request) {
// 从Header中拿到token
String token = request.getHeader(HEADER_STRING);
if (token != null) {
try {
// 解析 Token
Claims claims = Jwts.parserBuilder()
.setSigningKey(key).build()
// 去掉 Bearer
.parseClaimsJws(token.replace(TOKEN_PREFIX, ""))
.getBody();
// 获取用户名
String userName = claims.getSubject();
// 获取权限
List<GrantedAuthority> authorities = AuthorityUtils.commaSeparatedStringToAuthorityList((String) claims.get("auths"));
return new UsernamePasswordAuthenticationToken(userName, null, authorities);
} catch(Exception e) {
// the sub field was missing or did not have a value
return null;
}
} else {
return null;
}
}
}

View File

@ -0,0 +1,23 @@
package com.xkrs.common.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource;
/**
* 系统跨域配置
* @author tajochen
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Resource
private CorsInterceptor corsInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(corsInterceptor);
}
}

View File

@ -0,0 +1,29 @@
package com.xkrs.common.config;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 跨域处理
* @author tajochen
*/
@Component
public class CorsInterceptor implements HandlerInterceptor {
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
//添加跨域CORS
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "false");
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
response.setHeader("Access-Control-Allow-Headers", "Content-Type , Authorization," +
"Accept,Origin,X-Requested-With");
response.setHeader("Access-Control-Max-Age", "216000");
response.setHeader("Content-Type","application/json;charset=UTF-8");
return true;
}
}

View File

@ -0,0 +1,37 @@
package com.xkrs.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* WebMVC配置
* @author Tajochen
*/
@Configuration
public class MvcConfig implements WebMvcConfigurer {
/**
* 放行跨域请求
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*")
.allowedHeaders("*");
}
/**
* 定时任务线程池更改,防止多个任务并行
*/
@Bean
public TaskScheduler taskScheduler() {
final ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(5);
return scheduler;
}
}

View File

@ -0,0 +1,30 @@
package com.xkrs.common.config;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.io.Serializable;
/**
* Redis 缓存自动配置
* @author tajochen
*/
@Configuration
@AutoConfigureAfter(RedisAutoConfiguration.class)
public class RedisCacheAutoConfiguration {
@Bean
public RedisTemplate<String, Serializable> redisCacheTemplate(LettuceConnectionFactory redisConnectionFactory) {
RedisTemplate<String, Serializable> template = new RedisTemplate<>();
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
template.setConnectionFactory(redisConnectionFactory);
return template;
}
}

View File

@ -0,0 +1,187 @@
package com.xkrs.common.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.CacheResolver;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.time.Duration;
/**
* redis配置
* @author tajochen
*/
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport{
private static final Logger logger = LoggerFactory.getLogger(RedisConfig.class);
@Resource
private LettuceConnectionFactory lettuceConnectionFactory;
private static final Duration TIME_TO_LIVE = Duration.ofSeconds(3600*6);
@Bean
@Override
public KeyGenerator keyGenerator() {
// 设置自动key的生成规则配置spring boot的注解进行方法级别的缓存
return (target, method, params) -> {
StringBuilder sb = new StringBuilder();
sb.append(target.getClass().getName());
sb.append(":");
sb.append(method.getName());
for (Object obj : params) {
sb.append(":").append(obj);
}
// logger.info("自动生成Redis Key -> [{}]", rsToUse);
return String.valueOf(sb);
};
}
@Bean
@Override
public CacheManager cacheManager() {
// 关键点spring cache的注解使用的序列化都从这来没有这个配置的话使用的jdk自己的序列化
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
//key序列化方式
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(keySerializer()))
//value序列化方式
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(valueSerializer()))
.disableCachingNullValues()
.entryTtl(TIME_TO_LIVE);
RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager.RedisCacheManagerBuilder
.fromConnectionFactory(lettuceConnectionFactory)
.cacheDefaults(config)
.transactionAware();
return builder.build();
}
/**
* RedisTemplate配置 在单独使用redisTemplate的时候 重新定义序列化方式
*/
@Bean(name = "redisTemplate")
public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) {
// 设置序列化
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper om = new ObjectMapper();
// 配置null值序列化成空字符串
om.getSerializerProvider().setNullValueSerializer(new JsonSerializer<>() {
@Override
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString("");
}
});
// 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准
JavaTimeModule javaTimeModule = new JavaTimeModule();
om.registerModule(javaTimeModule);
om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// 其他设置
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance ,
ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
jackson2JsonRedisSerializer.setObjectMapper(om);
// 配置redisTemplate
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
redisTemplate.setKeySerializer(stringSerializer);
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
redisTemplate.setHashKeySerializer(stringSerializer);
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
private RedisSerializer<String> keySerializer() {
return new StringRedisSerializer();
}
private RedisSerializer<Object> valueSerializer() {
// 设置序列化
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(
Object.class);
ObjectMapper om = new ObjectMapper();
// 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准
JavaTimeModule javaTimeModule = new JavaTimeModule();
om.registerModule(javaTimeModule);
om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// 其他设置
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance ,
ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
jackson2JsonRedisSerializer.setObjectMapper(om);
return jackson2JsonRedisSerializer;
}
@Override
public CacheResolver cacheResolver() {
return null;
}
/**
* 设置数据存入 redis 的序列化方式,并开启事务
*
* @param redisTemplate
* @param factory
*/
private void initRedisTemplate(RedisTemplate<String, Object> redisTemplate, RedisConnectionFactory factory) {
//如果不配置Serializer那么存储的时候缺省使用String如果用User类型存储那么会提示错误User can't cast to String
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
// 开启事务
redisTemplate.setEnableTransactionSupport(true);
redisTemplate.setConnectionFactory(factory);
}
/**
* 注入封装RedisTemplate 给RedisUtil提供操作类
* @param redisTemplate
* @return RedisUtil
*/
@Bean(name = "redisUtil")
public RedisUtil redisUtil(RedisTemplate<String, Object> redisTemplate) {
RedisUtil redisUtil = new RedisUtil();
redisUtil.setRedisTemplate(redisTemplate);
return redisUtil;
}
@Override
@Bean
public CacheErrorHandler errorHandler() {
// 异常处理当Redis发生异常时打印日志但是程序正常走
logger.info("初始化 -> [{}]", "Redis CacheErrorHandler");
return null;
}
}

View File

@ -0,0 +1,533 @@
package com.xkrs.common.config;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* redis工具类
* @author tajochen
*/
public class RedisUtil {
private RedisTemplate<String, Object> redisTemplate;
public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
this.redisTemplate = redisTemplate;
}
/**
* 指定缓存失效时间
* @param key 键
* @param time 时间(秒)
* @return
*/
public boolean expire(String key,long time){
try {
if(time>0){
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 根据key 获取过期时间
* @param key 键 不能为null
* @return 时间(秒) 返回0 代表为永久有效
*/
public long getExpire(String key){
return redisTemplate.getExpire(key,TimeUnit.SECONDS);
}
/**
* 判断key是否存在
* @param key 键
* @return true 存在 false不存在
*/
public boolean hasKey(String key){
try {
return redisTemplate.hasKey(key);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 删除缓存
* @param key 可以传一个值 或多个
*/
@SuppressWarnings("unchecked")
public void del(String ... key){
if(key!=null&&key.length>0){
if(key.length==1){
redisTemplate.delete(key[0]);
}else{
redisTemplate.delete(String.valueOf(CollectionUtils.arrayToList(key)));
}
}
}
//============================String=============================
/**
* 普通缓存获取
* @param key 键
* @return 值
*/
public Object get(String key){
return key==null?null:redisTemplate.opsForValue().get(key);
}
/**
* 普通缓存放入
* @param key 键
* @param value 值
* @return true成功 false失败
*/
public boolean set(String key,Object value) {
try {
redisTemplate.opsForValue().set(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 普通缓存放入并设置时间
* @param key 键
* @param value 值
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
* @return true成功 false 失败
*/
public boolean set(String key,Object value,long time){
try {
if(time>0){
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
} else {
set(key, value);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 递增
* @param key 键
* @param delta 要增加几(大于0)
* @return
*/
public long incr(String key, long delta){
if(delta<0){
throw new RuntimeException("递增因子必须大于0");
}
return redisTemplate.opsForValue().increment(key, delta);
}
/**
* 递减
* @param key 键
* @param delta 要减少几(小于0)
* @return
*/
public long decr(String key, long delta){
if(delta<0){
throw new RuntimeException("递减因子必须大于0");
}
return redisTemplate.opsForValue().increment(key, -delta);
}
//================================Map=================================
/**
* HashGet
* @param key 键 不能为null
* @param item 项 不能为null
* @return 值
*/
public Object hget(String key,String item){
return redisTemplate.opsForHash().get(key, item);
}
/**
* 获取hashKey对应的所有键值
* @param key 键
* @return 对应的多个键值
*/
public Map<Object,Object> hmget(String key){
return redisTemplate.opsForHash().entries(key);
}
/**
* HashSet
* @param key 键
* @param map 对应多个键值
* @return true 成功 false 失败
*/
public boolean hmset(String key, Map<String,Object> map){
try {
redisTemplate.opsForHash().putAll(key, map);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* HashSet 并设置时间
* @param key 键
* @param map 对应多个键值
* @param time 时间(秒)
* @return true成功 false失败
*/
public boolean hmset(String key, Map<String,Object> map, long time){
try {
redisTemplate.opsForHash().putAll(key, map);
if(time>0){
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 向一张hash表中放入数据,如果不存在将创建
* @param key 键
* @param item 项
* @param value 值
* @return true 成功 false失败
*/
public boolean hset(String key,String item,Object value) {
try {
redisTemplate.opsForHash().put(key, item, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 向一张hash表中放入数据,如果不存在将创建
* @param key 键
* @param item 项
* @param value 值
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
* @return true 成功 false失败
*/
public boolean hset(String key,String item,Object value,long time) {
try {
redisTemplate.opsForHash().put(key, item, value);
if(time>0){
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 删除hash表中的值
* @param key 键 不能为null
* @param item 项 可以使多个 不能为null
*/
public void hdel(String key, Object... item){
redisTemplate.opsForHash().delete(key,item);
}
/**
* 判断hash表中是否有该项的值
* @param key 键 不能为null
* @param item 项 不能为null
* @return true 存在 false不存在
*/
public boolean hHasKey(String key, String item){
return redisTemplate.opsForHash().hasKey(key, item);
}
/**
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
* @param key 键
* @param item 项
* @param by 要增加几(大于0)
* @return
*/
public double hincr(String key, String item,double by){
return redisTemplate.opsForHash().increment(key, item, by);
}
/**
* hash递减
* @param key 键
* @param item 项
* @param by 要减少记(小于0)
* @return
*/
public double hdecr(String key, String item,double by){
return redisTemplate.opsForHash().increment(key, item,-by);
}
//============================set=============================
/**
* 根据key获取Set中的所有值
* @param key 键
* @return
*/
public Set<Object> sGet(String key){
try {
return redisTemplate.opsForSet().members(key);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 根据value从一个set中查询,是否存在
* @param key 键
* @param value 值
* @return true 存在 false不存在
*/
public boolean sHasKey(String key,Object value){
try {
return Boolean.TRUE.equals(redisTemplate.opsForSet().isMember(key, value));
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将数据放入set缓存
* @param key 键
* @param values 值 可以是多个
* @return 成功个数
*/
public long sSet(String key, Object...values) {
try {
return redisTemplate.opsForSet().add(key, values);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 将set数据放入缓存
* @param key 键
* @param time 时间(秒)
* @param values 值 可以是多个
* @return 成功个数
*/
public long sSetAndTime(String key,long time,Object...values) {
try {
Long count = redisTemplate.opsForSet().add(key, values);
if(time>0)
{expire(key, time);}
return count;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 获取set缓存的长度
* @param key 键
* @return
*/
public long sGetSetSize(String key){
try {
return redisTemplate.opsForSet().size(key);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 移除值为value的
* @param key 键
* @param values 值 可以是多个
* @return 移除的个数
*/
public long setRemove(String key, Object ...values) {
try {
Long count = redisTemplate.opsForSet().remove(key, values);
return count;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
//===============================list=================================
/**
* 获取list缓存的内容
* @param key 键
* @param start 开始
* @param end 结束 0 到 -1代表所有值
* @return
*/
public List<Object> lGet(String key, long start, long end){
try {
return redisTemplate.opsForList().range(key, start, end);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 获取list缓存的长度
* @param key 键
* @return
*/
public long lGetListSize(String key){
try {
return redisTemplate.opsForList().size(key);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 通过索引 获取list中的值
* @param key 键
* @param index 索引 index>=0时 0 表头1 第二个元素依次类推index<0时-1表尾-2倒数第二个元素依次类推
* @return
*/
public Object lGetIndex(String key,long index){
try {
return redisTemplate.opsForList().index(key, index);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 将list放入缓存
* @param key 键
* @param value 值
* @return
*/
public boolean lSet(String key, Object value) {
try {
redisTemplate.opsForList().rightPush(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将list放入缓存
* @param key 键
* @param value 值
* @param time 时间(秒)
* @return
*/
public boolean lSet(String key, Object value, long time) {
try {
redisTemplate.opsForList().rightPush(key, value);
if (time > 0)
{expire(key, time);}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将list放入缓存
* @param key 键
* @param value 值
* @return
*/
public boolean lSet(String key, List<Object> value) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将list放入缓存
* @param key 键
* @param value 值
* @param time 时间(秒)
* @return
*/
public boolean lSet(String key, List<Object> value, long time) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
if (time > 0) {
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 根据索引修改list中的某条数据
* @param key 键
* @param index 索引
* @param value 值
* @return
*/
public boolean lUpdateIndex(String key, long index,Object value) {
try {
redisTemplate.opsForList().set(key, index, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 移除N个值为value
* @param key 键
* @param count 移除多少个
* @param value 值
* @return 移除的个数
*/
public long lRemove(String key,long count,Object value) {
try {
Long remove = redisTemplate.opsForList().remove(key, count, value);
return remove;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
}

View File

@ -0,0 +1,63 @@
package com.xkrs.common.config;
import com.xkrs.common.account.CustomAuthenticationProvider;
import com.xkrs.common.account.JwtAuthenticationFilter;
import com.xkrs.common.account.JwtLoginFilter;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled=true)
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 设置 HTTP 验证规则
* @param http
* @throws Exception
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
// 关闭csrf验证
http.csrf().disable()
// 对请求进行认证
.authorizeRequests()
// 所有 / 的所有请求 都放行
.antMatchers("/").permitAll()
// 所有OPTIONS请求都放行
.antMatchers(HttpMethod.OPTIONS).permitAll()
// 所有 /user/add 用户注册 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/user/add").permitAll()
// 所有 /user/check/duplicate 检查用户名是否重复 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/user/check/duplicate").permitAll()
// 所有 /login 用户登录 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/login").permitAll()
// 所有 app 用户注册 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll()
// 手机号登录
.antMatchers(HttpMethod.POST,"/api/user/loginByPhone").permitAll()
// 所有其它请求需要身份认证
.anyRequest().authenticated()
.and()
// 添加一个过滤器 所有访问 /login 的请求交给 JWTLoginFilter 来处理 这个类处理所有的JWT相关内容
.addFilterBefore(new JwtLoginFilter("/api/login", authenticationManager()),
UsernamePasswordAuthenticationFilter.class)
// 添加一个过滤器验证其他请求的Token是否合法
.addFilterBefore(new JwtAuthenticationFilter(),
UsernamePasswordAuthenticationFilter.class);
;}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// 使用自定义身份验证组件
auth.authenticationProvider(new CustomAuthenticationProvider());
}
}

View File

@ -0,0 +1,59 @@
package com.xkrs.common.encapsulation;
import java.io.Serializable;
/**
* 输出信息对象
* @author tajochen
* @param <T>
*/
public class EncapsulationObejct<T> implements Serializable {
/**
* 状态码
*/
int status;
/**
* 提示信息
*/
String msg;
/**
* 数据
*/
T data;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@Override
public String toString() {
return "EncapsulationObejct{" +
"status=" + status +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
}

View File

@ -0,0 +1,96 @@
package com.xkrs.common.encapsulation;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.stereotype.Component;
import org.springframework.validation.FieldError;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
/**
* 输出信息封装
* @author tajochen
*/
@Component
public class OutputEncapsulation {
private static final Logger logger = LoggerFactory.getLogger(OutputEncapsulation.class);
/**
* 读取多国语言文件
* @return
*/
public static MessageSource messageSource() {
Properties properties = new Properties();
// 使用ClassLoader加载properties配置文件生成对应的输入流
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties");
// 使用properties对象加载输入流
try {
properties.load(in);
} catch (IOException e) {
e.printStackTrace();
}
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("i18n/messages");
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
}
/**
* 封装输出数据
* @param promptMessageEnum
* @param obj
* @return
*/
public static String outputEncapsulationObject(PromptMessageEnum promptMessageEnum, Object obj, Locale locale) {
EncapsulationObejct encapsulationObejct = new EncapsulationObejct();
encapsulationObejct.setStatus(promptMessageEnum.getCode());
encapsulationObejct.setMsg(messageSource().getMessage(promptMessageEnum.getText(),null,locale));
encapsulationObejct.setData(obj);
ObjectMapper objectMapper = new ObjectMapper();
// 忽略无法转换的对象
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
// 忽略json字符串中不识别的属性
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// 解决jackson无法反序列化LocalDateTime的问题,引入jsr310标准
JavaTimeModule javaTimeModule = new JavaTimeModule();
objectMapper.registerModule(javaTimeModule);
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
String strByEo = "";
try {
strByEo = objectMapper.writeValueAsString(encapsulationObejct);
} catch (JsonProcessingException e) {
e.printStackTrace();
logger.warn(e.toString());
}
return strByEo;
}
/**
* 输出请求值检验错误信息
* @param fieldErrors
* @return
*/
public static String outputEncapsulationErrorList(List<FieldError> fieldErrors, Locale locale){
List<String> errorMsg = new ArrayList<>();
for (FieldError fieldError : fieldErrors) {
String errMessage = fieldError.getDefaultMessage().subSequence(1,fieldError.getDefaultMessage().length()-1).toString();
errorMsg.add(messageSource().getMessage(errMessage,null,locale));
}
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,errorMsg,locale);
}
}

View File

@ -0,0 +1,62 @@
package com.xkrs.common.encapsulation;
/**
* 提示信息枚举
* @author tajochen
*/
public enum PromptMessageEnum{
// 执行成功
SUCCESS(0, "sys.message.success"),
// 用户权限错误或非法操作: 1001-1999
USER_NOT_LOGGED(1001, "sys.message.user.not_logged_in"),
USER_LOGIN_ERROR(1002, "sys.message.user.login_error"),
USER_ACCOUNT_FORBIDDEN(1003, "sys.message.user.account_forbidden"),
USER_ACCOUNT_NOT_ACTIVATED(1004, "sys.message.user.account_not_activated"),
USER_HAS_OVERTIME(1005, "sys.message.user.overtime"),
USER_NO_PERMISSION(1006,"sys.message.user.no_permission"),
USER_ALREADY_LOGGED(1007, "sys.message.user.already_logged"),
// 请求参数错误或非法2001-2999
PARAM_NULL(2001, "sys.message.param.null"),
PARAM_ILLEGAL(2002, "sys.message.param.illegal"),
// 数据返回错误3001-3999
DATA_NONE(3001, "sys.message.data.none"),
DATA_WRONG(3002, "sys.message.data.wrong"),
// 操作失败4001-4999
PROCESS_FAIL(4001,"sys.message.process.fail"),
PROCESS_OVERTIME(4002,"sys.message.process.overtime"),
FILE_EXISTS(4003,"sys.message.file.exists"),
FILE_WRITE_ERROR(4004,"sys.message.file.write.error"),
FILE_READ_ERROR(4005,"sys.message.file.read.error"),
// 系统内部错误或异常5001-5999
SYSTEM_INNER_ERROR(5001,"sys.message.system.inner_error"),
SYSTEM_ABNORMAL(5002,"sys.message.system.abnormal"),
SYSTEM_BUSY(5003,"sys.message.system.busy"),
SYSTEM_MAINTAIN(5004,"sys.message.system.maintain"),
// 数据库错误6001-6999
DATABASE_ERROR(6001,"sys.message.database.error");
private int code;
private String text;
private PromptMessageEnum(int code,String text) {
this.code = code;
this.text = text;
}
public String getText() {
return this.text;
}
public int getCode() {
return this.code;
}
}

View File

@ -0,0 +1,33 @@
package com.xkrs.common.tool;
/**
* CompareVersion 比较版本号
* @author tajochen
*/
public class CompareVersion {
/**
* 比较三位版本号 ,若 版本1>版本2 返回 1若版本1<版本2 返回 -1否则返回0
* @param version1 版本1
* @param version2 版本2
* @return
*/
public static int compareVersion(String version1, String version2) {
String[] v1 = version1.split("\\.");
String[] v2 = version2.split("\\.");
int n = Math.max(v1.length, v2.length);
for (int i = 0; i < n; i++) {
int v1Int = i < v1.length ? Integer.parseInt(v1[i]) : 0;
int v2Int = i < v2.length ? Integer.parseInt(v2[i]) : 0;
if (v1Int == v2Int) {
continue;
}
if (v1Int > v2Int){
return 1;
} else {
return -1;
}
}
return 0;
}
}

View File

@ -0,0 +1,98 @@
package com.xkrs.common.tool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* dao接口类处理工具
* @author tajochen
*/
public class EntityUtil {
private static final Logger logger = LoggerFactory.getLogger(EntityUtil.class);
/**
* 将数组数据转换为实体类
* 此处数组元素的顺序必须与实体类构造函数中的属性顺序一致
* @param list 数组对象集合
* @param clazz 实体类
* @param <T> 实体类
* @param model 实例化的实体类
* @return 实体类集合
*/
public static <T> List<T> castEntity(List<Object[]> list, Class<T> clazz, Object model) {
List<T> returnList = new ArrayList<T>();
if (list.isEmpty()) {
return returnList;
}
//获取每个数组集合的元素个数
Object[] co = list.get(0);
//获取当前实体类的属性名、属性值、属性类别
List<Map> attributeInfoList = getFiledsInfo(model);
//创建属性类别数组
Class[] c2 = new Class[attributeInfoList.size()];
//如果数组集合元素个数与实体类属性个数不一致则发生错误
if (attributeInfoList.size() != co.length) {
return returnList;
}
//确定构造方法
for (int i = 0; i < attributeInfoList.size(); i++) {
c2[i] = (Class) attributeInfoList.get(i).get("type");
}
try {
for (Object[] o : list) {
Constructor<T> constructor = clazz.getConstructor(c2);
returnList.add(constructor.newInstance(o));
}
} catch (Exception ex) {
logger.error("实体数据转化为实体类发生异常:异常信息:{}", ex.getMessage());
return returnList;
}
return returnList;
}
/**
* 根据属性名获取属性值
* @param fieldName 属性名
* @param modle 实体类
* @return 属性值
*/
private static Object getFieldValueByName(String fieldName, Object modle) {
try {
String firstLetter = fieldName.substring(0, 1).toUpperCase();
String getter = "get" + firstLetter + fieldName.substring(1);
Method method = modle.getClass().getMethod(getter, new Class[]{});
Object value = method.invoke(modle, new Object[]{});
return value;
} catch (Exception e) {
return null;
}
}
/**
* 获取属性类型(type),属性名(name),属性值(value)的map组成的list
* @param model 实体类
* @return list集合
*/
private static List<Map> getFiledsInfo(Object model) {
Field[] fields = model.getClass().getDeclaredFields();
List<Map> list = new ArrayList(fields.length);
Map infoMap = null;
for (int i = 0; i < fields.length; i++) {
infoMap = new HashMap(3);
infoMap.put("type", fields[i].getType());
infoMap.put("name", fields[i].getName());
infoMap.put("value", getFieldValueByName(fields[i].getName(), model));
list.add(infoMap);
}
return list;
}
}

View File

@ -0,0 +1,51 @@
package com.xkrs.common.tool;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import javax.crypto.SecretKey;
import java.util.List;
/**
* token工具
* @author tajochen
*/
public class TokenUtil {
/**
* Token前缀
*/
static public final String TOKEN_PREFIX = "Bearer";
static public final String SECRETKEY = "0Y9H364Q9Y908262F25LMXGIKIN5N858XM3674GWL2DD8X1DS4W6I722IRY8PS4XPNB6U30345" +
"HBVCUL94STG8C3Z53T7A09JJ100I56YE9894CI11PX9J71HIZ8L5Y2O504C4E2K8276425UA8734833F45K36878FXAG799QV9LXUJ" +
"OI3XA2046UPG8TB2OT84R5T6ZB127N9ZPJ7AJMC41JVHB2WK2B6H8NL45LZNAZ666KHZH3QUT65UX6F8";
static SecretKey key = Keys.hmacShaKeyFor(SECRETKEY.getBytes());
public static String getTokenUserName(String token) {
String userName = "";
if (token != null) {
try {
// 解析 Token
Claims claims = Jwts.parserBuilder()
.setSigningKey(key).build()
// 去掉 Bearer
.parseClaimsJws(token.replace(TOKEN_PREFIX, ""))
.getBody();
// 获取用户名
userName = claims.getSubject();
// 获取权限
List<GrantedAuthority> authorities = AuthorityUtils.commaSeparatedStringToAuthorityList((String) claims.get("auths"));
} catch(Exception e) {
// the sub field was missing or did not have a 'jsmith' value
return null;
}
} else {
return null;
}
return userName;
}
}

View File

@ -0,0 +1,86 @@
package com.xkrs.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.FileDocumentEntity;
import com.xkrs.model.qo.FileDocumentQo;
import com.xkrs.model.validation.FileDocumentQoInsert;
import com.xkrs.model.vo.FileServerResultVo;
import com.xkrs.service.FileDocumentService;
import com.xkrs.service.FileServerService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Locale;
import java.util.Optional;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
import static com.xkrs.common.tool.TokenUtil.getTokenUserName;
import static com.xkrs.utils.NumberUtil.isStrNumeric;
/**
* 文档管理服务
* @author tajochen
*/
@RestController
@RequestMapping("/api/document")
public class FileDocumentController {
@Resource
private FileDocumentService fileDocumentService;
@Resource
private FileServerService fileServerService;
@RequestMapping(value="/get/all",method = RequestMethod.GET)
public String getAllFiles() {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
Iterable<FileDocumentEntity> list = fileDocumentService.getAllFile();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,list,locale);
}
@RequestMapping(value="/add",method = RequestMethod.POST)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user','auth_administor')")
@CrossOrigin
public String fileUpload(@Validated({FileDocumentQoInsert.class}) @RequestBody FileDocumentQo fileDocumentQo,
BindingResult bindingResult, @RequestHeader(value="Authorization") String token) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证数据合法性
if(bindingResult.hasErrors()){
return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale);
}
// 获取当前用户名
String userName = getTokenUserName(token);
fileDocumentService.add(fileDocumentQo,userName);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
}
@RequestMapping(value="/delete",method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
@CrossOrigin
public String fileDelete(@RequestParam("id") String id) {
//获取区域信息
Locale locale = LocaleContextHolder.getLocale();
if(!isStrNumeric(id)){
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"参数错误",locale);
}
Optional <FileDocumentEntity> sf = fileDocumentService.getById(Integer.parseInt(id));
if(!sf.isPresent()){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"指定id文件不存在",locale);
}
try {
FileServerResultVo fileServerResultVo = fileServerService.deleteFile(sf.get().getMd5(),"");
fileDocumentService.delete(Integer.parseInt(id));
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,fileServerResultVo,locale);
} catch (Exception e) {
e.printStackTrace();
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"文件服务器出错",locale);
}
}
}

View File

@ -0,0 +1,114 @@
package com.xkrs.controller;
import com.xkrs.model.vo.FileServerResultVo;
import com.xkrs.service.FileServerService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 文件服务器管理服务
* @author tajochen
*/
@RestController
@RequestMapping("/api/file")
public class FileServerController {
@Resource
private FileServerService fileServerService;
/**
* 文件统计
* @return
*/
@RequestMapping(value="/stat",method = RequestMethod.GET)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
@CrossOrigin
public FileServerResultVo getFileStat() {
return fileServerService.getFileStat();
}
/**
* 文件删除
* @param md5 信息摘要
* @param path 路径
* @return
*/
@RequestMapping(value="/delete",method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')")
@CrossOrigin
public FileServerResultVo deleteFile(@RequestParam(value = "md5",required = false) String md5,
@RequestParam(value = "path",required = false) String path) {
FileServerResultVo fileServerResultVo = new FileServerResultVo();
Boolean existed = (md5==null||md5.isEmpty())&&(path==null||path.isEmpty());
if(existed){
fileServerResultVo.setStatus("fail");
fileServerResultVo.setData("");
fileServerResultVo.setMessage("参数为空");
return fileServerResultVo;
}
return fileServerService.deleteFile(md5,path);
}
/**
* 获取文件信息
* @param md5 信息摘要
* @param path 路径
* @return
*/
@RequestMapping(value="/get/info",method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')")
@CrossOrigin
public FileServerResultVo getFileInfo(@RequestParam(value = "md5",required = false) String md5,
@RequestParam(value = "path",required = false) String path) {
FileServerResultVo fileServerResultVo = new FileServerResultVo();
Boolean existed = (md5==null||md5.isEmpty())&&(path==null||path.isEmpty());
if(existed){
fileServerResultVo.setStatus("fail");
fileServerResultVo.setData("");
fileServerResultVo.setMessage("参数为空");
return fileServerResultVo;
}
return fileServerService.getFileInfo(md5,path);
}
/**
* 获取文件列表
* @param dir 文件夹
* @return
*/
@RequestMapping(value="/get/list",method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')")
@CrossOrigin
public FileServerResultVo getFileList(@RequestParam(value = "dir") String dir) {
return fileServerService.getFileList(dir);
}
/**
* 修复统计信息
* @param date 要修复的日期格式如20190725
* @return
*/
@RequestMapping(value="/get/repair_stat",method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')")
@CrossOrigin
public FileServerResultVo getFileRepairStat(@RequestParam(value = "date") String date) {
return fileServerService.getFileRepairStat(date);
}
/**
* 同步失败修复
* @param force 是否强行修复(0|1)
* @return
*/
@RequestMapping(value="/get/repair",method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','role_administor')")
@CrossOrigin
public FileServerResultVo getFileRepair(@RequestParam(value = "force") String force) {
return fileServerService.getFileRepair(force);
}
}

View File

@ -0,0 +1,104 @@
package com.xkrs.controller;
import com.xkrs.common.config.RedisUtil;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.common.tool.TokenUtil;
import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.BankCardQo;
import com.xkrs.model.qo.BusinessQo;
import com.xkrs.service.MerchantSettlementService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 14:40
*/
@RestController
public class MerchantSettlementController {
@Resource
private MerchantSettlementService merchantSettlementService;
@Resource
private SysUserDao sysUserDao;
@Resource
private RedisUtil redisUtil;
/**
* 商家入驻
* @param
* @param businessPhoto
* @param businessLicense
* @param
* @param
* @return
*/
@PostMapping("/merchantSettlement")
public String merchantSettlement(@RequestBody Map map, @RequestParam("businessPhoto") MultipartFile businessPhoto,
@RequestParam("businessLicense") MultipartFile businessLicense) throws IOException {
Locale locale = LocaleContextHolder.getLocale();
String businessName = (String) map.get("businessName");
String businessPro = (String) map.get("businessPro");
String businessCity = (String) map.get("businessCity");
String businessCountry = (String) map.get("businessCountry");
String businessAddress = (String) map.get("businessAddress");
String businessPhone = (String) map.get("businessPhone");
Double businessDiscount = (Double) map.get("businessDiscount");
String headIdentifier = (String) map.get("headIdentifier");
List<BankCardQo> bankCardQos = (List<BankCardQo>) map.get("bankCardQos");
String verificationCode = (String) map.get("verificationCode");
BusinessQo businessQo = new BusinessQo();
businessQo.setBusinessName(businessName);
businessQo.setBusinessPro(businessPro);
businessQo.setBusinessCity(businessCity);
businessQo.setBusinessCountry(businessCountry);
businessQo.setBusinessAddress(businessAddress);
businessQo.setBusinessPhone(businessPhone);
businessQo.setBusinessDiscount(businessDiscount);
businessQo.setHeadIdentifier(headIdentifier);
String o = (String) redisUtil.get(businessPhone);
if("".equals(o) || o == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"请先发送验证码!",locale);
}
if(!redisUtil.get(businessPhone).equals(verificationCode)){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"验证码错误,请重新输入!",locale);
}
return merchantSettlementService.merchantSettlement(businessQo,businessPhoto,businessLicense,bankCardQos);
}
/**
* 根据商家入驻状态查询待审核,审核通过,审核不通过商家的信息
* @param type
* @return
*/
@GetMapping("/findAllByBusinessType")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String findAllByBusinessType(@RequestParam("type") String type){
return merchantSettlementService.findAllByBusinessType(type);
}
/**
* 商家查询自己的入驻信息
* @param token
* @return
*/
@GetMapping("/findBusinessById")
public String findBusinessById(@RequestHeader(value="Authorization") String token){
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
return merchantSettlementService.findBusinessById(sysUserEntity.getId());
}
}

View File

@ -0,0 +1,57 @@
package com.xkrs.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import nl.basjes.parse.useragent.UserAgent;
import nl.basjes.parse.useragent.UserAgentAnalyzer;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* 系统管理测试服务
* @author tajochen
*/
@RestController
@RequestMapping(value = "/api")
public class SysManageController {
@RequestMapping(value="/hello/role",method = RequestMethod.GET)
@PreAuthorize("hasAnyRole('role_administor','role_system_manager')")
public String hello() {
//获取区域信息
Locale locale = LocaleContextHolder.getLocale();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"hello vip",locale);
}
@RequestMapping(value="/hello/auth",method = RequestMethod.GET)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')")
public String world() {
//获取区域信息
Locale locale = LocaleContextHolder.getLocale();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"world",locale);
}
@RequestMapping(value="/greeting",method = RequestMethod.GET)
public String greeting(@RequestParam(required=false, defaultValue="World") String name,
@RequestHeader(value="User-Agent") String userAgent) {
//获取区域信息
Locale locale = LocaleContextHolder.getLocale();
System.out.println("==== in greeting ====");
System.out.println(userAgent);
UserAgentAnalyzer uaa = UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.withCache(10000)
.build();
UserAgent agent = uaa.parse(userAgent);
for (String fieldName: agent.getAvailableFieldNamesSorted()) {
System.out.println(fieldName + " = " + agent.getValue(fieldName));
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,name,locale);
}
}

View File

@ -0,0 +1,299 @@
package com.xkrs.controller;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.xkrs.common.config.RedisUtil;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.common.tool.TokenUtil;
import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo;
import com.xkrs.model.qo.UserUpdate;
import com.xkrs.model.validation.SysUserQoInsert;
import com.xkrs.model.validation.SysUserQoUpdate;
import com.xkrs.model.vo.SysUserVo;
import com.xkrs.service.SysUserService;
import com.xkrs.utils.RandomUtil;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationErrorList;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
import static com.xkrs.utils.AliYunSmsUtils.sendSms;
/**
* 系统用户Controller
* @author tajocehn
*/
@RestController
@RequestMapping(value = "/api/user")
public class SysUserController {
@Resource
private SysUserService sysUserService;
@Resource
private SysUserDao sysUserDao;
@Resource
private RedisUtil redisUtil;
/**
* 登录用户Token验证
* @return
*/
@RequestMapping(value = "/logged/check",method = RequestMethod.POST)
public String loginUserTokenCheck(){
Locale locale = LocaleContextHolder.getLocale();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
}
@RequestMapping(value = "/check/duplicate", method = RequestMethod.POST)
public String checkDuplicate(@RequestParam(value="userName", required=false) String userName){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证用户名是否重复
if(!sysUserService.checkUserName(userName)){
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo,
BindingResult bindingResult){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证数据合法性
if(bindingResult.hasErrors()){
return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale);
}
// 验证用户名是否重复
if(!sysUserService.checkUserName(userQo.getUserName())){
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"该账号已注册,请勿重复注册!",locale);
}
// 添加新用户
sysUserService.addUser(userQo);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale);
}
/*@RequestMapping(value="/get/all", method = RequestMethod.GET)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
public String getAllSysUser(){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
Iterable<SysUserVo> sysUserDtoList = sysUserService.getAllSysUser();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,sysUserDtoList,locale);
}*/
/**
* 软删除指定id的普通用户
* @param id
* @return
*/
@RequestMapping(value = "/general/delete", method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')")
public String deleteCustomUser(@RequestParam(value="userId", required=false) int id){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证数据合法性
int res = sysUserService.softDeleteGeneralUser(id);
if(res==1){
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"",locale);
} else {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
}
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo,
BindingResult bindingResult){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证数据合法性
if(bindingResult.hasErrors()){
return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale);
}
// 修改用户
sysUserService.updateSysUser(userQo);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale);
}
/**
* 绑定手机号
* @param map
* @param token
* @return
*/
@PostMapping("/bindPhone")
public String bindPhone(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
Locale locale = LocaleContextHolder.getLocale();
String phone = (String) map.get("phone");
String verificationCode = (String) map.get("verificationCode");
// 验证token
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
if(sysUserEntity == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
}
String o = (String) redisUtil.get(phone);
if("".equals(o) || o == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"请先发送验证码!",locale);
}
if(!redisUtil.get(phone).equals(verificationCode)){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"验证码错误,请重新输入!",locale);
}
return sysUserService.bindPhone(sysUserEntity.getId(),phone);
}
/**
* 发送手机号
* @param phone
* @return
* @throws ClientException
*/
@GetMapping("/verificationCode")
public String verificationCode(@RequestParam("phone") String phone) throws ClientException {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
String optCode = String.valueOf(RandomUtil.returnCode());
redisUtil.set(phone,optCode,60*10);
SendSmsResponse response =sendSms(phone,optCode);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale); }
/**
* 手机号登录
* @param map
* @return
*/
@PostMapping("/loginByPhone")
public String loginByPhone(@RequestBody Map map){
String phone = (String) map.get("phone");
String verificationCode = (String) map.get("verificationCode");
return sysUserService.loginByPhone(phone,verificationCode);
}
/**
* 填写手机号发送验证码,用于用户忘记密码
* @param phone
* @return
* @throws ClientException
*/
@GetMapping("/verificationCodeUpdate")
public String verificationCodeUpdate(@RequestParam("phone") String phone) throws ClientException {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
SysUserVo sysUserVo = sysUserDao.selectUserByUserName(phone);
if(sysUserVo == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"手机号错误,请使用您注册的手机号",locale);
}
String optCode = String.valueOf(RandomUtil.returnCode());
redisUtil.set(phone,optCode,60*10);
SendSmsResponse response =sendSms(phone,optCode);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
}
/**
* 输入验证码进行判断
* @param phone
* @param verificationCode
* @return
*/
@GetMapping("/getVerificationCode")
public String getVerificationCode(@RequestParam("phone") String phone, @RequestParam("verificationCode") String verificationCode){
Locale locale = LocaleContextHolder.getLocale();
String o = (String) redisUtil.get(phone);
if("".equals(o) || o == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"请先发送验证码!",locale);
}
if(!redisUtil.get(phone).equals(verificationCode)){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"验证码错误,请重新输入!",locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"true",locale);
}
/**
* 用户完善信息
* @param files
* @param userUpdate
* @param token
* @return
*/
@PostMapping("/updateUserByUserId")
public String updateUserByUserId(@RequestParam("file") MultipartFile files, UserUpdate userUpdate, @RequestHeader(value="Authorization") String token) throws IOException {
Locale locale = LocaleContextHolder.getLocale();
if(userUpdate.getNickName() != null){
SysUserEntity byNickName = sysUserDao.findByNickName(userUpdate.getNickName());
if(byNickName != null){
return outputEncapsulationObject(PromptMessageEnum.FILE_EXISTS,"该昵称已存在!",locale);
}
}
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
return sysUserService.updateUserByUserId(files,userUpdate,sysUserEntity.getId());
}
/**
* 管理员进行启用禁用的操作
* @param map
* @param token
* @return
*/
@PostMapping("/operateActiveFlag")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String operateActiveFlag(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
Integer userId = (Integer) map.get("userId");
String keepType = (String) map.get("keepType");
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证token
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
if(sysUserEntity == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
}
// 如果keepType等于1进行启用操作
if("1".equals(keepType)){
sysUserService.updateEnable(userId);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"启用成功",locale);
}else {
sysUserService.updateDisable(userId);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"禁用成功",locale);
}
}
/**
* 判断用户名是否存在
* @param userName
* @return
*/
@GetMapping("/booleanUserName")
public String booleanUserName(@RequestParam("userName") String userName){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
Map map = new HashMap(3);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(userName);
if(sysUserEntity == null){
map.put("status",0);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
}else {
map.put("status",1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
}
}
}

View File

@ -0,0 +1,11 @@
package com.xkrs.dao;
import com.xkrs.model.entity.BankCardEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:38
*/
public interface BankCardDao extends JpaRepository<BankCardEntity,Long> {
}

View File

@ -0,0 +1,65 @@
package com.xkrs.dao;
import com.xkrs.model.entity.BusinessEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:37
*/
public interface BusinessDao extends JpaRepository<BusinessEntity,Long> {
/**
* 根据商家名称查询商家信息
* @param name
* @return
*/
BusinessEntity findByBusinessName(String name);
/**
* 根据手机号查询商家入驻信息
* @param phone
* @return
*/
BusinessEntity findByBusinessPhone(String phone);
/**
* 根据商家入驻状态查询待审核,审核通过,审核不通过商家的信息
* @param type
* @return
*/
List<BusinessEntity> findAllByBusinessType(String type);
/**
* 根据省查询审核通过的商家的信息
* @param businessPro
* @param type
* @return
*/
List<BusinessEntity> findAllByBusinessProAndAndBusinessType(String businessPro, String type);
/**
* 根据市查询审核通过的商家的信息
* @param businessCity
* @param type
* @return
*/
List<BusinessEntity> findAllByBusinessCityAndAndBusinessType(String businessCity, String type);
/**
* 根据区县查询审核通过的商家的信息
* @param businessCounty
* @param type
* @return
*/
List<BusinessEntity> findAllByBusinessCountryAndAndBusinessType(String businessCounty, String type);
/**|
* 根据商家用户id查询自己的入驻信息
* @param id
* @return
*/
BusinessEntity findByBusinessId(Integer id);
}

View File

@ -0,0 +1,12 @@
package com.xkrs.dao;
import com.xkrs.model.entity.FileDocumentEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* FileDocumentDao
* @author tajochen
*/
public interface FileDocumentDao extends JpaRepository<FileDocumentEntity,Integer> {
}

View File

@ -0,0 +1,11 @@
package com.xkrs.dao;
import com.xkrs.model.entity.ProductCoverEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @Author: XinYi Song
* @Date: 2021/12/15 11:42
*/
public interface ProductCoverDao extends JpaRepository<ProductCoverEntity,Long> {
}

View File

@ -0,0 +1,10 @@
package com.xkrs.dao;
import com.xkrs.model.entity.RelRoleAuthorityEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author XinYi Song
*/
public interface RelRoleAuthorityDao extends JpaRepository<RelRoleAuthorityEntity,Long> {
}

View File

@ -0,0 +1,10 @@
package com.xkrs.dao;
import com.xkrs.model.entity.RelUserRoleEntity;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author XinYi Song
*/
public interface RelUserRoleDao extends JpaRepository<RelUserRoleEntity,Long> {
}

View File

@ -0,0 +1,25 @@
package com.xkrs.dao;
import com.xkrs.model.entity.SysAuthorityEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* SysAuthorityDao
* @author tajochen
*/
public interface SysAuthorityDao extends JpaRepository<SysAuthorityEntity,Integer> {
/**
* 查询权限实体列表根据用户名 Object[]
* @param userName 用户名
* @return 用户实体
*/
@Query(value = "SELECT a.id, a.authority_name, a.authority_name_zh, a.authority_desc " +
"FROM sys_authority a,rel_role_authority ra,sys_role r WHERE r.id = ra.role_id AND ra.authority_id = a.id AND r.id " +
"IN (SELECT r.id FROM sys_user u,sys_role r,rel_user_role ur " +
" WHERE u.user_name = :userName AND u.id = ur.user_id AND ur.role_id = r.id)", nativeQuery = true)
List<SysAuthorityEntity> selectByUserName(@Param("userName") String userName);
}

View File

@ -0,0 +1,60 @@
package com.xkrs.dao;
import com.xkrs.model.entity.SysRoleEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* SysRoleDao
* @author tajochen
*/
public interface SysRoleDao extends JpaRepository<SysRoleEntity,Integer> {
/**
* 查询用户角色列表根据用户id
* @param id
* @return
*/
@Query(value = "SELECT sys_role.id,sys_role.role_name,sys_role.role_name_zh,sys_role.role_desc " +
"FROM sys_role,rel_user_role " +
"WHERE sys_role.id = rel_user_role.role_id " +
"AND rel_user_role.user_id = :id ", nativeQuery = true)
List<SysRoleEntity> selectByUserId(@Param("id") Integer id);
/**
* 查询用户角色列表根据用户名
* @param userName
* @return
*/
@Query(value = "SELECT sys_role.id,sys_role.role_name,sys_role.role_name_zh,sys_role.role_desc " +
"FROM sys_role.ID = rel_user_role.role_id " +
"WHERE rel_user_role.user_id = sys_user.id " +
"AND rel_user_role.user_id = sys_user.id " +
"AND sys_user.user_name = :userName ", nativeQuery = true)
List<SysRoleEntity> selectByUserName(@Param("userName") String userName);
// /**
// * 根据用户名修改用户角色
// */
// @Modifying
// @Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " +
// "WHERE user_name = :userName ;", nativeQuery = true)
// int updateUserRoleByUserName(@Param("userName") String userName);
/**
* 添加用户角色根据用户名和角色名
* @param userName
* @param roleName
* @return
*/
@Modifying
@Query(value = "INSERT INTO rel_user_role (id,role_id, user_id) " +
"SELECT nextval('rel_user_role_seq'),sys_role.ID,sys_user.ID FROM sys_role,sys_user " +
"WHERE sys_role.role_name = :roleName AND sys_user.user_name = :userName ", nativeQuery = true)
int insertRelUserRole(@Param("userName") String userName, @Param("roleName") String roleName);
}

View File

@ -0,0 +1,144 @@
package com.xkrs.dao;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.vo.SysUserVo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
/**
* SysUserDao
* @author tajochen
*/
public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
/**
* 检查系统用户名是否存在
* @param userName
* @return
*/
@Query(value = "SELECT COUNT(*) FROM sys_user WHERE user_name = :userName", nativeQuery = true)
int checkUserName(@Param("userName") String userName);
/**
* 查找用户实体根据用户名
* @param userName
* @return
*/
@Query(value = "SELECT * FROM sys_user WHERE user_name = :userName", nativeQuery = true)
SysUserEntity selectByUserName(@Param("userName") String userName);
/**
* 根据用户名查询实体信息
* @param userName
* @return
*/
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,userName,nickName,telephone,addTime,lastEntryTime,lastEntryIp,avatar,province,city,county,identifier,identity) " +
"from SysUserEntity where userName = :userName")
SysUserVo selectUserByUserName(String userName);
/**
* 更新用户登录信息
* @param userName
* @param ipAddress
* @return
*/
@Modifying
@Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " +
"WHERE user_name = :userName ;", nativeQuery = true)
int updateSysUserLogin(@Param("userName") String userName, @Param("ipAddress") String ipAddress);
/**
* 软删除系统用户根据用户名
* @param userName
* @return
*/
@Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " +
"WHERE user_name = :userName ;", nativeQuery = true)
int softDeleteSysUserByUserName(@Param("userName") String userName);
/**
* 软删除系统用户根据id
* @param id
* @return
*/
@Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " +
"WHERE id = :id ;", nativeQuery = true)
int softDeleteGeneralUserById(@Param("id") Integer id);
/**
* 删除系统用户(危险操作!)
* @param userName
* @return
*/
@Modifying
@Query(value = "DELETE FROM sys_user WHERE user_name = :userName ;", nativeQuery = true)
int deleteSysUser(@Param("userName") String userName);
/**
* 获取所有存在的系统用户Vo
* @return
*/
/*@Query(value = "select new com.xkrs.model.vo.SysUserVo (u.id, u.userName, u.nickName, u.userCode, " +
"u.telephone, u.signature," +
"u.statusCode,u.addTime,u.lastEntryTime) from SysUserEntity u ,SysRoleEntity r," +
"RelUserRoleEntity u_r " +
"WHERE u.deleteFlag = 0 AND u.activeFlag = 0 AND r.id = u_r.roleId AND u.id = u_r.userId")
List<SysUserVo> selectAllSysUser();*/
/**
* 通过userId修改手机号绑定手机号
* @param userId
* @param phone
*/
@Modifying(clearAutomatically=true)
@Query(value = "update sys_user set telephone = ?2 where id = ?1",nativeQuery = true)
void updatePhoneByUserId(Integer userId, String phone);
/**
* 根据手机号查询用户信息
* @param telephone
* @return
*/
SysUserEntity findByTelephone(String telephone);
/**
* 用户完善信息
* @param userId
* @param nickName
* @param avatar
* @param province
* @param city
* @param county
*/
@Modifying(clearAutomatically=true)
@Query(value = "update sys_user set nick_name = ?2,avatar = ?3,province = ?4,city = ?5,county = ?6 where id = ?1",nativeQuery = true)
void updateUserByUserId(Integer userId,String nickName,String avatar,String province,String city,String county);
/**
* 通过用户昵称查询用户信息
* @param nickName
* @return
*/
SysUserEntity findByNickName(String nickName);
/**
* 启用
* @param userId
*/
@Query(value = "update sys_user set active_flag = 0 where id = ?",nativeQuery = true)
@Modifying(clearAutomatically=true)
void updateEnable(Integer userId);
/**
* 禁用
* @param userId
*/
@Query(value = "update sys_user set active_flag = 1 where id = ?",nativeQuery = true)
@Modifying(clearAutomatically=true)
void updateDisable(Integer userId);
}

View File

@ -0,0 +1,120 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2021/12/13 17:43
*/
@Entity
@Table(name="bank_card")
public class BankCardEntity {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "bank_card_seq_gen")
@SequenceGenerator(name = "bank_card_seq_gen", sequenceName = "bank_card_id_seq")
private Integer id;
/**
* 银行卡号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String bankCardNumber;
/**
* 开户行
*/
private String accountBank;
/**
* 银行名称
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String bankName;
/**
* 商家用户id
*/
private Integer businessId;
/**
* 商家手机号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String businessPhone;
public BankCardEntity() {
}
public BankCardEntity(Integer id, String bankCardNumber, String accountBank, String bankName, Integer businessId, String businessPhone) {
this.id = id;
this.bankCardNumber = bankCardNumber;
this.accountBank = accountBank;
this.bankName = bankName;
this.businessId = businessId;
this.businessPhone = businessPhone;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getBankCardNumber() {
return bankCardNumber;
}
public void setBankCardNumber(String bankCardNumber) {
this.bankCardNumber = bankCardNumber;
}
public String getAccountBank() {
return accountBank;
}
public void setAccountBank(String accountBank) {
this.accountBank = accountBank;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public Integer getBusinessId() {
return businessId;
}
public void setBusinessId(Integer businessId) {
this.businessId = businessId;
}
public String getBusinessPhone() {
return businessPhone;
}
public void setBusinessPhone(String businessPhone) {
this.businessPhone = businessPhone;
}
@Override
public String toString() {
return "BankCardEntity{" +
"id=" + id +
", bankCardNumber='" + bankCardNumber + '\'' +
", accountBank='" + accountBank + '\'' +
", bankName='" + bankName + '\'' +
", businessId=" + businessId +
", businessPhone='" + businessPhone + '\'' +
'}';
}
}

View File

@ -0,0 +1,244 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2021/12/13 16:54
* 商家信息
*/
@Entity
@Table(name="business")
public class BusinessEntity {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "business_seq_gen")
@SequenceGenerator(name = "business_seq_gen", sequenceName = "business_id_seq")
private Integer id;
/**
* 商户名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String businessName;
/**
* 省
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String businessPro;
/**
* 市
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String businessCity;
/**
* 区
*/
private String businessCountry;
/**
* 详细地址
*/
private String businessAddress;
/**
* 商家电话
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String businessPhone;
/**
* 商家图片
*/
private String businessPhoto;
/**
* 营业执照
*/
private String businessLicense;
/**
* 商家折扣
*/
private Double businessDiscount;
/**
* 商家状态入驻默认0审核通过1 审核不通过2
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String businessType;
/**
* 团长识别码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String headIdentifier;
/**
* 商家用户id
*/
private Integer businessId;
/**
* 商家入驻时间
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String settleInTime;
public BusinessEntity() {
}
public BusinessEntity(Integer id, String businessName, String businessPro, String businessCity, String businessCountry, String businessAddress, String businessPhone, String businessPhoto, String businessLicense, Double businessDiscount, String businessType, String headIdentifier, Integer businessId, String settleInTime) {
this.id = id;
this.businessName = businessName;
this.businessPro = businessPro;
this.businessCity = businessCity;
this.businessCountry = businessCountry;
this.businessAddress = businessAddress;
this.businessPhone = businessPhone;
this.businessPhoto = businessPhoto;
this.businessLicense = businessLicense;
this.businessDiscount = businessDiscount;
this.businessType = businessType;
this.headIdentifier = headIdentifier;
this.businessId = businessId;
this.settleInTime = settleInTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getBusinessPro() {
return businessPro;
}
public void setBusinessPro(String businessPro) {
this.businessPro = businessPro;
}
public String getBusinessCity() {
return businessCity;
}
public void setBusinessCity(String businessCity) {
this.businessCity = businessCity;
}
public String getBusinessCountry() {
return businessCountry;
}
public void setBusinessCountry(String businessCountry) {
this.businessCountry = businessCountry;
}
public String getBusinessAddress() {
return businessAddress;
}
public void setBusinessAddress(String businessAddress) {
this.businessAddress = businessAddress;
}
public String getBusinessPhone() {
return businessPhone;
}
public void setBusinessPhone(String businessPhone) {
this.businessPhone = businessPhone;
}
public String getBusinessPhoto() {
return businessPhoto;
}
public void setBusinessPhoto(String businessPhoto) {
this.businessPhoto = businessPhoto;
}
public String getBusinessLicense() {
return businessLicense;
}
public void setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
}
public Double getBusinessDiscount() {
return businessDiscount;
}
public void setBusinessDiscount(Double businessDiscount) {
this.businessDiscount = businessDiscount;
}
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
public String getHeadIdentifier() {
return headIdentifier;
}
public void setHeadIdentifier(String headIdentifier) {
this.headIdentifier = headIdentifier;
}
public Integer getBusinessId() {
return businessId;
}
public void setBusinessId(Integer businessId) {
this.businessId = businessId;
}
public String getSettleInTime() {
return settleInTime;
}
public void setSettleInTime(String settleInTime) {
this.settleInTime = settleInTime;
}
@Override
public String toString() {
return "BusinessEntity{" +
"id=" + id +
", businessName='" + businessName + '\'' +
", businessPro='" + businessPro + '\'' +
", businessCity='" + businessCity + '\'' +
", businessCountry='" + businessCountry + '\'' +
", businessAddress='" + businessAddress + '\'' +
", businessPhone='" + businessPhone + '\'' +
", businessPhoto='" + businessPhoto + '\'' +
", businessLicense='" + businessLicense + '\'' +
", businessDiscount=" + businessDiscount +
", businessType='" + businessType + '\'' +
", headIdentifier='" + headIdentifier + '\'' +
", businessId=" + businessId +
", settleInTime='" + settleInTime + '\'' +
'}';
}
}

View File

@ -0,0 +1,132 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* file_document 表实体类
* @author tajochen
*/
@Entity
@Table(name="file_document")
public class FileDocumentEntity implements Serializable {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "file_document_seq_gen")
@SequenceGenerator(name = "file_document_seq_gen", sequenceName = "file_document_seq")
private Integer id;
@Column(length = 64, nullable = false, columnDefinition = "varchar(64)")
private String name;
@Column( columnDefinition = "int4")
private Integer category;
@Column(length = 192 , columnDefinition = "varchar(192)")
private String filePath;
@Column( length = 128, columnDefinition = "varchar(128)")
private String size;
@Column( length = 192, columnDefinition = "varchar(192)")
private String md5;
@Column( length = 128, columnDefinition = "varchar(128)")
private String memo;
@Column( length = 16, columnDefinition = "varchar(16)")
private String addUserName;
private LocalDateTime addTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCategory() {
return category;
}
public void setCategory(Integer category) {
this.category = category;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getAddUserName() {
return addUserName;
}
public void setAddUserName(String addUserName) {
this.addUserName = addUserName;
}
public LocalDateTime getAddTime() {
return addTime;
}
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
@Override
public String toString() {
return "FileDocumentEntity{" +
"id=" + id +
", name='" + name + '\'' +
", category=" + category +
", filePath='" + filePath + '\'' +
", size='" + size + '\'' +
", md5='" + md5 + '\'' +
", memo='" + memo + '\'' +
", addUserName='" + addUserName + '\'' +
", addTime=" + addTime +
'}';
}
}

View File

@ -0,0 +1,71 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2021/12/15 11:27
*/
@Entity
@Table(name="product_content_photo")
public class ProductContentPhotoEntity {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "product_content_photo_seq_gen")
@SequenceGenerator(name = "product_content_photo_seq_gen", sequenceName = "product_content_photo_id_seq")
private Integer id;
/**
* 商品内容图片
*/
private String productContentPhoto;
/**
* 商品id
*/
private Integer productId;
public ProductContentPhotoEntity() {
}
public ProductContentPhotoEntity(Integer id, String productContentPhoto, Integer productId) {
this.id = id;
this.productContentPhoto = productContentPhoto;
this.productId = productId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getProductContentPhoto() {
return productContentPhoto;
}
public void setProductContentPhoto(String productContentPhoto) {
this.productContentPhoto = productContentPhoto;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
@Override
public String toString() {
return "ProductContentPhotoEntity{" +
"id=" + id +
", productContentPhoto='" + productContentPhoto + '\'' +
", productId=" + productId +
'}';
}
}

View File

@ -0,0 +1,71 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2021/12/15 11:18
*/
@Entity
@Table(name="product_cover")
public class ProductCoverEntity {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "product_cover_seq_gen")
@SequenceGenerator(name = "product_cover_seq_gen", sequenceName = "product_cover_id_seq")
private Integer id;
/**
* 商品封面图片
*/
private String productCoverPhoto;
/**
* 商品id
*/
private Integer productId;
public ProductCoverEntity() {
}
public ProductCoverEntity(Integer id, String productCoverPhoto, Integer productId) {
this.id = id;
this.productCoverPhoto = productCoverPhoto;
this.productId = productId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getProductCoverPhoto() {
return productCoverPhoto;
}
public void setProductCoverPhoto(String productCoverPhoto) {
this.productCoverPhoto = productCoverPhoto;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
@Override
public String toString() {
return "ProductCoverEntity{" +
"id=" + id +
", productCoverPhoto='" + productCoverPhoto + '\'' +
", productId=" + productId +
'}';
}
}

View File

@ -0,0 +1,149 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.math.BigDecimal;
/**
* @Author: XinYi Song
* @Date: 2021/12/15 13:41
*/
@Entity
@Table(name="product")
public class ProductEntity {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "product_seq_gen")
@SequenceGenerator(name = "product_seq_gen", sequenceName = "product_id_seq")
private Integer id;
/**
* 商品名称
*/
private String productName;
/**
* 商品描述
*/
private String productDescription;
/**
* 商品分类
*/
private Integer productCategories;
/**
* 商品价格
*/
private BigDecimal productPrice;
/**
* 商品上架状态默认0 待审核1审核通过2审核不通过
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String shelfType;
/**
* 商家id
*/
private Integer businessId;
/**
* 商品上架的时间
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String productTime;
public ProductEntity() {
}
public ProductEntity(Integer id, String productName, String productDescription, Integer productCategories, BigDecimal productPrice, String shelfType, Integer businessId, String productTime) {
this.id = id;
this.productName = productName;
this.productDescription = productDescription;
this.productCategories = productCategories;
this.productPrice = productPrice;
this.shelfType = shelfType;
this.businessId = businessId;
this.productTime = productTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductDescription() {
return productDescription;
}
public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}
public Integer getProductCategories() {
return productCategories;
}
public void setProductCategories(Integer productCategories) {
this.productCategories = productCategories;
}
public BigDecimal getProductPrice() {
return productPrice;
}
public void setProductPrice(BigDecimal productPrice) {
this.productPrice = productPrice;
}
public String getShelfType() {
return shelfType;
}
public void setShelfType(String shelfType) {
this.shelfType = shelfType;
}
public Integer getBusinessId() {
return businessId;
}
public void setBusinessId(Integer businessId) {
this.businessId = businessId;
}
public String getProductTime() {
return productTime;
}
public void setProductTime(String productTime) {
this.productTime = productTime;
}
@Override
public String toString() {
return "ProductEntity{" +
"id=" + id +
", productName='" + productName + '\'' +
", productDescription='" + productDescription + '\'' +
", productCategories=" + productCategories +
", productPrice=" + productPrice +
", shelfType='" + shelfType + '\'' +
", businessId=" + businessId +
", productTime='" + productTime + '\'' +
'}';
}
}

View File

@ -0,0 +1,60 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* RelRoleAuthority 表实体类
* @author tajochen
*/
@Entity
@Table(name="rel_role_authority")
public class RelRoleAuthorityEntity implements Serializable {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "rel_role_authority_seq_gen")
@SequenceGenerator(name = "rel_role_authority_seq_gen", sequenceName = "rel_role_authority_id_seq")
private Integer id;
@Column(nullable = false)
private Integer roleId;
@Column(nullable = false)
private Integer authorityId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getAuthorityId() {
return authorityId;
}
public void setAuthorityId(Integer authorityId) {
this.authorityId = authorityId;
}
@Override
public String toString() {
return "RelRoleAuthorityEntity{" +
"id=" + id +
", roleId=" + roleId +
", authorityId=" + authorityId +
'}';
}
}

View File

@ -0,0 +1,60 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* RelUserRole 表实体类
* @author tajochen
*/
@Entity
@Table(name="rel_user_role")
public class RelUserRoleEntity implements Serializable {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "rel_user_role_seq_gen")
@SequenceGenerator(name = "rel_user_role_seq_gen", sequenceName = "rel_user_role_id_seq")
private Integer id;
@Column(nullable = false)
private Long userId;
@Column(nullable = false)
private Integer roleId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return "RelUserRoleEntity{" +
"id=" + id +
", userId=" + userId +
", roleId=" + roleId +
'}';
}
}

View File

@ -0,0 +1,72 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* SysAuthority 表实体类
* @author tajochen
*/
@Entity
@Table(name="sys_authority")
public class SysAuthorityEntity implements Serializable {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sys_authority_seq_gen")
@SequenceGenerator(name = "sys_authority_seq_gen", sequenceName = "sys_authority_id_seq")
private Integer id;
@Column(length = 64, nullable = false, unique = true,columnDefinition = "varchar(64)")
private String authorityName;
@Column(length = 64, columnDefinition = "varchar(64)")
private String authorityNameZh;
@Column(length = 128, columnDefinition = "varchar(128)")
private String authorityDesc;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAuthorityName() {
return authorityName;
}
public void setAuthorityName(String authorityName) {
this.authorityName = authorityName == null ? null : authorityName.trim();
}
public String getAuthorityNameZh() {
return authorityNameZh;
}
public void setAuthorityNameZh(String authorityNameZh) {
this.authorityNameZh = authorityNameZh == null ? null : authorityNameZh.trim();
}
public String getAuthorityDesc() {
return authorityDesc;
}
public void setAuthorityDesc(String authorityDesc) {
this.authorityDesc = authorityDesc == null ? null : authorityDesc.trim();
}
@Override
public String toString() {
return "SysAuthorityEntity{" +
"id=" + id +
", authorityName='" + authorityName + '\'' +
", authorityDesc='" + authorityDesc + '\'' +
", authorityNameZh='" + authorityNameZh + '\'' +
'}';
}
}

View File

@ -0,0 +1,72 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* SysRole 表实体类
* @author tajochen
*/
@Entity
@Table(name="sys_role")
public class SysRoleEntity implements Serializable {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sys_role_seq_gen")
@SequenceGenerator(name = "sys_role_seq_gen", sequenceName = "sys_role_id_seq")
private Integer id;
@Column(length = 32, nullable = false, unique = true,columnDefinition = "varchar(32)")
private String roleName;
@Column(length = 32, columnDefinition = "varchar(32)")
private String roleNameZh;
@Column(length = 64, columnDefinition = "varchar(64)")
private String roleDesc;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName == null ? null : roleName.trim();
}
public String getRoleDesc() {
return roleDesc;
}
public void setRoleDesc(String roleDesc) {
this.roleDesc = roleDesc == null ? null : roleDesc.trim();
}
public String getRoleNameZh() {
return roleNameZh;
}
public void setRoleNameZh(String roleNameZh) {
this.roleNameZh = roleNameZh == null ? null : roleNameZh.trim();
}
@Override
public String toString() {
return "SysRoleEntity{" +
"id=" + id +
", roleName='" + roleName + '\'' +
", roleNameZh='" + roleNameZh + '\'' +
", roleDesc='" + roleDesc + '\'' +
'}';
}
}

View File

@ -0,0 +1,278 @@
package com.xkrs.model.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* SysUser 表实体类
* @author tajochen
* 用户信息
*/
@Entity
@Table(name="sys_user")
public class SysUserEntity implements Serializable {
/**
* 指定主键,建立自增序列,主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sys_user_seq_gen")
@SequenceGenerator(name = "sys_user_seq_gen", sequenceName = "sys_user_id_seq")
private Integer id;
/**
* 用户名
*/
@Column(length = 16, nullable = false, unique = true, columnDefinition = "varchar(16)")
private String userName;
/**
* 用户昵称
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String nickName;
/**
* 密码
*/
@Column(length = 64, nullable = false, columnDefinition = "varchar(64)")
private String password;
@Column(length = 32, nullable = false, columnDefinition = "varchar(32)")
private String salt;
@Column(length = 16, unique = true, columnDefinition = "varchar(16)")
private String telephone;
@Column(columnDefinition = "varchar(192)")
private String signature;
@Column(nullable = false)
private Integer activeFlag;
@Column(nullable = false,columnDefinition = "smallint")
private Integer statusCode;
@Column(nullable = false)
private LocalDateTime addTime;
private LocalDateTime lastEntryTime;
@Column(nullable = false)
private Integer deleteFlag;
@Column(columnDefinition = "varchar(64)")
private String lastEntryIp;
/**
* 用户头像
*/
private String avatar;
/**
* 省
*/
@Column(columnDefinition = "varchar(32)")
private String province;
/**
* 市
*/
@Column(columnDefinition = "varchar(32)")
private String city;
/**
* 区
*/
@Column(columnDefinition = "varchar(32)")
private String county;
/**
* 识别码身份id
*/
private String identifier;
/**
* 用户身份
*/
private String identity;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
public Integer getActiveFlag() {
return activeFlag;
}
public void setActiveFlag(Integer activeFlag) {
this.activeFlag = activeFlag;
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public LocalDateTime getAddTime() {
return addTime;
}
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
public LocalDateTime getLastEntryTime() {
return lastEntryTime;
}
public void setLastEntryTime(LocalDateTime lastEntryTime) {
this.lastEntryTime = lastEntryTime;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public String getLastEntryIp() {
return lastEntryIp;
}
public void setLastEntryIp(String lastEntryIp) {
this.lastEntryIp = lastEntryIp;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
@Override
public String toString() {
return "SysUserEntity{" +
"id=" + id +
", userName='" + userName + '\'' +
", nickName='" + nickName + '\'' +
", password='" + password + '\'' +
", salt='" + salt + '\'' +
", telephone='" + telephone + '\'' +
", signature='" + signature + '\'' +
", activeFlag=" + activeFlag +
", statusCode=" + statusCode +
", addTime=" + addTime +
", lastEntryTime=" + lastEntryTime +
", deleteFlag=" + deleteFlag +
", lastEntryIp='" + lastEntryIp + '\'' +
", avatar='" + avatar + '\'' +
", province='" + province + '\'' +
", city='" + city + '\'' +
", county='" + county + '\'' +
", identifier='" + identifier + '\'' +
", identity='" + identity + '\'' +
'}';
}
}

View File

@ -0,0 +1,34 @@
package com.xkrs.model.qo;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:25
*/
public class BankCardQo {
/**
* 银行卡号
*/
private String bankCardNumber;
/**
* 开户行
*/
private String accountBank;
public String getBankCardNumber() {
return bankCardNumber;
}
public void setBankCardNumber(String bankCardNumber) {
this.bankCardNumber = bankCardNumber;
}
public String getAccountBank() {
return accountBank;
}
public void setAccountBank(String accountBank) {
this.accountBank = accountBank;
}
}

View File

@ -0,0 +1,147 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.BusinessQoInsert;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:11
*/
public class BusinessQo {
/**
* 商户名称
*/
@NotBlank(message = "{Business.businessName.null}",groups={BusinessQoInsert.class})
private String businessName;
/**
* 省
*/
@NotBlank(message = "{Business.businessPro.null}",groups={BusinessQoInsert.class})
private String businessPro;
/**
* 市
*/
@NotBlank(message = "{Business.businessCity.null}",groups={BusinessQoInsert.class})
private String businessCity;
/**
* 区
*/
@NotBlank(message = "{Business.businessCountry.null}",groups={BusinessQoInsert.class})
private String businessCountry;
/**
* 详细地址
*/
private String businessAddress;
/**
* 商家电话
*/
@Pattern(regexp = "^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\\d{8}$", message = "{Business.businessPhone.null}",groups={BusinessQoInsert.class})
private String businessPhone;
/**
* 商家折扣
*/
@NotBlank(message = "{Business.businessDiscount.null}",groups={BusinessQoInsert.class})
private Double businessDiscount;
/**
* 团长识别码
*/
private String headIdentifier;
/**
* 商家图片
*/
private String businessPhoto;
/**
* 营业执照
*/
private String businessLicense;
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getBusinessPro() {
return businessPro;
}
public void setBusinessPro(String businessPro) {
this.businessPro = businessPro;
}
public String getBusinessCity() {
return businessCity;
}
public void setBusinessCity(String businessCity) {
this.businessCity = businessCity;
}
public String getBusinessCountry() {
return businessCountry;
}
public void setBusinessCountry(String businessCountry) {
this.businessCountry = businessCountry;
}
public String getBusinessAddress() {
return businessAddress;
}
public void setBusinessAddress(String businessAddress) {
this.businessAddress = businessAddress;
}
public String getBusinessPhone() {
return businessPhone;
}
public void setBusinessPhone(String businessPhone) {
this.businessPhone = businessPhone;
}
public Double getBusinessDiscount() {
return businessDiscount;
}
public void setBusinessDiscount(Double businessDiscount) {
this.businessDiscount = businessDiscount;
}
public String getHeadIdentifier() {
return headIdentifier;
}
public void setHeadIdentifier(String headIdentifier) {
this.headIdentifier = headIdentifier;
}
public String getBusinessPhoto() {
return businessPhoto;
}
public void setBusinessPhoto(String businessPhoto) {
this.businessPhoto = businessPhoto;
}
public String getBusinessLicense() {
return businessLicense;
}
public void setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
}
}

View File

@ -0,0 +1,106 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.FileDocumentQoInsert;
import com.xkrs.model.validation.FileDocumentQoUpdate;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* AssistantInvestigatorQo
* @author tajochen
*/
public class FileDocumentQo {
@NotBlank(message = "{FileDocument.id.null}",groups={FileDocumentQoUpdate.class})
private Integer id;
@NotBlank(message = "{FileDocument.name.null}",groups = {FileDocumentQoInsert.class})
@Size(max = 64, message = "{FileDocument.name.length.illegal}", groups={FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private String name;
@Min(value = 0, message = "{FileDocument.category.length.illegal}", groups={FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private Integer category;
@NotBlank(message = "{FileDocument.filePath.null}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
@Size(max = 192, message = "{FileDocument.filePath.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private String filePath;
@Size(max = 128, message = "{FileDocument.size.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private String size;
@NotBlank(message = "{FileDocument.md5.null}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
@Size(max = 192, message = "{FileDocument.md5.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private String md5;
@Size(max = 128, message = "{FileDocument.memo.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private String memo;
@Size(max = 128, message = "{FileDocument.checkingToken.length.illegal}",groups = {FileDocumentQoInsert.class, FileDocumentQoUpdate.class})
private String checkingToken;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCategory() {
return category;
}
public void setCategory(Integer category) {
this.category = category;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getCheckingToken() {
return checkingToken;
}
public void setCheckingToken(String checkingToken) {
this.checkingToken = checkingToken;
}
}

View File

@ -0,0 +1,137 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.SysUserQoInsert;
import com.xkrs.model.validation.SysUserQoUpdate;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
/**
* SysUserQo
* @author tajochen
*/
public class SysUserQo {
@NotNull( message = "{SysUser.id.blank}",groups={SysUserQoUpdate.class})
private Integer id;
@NotBlank(message = "{SysUser.userName.blank}",groups={SysUserQoInsert.class})
@Size(min = 4,max = 16, message = "{SysUser.userName.length.illegal}",groups = {SysUserQoInsert.class,
SysUserQoUpdate.class})
@Pattern(regexp = "^([A-Za-z0-9_]+)$",message = "{SysUser.userName.format.illegal}",groups = {SysUserQoInsert.class,
SysUserQoUpdate.class})
private String userName;
@Size(max = 32, message = "{SysUser.nickName.length.illegal}",groups = {SysUserQoInsert.class,
SysUserQoUpdate.class})
private String nickName;
@NotBlank(message = "{SysUser.password.blank}",groups = {SysUserQoInsert.class})
@Size(min = 6,max = 16, message = "{SysUser.password.length.illegal}",groups = {SysUserQoInsert.class,
SysUserQoUpdate.class})
@Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$",message = "{SysUser.password.format.illegal}",
groups = {SysUserQoInsert.class,SysUserQoUpdate.class})
private String password;
@Pattern(regexp = "^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\\d{8}$",
message = "{SysUser.telephone.format.illegal}",groups = {SysUserQoInsert.class,SysUserQoUpdate.class})
private String telephone;
@NotNull(message = "{SysUser.statusCode.illegal}",groups={SysUserQoUpdate.class})
@Range(min=0,max=2,message = "{SysUser.statusCode.illegal}",groups = {SysUserQoInsert.class, SysUserQoUpdate.class})
private Integer statusCode;
@NotNull(message = "{SysUser.deleteFlag.null}",groups={SysUserQoUpdate.class})
private Integer deleteFlag;
private Integer roleId;
private Integer authorityId;
private String identity;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getAuthorityId() {
return authorityId;
}
public void setAuthorityId(Integer authorityId) {
this.authorityId = authorityId;
}
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
}

View File

@ -0,0 +1,62 @@
package com.xkrs.model.qo;
import javax.persistence.Column;
/**
* @Author: XinYi Song
* @Date: 2021/12/10 16:37
*/
public class UserUpdate {
/**
* 用户昵称
*/
private String nickName;
/**
* 省
*/
private String province;
/**
* 市
*/
private String city;
/**
* 区
*/
private String county;
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
}

View File

@ -0,0 +1,8 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:13
*/
public interface BusinessQoInsert {
}

View File

@ -0,0 +1,8 @@
package com.xkrs.model.validation;
/**
* FileDocumentQoInsert
* @author tajochen
*/
public interface FileDocumentQoInsert {
}

View File

@ -0,0 +1,8 @@
package com.xkrs.model.validation;
/**
* FileDocumentQoUpdate
* @author tajochen
*/
public interface FileDocumentQoUpdate {
}

View File

@ -0,0 +1,8 @@
package com.xkrs.model.validation;
/**
* SysUserQoInsert
* @author tajochen
*/
public interface SysUserQoInsert {
}

View File

@ -0,0 +1,8 @@
package com.xkrs.model.validation;
/**
* SysUserQoUpdate
* @author tajochen
*/
public interface SysUserQoUpdate {
}

View File

@ -0,0 +1,67 @@
package com.xkrs.model.vo;
import java.io.Serializable;
/**
* FileServerResultVo 文件服务器查询结果
* @author tajochen
*/
public class FileServerResultVo<T> implements Serializable {
/**
* 状态信息
*/
String status;
/**
* 提示信息
*/
String message;
/**
* 数据
*/
T data;
public FileServerResultVo() {
}
public FileServerResultVo(String status, String msg, T data) {
this.status = status;
this.message = msg;
this.data = data;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@Override
public String toString() {
return "FileServerResultVo{" +
"status='" + status + '\'' +
", message='" + message + '\'' +
", data=" + data +
'}';
}
}

View File

@ -0,0 +1,198 @@
package com.xkrs.model.vo;
import javax.persistence.Column;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* SysUserVo
* @Author tajochen
*/
public class SysUserVo implements Serializable {
private Integer id;
private String userName;
private String nickName;
private String telephone;
private LocalDateTime addTime;
private LocalDateTime lastEntryTime;
private String lastEntryIp;
/**
* 用户头像
*/
private String avatar;
/**
* 省
*/
@Column(columnDefinition = "varchar(32)")
private String province;
/**
* 市
*/
@Column(columnDefinition = "varchar(32)")
private String city;
/**
* 区
*/
@Column(columnDefinition = "varchar(32)")
private String county;
/**
* 识别码身份id
*/
private String identifier;
/**
* 用户身份
*/
private String identity;
public SysUserVo(Integer id, String userName, String nickName, String telephone, LocalDateTime addTime, LocalDateTime lastEntryTime, String lastEntryIp, String avatar, String province, String city, String county, String identifier, String identity) {
this.id = id;
this.userName = userName;
this.nickName = nickName;
this.telephone = telephone;
this.addTime = addTime;
this.lastEntryTime = lastEntryTime;
this.lastEntryIp = lastEntryIp;
this.avatar = avatar;
this.province = province;
this.city = city;
this.county = county;
this.identifier = identifier;
this.identity = identity;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public LocalDateTime getAddTime() {
return addTime;
}
public void setAddTime(LocalDateTime addTime) {
this.addTime = addTime;
}
public LocalDateTime getLastEntryTime() {
return lastEntryTime;
}
public void setLastEntryTime(LocalDateTime lastEntryTime) {
this.lastEntryTime = lastEntryTime;
}
public String getLastEntryIp() {
return lastEntryIp;
}
public void setLastEntryIp(String lastEntryIp) {
this.lastEntryIp = lastEntryIp;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
@Override
public String toString() {
return "SysUserVo{" +
"id=" + id +
", userName='" + userName + '\'' +
", nickName='" + nickName + '\'' +
", telephone='" + telephone + '\'' +
", addTime=" + addTime +
", lastEntryTime=" + lastEntryTime +
", lastEntryIp='" + lastEntryIp + '\'' +
", avatar='" + avatar + '\'' +
", province='" + province + '\'' +
", city='" + city + '\'' +
", county='" + county + '\'' +
", identifier='" + identifier + '\'' +
", identity='" + identity + '\'' +
'}';
}
}

View File

@ -0,0 +1,64 @@
package com.xkrs.qiniu.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 16:39
*/
@Configuration
public class QiNiuYunConfig {
/**
* 七牛域名domain
*/
@Value("${qiniu.domain}")
private String url;
/**
* 七牛ACCESS_KEY
*/
@Value("${qiniu.accessKey}")
private String AccessKey;
/**
* 七牛SECRET_KEY
*/
@Value("${qiniu.secretKey}")
private String SecretKey;
/**
* 七牛空间名
*/
@Value("${qiniu.bucket}")
private String BucketName;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getAccessKey() {
return AccessKey;
}
public void setAccessKey(String accessKey) {
AccessKey = accessKey;
}
public String getSecretKey() {
return SecretKey;
}
public void setSecretKey(String secretKey) {
SecretKey = secretKey;
}
public String getBucketName() {
return BucketName;
}
public void setBucketName(String bucketName) {
BucketName = bucketName;
}
}

View File

@ -0,0 +1,38 @@
package com.xkrs.qiniu.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.qiniu.service.UploadImageService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2021/12/15 15:01
*/
@RestController
public class UploadFileController {
@Resource
private UploadImageService uploadImageService;
/**
* 将图片上传到七牛云
* @param files
* @return
*/
@PostMapping("/qiNiuUploadFile")
public String uploadFile(@RequestParam("files") MultipartFile files){
Locale locale = LocaleContextHolder.getLocale();
String uploadQiNiuImg = uploadImageService.uploadQiNiuImg(files);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,uploadQiNiuImg,locale);
}
}

View File

@ -0,0 +1,32 @@
package com.xkrs.qiniu.service;
import org.springframework.web.multipart.MultipartFile;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 16:52
*/
public interface UploadImageService {
/**
* 上传文件
* @param file
* @return
*/
String uploadQiNiuImg(MultipartFile file);
/**
* 获取私有空间文件
* @param fileKey
* @return
*/
String getPrivateFile(String fileKey);
/**
* 根据空间名、文件名删除文件
* @param bucketName
* @param fileKey
* @return
*/
boolean removeFile(String bucketName, String fileKey);
}

View File

@ -0,0 +1,122 @@
package com.xkrs.qiniu.service.impl;
import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;
import com.xkrs.qiniu.config.QiNiuYunConfig;
import com.xkrs.qiniu.service.UploadImageService;
import com.xkrs.qiniu.util.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 16:53
*/
@Service
public class UploadImageServiceImpl implements UploadImageService {
private QiNiuYunConfig qiNiuYunConfig;
// 七牛文件上传管理器
private UploadManager uploadManager;
//上传的token
private String token;
// 七牛认证管理
private Auth auth;
private BucketManager bucketManager;
public UploadImageServiceImpl(QiNiuYunConfig qiNiuYunConfig) {
this.qiNiuYunConfig = qiNiuYunConfig;
init();
}
private void init() {
// 构造一个带指定Zone对象的配置类, 注意这里的Zone.zone0需要根据主机选择
uploadManager = new UploadManager(new Configuration(Zone.zone2()));
auth = Auth.create(qiNiuYunConfig.getAccessKey(), qiNiuYunConfig.getSecretKey());
// 根据命名空间生成的上传token
bucketManager = new BucketManager(auth, new Configuration(Zone.zone2()));
token = auth.uploadToken(qiNiuYunConfig.getBucketName());
}
/**
* 上传文件
* @param file
* @return
*/
@Override
public String uploadQiNiuImg(MultipartFile file) {
try {
// 获取文件的名称
String fileName = file.getOriginalFilename();
if(fileName != null){
// 使用工具类根据上传文件生成唯一图片名称
String imgName = StringUtil.getRandomImgName(fileName);
FileInputStream inputStream = (FileInputStream) file.getInputStream();
// 上传图片文件
Response res = uploadManager.put(inputStream, imgName, token, null, null);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
// 解析上传成功的结果
DefaultPutRet putRet = new Gson().fromJson(res.bodyString(), DefaultPutRet.class);
// 直接返回外链地址
return getPrivateFile(imgName);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 获取私有空间文件
*
* @param fileKey
* @return
*/
@Override
public String getPrivateFile(String fileKey) {
String encodedFileName = null;
String finalUrl = null;
try {
encodedFileName = URLEncoder.encode(fileKey, "utf-8").replace("+", "%20");
String publicUrl = String.format("%s/%s", this.qiNiuYunConfig.getUrl(), encodedFileName);
// 1小时可以自定义链接过期时间
long expireInSeconds = 3600;
finalUrl = auth.privateDownloadUrl(publicUrl, expireInSeconds);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return finalUrl;
}
/**
* 根据空间名、文件名删除文件
* @param bucketName
* @param fileKey
* @return
*/
@Override
public boolean removeFile(String bucketName, String fileKey) {
try {
bucketManager.delete(bucketName, fileKey);
} catch (QiniuException e) {
e.printStackTrace();
}
return true;
}
}

View File

@ -0,0 +1,30 @@
package com.xkrs.qiniu.util;
import java.util.UUID;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 16:43
*/
public class StringUtil {
/**
* @Description: 生成唯一图片名称
* @Param: fileName
* @return: 云服务器fileName
*/
public static String getRandomImgName(String fileName) {
int index = fileName.lastIndexOf(".");
if ((fileName == null || fileName.isEmpty()) || index == -1){
throw new IllegalArgumentException();
}
// 获取文件后缀
String suffix = fileName.substring(index);
// 生成UUID
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
// 生成上传至云服务器的路径
// String path = "news/crush/"+ DateUtil.today() + "-" + uuid + suffix;
String path = uuid + suffix;
return path;
}
}

View File

@ -0,0 +1,45 @@
package com.xkrs.service;
import com.xkrs.model.entity.FileDocumentEntity;
import com.xkrs.model.qo.FileDocumentQo;
import java.util.Optional;
/**
* 文档管理接口
* @author tajochen
*/
public interface FileDocumentService {
/**
* 文档列表
* @return
*/
Iterable<FileDocumentEntity> getAllFile();
/**
* 获取指定id记录
* @param id
* @return
*/
Optional getById(Integer id);
/**
* 新增文档记录
* @param fileDocumentQo
* @param userName
*/
void add(FileDocumentQo fileDocumentQo, String userName);
/**
* 删除文档记录
* @param id
*/
void delete(Integer id);
/**
* 修改文档记录
* @param fileDocumentEntity
*/
void update(FileDocumentEntity fileDocumentEntity);
}

View File

@ -0,0 +1,53 @@
package com.xkrs.service;
import com.xkrs.model.vo.FileServerResultVo;
/**
* 文件服务器接口
* @author tajochen
*/
public interface FileServerService {
/**
* 获取文件统计信息
* @return
*/
FileServerResultVo getFileStat();
/**
* 删除文件
* @param md5 信息摘要
* @param path 路径
* @return
*/
FileServerResultVo deleteFile(String md5, String path);
/**
* 获取文件信息
* @param md5 信息摘要
* @param path 路径
* @return
*/
FileServerResultVo getFileInfo(String md5, String path);
/**
* 获取文件列表
* @param dir 目录名
* @return
*/
FileServerResultVo getFileList(String dir);
/**
* 修复统计信息
* @param date 要修复的日期格式如20190725
* @return
*/
FileServerResultVo getFileRepairStat(String date);
/**
* 同步失败修复
* @param force 是否强行修复(0|1)
* @return
*/
FileServerResultVo getFileRepair(String force);
}

View File

@ -0,0 +1,50 @@
package com.xkrs.service;
import com.xkrs.model.qo.BankCardQo;
import com.xkrs.model.qo.BusinessQo;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:51
* 商家模块
*/
public interface MerchantSettlementService {
/**
* 商家入驻
* @param businessQo
* @param businessPhoto
* @param businessLicense
* @param bankCardQos
* @param businessId
* @return
* @throws IOException
*/
String merchantSettlement(BusinessQo businessQo, MultipartFile businessPhoto, MultipartFile businessLicense, List<BankCardQo> bankCardQos) throws IOException;
/**
* 通过状态查询商家入驻信息
* @param type
* @return
*/
String findAllByBusinessType(String type);
/**
* 根据省市区查询审核通过的商家的信息
* @param countyName
* @param keepType
* @return
*/
String findAllByCountyName(String countyName, String keepType);
/**
* 根据商家用户id查询商家入驻信息
* @param businessId
* @return
*/
String findBusinessById(Integer businessId);
}

View File

@ -0,0 +1,19 @@
package com.xkrs.service;
import com.xkrs.model.entity.SysAuthorityEntity;
import java.util.List;
/**
* 系统权限服务接口
* @author tajochen
*/
public interface SysAuthorityService {
/**
* 获取权限实体列表根据用户名
* @param userName
* @return
*/
List<SysAuthorityEntity> getSysAuthorityListByUserName(String userName);
}

View File

@ -0,0 +1,19 @@
package com.xkrs.service;
import com.xkrs.model.entity.SysRoleEntity;
import java.util.List;
/**
* 系统角色服务接口
* @author tajochen
*/
public interface SysRoleService {
/**
* 获取角色实体列表根据用户名
* @param userName
* @return
*/
List<SysRoleEntity> getSysRoleListByUserName(String userName);
}

View File

@ -0,0 +1,108 @@
package com.xkrs.service;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo;
import com.xkrs.model.qo.UserUpdate;
import com.xkrs.model.vo.SysUserVo;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* 系统用户服务接口
* @author tajochen
*/
public interface SysUserService {
/**
* 检查用户名
* @param userName
* @return
*/
boolean checkUserName(String userName);
/**
* 获取所有用户
* @return
*/
//Iterable<SysUserVo> getAllSysUser();
/**
* 保存用户
* @param sysUserQo
*/
void addUser(SysUserQo sysUserQo);
/**
* 获取系统用户实体根据用户名
* @param userName
* @return
*/
SysUserEntity getSysUserByUserName(String userName);
/**
* 获取用户信息
* @param userName
* @return
*/
SysUserVo selectUserByUserName(String userName);
/**
* 用户登录更新
* @param userName
* @param ipAddress
* @return
*/
int updateSysUserLogin(String userName, String ipAddress);
/**
* 系统用户更新
* @param sysUserQo
* @return
*/
int updateSysUser(SysUserQo sysUserQo);
/**
* 软删除系统用户
* @param id
* @return
*/
int softDeleteGeneralUser(Integer id);
/**
* 用户绑定手机号
* @param userId
* @param phone
* @return
*/
String bindPhone(Integer userId, String phone);
/**
* 手机号登录
* @param phone
* @param verificationCode
* @return
*/
String loginByPhone(String phone, String verificationCode);
/**
* 用户完善个人信息
* @param files
* @param userUpdate
* @param userId
* @return
*/
String updateUserByUserId(MultipartFile files, UserUpdate userUpdate, Integer userId) throws IOException;
/**
* 启用
* @param userId
*/
void updateEnable(Integer userId);
/**
* 禁用
* @param userId
*/
void updateDisable(Integer userId);
}

View File

@ -0,0 +1,99 @@
package com.xkrs.service.impl;
import com.xkrs.dao.FileDocumentDao;
import com.xkrs.model.entity.FileDocumentEntity;
import com.xkrs.model.qo.FileDocumentQo;
import com.xkrs.service.FileDocumentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Optional;
import static com.xkrs.utils.DateTimeUtil.getNowTime;
/**
* 文档管理接口
* @author tajochen
*/
@Service
@CacheConfig(cacheNames = "FileDocumentServiceCache")
public class FileDocumentServiceImpl implements FileDocumentService {
Logger logger = LoggerFactory.getLogger(FileDocumentServiceImpl.class);
@Resource
private FileDocumentDao fileDocumentDao;
/**
* 文档列表
* @return
*/
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
@Override
public Iterable<FileDocumentEntity> getAllFile() {
Iterable<FileDocumentEntity> list = fileDocumentDao.findAll();
return list;
}
/**
* 获取指定id记录
* @param id
* @return
*/
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
@Override
public Optional getById(Integer id) {
Optional <FileDocumentEntity> obj = fileDocumentDao.findById(id);
return obj;
}
/**
* 新增文档记录
* @param fileDocumentQo
* @param userName
*/
@Transactional(rollbackFor=Exception.class)
@Override
@CacheEvict(value = "FileDocumentServiceCache",allEntries = true)
public void add(FileDocumentQo fileDocumentQo, String userName) {
FileDocumentEntity fileDocumentEntity = new FileDocumentEntity();
fileDocumentEntity.setName(fileDocumentQo.getName());
fileDocumentEntity.setFilePath(fileDocumentQo.getFilePath());
fileDocumentEntity.setAddUserName(userName);
fileDocumentEntity.setCategory(fileDocumentQo.getCategory());
fileDocumentEntity.setMemo(fileDocumentQo.getMemo());
fileDocumentEntity.setMd5(fileDocumentQo.getMd5());
fileDocumentEntity.setSize(fileDocumentQo.getSize());
// 设置系统时间
fileDocumentEntity.setAddTime(getNowTime());
fileDocumentDao.save(fileDocumentEntity);
}
/**
* 删除文档记录
* @param id
*/
@Transactional(rollbackFor=Exception.class)
@Override
@CacheEvict(value = "FileDocumentServiceCache",allEntries = true)
public void delete(Integer id) {
fileDocumentDao.deleteById(id);
}
/**
* 修改文档记录
* @param fileDocumentEntity
*/
@Transactional(rollbackFor=Exception.class)
@Override
@CacheEvict(value = "FileDocumentServiceCache",allEntries = true)
public void update(FileDocumentEntity fileDocumentEntity) {
fileDocumentDao.save(fileDocumentEntity);
}
}

View File

@ -0,0 +1,121 @@
package com.xkrs.service.impl;
import com.xkrs.model.vo.FileServerResultVo;
import com.xkrs.service.FileServerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import static com.xkrs.utils.RequestUtil.postFileManage;
/**
* 文件服务器接口
* @author tajochen
*/
@Service
public class FileServerServiceImpl implements FileServerService {
Logger logger = LoggerFactory.getLogger(FileServerServiceImpl.class);
@Value("${my.FileServerAdminAdress}")
private String fileServerAdminAdress;
/**
* 获取文件统计信息
* @return
*/
@Override
public FileServerResultVo getFileStat(){
String requestUrl = fileServerAdminAdress + "/group1/stat";
Map<String,String> map = new HashMap<String, String>(16);
FileServerResultVo fileServerResultVo = postFileManage(requestUrl,map);
return fileServerResultVo;
}
/**
* 删除文件
* @param md5 信息摘要
* @param path 路径
* @return
*/
@Override
public FileServerResultVo deleteFile(String md5,String path){
String requestUrl = fileServerAdminAdress + "/group1/delete";
Map<String,String> map = new HashMap<String, String>(16);
if(md5 != null && !md5.isEmpty()){
map.put("md5",md5);
}
if(path != null && !path.isEmpty()){
map.put("path",path);
}
FileServerResultVo fileServerResultVo = postFileManage(requestUrl,map);
return fileServerResultVo;
}
/**
* 获取文件信息
* @param md5 信息摘要
* @param path 路径
* @return
*/
@Override
public FileServerResultVo getFileInfo(String md5,String path){
String requestUrl = fileServerAdminAdress + "/group1/get_file_info";
Map<String,String> map = new HashMap<String, String>(16);
if(md5 != null && !md5.isEmpty()){
map.put("md5",md5);
}
if(path != null && !path.isEmpty()){
map.put("path",path);
}
FileServerResultVo fileServerResultVo = postFileManage(requestUrl,map);
return fileServerResultVo;
}
/**
* 获取文件列表
* @param dir 目录名
* @return
*/
@Override
public FileServerResultVo getFileList(String dir){
String requestUrl = fileServerAdminAdress + "/group1/list_dir";
Map<String,String> map = new HashMap<String, String>(16);
map.put("dir",dir);
FileServerResultVo fileServerResultVo = postFileManage(requestUrl,map);
return fileServerResultVo;
}
/**
* 修复统计信息
* @param date 要修复的日期格式如20190725
* @return
*/
@Override
public FileServerResultVo getFileRepairStat(String date){
String requestUrl = fileServerAdminAdress + "/group1/repair_stat";
Map<String,String> map = new HashMap<String, String>(16);
map.put("date",date);
FileServerResultVo fileServerResultVo = postFileManage(requestUrl,map);
return fileServerResultVo;
}
/**
* 同步失败修复
* @param force 是否强行修复(0|1)
* @return
*/
@Override
public FileServerResultVo getFileRepair(String force){
String requestUrl = fileServerAdminAdress + "/group1/repair";
Map<String,String> map = new HashMap<String, String>(16);
map.put("force",force);
FileServerResultVo fileServerResultVo = postFileManage(requestUrl,map);
return fileServerResultVo;
}
}

View File

@ -0,0 +1,141 @@
package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.BankCardDao;
import com.xkrs.dao.BusinessDao;
import com.xkrs.model.entity.BankCardEntity;
import com.xkrs.model.entity.BusinessEntity;
import com.xkrs.model.qo.BankCardQo;
import com.xkrs.model.qo.BusinessQo;
import com.xkrs.service.MerchantSettlementService;
import com.xkrs.utils.DateTimeUtil;
import com.xkrs.utils.PhotoUtil;
import com.xkrs.utils.VerifyBankCardUtil;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2021/12/14 9:52
* 商家模块
*/
@Service
public class MerchantSettlementServiceImpl implements MerchantSettlementService {
@Resource
private BusinessDao businessDao;
@Resource
private BankCardDao bankCardDao;
/**
* 商家入驻
* @param businessQo
* @param businessPhoto
* @param businessLicense
* @param bankCardQos
* @param
* @return
*/
@Override
public String merchantSettlement(BusinessQo businessQo, MultipartFile businessPhoto, MultipartFile businessLicense, List<BankCardQo> bankCardQos) throws IOException {
Locale locale = LocaleContextHolder.getLocale();
BusinessEntity byBusinessName = businessDao.findByBusinessName(businessQo.getBusinessName());
if(byBusinessName != null){
return outputEncapsulationObject(PromptMessageEnum.FILE_EXISTS,"您已入驻,请勿重复入驻或提交!",locale);
}
BusinessEntity byBusinessPhone = businessDao.findByBusinessPhone(businessQo.getBusinessPhone());
if(byBusinessPhone != null){
return outputEncapsulationObject(PromptMessageEnum.FILE_EXISTS,"您已入驻,请勿重复入驻或提交!",locale);
}
if(businessPhoto == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"商家图片不能为空!",locale);
}
if(businessLicense == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"营业执照不能为空!",locale);
}
// 上传商家图片
//String busPhoto = PhotoUtil.memoryPhoto(businessPhoto);
// 上传商家营业执照
//String photo = PhotoUtil.memoryPhoto(businessLicense);
for(BankCardQo bankCardQo : bankCardQos){
Map<String, Object> stringObjectMap = VerifyBankCardUtil.checkBankCar(bankCardQo.getBankCardNumber());
if(!((Boolean) stringObjectMap.get("card")) || "findNotName".equals(stringObjectMap.get("cardName").toString())){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"银行卡信息有误,请检查重新填写!",locale);
}
BankCardEntity bankCardEntity = new BankCardEntity();
bankCardEntity.setBankCardNumber(bankCardQo.getBankCardNumber());
bankCardEntity.setAccountBank(bankCardQo.getAccountBank());
bankCardEntity.setBankName(stringObjectMap.get("cardName").toString());
// bankCardEntity.setBusinessId(businessId);
bankCardEntity.setBusinessPhone(businessQo.getBusinessPhone());
bankCardDao.save(bankCardEntity);
}
BusinessEntity businessEntity = new BusinessEntity();
businessEntity.setBusinessName(businessQo.getBusinessName());
businessEntity.setBusinessPro(businessQo.getBusinessPro());
businessEntity.setBusinessCity(businessQo.getBusinessCity());
businessEntity.setBusinessCountry(businessQo.getBusinessCountry());
businessEntity.setBusinessAddress(businessQo.getBusinessAddress());
businessEntity.setBusinessPhone(businessQo.getBusinessPhone());
businessEntity.setBusinessPhoto(businessQo.getBusinessPhoto());
businessEntity.setBusinessLicense(businessQo.getBusinessLicense());
businessEntity.setBusinessDiscount(businessQo.getBusinessDiscount());
businessEntity.setHeadIdentifier(businessQo.getHeadIdentifier());
businessEntity.setBusinessType("0");
businessEntity.setSettleInTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
businessDao.save(businessEntity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"入驻成功!",locale);
}
/**
* 通过状态查询商家入驻的信息
* @param type
* @return
*/
@Override
public String findAllByBusinessType(String type) {
Locale locale = LocaleContextHolder.getLocale();
List<BusinessEntity> allByBusinessType = businessDao.findAllByBusinessType(type);
if(allByBusinessType == null || allByBusinessType.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有您所需要的商家的信息!",locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,allByBusinessType,locale);
}
/**
* 根据省市区查询审核通过的商家的信息
* @param countyName
* @param keepType
* @return
*/
@Override
public String findAllByCountyName(String countyName, String keepType) {
return null;
}
/**
* 根据商家用户id查询入驻信息
* @param businessId
* @return
*/
@Override
public String findBusinessById(Integer businessId) {
Locale locale = LocaleContextHolder.getLocale();
BusinessEntity byBusinessId = businessDao.findByBusinessId(businessId);
if(byBusinessId == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"你还未入驻,请先入驻!",locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byBusinessId,locale);
}
}

View File

@ -0,0 +1,29 @@
package com.xkrs.service.impl;
import com.xkrs.dao.SysAuthorityDao;
import com.xkrs.model.entity.SysAuthorityEntity;
import com.xkrs.service.SysAuthorityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 系统权限服务实现
* @author tajochen
*/
@Service
public class SysAuthorityServiceImpl implements SysAuthorityService {
Logger logger = LoggerFactory.getLogger(SysAuthorityServiceImpl.class);
@Resource
private SysAuthorityDao sysAuthorityDao;
@Override
public List<SysAuthorityEntity> getSysAuthorityListByUserName(String userName) {
return sysAuthorityDao.selectByUserName(userName);
}
}

View File

@ -0,0 +1,29 @@
package com.xkrs.service.impl;
import com.xkrs.dao.SysRoleDao;
import com.xkrs.model.entity.SysRoleEntity;
import com.xkrs.service.SysRoleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 系统角色服务实现
* @author tajochen
*/
@Service
public class SysRoleServiceImpl implements SysRoleService {
Logger logger = LoggerFactory.getLogger(SysRoleServiceImpl.class);
@Resource
private SysRoleDao sysRoleDao;
@Override
public List<SysRoleEntity> getSysRoleListByUserName(String userName) {
return sysRoleDao.selectByUserName(userName);
}
}

View File

@ -0,0 +1,272 @@
package com.xkrs.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.xkrs.common.config.RedisUtil;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.RelRoleAuthorityDao;
import com.xkrs.dao.RelUserRoleDao;
import com.xkrs.dao.SysRoleDao;
import com.xkrs.dao.SysUserDao;
import com.xkrs.model.entity.RelRoleAuthorityEntity;
import com.xkrs.model.entity.RelUserRoleEntity;
import com.xkrs.model.entity.SysRoleEntity;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo;
import com.xkrs.model.qo.UserUpdate;
import com.xkrs.model.vo.SysUserVo;
import com.xkrs.service.SysUserService;
import com.xkrs.utils.PhotoUtil;
import com.xkrs.utils.RequestUtil;
import org.apache.kafka.common.requests.RequestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
import static com.xkrs.utils.DateTimeUtil.getNowTime;
import static com.xkrs.utils.EncryptDecryptUtil.encry256;
/**
* 系统用户服务实现
* @author tajochen
*/
@Service
public class SysUserServiceImpl implements SysUserService {
Logger logger = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Resource
private SysUserDao sysUserDao;
@Resource
private SysRoleDao sysRoleDao;
@Resource
private RelUserRoleDao relUserRoleDao;
@Resource
private RelRoleAuthorityDao relRoleAuthorityDao;
@Resource
private RedisUtil redisUtil;
/**
* 检查用户名是否存在
* @param userName
* @return
*/
@Override
public boolean checkUserName(String userName) {
int num = sysUserDao.checkUserName(userName);
return (num == 0);
};
/**
* 新增用户
* @param sysUserQo
*/
@Transactional(rollbackFor=Exception.class)
@Override
public void addUser(SysUserQo sysUserQo) {
String salt = KeyGenerators.string().generateKey();
SysUserEntity sysUserEntity = new SysUserEntity();
sysUserEntity.setUserName(sysUserQo.getUserName());
sysUserEntity.setSalt(salt);
sysUserEntity.setPassword(encry256(sysUserQo.getPassword() + salt));
// sysUserEntity.setTelephone(sysUserQo.getTelephone());
sysUserEntity.setActiveFlag(0);
sysUserEntity.setStatusCode(0);
sysUserEntity.setAddTime(getNowTime());
sysUserEntity.setDeleteFlag(0);
int i = (int)(Math.random()*9+1)*100000;
sysUserEntity.setIdentifier(String.valueOf(i));
sysUserEntity.setIdentity(sysUserQo.getIdentity());
sysUserDao.save(sysUserEntity);
RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity();
relUserRoleEntity.setUserId(sysUserEntity.getId().longValue());
relUserRoleEntity.setRoleId(sysUserQo.getRoleId());
RelRoleAuthorityEntity relRoleAuthorityEntity = new RelRoleAuthorityEntity();
relRoleAuthorityEntity.setRoleId(sysUserQo.getRoleId());
relRoleAuthorityEntity.setAuthorityId(sysUserQo.getAuthorityId());
relUserRoleDao.save(relUserRoleEntity);
relRoleAuthorityDao.save(relRoleAuthorityEntity);
//sysRoleDao.insertRelUserRole(sysUserEntity.getUserName(),"role_general_user");
}
/**
* 查询所有用户Vo
* @return
*/
/*@Transactional(rollbackFor=Exception.class)
@Override
public Iterable<SysUserVo> getAllSysUser() {
Iterable<SysUserVo> ls = sysUserDao.selectAllSysUser();
return ls;
}*/
@Transactional(rollbackFor=Exception.class)
@Override
public SysUserEntity getSysUserByUserName(String userName) {
return sysUserDao.selectByUserName(userName);
}
/**
* 获取用户信息
* @param userName
* @return
*/
@Transactional(rollbackFor=Exception.class)
@Override
public SysUserVo selectUserByUserName(String userName) {
return sysUserDao.selectUserByUserName(userName);
}
@Transactional(rollbackFor=Exception.class)
@Override
public int updateSysUserLogin(String userName,String ipAddress) {
return sysUserDao.updateSysUserLogin(userName,ipAddress);
}
/**
* 更新用户
* @param sysUserQo
* @return
*/
@Transactional(rollbackFor=Exception.class)
@Override
public int updateSysUser(SysUserQo sysUserQo) {
SysUserEntity sysUserEntity = new SysUserEntity();
sysUserEntity.setNickName(sysUserQo.getNickName());
sysUserDao.save(sysUserEntity);
return 1;
}
/**
* 软删除普通用户
* @param id
* @return
*/
@Transactional(rollbackFor=Exception.class)
@Override
public int softDeleteGeneralUser(Integer id) {
String adminRole = "role_administor";
String sysRole ="role_system_manager";
List<SysRoleEntity> list = sysRoleDao.selectByUserId(id);
if(list.size()>0){
SysRoleEntity sysRoleEntity = list.get(1);
if(sysRole.equals(sysRoleEntity.getRoleName())||adminRole.equals(sysRoleEntity.getRoleName())){
sysUserDao.softDeleteGeneralUserById(id);
return 0;
}
}
return 1;
}
/**
* 用户绑定手机号
* @param userId
* @param phone
* @return
*/
@Transactional(rollbackFor=Exception.class)
@Override
public String bindPhone(Integer userId, String phone) {
Locale locale = LocaleContextHolder.getLocale();
SysUserEntity byTelephone = sysUserDao.findByTelephone(phone);
if(byTelephone != null){
return outputEncapsulationObject(PromptMessageEnum.FILE_EXISTS,"该手机号已用于该平台的绑定!",locale);
}
sysUserDao.updatePhoneByUserId(userId,phone);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"绑定成功!!",locale);
}
/**
* 手机号登录
* @param phone
* @param verificationCode
* @return
*/
@Override
public String loginByPhone(String phone, String verificationCode) {
Locale locale = LocaleContextHolder.getLocale();
SysUserEntity byTelephone = sysUserDao.findByTelephone(phone);
if(byTelephone == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"您还未绑定手机号!不能使用手机号登录!",locale);
}
String o = (String) redisUtil.get(phone);
if("".equals(o) || o == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"请先发送验证码!",locale);
}
if(!redisUtil.get(phone).equals(verificationCode)){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"验证码错误,请重新输入!",locale);
}
String url = "http://localhost:6809/api/login";
Map<String,String> map = new HashMap(3);
map.put("userName",byTelephone.getUserName());
map.put("password",byTelephone.getPassword());
String userLogin = RequestUtil.doGet(url, map);
JSONObject jsonObject = JSON.parseObject(userLogin);
JSONObject data = (JSONObject) jsonObject.get("data");
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,data,locale);
}
/**
* 用户完善个人信息
* @param files
* @param userUpdate
* @param userId
* @return
*/
@Transactional(rollbackFor=Exception.class)
@Override
public String updateUserByUserId(MultipartFile files, UserUpdate userUpdate, Integer userId) throws IOException {
Locale locale = LocaleContextHolder.getLocale();
if(files == null){
String uploadAvatar = "";
sysUserDao.updateUserByUserId(userId,userUpdate.getNickName(),uploadAvatar,userUpdate.getProvince(),userUpdate.getCity(),userUpdate.getCounty());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功!",locale);
}
String memoryPhoto = PhotoUtil.memoryPhoto(files);
sysUserDao.updateUserByUserId(userId,userUpdate.getNickName(),memoryPhoto,userUpdate.getProvince(),userUpdate.getCity(),userUpdate.getCounty());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功!",locale);
}
/**
* 启用
* @param userId
*/
@Transactional(rollbackFor=Exception.class)
@Override
public void updateEnable(Integer userId) {
sysUserDao.updateEnable(userId);
}
/**
* 禁用
* @param userId
*/
@Transactional(rollbackFor=Exception.class)
@Override
public void updateDisable(Integer userId) {
sysUserDao.updateDisable(userId);
}
}

View File

@ -0,0 +1,293 @@
package com.xkrs.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
/**
* 根据经纬度获取地址:省 市 区 位置名称
* @author XinYi Song
*/
public class AddressUtils {
/*public static String getLatAndLng(String lat, String lng) {
String key = "O7QBZ-ZYDKI-EMKGN-53UHG-5XSJF-AAFBP";
try {
String hsUrl = "https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + "&key=" + key + "&get_poi=1";
URL url;
url = new URL(hsUrl);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
// 提交模式
con.setRequestMethod("GET");
X509TrustManager xtm = new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
// TODO Auto-generated method stub
return null;
}
@Override
public void checkServerTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
// TODO Auto-generated method stub
}
@Override
public void checkClientTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
// TODO Auto-generated method stub
}
};
TrustManager[] tm = {xtm};
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, tm, null);
con.setSSLSocketFactory(ctx.getSocketFactory());
con.setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String arg0, SSLSession arg1) {
return true;
}
});
InputStream inStream = con.getInputStream();
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, len);
}
//网页的二进制数据
byte[] b = outStream.toByteArray();
outStream.close();
inStream.close();
String rtn = new String(b, "utf-8");
if (StringUtils.isNotBlank(rtn)) {
JSONObject object = JSONObject.fromObject(rtn);
if (object != null) {
if (object.has("status") && object.getInt("status") == 0) {
JSONObject result = JSONObject.fromObject(object.get("result"));
if (result != null) {
JSONObject addressComponent = JSONObject.fromObject(result.get("address_component"));
if (addressComponent != null) {
String province = (String) addressComponent.get("province");
String city = (String) addressComponent.get("city");
String district = (String) addressComponent.get("district");
String street = (String) addressComponent.get("street");
String street_number = (String) addressComponent.get("street_number");
String address = province + city + district + street + street_number;
return address;
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}*/
private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36";
/**
* 获取指定经纬度的地理位置
* @param latitude 纬度
* @param longitude 经度
* @return
*/
public static String getLocal(String latitude, String longitude) {
String ok = "ok";
String msg = "msg";
String info = getAdd(latitude, longitude);
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(info);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
assert node != null;
String province = null;
String city = null;
String county = null;
String road = null;
String address = null;
if (ok.equals(node.path(msg).asText())) {
province = node.path("result").path("addressComponent").path("province").asText();
city = node.path("result").path("addressComponent").path("city").asText();
county = node.path("result").path("addressComponent").path("county").asText();
road = node.path("result").path("addressComponent").path("road").asText();
address = node.path("result").path("addressComponent").path("address").asText();
}
String fireAddress = province + city + county + road + address;
return fireAddress;
}
/**
* 根据经纬度获取位置信息
* @param latitude 纬度
* @param longitude 经度
* @return
*/
public static String getAdd(String latitude, String longitude) {
// 读取成功标志
boolean isSuccess = false;
// 重复次数
int count = 10;
ObjectMapper mapper = new ObjectMapper();
Map<String, String> paramMap = new HashMap<>(3);
paramMap.put("lon", longitude);
paramMap.put("lat", latitude);
paramMap.put("ver", "1");
String paramStr = null;
try {
paramStr = mapper.writeValueAsString(paramMap);
} catch (JsonProcessingException e) {
log.error("转json失败,{}", (Object) e.getStackTrace());
}
String url = String.format("http://api.tianditu.gov.cn/geocoder?type=geocode&tk=5a1d34815475f88e6d8802da6be832ae&postStr=%s",
paramStr);
// 创建http对象
RequestConfig defaultRequestConfig = RequestConfig.custom()
.setSocketTimeout(60000).setConnectTimeout(60000)
.setConnectionRequestTimeout(60000)
.build();
CloseableHttpClient client = HttpClients.custom()
.setDefaultRequestConfig(defaultRequestConfig).build();
// 创建并设置URI
URIBuilder uri = null;
// 创建Get请求
HttpGet get = null;
try {
URL url1 = new URL(url);
URI uri1 = new URI(url1.getProtocol(), url1.getHost(), url1.getPath(), url1.getQuery(), null);
uri = new URIBuilder(uri1);
get = new HttpGet(uri.build());
// 设置请求头
setGet(get);
} catch (URISyntaxException | MalformedURLException e) {
log.info("错误{}", (Object) e.getStackTrace());
}
//发送请求
HttpEntity entity = null;
InputStream is = null;
BufferedReader br = null;
// 创建响应对象
CloseableHttpResponse response = null;
String line;
String sLine = null;
String json = null;
while (!isSuccess && count > 0) {
try {
response = client.execute(get);
// 获取请求结果
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
log.info("实时定位数据未请求成功");
count--;
//close(is, br, response, client);
continue;
}
entity = response.getEntity();
is = entity.getContent();
br = new BufferedReader(
new InputStreamReader(is, StandardCharsets.UTF_8)
);
StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) {
sb.append(line);
}
sLine = sb.toString();
sLine = sLine.substring(sLine.indexOf("{"));
//使用ObjectMapper对象对 User对象进行转换
try {
json = mapper.writeValueAsString(sLine);
} catch (JsonProcessingException e) {
log.info("json字符串转化异常{}", (Object) e.getStackTrace());
}
isSuccess = true;
} catch (ClientProtocolException e) {
log.info("请求超时等问题:{}", (Object) e.getStackTrace());
} catch (IOException e) {
log.info("I/O问题:{}", (Object) e.getStackTrace());
} finally {
close(is, br, response, client);
}
}
return sLine;
}
private static void close(InputStream is, BufferedReader br, CloseableHttpResponse response, CloseableHttpClient client){
try {
if (null != is){
is.close();
}
if (null != br){
br.close();
}
if (null != response){
response.close();
}
if (null != client){
client.close();
}
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}
}
private static HttpGet setGet(HttpGet get) {
get.setHeader("Accept"
, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
get.setHeader("Accept-Encoding"
, "gzip, deflate");
get.setHeader("Accept-Language"
, "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6");
get.setHeader("Connection"
, "keep-alive");
get.setHeader("Cache-Control"
, "no-cache");
get.setHeader("Upgrade-Insecure-Requests"
, "1");
get.setHeader("User-Agent", USER_AGENT);
return get;
}
public static void main(String[] args) {
String latAndLng = getLocal("36.89", "115.90");
System.out.println(latAndLng);
}
}

View File

@ -0,0 +1,67 @@
package com.xkrs.utils;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Xin
*/
public class AliYunSmsUtils {
public static Logger log = LoggerFactory.getLogger(AliYunSmsUtils.class);
/**
* 产品名称:云通信短信API产品,开发者无需替换
*/
static final String product = "Dysmsapi";
/**
* 产品域名,开发者无需替换
*/
static final String domain = "dysmsapi.aliyuncs.com";
/**
* TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
* TODO 修改成自己的
*/
static final String accessKeyId = "LTAI5tMSjLfu8Xu2w6WeguFF";
/**
* TODO 修改成自己的
*/
static final String accessKeySecret = "hvqM5zpi72hvX4VXM71wq6AE0XYtDI";
public static SendSmsResponse sendSms(String telephone, String code) throws ClientException {
//可自助调整超时时间
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(telephone);
//必填:短信签名-可在短信控制台中找到
request.setSignName("青岛星科瑞升");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode("SMS_221082764");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
//如果为发送验证码 无需修改
request.setTemplateParam("{\"code\":\"" + code + "\"}");
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
//hint 此处可能会抛出异常注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if(sendSmsResponse.getCode()!= null && sendSmsResponse.getCode().equals("OK")){
log.info("------------>短信发送成功!");
}else {
log.info("------------>短信发送失败!");
}
return sendSmsResponse;
}
}

View File

@ -0,0 +1,73 @@
package com.xkrs.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
/**
* @author xkrs
*/
public class BeanUtils {
/**
* 缓存BeanCopier 对象 提升性能
*/
private static final ConcurrentHashMap<String, org.springframework.cglib.beans.BeanCopier> BEAN_COPIER_MAP = new ConcurrentHashMap<>();
/**
* Bean属性复制工具方法。
* @param sources 原始集合
* @param supplier: 目标类::new(eg: UserVO::new)
*/
public static <S, T> List<T> cgLibCopyList(List<S> sources, Supplier<T> supplier) {
List<T> list = new ArrayList<>(sources.size());
org.springframework.cglib.beans.BeanCopier beanCopier = null;
for (S source : sources) {
T t = supplier.get();
if (beanCopier == null) {
beanCopier = getBeanCopier(source.getClass(), t.getClass());
}
beanCopier.copy(source, t, null);
list.add(t);
}
return list;
}
/**
* Bean属性复制工具方法。
* @param source 目标对象
* @param supplier: 目标类::new(eg: UserVO::new)
*/
public static <T> T cgLibCopyBean(Object source, Supplier<T> supplier) {
T t = supplier.get();
getBeanCopier(source.getClass(), t.getClass()).copy(source, t, null);
return t;
}
/**
* 获取BeanCopier对象 如果缓存中有从缓存中获取 如果没有则新创建对象并加入缓存
* @param sourceClass
* @param targetClass
* @return
*/
private static org.springframework.cglib.beans.BeanCopier getBeanCopier(Class<?> sourceClass, Class<?> targetClass) {
String key = getKey(sourceClass.getName(), targetClass.getName());
org.springframework.cglib.beans.BeanCopier beanCopier;
beanCopier = BEAN_COPIER_MAP.get(key);
if (beanCopier == null) {
beanCopier = org.springframework.cglib.beans.BeanCopier.create(sourceClass, targetClass, false);
BEAN_COPIER_MAP.put(key, beanCopier);
}
return beanCopier;
}
/**
* 生成缓存key
*/
private static String getKey(String sourceClassName, String targetClassName) {
return sourceClassName + targetClassName;
}
}

View File

@ -0,0 +1,177 @@
package com.xkrs.utils;
/**
* @author XinYi Song
*/
public interface CommonConstant {
/**
* 正常状态
*/
public static final String STATUS_NORMAL = "0";
/**
* 禁用状态
*/
public static final String STATUS_DISABLE = "1";
/**
* 删除标志
*/
public static final String DEL_FLAG_1 = "1";
/**
* 未删除
*/
public static final String DEL_FLAG_0 = "0";
/**
* 系统日志类型: 登录
*/
public static final int LOG_TYPE_1 = 1;
/**
* 系统日志类型: 操作
*/
public static final int LOG_TYPE_2 = 2;
/**
* 操作日志类型: 查询
*/
public static final int OPERATE_TYPE_1 = 1;
/**
* 操作日志类型: 添加
*/
public static final int OPERATE_TYPE_2 = 2;
/**
* 操作日志类型: 更新
*/
public static final int OPERATE_TYPE_3 = 3;
/**
* 操作日志类型: 删除
*/
public static final int OPERATE_TYPE_4 = 4;
/**
* 操作日志类型: 倒入
*/
public static final int OPERATE_TYPE_5 = 5;
/**
* 操作日志类型: 导出
*/
public static final int OPERATE_TYPE_6 = 6;
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
public static final Integer SC_INTERNAL_SERVER_ERROR_501 = 501;
public static final Integer SC_INTERNAL_SERVER_ERROR_502 = 502;
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
public static final Integer SC_OK_200 = 200;
public static final Integer SC_OK_201 = 201;
public static final Integer SC_OK_202 = 202;
public static final Integer SC_OK_300 = 300;
public static final Integer SC_OK_301 = 301;
/**访问权限认证未通过 510*/
public static final Integer SC_JEECG_NO_AUTHZ=510;
/** 登录用户Shiro权限缓存KEY前缀 */
public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.modules.shiro.authc.ShiroRealm.authorizationCache:";
/** 登录用户Token令牌缓存KEY前缀 */
public static final String PREFIX_USER_TOKEN = "prefix_user_token_";
/** Token缓存时间3600秒即一小时 */
public static final int TOKEN_EXPIRE_TIME = 3600;
/**
* 0一级菜单
*/
public static final Integer MENU_TYPE_0 = 0;
/**
* 1子菜单
*/
public static final Integer MENU_TYPE_1 = 1;
/**
* 2按钮权限
*/
public static final Integer MENU_TYPE_2 = 2;
/**通告对象类型USER:指定用户ALL:全体用户)*/
public static final String MSG_TYPE_UESR = "USER";
public static final String MSG_TYPE_ALL = "ALL";
/**发布状态0未发布1已发布2已撤销*/
public static final String NO_SEND = "0";
public static final String HAS_SEND = "1";
public static final String HAS_CANCLE = "2";
/**阅读状态0未读1已读*/
public static final String HAS_READ_FLAG = "1";
public static final String NO_READ_FLAG = "0";
/**优先级L低M中H高*/
public static final String PRIORITY_L = "L";
public static final String PRIORITY_M = "M";
public static final String PRIORITY_H = "H";
/**
* 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板
* 3 信息变更
*/
public static final String SMS_TPL_TYPE_0 = "0";
public static final String SMS_TPL_TYPE_1 = "1";
public static final String SMS_TPL_TYPE_2 = "2";
public static final String SMS_TPL_TYPE_3 = "3";
/**
* 状态(0无效1有效)
*/
public static final String STATUS_0 = "0";
public static final String STATUS_1 = "1";
/**
* 同步工作流引擎1同步0不同步
*/
public static final Integer ACT_SYNC_1 = 1;
public static final Integer ACT_SYNC_0 = 0;
/**
* 消息类型1:通知公告2:系统消息
*/
public static final String MSG_CATEGORY_1 = "1";
public static final String MSG_CATEGORY_2 = "2";
/**
* 是否配置菜单的数据权限 1是0否
*/
public static final Integer RULE_FLAG_0 = 0;
public static final Integer RULE_FLAG_1 = 1;
/**
* 是否用户已被冻结 1正常(解冻) 2冻结
*/
public static final String USER_UNFREEZE = "1";
public static final String USER_FREEZE = "2";
/**
* 文件上传类型本地localMiniominio阿里云alioss
*/
public static final String UPLOAD_TYPE_LOCAL = "local";
public static final String UPLOAD_TYPE_MINIO = "minio";
public static final String UPLOAD_TYPE_OSS = "alioss";
/**
* 收入明细 1:收入 2:支出)
*/
public static final Integer USER_IDENTITY_1 = 1;
public static final Integer USER_IDENTITY_2 = 2;
}

View File

@ -0,0 +1,54 @@
package com.xkrs.utils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* 复制源对象的属性值
* @Author tajochen
*/
public class CopyPropertiesUtil {
/**
* 复制源对象和目标对象的属性值
* @param source 源对象
* @param target 目标对象
* @throws SecurityException
* @throws IllegalArgumentException
*/
public static void copy(Object source, Object target) {
//得到对象的Class
Class sourceClass = source.getClass();
Class targetClass = target.getClass();
//得到Class对象的所有属性
Field[] sourceFields = sourceClass.getDeclaredFields();
Field[] targetFields = targetClass.getDeclaredFields();
for(Field sourceField : sourceFields){
//属性名
String name = sourceField.getName();
//属性类型
Class type = sourceField.getType();
String methodName = name.substring(0, 1).toUpperCase() + name.substring(1);
try{
//得到属性对应get方法
Method getMethod = sourceClass.getMethod("get" + methodName);
//执行源对象的get方法得到属性值
Object value = getMethod.invoke(source);
//目标对象的属性名
for(Field targetField : targetFields){
String targetName = targetField.getName();
if(targetName.equals(name)){
//属性对应的set方法
Method setMethod = targetClass.getMethod("set" + methodName, type);
//执行目标对象的set方法
setMethod.invoke(target, value);
}
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,231 @@
package com.xkrs.utils;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 日期时间工具
* @author tajochen
*/
public class DateTimeUtil {
private final static String COMMON_PATTERN_DATETIME = "yyyy-MM-dd HH:mm:ss";
private final static String COMMON_PATTERN_DATE = "yyyy-MM-dd";
private final static DateTimeFormatter COMMON_FORMATTER_DATETIME = DateTimeFormatter.ofPattern(COMMON_PATTERN_DATETIME);
private final static DateTimeFormatter COMMON_FORMATTER_DATE = DateTimeFormatter.ofPattern(COMMON_PATTERN_DATE);
private final static ZoneOffset DEFAULT_ZONE_OFFSET = ZoneOffset.of("+8");
/**
* 字符串转LocalDate
* @param date
* @return
*/
public static LocalDate stringToDate(String date) {
assert date != null;
return LocalDate.parse(date, COMMON_FORMATTER_DATE);
}
/**
* LocalDate转字符串
* @param date
* @return
*/
public static String dateToString(LocalDate date) {
assert date != null;
return COMMON_FORMATTER_DATE.format(date);
}
/**
* LocalDateTime转字符串
* @param dateTime
* @return
*/
public static String dateTimeToString(LocalDateTime dateTime) {
assert dateTime != null;
return COMMON_FORMATTER_DATETIME.format(dateTime);
}
/**
* 字符串转LocalDateTime
* @param dateStr
* @return
*/
public static LocalDateTime stringToDateTime(String dateStr) {
assert dateStr != null;
return LocalDateTime.parse(dateStr, COMMON_FORMATTER_DATETIME);
}
/**
* 字符串转Instant时间戳
* @param str
* @return
*/
public static Instant stringToInstant(String str) {
assert str != null;
return stringToDateTime(str).toInstant(DEFAULT_ZONE_OFFSET);
}
/**
* LocalDateTime转字符串格式化
* @param dateTime
* @param formatter
* @return
*/
public static String dateToStringFormatter(LocalDateTime dateTime, DateTimeFormatter formatter) {
assert dateTime != null;
return formatter.format(dateTime);
}
/**
* 字符串转LocalDateTime格式化
* @param dateStr
* @param formatter
* @return
*/
public static LocalDateTime stringToDateTimeFormatter(String dateStr, DateTimeFormatter formatter) {
assert dateStr != null;
return LocalDateTime.parse(dateStr, formatter);
}
/**
* 字符串转 local date
* @param dateStr
* @return
*/
public static LocalDate stringToDateFormatter(String dateStr){
LocalDate date = LocalDate.parse(dateStr, COMMON_FORMATTER_DATE);
return date;
}
/**
* 日期转时间戳
* @param dateTime
* @return
*/
public static long dateToTimeMillis(LocalDateTime dateTime) {
assert dateTime != null;
return dateTime.toInstant(DEFAULT_ZONE_OFFSET).toEpochMilli();
}
/**
* 时间戳转日期
* @param timeMillis
* @return
*/
public static LocalDateTime timeMillisToDate(long timeMillis) {
Instant instant = Instant.ofEpochMilli(timeMillis);
return LocalDateTime.ofInstant(instant, DEFAULT_ZONE_OFFSET);
}
/**
* 时间戳转时间
* @param timeMillis
* @return
*/
public static LocalDateTime timeMillisToTime(long timeMillis) {
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis, 0, ZoneOffset.ofHours(8));
return localDateTime;
}
/**
* 时间戳转时间再转字符串
* @param timeMillis
* @return
*/
public static String timeMillisToString(long timeMillis){
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis, 0, ZoneOffset.ofHours(8));
return COMMON_FORMATTER_DATETIME.format(localDateTime);
}
/**
* 获取当前时间 hh:mm:ss:nnn
* @return
*/
public static LocalDateTime getNowTime() {
LocalDateTime now = LocalDateTime.now();
return now;
}
/**
* 获取当前日期 yyyy-MM-dd
* @return
*/
public static LocalDate getToday() {
LocalDate now = LocalDate.now();
return now;
}
/**
* 获取当前 Instant 时间戳
* @return
*/
public static Instant getInstant() {
Instant timeStamp = Instant.now();
return timeStamp;
}
/**
* 获取当前时间 yyyy-MM-ss hh:mm:ss
* @return
*/
public static String getNowTimeStr(){
return COMMON_FORMATTER_DATETIME.format(getNowTime());
}
/**
* 判断日期格式是否合法 "yyyy-MM-dd"
* @param strDate
* @return
*/
public static boolean isValidDate(String strDate) {
final int minLen = 10;
if(strDate == null || strDate.length() < minLen) {
return false;
}
//正则表达式校验日期格式 yyyy-MM-dd
String eL = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-" +
"(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})" +
"(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)(([0-9]{3}[1-9]|[0-9]{2}[1-9]" +
"[0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-" +
"(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|" +
"((0[48]|[2468][048]|[3579][26])00))-02-29)";
Pattern pat = Pattern.compile(eL);
Matcher matcher = pat.matcher(strDate);
return matcher.matches();
}
/**
* 判断时间格式 格式必须为 "YYYY-MM-DD HH:mm:ss"
* @param sDateTime
* @return
*/
public static boolean isValidDateTime(String sDateTime) {
final int minLen = 19;
if ((sDateTime == null) || (sDateTime.length() < minLen)) {
return false;
}
String eL = "(((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-(0?[13578]|1[02])-" +
"(0?[1-9]|[12]\\\\d|3[01]))|((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-" +
"(0?[13456789]|1[012])-(0?[1-9]|[12]\\\\d|30))|((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-0?2-" +
"(0?[1-9]|1\\\\d|2[0-8]))|(((1[6-9]|[2-9]\\\\d)(0[48]|[2468][048]|[13579][26])|((04|08|12|16|[2468][048]|" +
"[3579][26])00))-0?2-29)) (20|21|22|23|[0-1]?\\\\d):[0-5]?\\\\d:[0-5]?\\\\d";
Pattern pat = Pattern.compile(eL);
Matcher matcher = pat.matcher(sDateTime);
return matcher.matches();
}
public static void main(String[] args) {
LocalDate now = LocalDate.now();
LocalDate localDate = now.plusDays(1);
String s = dateToString(localDate);
LocalDate localDate1 = stringToDate(s);
System.out.println(localDate1);
}
}

View File

@ -0,0 +1,66 @@
package com.xkrs.utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* SHA加密解密工具
* @author tajochen
*/
public class EncryptDecryptUtil {
/**
* SHA-256加密
* @param strText
* @return
*/
public static String encry256(final String strText){
return encrySha(strText,"SHA-256");
}
/**
* SHA-512加密
* @param strText
* @return
*/
public static String encry512(final String strText){
return encrySha(strText,"SHA-512");
}
/**
* 基础SHA加密
* @param strText
* @param strType
* @return
*/
private static String encrySha(final String strText, final String strType){
// 返回值
String strResult=null;
// 是否是有效的字符串
if (strText != null && strText.length()>0){
// 加密开始,创建加密对象,并传入加密类型
try {
MessageDigest messageDigest = MessageDigest.getInstance(strType);
// 传入加密的字符串
messageDigest.update(strText.getBytes());
// 得到bytes类型结果
byte[] byteBuffer = messageDigest.digest();
StringBuilder strHexString = new StringBuilder();
for (byte b : byteBuffer) {
String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) {
strHexString.append('0');
}
strHexString.append(hex);
}
// 得到返回的结果
strResult = strHexString.toString();
}
catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
return strResult;
}
}

View File

@ -0,0 +1,36 @@
package com.xkrs.utils;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
/**
* @author XinYi Song
*/
public class EntityManagerUtil {
/**
* 把List<Object[]>转换成List<T>
*/
public static <T> List<T> objectToBean(List<Object[]> objList, Class<T> clz) throws Exception{
if (objList==null || objList.size()==0) {
return null;
}
Class<?>[] cz = null;
Constructor<?>[] cons = clz.getConstructors();
for (Constructor<?> ct : cons) {
Class<?>[] clazz = ct.getParameterTypes();
if (objList.get(0).length == clazz.length) {
cz = clazz;
break;
}
}
List<T> list = new ArrayList<T>();
for (Object[] obj : objList) {
Constructor<T> cr = clz.getConstructor(cz);
list.add(cr.newInstance(obj));
}
return list;
}
}

View File

@ -0,0 +1,193 @@
package com.xkrs.utils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author ZHY
* @date 2020/6/17 15:56
*/
public class ExcelImportUtil {
private Workbook wb;
private Sheet sheet;
private Row row;
String xls = ".xls";
String xlsx = ".xlsx";
/**
* 读取Excel
*
* @author ZHY
*/
public ExcelImportUtil(MultipartFile file) throws Exception {
String filename = file.getOriginalFilename();
String ext = filename.substring(filename.lastIndexOf("."));
InputStream is = file.getInputStream();
if (xls.equals(ext)) {
wb = new HSSFWorkbook(is);
} else if (xlsx.equals(ext)) {
wb = new XSSFWorkbook(is);
} else {
wb = null;
}
}
/**
* 读取Excel表格表头的内容输出
*
*/
public List<Map<String, Object>> readExcelTitleOut() {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
if (wb != null) {
sheet = wb.getSheetAt(0);
row = sheet.getRow(0);
// 标题总列数
int colNum = row.getPhysicalNumberOfCells();
System.out.println("colNum:" + colNum);
Map<String, Object> map = new LinkedHashMap<String, Object>();
for (int i = 0; i < colNum; i++) {
String stringCellValue = row.getCell(i).getStringCellValue();
map.put(stringCellValue, null);
}
list.add(map);
return list;
}
return list;
}
/**
* 读取Excel表格表头
*
*/
public String[] readExcelTitle() {
String[] title = {};
if (wb != null) {
sheet = wb.getSheetAt(0);
row = sheet.getRow(0);
// 标题总列数
int colNum = row.getPhysicalNumberOfCells();
System.out.println("colNum:" + colNum);
title = new String[colNum];
for (int i = 0; i < colNum; i++) {
Cell cell = row.getCell(i);
title[i] = cell.getStringCellValue().replaceAll("\\s+", "");
}
}
return title;
}
/**
* 读取Excel表格的某一个数值
* @return
*/
public Map<String, Object> readExcelSomeTitle(){
Map<String, Object> map = new LinkedHashMap<>();
if (wb != null) {
sheet = wb.getSheetAt(0);
String title = parseExcel(sheet.getRow(2).getCell(1));
String remark = parseExcel(sheet.getRow(3).getCell(1));
map.put("date",title);
map.put("remark",remark);
}
return map;
}
/**
* 读取Excel数据内容
*
*/
public List<Map<String, String>> readExcelContent() {
List<Map<String, String>> list = new ArrayList<>();
if (wb != null) {
//获取sheet表
sheet = wb.getSheetAt(0);
// 得到总行数
int rowNum = sheet.getLastRowNum();
//获取表头的标题
String[] readExcelTitle = readExcelTitle();
// 正文内容应该从第二行开始,第一行为表头的标题
for (int i = 1; i <= rowNum; i++) {
row = sheet.getRow(i);
if (row == null) {
continue;
}
Map<String, String> map = new LinkedHashMap<>();
for (int j = 0; j < readExcelTitle.length; j++) {
//获取每一列的数据值
String str = parseExcel(row.getCell(j));
//判断对应行的列值是否为空
if (str != null || "".equals(str)) {
//表头的标题为键值,列值为值
map.put(readExcelTitle[j], str);
}
}
//判段添加的对象是否为空
if (!map.isEmpty()){
list.add(map);
}
}
}
return list;
}
/**
*
* 根据Cell类型设置数据
*
*/
int ss = 20;
int xx = 58;
private String parseExcel(Cell cell) {
String result = "";
if (cell != null) {
SimpleDateFormat sdf = null;
switch (cell.getCellType()) {
// 数字类型
case NUMERIC:
// 处理日期格式、时间格式
if (DateUtil.isCellDateFormatted(cell)) {
if (cell.getCellStyle().getDataFormat() == ss) {
sdf = new SimpleDateFormat("HH:mm");
} else {// 日期
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
String dateFormat = sdf.format(cell.getDateCellValue());
result = dateFormat;
} else if (cell.getCellStyle().getDataFormat() == xx) {
// 处理自定义日期格式m月d日(通过判断单元格的格式id解决id的值是58)
sdf = new SimpleDateFormat("yyyy-MM-dd");
double value = cell.getNumericCellValue();
Date date = DateUtil.getJavaDate(value);
result = sdf.format(date);
} else {
double value = cell.getNumericCellValue();
DecimalFormat format = new DecimalFormat("#.###########");
String strVal = format.format(value);
result = strVal;
}
break;
// String类型
case STRING:
result = cell.getRichStringCellValue().toString();
break;
default:
break;
}
}
return result;
}
}

View File

@ -0,0 +1,477 @@
package com.xkrs.utils;
import cn.hutool.core.io.resource.InputStreamResource;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.tus.java.client.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import java.util.Objects;
/**
* @author dong
* @date 2020/12/31
*/
@Component
public class FileFastDfs {
@Value("${dfs.ip}")
public String ip;
@Value("${dfs.port}")
public String port;
// @Value("${dfs.upload}")
// public String upload;
//
// @Value("${dfs.delete}")
// public String delete;
@Resource
private KafkaTemplate<String, Object> kafkaTemplate;
private static final Logger log = LoggerFactory.getLogger(FileFastDfs.class);
private static final String STATUS = "status";
private static final String UPLOAD_BIG_PATH = "http://192.168.2.166:2001/group1/big/upload";
private static final String UPLOAD_PATH = "http://192.168.2.166:2001/group1/upload";
/**
* 文件上传到dfs服务器
* @param file
* @param dir
* @return
*/
public String uploadFile(MultipartFile file, String dir) {
File file1 = null;
InputStreamResource isr = null;
try {
file1 = multipartFileToFile(file);
isr=new InputStreamResource(file.getInputStream(),
file.getOriginalFilename());
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
} catch (Exception e) {
e.printStackTrace();
}
//文件地址
//声明参数集合
HashMap<String, Object> paramMap = new HashMap<>(7);
//文件
paramMap.put("file", isr);
//输出
paramMap.put("output", "json");
//自定义路径
paramMap.put("path", dir);
//场景 文件分类
if (null == file1) {
return null;
}
String name = file1.getName();
System.err.println("file:" + file1.getName());
paramMap.put("scene", name.substring(name.lastIndexOf(".") + 1));
paramMap.put("fileName", System.currentTimeMillis() + ""
+ Objects.requireNonNull(file.getOriginalFilename())
.substring(file.getOriginalFilename().lastIndexOf(".")));
System.err.println(paramMap);
//
String result = HttpUtil.post("http://" + ip + ":" + port + "/group1/upload", paramMap);
System.err.println(result);
// 拿出状态码,判断上传状态
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(result);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
final String fail = "fail";
if (null != node) {
if (fail.equals(node.path(STATUS).asText())) {
return null;
}
}
return result;
}
/**
* @description: 文件上传到dfs服务器
* @params [fileFile 文件, dir 文件存放路径]
* @author: wd
* @time: 2020/3/31 2020/3/31
*/
public String uploadFile(File file, String dir) {
//文件地址
//声明参数集合
HashMap<String, Object> paramMap = new HashMap<>(7);
//文件
paramMap.put("file", file);
//输出
paramMap.put("output", "json");
//自定义路径
paramMap.put("path", dir);
//场景
// System.err.println(file.getName());
// paramMap.put("fileName", System.currentTimeMillis() + "" + file.getName().substring(file.getName().lastIndexOf(".")));
paramMap.put("fileName", file.getName());
System.err.println(paramMap);
//上传
String result = HttpUtil.post("http://" + ip + ":" + port + "/group1/upload", paramMap);
System.err.println(result);
// 拿出状态码,判断上传状态
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(result);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
final String status = "status";
final String statusFail = "fail";
if (null != node) {
if (statusFail.equals(node.path(status).asText())) {
return null;
}
}
return result;
}
/**
* @description: 文件上传到dfs服务器
* @params [fileFile 文件, dir 文件存放路径]
* @author: wd
* @time: 2020/3/31 2020/3/31
*/
public String uploadFile(File file, String dir, String fileType) {
//文件地址
//声明参数集合
HashMap<String, Object> paramMap = new HashMap<>(7);
//文件
paramMap.put("file", file);
//输出
paramMap.put("output", "json");
//自定义路径
paramMap.put("path", dir);
//场景
System.err.println(file.getName());
// paramMap.put("fileName", System.currentTimeMillis() + "" + file.getName().substring(file.getName().lastIndexOf(".")));
paramMap.put("fileName", file.getName());
paramMap.put("scene", fileType);
System.err.println(paramMap);
//上传
String result = HttpUtil.post("http://" + ip + ":" + port + "/group1/upload", paramMap);
System.err.println(result);
// 拿出状态码,判断上传状态
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(result);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
final String status = "status";
final String statusFail = "fail";
if (null != node) {
if (statusFail.equals(node.path(status).asText())) {
return null;
}
}
return result;
}
public String uploadBigFile(File file, String dir, String fileType) {
// 下面这个一定要注意如果不设置为true将会直接返回301
System.setProperty("http.strictPostRedirect", Boolean.toString(true));
TusClient tusClient = new TusClient();
try {
tusClient.setUploadCreationURL(new URL(UPLOAD_BIG_PATH));
// tusClient.enableResuming(new TusRedisUrlStrore());
tusClient.enableResuming(new TusURLMemoryStore());
final TusUpload upload = new TusUpload(file);
System.out.println("start upload......");
TusExecutor executor = new TusExecutor() {
@Override
protected void makeAttempt() throws ProtocolException, IOException {
TusUploader uploader = tusClient.resumeOrCreateUpload(upload);
uploader.setChunkSize(1024 * 1024);
long start = System.currentTimeMillis();
do {
long totalBytes = upload.getSize();
long bytesUploaded = uploader.getOffset();
double progress = (double) bytesUploaded / totalBytes * 100;
System.out.printf("Upload at %06.2f%%.\n", progress);
} while (uploader.uploadChunk() > -1);
uploader.finish();
String uploadUrl = uploader.getUploadURL().toString();
System.out.println("Upload finished.");
System.out.format("Upload available at: %s\n", uploadUrl);
long end = System.currentTimeMillis();
System.out.println((end - start) + "ms");
// 使用hutool进行秒传置换url
String fileId = StrUtil.subAfter(uploadUrl, UPLOAD_BIG_PATH + "/", true);
System.out.println("fileId: " + fileId);
String url = StrUtil.format("{}?md5={}&output=json", UPLOAD_PATH, fileId);
System.out.println("url: " + url);
// 上传大文件的时候1.xG需要sleep一下要不然会有问题
ThreadUtil.sleep(5000);
String result = HttpUtil.get(url);
}
};
executor.makeAttempts();
} catch (IOException | ProtocolException e) {
e.printStackTrace();
}
return null;
}
/**
* @description: 文件base64流获取
* @params [fileName 文件路径]
* @return: java.lang.String
* @author: chqf
* @time: 2020/3/31 2020/3/31
*/
public String getBase64(String fileName) {
if (fileName == null || "".equals(fileName)) {
return null;
}
InputStream fis = null;
URL url = null;
try {
url = new URL("http://" + ip + ":" + port + "/" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
System.err.println(url);
fis = url.openStream();
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}
final ByteArrayOutputStream data = new ByteArrayOutputStream();
String imgStr = "";
try {
if (fis == null) {
return null;
}
int len = -1;
byte[] buf = new byte[2048];
while (-1 != (len = fis.read(buf, 0, buf.length))) {
data.write(buf, 0, len);
}
Base64.Encoder encoder = Base64.getEncoder();
imgStr = encoder.encodeToString(data.toByteArray());
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}finally {
try {
if (null != fis) {
fis.close();
}
data.close();
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}
}
return "data:image/jpeg;base64," + imgStr;
}
/**
* @description: 文件格式转换multipartFil 转为 File 格式
* @params [file]
* @return: java.io.File
* @author: dong
* @time: 2020/3/31 2020/3/31
*/
public File multipartFileToFile(MultipartFile file) throws Exception {
File toFile = null;
if ("".equals(file) || file.getSize() <= 0) {
file = null;
} else {
InputStream ins;
ins = file.getInputStream();
toFile = new File(Objects.requireNonNull(file.getOriginalFilename()));
inputStreamToFile(ins, toFile);
ins.close();
}
return toFile;
}
private static void inputStreamToFile(InputStream ins, File file) {
OutputStream os = null;
try {
os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}finally {
try {
if (null != os) {
os.close();
}
if (null != ins) {
ins.close();
}
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}
}
}
/**
* @description: 文件base64流获取
* @params [fileName 文件路径]
* @return: java.lang.String
* @author: dong
* @time: 2020/3/31 2020/3/31
*/
public Boolean getFile(String fileName, HttpServletResponse response) {
if (fileName == null || "".equals(fileName)) {
return null;
}
InputStream fis = null;
URL url = null;
try {
url = new URL("http://" + ip + ":" + port + "/" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
System.err.println(url);
fis = url.openStream();
response.reset();
response.setContentType("bin");
response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}
//
byte[] b = new byte[256];
int len;
try {
assert fis != null;
while ((len = fis.read(b)) > 0){
response.getOutputStream().write(b, 0, len);
}
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}finally {
try {
if (null != fis) {
fis.close();
}
} catch (IOException e) {
log.info("IO错误{}", (Object) e.getStackTrace());
}
}
return true;
}
/**
* 删除文件 path
* @param filePath 文件路径 上传返回的path
* @return
*/
public Boolean deleteFileByPath(String filePath) {
if (filePath == null || "".equals(filePath)) {
return false;
}
HashMap<String, Object> paramMap = new HashMap<>(1);
// 参数
paramMap.put("path", filePath);
String result = HttpUtil.post("http://" + ip + ":" + port + "/group1/delete", paramMap);
System.out.println(result);
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(result);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
final String statusOk = "ok";
if (null == node) {
log.error("返回结果为空");
return false;
}
if (!statusOk.equals(node.path(STATUS).asText())) {
log.error("未删除成功");
return false;
}
return true;
}
/**
* 删除文件 path
* @param md5 上传返回的md5
* @return
*/
public Boolean deleteFileByMd5(String md5) {
if (md5 == null || "".equals(md5)) {
return false;
}
HashMap<String, Object> paramMap = new HashMap<>(1);
// 参数
paramMap.put("md5", md5);
String result = HttpUtil.post("http://" + ip + ":" + port + "/group1/delete", paramMap);
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(result);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
final String status = "status";
final String statusOk = "ok";
if (null == node) {
log.error("返回结果为空");
return false;
}
if (!statusOk.equals(node.path(status).asText())) {
log.error("未删除成功");
return false;
}
return true;
}
public static void main(String[] args) {
File file = new File("C:\\Users\\dong\\Desktop\\遥感影像\\遥感影像\\GF1\\GF1_PMS1_E116.8_N36.6_20190528_L1A0004026837-MSS1_ORTHO_MS.tif");
FileFastDfs fileFastDfs = new FileFastDfs();
}
}

View File

@ -0,0 +1,250 @@
package com.xkrs.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.xkrs.utils.DateTimeUtil.getNowTimeStr;
public class FileUtil {
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
/**
* 判断目录是否存在, 不存在创建
* @param path 路径,目录最后带 File.separator
* @return
*/
public static boolean isFileExit(String path){
path = path.replace("/",File.separator);
File file = new File(path);
if (file.exists()) {
log.info("文件已存在");
return true;
}
if(path.endsWith(File.separator)) {
log.info("创建单个文件" + path + "失败,目标不能是目录!");
return false;
}
if(!file.getParentFile().exists()) {
log.info("目标文件所在路径不存在,准备创建。。。");
if (file.getParentFile().mkdirs()) {
if (file.mkdir()) {
log.info("创建目录文件成功!");
}
}
} else {
log.info("目标文件所在路径存在");
if (file.mkdir()) {
log.info("创建目录文件成功!");
}
}
return true;
}
/**
* 获取目录下的所有文件
* @param filePath 目录
* @return
* @throws Exception
*/
public static List<String> showListFile(String filePath) {
File dir = new File(filePath);
List<String> list = new ArrayList<>();
// 查找参数文件是否存在,只检查第一个入参
if(!dir.exists()) {
log.error("找不到文件");
}
// 如果是目录那么进行递归调用
if(dir.isDirectory()) {
// 获取目录下的所有文件
File[] f = dir.listFiles();
// 进行递归调用,最后总会返回一个list
assert f != null;
for (File file : f) {
list.addAll(showListFile(file.getPath()));
}
}else {
// 不是目录直接添加进去,判断是否为xml文件
list.add(dir.getPath());
}
return list;
}
/**
* 移动文件到目标目录
* @param path 文件路径
* @return
*/
/*public static FileEntity mvFile(String path){
String savePath = "D:" + File.separator + "dms" + File.separator + "data" ;
File file = new File(path);
if (!file.isFile()) {
log.info("{}不是文件。",path);
return null;
}
// 从文件名获取到入库信息 暂时不知道
String[] infos = path.split("/");
String fileNameUnHandler = infos[infos.length - 1];
String[] fileNameUnHandlerSplitWithPoint = fileNameUnHandler.split(".");
String fileName = fileNameUnHandlerSplitWithPoint[0];
String scene = fileNameUnHandlerSplitWithPoint[1];
String[] fileNames = fileNameUnHandler.split("_");
long length = file.length();
String filePath = File.separator + scene + File.separator + fileName;
// savePath = savePath + File.separator + dir + File.separator + fileName;
if (isFileExit(savePath + File.separator + scene)) {
if (file.renameTo(new File(filePath))) {
log.info("移动文件{}到{}目录",file.getName(), savePath + filePath);
} else {
log.info("文件{}移动失败",file.getName());
return null;
}
}
return null;
}*/
/**
* 读取txt文件内容
* @param file
* @return
*/
public static String txt2String(File file){
StringBuilder result = new StringBuilder();
try{
//构造一个BufferedReader类来读取文件
BufferedReader br = new BufferedReader(new FileReader(file));
String s = null;
//使用readLine方法一次读一行
while((s = br.readLine())!=null){
result.append(System.lineSeparator()).append(s);
}
br.close();
}catch(Exception e){
e.printStackTrace();
}
return result.toString();
}
/**
* 确定上传文件路径遥感数据 栅格
* @param file 文件
* @return
*/
public static String fileRsSaveType(File file) {
String name = file.getName();
String suffix = name.substring(name.indexOf("."));
// 判断是否为栅格数据
if (!suffix.contains("tif")) {
return null;
}
// GF1_PMS1_E116.8_N36.6_20190528_L1A0004026837-MSS1_ORTHO_MS.tif
String[] s = name.split("_");
// 卫星种类
String satelliteType = s[0];
// 传感器种类
String sensorType = s[1];
// 中心点经度
String lat = s[2];
// 中心点纬度
String lon = s[3];
// 时间
String time = s[4];
String year = time.substring(0, 4);
String month = time.substring(4, 6);
String day = time.substring(6);
// 产品号
String product = s[5];
String productLevel = product.substring(0, 3);
String productCode = product.substring(3);
// 种类
String type = s[6];
// 文件路径
String filePath = "/" + satelliteType + "/" + sensorType + "/" + productLevel + "/" + year + "/" + month + "/"
+ day + "/" + productCode + "/";
return filePath;
}
/**
* 矢量数据路径
* C:\Users\dong\Desktop\2018年山东省矢量数据\2018年山东省矢量数据\2018年动态\分县动态\山东.gdb\sa.gdb
* @param file
* @return
*/
public static String fileShpSavePath(File file) {
if (file.exists()) {
if (file.isFile()) {
String path = file.getPath();
String[] dirNames = path.split("\\\\");
StringBuffer sb = new StringBuffer();
int length = dirNames.length;
final int minLength = 5;
if (length >= minLength) {
for (int i = 5; i > 1; i--) {
sb.append("/").append(dirNames[length - i]);
}
return sb.toString();
}
}
}
return null;
}
public static Map<String, String> getUploadInfo(String info) {
final String statusFail = "fail";
final String status = "status";
ObjectMapper mapper = new ObjectMapper();
JsonNode resultNode = null;
Map<String, String> map = new HashMap<>();
try {
resultNode = mapper.readTree(info);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
if (!statusFail.equals(resultNode.path(status).asText())) {
String path = resultNode.path("path").asText();
String fileName = path.substring(path.lastIndexOf("/") + 1);
map.put("md5", resultNode.path("md5").asText());
map.put("mtime", getNowTimeStr());
map.put("path", path);
map.put("scene", resultNode.path("scene").asText());
map.put("size", resultNode.path("size").asText());
map.put("url", resultNode.path("url").asText());
map.put("fileName", fileName);
}
return map;
}
public static boolean checkFileSize(Long len, int size, String unit) {
double fileSize = 0;
if ("B".equals(unit.toUpperCase())) {
fileSize = (double) len;
} else if ("K".equals(unit.toUpperCase())) {
fileSize = (double) len / 1024;
} else if ("M".equals(unit.toUpperCase())) {
fileSize = (double) len / 1048576;
} else if ("G".equals(unit.toUpperCase())) {
fileSize = (double) len / 1073741824;
}
if (fileSize > size) {
return false;
}
return true;
}
public static void main(String[] args) {
String s = "C:/Users/dong/Desktop/2018年山东省矢量数据/2018年山东省矢量数据/2018年动态/分县动态/山东.gdb/a0000000a.gdbindexes";
fileShpSavePath(new File(s));
}
}

View File

@ -0,0 +1,40 @@
package com.xkrs.utils;
import java.security.MessageDigest;
/**
* md5加密解密工具
* @author tajochen
*/
public class HashUtil {
/**
* MD5加密
*
* @param password
* @return
*/
public static String md5Encode(String password) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
throw new RuntimeException(e);
}
char[] charArray = password.toCharArray();
byte[] byteArray = new byte[charArray.length];
for (int i = 0; i < charArray.length; i++){
byteArray[i] = (byte) charArray[i];
}
byte[] md5Bytes = md5.digest(byteArray);
StringBuilder hexValue = new StringBuilder();
for (byte md5Byte : md5Bytes) {
int val = ((int) md5Byte) & 0xff;
if (val < 16) {
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
}

View File

@ -0,0 +1,42 @@
package com.xkrs.utils;
import javax.servlet.http.HttpServletRequest;
/**
* IP地址处理工具
* @author tajochen
*/
public class IpUtil {
public static String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
final String unkonwMsg = "unknown";
final char splitChar = ',';
if (ip != null && ip.length() != 0 && !unkonwMsg.equalsIgnoreCase(ip)) {
// 多次反向代理后会有多个ip值第一个ip才是真实ip
if( ip.indexOf(splitChar)!=-1 ){
ip = ip.split(",")[0];
}
}
if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Real-IP");
}
if (ip == null || ip.length() == 0 || unkonwMsg.equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
System.out.println("获取客户端ip: " + ip);
return ip;
}
}

View File

@ -0,0 +1,21 @@
package com.xkrs.utils;
/**
* 数字工具
* @author tajochen
*/
public class NumberUtil {
public static boolean isStrNumeric(String str) {
if(str==null||str.length()==0){
return false;
}
for (int i = 0; i < str.length(); i++) {
System.out.println(str.charAt(i));
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,152 @@
package com.xkrs.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author XinYi Song
*/
public class ObjectToBeanUtils {
public static Logger log = LoggerFactory.getLogger(ObjectToBeanUtils.class);
/**
* 把List<Object[]>转换成List<T>
*/
public static <T> List<T> objectToBean(List<Object[]> objList, Class<T> clz) throws Exception{
if (objList==null || objList.size()==0) {
return null;
}
Class<?>[] cz = null;
Constructor<?>[] cons = clz.getConstructors();
for (Constructor<?> ct : cons) {
Class<?>[] clazz = ct.getParameterTypes();
if (objList.get(0).length == clazz.length) {
cz = clazz;
break;
}
}
List<T> list = new ArrayList<T>();
for (Object[] obj : objList) {
Constructor<T> cr = clz.getConstructor(cz);
list.add(cr.newInstance(obj));
}
return list;
}
public static <T> List<T> objectToBeans(List<Object[]> objList, Class<T> clz) throws Exception{
if (objList==null || objList.size()==0) {
return null;
}
int length = objList.get(0).length;
log.info("*************>"+length);
Class<?>[] cz = null;
Constructor<?>[] cons = clz.getConstructors();
for (Constructor<?> ct : cons) {
Class<?>[] clazz = ct.getParameterTypes();
if (objList.get(0).length == clazz.length) {
cz = clazz;
break;
}
}
List<T> list = new ArrayList<T>();
log.info("---------->"+objList.get(0));
Constructor<T> cr = clz.getConstructor(cz);
T newInstance = cr.newInstance((Object) objList.get(0));
list.add(newInstance);
return list;
}
public static <T> List<T> castEntity(List<Object[]> list, Class<T> clazz, Object model) {
List<T> returnList = new ArrayList<T>();
if (list.isEmpty()) {
return returnList;
}
//获取每个数组集合的元素个数
Object[] co = list.get(0);
//获取当前实体类的属性名、属性值、属性类别
List<Map> attributeInfoList = getFiledsInfo(model);
//创建属性类别数组
Class[] c2 = new Class[attributeInfoList.size()];
//如果数组集合元素个数与实体类属性个数不一致则发生错误
if (attributeInfoList.size() != co.length) {
return returnList;
}
//确定构造方法
for (int i = 0; i < attributeInfoList.size(); i++) {
c2[i] = (Class) attributeInfoList.get(i).get("type");
}
try {
for (Object[] o : list) {
Constructor<T> constructor = clazz.getConstructor(c2);
returnList.add(constructor.newInstance(o));
}
} catch (Exception ex) {
log.info("实体数据转化为实体类发生异常:异常信息:{}", ex.getMessage());
return returnList;
}
return returnList;
}
/**
* 根据属性名获取属性值
*
* @param fieldName 属性名
* @param modle 实体类
* @return 属性值
*/
private static Object getFieldValueByName(String fieldName, Object modle) {
try {
String firstLetter = fieldName.substring(0, 1).toUpperCase();
String getter = "get" + firstLetter + fieldName.substring(1);
Method method = modle.getClass().getMethod(getter, new Class[]{});
Object value = method.invoke(modle, new Object[]{});
return value;
} catch (Exception e) {
return null;
}
}
/**
* 获取属性类型(type),属性名(name),属性值(value)的map组成的list
*
* @param model 实体类
* @return list集合
*/
private static List<Map> getFiledsInfo(Object model) {
Field[] fields = model.getClass().getDeclaredFields();
List<Map> list = new ArrayList(fields.length);
Map infoMap = null;
for (int i = 0; i < fields.length; i++) {
infoMap = new HashMap(3);
infoMap.put("type", fields[i].getType());
infoMap.put("name", fields[i].getName());
infoMap.put("value", getFieldValueByName(fields[i].getName(), model));
list.add(infoMap);
}
return list;
}
}

View File

@ -0,0 +1,37 @@
package com.xkrs.utils;
import org.geolatte.geom.Geometry;
import org.geolatte.geom.Point;
import org.geolatte.geom.codec.Wkt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 开源Gis工具集
* @author tajochen
*/
public class OpenGeoUtil {
Logger logger = LoggerFactory.getLogger(OpenGeoUtil.class);
/**
* wkt文本转为点数据
* @param wkt
* @return
*/
public static Point wktStrToPoint(String wkt) {
Point point = (Point) Wkt.fromWkt(wkt);
return point;
}
/**
* wkt文本转geometry
* @param wkt
* @return
*/
public static Geometry wktStrToGeom(String wkt) {
Geometry geom = Wkt.fromWkt(wkt);
return geom;
}
}

View File

@ -0,0 +1,190 @@
package com.xkrs.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* @author XinYi Song
*/
public class PhotoUtil {
public static Logger log = LoggerFactory.getLogger(PhotoUtil.class);
/**
* 上传单张图片
* @param imgFile
* @return
* @throws IOException
*/
public static String memoryPhoto(MultipartFile imgFile) throws IOException {
//String uploadPath = "http://139.199.98.175:2088/wfTaskImage/";
// String uploadPath = "http://192.168.2.139";
String uploadPath = "/";
//获取原始文件名
String originalFilename = imgFile.getOriginalFilename();
if (originalFilename != null && !"".equals(originalFilename)) {
//找到 . 的位置
int index = originalFilename.lastIndexOf(".");
//根据 . 的位置进行分割,拿到文件后缀名
String suffix = originalFilename.substring(index);
//uuid生成新的文件名
String newName = UUID.randomUUID().toString() + suffix;
//将图片保存到本地/usr/etc/images/Folder
File file = new File("E:/img/");
if (!file.exists()) {
file.mkdirs();
}
String path = "E:/img/" + newName;
String uploadsImage = uploadPath + newName;
//实现上传
imgFile.transferTo(new File(path));
return uploadsImage;
}
return null;
}
/**
* 以文件形式,批量上传图片
* @param files
* @return
* @throws IOException
*/
/*public static List<FireTaskPhoto> uploadImage(MultipartFile[] files, String fireCode) throws IOException {
//String uploadPath = "http://139.199.98.175:2099/forestTaskImage/";
String uploadPath = "http://118.24.27.47:2088/";
String newName = "";
String oldName = "";
List<FireTaskPhoto> fireTaskPhotos = new ArrayList<>();
for(MultipartFile file : files){
//获取file图片名称
oldName = file.getOriginalFilename();
//找到 . 的位置
int index = oldName.lastIndexOf(".");
//根据 . 的位置进行分割,拿到文件后缀名
String suffix = oldName.substring(index);
//uuid生成新的文件名
newName = UUID.randomUUID().toString() + suffix;
//将图片保存到本地/usr/etc/images/Folder
File file1 = new File("/home/sxy/server/fire_point/firePointImage/");
//File file1 = new File("E:/file/work/image/");
if (!file1.exists()) {
file1.mkdirs();
}
String path = "/home/sxy/server/fire_point/firePointImage/" + newName;
//String path = "E:/file/work/image/" + newName;
String uploadPaths = "/firePointImage/" + newName;
//实现上传
file.transferTo(new File(path));
FireTaskPhoto fireTaskPhoto = new FireTaskPhoto();
fireTaskPhoto.setPhotoFireCode(fireCode);
fireTaskPhoto.setTaskPhoto(uploadPaths);
fireTaskPhotos.add(fireTaskPhoto);
}
return fireTaskPhotos;
}*/
/**
* 删除本地或服务器储存的图片
* @param path
* @return
*/
public static String delFile(String path){
String resultInfo = null;
int lastIndexOf = path.lastIndexOf("/");
String imgPath = path.substring(lastIndexOf + 1,path.length());
System.out.println(imgPath);
imgPath = "/usr/local/etc/images/" + imgPath;
// img_path = "/usr/etc/images/Folder/" + img_path;
File file = new File(imgPath);
if(file.exists()){
if(file.delete()){
resultInfo = "删除成功!";
}else {
resultInfo = "删除失败!";
}
}else {
resultInfo = "文件不存在";
}
return resultInfo;
}
/**
* 通过图片路径解析 ,上传保存
* @param listImgSrc
* @return
*/
public static List downloadImage(List<String> listImgSrc) {
try {
List list = new ArrayList();
//开始时间
Date beginDate = new Date();
for (String url : listImgSrc) {
//开始时间
Date beginDate2 = new Date();
String imageName = url.substring(url.lastIndexOf("/") + 1, url.length());
URL uri = new URL(url);
InputStream in = uri.openStream();
//String pathUpload = "E:/img/" + imageName;
String pathUpload = "/home/web/wf-fire-service/wfimage/" + imageName;
FileOutputStream fo = new FileOutputStream(new File(pathUpload));
byte[] buf = new byte[1024];
int length = 0;
log.info("-------开始下载:" + url);
while ((length = in.read(buf, 0, buf.length)) != -1) {
fo.write(buf, 0, length);
}
in.close();
fo.close();
list.add(imageName);
log.info(imageName + "------下载完成");
//结束时间
Date overDate2 = new Date();
double time = overDate2.getTime() - beginDate2.getTime();
log.info("-----耗时:" + time / 1000 + "s");
}
Date overDate = new Date();
double time = overDate.getTime() - beginDate.getTime();
log.info("======总耗时:" + time / 1000 + "s");
return list;
} catch (Exception e) {
log.info("++++++下载失败");
}
return null;
}
/**
* 删除本地文件夹图片
* @param url
*/
public static void deleteImage(String url){
File file=new File(url);
//判断file是否是文件目录 若是返回TRUE
if (file.isDirectory()){
//name存储file文件夹中的文件名
String[] name =file.list();
for (int i=0; i<name.length; i++){
//此时就可得到文件夹中的文件
File f=new File(url, name[i]);
//删除文件
f.delete();
}
}
}
}

View File

@ -0,0 +1,54 @@
package com.xkrs.utils;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* @author XinYi Song
*/
@Component
public class Query {
/**
* 查询近一个月的火点信息(县)
* @param countyCode
* @param startTime
* @param endTime
* @return
*/
/*public List<FirePointEntity> selectFirePointByMonthCounty(String proName, String countyCode,String startTime,String endTime) {
Specification<FirePointEntity> specification = new Specification<FirePointEntity>() {
@Override
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> list = new ArrayList<>();
if(countyCode != null && !"".equals(countyCode)){
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), countyCode));
}
if(startTime != null && !"".equals(startTime)){
list.add(criteriaBuilder.greaterThanOrEqualTo(root.get("satelliteTime").as(String.class), startTime));
}
if(endTime != null && !"".equals(endTime)){
list.add(criteriaBuilder.lessThanOrEqualTo(root.get("satelliteTime").as(String.class), endTime));
}
if(proName.equals("山东省")){
list.add(criteriaBuilder.notEqual(root.get("landType").as(String.class), "耕地"));
}
Predicate[] predicates = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(predicates));
}
};
return firePointDao.findAll(specification);
}*/
}

View File

@ -0,0 +1,71 @@
package com.xkrs.utils;
import java.util.Random;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 随机字符串产生工具
* @author tajochen
*/
public class RandomUtil {
/**
* 获取随机字母数字组合
* @param length
* 字符串长度
* @return
*/
public static String getRandomCharAndNumr(Integer length) {
String str = "";
StringBuilder strBuffer = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
boolean b = random.nextBoolean();
// 字符串
if (b) {
//取得65大写字母还是97小写字母
int choice = random.nextBoolean() ? 65 : 97;
strBuffer.append((char) (choice + random.nextInt(26)));
} else {
// 数字
strBuffer.append(random.nextInt(10));
}
}
str = strBuffer.toString();
return str;
}
/**
* 验证随机字母数字组合是否纯数字与纯字母
* @param str
* @return true 是 false 否
*/
public static boolean isRandomUsable(String str) {
// String regExp =
// "^[A-Za-z]+(([0-9]+[A-Za-z0-9]+)|([A-Za-z0-9]+[0-9]+))|[0-9]+(([A-Za-z]+[A-Za-z0-9]+)|([A-Za-z0-9]+[A-Za-z]+))$";
String regExp = "^([0-9]+)|([A-Za-z]+)$";
Pattern pat = Pattern.compile(regExp);
Matcher mat = pat.matcher(str);
return mat.matches();
}
/**
* 生成UUID
* @return
*/
public static String getUuid32(){
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
return uuid;
//  return UUID.randomUUID().toString().replace("-", "").toLowerCase();
}
/**
* 随机生成六位数
* @return
*/
public static int returnCode() {
Random rand = new Random();
return rand.nextInt(899999) + 100000;
}
}

View File

@ -0,0 +1,304 @@
package com.xkrs.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xkrs.model.vo.FileServerResultVo;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
* 上传工具
* @author tajochen
**/
public class RequestUtil {
/**
* 发送管理命令到文件服务器
* @param url
* @param map
* @return
*/
public static FileServerResultVo postFileManage(String url, Map<String,String> map){
Logger log = LoggerFactory.getLogger(RequestUtil.class);
String body = "";
// 创建httpclient对象
CloseableHttpClient client = HttpClients.createDefault();
// 创建post方式请求对象
HttpPost httpPost = new HttpPost(url);
// 装填参数
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
if(map!=null){
for (Map.Entry<String, String> entry : map.entrySet()) {
nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
}
try {
// 设置参数到请求对象中
httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
// 设置header报文头信息
httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0");
httpPost.setHeader("Accept", "application");
httpPost.setHeader("Accept-Encoding", "gzip, deflate");
// 执行请求操作,并拿到结果(同步阻塞)
CloseableHttpResponse response = client.execute(httpPost);
// 获取结果实体
HttpEntity entity = response.getEntity();
if (entity != null) {
// 按指定编码转换结果实体为String类型
body = EntityUtils.toString(entity, "UTF-8");
}
EntityUtils.consume(entity);
// 释放链接
response.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
FileServerResultVo fileServerResultVo = new FileServerResultVo();
ObjectMapper mapper = new ObjectMapper();
try {
fileServerResultVo = mapper.readValue(body, FileServerResultVo.class);
} catch (JsonProcessingException e) {
e.printStackTrace();
log.warn(e.toString());
}
return fileServerResultVo;
}
/**
* 模拟 get请求
* @param url 链接
* @param map 参数列表
*/
public static void getStandard(String url, Map<String,String> map) {
// 1.拿到一个httpclient的对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 2.设置请求方式和请求信息
HttpPost httpPost = new HttpPost(url);
//2.1 提交header头信息
httpPost.addHeader("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36");
//2.1 提交请求体
ArrayList<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
// 装填参数
if(map!=null){
for (Map.Entry<String, String> entry : map.entrySet()) {
parameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
}
try {
httpPost.setEntity(new UrlEncodedFormEntity(parameters));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// 3.执行请求
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpPost);
} catch (IOException e) {
e.printStackTrace();
}
// 4.获取返回值
String html = null;
try {
assert response != null;
html = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
// 5.打印
System.out.println(html);
}
/**
* 模拟get请求加请求头
* @param url
* @param param
* @return
*/
public static String doGet(String url, Map<String, String> param) {
String result = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse response = null;
try {
URIBuilder builder = new URIBuilder(url);
if (param != null) {
for (String key : param.keySet()) {
builder.addParameter(key, param.get(key));
}
}
URI uri = builder.build();
HttpGet httpGet = new HttpGet(uri);
httpGet.addHeader("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36");
response = httpclient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200) {
result = EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/**
* 模拟Post请求 application/x-www-form-urlencoded
* @param url 资源地址
* @param map 参数列表
* @return
*/
public static String postStandard(String url, Map<String,String> map) {
String body = "";
// 创建httpclient对象
CloseableHttpClient client = HttpClients.createDefault();
// 创建post方式请求对象
HttpPost httpPost = new HttpPost(url);
// 装填参数
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
if(map!=null){
for (Map.Entry<String, String> entry : map.entrySet()) {
nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
}
try {
// 设置参数到请求对象中
httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
// 设置header报文头信息
httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0");
httpPost.setHeader("Accept", "application");
httpPost.setHeader("Accept-Encoding", "gzip, deflate");
// 执行请求操作,并拿到结果(同步阻塞)
CloseableHttpResponse response = client.execute(httpPost);
// 获取结果实体
HttpEntity entity = response.getEntity();
if (entity != null) {
// 按指定编码转换结果实体为String类型
body = EntityUtils.toString(entity, "UTF-8");
}
EntityUtils.consume(entity);
// 释放链接
response.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return body;
}
/**
* 模拟Post请求 multipart/form-data
* @param postFile
* @param postUrl
* @param postParam
* @return
*/
public static Map<String,Object> postFile(File postFile,String postUrl,Map<String,String> postParam) {
Logger log = LoggerFactory.getLogger(RequestUtil.class);
Map<String,Object> resultMap = new HashMap<String,Object>(16);
CloseableHttpClient httpClient = HttpClients.createDefault();
try{
// 把一个普通参数和文件上传给下面这个地址
HttpPost httpPost = new HttpPost(postUrl);
// 设置传输参数
MultipartEntityBuilder multipartEntity = MultipartEntityBuilder.create();
// 解决乱码问题
multipartEntity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
multipartEntity.setCharset(StandardCharsets.UTF_8);
// 设置文件参数 获取文件名postFile.getName()
// 把文件转换成流对象FileBody
multipartEntity.addBinaryBody("file",postFile, ContentType.create("multipart/form-data", Consts.UTF_8),postFile.getName());
// 设计文件以外的参数
Set<String> keySet = postParam.keySet();
for (String key : keySet) {
// 相当于<input type="text" name="name" value=name>
multipartEntity.addPart(key, new StringBody(postParam.get(key), ContentType.create("multipart/form-data", Consts.UTF_8)));
}
HttpEntity reqEntity = multipartEntity.build();
httpPost.setEntity(reqEntity);
// 设置header报文头信息
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0");
httpPost.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
httpPost.setHeader("Accept-Encoding","gzip, deflate");
// 发起请求,返回请求的响应
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
resultMap.put("statusCode", response.getStatusLine().getStatusCode());
// 获取响应对象
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
// 打印响应内容
resultMap.put("data", EntityUtils.toString(resEntity, StandardCharsets.UTF_8));
resultMap.put("message", EntityUtils.toString(resEntity, StandardCharsets.UTF_8));
resultMap.put("status", EntityUtils.toString(resEntity, StandardCharsets.UTF_8));
}
// 销毁
EntityUtils.consume(resEntity);
} catch (Exception e) {
e.printStackTrace();
} finally {
response.close();
}
} catch (IOException e1) {
e1.printStackTrace();
} finally{
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
log.info("上传结果:" + resultMap);
return resultMap;
}
}

View File

@ -0,0 +1,124 @@
package com.xkrs.utils;
/**
* 基于Twitter开源的分布式ID生成算法snowflake
* @author tajochen
**/
public class SnowFlakeUtil {
/**
* 起始时间戳
* 2018-01-01 00:00:00
*/
private final static long START_STMP = 1514736000L;
/**
* 序列在id中占用的位数
*/
private final static long SEQUENCE_BIT = 12L;
/**
* 机器标识占用的位数
*/
private final static long MACHINE_BIT = 5L;
/**
* 数据中心占用的位数
*/
private final static long DATACENTER_BIT = 5L;
/**
* 每一部分的最大值
*/
private final static long MAX_DATACENTER_NUM = -1L ^ (-1L << DATACENTER_BIT);
private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
/**
* 每一部分向左的位移
*/
private final static long MACHINE_LEFT = SEQUENCE_BIT;
private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
/**
* 数据中心
*/
private long datacenterId;
/**
* 机器标识
*/
private long machineId;
/**
* 序列号
*/
private long sequence = 0L;
/**
* 上一次时间戳
*/
private long lastStmp = -1L;
public SnowFlakeUtil(long datacenterId, long machineId) {
if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) {
throw new IllegalArgumentException("data center id can't be greater than MAX_DATACENTER_NUM or less than 0");
}
if (machineId > MAX_MACHINE_NUM || machineId < 0) {
throw new IllegalArgumentException("machine id can't be greater than MAX_MACHINE_NUM or less than 0");
}
this.datacenterId = datacenterId;
this.machineId = machineId;
}
/**
* 产生下一个ID
* @return
*/
public synchronized long nextId() {
long currStmp = getNewstmp();
if (currStmp < lastStmp) {
throw new RuntimeException("Clock moved backwards. Refusing to generate id");
}
if (currStmp == lastStmp) {
//相同毫秒内,序列号自增
sequence = (sequence + 1) & MAX_SEQUENCE;
//同一毫秒的序列数已经达到最大
if (sequence == 0L) {
currStmp = getNextMill();
}
} else {
//不同毫秒内序列号置为0
sequence = 0L;
}
lastStmp = currStmp;
//时间戳部分
return (currStmp - START_STMP) << TIMESTMP_LEFT
//数据中心部分
| datacenterId << DATACENTER_LEFT
//机器标识部分
| machineId << MACHINE_LEFT
//序列号部分
| sequence;
}
private long getNextMill() {
long mill = getNewstmp();
while (mill <= lastStmp) {
mill = getNewstmp();
}
return mill;
}
private long getNewstmp() {
return System.currentTimeMillis();
}
public static void main(String[] args) {
SnowFlakeUtil snowFlake = new SnowFlakeUtil(5, 5);
//测试次数
int testTimes = 10000;
long start = System.currentTimeMillis();
for (int i = 0; i < testTimes; i++) {
System.out.println(snowFlake.nextId());
}
System.out.println(System.currentTimeMillis() - start);
}
}

View File

@ -0,0 +1,592 @@
package com.xkrs.utils;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: XinYi Song
* @Date: 2021/12/13 15:37
*/
public class VerifyBankCardUtil {
/**
* 校验银行卡卡号
*
* @param cardId
* 银行卡号
* @return 银行卡号符合校验规则false 银行卡号不符合校验规则
*/
public static boolean checkBankCard(String cardId) {
if (cardId == null || cardId.length() < 16 || cardId.length() > 19) {
return false;
}
char bit = getBankCardCheckCode(cardId
.substring(0, cardId.length() - 1));
if (bit == 'N') {
return false;
}
return cardId.charAt(cardId.length() - 1) == bit;
}
/**
* 从不含校验位的银行卡卡号采用 Luhm 校验算法获得校验位
*
* @param nonCheckCodeCardId
* 不包含最后一位的银行卡号
* @return 银行卡号校验位
*/
private static char getBankCardCheckCode(String nonCheckCodeCardId) {
if (nonCheckCodeCardId == null
|| nonCheckCodeCardId.trim().length() == 0
|| !nonCheckCodeCardId.matches("\\d+")) {
// 如果传的不是数据返回N
return 'N';
}
char[] chs = nonCheckCodeCardId.trim().toCharArray();
int luhnSum = 0;
for (int i = chs.length - 1, j = 0; i >= 0; i--, j++) {
int k = chs[i] - '0';
if (j % 2 == 0) {
k *= 2;
k = k / 10 + k % 10;
}
luhnSum += k;
}
return (luhnSum % 10 == 0) ? '0' : (char) ((10 - luhnSum % 10) + '0');
}
/**
* 传入卡号 得到银行名称
*
* @param cardId
* @return
*/
public static String getNameOfBank(String cardId) {
int bin = 0, index = 0;
if (cardId == null || cardId.length() < 16 || cardId.length() > 19) {
return "银行卡号错误";
}
// 6位Bin号
String cardBin = cardId.substring(0, 6);
if (!isNumeric(cardBin)) {
return "银行卡号前六位不是数字";
}
bin = Integer.valueOf(cardBin);
index = binarySearch(bankBin, bin);
if (index == -1 || index > bankName.length) {
return "findNotName";
}
return bankName[index];
}
// 查找方法
private static int binarySearch(int[] srcArray, int des) {
int low = 0;
int high = srcArray.length;
while (low < high) {
if (des == srcArray[low]) {
return low;
}
low++;
}
return -1;
}
// 检验数字
public static boolean isNumeric(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
/**
* BIN号
* 银行卡是由”发卡行标识代码 + 自定义 + 校验码 “等部分组成的
* 银联标准卡与以往发行的银行卡最直接的区别就是其卡号前6位数字的不同。
* 银行卡卡号的前6位是用来表示发卡银行或机构的称为“发卡行识别码”(Bank Identification Number缩写为“BIN”)。
* 银联标准卡是由国内各家商业银行(含邮储、信用社)共同发行、符合银联业务规范和技术标准、卡正面右下角带有“银联”标识(目前,新发行的银联标准卡一定带有国际化的银联新标识,新发的非银联标准卡使用旧的联网通用银联标识)、
* 卡号前6位为622126至622925之一的银行卡是中国银行卡产业共有的民族品牌。
*/
private final static int[] bankBin = { 102033, 103000, 185720, 303781,
356827, 356828, 356833, 356835, 356837, 356838, 356839, 356840,
356885, 356886, 356887, 356888, 356889, 356890, 370246, 370247,
370248, 370249, 400360, 400937, 400938, 400939, 400940, 400941,
400942, 402658, 402673, 402791, 403361, 403391, 404117, 404157,
404171, 404172, 404173, 404174, 404738, 404739, 405512, 405512,
406252, 406254, 406365, 407405, 409665, 409666, 409667, 409668,
409669, 409670, 409671, 409672, 410062, 412962, 412963, 415599,
421317, 421349, 421393, 421437, 421865, 421869, 421870, 421871,
422160, 422161, 424106, 424107, 424108, 424109, 424110, 424111,
424902, 425862, 427010, 427018, 427019, 427020, 427028, 427029,
427038, 427039, 427062, 427064, 427571, 428911, 431502, 431502,
433666, 433670, 433680, 434061, 434062, 435744, 435745, 436718,
436728, 436738, 436742, 436745, 436748, 436768, 438088, 438125,
438126, 438588, 438589, 438600, 439188, 439225, 439227, 442729,
442730, 451289, 451291, 451804, 451804, 451810, 451810, 453242,
456351, 456418, 458060, 458060, 458071, 458071, 458123, 458124,
468203, 472067, 472068, 479228, 479229, 481699, 486466, 486493,
486494, 486497, 487013, 489592, 489734, 489735, 489736, 491020,
491020, 491031, 491032, 491040, 493427, 493878, 498451, 504923,
510529, 512315, 512316, 512411, 512412, 512425, 512431, 512466,
512695, 512732, 514906, 514957, 514958, 517636, 518212, 518364,
518378, 518379, 518474, 518475, 518476, 518710, 518718, 519412,
519498, 520082, 520108, 520131, 520152, 520169, 520194, 520382,
521899, 522153, 523036, 524011, 524047, 524070, 524091, 524094,
524864, 524865, 525498, 525745, 525746, 526410, 526855, 527414,
528020, 528931, 528948, 530970, 530980, 530980, 530990, 532420,
532430, 532450, 532458, 535910, 535910, 535918, 537830, 540297,
540838, 541068, 541709, 543159, 544033, 545619, 545623, 545947,
547628, 547648, 547766, 547766, 548259, 548844, 552245, 552288,
552534, 552587, 552599, 552742, 552794, 552801, 552853, 553131,
553242, 556610, 556617, 558360, 558730, 558808, 558809, 558868,
558868, 558894, 558895, 558916, 566666, 584016, 601100, 601101,
601121, 601122, 601123, 601124, 601125, 601126, 601127, 601128,
601131, 601136, 601137, 601138, 601140, 601142, 601143, 601144,
601145, 601146, 601147, 601148, 601149, 601174, 601177, 601178,
601179, 601186, 601187, 601188, 601189, 601382, 601382, 601428,
601428, 601428, 601428, 602907, 602907, 602969, 602969, 603128,
603128, 603367, 603367, 603445, 603445, 603506, 603506, 603601,
603601, 603601, 603601, 603601, 603601, 603602, 603602, 603694,
603694, 603708, 603708, 621021, 621201, 621977, 621977, 622126,
622126, 622127, 622127, 622127, 622127, 622128, 622128, 622129,
622129, 622131, 622131, 622132, 622132, 622133, 622133, 622134,
622134, 622135, 622135, 622136, 622136, 622137, 622137, 622138,
622138, 622139, 622139, 622140, 622140, 622141, 622141, 622143,
622143, 622146, 622146, 622147, 622147, 622148, 622148, 622149,
622149, 622150, 622150, 622151, 622151, 622152, 622152, 622153,
622153, 622154, 622154, 622155, 622155, 622156, 622156, 622165,
622165, 622166, 622166, 622168, 622168, 622169, 622169, 622178,
622178, 622179, 622179, 622184, 622184, 622188, 622188, 622199,
622199, 622200, 622200, 622202, 622202, 622203, 622203, 622208,
622208, 622210, 622210, 622211, 622211, 622212, 622212, 622213,
622213, 622214, 622214, 622215, 622215, 622220, 622220, 622225,
622225, 622230, 622230, 622235, 622235, 622240, 622240, 622245,
622245, 622250, 622250, 622251, 622251, 622252, 622252, 622253,
622253, 622254, 622254, 622258, 622258, 622259, 622259, 622260,
622260, 622261, 622261, 622280, 622280, 622291, 622291, 622292,
622292, 622301, 622301, 622302, 622302, 622303, 622303, 622305,
622305, 622307, 622307, 622308, 622308, 622310, 622310, 622311,
622311, 622312, 622312, 622316, 622316, 622318, 622318, 622319,
622319, 622321, 622321, 622322, 622322, 622323, 622323, 622324,
622324, 622325, 622325, 622327, 622327, 622328, 622328, 622329,
622329, 622331, 622331, 622332, 622332, 622333, 622333, 622335,
622335, 622336, 622336, 622337, 622337, 622338, 622338, 622339,
622339, 622340, 622340, 622341, 622341, 622342, 622342, 622343,
622343, 622345, 622345, 622346, 622346, 622347, 622347, 622348,
622348, 622349, 622349, 622350, 622350, 622351, 622351, 622352,
622352, 622353, 622353, 622355, 622355, 622358, 622358, 622359,
622359, 622360, 622360, 622361, 622361, 622362, 622362, 622363,
622363, 622365, 622365, 622366, 622366, 622367, 622367, 622368,
622368, 622369, 622369, 622370, 622370, 622371, 622371, 622373,
622373, 622375, 622375, 622376, 622376, 622377, 622377, 622378,
622378, 622379, 622379, 622382, 622382, 622383, 622383, 622384,
622384, 622385, 622385, 622386, 622386, 622387, 622387, 622388,
622388, 622389, 622389, 622391, 622391, 622392, 622392, 622393,
622393, 622394, 622394, 622395, 622395, 622396, 622396, 622397,
622397, 622398, 622399, 622399, 622400, 622400, 622406, 622406,
622407, 622407, 622411, 622411, 622412, 622412, 622413, 622413,
622415, 622415, 622418, 622418, 622420, 622420, 622421, 622421,
622422, 622422, 622423, 622423, 622425, 622425, 622426, 622426,
622427, 622427, 622428, 622428, 622429, 622429, 622432, 622432,
622434, 622434, 622435, 622435, 622436, 622436, 622439, 622439,
622440, 622440, 622441, 622441, 622442, 622442, 622443, 622443,
622447, 622447, 622448, 622448, 622449, 622449, 622450, 622450,
622451, 622451, 622452, 622452, 622453, 622453, 622456, 622456,
622459, 622459, 622462, 622462, 622463, 622463, 622466, 622466,
622467, 622467, 622468, 622468, 622470, 622470, 622471, 622471,
622472, 622472, 622476, 622476, 622477, 622477, 622478, 622478,
622481, 622481, 622485, 622485, 622486, 622486, 622487, 622487,
622487, 622487, 622488, 622488, 622489, 622489, 622490, 622490,
622490, 622490, 622491, 622491, 622491, 622491, 622492, 622492,
622492, 622492, 622493, 622493, 622495, 622495, 622496, 622496,
622498, 622498, 622499, 622499, 622500, 622500, 622506, 622506,
622509, 622509, 622510, 622510, 622516, 622516, 622517, 622517,
622518, 622518, 622519, 622519, 622521, 622521, 622522, 622522,
622523, 622523, 622525, 622525, 622526, 622526, 622538, 622538,
622546, 622546, 622547, 622547, 622548, 622548, 622549, 622549,
622550, 622550, 622561, 622561, 622562, 622562, 622563, 622563,
622575, 622575, 622576, 622576, 622577, 622577, 622578, 622578,
622579, 622579, 622580, 622580, 622581, 622581, 622582, 622582,
622588, 622588, 622598, 622598, 622600, 622600, 622601, 622601,
622602, 622602, 622603, 622603, 622615, 622615, 622617, 622617,
622619, 622619, 622622, 622622, 622630, 622630, 622631, 622631,
622632, 622632, 622633, 622633, 622650, 622650, 622655, 622655,
622658, 622658, 622660, 622660, 622678, 622678, 622679, 622679,
622680, 622680, 622681, 622681, 622682, 622682, 622684, 622684,
622688, 622688, 622689, 622689, 622690, 622690, 622691, 622691,
622692, 622692, 622696, 622696, 622698, 622698, 622700, 622700,
622725, 622725, 622728, 622728, 622750, 622750, 622751, 622751,
622752, 622752, 622753, 622753, 622754, 622755, 622755, 622756,
622756, 622757, 622757, 622758, 622758, 622759, 622759, 622760,
622760, 622761, 622761, 622762, 622762, 622763, 622763, 622770,
622770, 622777, 622777, 622821, 622821, 622822, 622822, 622823,
622823, 622824, 622824, 622825, 622825, 622826, 622826, 622827,
622836, 622836, 622837, 622837, 622840, 622840, 622841, 622842,
622843, 622844, 622844, 622845, 622845, 622846, 622846, 622847,
622847, 622848, 622848, 622849, 622855, 622855, 622856, 622856,
622857, 622857, 622858, 622858, 622859, 622859, 622860, 622860,
622861, 622861, 622864, 622864, 622865, 622865, 622866, 622866,
622867, 622867, 622869, 622869, 622870, 622870, 622871, 622871,
622877, 622877, 622878, 622878, 622879, 622879, 622880, 622880,
622881, 622881, 622882, 622882, 622884, 622884, 622885, 622885,
622886, 622886, 622891, 622891, 622892, 622892, 622893, 622893,
622895, 622895, 622897, 622897, 622898, 622898, 622900, 622900,
622901, 622901, 622908, 622908, 622909, 622909, 622940, 622982,
628218, 628288, 628366, 628368, 650600, 650600, 650700, 650700,
650800, 650800, 650900, 650900, 682900, 682900, 683970, 683970,
685800, 685800, 685800, 685800, 685800, 685800, 690755, 690755,
690755, 690755, 694301, 694301, 695800, 695800, 843010, 843010,
843360, 843360, 843420, 843420, 843610, 843610, 843730, 843730,
843800, 843800, 843850, 843850, 843900, 843900, 870000, 870000,
870100, 870100, 870300, 870300, 870400, 870400, 870500, 870500,
888000, 888000, 940056, 955880, 955881, 955882, 955888, 984301,
998800 };
/**
* 发卡行.卡种名称
*/
private static final String[] bankName = { "广东发展银行.广发理财通", "农业银行.金穗借记卡",
"昆明农联社.金碧卡", "中国光大银行.阳光爱心卡", "上海银行.双币种申卡贷记卡个人金卡",
"上海银行.双币种申卡贷记卡个人普卡", "中国银行.中银JCB卡金卡", "中国银行.中银JCB卡普卡",
"中国光大银行.阳光商旅信用卡", "中国光大银行.阳光商旅信用卡", "中国光大银行.阳光商旅信用卡",
"中国光大银行.阳光商旅信用卡", "招商银行.招商银行银行信用卡", "招商银行.招商银行银行信用卡",
"招商银行.招商银行银行信用卡", "招商银行.招商银行银行信用卡", "招商银行.招商银行银行信用卡",
"招商银行.招商银行银行信用卡", "工商银行.牡丹运通卡金卡", "工商银行.牡丹运通卡普通卡",
"中国工商银行.牡丹运通卡金卡", "中国工商银行.牡丹运通卡金卡", "中信实业银行.中信贷记卡",
"中国银行.长城国际卡(美元卡)-商务普卡", "中国银行.长城国际卡(美元卡)-商务金卡",
"中国银行.长城国际卡(港币卡)-商务普卡", "中国银行.长城国际卡(港币卡)-商务金卡",
"中国银行.长城国际卡(美元卡)-个人普卡", "中国银行.长城国际卡(美元卡)-个人金卡", "招商银行.两地一卡通",
"上海银行.申卡贷记卡", "工商银行.国际借记卡", "农业银行.金穗贷记卡", "中信实业银行.中信贷记卡",
"农业银行.金穗贷记卡", "中信实业银行.中信贷记卡", "中信实业银行.中信贷记卡", "中信实业银行.中信贷记卡",
"中信实业银行.中信贷记卡", "中信实业银行.中信贷记卡", "上海浦东发展银行.上海浦东发展银行信用卡VISA普通卡",
"上海浦东发展银行.上海浦东发展银行信用卡VISA金卡", "交通银行.太平洋互连卡", "交通银行.太平洋互连卡",
"中国光大银行.阳光信用卡", "中国光大银行.阳光信用卡", "广东发展银行.广发VISA信用卡", "民生银行.民生贷记卡",
"中国银行.中银威士信用卡员工普卡", "中国银行.中银威士信用卡个人普卡", "中国银行.中银威士信用卡员工金卡",
"中国银行.中银威士信用卡个人金卡", "中国银行.中银威士信用卡员工白金卡", "中国银行.中银威士信用卡个人白金卡",
"中国银行.中银威士信用卡商务白金卡", "中国银行.长城公务卡", "招商银行银行.招商银行银行国际卡",
"深圳发展银行.发展借记卡", "深圳发展银行.发展借记卡", "民生银行.民生借记卡", "北京银行.京卡双币种国际借记卡",
"建设银行.乐当家银卡VISA", "民生银行.民生国际卡", "中信实业银行.中信国际借记卡", "民生银行.民生国际卡",
"民生银行.民生贷记卡", "民生银行.民生贷记卡", "民生银行.民生贷记卡", "北京银行.京卡贵宾金卡",
"北京银行.京卡贵宾白金卡", "中国银行.长城人民币信用卡-个人金卡", "中国银行.长城人民币信用卡-员工金卡",
"中国银行.长城人民币信用卡-个人普卡", "中国银行.长城人民币信用卡-员工普卡", "中国银行.长城人民币信用卡-单位普卡",
"中国银行.长城人民币信用卡-单位金卡", "中国银行.长城国际卡(美元卡)-白金卡", "中国光大银行.阳光商旅信用卡",
"工商银行.牡丹VISA信用卡", "工商银行.牡丹VISA信用卡", "工商银行.牡丹VISA信用卡",
"工商银行.牡丹VISA信用卡", "工商银行.国际借记卡", "工商银行.牡丹VISA信用卡", "工商银行.国际借记卡",
"工商银行.牡丹VISA信用卡", "工商银行.牡丹VISA信用卡", "工商银行.牡丹VISA信用卡",
"中国民生银行.民生国际借记卡", "广东发展银行.广发信用卡", "华夏.华夏卡", "华夏.华夏卡",
"中信实业银行.中信贷记卡", "中信实业银行.中信借记卡", "中信实业银行.中信借记卡", "建设银行.乐当家金卡VISA",
"建设银行.乐当家白金卡VISA", "深圳发展银行.沃尔玛百分卡", "深圳发展银行.沃尔玛百分卡",
"建设银行.龙卡贷记卡公司卡金卡VISA", "建设银行.龙卡普通卡VISA", "建设银行.龙卡贷记卡公司卡普通卡VISA",
"建设银行.龙卡储蓄卡", "建设银行.龙卡国际普通卡VISA", "建设银行.龙卡国际金卡VISA",
"广东发展银行.广发信用卡", "中国银行.中银奥运信用卡个人卡", "工商银行.牡丹VISA信用卡",
"中国工商银行.牡丹VISA白金卡", "兴业银行.兴业智能卡", "兴业银行.兴业智能卡", "上海银行.上海申卡IC",
"招商银行.招商银行银行信用卡", "招商银行.VISA信用卡", "招商银行.VISA商务信用卡",
"中信实业银行.中信国际借记卡", "中信实业银行.中信国际借记卡", "兴业银行.VISA信用卡",
"中国银行.长城国际卡(欧元卡)-个人金卡", "工商银行.牡丹贷记卡", "工商银行.牡丹贷记卡", "工商银行.牡丹贷记卡",
"工商银行.牡丹贷记卡", "建设银行.VISA准贷记卡", "中国银行.长城电子借记卡",
"上海浦东发展银行.浦发银行VISA年青卡", "工商银行.牡丹信用卡", "工商银行.牡丹信用卡", "工商银行.牡丹贷记卡",
"工商银行.牡丹贷记卡", "交通银行.太平洋双币贷记卡VISA", "交通银行.太平洋双币贷记卡VISA",
"招商银行.招商银行银行国际卡", "民生银行.民生国际卡", "民生银行.民生国际卡", "招商银行.招商银行银行信用卡",
"招商银行.招商银行银行信用卡", "中国光大银行.阳光白金信用卡", "上海银行.申卡贷记卡", "兴业银行.VISA商务普卡",
"兴业银行.VISA商务金卡", "中国光大银行.阳光商旅信用卡", "广东发展银行.广发VISA信用卡",
"中国建设银行.VISA白金/钻石信用卡", "中国工商银行.牡丹欧元卡", "中国工商银行.牡丹欧元卡",
"中国工商银行.牡丹欧元卡", "农业银行.金穗信用卡", "农业银行.金穗信用卡", "建设银行.VISA准贷记金卡",
"广东发展银行.广发信用卡", "交通银行.太平洋信用卡", "广东发展银行.广发信用卡",
"中国银行.长城国际卡(港币卡)-个人金卡", "上海浦东发展银行.上海浦东发展银行信用卡VISA白金卡",
"常州商业银行.月季卡", "工商银行.牡丹万事达国际借记卡", "中国银行.中银万事达信用卡员工普卡",
"中国银行.中银万事达信用卡个人普卡", "中国银行.中银万事达信用卡员工金卡", "中国银行.中银万事达信用卡个人金卡",
"招商银行.招商银行银行国际卡", "宁波市商业银行.汇通国际卡", "民生银行.民生贷记卡",
"中国银行.长城国际卡(英镑卡)-个人普卡", "中国银行.长城国际卡(英镑卡)-个人金卡", "中信实业银行.中信贷记卡",
"中国银行.中银万事达信用卡员工白金卡", "中国银行.中银万事达信用卡个人白金卡", "民生银行.民生贷记卡",
"中信实业银行.中信贷记卡", "广东发展银行.广发信用卡", "中国银行.长城人民币信用卡-个人金卡",
"中国银行.长城人民币信用卡-员工金卡", "中国银行.长城人民币信用卡-专用卡普卡", "中国银行.长城人民币信用卡-员工普卡",
"中国银行.长城人民币信用卡-个人普卡", "招商银行.MASTER信用卡", "招商银行.MASTER信用金卡",
"农业银行.金穗贷记卡", "上海银行.双币种申卡贷记卡普通卡", "农业银行.金穗贷记卡", "中信实业银行.中信贷记卡",
"上海银行.双币种申卡贷记卡金卡", "广东发展银行.广发万事达信用卡", "交通银行.太平洋双币贷记卡MasterCard",
"宁波市商业银行.汇通国际卡", "广东发展银行.广发万事达信用卡", "交通银行.太平洋双币贷记卡MasterCard",
"中国银行.长城国际卡(欧元卡)-个人普卡", "兴业银行.万事达信用卡", "招商银行.招商银行银行国际卡",
"工商银行.牡丹万事达白金卡", "兴业银行.万事达信用卡", "中国工商银行.牡丹海航信用卡个人金卡",
"建设银行.乐当家金卡MASTER", "中国银行.长城信用卡", "中国银行.长城信用卡",
"中国工商银行.牡丹海航信用卡个人普卡", "中国银行.长城信用卡", "中国银行.长城信用卡",
"建设银行.乐当家银卡MASTER", "深圳市商业银行.深圳市商业银行信用卡", "兴业银行.加菲猫信用卡",
"深圳市商业银行.深圳市商业银行信用卡", "广东发展银行.广发万事达信用卡", "民生银行.民生贷记卡",
"工商银行.牡丹万事达信用卡", "工商银行.牡丹信用卡", "工商银行.牡丹信用卡", "工商银行.牡丹万事达信用卡",
"建设银行.MASTER准贷记卡", "建设银行.龙卡普通卡MASTER", "建设银行.龙卡国际普通卡MASTER",
"建设银行.龙卡国际金卡MASTER", "农业银行.金穗信用卡", "农业银行.金穗信用卡", "农业银行.金穗信用卡",
"交通银行.太平洋信用卡", "中国银行.长城国际卡(港币卡)-个人普卡", "中国银行.长城国际卡(美元卡)-个人普卡",
"中国银行.长城国际卡(美元卡)-个人金卡", "广东发展银行.广发信用卡", "中国光大银行.第十八届世界足球锦标赛纪念卡",
"建设银行.MASTER准贷记金卡", "招商银行.万事达信用卡", "招商银行.万事达信用卡", "招商银行.万事达信用卡",
"中国银行.长城国际卡(美元卡)-商务普卡", "中国银行.长城国际卡(港币卡)-商务普卡",
"中国银行.长城人民币信用卡-单位普卡", "中国银行.长城万事达信用卡单位普卡", "工商银行.国际借记卡",
"广东发展银行.广发信用卡", "建设银行.乐当家白金卡MASTER", "民生银行.民生贷记卡",
"招商银行.招商银行银行信用卡", "招商银行.招商银行银行信用卡", "农业银行.金穗贷记卡", "中国银行.长城公务卡",
"广东发展银行.广发万事达信用卡", "建设银行.龙卡贷记卡公司卡普通卡MASTER",
"交通银行.太平洋双币贷记卡MasterCard", "中国银行.长城公务卡", "建设银行.龙卡信用卡",
"民生银行.民生贷记卡", "中信实业银行.中信MASTERCARD人民币+美金双币贷记卡", "工商银行.牡丹万事达信用卡",
"农业银行.金穗贷记卡", "中国银行.长城国际卡(港币卡)-商务金卡", "中国银行.长城国际卡(美元卡)-商务金卡",
"中国银行.长城人民币信用卡-单位金卡", "中国银行.中银万事达信用卡单位金卡", "广东发展银行.广发万事达信用卡",
"建设银行.龙卡贷记卡公司卡金卡MASTER", "中信实业银行.中信MASTERCARD人民币+美金双币贷记卡",
"沈阳市商业银行.玫瑰卡", "深圳农联社.信通卡", "D.F.S.I(备注1).发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡", "D.F.S.I.发现卡",
"D.F.S.I.发现卡", "中国银行.长城电子借记卡", "中国银行.长城电子借记卡", "交通银行.太平洋万事顺卡",
"交通银行.太平洋万事顺卡", "交通银行.太平洋万事顺卡", "交通银行.太平洋万事顺卡", "深圳商业银行.万事顺卡",
"深圳商业银行.万事顺卡", "北京银行.京卡", "北京银行.京卡", "南京市商业银行.梅花卡", "南京市商业银行.梅花卡",
"杭州商业银行.西湖卡", "杭州商业银行.西湖卡", "广州市商业银行.羊城借记卡", "广州市商业银行.羊城借记卡",
"苏州市商业银行.姑苏卡", "苏州市商业银行.姑苏卡", "徽商银行合肥分行.黄山卡", "徽商银行合肥分行.黄山卡",
"徽商银行合肥分行.黄山卡", "徽商银行合肥分行.黄山卡", "徽商银行合肥分行.黄山卡", "徽商银行合肥分行.黄山卡",
"绍兴商业银行.兰花卡", "绍兴商业银行.兰花卡", "常熟农村商业银行.粒金卡", "常熟农村商业银行.粒金卡",
"大连商业银行.北方明珠卡", "大连商业银行.北方明珠卡", "河北省农村信用社.信通卡", "韩亚银行.",
"温州商业银行.金鹿卡", "温州商业银行.金鹿卡", "阜新市商业银行.金通卡", "阜新市商业银行.金通卡",
"福建省农村信用社联合社.万通", "厦门市农村信用合作社.万通卡", "福建省农村信用社联合社.万通",
"厦门市农村信用合作社.万通卡", "深圳农信社.信通卡", "深圳农信社.信通卡", "深圳市农村信用合作社联合社.信通商务卡",
"深圳市农村信用合作社联合社.信通商务卡", "淮安市商业银行.九州借记卡", "淮安市商业银行.九州借记卡",
"嘉兴市商业银行.南湖借记卡", "嘉兴市商业银行.南湖借记卡", "贵阳市商业银行.甲秀银联借记卡",
"贵阳市商业银行.甲秀银联借记卡", "重庆市商业银行.长江卡", "重庆市商业银行.长江卡", "成都商业银行.锦程卡",
"成都商业银行.锦程卡", "西安市商业银行.福瑞卡", "西安市商业银行.福瑞卡", "徽商银行芜湖分行.黄山卡",
"徽商银行芜湖分行.黄山卡", "北京农联社.信通卡", "北京农联社.信通卡", "兰州市商业银行.敦煌国际卡",
"兰州市商业银行.敦煌国际卡", "廊坊市商业银行.银星卡", "廊坊市商业银行.银星卡", "泰隆城市信用社.泰隆卡",
"泰隆城市信用社.泰隆卡", "乌鲁木齐市商业银行.雪莲借记卡", "乌鲁木齐市商业银行.雪莲借记卡", "青岛商行.金桥卡",
"青岛商行.金桥卡", "呼市商业银行.百灵卡", "呼市商业银行.百灵卡", "上海银行.人民币申卡贷记卡金卡",
"上海银行.人民币申卡贷记卡金卡", "上海银行.人民币申卡贷记卡普通卡", "上海银行.人民币申卡贷记卡普通卡",
"国家邮政局.绿卡银联标准卡", "国家邮政局.绿卡银联标准卡", "国家邮政局.绿卡银联标准卡", "国家邮政局.绿卡银联标准卡",
"成都市商业银行.锦程卡金卡", "成都市商业银行.锦程卡金卡", "成都市商业银行.锦程卡定活一卡通金卡",
"成都市商业银行.锦程卡定活一卡通金卡", "成都市商业银行.锦程卡定活一卡通", "成都市商业银行.锦程卡定活一卡通",
"深圳市商业银行.深圳市商业银行信用卡", "深圳市商业银行.深圳市商业银行信用卡", "深圳市商业银行.深圳市商业银行信用卡",
"深圳市商业银行.深圳市商业银行信用卡", "包头市商业银行.包头市商业银行借记卡", "包头市商业银行.包头市商业银行借记卡",
"中国建设银行.龙卡人民币信用卡", "中国建设银行.龙卡人民币信用卡", "中国建设银行.龙卡人民币信用金卡",
"中国建设银行.龙卡人民币信用金卡", "湖南省农村信用社联合社.福祥借记卡", "湖南省农村信用社联合社.福祥借记卡",
"吉林市商业银行.信用卡", "吉林市商业银行.信用卡", "吉林市商业银行.信用卡", "吉林市商业银行.信用卡",
"福建省农村信用社联合社.万通", "福建省农村信用社联合社.万通", "国家邮政局.绿卡银联标准卡",
"国家邮政局.绿卡银联标准卡", "国家邮政局.绿卡银联标准卡", "国家邮政局.绿卡银联标准卡", "中国工商银行.灵通卡",
"中国工商银行.灵通卡", "中国工商银行.E时代卡", "中国工商银行.E时代卡", "中国工商银行.E时代卡",
"中国工商银行.E时代卡", "中国工商银行.理财金卡", "中国工商银行.理财金卡", "中国工商银行.准贷记卡",
"中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡",
"中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡",
"中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡",
"中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.准贷记卡", "中国工商银行.贷记卡",
"中国工商银行.贷记卡", "中国工商银行.贷记卡", "中国工商银行.贷记卡", "中国工商银行.贷记卡",
"中国工商银行.贷记卡", "中国工商银行.贷记卡", "中国工商银行.贷记卡",
"交通银行股份有限公司太平洋双币信用卡中心.太平洋人民币贷记卡", "交行太平洋卡中心.太平洋人民币贷记卡",
"交通银行股份有限公司太平洋双币信用卡中心.太平洋人民币贷记卡", "交行太平洋卡中心.太平洋人民币贷记卡",
"交通银行股份有限公司太平洋双币信用卡中心.太平洋人民币贷记卡", "交行太平洋卡中心.太平洋人民币贷记卡",
"交通银行股份有限公司太平洋双币信用卡中心.太平洋人民币贷记卡", "交行太平洋卡中心.太平洋人民币贷记卡",
"交通银行.太平洋人民币准贷记卡", "交通银行.太平洋人民币准贷记卡", "交通银行.太平洋人民币借记卡",
"交通银行.太平洋人民币借记卡", "交通银行.太平洋人民币借记卡", "交通银行.太平洋人民币借记卡",
"交通银行.太平洋人民币借记卡", "交通银行.太平洋人民币借记卡", "交通银行.太平洋人民币借记卡",
"交通银行.太平洋人民币借记卡", "建设银行.622280银联储蓄卡", "建设银行.622280银联储蓄卡",
"柳州市商业银行.龙城卡", "柳州市商业银行.龙城卡", "柳州市商业银行.龙城卡", "柳州市商业银行.龙城卡",
"湖州市商业银行.百合卡", "湖州市商业银行.百合卡", "佛山市禅城区农村信用联社.信通卡",
"佛山市禅城区农村信用联社.信通卡", "南京市商业银行.梅花贷记卡", "南京市商业银行.梅花贷记卡",
"南京市商业银行.梅花借记卡", "南京市商业银行.梅花借记卡", "九江市商业银行.庐山卡", "九江市商业银行.庐山卡",
"昆明商业银行.春城卡", "昆明商业银行.春城卡", "西宁市商业银行.三江银行卡", "西宁市商业银行.三江银行卡",
"淄博市商业银行.金达借记卡", "淄博市商业银行.金达借记卡", "徐州市郊农村信用合作联社.信通卡",
"徐州市郊农村信用合作联社.信通卡", "宁波市商业银行.汇通卡", "宁波市商业银行.汇通卡", "宁波市商业银行.汇通卡",
"宁波市商业银行.汇通卡", "山东农村信用联合社.信通卡", "山东农村信用联合社.信通卡", "台州市商业银行.大唐贷记卡",
"台州市商业银行.大唐贷记卡", "顺德农信社.恒通卡", "顺德农信社.恒通卡", "常熟农村商业银行.粒金借记卡",
"常熟农村商业银行.粒金借记卡", "江苏农信.圆鼎卡", "江苏农信.圆鼎卡", "武汉市商业银行.九通卡",
"武汉市商业银行.九通卡", "徽商银行马鞍山分行.黄山卡", "徽商银行马鞍山分行.黄山卡", "东莞农村信用合作社.信通卡",
"东莞农村信用合作社.信通卡", "天津市农村信用社.信通借记卡", "天津市农村信用社.信通借记卡", "天津市商业银行.津卡",
"天津市商业银行.津卡", "张家港市农村商业银行.一卡通", "张家港市农村商业银行.一卡通", "东莞市商业银行.万顺通卡",
"东莞市商业银行.万顺通卡", "南宁市商业银行.桂花卡", "南宁市商业银行.桂花卡", "包头市商业银行.雄鹰卡",
"包头市商业银行.雄鹰卡", "连云港市商业银行.金猴神通借记卡", "连云港市商业银行.金猴神通借记卡",
"焦作市商业银行.月季借记卡", "焦作市商业银行.月季借记卡", "鄞州农村合作银行.蜜蜂借记卡",
"鄞州农村合作银行.蜜蜂借记卡", "徽商银行淮北分行.黄山卡", "徽商银行淮北分行.黄山卡", "江阴农村商业银行.合作借记卡",
"江阴农村商业银行.合作借记卡", "攀枝花市商业银行.攀枝花卡", "攀枝花市商业银行.攀枝花卡",
"佛山市三水区农村信用合作社.信通卡", "佛山市三水区农村信用合作社.信通卡", "成都农信社.天府借记卡",
"成都农信社.天府借记卡", "中国银行.人民币信用卡金卡", "中国银行.人民币信用卡金卡", "中国银行.人民币信用卡普通卡",
"中国银行.人民币信用卡普通卡", "中国银行.中银卡", "中国银行.中银卡", "南洋商业银行.人民币信用卡金卡",
"南洋商业银行.人民币信用卡金卡", "南洋商业银行.人民币信用卡普通卡", "南洋商业银行.人民币信用卡普通卡",
"南洋商业银行.中银卡", "南洋商业银行.中银卡", "集友银行.人民币信用卡金卡", "集友银行.人民币信用卡金卡",
"集友银行.人民币信用卡普通卡", "集友银行.人民币信用卡普通卡", "集友银行.中银卡", "集友银行.中银卡",
"沧州农信社.信通卡", "沧州农信社.信通卡", "临沂市商业银行.沂蒙卡", "临沂市商业银行.沂蒙卡",
"香港上海汇丰银行有限公司.人民币卡", "香港上海汇丰银行有限公司.人民币卡", "香港上海汇丰银行有限公司.人民币金卡",
"香港上海汇丰银行有限公司.人民币金卡", "中山市农村信用合作社.信通卡", "中山市农村信用合作社.信通卡",
"珠海市商业银行.万事顺卡", "珠海市商业银行.万事顺卡", "东亚银行有限公司.电子网络人民币卡",
"东亚银行有限公司.电子网络人民币卡", "徽商银行安庆分行.黄山卡", "徽商银行安庆分行.黄山卡",
"绵阳市商业银行.科技城卡", "绵阳市商业银行.科技城卡", "长沙市商业银行.芙蓉卡", "长沙市商业银行.芙蓉卡",
"昆明市农村信用联社.金碧一卡通", "昆明市农村信用联社.金碧一卡通", "泉州市商业银行.海峡银联卡",
"泉州市商业银行.海峡银联卡", "花旗银行有限公司.花旗人民币信用卡", "花旗银行有限公司.花旗人民币信用卡",
"大新银行有限公司.大新人民币信用卡普通卡", "大新银行有限公司.大新人民币信用卡普通卡", "大新银行有限公司.人民币借记卡",
"大新银行有限公司.人民币借记卡", "恒生银行有限公司.恒生人民币信用卡", "恒生银行有限公司.恒生人民币信用卡",
"恒生银行有限公司.恒生人民币金卡", "恒生银行有限公司.恒生人民币金卡", "恒生银行有限公司.恒生人民币白金卡",
"恒生银行有限公司.恒生人民币白金卡", "济南市商业银行.齐鲁卡", "济南市商业银行.齐鲁卡", "美国银行.人民币卡",
"美国银行.人民币卡", "大连市商业银行.大连市商业银行贷记卡", "大连市商业银行.大连市商业银行贷记卡",
"恒丰银行.九州借记卡", "恒丰银行.九州借记卡", "大连市商业银行.大连市商业银行贷记卡",
"大连市商业银行.大连市商业银行贷记卡", "上海商业银行.人民币信用卡", "上海商业银行.人民币信用卡",
"永隆银行有限公司.永隆人民币信用卡", "永隆银行有限公司.永隆人民币信用卡", "福州市商业银行.榕城卡",
"福州市商业银行.榕城卡", "宁波鄞州农村合作银行.蜜蜂贷记卡", "宁波鄞州农村合作银行.蜜蜂贷记卡",
"潍坊商业银行.鸢都卡", "潍坊商业银行.鸢都卡", "泸州市商业银行.酒城卡", "泸州市商业银行.酒城卡",
"厦门市商业银行.银鹭借记卡", "厦门市商业银行.银鹭借记卡", "镇江市商业银行.金山灵通卡", "镇江市商业银行.金山灵通卡",
"大同市商业银行.云冈卡", "大同市商业银行.云冈卡", "宜昌市商业银行.三峡卡", "宜昌市商业银行.三峡卡",
"宜昌市商业银行.信用卡", "宜昌市商业银行.信用卡", "葫芦岛市商业银行.一通卡", "辽阳市商业银行.新兴卡",
"辽阳市商业银行.新兴卡", "营口市商业银行.辽河一卡通", "营口市商业银行.辽河一卡通",
"香港上海汇丰银行有限公司.ATM Card", "香港上海汇丰银行有限公司.ATM Card",
"香港上海汇丰银行有限公司.ATM Card", "香港上海汇丰银行有限公司.ATM Card", "威海市商业银行.通达卡",
"威海市商业银行.通达卡", "湖北农信社.信通卡", "湖北农信社.信通卡", "鞍山市商业银行.千山卡",
"鞍山市商业银行.千山卡", "丹东商行.银杏卡", "丹东商行.银杏卡", "南通市商业银行.金桥卡",
"南通市商业银行.金桥卡", "洛阳市商业银行.都市一卡通", "洛阳市商业银行.都市一卡通", "郑州商业银行.世纪一卡通",
"郑州商业银行.世纪一卡通", "扬州市商业银行.绿扬卡", "扬州市商业银行.绿扬卡", "永隆银行有限公司.永隆人民币信用卡",
"永隆银行有限公司.永隆人民币信用卡", "哈尔滨市商业银行.丁香借记卡", "哈尔滨市商业银行.丁香借记卡",
"天津市商业银行.津卡贷记卡", "天津市商业银行.津卡贷记卡", "台州市商业银行.大唐卡", "台州市商业银行.大唐卡",
"银川市商业银行.如意卡", "银川市商业银行.如意卡", "银川市商业银行.如意借记卡", "银川市商业银行.如意借记卡",
"大西洋银行股份有限公司.澳门币卡", "大西洋银行股份有限公司.澳门币卡", "澳门国际银行.人民币卡",
"澳门国际银行.人民币卡", "澳门国际银行.港币卡", "澳门国际银行.港币卡", "澳门国际银行.澳门币卡",
"澳门国际银行.澳门币卡", "广州农村信用合作社联合社.麒麟储蓄卡", "广州农村信用合作社.麒麟储蓄卡",
"吉林市商业银行.雾凇卡", "吉林市商业银行.雾凇卡", "三门峡市城市信用社.天鹅卡", "三门峡市城市信用社.天鹅卡",
"抚顺市商业银行.绿叶卡", "抚顺市商业银行.绿叶卡", "昆山农村信用合作社联合社.江通卡",
"昆山农村信用合作社联合社.江通卡", "常州商业银行.月季卡", "常州商业银行.月季卡", "湛江市商业银行.南珠卡",
"湛江市商业银行.南珠卡", "金华市商业银行.双龙借记卡", "金华市商业银行.双龙借记卡", "金华市商业银行.双龙贷记卡",
"金华市商业银行.双龙贷记卡", "大新银行有限公司.大新人民币信用卡金卡", "大新银行有限公司.大新人民币信用卡金卡",
"江苏农信社.圆鼎卡", "江苏农信社.圆鼎卡", "中信嘉华银行有限公司.人民币信用卡金卡",
"中信嘉华银行有限公司.人民币信用卡金卡", "中信嘉华银行有限公司.人民币信用卡普通卡",
"中信嘉华银行有限公司.人民币信用卡普通卡", "中信嘉华银行有限公司.人民币借记卡", "中信嘉华银行有限公司.人民币借记卡",
"常熟市农村商业银行.粒金贷记卡", "常熟市农村商业银行.粒金贷记卡", "廖创兴银行有限公司.港币借记卡",
"廖创兴银行有限公司.港币借记卡", "沈阳市商业银行.玫瑰卡", "沈阳市商业银行.玫瑰卡", "广州市商业银行.羊城借记卡",
"广州市商业银行.羊城借记卡", "上海银行.申卡", "上海银行.申卡", "江门市新会农信社.信通卡",
"江门市新会农信社.信通卡", "东亚银行有限公司.人民币信用卡", "东亚银行有限公司.人民币信用卡",
"东亚银行有限公司.人民币信用卡金卡", "东亚银行有限公司.人民币信用卡金卡", "乌鲁木齐市商业银行.雪莲贷记卡",
"乌鲁木齐市商业银行.雪莲贷记卡", "高要市农村信用联社.信通卡", "高要市农村信用联社.信通卡",
"上海市农村信用合作社联合社.如意卡", "上海市农村信用合作社联社.如意卡", "江阴市农村商业银行.合作贷记卡",
"江阴市农村商业银行.合作贷记卡", "无锡市商业银行.太湖金保卡", "无锡市商业银行.太湖金保卡", "绍兴市商业银行.兰花卡",
"绍兴市商业银行.兰花卡", "星展银行.银联人民币银行卡", "星展银行.银联人民币银行卡", "星展银行.银联人民币银行卡",
"星展银行.银联人民币银行卡", "吴江农村商业银行.垂虹卡", "吴江农村商业银行.垂虹卡", "大新银行有限公司.借记卡",
"大新银行有限公司.借记卡", "星展银行.银联人民币银行卡", "星展银行.银联人民币银行卡", "星展银行.银联人民币银行卡",
"星展银行.银联人民币银行卡", "星展银行.银联银行卡", "星展银行.银联港币银行卡", "星展银行.银联港币银行卡",
"星展银行.银联银行卡", "星展银行.银联银行卡", "星展银行.银联港币银行卡", "星展银行.银联港币银行卡",
"星展银行.银联银行卡", "AEON信贷财务.AEON JUSCO银联卡", "AEON信贷财务.AEON JUSCO银联卡",
"Travelex.Travelex港币卡", "Travelex.Travelex港币卡",
"Travelex.Travelex美元卡", "Travelex.Travelex美元卡", "石家庄市商业银行.如意借记卡",
"石家庄市商业银行.如意借记卡", "石家庄市商业银行.如意借记卡", "石家庄市商业银行.如意借记卡",
"上海浦东发展银行.东方卡", "上海浦东发展银行.东方卡", "陕西省农村信用社联合社.陕西信合富泰卡",
"陕西省农村信用社联合社.陕西信合富泰卡", "高要市农村信用合作社联合社.信通白金卡", "高要市农村信用合作社联社.信通白金卡",
"高要市农村信用合作社联合社.信通金卡", "高要市农村信用合作社联社.信通金卡", "上海浦东发展银行.东方-轻松理财卡白金卡",
"上海浦东发展银行.东方-轻松理财卡白金卡", "上海浦东发展银行.东方-轻松理财卡普卡",
"上海浦东发展银行.东方-轻松理财卡普卡", "上海浦东发展银行.东方-轻松理财卡钻石卡",
"上海浦东发展银行.东方-轻松理财卡钻石卡", "上海浦东发展银行.东方-新标准准贷记卡",
"上海浦东发展银行.东方-新标准准贷记卡", "上海浦东发展银行.东方卡", "上海浦东发展银行.东方卡",
"上海浦东发展银行.东方卡", "上海浦东发展银行.东方卡", "上海浦东发展银行.东方卡", "上海浦东发展银行.东方卡",
"深圳发展银行.人民币信用卡金卡", "深圳发展银行.人民币信用卡金卡", "深圳发展银行.人民币信用卡普卡",
"深圳发展银行.人民币信用卡普卡", "深圳发展银行.发展卡", "深圳发展银行.发展卡", "大丰银行有限公司.人民币借记卡",
"大丰银行有限公司.人民币借记卡", "大丰银行有限公司.港币借记卡", "大丰银行有限公司.港币借记卡",
"大丰银行有限公司.澳门币借记卡", "大丰银行有限公司.澳门币借记卡",
"哈萨克斯坦国民储蓄银行.Halykbank Classic", "哈萨克斯坦国民储蓄银行.Halykbank Classic",
"哈萨克斯坦国民储蓄银行.Halykbank Golden", "哈萨克斯坦国民储蓄银行.Halykbank Golden",
"德阳市商业银行.锦程卡定活一卡通白金卡", "德阳市商业银行.锦程卡定活一卡通白金卡", "德阳市商业银行.锦程卡定活一卡通金卡",
"德阳市商业银行.锦程卡定活一卡通金卡", "德阳市商业银行.锦程卡定活一卡通", "德阳市商业银行.锦程卡定活一卡通",
"招商银行.招商银行信用卡", "招商银行银行.招商银行银行信用卡", "招商银行.招商银行信用卡",
"招商银行银行.招商银行银行信用卡", "招商银行.招商银行信用卡", "招商银行银行.招商银行银行信用卡",
"招商银行.招商银行信用卡", "招商银行银行.招商银行银行信用卡", "招商银行.招商银行信用卡",
"招商银行银行.招商银行银行信用卡", "招商银行.一卡通", "招商银行银行.一卡通", "招商银行.招商银行信用卡",
"招商银行银行.招商银行银行信用卡", "招商银行.招商银行信用卡", "招商银行银行.招商银行银行信用卡", "招商银行.一卡通",
"招商银行银行.一卡通", "招商银行.公司卡", "招商银行银行.公司卡", "民生银行.民生信用卡", "民生银行.民生信用卡",
"民生银行.民生信用卡", "民生银行.民生信用卡", "中国民生银行.民生银联白金信用卡", "中国民生银行.民生银联白金信用卡",
"中国民生银行.民生银联商务信用卡", "中国民生银行.民生银联商务信用卡", "民生银行.民生借记卡", "民生银行.民生借记卡",
"中国民生银行.民生借记卡", "中国民生银行.民生借记卡", "中国民生银行.民生借记卡", "中国民生银行.民生借记卡",
"中国民生银行.民生借记卡", "中国民生银行.民生借记卡", "华夏银行.华夏卡", "华夏银行.华夏卡",
"华夏银行.华夏至尊金卡", "华夏银行.华夏至尊金卡", "华夏银行.华夏丽人卡", "华夏银行.华夏丽人卡",
"华夏银行.华夏万通卡", "华夏银行.华夏万通卡", "中国光大银行.炎黄卡普卡", "中国光大银行.炎黄卡普卡",
"中国光大银行.炎黄卡白金卡", "中国光大银行.炎黄卡白金卡", "中国光大银行.炎黄卡金卡", "中国光大银行.炎黄卡金卡",
"光大银行.阳光卡", "光大银行.阳光卡", "中信实业银行信用卡中心.中信银联标准贷记卡",
"中信实业银行信用卡中心.中信银联标准贷记卡", "中信实业银行信用卡中心.中信银联标准贷记卡",
"中信实业银行信用卡中心.中信银联标准贷记卡", "中信实业银行信用卡中心.中信银联标准贷记卡",
"中信实业银行信用卡中心.中信银联标准贷记卡", "江西省农村信用社联合社.百福卡", "江西省农村信用社联合社.百福卡",
"江西省农村信用社联合社.百福卡", "江西省农村信用社联合社.百福卡", "渤海银行.渤海银行公司借记卡",
"渤海银行.渤海银行公司借记卡", "中信实业银行信用卡中心.中信银联标准贷记卡", "中信实业银行信用卡中心.中信银联标准贷记卡",
"中信实业银行信用卡中心.中信银联标准贷记卡", "中信实业银行信用卡中心.中信银联标准贷记卡", "中信实业银行.中信借记卡",
"中信实业银行.中信借记卡", "中信实业银行.中信借记卡", "中信实业银行.中信借记卡", "中信实业银行.中信贵宾卡",
"中信实业银行.中信贵宾卡", "中信银行.中信理财宝金卡", "中信银行.中信理财宝金卡", "中信银行.中信理财宝白金卡",
"中信银行.中信理财宝白金卡", "建设银行.龙卡储蓄卡", "中国建设银行.龙卡储蓄卡", "中国建设银行.龙卡准贷记卡",
"中国建设银行.龙卡准贷记卡", "中国建设银行.龙卡准贷记卡金卡", "中国建设银行.龙卡准贷记卡金卡",
"中国银行澳门分行.人民币信用卡", "中国银行澳门分行.人民币信用卡", "中国银行澳门分行.人民币信用卡",
"中国银行澳门分行.人民币信用卡", "中国银行.长城人民币信用卡", "中国银行.长城人民币信用卡-个人普卡",
"中国银行.长城人民币信用卡", "中国银行.长城人民币信用卡-个人金卡", "中国银行.长城人民币信用卡-专用卡普卡",
"中国银行.长城人民币信用卡", "中国银行.长城人民币信用卡-员工金卡", "中国银行.长城人民币信用卡",
"中国银行.长城人民币信用卡-员工金卡", "中国银行.长城人民币信用卡", "中国银行.长城人民币信用卡-员工金卡",
"中国银行.长城人民币信用卡", "中国银行.长城人民币信用卡-单位普卡", "中国银行.长城信用卡",
"中国银行.长城人民币信用卡-单位金卡", "中国银行.银联单币贷记卡", "中国银行.银联单币贷记卡", "中国银行.长城信用卡",
"中国银行.长城信用卡", "中国银行.长城信用卡", "中国银行.长城信用卡", "中国银行.长城信用卡",
"中国银行.长城信用卡", "中国银行澳门分行.中银卡", "中国银行澳门分行.中银卡", "曲靖市商业银行.珠江源卡",
"曲靖市商业银行.珠江源卡", "农业银行.金穗校园卡", "农业银行.金穗校园卡", "农业银行.金穗星座卡",
"农业银行.金穗星座卡", "农业银行.金穗社保卡", "农业银行.金穗社保卡", "农业银行.金穗旅游卡",
"农业银行.金穗旅游卡", "农业银行.金穗青年卡", "农业银行.金穗青年卡", "农业银行.复合介质金穗通宝卡",
"农业银行.复合介质金穗通宝卡", "农业银行.金穗海通卡", "农业银行.金穗贷记卡", "农业银行.金穗贷记卡",
"农业银行.金穗贷记卡", "农业银行.金穗贷记卡", "农业银行.金穗通宝卡(暂未使用)", "农业银行.金穗通宝卡",
"农业银行.金穗惠农卡", "农业银行.金穗通宝卡(暂未使用)", "农业银行.金穗通宝贵宾卡(银)",
"农业银行.金穗通宝卡(暂未使用)", "农业银行.金穗通宝卡", "农业银行.金穗通宝贵宾卡(金)", "农业银行.金穗通宝卡",
"农业银行.金穗通宝贵宾卡(白金)", "中国农业银行.金穗通宝卡", "农业银行.金穗通宝卡(单位卡)",
"农业银行.金穗通宝卡", "农业银行.金穗通宝卡(个人普卡)", "农业银行.金穗通宝卡", "农业银行.金穗通宝贵宾卡(钻石)",
"江苏东吴农村商业银行.新苏卡", "江苏东吴农村商业银行.新苏卡", "桂林市商业银行.漓江卡", "桂林市商业银行.漓江卡",
"日照市商业银行.黄海卡", "日照市商业银行.黄海卡", "浙江省农村信用社联合社.丰收卡", "浙江省农村信用社联社.丰收卡",
"珠海农村信用合作社联社.信通卡", "珠海农村信用合作联社.信通卡", "大庆市商业银行.玉兔卡", "大庆市商业银行.玉兔卡",
"澳门永亨银行股份有限公司.人民币卡", "澳门永亨银行股份有限公司.人民币卡", "莱芜市商业银行.金凤卡",
"莱芜市商业银行.金凤卡", "长春市商业银行.君子兰一卡通", "长春市商业银行.君子兰一卡通", "徐州市商业银行.彭城借记卡",
"徐州市商业银行.彭城借记卡", "重庆市农村信用社联合社.信合平安卡", "重庆市农村信用社联合社.信合平安卡",
"太仓农村商业银行.郑和卡", "太仓农村商业银行.郑和卡", "靖江市长江城市信用社.长江卡", "靖江市长江城市信用社.长江卡",
"永亨银行.永亨尊贵理财卡", "永亨银行.永亨尊贵理财卡", "徽商银行.黄山卡", "徽商银行.黄山卡",
"杭州市商业银行.西湖卡", "杭州市商业银行.西湖卡", "徽商银行.黄山卡", "徽商银行.黄山卡",
"柳州市商业银行.龙城卡", "柳州市商业银行.龙城卡", "柳州市商业银行.龙城卡", "柳州市商业银行.龙城卡",
"尧都区农村信用合作社联社.天河卡", "尧都区农村信用合作社联社.天河卡", "渤海银行.渤海银行借记卡",
"渤海银行.渤海银行借记卡", "重庆市农村信用社联合社.信合希望卡", "重庆市农村信用社联合社.信合希望卡",
"烟台市商业银行.金通卡", "烟台市商业银行.金通卡", "武进农村商业银行.阳湖卡", "武进农村商业银行.阳湖卡",
"上海银行.申卡借记卡", "上海银行.申卡借记卡", "贵州省农村信用社联合社.信合卡", "贵州省农村信用社联合社.信合卡",
"江苏锡州农村商业银行.金阿福", "江苏锡州农村商业银行.金阿福", "中外合资.南充市商业银行.熊猫团团卡",
"中外合资.南充市商业银行.熊猫团团卡", "长沙市商业银行.芙蓉贷记卡", "长沙市商业银行.芙蓉贷记卡",
"长沙市商业银行.芙蓉贷记卡", "长沙市商业银行.芙蓉贷记卡", "兴业银行.银联信用卡", "兴业银行.银联信用卡",
"兴业银行.兴业自然人生理财卡", "兴业银行.兴业自然人生理财卡", "兴业银行.万能卡", "兴业银行.万能卡",
"石嘴山城市信用社.麒麟卡", "张家口市商业银行.好运卡", "交通银行.太平洋卡", "中国工商银行.公务卡",
"中国建设银行.公务卡", "大庆市商业银行.公务卡", "Discover Financial ServicesInc.发现卡",
".发现卡", "Discover Financial ServicesInc.发现卡", ".发现卡",
"Discover Financial ServicesInc.发现卡", ".发现卡",
"Discover Financial ServicesInc.发现卡", ".发现卡", "上海银行.上海明珠卡",
"上海银行.上海明珠卡", "泉州市商业银行.海峡储蓄卡", "泉州市商业银行.海峡储蓄卡", "广东发展银行.广发信用卡",
"广东发展银行.广发VISA信用卡", "广东发展银行.广发理财通", "广东发展银行.广发VISA信用卡",
"广东发展银行.广发理财通", "广东发展银行.广发信用卡", "招商.招行一卡通", "招商.招行一卡通",
"招商银行.招商银行银行一卡通", "招商银行.招商银行银行一卡通", "长沙市商业银行.芙蓉卡", "长沙市商业银行.芙蓉卡",
"南通商业银行.金桥卡", "南通商业银行.金桥卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡", "浦东发展银行.东方卡",
"贵阳市商业银行.甲秀卡", "贵阳市商业银行.甲秀卡", "郑州市商业银行.世纪一卡通", "工商银行.牡丹银联灵通卡-个人普卡",
"工商银行.牡丹银联灵通卡-个人普卡", "工商银行.牡丹银联灵通卡-个人金卡", "工商银行.牡丹银联理财金卡",
"上海浦东发展银行.东方卡", "深圳发展银行.发展卡" };
public static Map<String,Object> checkBankCar(String cardId){
Map<String,Object> map = new HashMap(3);
boolean checkBankCard = checkBankCard(cardId);
map.put("card",checkBankCard);
String nameOfBank = getNameOfBank(cardId);
map.put("cardName",nameOfBank);
return map;
}
public static void main(String[] args) {
String cards = "1035481552887309119";
Map<String, Object> stringObjectMap = checkBankCar(cards);
System.out.println(stringObjectMap);
}
}

View File

@ -0,0 +1,102 @@
server.port = 6809
## 数据源配置
#spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/fire_point
#spring.datasource.userName = fire_manage
#spring.datasource.password = fire456
#spring.datasource.driverClassName = org.postgresql.Driver
spring.datasource.url = jdbc:postgresql://localhost:5432/shopping
spring.datasource.userName = postgres
spring.datasource.password = 123456
spring.datasource.driverClassName = org.postgresql.Driver
server.tomcat.uri-encoding=UTF-8
# 关闭spring data 的redis仓库
spring.data.redis.repositories.enabled = false
# jackson 配置
spring.jackson.serialization.write-date-keys-as-timestamps=false
## Hikari连接池设置
spring.datasource.hikari.auto-commit = true
spring.datasource.hikari.maximum-pool-size = 100
spring.datasource.hikari.idle-timeout = 10000
spring.datasource.hikari.minimum-idle = 5
spring.datasource.hikari.validation-timeout = 3000
## Spring Data JPA 配置
spring.jpa.database = POSTGRESQL
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.show-sql = true
# 指定 ddl mode (none, validate, create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# 命名策略
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect
#spring.jpa.properties.hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
spring.jpa.properties.hibernate.jdbc.batch_size=500
spring.jpa.properties.hibernate.jdbc.batch_versioned_data=true
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates =true
## Redis配置 12
spring.cache.type = redis
spring.redis.database = 12
spring.redis.host = localhost
spring.redis.port = 6379
spring.redis.password=sdust2020
spring.redis.timeout = 10000
spring.redis.lettuce.pool.max-active = 100
spring.redis.lettuce.pool.max-wait = 10000
spring.redis.lettuce.pool.max-idle = 100
spring.redis.lettuce.pool.min-idle = 1
spring.redis.lettuce.shutdown-timeout = 0
## Devtools配置
spring.devtools.livereload.enabled = true
## 多国语言配置
spring.messages.basename = i18n/messages
spring.messages.encoding = UTF-8
# 上传文件配置
spring.servlet.multipart.enabled=true
# 最大文件大小
spring.servlet.multipart.max-file-size = 100MB
# 最大请求大小
spring.servlet.multipart.max-request-size = 100MB
spring.main.allow-bean-definition-overriding = true
# Geoserver服务器地址
my.GeoserverAdress = http://139.199.98.175:9080/geoserver/
# 文件服务器地址
my.FileServerAdress = http://139.199.98.175:4096/
my.FileServerAdminAdress = http://127.0.0.1:4096/
dfs.ip = 192.168.2.9
dfs.port = 4096
## 自定义用户最大登录错误尝试次数
my.MaxLoginErrorCount = 5
## 自定义用户登录错误间隔时间(分钟)
my.LoginErrorIntervalTime = 60
#公共密钥
qiniu.accessKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# 私钥
qiniu.secretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# 空间名
qiniu.bucket=XXXXXXX
qiniu.zone=XXXXXXX
# 外链默认域名
qiniu.domain=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

View File

@ -0,0 +1,162 @@
sys.message.success = 成功
sys.message.null = 暂时还没有数据
sys.message.exit = 已存在相关内容,请勿重复操作
sys.message.user.not_logged_in = 用户未登录
sys.message.user.login_error = 用户登陆失败
sys.message.user.account_forbidden = 用户已被禁止
sys.message.user.account_not_activated = 用户未激活
sys.message.user.overtime = 用户登录超时
sys.message.user.no_permission = 用户权限不足
sys.message.user.already_logged = 用户已经登录
sys.message.param.null = 参数为空
sys.message.param.illegal = 参数非法
sys.message.data.none = 数据为空
sys.message.data.wrong = 数据错误
sys.message.process.fail = 处理失败
sys.message.process.overtime = 处理超时
sys.message.system.inner_error = 系统内部错误
sys.message.system.abnormal = 系统异常
sys.message.system.busy = 系统正忙,请稍后
sys.message.system.maintain = 系统维护中
sys.message.database.error = 数据库错误
sys.message.file.exists = 文件已存在
sys.message.file.write.error = 文件写入失败
sys.message.file.read.error = 文件读取失败
SysUser.id.blank = 用户id不能为空
SysUser.userName.blank = 用户名不能为空
SysUser.userName.length.illegal = 用户名长度不合法
SysUser.userName.format.illegal = 用户名格式不合法
SysUser.nickName.length.illegal = 用户昵称长度不合法
SysUser.userCode.length.illegal = 用户编码长度不合法
SysUser.userCode.format.illegal = 用户编码含有非法字符
SysUser.password.blank = 用户密码不能为空
SysUser.password.length.illegal = 用户密码长度不合法
SysUser.password.format.illegal = 用户密码格式不合法
SysUser.sex.num.null = 用户性别数字不能为空
SysUser.sex.num.illegal = 用户性别数字不合法
SysUser.telephone.format.illegal = 用户手机号码不合法
SysUser.email.length.illegal = 用户邮箱长度不合法
SysUser.email.format.illegal = 用户邮箱格式不合法
SysUser.admCode.illegal = 用户行政区划代码不合法
SysUser.address.length.illegal = 用户详细地址长度不合法
SysUser.birthday.format.illegal = 用户出生日期必须是 yyyy-MM-dd
SysUser.personalSignature.length.illegal = 用户个性签名长度非法
SysUser.portraitId.illegal = 用户头像id非法
SysUser.statusCode.null = 用户当前状态编码为空
SysUser.statusCode.illegal = 用户当前状态编码非法
SysUser.deleteFlag.null = 用户删除标记不能是空
TrajectoryRecord.id.null = id 不能为空
TrajectoryRecord.startTimeTs.null = startTimeTs 不能为空
SatelliteFirePoint.id.null = id 不能为空
SatelliteFirePoint.fireCode.null = fireCode 不能为空
SatelliteFirePoint.fireCode.length.illegal = fireCode 长度过长
SatelliteFirePoint.countyCode.null = countyCode 不能为空
SatelliteFirePoint.countyCode.length.illegal = countyCode 长度过长
SatelliteFirePoint.countyName.null = countyName 不能为空
SatelliteFirePoint.countyName.length.illegal = countyName 长度过长
SatelliteFirePoint.satelliteType.null = satelliteType 不能为空
SatelliteFirePoint.fireStatus.null = fireStatus 不能为空
SatelliteFirePoint.verifyStatus.null = verifyStatus 不能为空
SatelliteFirePoint.satelliteTimeTs.null = satelliteTimeTs 不能为空
PictureFirePoint.id.null = id 不能为空
PictureFirePoint.fireCode.null = fireCode 不能为空
PictureFirePoint.fireCode.length.illegal = fireCode 长度过长
PictureFirePoint.pictureName.length.illegal = pictureName 长度过长
PictureFirePoint.picturePath.null = picturePath 不能为空
PictureFirePoint.picturePath.length.illegal = picturePath 长度过长
PictureFirePoint.memo.length.illegal = memo 长度过长
PictureFirePoint.size.length.illegal = size 长度过长
PictureFirePoint.md5.null = md5 不能为空
PictureFirePoint.md5.length.illegal = md5 长度过长
PictureFirePoint.shootTimeTs.null = shootTimeTs 不能为空
PersonInvestigator.id.null = id 不能为空
PersonInvestigator.name.null = name 不能为空
PersonInvestigator.name.length.illegal = name 长度过长
PersonInvestigator.code.length.illegal = code 长度过长
PersonInvestigator.telephone.null = telephone 不能为空
PersonInvestigator.telephone.format.illegal = telephone 格式非法
PersonInvestigator.sex.null = sex 不能为空
PersonInvestigator.sex.format.illegal = sex 格式非法
PersonInvestigator.idCard.length.illegal = idCard 长度过长
PersonInvestigator.memo.length.illegal = memo 长度过长
PersonInvestigator.linkUserName.null = linkUserName 不能为空
PersonInvestigator.linkUserName.format.illegal = linkUserName 格式非法
PersonInvestigator.password.null = password 不能为空
PersonInvestigator.password.format.illegal = password 格式非法
InvestigateFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空
InvestigateFirePoint.id.null = id 不能为空
InvestigateFirePoint.fireCode.null = fireCode 不能为空
InvestigateFirePoint.fireCode.length.illegal = fireCode 长度过长
InvestigateFirePoint.countyCode.null = countyCode 不能为空
InvestigateFirePoint.countyCode.length.illegal = countyCode 长度过长
InvestigateFirePoint.countyName.null = countyName 不能为空
InvestigateFirePoint.countyName.length.illegal = countyName 长度过长
InvestigateFirePoint.address.null = address 不能为空
InvestigateFirePoint.fireArea.null = fireArea 不能为空
InvestigateFirePoint.verifyType.null = verifyType 不能为空
InvestigateFirePoint.satelliteType.null = satelliteType 不能为空
InvestigateFirePoint.satelliteType.length.illegal = satelliteType 长度过长
FileDocument.id.null = id 不能为空
FileDocument.name.null = name 不能为空
FileDocument.name.length.illegal = name 长度过长
FileDocument.category.length.illegal = category 长度过长
FileDocument.filePath.null = filePath 不能为空
FileDocument.filePath.length.illegal = filePath 长度过长
FileDocument.size.length.illegal = size 长度过长
FileDocument.md5.null = md5 不能为空
FileDocument.md5.length.illegal = md5 长度过长
FileDocument.memo.length.illegal = memo 长度过长
FileDocument.checkingToken.length.illegal = checkingToken 长度过长
AppFile.id.null = id 不能为空
AppFile.name.null = name 不能为空
AppFile.name.length.illegal = name 长度过长
AppFile.appPath.null = appPath 不能为空
AppFile.appPath.length.illegal = appPath 长度过长
AppFile.versionNumber.null = versionNumber 不能为空
AppFile.versionNumber.length.illegal = versionNumber 长度过长
AppFile.versionNumber.format.illegal = versionNumber 格式不合法
AppFile.size.null = size 不能为空
AppFile.size.length.illegal = size 长度过长
AppFile.md5.null = md5 不能为空
AppFile.md5.length.illegal = md5 长度过长
AppFile.memo.length.illegal = memo 长度过长
RealFirePoint.id.null = id 不能为空
RealFirePoint.fireCode.null = fireCode 不能为空
RealFirePoint.fireCode.length.illegal = fireCode 不合法
RealFirePoint.countyCode.null = countyCode 不能为空
RealFirePoint.countyCode.length.illegal = countyCode 不合法
RealFirePoint.countyName.null = countyName 不能为空
RealFirePoint.countyName.length.illegal = countyName 不合法
RealFirePoint.address.null = address 不能为空
RealFirePoint.address.length.illegal = address 不合法
RealFirePoint.fireArea.null = fireArea 不能为空
RealFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空
RealFirePoint.verifyType.null = verifyType 不能为空
InvestigationTeam.id.null = id 不能为空
InvestigationTeam.teamName.null = teamName 不能为空
InvestigationTeam.teamName.length.illegal = teamName 长度过长
InvestigationTeam.memo.length.illegal = memo 长度过长
InvestigationTeam.userName.null = userName 不能为空
InvestigationTeam.userName.length.illegal = userName 长度过长
InvestigationTeam.userRealName.null = userRealName 不能为空
InvestigationTeam.userRealName.length.illegal = userRealName 长度过长
RelTeamInvestigator.id.null = id 不能为空
RelTeamInvestigator.teamCode.null = teamCode 不能为空
RelTeamInvestigator.teamCode.length.illegal = teamCode 长度过长
RelTeamInvestigator.userName.null = userName 不能为空
RelTeamInvestigator.userName.length.illegal = userName 长度过长
RelTeamInvestigator.teamDeputy.null = teamDeputy 不能为空
RelTeamInvestigator.memo.length.illegal = memo 长度过长
RelTeamInvestigator.userRealName.null = userRealName 不能为空
RelTeamInvestigator.userRealName.length.illegal = userRealName 长度过长

View File

@ -0,0 +1,162 @@
sys.message.success = success
sys.message.null = null
sys.message.exit = data already exists
sys.message.user.not_logged_in = user not logged in
sys.message.user.login_error = user login failed
sys.message.user.account_forbidden = this account is forbidden
sys.message.user.account_not_activated = this account not activated
sys.message.user.overtime = user login timeout
sys.message.user.no_permission = user permission denied
sys.message.user.already_logged = user already logged
sys.message.param.null = parameter is null
sys.message.param.illegal = parameter is illegal
sys.message.data.none = data is none
sys.message.data.wrong = data is wrong
sys.message.process.fail = process fail
sys.message.process.overtime = process overtime
sys.message.system.inner_error = system inner error
sys.message.system.abnormal = system abnormal
sys.message.system.busy = system is busy
sys.message.system.maintain = system maintenance
sys.message.database.error = database error
sys.message.file.exists = file exists
sys.message.file.write.error = file write error
sys.message.file.read.error = file read error
SysUser.id.blank = user id can't be blank
SysUser.userName.blank = user name can't be blank
SysUser.userName.length.illegal = user name length illegal
SysUser.userName.format.illegal = user name format illegal
SysUser.nickName.length.illegal = user nickname length illegal
SysUser.userCode.length.illegal = user code length illegal
SysUser.userCode.format.illegal = user code cantains illegal character
SysUser.password.blank = user password can't be blank
SysUser.password.length.illegal = user password length illegal
SysUser.password.format.illegal = user password format illegal
SysUser.sex.num.null = user sex num can't be blank
SysUser.sex.num.illegal = user sex num illegal
SysUser.telephone.format.illegal = user telephone format illegal
SysUser.email.length.illegal = user email length illegal
SysUser.email.format.illegal = user email format illegal
SysUser.admCode.illegal = user administrative area code illegal
SysUser.address.length.illegal = user address length illegal
SysUser.birthday.format.illegal = user birthday must be yyyy-MM-dd
SysUser.personalSignature.length.illegal = user personal signature length illegal
SysUser.portraitId.illegal = user portrait id illegal
SysUser.statusCode.null = user current status code can't be blank
SysUser.statusCode.illegal = user current status code illegal
SysUser.deleteFlag.null = user delete flag can't be null
TrajectoryRecord.id.null = id can't be null
TrajectoryRecord.startTimeTs.null = startTimeTs can't be null
SatelliteFirePoint.id.null = id can't be blank
SatelliteFirePoint.fireCode.null = fireCode can't be blank
SatelliteFirePoint.fireCode.length.illegal = fireCode length illegal
SatelliteFirePoint.countyCode.null = countyCode can't be blank
SatelliteFirePoint.countyCode.length.illegal = countyCode length illegal
SatelliteFirePoint.countyName.null = countyName can't be blank
SatelliteFirePoint.countyName.length.illegal = countyName length illegal
SatelliteFirePoint.satelliteType.null = satelliteType can't be blank
SatelliteFirePoint.fireStatus.null = fireStatus can't be blank
SatelliteFirePoint.verifyStatus.null = verifyStatus can't be blank
SatelliteFirePoint.satelliteTimeTs.null = satelliteTimeTs can't be blank
PictureFirePoint.id.null = id can't be blank
PictureFirePoint.fireCode.null = fireCode can't be blank
PictureFirePoint.fireCode.length.illegal = fireCode length illegal
PictureFirePoint.pictureName.length.illegal = pictureName length illegal
PictureFirePoint.picturePath.null = picturePath can't be blank
PictureFirePoint.picturePath.length.illegal = picturePath length illegal
PictureFirePoint.memo.length.illegal = memo length illegal
PictureFirePoint.size.length.illegal = size length illegal
PictureFirePoint.md5.null = md5 can't be blank
PictureFirePoint.md5.length.illegal = md5 length illegal
PictureFirePoint.shootTimeTs.null = shootTimeTs can't be blank
PersonInvestigator.id.null = id can't be blank
PersonInvestigator.name.null = name can't be blank
PersonInvestigator.name.length.illegal = name length illegal
PersonInvestigator.code.length.illegal = code length illegal
PersonInvestigator.telephone.null = telephone can't be blank
PersonInvestigator.telephone.format.illegal = telephone format illegal
PersonInvestigator.sex.null = sex format can't be blank
PersonInvestigator.sex.format.illegal = sex format illegal
PersonInvestigator.idCard.length.illegal = idCard length illegal
PersonInvestigator.memo.length.illegal = memo length illegal
PersonInvestigator.linkUserName.null = linkUserName can't be blank
PersonInvestigator.linkUserName.format.illegal = linkUserName format illegal
PersonInvestigator.password.null = password can't be blank
PersonInvestigator.password.format.illegal = password format
InvestigateFirePoint.verifyTimeTs.null = verifyTimeTs can't be blank
InvestigateFirePoint.id.null = id can't be blank
InvestigateFirePoint.fireCode.null = fireCode can't be blank
InvestigateFirePoint.fireCode.length.illegal = fireCode length illegal
InvestigateFirePoint.countyCode.null = countyCode can't be blank
InvestigateFirePoint.countyCode.length.illegal = countyCode length illegal
InvestigateFirePoint.countyName.null = countyName can't be blank
InvestigateFirePoint.countyName.length.illegal = countyName length illegal
InvestigateFirePoint.address.null = address can't be blank
InvestigateFirePoint.fireArea.null = fireArea can't be blank
InvestigateFirePoint.verifyType.null = verifyType can't be blank
InvestigateFirePoint.satelliteType.null = satelliteType can't be blank
InvestigateFirePoint.satelliteType.length.illegal = satelliteType length illegal
FileDocument.id.null = id can't be blank
FileDocument.name.null = name can't be blank
FileDocument.name.length.illegal = name length illegal
FileDocument.category.length.illegal = category length illegal
FileDocument.filePath.null = filePath can't be blank
FileDocument.filePath.length.illegal = filePath length illegal
FileDocument.size.length.illegal = size length illegal
FileDocument.md5.null = md5 can't be blank
FileDocument.md5.length.illegal = md5 length illegal
FileDocument.memo.length.illegal = memo length illegal
FileDocument.checkingToken.length.illegal = checkingToken length illegal
AppFile.id.null = id can't be blank
AppFile.name.null = name can't be blank
AppFile.name.length.illegal = name length illegal
AppFile.appPath.null = appPath can't be blank
AppFile.appPath.length.illegal = appPath length illegal
AppFile.versionNumber.null = versionNumber can't be blank
AppFile.versionNumber.length.illegal = versionNumber length illegal
AppFile.versionNumber.format.illegal = versionNumber illegal
AppFile.size.null = size can't be blank
AppFile.size.length.illegal = size length illegal
AppFile.md5.null = md5 can't be blank
AppFile.md5.length.illegal = md5 length illegal
AppFile.memo.length.illegal = memo length illegal
RealFirePoint.id.null = id can't be blank
RealFirePoint.fireCode.null = fireCode can't be blank
RealFirePoint.fireCode.length.illegal = fireCode illegal
RealFirePoint.countyCode.null = countyCode can't be blank
RealFirePoint.countyCode.length.illegal = countyCode
RealFirePoint.countyName.null = countyName can't be blank
RealFirePoint.countyName.length.illegal = countyName illegal
RealFirePoint.address.null = address can't be blank
RealFirePoint.address.length.illegal = address illegal
RealFirePoint.fireArea.null = fireArea can't be blank
RealFirePoint.verifyTimeTs.null = verifyTimeTs can't be blank
RealFirePoint.verifyType.null = verifyType can't be blank
InvestigationTeam.id.null = id can't be blank
InvestigationTeam.teamName.null = teamName can't be blank
InvestigationTeam.teamName.length.illegal = teamName length illegal
InvestigationTeam.memo.length.illegal = memo length illegal
InvestigationTeam.userName.null = userName can't be blank
InvestigationTeam.userName.length.illegal = userName length illegal
InvestigationTeam.userRealName.null = userRealName can't be blank
InvestigationTeam.userRealName.length.illegal = userRealName length illegal
RelTeamInvestigator.id.null = id can't be blank
RelTeamInvestigator.teamCode.null = teamCode can't be blank
RelTeamInvestigator.teamCode.length.illegal = teamCode length illegal
RelTeamInvestigator.userName.null = userName can't be blank
RelTeamInvestigator.userName.length.illegal = userName length illegal
RelTeamInvestigator.teamDeputy.null = teamDeputy can't be blank
RelTeamInvestigator.memo.length.illegal = memo length illegal
RelTeamInvestigator.userRealName.null = userRealName can't be blank
RelTeamInvestigator.userRealName.length.illegal = userRealName length illegal

View File

@ -0,0 +1,162 @@
sys.message.success = 成功
sys.message.null = 暂时还没有数据
sys.message.exit = 已存在相关内容,请勿重复操作
sys.message.user.not_logged_in = 用户未登录
sys.message.user.login_error = 用户登陆失败
sys.message.user.account_forbidden = 用户已被禁止
sys.message.user.account_not_activated = 用户未激活
sys.message.user.overtime = 用户登录超时
sys.message.user.no_permission = 用户权限不足
sys.message.user.already_logged = 用户已经登录
sys.message.param.null = 参数为空
sys.message.param.illegal = 参数非法
sys.message.data.none = 数据为空
sys.message.data.wrong = 数据错误
sys.message.process.fail = 处理失败
sys.message.process.overtime = 处理超时
sys.message.system.inner_error = 系统内部错误
sys.message.system.abnormal = 系统异常
sys.message.system.busy = 系统正忙,请稍后
sys.message.system.maintain = 系统维护中
sys.message.database.error = 数据库错误
sys.message.file.exists = 文件已存在
sys.message.file.write.error = 文件写入失败
sys.message.file.read.error = 文件读取失败
SysUser.id.blank = 用户id不能为空
SysUser.userName.blank = 用户名不能为空
SysUser.userName.length.illegal = 用户名长度不合法
SysUser.userName.format.illegal = 用户名格式不合法
SysUser.nickName.length.illegal = 用户昵称长度不合法
SysUser.userCode.length.illegal = 用户编码长度不合法
SysUser.userCode.format.illegal = 用户编码含有非法字符
SysUser.password.blank = 用户密码不能为空
SysUser.password.length.illegal = 用户密码长度不合法
SysUser.password.format.illegal = 用户密码格式不合法
SysUser.sex.num.null = 用户性别数字不能为空
SysUser.sex.num.illegal = 用户性别数字不合法
SysUser.telephone.format.illegal = 用户手机号码不合法
SysUser.email.length.illegal = 用户邮箱长度不合法
SysUser.email.format.illegal = 用户邮箱格式不合法
SysUser.admCode.illegal = 用户行政区划代码不合法
SysUser.address.length.illegal = 用户详细地址长度不合法
SysUser.birthday.format.illegal = 用户出生日期必须是 yyyy-MM-dd
SysUser.personalSignature.length.illegal = 用户个性签名长度非法
SysUser.portraitId.illegal = 用户头像id非法
SysUser.statusCode.null = 用户当前状态编码为空
SysUser.statusCode.illegal = 用户当前状态编码非法
SysUser.deleteFlag.null = 用户删除标记不能是空
TrajectoryRecord.id.null = id 不能为空
TrajectoryRecord.startTimeTs.null = startTimeTs 不能为空
SatelliteFirePoint.id.null = id 不能为空
SatelliteFirePoint.fireCode.null = fireCode 不能为空
SatelliteFirePoint.fireCode.length.illegal = fireCode 长度过长
SatelliteFirePoint.countyCode.null = countyCode 不能为空
SatelliteFirePoint.countyCode.length.illegal = countyCode 长度过长
SatelliteFirePoint.countyName.null = countyName 不能为空
SatelliteFirePoint.countyName.length.illegal = countyName 长度过长
SatelliteFirePoint.satelliteType.null = satelliteType 不能为空
SatelliteFirePoint.fireStatus.null = fireStatus 不能为空
SatelliteFirePoint.verifyStatus.null = verifyStatus 不能为空
SatelliteFirePoint.satelliteTimeTs.null = satelliteTimeTs 不能为空
PictureFirePoint.id.null = id 不能为空
PictureFirePoint.fireCode.null = fireCode 不能为空
PictureFirePoint.fireCode.length.illegal = fireCode 长度过长
PictureFirePoint.pictureName.length.illegal = pictureName 长度过长
PictureFirePoint.picturePath.null = picturePath 不能为空
PictureFirePoint.picturePath.length.illegal = picturePath 长度过长
PictureFirePoint.memo.length.illegal = memo 长度过长
PictureFirePoint.size.length.illegal = size 长度过长
PictureFirePoint.md5.null = md5 不能为空
PictureFirePoint.md5.length.illegal = md5 长度过长
PictureFirePoint.shootTimeTs.null = shootTimeTs 不能为空
PersonInvestigator.id.null = id 不能为空
PersonInvestigator.name.null = name 不能为空
PersonInvestigator.name.length.illegal = name 长度过长
PersonInvestigator.code.length.illegal = code 长度过长
PersonInvestigator.telephone.null = telephone 不能为空
PersonInvestigator.telephone.format.illegal = telephone 格式非法
PersonInvestigator.sex.null = sex 不能为空
PersonInvestigator.sex.format.illegal = sex 格式非法
PersonInvestigator.idCard.length.illegal = idCard 长度过长
PersonInvestigator.memo.length.illegal = memo 长度过长
PersonInvestigator.linkUserName.null = linkUserName 不能为空
PersonInvestigator.linkUserName.format.illegal = linkUserName 格式非法
PersonInvestigator.password.null = password 不能为空
PersonInvestigator.password.format.illegal = password 格式非法
InvestigateFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空
InvestigateFirePoint.id.null = id 不能为空
InvestigateFirePoint.fireCode.null = fireCode 不能为空
InvestigateFirePoint.fireCode.length.illegal = fireCode 长度过长
InvestigateFirePoint.countyCode.null = countyCode 不能为空
InvestigateFirePoint.countyCode.length.illegal = countyCode 长度过长
InvestigateFirePoint.countyName.null = countyName 不能为空
InvestigateFirePoint.countyName.length.illegal = countyName 长度过长
InvestigateFirePoint.address.null = address 不能为空
InvestigateFirePoint.fireArea.null = fireArea 不能为空
InvestigateFirePoint.verifyType.null = verifyType 不能为空
InvestigateFirePoint.satelliteType.null = satelliteType 不能为空
InvestigateFirePoint.satelliteType.length.illegal = satelliteType 长度过长
FileDocument.id.null = id 不能为空
FileDocument.name.null = name 不能为空
FileDocument.name.length.illegal = name 长度过长
FileDocument.category.length.illegal = category 长度过长
FileDocument.filePath.null = filePath 不能为空
FileDocument.filePath.length.illegal = filePath 长度过长
FileDocument.size.length.illegal = size 长度过长
FileDocument.md5.null = md5 不能为空
FileDocument.md5.length.illegal = md5 长度过长
FileDocument.memo.length.illegal = memo 长度过长
FileDocument.checkingToken.length.illegal = checkingToken 长度过长
AppFile.id.null = id 不能为空
AppFile.name.null = name 不能为空
AppFile.name.length.illegal = name 长度过长
AppFile.appPath.null = appPath 不能为空
AppFile.appPath.length.illegal = appPath 长度过长
AppFile.versionNumber.null = versionNumber 不能为空
AppFile.versionNumber.length.illegal = versionNumber 长度过长
AppFile.versionNumber.format.illegal = versionNumber 格式不合法
AppFile.size.null = size 不能为空
AppFile.size.length.illegal = size 长度过长
AppFile.md5.null = md5 不能为空
AppFile.md5.length.illegal = md5 长度过长
AppFile.memo.length.illegal = memo 长度过长
RealFirePoint.id.null = id 不能为空
RealFirePoint.fireCode.null = fireCode 不能为空
RealFirePoint.fireCode.length.illegal = fireCode 不合法
RealFirePoint.countyCode.null = countyCode 不能为空
RealFirePoint.countyCode.length.illegal = countyCode 不合法
RealFirePoint.countyName.null = countyName 不能为空
RealFirePoint.countyName.length.illegal = countyName 不合法
RealFirePoint.address.null = address 不能为空
RealFirePoint.address.length.illegal = address 不合法
RealFirePoint.fireArea.null = fireArea 不能为空
RealFirePoint.verifyTimeTs.null = verifyTimeTs 不能为空
RealFirePoint.verifyType.null = verifyType 不能为空
InvestigationTeam.id.null = id 不能为空
InvestigationTeam.teamName.null = teamName 不能为空
InvestigationTeam.teamName.length.illegal = teamName 长度过长
InvestigationTeam.memo.length.illegal = memo 长度过长
InvestigationTeam.userName.null = userName 不能为空
InvestigationTeam.userName.length.illegal = userName 长度过长
InvestigationTeam.userRealName.null = userRealName 不能为空
InvestigationTeam.userRealName.length.illegal = userRealName 长度过长
RelTeamInvestigator.id.null = id 不能为空
RelTeamInvestigator.teamCode.null = teamCode 不能为空
RelTeamInvestigator.teamCode.length.illegal = teamCode 长度过长
RelTeamInvestigator.userName.null = userName 不能为空
RelTeamInvestigator.userName.length.illegal = userName 长度过长
RelTeamInvestigator.teamDeputy.null = teamDeputy 不能为空
RelTeamInvestigator.memo.length.illegal = memo 长度过长
RelTeamInvestigator.userRealName.null = userRealName 不能为空
RelTeamInvestigator.userRealName.length.illegal = userRealName 长度过长

Some files were not shown because too many files have changed in this diff Show More