New file |
| | |
| | | # Default ignored files |
| | | /shelf/ |
| | | /workspace.xml |
| | | # Editor-based HTTP Client requests |
| | | /httpRequests/ |
| | | # Datasource local storage ignored files |
| | | /dataSources/ |
| | | /dataSources.local.xml |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <module type="JAVA_MODULE" version="4"> |
| | | <component name="NewModuleRootManager" inherit-compiler-output="true"> |
| | | <exclude-output /> |
| | | <content url="file://$MODULE_DIR$" /> |
| | | <orderEntry type="inheritedJdk" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | | </component> |
| | | </module> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| | | <output url="file://$PROJECT_DIR$/out" /> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ProjectModuleManager"> |
| | | <modules> |
| | | <module fileurl="file://$PROJECT_DIR$/.idea/eyes.iml" filepath="$PROJECT_DIR$/.idea/eyes.iml" /> |
| | | </modules> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="VcsDirectoryMappings"> |
| | | <mapping directory="" vcs="Git" /> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>sales</artifactId> |
| | | <groupId>com</groupId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>applet</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>aliyun-java-sdk-core</artifactId> |
| | | <version>4.4.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.huaweicloud</groupId> |
| | | <artifactId>esdk-obs-java</artifactId> |
| | | <version>3.19.5</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com</groupId> |
| | | <artifactId>common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-core</artifactId> |
| | | <version>5.5.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-config</artifactId> |
| | | <version>5.5.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-web</artifactId> |
| | | <version>5.5.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-crypto</artifactId> |
| | | <version>5.5.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.jetbrains</groupId> |
| | | <artifactId>annotations</artifactId> |
| | | <version>RELEASE</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.aliyun</groupId>--> |
| | | <!-- <artifactId>dingtalk</artifactId>--> |
| | | <!-- <version>2.0.0</version>--> |
| | | <!-- </dependency>--> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>alibaba-dingtalk-service-sdk</artifactId> |
| | | <version>2.0.0</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>applet</finalName> |
| | | |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>${spring.boot.version}</version> |
| | | <configuration> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | <mainClass>com.jilongda.applet.AppletApplication</mainClass> |
| | | </configuration> |
| | | </plugin> |
| | | |
| | | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <version>2.22.2</version> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.8.0</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | <encoding>UTF-8</encoding> |
| | | <optimize>true</optimize> |
| | | <useIncrementalCompilation>false</useIncrementalCompilation> |
| | | <!-- 去除泛型编译告警 --> |
| | | <compilerArgument>-Xlint:unchecked</compilerArgument> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.jilongda.applet; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | |
| | | /** |
| | | * @Description 启动类 |
| | | * @Author xiaochen |
| | | * @Date 2022/6/8 17:33 |
| | | */ |
| | | @Slf4j |
| | | @ComponentScan(basePackages = "com.jilongda") |
| | | @MapperScan({"com.jilongda.applet.mapper"}) |
| | | @EnableTransactionManagement |
| | | @SpringBootApplication |
| | | public class AppletApplication { |
| | | |
| | | public static void main(String[] args) throws UnknownHostException { |
| | | ConfigurableApplicationContext application = SpringApplication.run(AppletApplication.class, args); |
| | | Environment env = application.getEnvironment(); |
| | | log.info("\n----------------------------------------------------------\n\t" + |
| | | "应用 '{}' 运行成功! 访问连接:\n\t" + |
| | | "Swagger文档: \t\thttp://{}:{}/doc.html\n" + |
| | | "----------------------------------------------------------", |
| | | env.getProperty("spring.application.name", "小程序"), |
| | | InetAddress.getLocalHost().getHostAddress(), |
| | | env.getProperty("server.port", "8088")); |
| | | } |
| | | |
| | | @Bean |
| | | public PasswordEncoder passwordEncoder() { |
| | | return new BCryptPasswordEncoder(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.aspect; |
| | | |
| | | |
| | | import com.jilongda.applet.config.GlobalResultEnum; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.utils.LoginInfoUtil; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import com.jilongda.common.exception.TokenException; |
| | | import com.jilongda.common.exception.UserException; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | @Aspect |
| | | @Component |
| | | |
| | | public class StateAspect { |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Pointcut("execution(* com.jilongda.applet.controller.*.*(..)) && !execution( * com.jilongda.applet.controller.LoginController.*(..)) && !execution(* com.jilongda.applet.controller.TGoodsController.getConfigById(..))") |
| | | public void state(){ |
| | | |
| | | } |
| | | |
| | | @Before("state()") |
| | | public void isfrozen(){ |
| | | |
| | | SecUser loginUser = loginInfoUtil.getLoginUser(); |
| | | if (loginUser==null){ |
| | | throw new TokenException("当前账号已被删除"); |
| | | } |
| | | |
| | | if (loginUser.getState()){ |
| | | throw new TokenException("账号已冻结"); |
| | | } |
| | | |
| | | System.err.println("进入切面"); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.security.SecurityUserDetails; |
| | | import com.jilongda.applet.service.SecUserService; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.cache.CaffineCache; |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import com.jilongda.common.security.SecurityUtils; |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | import com.jilongda.common.utils.ResponseUtils; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import com.jilongda.common.exception.TokenException; |
| | | import io.jsonwebtoken.Claims; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.Base64Utils; |
| | | import org.springframework.web.filter.OncePerRequestFilter; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.naming.ldap.PagedResultsControl; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 登录认证检查过滤器 |
| | | * |
| | | * @author xiaochen |
| | | * @date Jun 29, 2020 |
| | | * <p> |
| | | * OncePerRequestFilter是在一次外部请求中只过滤一次。对于服务器内部之间的forward等请求,不会再次执行过滤方法。 |
| | | * <p> |
| | | * 文档参见:https://www.jianshu.com/p/b2aa7dd346a2 |
| | | */ |
| | | @Slf4j |
| | | |
| | | public class AuthenticationFilter1 extends OncePerRequestFilter { |
| | | private final SecurityUtils securityUtils; |
| | | private CaffineCache<String> accessTokenCache; |
| | | public AuthenticationFilter1(SecurityUtils securityUtils) { |
| | | this.securityUtils = securityUtils; |
| | | } |
| | | @Resource |
| | | private SecUserService secUserService; |
| | | |
| | | @Override |
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { |
| | | // 全局异常无法捕捉过滤器异常,需在此处做处理 |
| | | try { |
| | | String token = JwtTokenUtils.getToken(request); |
| | | // 获取摘要信息 |
| | | Claims claims = JwtTokenUtils.getClaimsFromToken(token); |
| | | CaffineCache<String> tokenCache = null; |
| | | if (Objects.nonNull(this.accessTokenCache)) { |
| | | tokenCache = this.accessTokenCache; |
| | | } |
| | | // 如果token被托管 |
| | | if (Objects.nonNull(tokenCache)) { |
| | | String accessToken = tokenCache.getKey(Constant.JWT_TOKEN_KEY_PREFIX + claims.getSubject()); |
| | | if (Objects.isNull(accessToken)) { |
| | | throw new TokenException(com.jilongda.common.swagger.GlobalResultEnum.TOKEN_EXPIRE.getCode(), com.jilongda.common.swagger.GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } |
| | | accessToken = new String(Base64Utils.decode(accessToken.getBytes())); |
| | | if (!token.equals(accessToken)) { |
| | | throw new TokenException(com.jilongda.common.swagger.GlobalResultEnum.TOKEN_EXPIRE.getCode(), GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } |
| | | } |
| | | Authentication authentication = JwtTokenUtils.getAuthenticatione(token); |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | |
| | | Object principal = authentication.getPrincipal(); |
| | | String string = principal.toString(); |
| | | SecUser one = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class).eq(SecUser::getPhone, principal.toString())); |
| | | // securityUtils.checkAuthentication(request); |
| | | // chain.doFilter(request, response); |
| | | } catch (Exception e) { |
| | | // 如果是业务异常,需返回状态码 |
| | | if (e instanceof ServiceException) { |
| | | ServiceException e1 = (ServiceException) e; |
| | | ResponseUtils.renderJson(response, ApiResult.failed(e1.getCode(), e.getMessage())); |
| | | } else if (e instanceof TokenException) { |
| | | TokenException e1 = (TokenException) e; |
| | | ResponseUtils.renderJson(response, ApiResult.failed(e1.getCode(), e.getMessage())); |
| | | } else { |
| | | ResponseUtils.renderJson(response, ApiResult.failed(e.getMessage())); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.config; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName: ResultCode |
| | | * @Description: 返回的状态码 |
| | | * @date 2021-12-03 9:26 |
| | | */ |
| | | |
| | | public enum GlobalResultEnum { |
| | | |
| | | /** |
| | | * HTTP接口通信相关 |
| | | */ |
| | | FAIL(500, "操作失败"), |
| | | |
| | | SUCCESS(200, "操作成功"), |
| | | |
| | | /** |
| | | * 账号相关 |
| | | */ |
| | | USER_NOT_EXIST(100, "该用户不存在"), |
| | | |
| | | PHONE_UNLIKE_BIND(101, "手机号非当前用户绑定手机"), |
| | | |
| | | TWICE_PASSWORD_DISAGREED(102, "两次输入密码不一致"), |
| | | |
| | | ACCOUNT_DISABLED(103, "账号已被禁用"), |
| | | |
| | | UPDATE_INIT_PWD(104, "请修改初始密码"), |
| | | |
| | | USER_PASS_ERRO(105, "账户或密码错误"), |
| | | |
| | | /** |
| | | * 资源相关 |
| | | */ |
| | | NOT_FOUND(404, "找不到资源"), |
| | | |
| | | FORBIDDEN(403, "没有访问权限"), |
| | | |
| | | UNAUTHORIZED(401, "未认证,请登录后操作"), |
| | | |
| | | FAIL_AUTHORIZED(405, "认证失败"), |
| | | |
| | | /** |
| | | * 应用相关 |
| | | */ |
| | | ERROR(505, "服务器内部错误"), |
| | | |
| | | APPLY_STOP(502, "应用已停止运行"), |
| | | |
| | | |
| | | /** |
| | | * 会话相关 |
| | | */ |
| | | TOKEN_EXPIRE(401, "请重新登录"), |
| | | TOKEN_PARSE_ERROR(601, "令牌解析错误,请检查令牌是否正确"), |
| | | REF_TOKEN_EXPIRE(602, "刷新令牌过期或无效,请重新登录"), |
| | | LOGIN_EXPIRE(603, "登陆过期,请重新登录"); |
| | | |
| | | |
| | | public int code; |
| | | |
| | | public String message; |
| | | |
| | | GlobalResultEnum(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.config; |
| | | |
| | | import com.jilongda.applet.security.AuthenticationProvider; |
| | | import com.jilongda.applet.security.SysUserDetailsService; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.cache.CaffineCache; |
| | | import com.jilongda.common.redis.RedisAutoTemplate; |
| | | import com.jilongda.common.security.SecurityUtils; |
| | | import com.jilongda.common.security.filter.AuthenticationFilter; |
| | | import com.jilongda.common.security.hadler.SecurityAuthenticationEntryPoint; |
| | | import com.jilongda.common.swagger.SwaggerAutoConfiguration; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | 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.builders.WebSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.config.http.SessionCreationPolicy; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | |
| | | /** |
| | | * 细粒度的访问控制 |
| | | * <p> |
| | | * 注:需要使用注解@EnableGlobalMethodSecurity(prePostEnabled=true) 开启 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | @Configuration |
| | | @EnableWebSecurity |
| | | @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) |
| | | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | private final SecurityAuthenticationEntryPoint securityAuthenticationEntryPoint; |
| | | private final RedisAutoTemplate redisAutoTemplate; |
| | | private final CaffineCache<String> accessTokenCache; |
| | | private final CaffineCache<String> refreshTokenCache; |
| | | private final SysUserDetailsService loadUserDetailsService; |
| | | private final PasswordEncoder passwordEncoder; |
| | | |
| | | @Autowired |
| | | public WebSecurityConfig(SecurityAuthenticationEntryPoint securityAuthenticationEntryPoint, RedisAutoTemplate redisAutoTemplate, CaffineCache<String> accessTokenCache, CaffineCache<String> refreshTokenCache, SysUserDetailsService loadUserDetailsService, PasswordEncoder passwordEncoder) { |
| | | this.securityAuthenticationEntryPoint = securityAuthenticationEntryPoint; |
| | | this.redisAutoTemplate = redisAutoTemplate; |
| | | this.accessTokenCache = accessTokenCache; |
| | | this.refreshTokenCache = refreshTokenCache; |
| | | this.loadUserDetailsService = loadUserDetailsService; |
| | | this.passwordEncoder = passwordEncoder; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 应用重启token无效,可手动使令牌无效,管理了token的生命周期 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public SecurityUtils securityUtils() { |
| | | return new SecurityUtils(accessTokenCache, refreshTokenCache); |
| | | // return new SecurityUtils(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 不需要认证的在此处放行,比如系统的一些字典请求 |
| | | * 会包含Basic认证的请求。意思是如果请求在Basic中存在,在此处也存在,那么该请求的认证会被忽略 |
| | | * 这种方式的优势是不走 Spring Security 过滤器链 |
| | | * |
| | | * @param web |
| | | */ |
| | | @Override |
| | | public void configure(WebSecurity web) { |
| | | web.ignoring().antMatchers(SwaggerAutoConfiguration.DOC_LIST); |
| | | web.ignoring().antMatchers(Constant.APPLET_AUTH_WHITELIST); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用自定义登录身份认证组件,自实现rest登录请求,不适用于在过滤其中实现 在过滤其中无法提供接口文档,维护不方便 |
| | | * |
| | | * @param auth |
| | | */ |
| | | @Override |
| | | public void configure(AuthenticationManagerBuilder auth) { |
| | | auth.authenticationProvider(new AuthenticationProvider(loadUserDetailsService, passwordEncoder)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Security各项配置 |
| | | * |
| | | * @param http |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | // 需要Basic认证的请求 |
| | | http |
| | | .cors().disable() |
| | | // 关闭登录,自定义接口实现 |
| | | .formLogin().disable() |
| | | // 关闭httpBasic认证 |
| | | .httpBasic().disable() |
| | | // 关闭退出,自定义接口实现 |
| | | .logout().disable() |
| | | .csrf().disable() |
| | | // 放在 Cookie 中返回前端,防止跨域伪造 |
| | | //.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).and() |
| | | //.and() |
| | | .authorizeRequests() |
| | | // 跨域预检请求 |
| | | .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() |
| | | // 登录URL permitAll() 无需保护 ---> 此种方式配置忽略认证规则会走Spring Security 过滤器链,在过滤器链中,给请求放行 |
| | | // 不需要保护的请求,但需要经过过滤连 |
| | | //.antMatchers(HttpMethod.POST, "/login").permitAll() |
| | | // 微信登录 |
| | | .antMatchers(HttpMethod.GET, "/**/openId-by-jscode2session/**").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/login").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/code/login").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/sendCode").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/sendPassCode").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/pageResetPassword").permitAll() |
| | | // 其他都需要权限认证 |
| | | .anyRequest() |
| | | .authenticated() |
| | | // 其他所有请求需要身份认证 |
| | | .and() |
| | | // 异常拦截 |
| | | .exceptionHandling() |
| | | // 未授权用户访问无权限时的处理 |
| | | .authenticationEntryPoint(securityAuthenticationEntryPoint); |
| | | // 此处存在session共享的问题,如要共享session,则需要管理 |
| | | http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); |
| | | // 访问控制时登录状态检查过滤器 |
| | | http.addFilterBefore(new AuthenticationFilter(securityUtils()), UsernamePasswordAuthenticationFilter.class); |
| | | // 异常捕捉过滤器,必须在AuthenticationFilter之前才能捕捉到异常信息 |
| | | http.addFilterBefore(new AuthenticationFilter(securityUtils()), AuthenticationFilter.class); |
| | | //禁用缓存 |
| | | http.headers().cacheControl(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 验证管理器,在登录接口时用到 |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Bean |
| | | @Override |
| | | public AuthenticationManager authenticationManager() throws Exception { |
| | | return super.authenticationManager(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.v3.ApiException; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.dingtalk.api.DefaultDingTalkClient; |
| | | import com.dingtalk.api.DingTalkClient; |
| | | import com.dingtalk.api.request.OapiUserGetuserinfoRequest; |
| | | import com.dingtalk.api.request.OapiV2UserGetRequest; |
| | | import com.dingtalk.api.response.OapiUserGetuserinfoResponse; |
| | | import com.dingtalk.api.response.OapiV2UserGetResponse; |
| | | import com.github.xiaoymin.knife4j.core.util.StrUtil; |
| | | import com.jilongda.applet.dto.*; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.security.SecurityUserDetails; |
| | | import com.jilongda.applet.security.SysUserDetailsService; |
| | | import com.jilongda.applet.service.SecUserService; |
| | | import com.jilongda.applet.utils.ALiSendSms; |
| | | import com.jilongda.applet.utils.LoginInfoUtil; |
| | | import com.jilongda.applet.utils.dingding.DingTalkAccessTokenRequest; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import com.jilongda.common.log.OperLoginLog; |
| | | import com.jilongda.common.log.OperationLog; |
| | | import com.jilongda.common.msg.HuaweiCloudSMSUtil; |
| | | import com.jilongda.common.redis.RedisAutoTemplate; |
| | | import com.jilongda.common.security.SecurityUtils; |
| | | import com.jilongda.common.utils.WebUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2021-07-28 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "用户登录相关") |
| | | @RestController |
| | | @RequestMapping("/") |
| | | public class LoginController { |
| | | private final SecurityUtils securityUtils; |
| | | private final AuthenticationManager authenticationManager; |
| | | private final RedisAutoTemplate redisAutoTemplate; |
| | | private final HuaweiCloudSMSUtil msgUtils; |
| | | private final LoginInfoUtil loginInfoUtil; |
| | | private final SysUserDetailsService loadUserDetailsService; |
| | | @Autowired |
| | | private SecUserService secUserService; |
| | | @Autowired |
| | | private PasswordEncoder passwordEncoder; |
| | | |
| | | @Autowired |
| | | public LoginController(SecurityUtils securityUtils, AuthenticationManager authenticationManager, RedisAutoTemplate redisAutoTemplate, HuaweiCloudSMSUtil msgUtils, LoginInfoUtil loginInfoUtil,SysUserDetailsService loadUserDetailsService) { |
| | | this.securityUtils = securityUtils; |
| | | this.authenticationManager = authenticationManager; |
| | | this.redisAutoTemplate = redisAutoTemplate; |
| | | this.msgUtils = msgUtils; |
| | | this.loginInfoUtil = loginInfoUtil; |
| | | this.loadUserDetailsService = loadUserDetailsService; |
| | | } |
| | | |
| | | // @ApiOperation(value = "通过code获得openid") |
| | | // @GetMapping("openId-by-jscode2session/{code}") |
| | | // public ApiResult<Map<String, Object>> jscode2session(@PathVariable("code") String code) { |
| | | //// log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", code); |
| | | //// WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | //// Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(code)); |
| | | //// String openid = body.getOpenid(); |
| | | //// String sessionKey = body.getSessionKey(); |
| | | //// SecUser secUser = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class).eq(SecUser::getOpenId, openid).last("limit 1")); |
| | | //// if (Objects.isNull(secUser)) { |
| | | //// return ApiResult.failed(500, "请绑定账号"); |
| | | //// } |
| | | //// // 提前对sessionKey进行删除 |
| | | //// //redisTemplate.delete(openid); |
| | | //// log.info("换取sessionKey:{}", sessionKey); |
| | | //// // 将sessionKey进行存储,后续获取信息需要 |
| | | //// redisAutoTemplate.setStr(openid, sessionKey); |
| | | // Map<String, Object> tokenInfos = securityUtils.login(null, null, authenticationManager, SecUser.class, 3); |
| | | // return ApiResult.success(tokenInfos); |
| | | // } |
| | | |
| | | // @ApiOperation(value = "账号与小程序进行绑定") |
| | | // @GetMapping("openidBindPhone/{code}/{account}") |
| | | // public ApiResult<String> openidBindPhone(@PathVariable("code") String code, @PathVariable("account") String account) { |
| | | // SecUser secUser = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class).eq(SecUser::getAccount, account).last("limit 1")); |
| | | // Assert.isTrue(!StringUtils.hasLength(secUser.getOpenId()), "该账号已绑定微信"); |
| | | // log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", code); |
| | | // WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | // Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(code)); |
| | | // String openid = body.getOpenid(); |
| | | // // 手机号绑定微信 |
| | | // secUser.setOpenId(openid); |
| | | // secUserService.updateById(secUser); |
| | | // return ApiResult.success(); |
| | | // } |
| | | /** |
| | | * 登录接口 |
| | | */ |
| | | // @OperLoginLog |
| | | // @ApiOperation("用户账号登录") |
| | | // @PostMapping(value = "login") |
| | | // public ApiResult<Map<String, Object>> login(@Validated @RequestBody LoginDTO loginDto) { |
| | | // // 先检验是否登录 |
| | | // String username = loginDto.getAccount(); |
| | | // String password = loginDto.getPassword(); |
| | | // |
| | | // log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", loginDto.getCode()); |
| | | //// WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | //// Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(loginDto.getCode())); |
| | | //// String openid = body.getOpenid(); |
| | | //// loginDto.setOpenId(openid); |
| | | // |
| | | // try { |
| | | // Map<String, Object> token = securityUtils.login(username, password, authenticationManager, SecurityUserDetails.class, 2); |
| | | // return ApiResult.success(token); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // ApiResult<Map<String, Object>> failed = ApiResult.failed(new HashMap<>(1)); |
| | | // failed.setCode(0); |
| | | // failed.setSuccess(false); |
| | | // failed.setMsg(e.getMessage()); |
| | | // return failed; |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 登录接口 |
| | | */ |
| | | @OperLoginLog |
| | | @ApiOperation("后台登录") |
| | | @PostMapping(value = "login") |
| | | public ApiResult<Map<String, Object>> login1(@Validated @RequestBody LoginDTO loginDto) { |
| | | //验证是否通过验证 |
| | | // if (ObjectUtils.isEmpty(loginDto.getVerify()) || !loginDto.getVerify()) { |
| | | // ApiResult<Map<String, Object>> failed = new ApiResult<>(); |
| | | // failed.setMsg("登录失败,请正确验证!"); |
| | | // return failed; |
| | | // } |
| | | // 先检验是否登录 |
| | | String username = loginDto.getPhone(); |
| | | String password = loginDto.getPassword(); |
| | | try { |
| | | SecUser secUser = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class) |
| | | .eq(SecUser::getAccount, loginDto.getPhone())); |
| | | Assert.isTrue(Objects.nonNull(secUser), "该账号不存在"); |
| | | |
| | | |
| | | SecUser one = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class).eq(SecUser::getAccount, username)); |
| | | if (one.getState()){ |
| | | return ApiResult.failed(500, "该账号已被冻结,请联系管理员"); |
| | | } |
| | | |
| | | |
| | | Map<String, Object> token = securityUtils.login(username, password, authenticationManager, SecurityUserDetails.class, 1); |
| | | return ApiResult.success(token); |
| | | } catch (Exception e) { |
| | | ApiResult<Map<String, Object>> failed = ApiResult.failed(new HashMap<>(1)); |
| | | failed.setCode(0); |
| | | failed.setSuccess(false); |
| | | failed.setMsg(e.getMessage()); |
| | | return failed; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 登录接口 |
| | | */ |
| | | // @OperLoginLog |
| | | // @ApiOperation("选择用户账号登录") |
| | | // @PostMapping(value = "choose-login") |
| | | // public ApiResult<Map<String, Object>> chooseLogin(@Validated @RequestBody LoginDTO loginDto) { |
| | | // 先检验是否登录 |
| | | // String username = loginDto.getAccount(); |
| | | // |
| | | //// SecUser one = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class) |
| | | //// .eq(SecUser::getAccount, username)); |
| | | // |
| | | // log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", loginDto.getCode()); |
| | | // WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | // Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(loginDto.getCode())); |
| | | // String openid = body.getOpenid(); |
| | | // loginDto.setOpenId(openid); |
| | | // |
| | | // try { |
| | | // Map<String, Object> token = securityUtils.login(username, one, authenticationManager, SecUser.class, 2); |
| | | // |
| | | // //保存登录记录 |
| | | // try { |
| | | // loginRecordService.saveNew((SecurityUserDetails) token.get("userInfo")); |
| | | // } catch (Exception e) { |
| | | // log.error("登录记录失败!"); |
| | | // } |
| | | // |
| | | // return ApiResult.success(token); |
| | | // } catch (Exception e) { |
| | | // ApiResult<Map<String, Object>> failed = ApiResult.failed(new HashMap<>(1)); |
| | | // failed.setCode(0); |
| | | // failed.setSuccess(false); |
| | | // failed.setMsg(e.getMessage()); |
| | | // return failed; |
| | | // } |
| | | // return ApiResult.success(new HashMap<>()); |
| | | // } |
| | | |
| | | /** |
| | | * 登录接口 |
| | | */ |
| | | // @ApiOperation("短信登录") |
| | | // @PostMapping(value = "code/login") |
| | | // public ApiResult<List<SecUser>> loginByCode(@Validated @RequestBody LoginCodeDTO dto) { |
| | | // // 先检验是否登录 |
| | | // String phone = dto.getPhone(); |
| | | // String code = dto.getCode(); |
| | | // // 校验验证码是否正确 |
| | | // String redisCode = redisAutoTemplate.getStr(dto.getPhone()); |
| | | // Assert.isTrue(StringUtils.hasLength(redisCode), "验证码已过期"); |
| | | // if (!code.equals(redisCode)) { |
| | | // throw new ServiceException(500, "验证码错误,请重新输入验证码!"); |
| | | // } |
| | | // try { |
| | | //// List<SecUser> list = secUserService.list(Wrappers.lambdaQuery(SecUser.class) |
| | | //// .eq(SecUser::getPhone, phone)); |
| | | //// list = list.stream().filter(o -> !o.getShortName().contains("admin")).collect(Collectors.toList()); |
| | | //// Map<String, Object> token = securityUtils.login(phone, code, authenticationManager, SecurityUserDetails.class, true); |
| | | // //保存登录记录 |
| | | // return ApiResult.success(new ArrayList<>()); |
| | | // } catch (Exception e) { |
| | | // ApiResult<List<SecUser>> failed = ApiResult.failed(new ArrayList<>(1)); |
| | | // failed.setCode(0); |
| | | // failed.setSuccess(false); |
| | | // failed.setMsg(e.getMessage()); |
| | | // return failed; |
| | | // } |
| | | // } |
| | | |
| | | @ApiOperation("发送验证码") |
| | | @PostMapping(value = "sendCode") |
| | | public ApiResult<String> sendCode(@RequestBody VerificationCodeDTO dto) throws ClientException { |
| | | |
| | | // 账号查询用户 |
| | | SecUser secUser = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class) |
| | | .eq(SecUser::getAccount, dto.getPhone())); |
| | | Assert.isTrue(Objects.nonNull(secUser), "该账号不存在"); |
| | | |
| | | // 发送验证码并存储到redis |
| | | if (StringUtils.hasLength(dto.getPhone())) { |
| | | if(!loginInfoUtil.checkPhoneExits(dto.getPhone())){ |
| | | throw new ServiceException("无效手机号码"); |
| | | } |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | //TODO 临时验证码,短信未开通前测试用 |
| | | // code = "666666"; |
| | | redisAutoTemplate.setStr("code:"+dto.getPhone(), code); |
| | | redisAutoTemplate.expire(dto.getPhone(), Constant.REDIS_EXPIRE); |
| | | // msgUtils.sendSMS(dto.getPhone(), code); |
| | | |
| | | AliSms aliSms =new AliSms(); |
| | | aliSms.setCode(code); |
| | | aliSms.setProduct(dto.getPhone()); |
| | | String json = JSONObject.toJSONString(aliSms); |
| | | aLiSendSms.sendSms(dto.getPhone(), "SMS_58880127", json); |
| | | |
| | | return ApiResult.success("发送短信验证码成功!15分钟内有效"); |
| | | } |
| | | return ApiResult.failed(500, "发送短信验证码失败,请确认手机号码!"); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("发送修改密码验证码") |
| | | @PostMapping(value = "sendPassCode") |
| | | public ApiResult<String> sendPassCode(@RequestBody VerificationCodeDTO dto) throws ClientException { |
| | | |
| | | // 账号查询用户 |
| | | SecUser secUser = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class) |
| | | .eq(SecUser::getAccount, dto.getPhone())); |
| | | Assert.isTrue(Objects.nonNull(secUser), "该账号不存在"); |
| | | |
| | | // 发送验证码并存储到redis |
| | | if (StringUtils.hasLength(dto.getPhone())) { |
| | | if(!loginInfoUtil.checkPhoneExits(dto.getPhone())){ |
| | | throw new ServiceException("无效手机号码"); |
| | | } |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | //TODO 临时验证码,短信未开通前测试用 |
| | | // code = "666666"; |
| | | redisAutoTemplate.setStr("code:"+dto.getPhone(), code); |
| | | redisAutoTemplate.expire(dto.getPhone(), Constant.REDIS_EXPIRE); |
| | | // msgUtils.sendSMS(dto.getPhone(), code); |
| | | |
| | | AliSms aliSms =new AliSms(); |
| | | aliSms.setCode(code); |
| | | aliSms.setProduct(dto.getPhone()); |
| | | String json = JSONObject.toJSONString(aliSms); |
| | | aLiSendSms.sendSms(dto.getPhone(), "SMS_58880123", json); |
| | | |
| | | return ApiResult.success("发送短信验证码成功!15分钟内有效"); |
| | | } |
| | | return ApiResult.failed(500, "发送短信验证码失败,请确认手机号码!"); |
| | | } |
| | | |
| | | |
| | | @OperLoginLog |
| | | @ApiOperation("短信登录") |
| | | @PostMapping(value = "code/login") |
| | | public ApiResult<Map<String, Object>> loginByCode(@Validated @RequestBody LoginCodeDTO dto) { |
| | | String phone = dto.getPhone(); |
| | | String code = dto.getCode(); |
| | | // 校验验证码是否正确 |
| | | if(!redisAutoTemplate.hasKey("code:"+phone)){ |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | String redisCode = redisAutoTemplate.getStr("code:"+phone); |
| | | if (!code.equals(redisCode)) { |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | try { |
| | | |
| | | SecUser one = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class).eq(SecUser::getAccount, phone)); |
| | | if (Objects.isNull(one)){ |
| | | return ApiResult.failed(500, "请输入正确的账号"); |
| | | } |
| | | if (one.getState()){ |
| | | return ApiResult.failed(500, "该账号已被冻结,请联系管理员"); |
| | | } |
| | | |
| | | Map<String, Object> token = securityUtils.login(phone, code, authenticationManager, SecurityUserDetails.class, 2); |
| | | SecurityUserDetails userDetails = loadUserDetailsService.loadUserByUsername(phone); |
| | | token.put("userInfo", userDetails); |
| | | return ApiResult.success(token); |
| | | } catch (Exception e) { |
| | | ApiResult<Map<String, Object>> failed = ApiResult.failed(new HashMap<>(1)); |
| | | failed.setCode(0); |
| | | failed.setSuccess(false); |
| | | failed.setMsg(e.getMessage()); |
| | | return failed; |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("退出登录") |
| | | @GetMapping("logout") |
| | | public ApiResult<String> logout() { |
| | | boolean flag = securityUtils.invalidateToken(WebUtils.request()); |
| | | if (flag) { |
| | | return ApiResult.success("退出成功"); |
| | | } |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @OperationLog(operType = "修改", operDesc = "密码修改", operModul = "用户") |
| | | @ApiOperation("首页密码修改") |
| | | @PostMapping("/pageResetPassword") |
| | | public ApiResult<String> pageResetPassword(@Validated @RequestBody ResetPasswordDTO dto) { |
| | | // 账号查询用户 |
| | | SecUser secUser = secUserService.getOne(Wrappers.lambdaQuery(SecUser.class) |
| | | .eq(SecUser::getPhone, dto.getPhone())); |
| | | Assert.isTrue(Objects.nonNull(secUser), "该账号不存在"); |
| | | |
| | | // 校验短信验证码 |
| | | String str = redisAutoTemplate.getStr("code:"+secUser.getPhone()); |
| | | if(!StringUtils.hasLength(str)){ |
| | | return ApiResult.failed("验证码已过期!"); |
| | | } |
| | | if(!str.equals(dto.getCode())){ |
| | | return ApiResult.failed("验证码错误"); |
| | | } |
| | | |
| | | // if (StrUtil.isNotBlank(dto.getPassword())) { |
| | | // // 根据加密算法加密用户输入的密码,然后和数据库中保存的密码进行比较 |
| | | // if (!this.passwordEncoder.matches(dto.getOldPassword(), secUser.getPassword())) { |
| | | // throw new BadCredentialsException("输入原密码不正确"); |
| | | // } |
| | | // 修改密码 |
| | | secUser.setPassword(passwordEncoder.encode(dto.getPassword())); |
| | | // } else { |
| | | // // 重置密码 |
| | | // secUser.setPassword(passwordEncoder.encode(Constant.DEF_PASSWORD)); |
| | | // } |
| | | secUserService.updateById(secUser); |
| | | return ApiResult.success(); |
| | | } |
| | | @ApiOperation("钉钉登录") |
| | | @RequestMapping(value = "/dingding", method = RequestMethod.GET) |
| | | public ApiResult login (@RequestParam("code") String requestAuthCode) throws Exception { |
| | | |
| | | |
| | | OapiUserGetuserinfoResponse response; |
| | | |
| | | String accessTokenRequest = DingTalkAccessTokenRequest.getAccessTokenRequest(); |
| | | String access_token = accessTokenRequest; |
| | | try { |
| | | |
| | | // |
| | | |
| | | // 获取用户信息 |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/getuserinfo"); |
| | | OapiUserGetuserinfoRequest request = new OapiUserGetuserinfoRequest(); |
| | | request.setCode(requestAuthCode); |
| | | request.setHttpMethod("GET"); |
| | | |
| | | response = client.execute(request, access_token); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | // 查询得到当前用户的userId |
| | | // 获得到userId之后应用应该处理应用自身的登录会话管理(session),避免后续的业务交互(前端到应用服务端)每次都要重新获取用户身份,提升用户体验 |
| | | String userId = response.getUserid(); |
| | | Map<String, Object> returnMap = new HashMap<String,Object>(); |
| | | returnMap.put("userId", userId); |
| | | // return ServiceResult.success(returnMap); |
| | | |
| | | |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get"); |
| | | OapiV2UserGetRequest req = new OapiV2UserGetRequest(); |
| | | req.setUserid(userId); |
| | | OapiV2UserGetResponse rsp = client.execute(req, access_token); |
| | | System.out.println(rsp.getBody()); |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | // @ApiOperation(value = "发送验证码", notes = "发送验证码") |
| | | // @PostMapping(value = "sendMsg") |
| | | // public ApiResult<String> sendMsg(@RequestBody VerificationCodeDTO dto) throws Exception { |
| | | // // 发送验证码并存储到redis |
| | | // if (StringUtils.hasLength(dto.getPhone())) { |
| | | // String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | // redisAutoTemplate.setStr(dto.getPhone(), code); |
| | | // redisAutoTemplate.expire(dto.getPhone(), Constant.REDIS_EXPIRE); |
| | | // AliSms aliSms =new AliSms(); |
| | | // aliSms.setCode(code); |
| | | // aliSms.setProduct(dto.getPhone()); |
| | | // String json = JSONObject.toJSONString(aliSms); |
| | | // aLiSendSms.sendSms(dto.getPhone(), "SMS_58880127", json); |
| | | // return ApiResult.success("发送短信验证码成功!15分钟内有效"); |
| | | // } |
| | | // return ApiResult.failed(500, "发送短信验证码失败,请确认手机号码!"); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-收费项设置 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-fee-items") |
| | | public class SecFeeItemsController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资源表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-resources") |
| | | public class SecResourcesController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-role") |
| | | public class SecRoleController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-role-resource") |
| | | public class SecRoleResourceController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-setting") |
| | | public class SecSettingController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-user") |
| | | public class SecUserController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sec-user-role") |
| | | public class SecUserRoleController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-app-user") |
| | | public class TAppUserController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-brand") |
| | | public class TBrandController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券领取记录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-coupon") |
| | | public class TCouponController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-coupon-receive") |
| | | public class TCouponReceiveController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架出库入库详细表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-frame-warehousing-detail") |
| | | public class TFrameWarehousingDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 盘点表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-inventory") |
| | | public class TInventoryController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 材质表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-inventory-frame-detail") |
| | | public class TInventoryFrameDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架盘点详细表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-inventory-lens-detail") |
| | | public class TInventoryLensDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片系列表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-lens-series") |
| | | public class TLensSeriesController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片出库入库明细表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-lens-warehousing-detail") |
| | | public class TLensWarehousingDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 排号管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-line-up") |
| | | public class TLineUpController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-material") |
| | | public class TMaterialController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架型号表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-model") |
| | | public class TModelController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光师表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-optometrist") |
| | | public class TOptometristController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-optometry") |
| | | public class TOptometryController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单详情 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-optometry-detail") |
| | | public class TOptometryDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单核算表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-order-accounting") |
| | | public class TOrderAccountingController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单售后表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-order-aftersales") |
| | | public class TOrderAftersalesController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售订单表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-order") |
| | | public class TOrderController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 门店表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-store") |
| | | public class TStoreController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供应商 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-supplier") |
| | | public class TSupplierController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 小票机 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-ticket") |
| | | public class TTicketController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.service.SecUserService; |
| | | import com.jilongda.applet.utils.LoginInfoUtil; |
| | | import com.jilongda.applet.vo.AppOrderVO; |
| | | import com.jilongda.applet.vo.AppUserVO; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.model.TCustomers; |
| | | import com.jilongda.common.security.SecurityUtils; |
| | | import com.jilongda.common.utils.WebUtils; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-user") |
| | | public class TUserController { |
| | | |
| | | @Autowired |
| | | private SecUserService secUserService; |
| | | |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | |
| | | @Autowired |
| | | private SecurityUtils securityUtils; |
| | | |
| | | @ApiOperation(value = "获取登录用户信息") |
| | | @GetMapping(value = "/getUserDetail") |
| | | public ApiResult<AppUserVO> getUserDetail() { |
| | | SecUser user = loginInfoUtil.getLoginUser(); |
| | | AppUserVO result = new AppUserVO(); |
| | | BeanUtils.copyProperties(user, result); |
| | | return ApiResult.success(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改头像",tags = "主页") |
| | | @PostMapping(value = "/changeAdva" ) |
| | | public ApiResult changeAdva(String advatar) { |
| | | SecUser user = loginInfoUtil.getLoginUser(); |
| | | user.setAvatarUrl(advatar); |
| | | secUserService.updateById(user); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("注销用户") |
| | | @GetMapping("/logoff") |
| | | public ApiResult<String> logoff() { |
| | | loginInfoUtil.logoff(); |
| | | boolean flag = securityUtils.invalidateToken(WebUtils.request()); |
| | | // if (flag) { |
| | | // return ApiResult.success("注销成功"); |
| | | // } |
| | | |
| | | SecUser secUser = loginInfoUtil.getLoginUser(); |
| | | if (Constant.ADMIN.equals(secUser.getAccount())) { |
| | | return ApiResult.failed(500, "超级管理员不可删除"); |
| | | } |
| | | if (Constant.TRAIN.equals(secUser.getAccount())) { |
| | | return ApiResult.failed(500, "培训管理员不可删除"); |
| | | } |
| | | secUserService.removeById(secUser.getId()); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片出库入库表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-warehousing") |
| | | public class TWarehousingController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AliSms { |
| | | private String code; |
| | | private String product; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import com.jilongda.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName AppCustomerListDTO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/17 9:36 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @ApiModel("客户收货地址列表") |
| | | public class AppCustomerPageDTO extends BasePage { |
| | | |
| | | @ApiModelProperty("搜索词") |
| | | private String keyword; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName AppGoodsSPecDTO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/22 14:41 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppGoodsSpecDTO { |
| | | |
| | | @ApiModelProperty(value = "产品id") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "剂型 1=粉剂,2=颗粒,3=液体") |
| | | private Integer goodsDosage; |
| | | |
| | | @ApiModelProperty(value = "含量") |
| | | private String goodsContent; |
| | | |
| | | @ApiModelProperty(value = "规格") |
| | | private String goodsSpecifications; |
| | | |
| | | @ApiModelProperty(value = "userId",hidden = true) |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "userType",hidden = true) |
| | | private Integer userType; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.jilongda.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @ClassName AppOrderPageDTO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/17 14:41 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppOrderPageDTO extends BasePage { |
| | | |
| | | @ApiModelProperty("订单状态(1待审批,2已通过,3已拒绝,4待发货,5已发货,6.已撤回,7已通过已拒绝)") |
| | | private Integer orderStatus; |
| | | |
| | | @ApiModelProperty("订单类型(1我提交审批订单,2需要我审批订单)") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty(value = "用户id",hidden = true) |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "用户类型",hidden = true) |
| | | private Integer userType; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName AppAuditOrderDTO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/17 17:01 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppPassOrderDTO { |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "审核1通过2拒绝") |
| | | private Integer passType; |
| | | |
| | | @ApiModelProperty(value = "审核备注") |
| | | private String passRemark; |
| | | |
| | | @ApiModelProperty(value = "用户id",hidden = true) |
| | | private Long userId; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class Btn implements Serializable { |
| | | private String title; |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/27/02715:49 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "短信验证码登录") |
| | | public class LoginCodeDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @NotBlank(message = "手机号不能为空") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "验证码") |
| | | @NotBlank(message = "验证码不能为空") |
| | | private String code; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName LoginDto |
| | | * @Description |
| | | * @date 2020-08-20 17:52 |
| | | */ |
| | | @Data |
| | | @ApiModel("登录相关dto") |
| | | public class LoginDTO { |
| | | private String code; |
| | | |
| | | private String openId; |
| | | |
| | | @NotBlank(message = "账号不能为空") |
| | | private String phone; |
| | | |
| | | private String password; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class Meta implements Serializable { |
| | | private String title; |
| | | private String parent; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/10/17 14:20 |
| | | */ |
| | | @Data |
| | | public class ResetPasswordDTO { |
| | | @ApiModelProperty(value = "账号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "新密码") |
| | | // @Length(min = 6, max = 16, message = "密码长度在8-16之间") |
| | | private String password; |
| | | @ApiModelProperty(value = "旧密码") |
| | | private String oldPassword; |
| | | private String id; |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | |
| | | import com.jilongda.applet.model.SecResources; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName SysResDTO |
| | | * @Description |
| | | * @date 2021-04-20 10:25 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @ApiModel("资源dto") |
| | | public class SecResDTO extends SecResources { |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import com.jilongda.applet.model.SecRole; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 11:35 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @ApiModel("角色dto") |
| | | public class SecRoleDTO extends SecRole { |
| | | /** |
| | | * 角色id |
| | | */ |
| | | @ApiModelProperty("角色id") |
| | | private Long rid; |
| | | /** |
| | | * 资源列表 |
| | | */ |
| | | @ApiModelProperty("资源列表集合") |
| | | private List<Long> resourceIds; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 11:35 |
| | | */ |
| | | @Data |
| | | @ApiModel("角色赋予资源dto") |
| | | public class SecRoleResDTO { |
| | | /** |
| | | * 角色id |
| | | */ |
| | | @ApiModelProperty("角色id") |
| | | private Long rid; |
| | | /** |
| | | * 资源列表 |
| | | */ |
| | | @ApiModelProperty("资源列表集合") |
| | | private List<Long> resourceIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import com.jilongda.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 11:25 |
| | | */ |
| | | @Data |
| | | @ApiModel("角色列表dto请求体") |
| | | public class SecRolesDTO extends BasePage { |
| | | @ApiModelProperty("角色名称") |
| | | private String rolename; |
| | | |
| | | @ApiModelProperty(value = "角色状态") |
| | | private Boolean roleState; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | |
| | | import com.jilongda.applet.model.SecUser; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 10:59 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @ApiModel("管理员账号dto") |
| | | public class SecUserDTO extends SecUser { |
| | | |
| | | @ApiModelProperty("角色id") |
| | | private Long roleId; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | import com.jilongda.common.dto.TimeRangePageDTO; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 10:59 |
| | | */ |
| | | @Data |
| | | @ApiModel("用户查询dto") |
| | | @JsonIgnoreProperties({BaseModel.UPDATE_TIME}) |
| | | public class SecUserQueryDTO extends TimeRangePageDTO { |
| | | |
| | | @ApiModelProperty("角色id") |
| | | private Long id; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/29/0299:31 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "人员绑定角色DTO") |
| | | public class SecUserRoleDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "人员id集合") |
| | | private List<Long> userIds; |
| | | |
| | | @ApiModelProperty(value = "角色id") |
| | | @NotBlank(message = "角色不可为空") |
| | | private Long roleId; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import com.jilongda.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员列表dto对象 |
| | | * </p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 10:18 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @ApiModel("管理员列表dto对象") |
| | | public class SecUsersDTO extends BasePage { |
| | | @ApiModelProperty("姓名") |
| | | private String shortName; |
| | | @ApiModelProperty("联系方式") |
| | | private String phone; |
| | | @ApiModelProperty("登陆账号") |
| | | private String account; |
| | | @ApiModelProperty("人员角色") |
| | | private String rolename; |
| | | @ApiModelProperty("人员角色id") |
| | | private Long roleId; |
| | | @ApiModelProperty("状态 true = 禁用 ") |
| | | private Boolean state; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SysSourcesDTO implements Serializable { |
| | | private String icon; |
| | | |
| | | private String path; |
| | | |
| | | private String name; |
| | | |
| | | private String component; |
| | | |
| | | private Boolean hidden; |
| | | |
| | | private Meta meta; |
| | | |
| | | private List<Btn> btn; |
| | | |
| | | private List<SysSourcesDTO> children; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SysSourcesListDTO implements Serializable { |
| | | private List<SysSourcesDTO> menus; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Pattern; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/27/02715:33 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "验证码") |
| | | public class VerificationCodeDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @NotBlank(message = "请输入手机号") |
| | | @Length(min = 11, max = 11, message = "手机号只能为11位") |
| | | @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误") |
| | | private String phone; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.log; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.jilongda.applet.security.SecurityUserDetails; |
| | | import com.jilongda.applet.security.SysUserDetailsService; |
| | | import com.jilongda.applet.service.LoginLogService; |
| | | import com.jilongda.common.log.OperLoginLog; |
| | | import com.jilongda.common.log.ParamParser; |
| | | import com.jilongda.common.model.LoginLog; |
| | | import com.jilongda.common.utils.IPUtil; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.AfterReturning; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.AnonymousAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Parameter; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 切面处理类,登录日志记录处理 |
| | | * |
| | | * @author xiaochen |
| | | * @date 2021/12/21 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class LoginLogAspect { |
| | | |
| | | @Autowired |
| | | private LoginLogService loginLogService; |
| | | @Autowired |
| | | private SysUserDetailsService loadUserDetailsService; |
| | | |
| | | /** |
| | | * 设置操作日志切入点 记录登录日志 在注解的位置切入代码 |
| | | */ |
| | | @Pointcut("@annotation(com.jilongda.common.log.OperLoginLog)") |
| | | public void operLoginLogPoinCut() { |
| | | } |
| | | |
| | | /** |
| | | * 正常返回通知,拦截用户登录日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行 |
| | | * |
| | | * @param joinPoint 切入点 |
| | | * @param keys 返回结果 |
| | | */ |
| | | @AfterReturning(value = "operLoginLogPoinCut()", returning = "keys") |
| | | public void saveOperLog(JoinPoint joinPoint, Object keys) { |
| | | // 获取RequestAttributes |
| | | RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); |
| | | // 从获取RequestAttributes中获取HttpServletRequest的信息 |
| | | HttpServletRequest request = (HttpServletRequest) requestAttributes |
| | | .resolveReference(RequestAttributes.REFERENCE_REQUEST); |
| | | |
| | | LoginLog operLoginLog = new LoginLog(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | try { |
| | | // 从切面织入点处通过反射机制获取织入点处的方法 |
| | | MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
| | | // 获取切入点所在的方法 |
| | | Method method = signature.getMethod(); |
| | | // 获取操作 |
| | | OperLoginLog opLog = method.getAnnotation(OperLoginLog.class); |
| | | |
| | | // 操作简述绑定参数 |
| | | Object paramParserObj = null; |
| | | String requestArgs; |
| | | Parameter[] parameters = method.getParameters(); |
| | | if (parameters != null && parameters.length > 0) { |
| | | for (int i = 0; i < parameters.length; i++) { |
| | | ParamParser an = parameters[i].getDeclaredAnnotation(ParamParser.class); |
| | | if (an != null) { |
| | | paramParserObj = an.value(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // 不止一个参数 |
| | | if (paramParserObj != null) { |
| | | requestArgs = sb.append(":").append(paramParserObj).toString(); |
| | | } else { |
| | | requestArgs = JSONObject.toJSONString(joinPoint.getArgs()); |
| | | } |
| | | |
| | | // 获取openid |
| | | String openId = JSONObject.parseArray(requestArgs).getJSONObject(0).getString("openId"); |
| | | operLoginLog.setOpenId(openId); |
| | | |
| | | // 获取当前登录用户信息 |
| | | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| | | String userName = null; |
| | | // if (!(authentication instanceof AnonymousAuthenticationToken)) { |
| | | // userName = authentication.getName(); |
| | | // } |
| | | |
| | | if (StringUtils.hasLength(userName)) { |
| | | // 通过用户名查询该账号信息 |
| | | SecurityUserDetails userDetails = loadUserDetailsService.loadUserByUsername(userName); |
| | | // operLoginLog.setUserName(userDetails.getShortName()); // 请求用户名称 |
| | | // operLoginLog.setAccount(userDetails.getAccount()); // 请求账号 |
| | | } |
| | | String ip = IPUtil.getIpAddress(request); |
| | | operLoginLog.setLoginIp(ip); // 请求IP |
| | | // operLoginLog.setLoginAddress(IPAddressUtil.getRealAddress(ip)); // 登录地址,目前服务器带不动 |
| | | String address = IPUtil.getUserLocationByIp(); |
| | | operLoginLog.setLoginAddress(address); |
| | | operLoginLog.setWorkAddress(address); // 工作地 |
| | | operLoginLog.setLoginTime(LocalDateTime.now()); // 登录时间 |
| | | Long id = IdWorker.getId(); |
| | | operLoginLog.setId(id); |
| | | loginLogService.save(operLoginLog); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转换request 请求参数 |
| | | * |
| | | * @param paramMap request获取的参数数组 |
| | | */ |
| | | public Map<String, String> converMap(Map<String, String[]> paramMap) { |
| | | Map<String, String> rtnMap = new HashMap<String, String>(); |
| | | for (String key : paramMap.keySet()) { |
| | | rtnMap.put(key, paramMap.get(key)[0]); |
| | | } |
| | | return rtnMap; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.jilongda.common.model.LoginLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | public interface LoginLogMapper extends BaseMapper<LoginLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecFeeItems; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-收费项设置 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecFeeItemsMapper extends BaseMapper<SecFeeItems> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecResources; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资源表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecResourcesMapper extends BaseMapper<SecResources> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecRole; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecRoleMapper extends BaseMapper<SecRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecRoleResource; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecRoleResourceMapper extends BaseMapper<SecRoleResource> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecSetting; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecSettingMapper extends BaseMapper<SecSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecUserMapper extends BaseMapper<SecUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.SecUserRole; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecUserRoleMapper extends BaseMapper<SecUserRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TAppUser; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TAppUserMapper extends BaseMapper<TAppUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TBrand; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TBrandMapper extends BaseMapper<TBrand> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TCoupon; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券领取记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TCouponMapper extends BaseMapper<TCoupon> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TCouponReceive; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TCouponReceiveMapper extends BaseMapper<TCouponReceive> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TFrameWarehousingDetail; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架出库入库详细表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TFrameWarehousingDetailMapper extends BaseMapper<TFrameWarehousingDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TInventoryFrameDetail; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 材质表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TInventoryFrameDetailMapper extends BaseMapper<TInventoryFrameDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TInventoryLensDetail; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架盘点详细表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TInventoryLensDetailMapper extends BaseMapper<TInventoryLensDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TInventory; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 盘点表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TInventoryMapper extends BaseMapper<TInventory> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TLensSeries; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片系列表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TLensSeriesMapper extends BaseMapper<TLensSeries> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TLensWarehousingDetail; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片出库入库明细表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TLensWarehousingDetailMapper extends BaseMapper<TLensWarehousingDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TLineUp; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 排号管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TLineUpMapper extends BaseMapper<TLineUp> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TMaterial; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TMaterialMapper extends BaseMapper<TMaterial> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TModel; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架型号表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TModelMapper extends BaseMapper<TModel> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TOptometrist; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光师表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOptometristMapper extends BaseMapper<TOptometrist> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TOptometryDetail; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单详情 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOptometryDetailMapper extends BaseMapper<TOptometryDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TOptometry; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOptometryMapper extends BaseMapper<TOptometry> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TOrderAccounting; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单核算表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOrderAccountingMapper extends BaseMapper<TOrderAccounting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TOrderAftersales; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单售后表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOrderAftersalesMapper extends BaseMapper<TOrderAftersales> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TOrder; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售订单表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOrderMapper extends BaseMapper<TOrder> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TStore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 门店表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TStoreMapper extends BaseMapper<TStore> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TSupplier; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供应商 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TSupplierMapper extends BaseMapper<TSupplier> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TTicket; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 小票机 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TTicketMapper extends BaseMapper<TTicket> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.jilongda.common.model.TUser; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | public interface TUserMapper extends BaseMapper<TUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.mapper; |
| | | |
| | | import com.jilongda.applet.model.TWarehousing; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片出库入库表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TWarehousingMapper extends BaseMapper<TWarehousing> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-收费项设置 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_fee_items") |
| | | @ApiModel(value="SecFeeItems对象", description="系统设置-收费项设置 ") |
| | | public class SecFeeItems implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "收费项名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "手续费比例") |
| | | @TableField("percent") |
| | | private BigDecimal percent; |
| | | |
| | | @ApiModelProperty(value = "状态 1启用 2禁用") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资源表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_resources") |
| | | @ApiModel(value="SecResources对象", description="资源表") |
| | | public class SecResources implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "父级id") |
| | | @TableField("parent_id") |
| | | private String parentId; |
| | | |
| | | @ApiModelProperty(value = "资源名") |
| | | @TableField("title") |
| | | private String title; |
| | | |
| | | @ApiModelProperty(value = "资源描述") |
| | | @TableField("descriptions") |
| | | private String descriptions; |
| | | |
| | | @ApiModelProperty(value = "排序,数字越大越靠后,最小值为0,最大值为100000") |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty(value = "菜单或按钮图标") |
| | | @TableField("icon") |
| | | private String icon; |
| | | |
| | | @ApiModelProperty(value = "前端页面名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "menu") |
| | | @TableField("menu") |
| | | private String menu; |
| | | |
| | | @ApiModelProperty(value = "前端文件路径") |
| | | @TableField("component") |
| | | private String component; |
| | | |
| | | @ApiModelProperty(value = "针对请求地址是否允许通过,默认不通过,设为通过则不会校验其权限") |
| | | @TableField("permit") |
| | | private Boolean permit; |
| | | |
| | | @ApiModelProperty(value = "权限类型,页面-1,按钮-2 默认页面") |
| | | @TableField("cate") |
| | | private Integer cate; |
| | | |
| | | @ApiModelProperty(value = "权限类型") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "页面是否隐藏,1是 0否(默认)") |
| | | @TableField("hidden") |
| | | private Boolean hidden; |
| | | |
| | | @ApiModelProperty(value = "1前台 2后台") |
| | | @TableField("env_port") |
| | | private Integer envPort; |
| | | |
| | | @ApiModelProperty(value = "前端页面路径") |
| | | @TableField("path") |
| | | private String path; |
| | | |
| | | @ApiModelProperty(value = "相关接口,多个逗号隔开") |
| | | @TableField("api_url") |
| | | private String apiUrl; |
| | | |
| | | @ApiModelProperty(value = "创建人") |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "创建时间(注册时间)") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改人") |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "是否删除/禁用 1删除 0否(默认)") |
| | | @TableField("isDelete") |
| | | private Boolean isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_role") |
| | | @ApiModel(value="SecRole对象", description="") |
| | | public class SecRole implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户组名称") |
| | | @TableField("rolename") |
| | | private String rolename; |
| | | |
| | | @ApiModelProperty(value = "角色描述") |
| | | @TableField("role_desc") |
| | | private String roleDesc; |
| | | |
| | | @ApiModelProperty(value = "是否启用 1启用 0禁用") |
| | | @TableField("role_state") |
| | | private Boolean roleState; |
| | | |
| | | @ApiModelProperty(value = "创建人") |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "创建时间(注册时间)") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改人") |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "是否删除/禁用 1删除 0否(默认)") |
| | | @TableField("isDelete") |
| | | private Boolean isDelete; |
| | | |
| | | @ApiModelProperty(value = "排序 倒序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_role_resource") |
| | | @ApiModel(value="SecRoleResource对象", description="") |
| | | public class SecRoleResource implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField("role_id") |
| | | private Long roleId; |
| | | |
| | | @TableField("resource_id") |
| | | private Long resourceId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_setting") |
| | | @ApiModel(value="SecSetting对象", description="系统设置 ") |
| | | public class SecSetting implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "镜片警告阈值") |
| | | @TableField("lensThreshold") |
| | | private Integer lensThreshold; |
| | | |
| | | @ApiModelProperty(value = "镜架警告阈值") |
| | | @TableField("frameThreshold") |
| | | private Integer frameThreshold; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_user") |
| | | @ApiModel(value="SecUser对象", description="") |
| | | public class SecUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "账户") |
| | | @TableField("account") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "用户描述") |
| | | @TableField("description") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "密码") |
| | | @TableField("password") |
| | | private String password; |
| | | |
| | | @ApiModelProperty(value = "手机号码") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "账户状态 是否禁用") |
| | | @TableField("state") |
| | | private Boolean state; |
| | | |
| | | @ApiModelProperty(value = "最近一次登陆时间") |
| | | @TableField("last_login_time") |
| | | private LocalDateTime lastLoginTime; |
| | | |
| | | @ApiModelProperty(value = "创建人") |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "创建时间(注册时间)") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改人") |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "是否删除/禁用 1删除 0否(默认)") |
| | | @TableField("isDelete") |
| | | private Boolean isDelete; |
| | | |
| | | @ApiModelProperty(value = "用户昵称") |
| | | @TableField("nick_name") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "头像地址") |
| | | @TableField("avatar_url") |
| | | private String avatarUrl; |
| | | |
| | | @ApiModelProperty(value = "省") |
| | | @TableField("province") |
| | | private String province; |
| | | |
| | | @ApiModelProperty(value = "市") |
| | | @TableField("city") |
| | | private String city; |
| | | |
| | | @ApiModelProperty(value = "区") |
| | | @TableField("area") |
| | | private String area; |
| | | |
| | | @ApiModelProperty(value = "详细地址") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "生日") |
| | | @TableField("birthday") |
| | | private LocalDateTime birthday; |
| | | |
| | | @ApiModelProperty(value = "1男2女0未知") |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | |
| | | @ApiModelProperty(value = "部门id") |
| | | @TableField("deptId") |
| | | private Long deptId; |
| | | |
| | | @ApiModelProperty(value = "类型1平台管理员2验光师") |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | |
| | | @ApiModelProperty(value = "省code") |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | |
| | | @ApiModelProperty(value = "市code") |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty(value = "区code") |
| | | @TableField("areaCode") |
| | | private String areaCode; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("sec_user_role") |
| | | @ApiModel(value="SecUserRole对象", description="") |
| | | public class SecUserRole implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "角色id") |
| | | @TableField("role_id") |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_app_user") |
| | | @ApiModel(value="TAppUser对象", description="用户表") |
| | | public class TAppUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "微信昵称") |
| | | @TableField("name") |
| | | private String name; |
| | | @ApiModelProperty(value = "微信openId") |
| | | @TableField("openId") |
| | | private String openId; |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | @TableField("realName") |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "年龄") |
| | | @TableField("age") |
| | | private Integer age; |
| | | |
| | | @ApiModelProperty(value = "性别1男2女3保密") |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | |
| | | @ApiModelProperty(value = "注册时间") |
| | | @TableField("registerTime") |
| | | private LocalDateTime registerTime; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_brand") |
| | | @ApiModel(value="TBrand对象", description="镜架/镜片品牌表") |
| | | public class TBrand implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "品牌名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "类型 1镜架 2镜片") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "状态 1启用 2禁用") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "是否为主要品牌 1是2否") |
| | | @TableField("isMain") |
| | | private Integer isMain; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券领取记录 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_coupon") |
| | | @ApiModel(value="TCoupon对象", description="优惠券领取记录") |
| | | public class TCoupon implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @TableField("name") |
| | | private Integer name; |
| | | |
| | | @ApiModelProperty(value = "发放方式 1注册发放 2全局发放 3指定发放 4扫码发放") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | @TableField("amount") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value = "门店id 字段为null表示全部") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "有效期(天)最高365") |
| | | @TableField("time") |
| | | private Integer time; |
| | | |
| | | @ApiModelProperty(value = "优惠条件金额 为0则表示通用券") |
| | | @TableField("amountCondition") |
| | | private BigDecimal amountCondition; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "发放状态1发放中 2暂停发放 只有发放方式为1和4的时候存储") |
| | | @TableField("grantStatus") |
| | | private Integer grantStatus; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_coupon_receive") |
| | | @ApiModel(value="TCouponReceive对象", description="优惠券") |
| | | public class TCouponReceive implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "优惠券id") |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "发放方式 1注册发放 2全局发放 3指定发放 4扫码发放") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | @TableField("amount") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value = "门店id 字段为null表示全部") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "有效期截止日期") |
| | | @TableField("endTime") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "优惠条件金额 为0则表示通用券") |
| | | @TableField("amountCondition") |
| | | private BigDecimal amountCondition; |
| | | |
| | | @ApiModelProperty(value = "1待使用 2已使用 3已过期") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架出库入库详细表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_frame_warehousing_detail") |
| | | @ApiModel(value="TFrameWarehousingDetail对象", description="镜架出库入库详细表") |
| | | public class TFrameWarehousingDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "入库出库表id") |
| | | @TableField("warehousingId") |
| | | private Integer warehousingId; |
| | | |
| | | @ApiModelProperty(value = "品牌") |
| | | @TableField("brand") |
| | | private String brand; |
| | | |
| | | @ApiModelProperty(value = "供应商") |
| | | @TableField("supplier") |
| | | private String supplier; |
| | | |
| | | @ApiModelProperty(value = "材质") |
| | | @TableField("material") |
| | | private String material; |
| | | |
| | | @ApiModelProperty(value = "入库/出库总数量") |
| | | @TableField("total") |
| | | private Integer total; |
| | | |
| | | @ApiModelProperty(value = "在库数量(出库没有该字段)") |
| | | @TableField("count") |
| | | private Integer count; |
| | | |
| | | @ApiModelProperty(value = "色号") |
| | | @TableField("color") |
| | | private String color; |
| | | |
| | | @ApiModelProperty(value = "镜架型号") |
| | | @TableField("model") |
| | | private String model; |
| | | |
| | | @ApiModelProperty(value = "入库编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "型号id") |
| | | @TableField("modelId") |
| | | private Integer modelId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 盘点表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_inventory") |
| | | @ApiModel(value="TInventory对象", description="盘点表") |
| | | public class TInventory implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "1型号2品牌3材质4球/柱镜5折射率6系列") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "1镜架2镜片") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 材质表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_inventory_frame_detail") |
| | | @ApiModel(value="TInventoryFrameDetail对象", description="材质表") |
| | | public class TInventoryFrameDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "盘点表id") |
| | | @TableField("inventoryId") |
| | | private Integer inventoryId; |
| | | |
| | | @ApiModelProperty(value = "品牌") |
| | | @TableField("brand") |
| | | private Integer brand; |
| | | |
| | | @ApiModelProperty(value = "供应商") |
| | | @TableField("supplier") |
| | | private Integer supplier; |
| | | |
| | | @ApiModelProperty(value = "材质") |
| | | @TableField("material") |
| | | private Integer material; |
| | | |
| | | @ApiModelProperty(value = "库存总数量") |
| | | @TableField("total") |
| | | private Integer total; |
| | | |
| | | @ApiModelProperty(value = "盘点类型 1型号2品牌3材质") |
| | | @TableField("category") |
| | | private Integer category; |
| | | |
| | | @ApiModelProperty(value = "色号") |
| | | @TableField("color") |
| | | private String color; |
| | | |
| | | @ApiModelProperty(value = "镜架型号") |
| | | @TableField("model") |
| | | private Integer model; |
| | | |
| | | @ApiModelProperty(value = "盘点数量") |
| | | @TableField("count") |
| | | private Integer count; |
| | | |
| | | @ApiModelProperty(value = "差值") |
| | | @TableField("diff") |
| | | private Integer diff; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架盘点详细表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_inventory_lens_detail") |
| | | @ApiModel(value="TInventoryLensDetail对象", description="镜架盘点详细表") |
| | | public class TInventoryLensDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "盘点表id") |
| | | @TableField("inventoryId") |
| | | private Integer inventoryId; |
| | | |
| | | @ApiModelProperty(value = "系列") |
| | | @TableField("series") |
| | | private String series; |
| | | |
| | | @ApiModelProperty(value = "1球面 2非球面 3双非") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "库存总数量") |
| | | @TableField("total") |
| | | private Integer total; |
| | | |
| | | @ApiModelProperty(value = "盘点数量") |
| | | @TableField("count") |
| | | private Integer count; |
| | | |
| | | @ApiModelProperty(value = "差值") |
| | | @TableField("diff") |
| | | private Integer diff; |
| | | |
| | | @ApiModelProperty(value = "折射率") |
| | | @TableField("refractiveIndex") |
| | | private String refractiveIndex; |
| | | |
| | | @ApiModelProperty(value = "球镜") |
| | | @TableField("ballMirror") |
| | | private String ballMirror; |
| | | |
| | | @ApiModelProperty(value = "柱镜") |
| | | @TableField("columnMirror") |
| | | private String columnMirror; |
| | | |
| | | @ApiModelProperty(value = "盘点类型 1球/柱镜2折射率3系列") |
| | | @TableField("category") |
| | | private Integer category; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片系列表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_lens_series") |
| | | @ApiModel(value="TLensSeries对象", description="镜片系列表") |
| | | public class TLensSeries implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "系列名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "品牌id") |
| | | @TableField("brandId") |
| | | private Integer brandId; |
| | | |
| | | @ApiModelProperty(value = "供应商id") |
| | | @TableField("supplierId") |
| | | private Integer supplierId; |
| | | |
| | | @ApiModelProperty(value = "库存类型 1库存 2非库存") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "球面") |
| | | @TableField("sphere") |
| | | private String sphere; |
| | | |
| | | @ApiModelProperty(value = "非球面") |
| | | @TableField("asphericSurface") |
| | | private String asphericSurface; |
| | | |
| | | @ApiModelProperty(value = "双非") |
| | | @TableField("doubleNon") |
| | | private String doubleNon; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片出库入库明细表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_lens_warehousing_detail") |
| | | @ApiModel(value="TLensWarehousingDetail对象", description="镜片出库入库明细表") |
| | | public class TLensWarehousingDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "品牌") |
| | | @TableField("brand") |
| | | private String brand; |
| | | |
| | | @ApiModelProperty(value = "供应商") |
| | | @TableField("supplier") |
| | | private String supplier; |
| | | |
| | | @ApiModelProperty(value = "系列") |
| | | @TableField("series") |
| | | private String series; |
| | | |
| | | @ApiModelProperty(value = "折射率") |
| | | @TableField("refractiveIndex") |
| | | private String refractiveIndex; |
| | | |
| | | @ApiModelProperty(value = "球镜") |
| | | @TableField("ballMirror") |
| | | private String ballMirror; |
| | | |
| | | @ApiModelProperty(value = "柱镜") |
| | | @TableField("columnMirror") |
| | | private String columnMirror; |
| | | |
| | | @ApiModelProperty(value = "1球面 2非球面 3双非") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "入库/出库数量") |
| | | @TableField("total") |
| | | private Integer total; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "在库数量(出库没有该字段)") |
| | | @TableField("count") |
| | | private Integer count; |
| | | |
| | | @ApiModelProperty(value = "系列id") |
| | | @TableField("seriesId") |
| | | private Integer seriesId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 排号管理 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_line_up") |
| | | @ApiModel(value="TLineUp对象", description="排号管理") |
| | | public class TLineUp implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "验光师id") |
| | | @TableField("optometristId") |
| | | private Integer optometristId; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "状态1排队中2验光中3已完成4已过号5已取消") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_material") |
| | | @ApiModel(value="TMaterial对象", description="镜架/镜片品牌表") |
| | | public class TMaterial implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "材质名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "状态 1启用 2禁用") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架型号表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_model") |
| | | @ApiModel(value="TModel对象", description="镜架型号表") |
| | | public class TModel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "品牌id") |
| | | @TableField("brandId") |
| | | private Integer brandId; |
| | | |
| | | @ApiModelProperty(value = "供应商id") |
| | | @TableField("supplierId") |
| | | private Integer supplierId; |
| | | |
| | | @ApiModelProperty(value = "材质id") |
| | | @TableField("materialId") |
| | | private Integer materialId; |
| | | |
| | | @ApiModelProperty(value = "色号 多个逗号拼接") |
| | | @TableField("color") |
| | | private String color; |
| | | |
| | | @ApiModelProperty(value = "售价") |
| | | @TableField("sale") |
| | | private BigDecimal sale; |
| | | |
| | | @ApiModelProperty(value = "成本价") |
| | | @TableField("cost") |
| | | private BigDecimal cost; |
| | | |
| | | @ApiModelProperty(value = "镜架型号") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "状态 1启用 2禁用") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光师表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_optometrist") |
| | | @ApiModel(value="TOptometrist对象", description="验光师表") |
| | | public class TOptometrist implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "验光师名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "状态 1启用 2禁用") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "照片") |
| | | @TableField("img") |
| | | private String img; |
| | | |
| | | @ApiModelProperty(value = "注册时间") |
| | | @TableField("registerTime") |
| | | private LocalDateTime registerTime; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_optometry") |
| | | @ApiModel(value="TOptometry对象", description="验光单") |
| | | public class TOptometry implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "年龄") |
| | | @TableField("age") |
| | | private Integer age; |
| | | |
| | | @ApiModelProperty(value = "性别 1男2女") |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "验光师id") |
| | | @TableField("optometristId") |
| | | private Integer optometristId; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "状态1排队中2验光中3已完成4已过号5已取消") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "注册时间") |
| | | @TableField("registerTime") |
| | | private LocalDateTime registerTime; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单详情 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_optometry_detail") |
| | | @ApiModel(value="TOptometryDetail对象", description="验光单详情") |
| | | public class TOptometryDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "类型1配镜处方 2完全矫正 3旧镜信息") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "验光单id") |
| | | @TableField("optometryId") |
| | | private Integer optometryId; |
| | | |
| | | @ApiModelProperty(value = "球镜") |
| | | @TableField("ballMirror") |
| | | private Integer ballMirror; |
| | | |
| | | @ApiModelProperty(value = "柱镜") |
| | | @TableField("columnMirror") |
| | | private Integer columnMirror; |
| | | |
| | | @ApiModelProperty(value = "轴位") |
| | | @TableField("axis") |
| | | private String axis; |
| | | |
| | | @ApiModelProperty(value = "add") |
| | | @TableField("add") |
| | | private String add; |
| | | |
| | | @ApiModelProperty(value = "瞳高") |
| | | @TableField("pupilHeight") |
| | | private String pupilHeight; |
| | | |
| | | @ApiModelProperty(value = "瞳距") |
| | | @TableField("pupilDistance") |
| | | private String pupilDistance; |
| | | |
| | | @ApiModelProperty(value = "矫正") |
| | | @TableField("correct") |
| | | private String correct; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "左眼右眼 1为L 2为R") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "注册时间") |
| | | @TableField("registerTime") |
| | | private LocalDateTime registerTime; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售订单表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order") |
| | | @ApiModel(value="TOrder对象", description="销售订单表") |
| | | public class TOrder implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "验光单id") |
| | | @TableField("optometryId") |
| | | private Integer optometryId; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "镜架型号id") |
| | | @TableField("modelId") |
| | | private Integer modelId; |
| | | |
| | | @ApiModelProperty(value = "镜架色号") |
| | | @TableField("color") |
| | | private String color; |
| | | |
| | | @ApiModelProperty(value = "镜片系列id") |
| | | @TableField("series") |
| | | private Integer series; |
| | | |
| | | @ApiModelProperty(value = "镜片右 球镜+柱镜 逗号拼接 字段为空 客户自带") |
| | | @TableField("rLens") |
| | | private String rLens; |
| | | |
| | | @ApiModelProperty(value = "镜片左 球镜+柱镜 逗号拼接 字段为空 客户自带") |
| | | @TableField("lLens") |
| | | private String lLens; |
| | | |
| | | @ApiModelProperty(value = "1球 2非球面 3双非") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "折射率") |
| | | @TableField("refractiveIndex") |
| | | private String refractiveIndex; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "店铺员工id") |
| | | @TableField("sysId") |
| | | private Integer sysId; |
| | | |
| | | @ApiModelProperty(value = "优惠券id") |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | |
| | | @ApiModelProperty(value = "收费项id") |
| | | @TableField("itemsId") |
| | | private Integer itemsId; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "是否邮寄 1是2否") |
| | | @TableField("isMail") |
| | | private Integer isMail; |
| | | |
| | | @ApiModelProperty(value = "收件人姓名") |
| | | @TableField("mailName") |
| | | private String mailName; |
| | | |
| | | @ApiModelProperty(value = "收件人电话") |
| | | @TableField("mailPhone") |
| | | private String mailPhone; |
| | | |
| | | @ApiModelProperty(value = "收件人地址") |
| | | @TableField("mailAddress") |
| | | private String mailAddress; |
| | | |
| | | @ApiModelProperty(value = "订单总金额") |
| | | @TableField("orderMoney") |
| | | private BigDecimal orderMoney; |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | @TableField("couponMoney") |
| | | private BigDecimal couponMoney; |
| | | |
| | | @ApiModelProperty(value = "支付金额") |
| | | @TableField("payMoney") |
| | | private BigDecimal payMoney; |
| | | |
| | | @ApiModelProperty(value = "是否加工 1是2否") |
| | | @TableField("isMachining") |
| | | private Integer isMachining; |
| | | |
| | | @ApiModelProperty(value = "加工编号") |
| | | @TableField("machiningCode") |
| | | private String machiningCode; |
| | | |
| | | @ApiModelProperty(value = "是否核算 1是2否") |
| | | @TableField("isAccounting") |
| | | private Integer isAccounting; |
| | | |
| | | @ApiModelProperty(value = "核算人") |
| | | @TableField("accountingName") |
| | | private String accountingName; |
| | | |
| | | @ApiModelProperty(value = "核算时间") |
| | | @TableField("accountingTime") |
| | | private LocalDateTime accountingTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单核算表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order_accounting") |
| | | @ApiModel(value="TOrderAccounting对象", description="订单核算表") |
| | | public class TOrderAccounting implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty(value = "镜片右 核算成本价") |
| | | @TableField("rLens") |
| | | private BigDecimal rLens; |
| | | |
| | | @ApiModelProperty(value = "镜片右 核算成本价") |
| | | @TableField("lLens") |
| | | private BigDecimal lLens; |
| | | |
| | | @ApiModelProperty(value = "镜架核算成本价") |
| | | @TableField("frame") |
| | | private BigDecimal frame; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "手续费") |
| | | @TableField("commission") |
| | | private Integer commission; |
| | | |
| | | @ApiModelProperty(value = "镜片右毛利") |
| | | @TableField("rLensProfit") |
| | | private BigDecimal rLensProfit; |
| | | |
| | | @ApiModelProperty(value = "镜片左毛利") |
| | | @TableField("lLensProfit") |
| | | private BigDecimal lLensProfit; |
| | | |
| | | @ApiModelProperty(value = "镜架毛利") |
| | | @TableField("frameProfit") |
| | | private BigDecimal frameProfit; |
| | | |
| | | @ApiModelProperty(value = "实收金额") |
| | | @TableField("payMoney") |
| | | private String payMoney; |
| | | |
| | | @ApiModelProperty(value = "本单毛利") |
| | | @TableField("profitMoney") |
| | | private BigDecimal profitMoney; |
| | | |
| | | @ApiModelProperty(value = "毛利率") |
| | | @TableField("profitRating") |
| | | private BigDecimal profitRating; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单售后表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order_aftersales") |
| | | @ApiModel(value="TOrderAftersales对象", description="订单售后表") |
| | | public class TOrderAftersales implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "店铺员工id") |
| | | @TableField("sysId") |
| | | private Integer sysId; |
| | | |
| | | @ApiModelProperty(value = "验光师id") |
| | | @TableField("optometristId") |
| | | private Integer optometristId; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty(value = "售后原因") |
| | | @TableField("reason") |
| | | private String reason; |
| | | |
| | | @ApiModelProperty(value = "处理结果") |
| | | @TableField("handleResult") |
| | | private String handleResult; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 门店表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_store") |
| | | @ApiModel(value="TStore对象", description="门店表") |
| | | public class TStore implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "省") |
| | | @TableField("province") |
| | | private String province; |
| | | |
| | | @ApiModelProperty(value = "省code") |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | |
| | | @ApiModelProperty(value = "市") |
| | | @TableField("city") |
| | | private String city; |
| | | |
| | | @ApiModelProperty(value = "市code") |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty(value = "区/县") |
| | | @TableField("area") |
| | | private Integer area; |
| | | |
| | | @ApiModelProperty(value = "区县code") |
| | | @TableField("areaCode") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty(value = "地址") |
| | | @TableField("address") |
| | | private Integer address; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @TableField("lon") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @TableField("lat") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "照片") |
| | | @TableField("img") |
| | | private String img; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供应商 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_supplier") |
| | | @ApiModel(value="TSupplier对象", description="供应商") |
| | | public class TSupplier implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "状态 1启用 2禁用") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 小票机 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_ticket") |
| | | @ApiModel(value="TTicket对象", description="小票机") |
| | | public class TTicket implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "小票机名称") |
| | | @TableField("name") |
| | | private Integer name; |
| | | |
| | | @ApiModelProperty(value = "类型 1验光单 2加工单") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "云端id") |
| | | @TableField("cloudId") |
| | | private Integer cloudId; |
| | | |
| | | @ApiModelProperty(value = "密钥") |
| | | @TableField("secret") |
| | | private String secret; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片出库入库表 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_warehousing") |
| | | @ApiModel(value="TWarehousing对象", description="镜架/镜片出库入库表") |
| | | public class TWarehousing implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "1出库2入库") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "1镜架2镜片") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("updateTime") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField("createBy") |
| | | private String createBy; |
| | | |
| | | @TableField("updateBy") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "是否删除 0否1是") |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.query; |
| | | |
| | | import com.jilongda.common.dto.TimeRangePageDTO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/9/21/02111:52 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "登录日志Query") |
| | | public class LoginLogQuery extends TimeRangePageDTO { |
| | | |
| | | @ApiModelProperty(value = "登录账号") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "账号名称") |
| | | private String shortName; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.query; |
| | | |
| | | import com.jilongda.common.dto.TimeRangePageDTO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/9/21/02111:52 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "操作日志Query") |
| | | public class OperLogQuery extends TimeRangePageDTO { |
| | | |
| | | @ApiModelProperty(value = "操作账号") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "账号名称") |
| | | private String shortName; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.schedule; |
| | | |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @Description 系统定时任务类 |
| | | * @Author xiaochen |
| | | * @Date 2022/7/26/02614:00 |
| | | */ |
| | | @Component |
| | | @EnableScheduling |
| | | public class SystemSchedule { |
| | | |
| | | @Scheduled(cron = "0 0 0 ? * SUN") |
| | | private void updateProduct() { |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.security; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.authentication.*; |
| | | import org.springframework.security.authentication.dao.DaoAuthenticationProvider; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 身份验证提供者--->登录验证逻辑 |
| | | * <p> |
| | | * 不管是 implements AuthenticationProvider 还是 extends DaoAuthenticationProvider 区别不大 |
| | | * <p> |
| | | * DaoAuthenticationProvider 实现了 AuthenticationProvider 类 |
| | | * <p> |
| | | * 验证逻辑都是在 public Authentication authenticate(Authentication authentication) throws AuthenticationException {} 方法中 |
| | | * |
| | | * @author xiaochen |
| | | * @date 2021-01-02 20:17 |
| | | */ |
| | | @Slf4j |
| | | public class AuthenticationProvider extends DaoAuthenticationProvider { |
| | | |
| | | private SysUserDetailsService loadUserDetailsService; |
| | | private PasswordEncoder passwordEncoder; |
| | | |
| | | public AuthenticationProvider(SysUserDetailsService loadUserDetailsService, PasswordEncoder passwordEncoder) { |
| | | this.loadUserDetailsService = loadUserDetailsService; |
| | | this.passwordEncoder = passwordEncoder; |
| | | setUserDetailsService(loadUserDetailsService); |
| | | setPasswordEncoder(passwordEncoder); |
| | | } |
| | | |
| | | @Override |
| | | public Authentication authenticate(Authentication authentication) { |
| | | // 可以在此处覆写整个登录认证逻辑 |
| | | // [1] 获取 username 和 password |
| | | String userName = (String) authentication.getPrincipal(); |
| | | String password = (String) authentication.getCredentials(); |
| | | // [2] 使用用户名从数据库读取用户信息 |
| | | SecurityUserDetails userDetails = this.loadUserDetailsService.loadUserByUsername(userName); |
| | | // 判断是否被封禁 |
| | | // userDetails.setEnabled(userDetails.getStatus()); |
| | | // [3] 检查用户信息 |
| | | if (Objects.isNull(userDetails)) { |
| | | throw new UsernameNotFoundException("用户账户不存在"); |
| | | } |
| | | else if (userDetails.getState()) { |
| | | throw new DisabledException("用户已被禁用或删除,请联系管理员"); |
| | | } |
| | | // else if (!userDetails.isAccountNonExpired()) { |
| | | // throw new AccountExpiredException(userName + " 账号已过期"); |
| | | // } else if (!userDetails.isAccountNonLocked()) { |
| | | // throw new LockedException(userName + " 账号已被锁定"); |
| | | // } else if (!userDetails.isCredentialsNonExpired()) { |
| | | // throw new LockedException(userName + " 凭证已过期"); |
| | | // } |
| | | // [4] 数据库用户的密码,一般都是加密过的 |
| | | String encryptedPassword = userDetails.getPassword(); |
| | | |
| | | // 根据加密算法加密用户输入的密码,然后和数据库中保存的密码进行比较 |
| | | if (!this.passwordEncoder.matches(password, encryptedPassword)) { |
| | | throw new BadCredentialsException("密码错误"); |
| | | } |
| | | // [5] 成功登陆,把用户信息提交给 Spring Security |
| | | // 把 userDetails 作为 principal 的好处是可以放自定义的 UserDetails,这样可以存储更多有用的信息,而不只是 username, |
| | | // 默认只有 username,这里的密码使用数据库中保存的密码,而不是用户输入的明文密码,否则就暴露了密码的明文 |
| | | // 不暴露密码 |
| | | userDetails.setPassword(null); |
| | | UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(userDetails.getUsername(), null, null); |
| | | // 设置详情 |
| | | //String userInfo = JsonUtils.toJsonString(userDetails); |
| | | usernamePasswordAuthenticationToken.setDetails(userDetails); |
| | | return usernamePasswordAuthenticationToken; |
| | | } |
| | | |
| | | @Override |
| | | protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) |
| | | throws AuthenticationException { |
| | | // 可以在此处覆写密码验证逻辑 |
| | | super.additionalAuthenticationChecks(userDetails, authentication); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.security; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.Setter; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DinePeopleDetails |
| | | * @Description |
| | | * @date 2020-08-20 20:36 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class SecurityUserDetails extends SecurityUserRoleResouce implements UserDetails, Serializable { |
| | | private static final long serialVersionUID = 8154896751339152731L; |
| | | @Setter |
| | | private Boolean accountNonExpired = true; |
| | | @Setter |
| | | private Boolean accountNonLocked = true; |
| | | @Setter |
| | | private Boolean credentialsNonExpired = true; |
| | | @Setter |
| | | private Boolean enabled = false; |
| | | |
| | | |
| | | /** |
| | | * 不在此处做权限校验 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String getPassword() { |
| | | return super.getPassword(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() { |
| | | return super.getAccount(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonExpired() { |
| | | return this.accountNonExpired; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonLocked() { |
| | | return this.accountNonLocked; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCredentialsNonExpired() { |
| | | return this.credentialsNonExpired; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return this.enabled; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.security; |
| | | |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.common.model.TUser; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName SysUserRoleResouce |
| | | * @Description |
| | | * @date 2021-05-20 15:10 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class SecurityUserRoleResouce extends SecUser implements Serializable { |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.security; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.jilongda.applet.mapper.SecRoleMapper; |
| | | import com.jilongda.applet.mapper.SecUserMapper; |
| | | import com.jilongda.applet.model.SecRole; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.service.SecUserService; |
| | | import com.jilongda.applet.service.TUserService; |
| | | import com.jilongda.applet.vo.SecResourceVO; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.model.TUser; |
| | | import com.jilongda.common.utils.SpringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.ParameterResolutionDelegate; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 用户登录认证信息查询 |
| | | * |
| | | * @author xiaochen |
| | | * @date Jun 29, 2019 |
| | | */ |
| | | @Component("loadUserDetailsService") |
| | | public class SysUserDetailsService implements UserDetailsService { |
| | | @Autowired |
| | | private SecUserMapper secUserMapper; |
| | | @Autowired |
| | | private SecRoleMapper secRoleMapper; |
| | | // @Autowired |
| | | // private SecResourcesMapper secResourcesMapper; |
| | | @Autowired |
| | | private SecUserService secUserService; |
| | | |
| | | |
| | | @Override |
| | | public SecurityUserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
| | | SecUser user = secUserMapper.selectOne(Wrappers.lambdaQuery(SecUser.class).eq(SecUser::getPhone, username).last(" LIMIT 1")); |
| | | if (Objects.isNull(user)) { |
| | | throw new UsernameNotFoundException("无效手机号码"); |
| | | } |
| | | SecurityUserDetails vo = SpringUtils.beanCopy(user, SecurityUserDetails.class); |
| | | // if (user.getAccount().equals(Constant.ADMIN)) { |
| | | // getAdminPermission(vo); |
| | | // } else { |
| | | // List<SecRole> roles = secRoleMapper.selectRolesByUid(user.getId()); |
| | | // List<Long> roleIds = roles.stream().map(SecRole::getId).collect(Collectors.toList()); |
| | | // List<SecResourceVO> resources; |
| | | // if (CollectionUtils.isEmpty(roleIds)) { |
| | | // resources = new ArrayList<>(); |
| | | // } else { |
| | | // resources = secUserService.getResourceTag(user.getId()); |
| | | // } |
| | | // vo.setRoles(roles); |
| | | // vo.setResources(resources); |
| | | // } |
| | | // // 更新登录时间 |
| | | // SecurityUserDetails securityUserDetails = new SecurityUserDetails(); |
| | | // securityUserDetails.setId(user.getId()); |
| | | // securityUserDetails.setLastLoginTime(LocalDateTime.now()); |
| | | // secUserMapper.updateById(securityUserDetails); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 为管理员赋所有权限 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | // private SecurityUserDetails getAdminPermission(SecurityUserDetails details) { |
| | | // List<SecRole> roles = secRoleMapper.selectList(Wrappers.emptyWrapper()); |
| | | // List<SecResourceVO> resources = secUserService.selectUserResourcesTag(details.getId()); |
| | | // details.setRoles(roles); |
| | | // details.setResources(resources); |
| | | // return details; |
| | | // } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.jilongda.common.model.LoginLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | public interface LoginLogService extends IService<LoginLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecFeeItems; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-收费项设置 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecFeeItemsService extends IService<SecFeeItems> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecResources; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资源表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecResourcesService extends IService<SecResources> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecRoleResource; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecRoleResourceService extends IService<SecRoleResource> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecRole; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecRoleService extends IService<SecRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecSetting; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecSettingService extends IService<SecSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecUserRole; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecUserRoleService extends IService<SecUserRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface SecUserService extends IService<SecUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TAppUser; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TAppUserService extends IService<TAppUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TBrand; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TBrandService extends IService<TBrand> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TCouponReceive; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TCouponReceiveService extends IService<TCouponReceive> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TCoupon; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券领取记录 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TCouponService extends IService<TCoupon> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TFrameWarehousingDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架出库入库详细表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TFrameWarehousingDetailService extends IService<TFrameWarehousingDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TInventoryFrameDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 材质表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TInventoryFrameDetailService extends IService<TInventoryFrameDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TInventoryLensDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架盘点详细表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TInventoryLensDetailService extends IService<TInventoryLensDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TInventory; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 盘点表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TInventoryService extends IService<TInventory> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TLensSeries; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片系列表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TLensSeriesService extends IService<TLensSeries> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TLensWarehousingDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片出库入库明细表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TLensWarehousingDetailService extends IService<TLensWarehousingDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TLineUp; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 排号管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TLineUpService extends IService<TLineUp> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TMaterial; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TMaterialService extends IService<TMaterial> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TModel; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架型号表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TModelService extends IService<TModel> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TOptometrist; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光师表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOptometristService extends IService<TOptometrist> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TOptometryDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单详情 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOptometryDetailService extends IService<TOptometryDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TOptometry; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOptometryService extends IService<TOptometry> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TOrderAccounting; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单核算表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOrderAccountingService extends IService<TOrderAccounting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TOrderAftersales; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单售后表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOrderAftersalesService extends IService<TOrderAftersales> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TOrder; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售订单表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TOrderService extends IService<TOrder> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TStore; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 门店表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TStoreService extends IService<TStore> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TSupplier; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供应商 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TSupplierService extends IService<TSupplier> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TTicket; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 小票机 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TTicketService extends IService<TTicket> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.jilongda.common.model.TUser; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | public interface TUserService extends IService<TUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service; |
| | | |
| | | import com.jilongda.applet.model.TWarehousing; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片出库入库表 服务类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | public interface TWarehousingService extends IService<TWarehousing> { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.applet.mapper.LoginLogMapper; |
| | | import com.jilongda.applet.service.LoginLogService; |
| | | import com.jilongda.common.model.LoginLog; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | @Service |
| | | public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements LoginLogService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecFeeItems; |
| | | import com.jilongda.applet.mapper.SecFeeItemsMapper; |
| | | import com.jilongda.applet.service.SecFeeItemsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-收费项设置 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecFeeItemsServiceImpl extends ServiceImpl<SecFeeItemsMapper, SecFeeItems> implements SecFeeItemsService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecResources; |
| | | import com.jilongda.applet.mapper.SecResourcesMapper; |
| | | import com.jilongda.applet.service.SecResourcesService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资源表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecResourcesServiceImpl extends ServiceImpl<SecResourcesMapper, SecResources> implements SecResourcesService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecRoleResource; |
| | | import com.jilongda.applet.mapper.SecRoleResourceMapper; |
| | | import com.jilongda.applet.service.SecRoleResourceService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecRoleResourceServiceImpl extends ServiceImpl<SecRoleResourceMapper, SecRoleResource> implements SecRoleResourceService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecRole; |
| | | import com.jilongda.applet.mapper.SecRoleMapper; |
| | | import com.jilongda.applet.service.SecRoleService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecRoleServiceImpl extends ServiceImpl<SecRoleMapper, SecRole> implements SecRoleService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecSetting; |
| | | import com.jilongda.applet.mapper.SecSettingMapper; |
| | | import com.jilongda.applet.service.SecSettingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecSettingServiceImpl extends ServiceImpl<SecSettingMapper, SecSetting> implements SecSettingService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecUserRole; |
| | | import com.jilongda.applet.mapper.SecUserRoleMapper; |
| | | import com.jilongda.applet.service.SecUserRoleService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecUserRoleServiceImpl extends ServiceImpl<SecUserRoleMapper, SecUserRole> implements SecUserRoleService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.mapper.SecUserMapper; |
| | | import com.jilongda.applet.service.SecUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class SecUserServiceImpl extends ServiceImpl<SecUserMapper, SecUser> implements SecUserService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TAppUser; |
| | | import com.jilongda.applet.mapper.TAppUserMapper; |
| | | import com.jilongda.applet.service.TAppUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TAppUserServiceImpl extends ServiceImpl<TAppUserMapper, TAppUser> implements TAppUserService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TBrand; |
| | | import com.jilongda.applet.mapper.TBrandMapper; |
| | | import com.jilongda.applet.service.TBrandService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TBrandServiceImpl extends ServiceImpl<TBrandMapper, TBrand> implements TBrandService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TCouponReceive; |
| | | import com.jilongda.applet.mapper.TCouponReceiveMapper; |
| | | import com.jilongda.applet.service.TCouponReceiveService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TCouponReceiveServiceImpl extends ServiceImpl<TCouponReceiveMapper, TCouponReceive> implements TCouponReceiveService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TCoupon; |
| | | import com.jilongda.applet.mapper.TCouponMapper; |
| | | import com.jilongda.applet.service.TCouponService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 优惠券领取记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TCouponServiceImpl extends ServiceImpl<TCouponMapper, TCoupon> implements TCouponService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TFrameWarehousingDetail; |
| | | import com.jilongda.applet.mapper.TFrameWarehousingDetailMapper; |
| | | import com.jilongda.applet.service.TFrameWarehousingDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架出库入库详细表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TFrameWarehousingDetailServiceImpl extends ServiceImpl<TFrameWarehousingDetailMapper, TFrameWarehousingDetail> implements TFrameWarehousingDetailService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TInventoryFrameDetail; |
| | | import com.jilongda.applet.mapper.TInventoryFrameDetailMapper; |
| | | import com.jilongda.applet.service.TInventoryFrameDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 材质表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TInventoryFrameDetailServiceImpl extends ServiceImpl<TInventoryFrameDetailMapper, TInventoryFrameDetail> implements TInventoryFrameDetailService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TInventoryLensDetail; |
| | | import com.jilongda.applet.mapper.TInventoryLensDetailMapper; |
| | | import com.jilongda.applet.service.TInventoryLensDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架盘点详细表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TInventoryLensDetailServiceImpl extends ServiceImpl<TInventoryLensDetailMapper, TInventoryLensDetail> implements TInventoryLensDetailService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TInventory; |
| | | import com.jilongda.applet.mapper.TInventoryMapper; |
| | | import com.jilongda.applet.service.TInventoryService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 盘点表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TInventoryServiceImpl extends ServiceImpl<TInventoryMapper, TInventory> implements TInventoryService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TLensSeries; |
| | | import com.jilongda.applet.mapper.TLensSeriesMapper; |
| | | import com.jilongda.applet.service.TLensSeriesService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片系列表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TLensSeriesServiceImpl extends ServiceImpl<TLensSeriesMapper, TLensSeries> implements TLensSeriesService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TLensWarehousingDetail; |
| | | import com.jilongda.applet.mapper.TLensWarehousingDetailMapper; |
| | | import com.jilongda.applet.service.TLensWarehousingDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜片出库入库明细表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TLensWarehousingDetailServiceImpl extends ServiceImpl<TLensWarehousingDetailMapper, TLensWarehousingDetail> implements TLensWarehousingDetailService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TLineUp; |
| | | import com.jilongda.applet.mapper.TLineUpMapper; |
| | | import com.jilongda.applet.service.TLineUpService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 排号管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TLineUpServiceImpl extends ServiceImpl<TLineUpMapper, TLineUp> implements TLineUpService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TMaterial; |
| | | import com.jilongda.applet.mapper.TMaterialMapper; |
| | | import com.jilongda.applet.service.TMaterialService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片品牌表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TMaterialServiceImpl extends ServiceImpl<TMaterialMapper, TMaterial> implements TMaterialService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TModel; |
| | | import com.jilongda.applet.mapper.TModelMapper; |
| | | import com.jilongda.applet.service.TModelService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架型号表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TModelServiceImpl extends ServiceImpl<TModelMapper, TModel> implements TModelService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TOptometrist; |
| | | import com.jilongda.applet.mapper.TOptometristMapper; |
| | | import com.jilongda.applet.service.TOptometristService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光师表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TOptometristServiceImpl extends ServiceImpl<TOptometristMapper, TOptometrist> implements TOptometristService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TOptometryDetail; |
| | | import com.jilongda.applet.mapper.TOptometryDetailMapper; |
| | | import com.jilongda.applet.service.TOptometryDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单详情 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TOptometryDetailServiceImpl extends ServiceImpl<TOptometryDetailMapper, TOptometryDetail> implements TOptometryDetailService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TOptometry; |
| | | import com.jilongda.applet.mapper.TOptometryMapper; |
| | | import com.jilongda.applet.service.TOptometryService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 验光单 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TOptometryServiceImpl extends ServiceImpl<TOptometryMapper, TOptometry> implements TOptometryService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TOrderAccounting; |
| | | import com.jilongda.applet.mapper.TOrderAccountingMapper; |
| | | import com.jilongda.applet.service.TOrderAccountingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单核算表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TOrderAccountingServiceImpl extends ServiceImpl<TOrderAccountingMapper, TOrderAccounting> implements TOrderAccountingService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TOrderAftersales; |
| | | import com.jilongda.applet.mapper.TOrderAftersalesMapper; |
| | | import com.jilongda.applet.service.TOrderAftersalesService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单售后表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TOrderAftersalesServiceImpl extends ServiceImpl<TOrderAftersalesMapper, TOrderAftersales> implements TOrderAftersalesService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TOrder; |
| | | import com.jilongda.applet.mapper.TOrderMapper; |
| | | import com.jilongda.applet.service.TOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售订单表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> implements TOrderService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TStore; |
| | | import com.jilongda.applet.mapper.TStoreMapper; |
| | | import com.jilongda.applet.service.TStoreService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 门店表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TStoreServiceImpl extends ServiceImpl<TStoreMapper, TStore> implements TStoreService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TSupplier; |
| | | import com.jilongda.applet.mapper.TSupplierMapper; |
| | | import com.jilongda.applet.service.TSupplierService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供应商 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TSupplierServiceImpl extends ServiceImpl<TSupplierMapper, TSupplier> implements TSupplierService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TTicket; |
| | | import com.jilongda.applet.mapper.TTicketMapper; |
| | | import com.jilongda.applet.service.TTicketService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 小票机 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TTicketServiceImpl extends ServiceImpl<TTicketMapper, TTicket> implements TTicketService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.applet.mapper.TUserMapper; |
| | | import com.jilongda.applet.service.TUserService; |
| | | import com.jilongda.common.model.TUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Service |
| | | public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements TUserService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.jilongda.applet.model.TWarehousing; |
| | | import com.jilongda.applet.mapper.TWarehousingMapper; |
| | | import com.jilongda.applet.service.TWarehousingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 镜架/镜片出库入库表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-12-09 |
| | | */ |
| | | @Service |
| | | public class TWarehousingServiceImpl extends ServiceImpl<TWarehousingMapper, TWarehousing> implements TWarehousingService { |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | |
| | | import com.aliyuncs.CommonRequest; |
| | | import com.aliyuncs.CommonResponse; |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.IAcsClient; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import com.google.gson.Gson; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 阿里云短信工具类 |
| | | */ |
| | | @Component |
| | | public class ALiSendSms { |
| | | |
| | | // 设置鉴权参数,初始化客户端 |
| | | private DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou",// 地域ID |
| | | "LTAIFS7hF89c6zw9",// 您的AccessKey ID |
| | | "CRGQq3oo5IcKxdUOOki60lOvo0fCHs");// 您的AccessKey Secret |
| | | private IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | private static void log_print(String functionName, Object result) { |
| | | Gson gson = new Gson(); |
| | | System.out.println("-------------------------------" + functionName + "-------------------------------"); |
| | | System.out.println(gson.toJson(result)); |
| | | } |
| | | |
| | | /** |
| | | * 添加短信模板 |
| | | */ |
| | | public String addSmsTemplate() throws ClientException { |
| | | CommonRequest addSmsTemplateRequest = new CommonRequest(); |
| | | addSmsTemplateRequest.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | addSmsTemplateRequest.setSysAction("AddSmsTemplate"); |
| | | addSmsTemplateRequest.setSysVersion("2017-05-25"); |
| | | // 短信类型。0:验证码;1:短信通知;2:推广短信;3:国际/港澳台消息 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateType", "0"); |
| | | // 模板名称,长度为1~30个字符 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateName", "测试短信模板"); |
| | | // 模板内容,长度为1~500个字符 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateContent", "您正在申请手机注册,验证码为:${code},5分钟内有效!"); |
| | | // 短信模板申请说明 |
| | | addSmsTemplateRequest.putQueryParameter("Remark", "测试"); |
| | | CommonResponse addSmsTemplateResponse = client.getCommonResponse(addSmsTemplateRequest); |
| | | String data = addSmsTemplateResponse.getData(); |
| | | // 消除返回文本中的反转义字符 |
| | | String sData = data.replaceAll("'\'", ""); |
| | | log_print("addSmsTemplate", sData); |
| | | Gson gson = new Gson(); |
| | | // 将字符串转换为Map类型,取TemplateCode字段值 |
| | | Map map = gson.fromJson(sData, Map.class); |
| | | Object templateCode = map.get("TemplateCode"); |
| | | return templateCode.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 发送短信 |
| | | */ |
| | | public String sendSms(String phone, String templateCode, String json) throws ClientException { |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | request.setSysVersion("2017-05-25"); |
| | | request.setSysAction("SendSms"); |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumbers", phone); |
| | | // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 |
| | | request.putQueryParameter("SignName", "吉隆达"); |
| | | // 短信模板ID |
| | | request.putQueryParameter("TemplateCode", templateCode); |
| | | // 短信模板变量对应的实际值,JSON格式。 |
| | | request.putQueryParameter("TemplateParam", json); |
| | | CommonResponse commonResponse = client.getCommonResponse(request); |
| | | String data = commonResponse.getData(); |
| | | String sData = data.replaceAll("'\'", ""); |
| | | log_print("sendSms", sData); |
| | | return sData; |
| | | } |
| | | |
| | | /** |
| | | * 查询发送详情 |
| | | */ |
| | | private void querySendDetails(String bizId) throws ClientException { |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | request.setSysVersion("2017-05-25"); |
| | | request.setSysAction("QuerySendDetails"); |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumber", "156xxxxxxxx"); |
| | | // 短信发送日期,支持查询最近30天的记录。格式为yyyyMMdd,例如20191010。 |
| | | request.putQueryParameter("SendDate", "20191010"); |
| | | // 分页记录数量 |
| | | request.putQueryParameter("PageSize", "10"); |
| | | // 分页当前页码 |
| | | request.putQueryParameter("CurrentPage", "1"); |
| | | // 发送回执ID,即发送流水号。 |
| | | request.putQueryParameter("BizId", bizId); |
| | | CommonResponse response = client.getCommonResponse(request); |
| | | log_print("querySendDetails", response.getData()); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | ALiSendSms sendSmsDemo = new ALiSendSms(); |
| | | try { |
| | | // 创建短信模板 |
| | | // String templateCode = sendSmsDemo.addSmsTemplate(); |
| | | // 使用刚创建的短信模板发送短信 |
| | | String sData = sendSmsDemo.sendSms("19522115070", "SMS_58880127", "{\"code\":\"8888\",\"product\":\"111\" }"); |
| | | Gson gson = new Gson(); |
| | | Map map = gson.fromJson(sData, Map.class); |
| | | String bizId = map.get("BizId").toString(); |
| | | // 根据短信发送流水号查询短信发送情况 |
| | | sendSmsDemo.querySendDetails(bizId); |
| | | } catch (ClientException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | public class DistanceCalculator { |
| | | public static void main(String[] args) { |
| | | String coord1 = "40.7128"; |
| | | String coord2 = "-74.0060"; |
| | | String coord3 = "34.0522"; |
| | | String coord4 = "-118.2437"; |
| | | |
| | | double distance = calculateDistance(coord1, coord2, coord3, coord4); |
| | | System.out.println("两个坐标点的距离为: " + distance + " km"); |
| | | } |
| | | |
| | | public static double calculateDistance(String lat1, String lon1, String lat2, String lon2) { |
| | | double lat1Double = Double.parseDouble(lat1); |
| | | double lon1Double = Double.parseDouble(lon1); |
| | | double lat2Double = Double.parseDouble(lat2); |
| | | double lon2Double = Double.parseDouble(lon2); |
| | | |
| | | int R = 6371; // 地球半径,单位:km |
| | | double latDistance = Math.toRadians(lat2Double - lat1Double); |
| | | double lonDistance = Math.toRadians(lon2Double - lon1Double); |
| | | double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) |
| | | + Math.cos(Math.toRadians(lat1Double)) * Math.cos(Math.toRadians(lat2Double)) |
| | | * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2); |
| | | double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); |
| | | return R * c; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import com.jilongda.applet.service.SecUserService; |
| | | import com.jilongda.applet.service.TUserService; |
| | | import com.jilongda.common.model.TUser; |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.jilongda.applet.service.TUserService; |
| | | import com.jilongda.common.model.TUser; |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.jilongda.applet.service.TUserService; |
| | | import com.jilongda.common.model.TUser; |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class LoginInfoUtil { |
| | | |
| | | @Autowired |
| | | private TUserService tUserService; |
| | | |
| | | @Autowired |
| | | private SecUserService secUserService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public Long getUserId1(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | TUser userName = tUserService.getOne(new QueryWrapper<TUser>().eq("userName", username).eq("isDelete",0)); |
| | | return userName.getId(); |
| | | |
| | | } |
| | | public Long getUserId(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return userName.getId(); |
| | | |
| | | } |
| | | public SecUser getLoginUserByPhone(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser tUser = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return tUser; |
| | | } |
| | | |
| | | public SecUser getLoginUser(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser secUser = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return secUser; |
| | | } |
| | | |
| | | public Integer getUserType(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | return userName.getUserType(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @description 注销 |
| | | * @author jqs |
| | | * @date 2024/4/18 10:26 |
| | | * @param |
| | | * @return void |
| | | */ |
| | | public void logoff(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", username).eq("isDelete",0)); |
| | | userName.setIsDelete(true); |
| | | secUserService.saveOrUpdate(userName); |
| | | } |
| | | |
| | | public Boolean checkPhoneExits(String phone){ |
| | | SecUser userName = secUserService.getOne(new QueryWrapper<SecUser>().eq("phone", phone).eq("isDelete",0)); |
| | | if(userName!=null){ |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsRequest; |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsResponse; |
| | | import com.aliyun.tea.TeaException; |
| | | import com.aliyun.teaopenapi.models.Config; |
| | | import com.aliyun.teautil.models.RuntimeOptions; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MsgUtils { |
| | | |
| | | @Value("${oss.config.accessKeyId}") |
| | | private String accessKeyId; |
| | | @Value("${oss.config.accessKeySecret}") |
| | | private String accessKeySecret; |
| | | @Value("${oss.config.signName}") |
| | | private String signName; |
| | | @Value("${oss.config.templateCode}") |
| | | private String templateCode; |
| | | @Value("${oss.config.signNameTest}") |
| | | private String signNameTest; |
| | | @Value("${oss.config.templateCodeTest}") |
| | | private String templateCodeTest; |
| | | |
| | | @Value("${oss.config.shareTemplateCode}") |
| | | private String shareTemplateCode; |
| | | |
| | | /** |
| | | * 使用AK&SK初始化账号Client |
| | | * @param accessKeyId |
| | | * @param accessKeySecret |
| | | * @return Client |
| | | * @throws Exception |
| | | */ |
| | | public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { |
| | | Config config = new Config() |
| | | // 您的 AccessKey ID |
| | | .setAccessKeyId(accessKeyId) |
| | | // 您的 AccessKey Secret |
| | | .setAccessKeySecret(accessKeySecret); |
| | | // 访问的域名 |
| | | config.endpoint = "dysmsapi.aliyuncs.com"; |
| | | return new com.aliyun.dysmsapi20170525.Client(config); |
| | | } |
| | | |
| | | public void sendMsg(String phone,String code) throws Exception { |
| | | com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret); |
| | | SendSmsRequest sendSmsRequest = new SendSmsRequest() |
| | | .setSignName(signName) |
| | | .setTemplateCode(templateCode) |
| | | .setPhoneNumbers(phone) |
| | | .setTemplateParam("{\"code\":\""+code+"\"}"); |
| | | RuntimeOptions runtime = new RuntimeOptions(); |
| | | try { |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); |
| | | log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode()); |
| | | } catch (TeaException error) { |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } catch (Exception _error) { |
| | | TeaException error = new TeaException(_error.getMessage(), _error); |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } |
| | | } |
| | | |
| | | public void sendMsg(String phone,String name,String time,String content) throws Exception { |
| | | com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret); |
| | | SendSmsRequest sendSmsRequest = new SendSmsRequest() |
| | | .setSignName(signName) |
| | | .setTemplateCode(shareTemplateCode) |
| | | .setPhoneNumbers(phone) |
| | | .setTemplateParam("{\"name\":\""+name+"\",\"time\":\""+time+"\",\"content\":\""+content+"\"}"); |
| | | RuntimeOptions runtime = new RuntimeOptions(); |
| | | try { |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); |
| | | log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode()); |
| | | } catch (TeaException error) { |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } catch (Exception _error) { |
| | | TeaException error = new TeaException(_error.getMessage(), _error); |
| | | // 如有需要,请打印 error |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | log.info("短信发送失败:{}",error.message); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | public class ObsUploadUtil { |
| | | //OBS图片访问域名 |
| | | public static String endPoint = "obs.cn-southwest-2.myhuaweicloud.com"; |
| | | public static String accessKeyId = "BS5OIYJTSJGGVGRTOG2I"; |
| | | public static String accessKeySecret = "a8EP93DlqpPeYpFGiYHqjjubOEpt1d0ovIP1L3YL"; |
| | | public static String bucketName = "cqzxtaxi"; |
| | | public static String oss_domain = "https://cqzxtaxi.obs.cn-southwest-2.myhuaweicloud.com/"; |
| | | |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | public static String obsUpload(MultipartFile file) throws IOException{ |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"admin/"+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | //ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // public static void createBucket(String bucketName) |
| | | // { |
| | | // //初始化 OSSClient |
| | | //// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // // 新建一个Bucket |
| | | // Bucket bucket = ossClient.createBucket(bucketName); |
| | | // System.out.println(bucket.getName()); |
| | | // System.out.println(bucket.getCreationDate()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // OssUploadUtil.createBucket("ssfdfsd"); |
| | | // } |
| | | } |
New file |
| | |
| | | //package com.hollywood.applet.utils; |
| | | // |
| | | //import com.alibaba.fastjson.JSON; |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | // |
| | | //import com.alipay.api.AlipayApiException; |
| | | //import com.alipay.api.AlipayClient; |
| | | //import com.alipay.api.DefaultAlipayClient; |
| | | //import com.alipay.api.domain.*; |
| | | //import com.alipay.api.request.AlipayTradeAppPayRequest; |
| | | //import com.alipay.api.response.AlipayTradeAppPayResponse; |
| | | //import com.hollywood.common.basic.ApiResult; |
| | | //import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | //import org.dom4j.Document; |
| | | //import org.dom4j.DocumentException; |
| | | //import org.dom4j.Element; |
| | | //import org.dom4j.io.SAXReader; |
| | | //import org.springframework.http.HttpHeaders; |
| | | //import org.springframework.http.MediaType; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import javax.crypto.BadPaddingException; |
| | | //import javax.crypto.Cipher; |
| | | //import javax.crypto.IllegalBlockSizeException; |
| | | //import javax.crypto.NoSuchPaddingException; |
| | | //import javax.crypto.spec.SecretKeySpec; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import java.io.*; |
| | | //import java.math.BigDecimal; |
| | | //import java.net.InetAddress; |
| | | //import java.net.UnknownHostException; |
| | | //import java.security.InvalidKeyException; |
| | | //import java.security.NoSuchAlgorithmException; |
| | | //import java.security.NoSuchProviderException; |
| | | //import java.security.Security; |
| | | //import java.util.*; |
| | | // |
| | | ///** |
| | | // * 第三方支付工具类 |
| | | // */ |
| | | //@Component |
| | | //public class PayMoneyUtil { |
| | | // private String aliAppid = "2021004105665036";//支付宝appid |
| | | // |
| | | // private String appPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==";//支付宝开发者应用私钥 |
| | | // |
| | | // private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAouYvZ1v4RiydwNOnGcU0Hb4hQu0x6XUooaE2Bi6/atNOobtFdunnATGP6OMOW7yF9DpP8qH5mbFXAiaQD721y/7qlayI50UcV4mngRU4ZcaAVE3bp721Eg2H85RISa+Tb1CiOh+pc9p4l5UBseKsvB2ruHHForfZDPI8FL7AVUKBYCQPsa4zL6KAO2C6KULaTg/lCa+bYQKU0n9ca569VtdsqJUyxB9eSZjVd+9nKl62FLqp2NELGj7cXqiVBgDnBnVS5ZUO3mrBM5z/AxQbw3RwE3JqdkhzUA1BFjejAlT2zIGNOjUFagF8ao0wGElYfuk0bum6Hz5qWAt02QdNNwIDAQAB";//支付宝应用公钥 |
| | | // |
| | | // private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | // |
| | | // private String appid = "";//微信appid |
| | | // |
| | | // private String appletsAppid = "";//微信小程序appid |
| | | // |
| | | // private String mchId = "";//微信商户号 |
| | | // |
| | | // private String key = "";//微信商户号 |
| | | // |
| | | // private String callbackPath = "http://8.137.22.229:56666/competition";//支付回调网关地址 |
| | | // |
| | | // private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径 |
| | | // |
| | | // private String alipay_cert_path = "C:/cert/alipay/user/alipay_cert_path.crt";//支付宝公钥证书文件路径 |
| | | // |
| | | // private String alipay_root_cert_path = "C:/cert/alipay/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 |
| | | // |
| | | // private String certPath = "C:\\cert\\1523106371_20211206_cert\\apiclient_cert.p12";//微信证书 |
| | | // |
| | | // |
| | | // /** |
| | | // * 支付宝支付 |
| | | // */ |
| | | // public ApiResult alipay(String smid,String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl) { |
| | | // |
| | | // |
| | | // //实例化客户端 |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | // model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | // model.setSubject("报名赛事");//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | // model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | // model.setTimeoutExpress("30m"); |
| | | // model.setTotalAmount(amount);//付款金额 |
| | | // model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // SettleInfo settleInfo = new SettleInfo(); |
| | | // settleInfo.setSettlePeriodTime("3d"); |
| | | // SettleDetailInfo settleDetailInfo = new SettleDetailInfo(); |
| | | // settleDetailInfo.setTransInType("defaultSettle"); |
| | | // settleDetailInfo.setAmount(amount); |
| | | // List<SettleDetailInfo> settleDetailInfos = new ArrayList<>(); |
| | | // settleDetailInfos.add(settleDetailInfo); |
| | | // settleInfo.setSettleDetailInfos(settleDetailInfos); |
| | | // model.setSettleInfo(settleInfo); |
| | | // SubMerchant subMerchant = new SubMerchant(); |
| | | // subMerchant.setMerchantId(smid); |
| | | // model.setSubMerchant(subMerchant); |
| | | // ExtendParams extendParams = new ExtendParams(); |
| | | // extendParams.setRoyaltyFreeze("true");// 冻结资金 用于后续分账处理 |
| | | // model.setExtendParams(extendParams); |
| | | // request.setBizModel(model); |
| | | // request.setNotifyUrl(callbackPath + notifyUrl); |
| | | // |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ApiResult.success(map); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // /** |
| | | // * 支付成功后的回调处理逻辑 |
| | | // * |
| | | // * @param request |
| | | // */ |
| | | // public Map<String, String> alipayCallback(HttpServletRequest request) { |
| | | // //获取支付宝POST过来反馈信息 |
| | | // Map<String, String> params = new HashMap<String, String>(); |
| | | // Map requestParams = request.getParameterMap(); |
| | | // for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) { |
| | | // String name = (String) iter.next(); |
| | | // String[] values = (String[]) requestParams.get(name); |
| | | // String valueStr = ""; |
| | | // for (int i = 0; i < values.length; i++) { |
| | | // valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | // : valueStr + values[i] + "_"; |
| | | // } |
| | | // //乱码解决,这段代码在出现乱码时使用。 |
| | | // //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); |
| | | // params.put(name, valueStr); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // String out_trade_no = params.get("out_trade_no"); |
| | | // String subject = params.get("subject"); |
| | | // String total_amount = params.get("total_amount"); |
| | | // String trade_no = params.get("trade_no"); |
| | | // String passback_params = params.get("passback_params"); |
| | | // map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | // map.put("subject", subject); |
| | | // map.put("total_amount", total_amount); |
| | | // map.put("trade_no", trade_no);//支付宝交易号 |
| | | // map.put("passback_params", passback_params);//回传参数 |
| | | // return map; |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信统一下单 |
| | | // * |
| | | // * @param body 商品描述 |
| | | // * @param attach 附加数据 |
| | | // * @param out_trade_no 商户订单号 |
| | | // * @param total_fee 标价金额 |
| | | // * @param notify_url 通知地址 |
| | | // * @param tradeType 交易类型 |
| | | // * @return |
| | | // */ |
| | | // public ApiResult weixinpay(String body, String attach, String out_trade_no, String total_fee, String notify_url, String tradeType, String openId) throws Exception { |
| | | // int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | // String hostAddress = null; |
| | | // try { |
| | | // hostAddress = InetAddress.getLocalHost().getHostAddress(); |
| | | // } catch (UnknownHostException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String nonce_str = UUIDUtil.getRandomCode(16); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("appid", "APP".equals(tradeType) ? appid : appletsAppid); |
| | | // map.put("mch_id", mchId); |
| | | // map.put("nonce_str", nonce_str); |
| | | // map.put("body", body); |
| | | // map.put("attach", attach);//存储订单id |
| | | // map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | // map.put("total_fee", i); |
| | | // map.put("spbill_create_ip", hostAddress); |
| | | // map.put("notify_url", callbackPath + notify_url); |
| | | // map.put("trade_type", tradeType); |
| | | // if ("JSAPI".equals(tradeType)) { |
| | | // map.put("openid", openId); |
| | | // } |
| | | // String s = this.weixinSignature(map); |
| | | // map.put("sign", s); |
| | | // |
| | | // String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | // //设置请求头 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // headers.setContentType(MediaType.APPLICATION_XML); |
| | | // StringBuffer xmlString = new StringBuffer(); |
| | | // Set<String> strings = map.keySet(); |
| | | // String[] keys = {}; |
| | | // keys = strings.toArray(keys); |
| | | // Arrays.sort(keys); |
| | | // xmlString.append("<xml>"); |
| | | // for (int l = 0; l < keys.length; l++) { |
| | | // xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | // } |
| | | // xmlString.append("</xml>"); |
| | | // |
| | | // Map<String, String> map1 = null; |
| | | // String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | // //将结果xml解析成map |
| | | // body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | // body1 = body1.replaceAll("]]>", ""); |
| | | // try { |
| | | // map1 = this.xmlToMap(body1, "UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String return_code = map1.get("return_code"); |
| | | // if ("SUCCESS".equals(return_code)){ |
| | | // String result_code = map1.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)){ |
| | | // String type = map1.get("trade_type"); |
| | | // String prepay_id = map1.get("prepay_id"); |
| | | // switch (type) { |
| | | // case "JSAPI": |
| | | // //重新进行签名后返回给前端 |
| | | // Map<String, Object> map2 = new HashMap<>(); |
| | | // map2.put("appId", map1.get("appid")); |
| | | // map2.put("nonceStr", map1.get("nonce_str")); |
| | | // map2.put("package", "prepay_id=" + prepay_id); |
| | | // map2.put("signType", "MD5"); |
| | | // map2.put("timeStamp", new Date().getTime() + ""); |
| | | // String s2 = this.weixinSignature(map2); |
| | | // |
| | | // map2.put("prepay_id", prepay_id); |
| | | // map2.put("mch_id", map1.get("mch_id")); |
| | | // map2.put("trade_type", map1.get("trade_type")); |
| | | // |
| | | // map2.put("sign", s2); |
| | | // return ResultUtil.success(map2); |
| | | // case "NATIVE": |
| | | // String code_url = map1.get("code_url"); |
| | | // return ResultUtil.success(code_url); |
| | | // case "APP": |
| | | // //重新进行签名后返回给前端 |
| | | // Map<String, Object> map3 = new HashMap<>(); |
| | | // map3.put("appid", appid); |
| | | // map3.put("noncestr", nonce_str); |
| | | // map3.put("package", "Sign=WXPay"); |
| | | // map3.put("partnerid", mchId); |
| | | // map3.put("prepayid", prepay_id); |
| | | // map3.put("timestamp", new Date().getTime() / 1000); |
| | | // String s1 = this.weixinSignature(map3); |
| | | // map3.put("sign", s1); |
| | | // System.err.println(map3); |
| | | // return ResultUtil.success(map3); |
| | | // } |
| | | // return null; |
| | | // } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | // return ResultUtil.error(map1.get("err_code_des")); |
| | | // } |
| | | // } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | // return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信支付成功后的回调处理 |
| | | // * |
| | | // * @param request |
| | | // */ |
| | | // public Map<String, String> weixinpayCallback(HttpServletRequest request) { |
| | | // try { |
| | | // String param = this.getParam(request); |
| | | // param = param.replaceAll("<!\\[CDATA\\[", ""); |
| | | // param = param.replaceAll("]]>", ""); |
| | | // Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | // String return_code = map.get("return_code"); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String result_code = map.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)) { |
| | | // Map<String, String> map1 = new HashedMap(); |
| | | // map1.put("nonce_str", map.get("nonce_str")); |
| | | // map1.put("out_trade_no", map.get("out_trade_no"));//存储的订单code |
| | | // map1.put("attach", map.get("attach"));//存储订单id |
| | | // map1.put("total_fee", map.get("total_fee")); |
| | | // map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 |
| | | // String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | // map1.put("result", result); |
| | | // return map1; |
| | | // } else { |
| | | // System.err.println(map.get("err_code_des")); |
| | | // } |
| | | // } else { |
| | | // System.err.println(map.get("return_msg")); |
| | | // } |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信扫码收款 |
| | | // * |
| | | // * @param body 商品描述 |
| | | // * @param attach 附加数据 |
| | | // * @param nonce_str 随机字符串 |
| | | // * @param out_trade_no 商户订单号 |
| | | // * @param total_fee 订单金额 |
| | | // * @param auth_code 授权码 扫码支付授权码,设备读取用户微信中的条码或者二维码信息(注:用户付款码条形码规则:18位纯数字,以10、11、12、13、14、15开头) |
| | | // * @return |
| | | // */ |
| | | // public ResultUtil wxScanQRCodePay(String body, String attach, String nonce_str, String out_trade_no, String total_fee, String auth_code) { |
| | | // int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | // String hostAddress = null; |
| | | // try { |
| | | // InetAddress address = InetAddress.getLocalHost(); |
| | | // hostAddress = address.getHostAddress(); |
| | | // } catch (UnknownHostException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String randomCode = null; |
| | | // try { |
| | | // randomCode = UUIDUtil.getRandomCode(10); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("appid", appid); |
| | | // map.put("mch_id", mchId); |
| | | // map.put("nonce_str", nonce_str);//存储的支付人员id,员工扫描二维码支付的时候存储的是收款员工id |
| | | // map.put("body", body); |
| | | // map.put("attach", attach);//存储的费用月份数据,员工扫描二维码支付的时候存储的是收费项id |
| | | // map.put("out_trade_no", randomCode + "_" + out_trade_no);//存储的房间id |
| | | // map.put("total_fee", i); |
| | | // map.put("spbill_create_ip", hostAddress); |
| | | // map.put("auth_code", auth_code); |
| | | // String s = this.weixinSignature(map); |
| | | // map.put("sign", s); |
| | | // |
| | | // String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | // //设置请求头 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // headers.setContentType(MediaType.APPLICATION_XML); |
| | | // StringBuffer xmlString = new StringBuffer(); |
| | | // Set<String> strings = map.keySet(); |
| | | // String[] keys = {}; |
| | | // keys = strings.toArray(keys); |
| | | // Arrays.sort(keys); |
| | | // xmlString.append("<xml>"); |
| | | // for (int l = 0; l < keys.length; l++) { |
| | | // xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | // } |
| | | // xmlString.append("</xml>"); |
| | | // |
| | | // Map<String, String> map1 = null; |
| | | // String body1 = null; |
| | | // try { |
| | | // body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //将结果xml解析成map |
| | | // body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | // body1 = body1.replaceAll("]]>", ""); |
| | | // try { |
| | | // map1 = this.xmlToMap(body1, "UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String return_code = map1.get("return_code"); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String result_code = map1.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)) { |
| | | // String type = map1.get("trade_type"); |
| | | // switch (type) { |
| | | // case "JSAPI": |
| | | // break; |
| | | // case "NATIVE": |
| | | // String code_url = map1.get("code_url"); |
| | | // return ResultUtil.success(code_url); |
| | | // case "APP": |
| | | // String prepay_id = map1.get("prepay_id"); |
| | | // //重新进行签名后返回给前端 |
| | | // Map<String, Object> map2 = new HashMap<>(); |
| | | // map2.put("appid", appid); |
| | | // map2.put("noncestr", nonce_str); |
| | | // map2.put("package", "Sign=WXPay"); |
| | | // map2.put("partnerid", mchId); |
| | | // map2.put("prepayid", prepay_id); |
| | | // map2.put("timestamp", new Date().getTime() + ""); |
| | | // String s1 = this.weixinSignature(map2); |
| | | // |
| | | // map2.put("pac", "Sign=WXPay"); |
| | | // map2.put("sign", s1); |
| | | //// System.err.println(map2); |
| | | // return ResultUtil.success(map2); |
| | | // } |
| | | // return null; |
| | | // } else { |
| | | //// System.err.println(map1.get("err_code_des")); |
| | | // return ResultUtil.error(map1.get("err_code_des")); |
| | | // } |
| | | // } else { |
| | | //// System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | // return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 支付宝扫码收款 |
| | | // * |
| | | // * @param data |
| | | // * @return |
| | | // */ |
| | | // public Object aliScanQRCodePay(String data) { |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信退款申请 |
| | | // * |
| | | // * @param transaction_id 微信订单号。微信生成的订单号,在支付通知中有返回 |
| | | // * @param out_refund_no 商户退款单号。商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 |
| | | // * @param total_fee 订单金额。订单总金额,单位为分,只能为整数 |
| | | // * @param refund_fee 退款金额。退款总金额,订单总金额,单位为分,只能为整数 |
| | | // * @param notify_url 退款结果通知url。异步接收微信支付退款结果通知的回调地址,通知URL必须为外网可访问的url,不允许带参数 如果参数中传了notify_url,则商户平台上配置的回调地址将不会生效。 |
| | | // * @return |
| | | // */ |
| | | // public Map<String, String> wxRefund(String transaction_id, String out_refund_no, String total_fee, String refund_fee, String notify_url) { |
| | | // int tf = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | // int rf = new BigDecimal(refund_fee).multiply(new BigDecimal("100")).intValue(); |
| | | // String nonce_str = UUIDUtil.getRandomCode(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("appid", appid); |
| | | // map.put("mch_id", mchId); |
| | | // map.put("nonce_str", nonce_str); |
| | | // map.put("transaction_id", transaction_id); |
| | | // map.put("out_refund_no", out_refund_no); |
| | | // map.put("total_fee", tf); |
| | | // map.put("refund_fee", rf); |
| | | // map.put("notify_url", callbackPath + notify_url); |
| | | // String s = this.weixinSignature(map, key); |
| | | // map.put("sign", s); |
| | | // |
| | | // String url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; |
| | | // //设置请求头 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // headers.setContentType(MediaType.APPLICATION_XML); |
| | | // StringBuffer xmlString = new StringBuffer(); |
| | | // Set<String> strings = map.keySet(); |
| | | // String[] keys = {}; |
| | | // keys = strings.toArray(keys); |
| | | // Arrays.sort(keys); |
| | | // xmlString.append("<xml>"); |
| | | // for (int l = 0; l < keys.length; l++) { |
| | | // xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | // } |
| | | // xmlString.append("</xml>"); |
| | | // |
| | | // Map<String, String> map1 = null; |
| | | // String body1 = null; |
| | | // try { |
| | | // body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // System.err.println(body1); |
| | | // //将结果xml解析成map |
| | | // body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | // body1 = body1.replaceAll("]]>", ""); |
| | | // try { |
| | | // map1 = this.xmlToMap(body1, "UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String return_code = map1.get("return_code"); |
| | | // Map<String, String> map2 = new HashMap<>(); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String result_code = map1.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)) { |
| | | // map2.put("return_code", result_code); |
| | | // map2.put("refund_id", String.valueOf(map1.get("refund_id")));//微信退款订单号 |
| | | // map2.put("refund_fee", String.valueOf(map1.get("refund_fee")));//退款金额 |
| | | // return map2; |
| | | // } else { |
| | | // map2.put("return_code", result_code); |
| | | // map2.put("return_msg", map1.get("err_code_des")); |
| | | // return map2; |
| | | // } |
| | | // } else { |
| | | // map2.put("return_code", return_code); |
| | | // map2.put("return_msg", map1.get("return_msg")); |
| | | // return map2; |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信退款成功后的回调处理 |
| | | // * |
| | | // * @param request |
| | | // * @return |
| | | // */ |
| | | // public Map<String, String> wxRefundCallback(HttpServletRequest request) { |
| | | // try { |
| | | // String param = this.getParam(request); |
| | | // param = param.replaceAll("<!\\[CDATA\\[", ""); |
| | | // param = param.replaceAll("]]>", ""); |
| | | // Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | // String return_code = map.get("return_code"); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String req_info = map.get("req_info");//加密信息请用商户秘钥进行解密 |
| | | // String s = this.wxDecrypt(req_info); |
| | | // s = s.replaceAll("<!\\[CDATA\\[", ""); |
| | | // s = s.replaceAll("]]>", ""); |
| | | // map = this.xmlToMap(s, "UTF-8"); |
| | | // Map<String, String> map1 = new HashMap<>(); |
| | | // map1.put("refund_id", map.get("refund_id")); |
| | | // map1.put("out_refund_no", map.get("out_refund_no")); |
| | | // String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | // map1.put("result", result); |
| | | // return map1; |
| | | // } else { |
| | | //// System.err.println(map.get("return_msg")); |
| | | // } |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (NoSuchAlgorithmException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (InvalidKeyException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (NoSuchPaddingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (BadPaddingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (NoSuchProviderException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (IllegalBlockSizeException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 支付宝退款 |
| | | // * |
| | | // * @param trade_no 支付宝交易号 |
| | | // * @param refund_amount 退款金额 |
| | | // * @return |
| | | // * @throws AlipayApiException |
| | | // */ |
| | | // public Map<String, String> aliRefund(String trade_no, String refund_amount) throws AlipayApiException { |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("trade_no", trade_no); |
| | | // jsonObject.put("refund_amount", refund_amount); |
| | | // request.setBizContent(jsonObject.toJSONString()); |
| | | // AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // if (response.isSuccess()) { |
| | | // System.out.println("调用成功"); |
| | | // String outTradeNo = response.getOutTradeNo(); |
| | | // map.put("code", response.getCode());//10000 |
| | | // map.put("trade_no", response.getTradeNo());//支付宝交易号 |
| | | // map.put("out_trade_no", outTradeNo);//商户订单号 |
| | | // } else { |
| | | // System.out.println("调用失败"); |
| | | // map.put("code", response.getCode()); |
| | | // map.put("msg", response.getSubMsg()); |
| | | // } |
| | | // return map; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 查询微信支付订单 |
| | | // * |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // public ResultUtil<Map<String, String>> queryWXOrder(String out_trade_no, String transaction_id) throws Exception { |
| | | // String url = "https://api.mch.weixin.qq.com/pay/orderquery"; |
| | | // String nonce_str = UUIDUtil.getRandomCode(16); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("appid", appid); |
| | | // map.put("mch_id", mchId); |
| | | // map.put("out_trade_no", out_trade_no);//商户订单号 |
| | | // map.put("transaction_id", transaction_id);//微信订单号 |
| | | // map.put("nonce_str", nonce_str);//随机字符串 |
| | | // String s = this.weixinSignature(map); |
| | | // map.put("sign", s); |
| | | // |
| | | // //设置请求头 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // headers.setContentType(MediaType.APPLICATION_XML); |
| | | // StringBuffer xmlString = new StringBuffer(); |
| | | // Set<String> strings = map.keySet(); |
| | | // String[] keys = {}; |
| | | // keys = strings.toArray(keys); |
| | | // Arrays.sort(keys); |
| | | // xmlString.append("<xml>"); |
| | | // for (int l = 0; l < keys.length; l++) { |
| | | // xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | // } |
| | | // xmlString.append("</xml>"); |
| | | // |
| | | // Map<String, String> map1 = null; |
| | | // String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | // //将结果xml解析成map |
| | | // body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | // body1 = body1.replaceAll("]]>", ""); |
| | | // try { |
| | | // map1 = this.xmlToMap(body1, "UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String return_code = map1.get("return_code"); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String result_code = map1.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)) { |
| | | // Map<String, String> map2 = new HashMap<>(); |
| | | // map2.put("trade_type", map1.get("trade_type")); |
| | | // map2.put("trade_state", map1.get("trade_state"));//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | // map2.put("transaction_id", map1.get("transaction_id")); |
| | | // return ResultUtil.success(map2); |
| | | // } else { |
| | | // System.err.println(map1.get("err_code_des")); |
| | | // return ResultUtil.error(map1.get("err_code_des")); |
| | | // } |
| | | // } else { |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | // return ResultUtil.error(map1.get("return_msg")); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信转账功能(企业付款到零钱) |
| | | // * |
| | | // * @param openid 商户appid下,某用户的openid |
| | | // * @param desc 企业付款备注,必填。 |
| | | // * @param total_fee 企业付款金额 |
| | | // * @param partner_trade_no 商户订单号,需保持唯一性 |
| | | // * @return |
| | | // */ |
| | | // public Map<String, String> wxTransfers(String openid, String desc, String total_fee, String partner_trade_no) throws Exception { |
| | | // int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | // String nonce_str = UUIDUtil.getRandomCode(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("mch_appid", appid);//申请商户号的appid或商户号绑定的appid |
| | | // map.put("mchid", mchId);//微信支付分配的商户号 |
| | | // map.put("nonce_str", nonce_str);//随机字符串,不长于32位 |
| | | // map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 |
| | | // map.put("openid", openid);//商户appid下,某用户的openid |
| | | // map.put("check_name", "NO_CHECK");//NO_CHECK:不校验真实姓名 FORCE_CHECK:强校验真实姓名 |
| | | // map.put("amount", amount);//企业付款金额,单位为分 |
| | | // map.put("desc", desc);//企业付款备注,必填。 |
| | | // String s = this.weixinSignature(map, key); |
| | | // map.put("sign", s); |
| | | // |
| | | // String url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; |
| | | // //设置请求头 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // headers.setContentType(MediaType.APPLICATION_XML); |
| | | // StringBuffer xmlString = new StringBuffer(); |
| | | // Set<String> strings = map.keySet(); |
| | | // String[] keys = {}; |
| | | // keys = strings.toArray(keys); |
| | | // Arrays.sort(keys); |
| | | // xmlString.append("<xml>"); |
| | | // for (int l = 0; l < keys.length; l++) { |
| | | // xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | // } |
| | | // xmlString.append("</xml>"); |
| | | // |
| | | // Map<String, String> map1 = null; |
| | | // String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | // //将结果xml解析成map |
| | | // body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | // body1 = body1.replaceAll("]]>", ""); |
| | | // try { |
| | | // map1 = this.xmlToMap(body1, "UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String return_code = map1.get("return_code"); |
| | | // Map<String, String> map2 = new HashMap<>(); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String result_code = map1.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)) { |
| | | // map2.put("return_code", result_code); |
| | | // map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 |
| | | // map2.put("payment_time", String.valueOf(map1.get("payment_time")));//付款时间 |
| | | // return map2; |
| | | // } else { |
| | | // map2.put("return_code", result_code); |
| | | // map2.put("err_code", map1.get("err_code")); |
| | | // map2.put("err_code_des", map1.get("err_code_des")); |
| | | // return map2; |
| | | // } |
| | | // } else { |
| | | // map2.put("return_code", return_code); |
| | | // map2.put("return_msg", map1.get("return_msg")); |
| | | // return map2; |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信转账功能(企业付款到银行卡) |
| | | // * |
| | | // * @param desc 备注信息 |
| | | // * @param total_fee 转账金额 |
| | | // * @param partner_trade_no 订单号 |
| | | // * @param enc_bank_no 银行卡号 |
| | | // * @param enc_true_name 收款方用户名 |
| | | // * @param bankName 银行名称 |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // public Map<String, String> wxPayBank(String desc, String total_fee, String partner_trade_no, String enc_bank_no, String enc_true_name, String bankName) throws Exception { |
| | | // int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | // String nonce_str = UUIDUtil.getRandomCode(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("mch_id", mchId);//微信支付分配的商户号 |
| | | // map.put("nonce_str", nonce_str);//随机字符串,不长于32位 |
| | | // map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 |
| | | // map.put("enc_bank_no", enc_bank_no);//收款方银行卡号(采用标准RSA算法,公钥由微信侧提供) |
| | | // map.put("enc_true_name", enc_true_name);//收款方用户名(采用标准RSA算法,公钥由微信侧提供) |
| | | // map.put("bank_code", findBankCode(bankName));// |
| | | // map.put("amount", amount);//企业付款金额,单位为分 |
| | | // map.put("desc", desc);//企业付款备注,必填。 |
| | | // String s = this.weixinSignature(map, key); |
| | | // map.put("sign", s); |
| | | // |
| | | // String url = "https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank"; |
| | | // //设置请求头 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // headers.setContentType(MediaType.APPLICATION_XML); |
| | | // StringBuffer xmlString = new StringBuffer(); |
| | | // Set<String> strings = map.keySet(); |
| | | // String[] keys = {}; |
| | | // keys = strings.toArray(keys); |
| | | // Arrays.sort(keys); |
| | | // xmlString.append("<xml>"); |
| | | // for (int l = 0; l < keys.length; l++) { |
| | | // xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | // } |
| | | // xmlString.append("</xml>"); |
| | | // |
| | | // Map<String, String> map1 = null; |
| | | // String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | // //将结果xml解析成map |
| | | // body1 = body1.replaceAll("<!\\[CDATA\\[", ""); |
| | | // body1 = body1.replaceAll("]]>", ""); |
| | | // try { |
| | | // map1 = this.xmlToMap(body1, "UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String return_code = map1.get("return_code"); |
| | | // Map<String, String> map2 = new HashMap<>(); |
| | | // if ("SUCCESS".equals(return_code)) { |
| | | // String result_code = map1.get("result_code"); |
| | | // if ("SUCCESS".equals(result_code)) { |
| | | // map2.put("return_code", result_code); |
| | | // map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 |
| | | // map2.put("cmms_amt", String.valueOf(map1.get("cmms_amt")));//手续费金额 RMB:分 |
| | | // return map2; |
| | | // } else { |
| | | // map2.put("return_code", result_code); |
| | | // map2.put("err_code", map1.get("err_code")); |
| | | // map2.put("err_code_des", map1.get("err_code_des")); |
| | | // return map2; |
| | | // } |
| | | // } else { |
| | | // map2.put("return_code", return_code); |
| | | // map2.put("return_msg", map1.get("return_msg")); |
| | | // return map2; |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * 微信转账到银行卡不编号 |
| | | // * |
| | | // * @param bankName |
| | | // * @return |
| | | // */ |
| | | // public String findBankCode(String bankName) { |
| | | // String json = "{\"工商银行 \":1002,\"农业银行\":1005,\"建设银行\":1003,\"中国银行\":1026,\"交通银行 \":1020,\"招商银行 \":1001,\"邮储银行\":1066,\"民生银行 \":1006,\"平安银行 \":1010,\"中信银行\":1021,\"浦发银行 \":1004,\"兴业银行 \":1009,\"光大银行 \":1022,\"广发银行\":1027,\"华夏银行\":1025,\"宁波银行\":1056,\"北京银行\":4836,\"上海银行\":1024,\"南京银行\":1054,\"长子县融汇村镇银行\":4755,\"长沙银行\":4216,\"浙江泰隆商业银行\":4051,\"中原银行 \":4753,\"企业银行(中国)\":4761,\"顺德农商银行 \":4036,\"衡水银行\":4752,\"长治银行\":4756,\"大同银行\":4767,\"河南省农村信用社\":4115,\"宁夏黄河农村商业银行\":4150,\"山西省农村信用社\":4156,\"安徽省农村信用社\":4166,\"甘肃省农村信用社\":4157,\"天津农村商业银行\":4153,\"广西壮族自治区农村信用社\":4113,\"陕西省农村信用社\":4108,\"深圳农村商业银行\":4076,\"宁波鄞州农村商业银行\":4052,\"浙江省农村信用社联合社\":4764,\"江苏省农村信用社联合社\":4217,\"江苏紫金农村商业银行股份有限公司 \":4072,\"北京中关村银行股份有限公司 \":4769,\"星展银行( 中国) 有限公司 \":4778,\"枣庄银行股份有限公司 \":4766,\"海口联合农村商业银行股份有限公司 \":4758,\"南洋商业银行( 中国) 有限公司 \":4763}"; |
| | | // JSONObject jsonObject = JSON.parseObject(json); |
| | | // Set<String> strings = jsonObject.keySet(); |
| | | // for (String key : strings) { |
| | | // if (key.indexOf(bankName) >= 0) { |
| | | // return jsonObject.getString(key); |
| | | // } |
| | | // } |
| | | // return ""; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 支付宝转账 |
| | | // * |
| | | // * @param out_biz_no 商家侧唯一订单号,由商家自定义。对于不同转账请求,商家需保证该订单号在自身系统唯一。 |
| | | // * @param trans_amount 订单总金额,单位为元,精确到小数点后两位 |
| | | // * @param order_title 转账业务的标题,用于在支付宝用户的账单里显示 |
| | | // * @param identity 参与方的唯一标识(收款方支付宝账号) |
| | | // * @param name 参与方真实姓名,如果非空,将校验收款支付宝账号姓名一致性。 |
| | | // * @param remark 业务备注 |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // public Map<String, Object> aliTransfer(String out_biz_no, Double trans_amount, String order_title, String identity, String name, String remark) throws Exception { |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); |
| | | // certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); //gateway:支付宝网关(固定)https://openapi.alipay.com/gateway.do |
| | | // certAlipayRequest.setAppId(aliAppid); //APPID 即创建应用后生成,详情见创建应用并获取 APPID |
| | | // certAlipayRequest.setPrivateKey(appPrivateKey); //开发者应用私钥,由开发者自己生成 |
| | | // certAlipayRequest.setFormat("json"); //参数返回格式,只支持 json 格式 |
| | | // certAlipayRequest.setCharset("UTF-8"); //请求和签名使用的字符编码格式,支持 GBK和 UTF-8 |
| | | // certAlipayRequest.setSignType("RSA2"); //商户生成签名字符串所使用的签名算法类型,目前支持 RSA2 和 RSA,推荐商家使用 RSA2。 |
| | | // certAlipayRequest.setCertPath(app_cert_path); //应用公钥证书路径(app_cert_path 文件绝对路径) |
| | | // certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); //支付宝公钥证书文件路径(alipay_cert_path 文件绝对路径) |
| | | // certAlipayRequest.setRootCertPath(alipay_root_cert_path); //支付宝CA根证书文件路径(alipay_root_cert_path 文件绝对路径) |
| | | // AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | // AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest(); |
| | | // request.setBizContent("{" + |
| | | // "\"out_biz_no\":\"" + out_biz_no + "\"," + |
| | | // "\"trans_amount\":" + trans_amount + "," + |
| | | // "\"product_code\":\"TRANS_ACCOUNT_NO_PWD\"," + |
| | | // "\"biz_scene\":\"DIRECT_TRANSFER\"," + |
| | | // "\"order_title\":\"" + order_title + "\"," + |
| | | // "\"payee_info\":{" + |
| | | // "\"identity\":\"" + identity + "\"," + |
| | | // "\"identity_type\":\"ALIPAY_USER_ID\"," + |
| | | // "\"name\":\"" + name + "\"," + |
| | | // "}," + |
| | | // "\"remark\":\"" + remark + "\"" + |
| | | // "}"); |
| | | // AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // if (response.isSuccess()) { |
| | | // String status = response.getStatus(); |
| | | // if (status.equals("SUCCESS")) {//成功 |
| | | // map.put("code", response.getCode()); |
| | | // map.put("order_id", response.getOrderId());//支付宝订单号 |
| | | // map.put("pay_fund_order_id", response.getPayFundOrderId());//支付宝流水号 |
| | | // } else { |
| | | // map.put("code", response.getCode()); |
| | | // map.put("sub_msg", response.getSubMsg()); |
| | | // } |
| | | // } else { |
| | | // map.put("code", response.getSubCode()); |
| | | // map.put("sub_msg", response.getSubMsg()); |
| | | // } |
| | | // return map; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 获取请求内容 |
| | | // * |
| | | // * @param request |
| | | // * @return |
| | | // * @throws IOException |
| | | // */ |
| | | // private String getParam(HttpServletRequest request) throws IOException { |
| | | // // 读取参数 |
| | | // InputStream inputStream; |
| | | // StringBuilder sb = new StringBuilder(); |
| | | // inputStream = request.getInputStream(); |
| | | // String s; |
| | | // BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); |
| | | // while ((s = in.readLine()) != null) { |
| | | // sb.append(s); |
| | | // } |
| | | // in.close(); |
| | | // inputStream.close(); |
| | | // return sb.toString(); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信下单的签名算法 |
| | | // * |
| | | // * @param map |
| | | // * @return |
| | | // */ |
| | | // private String weixinSignature(Map<String, Object> map) { |
| | | // try { |
| | | // Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | // List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | // Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | // public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | // return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | // } |
| | | // }); |
| | | // // 构造签名键值对的格式 |
| | | // StringBuilder sb = new StringBuilder(); |
| | | // for (Map.Entry<String, Object> item : infoIds) { |
| | | // if (item.getKey() != null || item.getKey() != "") { |
| | | // String key = item.getKey(); |
| | | // Object val = item.getValue(); |
| | | // if (!(val == "" || val == null)) { |
| | | // sb.append(key + "=" + val + "&"); |
| | | // } |
| | | // } |
| | | // } |
| | | // sb.append("key=" + key); |
| | | // String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | // return sign; |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信下单的签名算法 |
| | | // * |
| | | // * @param map |
| | | // * @return |
| | | // */ |
| | | // private String weixinSignature(Map<String, Object> map, String key_) { |
| | | // try { |
| | | // Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | // List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | // Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | // public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | // return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | // } |
| | | // }); |
| | | // // 构造签名键值对的格式 |
| | | // StringBuilder sb = new StringBuilder(); |
| | | // for (Map.Entry<String, Object> item : infoIds) { |
| | | // if (item.getKey() != null || item.getKey() != "") { |
| | | // String key = item.getKey(); |
| | | // Object val = item.getValue(); |
| | | // if (!(val == "" || val == null)) { |
| | | // sb.append(key + "=" + val + "&"); |
| | | // } |
| | | // } |
| | | // } |
| | | // sb.append("key=" + key_); |
| | | // String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | // return sign; |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 微信退款成功后的解密 |
| | | // * |
| | | // * @param req_info |
| | | // * @return |
| | | // */ |
| | | // private String wxDecrypt(String req_info) throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, |
| | | // InvalidKeyException, BadPaddingException, IllegalBlockSizeException { |
| | | // byte[] decode = Base64.getDecoder().decode(req_info); |
| | | // String sign = MD5AndKL.MD5Encode(key, "UTF-8").toLowerCase(); |
| | | // if (Security.getProvider("BC") == null) { |
| | | // Security.addProvider(new BouncyCastleProvider()); |
| | | // } |
| | | // Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); |
| | | // SecretKeySpec secretKeySpec = new SecretKeySpec(sign.getBytes(), "AES"); |
| | | // cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); |
| | | // return new String(cipher.doFinal(decode)); |
| | | // } |
| | | // |
| | | // |
| | | //// public static void main(String[] ages){ |
| | | //// PayMoneyUtil payMoneyUtil = new PayMoneyUtil(); |
| | | //// ResultUtil ce = payMoneyUtil.alipay("测试", "测试", "", "121456457", "10", "http://123.com"); |
| | | //// System.err.println(ce); |
| | | //// ResultUtil resultUtil = null; |
| | | //// try { |
| | | //// resultUtil = payMoneyUtil.queryALIOrder("121456457"); |
| | | //// } catch (Exception e) { |
| | | //// e.printStackTrace(); |
| | | //// } |
| | | //// System.err.println(resultUtil); |
| | | //// } |
| | | // |
| | | // |
| | | // /** |
| | | // * xml转map |
| | | // * |
| | | // * @param xml |
| | | // * @param charset |
| | | // * @return |
| | | // * @throws UnsupportedEncodingException |
| | | // * @throws DocumentException |
| | | // */ |
| | | // public static Map<String, String> xmlToMap(String xml, String charset) throws UnsupportedEncodingException, DocumentException { |
| | | // |
| | | // Map<String, String> respMap = new HashMap<String, String>(); |
| | | // |
| | | // SAXReader reader = new SAXReader(); |
| | | // Document doc = reader.read(new ByteArrayInputStream(xml.getBytes(charset))); |
| | | // Element root = doc.getRootElement(); |
| | | // xmlToMap(root, respMap); |
| | | // return respMap; |
| | | // } |
| | | // |
| | | // public static Map<String, String> xmlToMap(Element tmpElement, Map<String, String> respMap) { |
| | | // if (tmpElement.isTextOnly()) { |
| | | // respMap.put(tmpElement.getName(), tmpElement.getText()); |
| | | // return respMap; |
| | | // } |
| | | // |
| | | // @SuppressWarnings("unchecked") |
| | | // Iterator<Element> eItor = tmpElement.elementIterator(); |
| | | // while (eItor.hasNext()) { |
| | | // Element element = eItor.next(); |
| | | // xmlToMap(element, respMap); |
| | | // } |
| | | // return respMap; |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.jilongda.applet.utils; |
| | | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 定义生成随机码的工具类 |
| | | */ |
| | | public class UUIDUtil { |
| | | |
| | | private int i = 1; |
| | | |
| | | |
| | | /** |
| | | * 定义生成原生的UUID随机码 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNativeUUID() { |
| | | return UUID.randomUUID().toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成32位随机码 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getRandomCode() { |
| | | return UUIDUtil.getNativeUUID().replaceAll("-", ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取给定长度的随机码 |
| | | * |
| | | * @param num |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String getRandomCode(Integer num) throws Exception { |
| | | String str = null; |
| | | if (0 < num) { |
| | | if (num % 32 > 0) { |
| | | Integer s = num / 32; |
| | | Integer l = num % 32; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < s; i++) { |
| | | sb.append(UUIDUtil.getRandomCode()); |
| | | } |
| | | sb.append(UUIDUtil.getRandomCode().substring(0, l)); |
| | | str = sb.toString(); |
| | | } else if (num % 32 == 0) { |
| | | Integer s = num / 32; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < s; i++) { |
| | | sb.append(UUIDUtil.getRandomCode()); |
| | | } |
| | | str = sb.toString(); |
| | | } else { |
| | | str = UUIDUtil.getRandomCode().substring(0, num); |
| | | } |
| | | } else { |
| | | throw new Exception("参数只能大于0"); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取根据当前时间的字符串数据 |
| | | * |
| | | * @return |
| | | */ |
| | | public synchronized static String getTimeStr() { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmssS"); |
| | | return simpleDateFormat.format(new Date()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 获取数字随机码 |
| | | * @Author pzb |
| | | * @Date 2021/8/11 16:52 |
| | | * @Param |
| | | * @Return |
| | | * @Exception |
| | | */ |
| | | public static String getNumberRandom(Integer num) { |
| | | if (null == num) { |
| | | num = 32; |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < num; i++) { |
| | | sb.append(Double.valueOf(Math.random() * 10).intValue()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | //// This file is auto-generated, don't edit it. Thanks. |
| | | //package com.jilongda.applet.utils.dingding; |
| | | // |
| | | //import com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenResponse; |
| | | //import com.aliyun.tea.*; |
| | | // |
| | | //public class AccessTokenUtil { |
| | | // |
| | | // /** |
| | | // * 使用 Token 初始化账号Client |
| | | // * @return Client |
| | | // * @throws Exception |
| | | // */ |
| | | // public static com.aliyun.dingtalkoauth2_1_0.Client createClient() throws Exception { |
| | | // com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config(); |
| | | // config.protocol = "https"; |
| | | // config.regionId = "central"; |
| | | // return new com.aliyun.dingtalkoauth2_1_0.Client(config); |
| | | // } |
| | | // |
| | | // public static void gettoken() throws Exception { |
| | | //// java.util.List<String> args = java.util.Arrays.asList(args_); |
| | | // com.aliyun.dingtalkoauth2_1_0.Client client = AccessTokenUtil.createClient(); |
| | | // com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest getAccessTokenRequest = new com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest() |
| | | // .setAppKey("ding9xnitayotphtuaxa") |
| | | // .setAppSecret("8I88pUQgJyteYsGscECS-RAIkc-vh2HlJwDzX5dhIFkI4Avpo5D_dmXBQM9flVzC"); |
| | | // try { |
| | | // client.getAccessToken(getAccessTokenRequest); |
| | | // |
| | | // return; |
| | | // } catch (TeaException err) { |
| | | // if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) { |
| | | // // err 中含有 code 和 message 属性,可帮助开发定位问题 |
| | | // } |
| | | // |
| | | // } catch (Exception _err) { |
| | | // TeaException err = new TeaException(_err.getMessage(), _err); |
| | | // if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) { |
| | | // // err 中含有 code 和 message 属性,可帮助开发定位问题 |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.jilongda.applet.utils.dingding; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonParser; |
| | | import com.google.gson.JsonObject; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | public class DingTalkAccessTokenRequest { |
| | | |
| | | public static String getAccessTokenRequest() throws Exception { |
| | | // 定义URL |
| | | URL url = new URL("https://api.dingtalk.com/v1.0/oauth2/accessToken"); |
| | | |
| | | // 打开连接 |
| | | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| | | connection.setRequestMethod("POST"); |
| | | connection.setRequestProperty("Host", "api.dingtalk.com"); |
| | | connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); |
| | | connection.setDoOutput(true); // 设置允许输出 |
| | | |
| | | // 准备请求体 |
| | | String requestBody = "{\"appKey\":\"ding9xnitayotphtuaxa\",\"appSecret\":\"8I88pUQgJyteYsGscECS-RAIkc-vh2HlJwDzX5dhIFkI4Avpo5D_dmXBQM9flVzC\"}"; |
| | | |
| | | // 发送请求 |
| | | try (OutputStream outputStream = connection.getOutputStream()) { |
| | | outputStream.write(requestBody.getBytes(StandardCharsets.UTF_8)); |
| | | } |
| | | |
| | | // 获取响应码,假设我们需要检查是否成功 |
| | | int responseCode = connection.getResponseCode(); |
| | | connection.getResponseMessage(); |
| | | System.out.println("Response Code : " + responseCode); |
| | | if (responseCode == HttpURLConnection.HTTP_OK) { // 如果状态码为200 |
| | | try (BufferedReader in = new BufferedReader( |
| | | new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { |
| | | String inputLine; |
| | | StringBuffer response = new StringBuffer(); |
| | | |
| | | while ((inputLine = in.readLine()) != null) { |
| | | response.append(inputLine); |
| | | } |
| | | |
| | | // 打印或处理响应数据 |
| | | System.out.println("Response Data: " + response.toString()); |
| | | JSONObject jsonObject = JSONObject.parseObject(response.toString()); |
| | | String o = (String) jsonObject.get("accessToken"); |
| | | return o; |
| | | |
| | | } |
| | | } else { |
| | | System.err.println("Failed with HTTP error code : " + responseCode); |
| | | } |
| | | |
| | | // 如果需要读取响应体,可以使用以下代码: |
| | | // BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | // String inputLine; |
| | | // StringBuffer response = new StringBuffer(); |
| | | // while ((inputLine = in.readLine()) != null) { |
| | | // response.append(inputLine); |
| | | // } |
| | | // in.close(); |
| | | |
| | | // 这里我们没有处理响应体,实际应用中需要根据API的响应结构来解析JSON并处理结果 |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @ClassName AppOrderGoodsVO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/17 15:01 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppOrderGoodsVO { |
| | | |
| | | @ApiModelProperty(value = "订单商品id") |
| | | private Long orderGoodsId; |
| | | @ApiModelProperty(value = "产品规格id") |
| | | private Long specId; |
| | | |
| | | @ApiModelProperty(value = "产品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "产品图片") |
| | | private String goodsPicture; |
| | | |
| | | @ApiModelProperty(value = "规格") |
| | | private String goodsSpecifications; |
| | | |
| | | @ApiModelProperty(value = "产品价格") |
| | | private String goodsPrice; |
| | | |
| | | @ApiModelProperty(value = "修改后价格") |
| | | private String updateGoodsPrice; |
| | | |
| | | @ApiModelProperty(value = "购买数量") |
| | | private Integer buyNum; |
| | | |
| | | @ApiModelProperty(value = "商品小计") |
| | | private String goodsTotal; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName AppOrderPageVO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/17 14:58 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppOrderPageVO { |
| | | |
| | | @ApiModelProperty("订单id") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty("订单状态(1待审批,2已通过,3已拒绝,4待发货,5已发货,6.已撤回)") |
| | | private Integer orderStatus; |
| | | |
| | | @ApiModelProperty(value = "订单金额") |
| | | private BigDecimal orderAmount; |
| | | |
| | | @ApiModelProperty(value = "检测报告") |
| | | private String reportPics; |
| | | @ApiModelProperty(value = "审核人名称") |
| | | private String passName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "订单商品列表") |
| | | private List<AppOrderGoodsVO> goodsList; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName AppOrderVO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/17 16:27 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppOrderVO { |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "订单状态(1待审批,2已通过,3已拒绝,4待发货,5已发货,6.已撤回)") |
| | | private Integer orderStatus; |
| | | |
| | | @ApiModelProperty(value = "客户收货地址id") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "公司名") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "子公司名") |
| | | private String subsidiaryName; |
| | | |
| | | @ApiModelProperty(value = "收件人姓名") |
| | | private String recipientName; |
| | | |
| | | @ApiModelProperty(value = "收件人电话") |
| | | private String recipientPhone; |
| | | |
| | | @ApiModelProperty(value = "收件地址") |
| | | private String recipientAddress; |
| | | |
| | | @ApiModelProperty(value = "订单金额") |
| | | private String orderAmount; |
| | | |
| | | @ApiModelProperty(value = "款期") |
| | | private LocalDateTime paymentTerms; |
| | | |
| | | @ApiModelProperty(value = "发票类型1专票、2普票、3不开票") |
| | | private Integer invoiceType; |
| | | |
| | | @ApiModelProperty(value = "物流1自提,2配送") |
| | | private Integer logistics; |
| | | |
| | | @ApiModelProperty(value = "要求到货时间") |
| | | private LocalDate expectedDeliveryDate; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "下单人员") |
| | | private String orderingPerson; |
| | | |
| | | @ApiModelProperty(value = "审批人") |
| | | private String passUser; |
| | | |
| | | @ApiModelProperty(value = "审批备注") |
| | | private String passRemark; |
| | | |
| | | @ApiModelProperty(value = "检测报告") |
| | | private String reportPics; |
| | | |
| | | private String passName; |
| | | |
| | | @ApiModelProperty(value = "订单商品列表") |
| | | private List<AppOrderGoodsVO> goodsList; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Pattern; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @ClassName AppUserVO |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2024/4/18 9:50 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class AppUserVO { |
| | | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "用户昵称") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "微信头像地址") |
| | | private String avatarUrl; |
| | | |
| | | @ApiModelProperty(value = "省") |
| | | private String province; |
| | | |
| | | @ApiModelProperty(value = "市") |
| | | private String city; |
| | | |
| | | @ApiModelProperty(value = "区") |
| | | private String area; |
| | | |
| | | @ApiModelProperty(value = "详细地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "生日") |
| | | private LocalDateTime birthday; |
| | | |
| | | @ApiModelProperty(value = "1男2女0未知") |
| | | private Integer gender; |
| | | |
| | | @ApiModelProperty(value = "职位1总经理2销售总监3业务经理") |
| | | private Integer userType; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import com.jilongda.common.model.TGoods; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.License; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("产品详情VO") |
| | | public class GoodDetailVO extends TGoods { |
| | | @ApiModelProperty(value = "产品价格") |
| | | private List<BigDecimal> price; |
| | | @ApiModelProperty(value = "是否为常用商品1是0否") |
| | | private Integer isUsual; |
| | | @ApiModelProperty(value = "产品规格") |
| | | private String specifications; |
| | | @ApiModelProperty(value = "总经理价格") |
| | | private List<BigDecimal> generalManagerPrice; |
| | | @ApiModelProperty(value = "销售总监价格") |
| | | private List<BigDecimal> salesDirector; |
| | | @ApiModelProperty(value = "客户经理价格") |
| | | private List<BigDecimal> accountManager; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.checkerframework.checker.units.qual.N; |
| | | |
| | | @Data |
| | | @ApiModel("主页商品Vo") |
| | | public class IndexGoodVO { |
| | | private Long id; |
| | | @ApiModelProperty(value = "产品名称") |
| | | private String goodsName; |
| | | @ApiModelProperty(value = "产品规格") |
| | | private String goodsSpecifications; |
| | | @ApiModelProperty(value = "产品图片") |
| | | private String goodsPicture; |
| | | @ApiModelProperty(value = "1是常用产品,0不是") |
| | | private Integer isUsual; |
| | | @ApiModelProperty(value = "已购数量") |
| | | private Integer count; |
| | | public IndexGoodVO() { |
| | | // 初始化时,如果 isUsual 为 null,则将其设为 0 |
| | | if (this.isUsual == null) { |
| | | this.isUsual = 0; |
| | | } |
| | | if (this.count == null) { |
| | | this.count = 0; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel("商品表实体") |
| | | public class PriceGoodsVo { |
| | | |
| | | @ApiModelProperty(value = "总经理价格") |
| | | private BigDecimal generalManagerPrice; |
| | | |
| | | @ApiModelProperty(value = "销售总监价格") |
| | | private BigDecimal salesDirector; |
| | | |
| | | @ApiModelProperty(value = "客户经理价格") |
| | | private BigDecimal accountManager; |
| | | @ApiModelProperty(value = "产品名称") |
| | | @TableField("goodInfo") |
| | | private String goodInfo; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | |
| | | import com.jilongda.applet.model.SecResources; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author madman |
| | | * @version 1.0 |
| | | * @date 2019/8/13 11:56 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @ApiModel(value = "资源vo") |
| | | public class SecResourceVO extends SecResources { |
| | | private static final long serialVersionUID = 2932580245701601388L; |
| | | @ApiModelProperty(value = "用户是否拥有此权限") |
| | | private Boolean flag; |
| | | |
| | | @ApiModelProperty(value = "子集列表,无则为[]") |
| | | private List<SecResourceVO> children = new ArrayList<>(); |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | |
| | | import com.jilongda.applet.model.SecResources; |
| | | import com.jilongda.applet.model.SecRole; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName SysUserRoleResouceVo |
| | | * @Description |
| | | * @date 2020-09-23 16:03 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class SecUserRoleResouceVO extends SecUser { |
| | | private static final long serialVersionUID = -4099422915334750845L; |
| | | /** |
| | | * 角色 |
| | | */ |
| | | List<SecRole> roles; |
| | | |
| | | /** |
| | | * 资源 |
| | | */ |
| | | List<SecResources> resources; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 10:42 |
| | | */ |
| | | @Data |
| | | @ApiModel("系统用户列表vo实体(通过Role查询)") |
| | | public class SecUserVO { |
| | | |
| | | @ApiModelProperty("角色id") |
| | | private Integer roleId; |
| | | |
| | | @ApiModelProperty("用户id") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty("账号姓名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("登陆账号") |
| | | private String account; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo; |
| | | |
| | | |
| | | import com.jilongda.applet.model.SecRole; |
| | | import com.jilongda.applet.model.SecUser; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/9/3 10:42 |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @ApiModel("系统用户列表vo实体") |
| | | public class SecUsersVO extends SecUser { |
| | | private static final long serialVersionUID = 8351204679799277051L; |
| | | @ApiModelProperty("角色名称") |
| | | private String rolename; |
| | | |
| | | @ApiModelProperty("角色id") |
| | | private String roleId; |
| | | |
| | | @ApiModelProperty("角色") |
| | | private SecRole secRole; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.vo.vo; |
| | | |
| | | import com.jilongda.common.model.TOrder; |
| | | import com.jilongda.common.model.TOrderGood; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "订单VO") |
| | | public class TOrderVO extends TOrder { |
| | | |
| | | @ApiModelProperty(value = "订单商品信息") |
| | | private List<TOrderGood> orderGoods; |
| | | |
| | | @ApiModelProperty(value = "公司名") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "子公司名") |
| | | private String subsidiaryName; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.body.resp; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * AccessToken 全局唯一 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | @Data |
| | | public class AccessTokenRespBody extends RespBody implements Serializable { |
| | | |
| | | /** |
| | | * 获取到的凭证 |
| | | */ |
| | | @JsonProperty("access_token") |
| | | private String accessToken; |
| | | /** |
| | | * 凭证有效时间,单位:秒 |
| | | */ |
| | | @JsonProperty("expires_in") |
| | | private int expiresIn; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.body.resp; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Code2SessionRespBody extends RespBody{ |
| | | /** |
| | | * 用户唯一标识 |
| | | */ |
| | | @JsonProperty("openid") |
| | | private String openid; |
| | | /** |
| | | * 会话密钥 |
| | | */ |
| | | @JsonProperty("session_key") |
| | | private String sessionKey; |
| | | /** |
| | | * 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台帐号下会返回,详见 UnionID 机制说明。 |
| | | */ |
| | | @JsonProperty("unionid") |
| | | private String unionid; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.body.resp; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName RespBody |
| | | * @Description |
| | | * @date 2021-07-28 11:44 |
| | | */ |
| | | @Data |
| | | public class RespBody { |
| | | @JsonProperty("errcode") |
| | | private Integer errorCode; |
| | | |
| | | @JsonProperty("errmsg") |
| | | private String errorMsg; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.body.resq; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName Code2SessionResqBody |
| | | * @Description |
| | | * @date 2021-07-28 11:47 |
| | | */ |
| | | @Data |
| | | public class Code2SessionResqBody { |
| | | @JsonProperty("js_code") |
| | | private String jsCode; |
| | | |
| | | public Code2SessionResqBody build(String jsCode) { |
| | | this.jsCode = jsCode; |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AppletUserDecodeData |
| | | * @Description |
| | | * @date 2021-08-13 17:46 |
| | | * 小程序加密数据体 |
| | | * |
| | | */ |
| | | @Data |
| | | public class AppletPhoneEncrypteData { |
| | | private String encryptedData; |
| | | private String openid; |
| | | private String unionid; |
| | | private String iv; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AppletUserDecodeData |
| | | * @Description |
| | | * @date 2021-08-13 17:46 |
| | | * 用户主体信息部分 |
| | | * { |
| | | * "openId": "OPENID", |
| | | * "nickName": "NICKNAME", |
| | | * "gender": GENDER, |
| | | * "city": "CITY", |
| | | * "province": "PROVINCE", |
| | | * "country": "COUNTRY", |
| | | * "avatarUrl": "AVATARURL", |
| | | * "unionId": "UNIONID", |
| | | * "watermark": |
| | | * { |
| | | * "appid":"APPID", |
| | | * "timestamp":TIMESTAMP |
| | | * } |
| | | * } |
| | | * 电话部分 |
| | | * { |
| | | * "phoneNumber": "13580006666", |
| | | * "purePhoneNumber": "13580006666", |
| | | * "countryCode": "86", |
| | | * "watermark": |
| | | * { |
| | | * "appid":"APPID", |
| | | * "timestamp": TIMESTAMP |
| | | * } |
| | | * } |
| | | * |
| | | */ |
| | | @Data |
| | | public class AppletUserDecodeData { |
| | | private String openId; |
| | | private String unionId; |
| | | private String nickName; |
| | | private int gender; |
| | | private String city; |
| | | private String province; |
| | | private String country; |
| | | private String avatarUrl; |
| | | private Watermark watermark; |
| | | private String phoneNumber; |
| | | private String purePhoneNumber; |
| | | private String countryCode; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AppletUserDecodeData |
| | | * @Description |
| | | * @date 2021-08-13 17:46 |
| | | * 小程序加密数据体 |
| | | * |
| | | */ |
| | | @Data |
| | | public class AppletUserEncrypteData extends AppletPhoneEncrypteData { |
| | | private String rawData; |
| | | private String signature; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Watermark { |
| | | private String appid; |
| | | private String timestamp; |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.JsonSerializer; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.jilongda.common.config.JacksonConfig; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * Json转换工具类 |
| | | * 参考:https://blog.csdn.net/weixin_38413579/article/details/82562634 |
| | | * @author madman |
| | | */ |
| | | @Slf4j |
| | | public final class JsonUtils { |
| | | |
| | | private static final ObjectMapper OM = new ObjectMapper(); |
| | | private static final JavaTimeModule timeModule = new JavaTimeModule(); |
| | | |
| | | /** |
| | | * 转换LocalDateTime |
| | | */ |
| | | static class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> { |
| | | @Override |
| | | public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDateTime.format(DateTimeFormatter.ofPattern(JacksonConfig.dateTimeFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换LocalDate |
| | | */ |
| | | static class LocalDateSerializer extends JsonSerializer<LocalDate> { |
| | | @Override |
| | | public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDate.format(DateTimeFormatter.ofPattern(JacksonConfig.dateFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置 ObjectMapper |
| | | * |
| | | * @return |
| | | */ |
| | | private static ObjectMapper getObjectMapper() { |
| | | // 序列化 |
| | | timeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer()); |
| | | timeModule.addSerializer(LocalDate.class, new LocalDateSerializer()); |
| | | // 反序列化 |
| | | timeModule.addDeserializer(LocalDateTime.class, |
| | | new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(JacksonConfig.dateTimeFormat))); |
| | | timeModule.addDeserializer(LocalDate.class, |
| | | new LocalDateDeserializer(DateTimeFormatter.ofPattern(JacksonConfig.dateFormat))); |
| | | // 允许对象忽略json中不存在的属性 |
| | | OM.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | OM.registerModule(timeModule); |
| | | return OM; |
| | | } |
| | | |
| | | /** |
| | | * 将对象序列化 |
| | | */ |
| | | public static <T> String toJsonString(T obj) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.writeValueAsString(obj); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("转json字符串失败:{}", obj); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化对象字符串 |
| | | */ |
| | | public static <T> T parseObject(String json, Class<T> clazz) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, clazz); |
| | | } catch (JsonProcessingException e) { |
| | | throw new ServiceException("反序列化对象字符串失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化字符串成为对象 |
| | | */ |
| | | public static <T> T parseObject(String json, TypeReference<T> valueTypeRef) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, valueTypeRef); |
| | | } catch (JsonProcessingException e) { |
| | | throw new ServiceException("反序列化字符串成为对象失败"); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class SHA1 { |
| | | |
| | | |
| | | /** |
| | | * 用SHA1算法生成安全签名 |
| | | * |
| | | * @param str |
| | | * @return |
| | | * @throws WxException |
| | | */ |
| | | public static String getSHA1(String str) throws WxException { |
| | | try { |
| | | // SHA1签名生成 |
| | | MessageDigest md = MessageDigest.getInstance("SHA-1"); |
| | | md.update(str.getBytes()); |
| | | byte[] digest = md.digest(); |
| | | StringBuffer hexstr = new StringBuffer(); |
| | | String shaHex; |
| | | for (int i = 0; i < digest.length; i++) { |
| | | shaHex = Integer.toHexString(digest[i] & 0xFF); |
| | | if (shaHex.length() < 2) { |
| | | hexstr.append(0); |
| | | } |
| | | hexstr.append(shaHex); |
| | | } |
| | | return hexstr.toString(); |
| | | } catch (Exception e) { |
| | | throw new WxException(WxException.ComputeSignatureError); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | /** |
| | | * @Author xiaochen |
| | | * @Date 2019/08/26 10:28 AM |
| | | * @Description |
| | | */ |
| | | public final class WebUtils { |
| | | |
| | | private WebUtils() { |
| | | } |
| | | |
| | | /** |
| | | * 当前请求 |
| | | */ |
| | | public static HttpServletRequest request() { |
| | | return contextHolder() == null ? null : contextHolder().getRequest(); |
| | | } |
| | | |
| | | /** |
| | | * 当前响应 |
| | | */ |
| | | public static HttpServletResponse response() { |
| | | return contextHolder() == null ? null : contextHolder().getResponse(); |
| | | } |
| | | |
| | | /** |
| | | * 当前session |
| | | */ |
| | | public static HttpSession session() { |
| | | return request() == null ? null : request().getSession(); |
| | | } |
| | | |
| | | /** |
| | | * 当前ServletRequest |
| | | */ |
| | | public static ServletRequestAttributes contextHolder() { |
| | | return (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | import lombok.Value; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.boot.context.properties.NestedConfigurationProperty; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName WeixinProperties |
| | | * @Description |
| | | * @date 2021-07-28 13:55 |
| | | */ |
| | | @ToString |
| | | @Component |
| | | @Data |
| | | @ConfigurationProperties(prefix = "wx.conf") |
| | | public class WeixinProperties { |
| | | /** |
| | | * 默认开启 |
| | | */ |
| | | private boolean enabled = true; |
| | | /** |
| | | * 获取 App ID |
| | | * |
| | | * @return App ID |
| | | */ |
| | | @JsonProperty("appId") |
| | | private String appId; |
| | | /** |
| | | * 获取 Mch ID |
| | | * |
| | | * @return Mch ID |
| | | */ |
| | | @JsonProperty("mchId") |
| | | private String mchId; |
| | | |
| | | /** |
| | | * 获取 secret ID |
| | | * |
| | | * @return secret ID |
| | | */ |
| | | @JsonProperty("secretId") |
| | | private String secretId; |
| | | |
| | | /** |
| | | * 审批模板id |
| | | */ |
| | | @JsonProperty("templateApproveId") |
| | | private String templateApproveId; |
| | | |
| | | public String getSecretId() { |
| | | return secretId; |
| | | } |
| | | |
| | | public void setSecretId(String secretId) { |
| | | this.secretId = secretId; |
| | | } |
| | | |
| | | /** |
| | | * HTTP(S) 连接超时时间,单位毫秒 |
| | | * |
| | | */ |
| | | public int getHttpConnectTimeoutMs() { |
| | | return 6 * 1000; |
| | | } |
| | | |
| | | /** |
| | | * HTTP(S) 读数据超时时间,单位毫秒 |
| | | */ |
| | | public int getHttpReadTimeoutMs() { |
| | | return 8 * 1000; |
| | | } |
| | | |
| | | public String getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(String appId) { |
| | | this.appId = appId; |
| | | } |
| | | |
| | | public String getMchId() { |
| | | return mchId; |
| | | } |
| | | |
| | | public void setMchId(String mchId) { |
| | | this.mchId = mchId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import com.jilongda.applet.wx.body.resp.AccessTokenRespBody; |
| | | import com.jilongda.applet.wx.body.resp.Code2SessionRespBody; |
| | | import com.jilongda.applet.wx.body.resq.Code2SessionResqBody; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.text.MessageFormat; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName WxAppletTools |
| | | * @Description |
| | | * @date 2020-12-04 13:55 |
| | | */ |
| | | @Slf4j |
| | | public class WxAppletTools { |
| | | private final static String ACCESSTOKEN_CACHE_KEY = "accessToken"; |
| | | /** |
| | | * 请求参数 |
| | | * 属性 类型 默认值 必填 说明 |
| | | * appid string 是 小程序 appId |
| | | * secret string 是 小程序 appSecret |
| | | * js_code string 是 登录时获取的 code |
| | | * grant_type string 是 授权类型,此处只需填写 authorization_cod |
| | | * <p> |
| | | * 返回值: |
| | | * <p> |
| | | * 属性 类型 说明 |
| | | * openid string 用户唯一标识 |
| | | * session_key string 会话密钥 |
| | | * unionid string 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台帐号下会返回,详见 UnionID 机制说明。 |
| | | * errcode number 错误码 |
| | | * errmsg string 错误信息 |
| | | */ |
| | | private static final String JSCODE_2_SESSION_URL = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"; |
| | | /** |
| | | * 请求参数 |
| | | * 属性 类型 默认值 必填 说明 |
| | | * grant_type string 是 填写 client_credential |
| | | * appid string 是 小程序唯一凭证,即 AppID,可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态) |
| | | * secret string 是 小程序唯一凭证密钥,即 AppSecret,获取方式同 appid |
| | | * 返回值 |
| | | * Object |
| | | * 返回的 JSON 数据包 |
| | | * <p> |
| | | * 属性 类型 说明 |
| | | * access_token string 获取到的凭证 |
| | | * expires_in number 凭证有效时间,单位:秒。目前是7200秒之内的值。 |
| | | * errcode number 错误码 |
| | | * errmsg string 错误信息 |
| | | */ |
| | | public static String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"; |
| | | private WeixinProperties wxConfig; |
| | | private RestTemplate wxRestTemplate; |
| | | private WxCacheTemplate<String> wxCacheTemplate; |
| | | |
| | | public WxAppletTools(RestTemplate wxRestTemplate, WeixinProperties wxConfig, WxCaffineCache wxCacheTemplate) { |
| | | this.wxRestTemplate = wxRestTemplate; |
| | | this.wxCacheTemplate = wxCacheTemplate; |
| | | this.wxConfig = wxConfig; |
| | | } |
| | | |
| | | public WxAppletTools(RestTemplate wxRestTemplate, WeixinProperties wxConfig) { |
| | | this.wxRestTemplate = wxRestTemplate; |
| | | this.wxConfig = wxConfig; |
| | | } |
| | | |
| | | /** |
| | | * 自定义部分数据 |
| | | * |
| | | * @param wxConfig |
| | | * @return |
| | | */ |
| | | public WxAppletTools build(WeixinProperties wxConfig) { |
| | | this.wxConfig = wxConfig; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * @param resqBody |
| | | * @return |
| | | */ |
| | | public Code2SessionRespBody getOpenIdByJscode2session(Code2SessionResqBody resqBody) { |
| | | long start = System.currentTimeMillis(); |
| | | String requestUrl = MessageFormat.format(JSCODE_2_SESSION_URL, wxConfig.getAppId(), wxConfig.getSecretId(), resqBody.getJsCode()); |
| | | long end = System.currentTimeMillis(); |
| | | log.info("code换取sessionKey时间:{}", (end - start)); |
| | | String respBody = wxRestTemplate.getForEntity(requestUrl, String.class).getBody(); |
| | | end = System.currentTimeMillis(); |
| | | log.info("code换取sessionKey时间:{}", (end - start)); |
| | | log.info("Jscode2session:{}", respBody); |
| | | Code2SessionRespBody code2SessionRespBody = WxJsonUtils.parseObject(respBody, Code2SessionRespBody.class); |
| | | // 判断有误异常 |
| | | if (StringUtils.hasLength(code2SessionRespBody.getErrorMsg())) { |
| | | // 抛出错误 |
| | | throw new WxException(code2SessionRespBody.getErrorCode() + ":" + code2SessionRespBody.getErrorMsg()); |
| | | } |
| | | return code2SessionRespBody; |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | */ |
| | | public String getAccessToken() { |
| | | String accessToken = wxCacheTemplate.getKey(ACCESSTOKEN_CACHE_KEY); |
| | | if (StringUtils.hasLength(accessToken)) { |
| | | return accessToken; |
| | | } |
| | | String requestUrl = MessageFormat.format(ACCESS_TOKEN_URL, wxConfig.getAppId(), wxConfig.getSecretId()); |
| | | String respBody = wxRestTemplate.getForEntity(requestUrl, String.class).getBody(); |
| | | AccessTokenRespBody accessTokenRespBody = WxJsonUtils.parseObject(respBody, AccessTokenRespBody.class); |
| | | // 判断有误异常 |
| | | if (StringUtils.hasLength(accessTokenRespBody.getErrorMsg())) { |
| | | // 抛出错误 |
| | | throw new WxException(accessTokenRespBody.getErrorCode() + ":" + accessTokenRespBody.getErrorMsg()); |
| | | } |
| | | wxCacheTemplate.setKey(ACCESSTOKEN_CACHE_KEY, accessTokenRespBody.getAccessToken()); |
| | | return accessTokenRespBody.getAccessToken(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 缓存 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | class WxCache { |
| | | /** |
| | | * 缓存的初始化容量 |
| | | */ |
| | | private int initialCapacity = 50; |
| | | /** |
| | | * 缓存最大容量 |
| | | */ |
| | | private long maximumSize = 200L; |
| | | /** |
| | | * 缓存时长 |
| | | */ |
| | | private long duration = 7000L; |
| | | /** |
| | | * 时长单位,自动转换 |
| | | * 支持: |
| | | * 时 |
| | | * 分 |
| | | * 秒 |
| | | * 天 |
| | | */ |
| | | private TimeUnit timeunit = TimeUnit.SECONDS; |
| | | |
| | | public int getInitialCapacity() { |
| | | return initialCapacity; |
| | | } |
| | | |
| | | public void setInitialCapacity(int initialCapacity) { |
| | | this.initialCapacity = initialCapacity; |
| | | } |
| | | |
| | | public long getMaximumSize() { |
| | | return maximumSize; |
| | | } |
| | | |
| | | public void setMaximumSize(long maximumSize) { |
| | | this.maximumSize = maximumSize; |
| | | } |
| | | |
| | | |
| | | public long getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(long duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public TimeUnit getTimeunit() { |
| | | return timeunit; |
| | | } |
| | | |
| | | public void setTimeunit(TimeUnit timeunit) { |
| | | this.timeunit = timeunit; |
| | | } |
| | | |
| | | public static class Builder { |
| | | private int initialCapacity; |
| | | private long maximumSize; |
| | | private long duration; |
| | | private TimeUnit timeunit; |
| | | |
| | | public Builder setInitialCapacity(int initialCapacity) { |
| | | this.initialCapacity = initialCapacity; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setMaximumSize(long maximumSize) { |
| | | this.maximumSize = maximumSize; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setDuration(long duration) { |
| | | this.duration = duration; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setTimeUnit(TimeUnit timeunit) { |
| | | this.timeunit = timeunit; |
| | | return this; |
| | | } |
| | | |
| | | public WxCache build() { |
| | | return new WxCache(this); |
| | | } |
| | | } |
| | | |
| | | public static Builder options() { |
| | | return new Builder(); |
| | | } |
| | | |
| | | private WxCache(Builder builder) { |
| | | this.initialCapacity = 0 == builder.initialCapacity ? this.initialCapacity : builder.initialCapacity; |
| | | this.maximumSize = 0L == builder.maximumSize ? this.maximumSize : builder.maximumSize; |
| | | this.duration = 0L == builder.duration ? this.duration : builder.duration; |
| | | this.timeunit = null == builder.timeunit ? this.timeunit : builder.timeunit; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "WxCache{" + |
| | | "initialCapacity=" + initialCapacity + |
| | | ", maximumSize=" + maximumSize + |
| | | ", duration=" + duration + |
| | | ", timeunit=" + timeunit + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName WxCacheTemplate |
| | | * @Description |
| | | * @date 2021-01-11 11:27 |
| | | */ |
| | | public interface WxCacheTemplate<T> { |
| | | /** |
| | | * 保存key |
| | | * |
| | | * @param key |
| | | * @param value |
| | | * @return |
| | | */ |
| | | boolean setKey(String key, T value); |
| | | |
| | | /** |
| | | * 获取缓存 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | T getKey(String key); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | boolean delKey(String key); |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import com.github.benmanes.caffeine.cache.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AbstractCaffineCache |
| | | * @Description |
| | | * @date 2021-01-11 11:27 |
| | | */ |
| | | @Slf4j |
| | | class WxCaffineCache<T> implements WxCacheTemplate<T> { |
| | | /** |
| | | * 缓存环境 |
| | | */ |
| | | private String env = "wx"; |
| | | |
| | | /** |
| | | * 本地缓存实例 |
| | | */ |
| | | private LoadingCache<String, Object> loadingCache; |
| | | |
| | | /** |
| | | * 构造函数 |
| | | * |
| | | */ |
| | | public WxCaffineCache() { |
| | | WxCache cache = WxCache.options().setTimeUnit(TimeUnit.SECONDS).build(); |
| | | // 构建本地缓存实例 |
| | | this.loadingCache = caffineCacheManage(cache); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean setKey(String key, T value) { |
| | | if (Objects.isNull(this.loadingCache)) { |
| | | return Boolean.FALSE; |
| | | } |
| | | if (StringUtils.hasLength(this.env)) { |
| | | this.loadingCache.put(this.env + ":" + key, value); |
| | | } else { |
| | | this.loadingCache.put(key, value); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | @Override |
| | | public T getKey(String key) { |
| | | if (Objects.isNull(this.loadingCache)) { |
| | | return null; |
| | | } |
| | | try { |
| | | if (StringUtils.hasLength(this.env)) { |
| | | return (T) this.loadingCache.get(this.env + ":" + key); |
| | | } else { |
| | | return (T) this.loadingCache.get(key); |
| | | } |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean delKey(String key) { |
| | | if (Objects.isNull(this.loadingCache)) { |
| | | return Boolean.FALSE; |
| | | } |
| | | if (StringUtils.hasLength(this.env)) { |
| | | this.loadingCache.invalidate(this.env + ":" + key); |
| | | } else { |
| | | this.loadingCache.invalidate(key); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | /** |
| | | * 缓存管理 |
| | | * |
| | | * @param cache |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | private static <T> LoadingCache<String, T> caffineCacheManage(WxCache cache) { |
| | | log.info("初始化缓存的实体数据:{}", cache); |
| | | if (Objects.isNull(cache)) { |
| | | throw new NullPointerException("请实例化一个Cache对象!"); |
| | | } |
| | | LoadingCache<String, T> localcache = |
| | | // 构建本地缓存,调用链的方式 |
| | | // ,1000是设置缓存的初始化容量,maximumSize是设置缓存最大容量,当超过了最大容量,guava将使用LRU算法(最少使用算法),来移除缓存项 |
| | | // expireAfterAccess(12,TimeUnit.HOURS)设置缓存有效期为12个小时 |
| | | Caffeine.newBuilder().initialCapacity(cache.getInitialCapacity()).maximumSize(cache.getMaximumSize()) |
| | | // 设置写缓存后n秒钟过期 |
| | | // .expireAfterWrite(30, TimeUnit.SECONDS) |
| | | .expireAfterWrite(cache.getDuration(), cache.getTimeunit()) |
| | | // 设置读写缓存后n秒钟过期,实际很少用到,类似于expireAfterWrite |
| | | //.expireAfterAccess(googleCache.getDuration(), googleCache.getTimeunit()) |
| | | // 只阻塞当前数据加载线程,其他线程返回旧值 |
| | | //.refreshAfterWrite(10, TimeUnit.SECONDS) |
| | | // 设置缓存的移除通知//用户手动移除EXPLICIT, |
| | | // //用户手动替换REPLACED,//被垃圾回收COLLECTED,//超时过期EXPIRED,//SIZE由于缓存大小限制 |
| | | .removalListener(new RemovalListener<String, T>() { |
| | | @Override |
| | | public void onRemoval(String key, Object value, RemovalCause cause) { |
| | | log.info(key + ":" + value + ":" + cause.name()); |
| | | } |
| | | }) |
| | | // build里面要实现一个匿名抽象类 |
| | | .build(new CacheLoader<String, T>() { |
| | | // 这个方法是默认的数据加载实现,get的时候,如果key没有对应的值,就调用这个方法进行加载。此处是没有默认值则返回null |
| | | @Override |
| | | public T load(String key) throws Exception { |
| | | return null; |
| | | } |
| | | }); |
| | | return localcache; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | */ |
| | | public class WxException extends RuntimeException { |
| | | |
| | | private final static int OK = 0; |
| | | private final static int ValidateSignatureError = -40001; |
| | | private final static int ParseXmlError = -40002; |
| | | public final static int ComputeSignatureError = -40003; |
| | | private final static int IllegalAesKey = -40004; |
| | | private final static int ValidateAppidError = -40005; |
| | | private final static int EncryptAESError = -40006; |
| | | private final static int DecryptAESError = -40007; |
| | | private final static int IllegalBuffer = -40008; |
| | | |
| | | private int code; |
| | | |
| | | private static String getMessage(int code) { |
| | | switch (code) { |
| | | case ValidateSignatureError: |
| | | return "签名验证错误"; |
| | | case ParseXmlError: |
| | | return "xml解析失败"; |
| | | case ComputeSignatureError: |
| | | return "sha加密生成签名失败"; |
| | | case IllegalAesKey: |
| | | return "SymmetricKey非法"; |
| | | case ValidateAppidError: |
| | | return "appid校验失败"; |
| | | case EncryptAESError: |
| | | return "aes加密失败"; |
| | | case DecryptAESError: |
| | | return "aes解密失败"; |
| | | case IllegalBuffer: |
| | | return "解密后得到的buffer非法"; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | WxException(int code) { |
| | | super(getMessage(code)); |
| | | this.code = code; |
| | | } |
| | | |
| | | public WxException(String message) { |
| | | super(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wx.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.JsonSerializer; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * Json转换工具类 |
| | | * 参考:https://blog.csdn.net/weixin_38413579/article/details/82562634 |
| | | * @author madman |
| | | */ |
| | | @Slf4j |
| | | public final class WxJsonUtils { |
| | | public static final String dateFormat = "yyyy-MM-dd"; |
| | | public static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; |
| | | private static final ObjectMapper OM = new ObjectMapper(); |
| | | private static final JavaTimeModule timeModule = new JavaTimeModule(); |
| | | |
| | | /** |
| | | * 转换LocalDateTime |
| | | */ |
| | | static class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> { |
| | | @Override |
| | | public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDateTime.format(DateTimeFormatter.ofPattern(dateTimeFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换LocalDate |
| | | */ |
| | | static class LocalDateSerializer extends JsonSerializer<LocalDate> { |
| | | @Override |
| | | public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDate.format(DateTimeFormatter.ofPattern(dateFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置 ObjectMapper |
| | | * |
| | | * @return |
| | | */ |
| | | private static ObjectMapper getObjectMapper() { |
| | | // 序列化 |
| | | timeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer()); |
| | | timeModule.addSerializer(LocalDate.class, new LocalDateSerializer()); |
| | | // 反序列化 |
| | | timeModule.addDeserializer(LocalDateTime.class, |
| | | new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(dateTimeFormat))); |
| | | timeModule.addDeserializer(LocalDate.class, |
| | | new LocalDateDeserializer(DateTimeFormatter.ofPattern(dateFormat))); |
| | | // 允许对象忽略json中不存在的属性 |
| | | OM.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | OM.registerModule(timeModule); |
| | | return OM; |
| | | } |
| | | |
| | | /** |
| | | * 将对象序列化 |
| | | */ |
| | | public static <T> String toJsonString(T obj) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.writeValueAsString(obj); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("转json字符串失败:{}", obj); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化对象字符串 |
| | | */ |
| | | public static <T> T parseObject(String json, Class<T> clazz) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, clazz); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException("反序列化对象字符串失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化字符串成为对象 |
| | | */ |
| | | public static <T> T parseObject(String json, TypeReference<T> valueTypeRef) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, valueTypeRef); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException("反序列化字符串成为对象失败"); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.applet.wxtemplate; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Description 微信消息模板参数实体 |
| | | * @Author xiaochen |
| | | * @Date 2021/11/8 10:30 |
| | | */ |
| | | @Data |
| | | public class Template implements Serializable{ |
| | | |
| | | @ApiModelProperty(value = "消息内容") |
| | | private String value; |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 9091 |
| | | tomcat: |
| | | max-swallow-size: 500MB |
| | | servlet: |
| | | context-path: /app |
| | | spring: |
| | | thymeleaf: |
| | | cache: false |
| | | servlet: |
| | | multipart: |
| | | max-file-size: 500MB |
| | | max-request-size: 500MB |
| | | resolve-lazily: true #设置为懒加载,不然依然会捕获不到异常 |
| | | profiles: |
| | | active: dev |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | rabbitmq: |
| | | host: localhost |
| | | port: 5672 |
| | | username: guest #正式环境 |
| | | password: guest #正式环境 |
| | | #sagger文档属性配置 |
| | | mvc: |
| | | static-path-pattern: /** |
| | | pathmatch: |
| | | matching-strategy: ant_path_matcher |
| | | web: |
| | | swagger: |
| | | enabled: true |
| | | service-url: / |
| | | title: 小程序-接口文档 |
| | | description: 请求方式(application/json; charset=utf-8) |
| | | contact: |
| | | email: chenkun@lingser.com |
| | | name: 无关风月 |
| | | req-fixed-parameters: |
| | | - { paramKey: 'token', description: '登录返回的token',required: false } |
| | | # mybatis |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapping/*.xml |
| | | logging: |
| | | file: |
| | | # path 及 name只能二选一,自定义名称选name,path的默认文件名spring.log |
| | | # path: /logs |
| | | name: logs/app.log |
| | | logback: |
| | | rollingpolicy: |
| | | max-history: 3 |
| | | level: |
| | | com: |
| | | sales: |
| | | manage: debug |
| | | debug: true |
| | | # 微信SDK |
| | | wx: |
| | | conf: |
| | | # 开启或关闭,默认开启,当支付信息无效时不能正常启动项目,可设为false |
| | | enabled: true |
| | | appId: wxb17e909bb2b1975f |
| | | secretId: eee8aae16bab075f1b3e51784e5dff6d |
| | | templateApproveId: jAt2UR8LtaDplqwHQFmAjvaqdLY0WVo16CVYKoZtcuo #申请审批消息模板id |
| | | #OSS及短信配置 |
| | | oss: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | |
| | | accessKeyId: LTAI5tPFeEGX87j4bwcmjyqV |
| | | accessKeySecret: lRVBAYB7bTVAMd0OjakACAALG0jFXl |
| | | endpoint: oss-cn-shanghai.aliyuncs.com |
| | | bucketName: sales-bucket |
| | | cdn: |
| | | signName: "药零科技" |
| | | templateCode: SMS_244030342 |
| | | |
| | | shareTemplateCode: SMS_251096901 |
| | | |
| | | file: |
| | | url: |
| | | ae: https://xsbf-2022.oss-cn-shanghai.aliyuncs.com/sales/1662966519668SAFETY%20DATA%20AND%20QUALITY%281%29.docx |
| | | sign: https://nn-bucket.oss-cn-shanghai.aliyuncs.com/sales/1663849389027%E7%AD%BE%E5%88%B0%E8%A1%A8%EF%BC%88%E4%B8%8B%E8%BD%BD%E6%A8%A1%E6%9D%BF%EF%BC%89.docx |
| | | cost: https://xsbf-2022.oss-cn-shanghai.aliyuncs.com/sales/1662966747647%E8%B4%B9%E7%94%A8%E7%A1%AE%E8%AE%A4%E8%A1%A8%E6%A8%A1%E6%9D%BF.xlsx |
| | | beforeActivityUrl: https://nn-bucket.oss-cn-shanghai.aliyuncs.com/sales/1663849178786%E6%B4%BB%E5%8A%A8%E5%89%8D%E8%AE%B2%E8%80%85%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE-%E5%8D%95%E6%AC%A1%E8%AE%B2%E8%AF%BE%EF%BC%88%E4%B8%8B%E8%BD%BD%E6%A8%A1%E6%9D%BF%EF%BC%89.docx |
| | | afterActivityUrl: https://nn-bucket.oss-cn-shanghai.aliyuncs.com/sales/1663849357042%E6%B4%BB%E5%8A%A8%E5%90%8E%E8%AE%B2%E8%80%85%E7%A1%AE%E8%AE%A4%E4%B9%A6%EF%BC%88%E4%B8%8B%E8%BD%BD%E6%A8%A1%E7%89%88%EF%BC%89.docx |
| | | yaoqinghanUrl: https://nn-bucket.oss-cn-shanghai.aliyuncs.com/sales/1666341482675%E4%BC%9A%E8%AE%AE%E9%82%80%E8%AF%B7%E5%87%BD.docx |
| | | uri: https://nncdn.pharmacylinked.com |
| | | #测试环境 |
| | | --- |
| | | spring: |
| | | config: |
| | | activate: |
| | | on-profile: dev |
| | | # 数据源 |
| | | datasource: |
| | | username: root #测试环境 |
| | | password: 123456 |
| | | url: jdbc:mysql://192.168.110.64:3306/eyes?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai |
| | | type: com.zaxxer.hikari.HikariDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | hikari: |
| | | minimum-idle: 10 |
| | | # 连接池大小 = (核心数*2 + 有效磁盘数) |
| | | maximum-pool-size: 5 |
| | | auto-commit: true |
| | | idle-timeout: 30000 |
| | | pool-name: DatebookHikariCP-Applet |
| | | max-lifetime: 1800000 |
| | | connection-timeout: 30000 |
| | | connection-test-query: SELECT 1 |
| | | redis: |
| | | #测试环境 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | timeout: 5000 |
| | | database: 10 |
| | | password: 123456 |
| | | alipay: |
| | | appid: "" |
| | | appPrivateKey: "" |
| | | alipayPublicKey: "" |
| | | alipay_public_key: "" |
| | | wx: |
| | | appid: "" |
| | | mchId: "" |
| | | key: |
| | | callbackPath: "" |
| | | |
| | | hw: |
| | | sms: |
| | | url: "url" |
| | | appKey: "appKey" |
| | | appSecret: "appSecret" |
| | | sender: "sender" |
| | | templateId: "templateId" |
| | | signature: "signature" |
| | | |
| | | #正式环境 |
| | | --- |
| | | spring: |
| | | config: |
| | | activate: |
| | | on-profile: prod |
| | | # 数据源 |
| | | datasource: |
| | | username: root |
| | | password: Xiwang2024! |
| | | url: jdbc:mysql://120.26.112.122:3306/jilongda?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai |
| | | type: com.zaxxer.hikari.HikariDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | hikari: |
| | | minimum-idle: 10 |
| | | # 连接池大小 = (核心数*2 + 有效磁盘数) |
| | | maximum-pool-size: 5 |
| | | auto-commit: true |
| | | idle-timeout: 30000 |
| | | pool-name: DatebookHikariCP-Applet |
| | | max-lifetime: 1800000 |
| | | connection-timeout: 30000 |
| | | connection-test-query: SELECT 1 |
| | | redis: |
| | | host: 120.26.112.122 |
| | | port: 6379 |
| | | timeout: 5000 |
| | | database: 1 |
| | | password: xsbf@2022 |
| | | alipay: |
| | | appid: "" |
| | | appPrivateKey: "" |
| | | alipayPublicKey: "" |
| | | alipay_public_key: "" |
| | | wx: |
| | | appid: "" |
| | | mchId: "" |
| | | key: |
| | | callbackPath: "" |
| | | |
| | | |
| | | hw: |
| | | sms: |
| | | url: "url" |
| | | appKey: "appKey" |
| | | appSecret: "appSecret" |
| | | sender: "sender" |
| | | templateId: "templateId" |
| | | signature: "signature" |
| | | |
| | | |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.LoginLogMapper"> |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.common.model.LoginLog"> |
| | | <id column="id" property="id"/> |
| | | <result column="user_name" property="userName"/> |
| | | <result column="account" property="account"/> |
| | | <result column="work_address" property="workAddress"/> |
| | | <result column="login_address" property="loginAddress"/> |
| | | <result column="login_time" property="loginTime"/> |
| | | <result column="login_ip" property="loginIp"/> |
| | | <result column="equipment" property="equipment"/> |
| | | <result column="open_id" property="openId"/> |
| | | <result column="applet_or_manage" property="appletOrManage"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id |
| | | , user_name, account, work_address, login_address, login_time, login_ip,equipment,open_id,applet_or_manage |
| | | </sql> |
| | | |
| | | <select id="pageList" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"> |
| | | </include> |
| | | from login_log |
| | | <where> |
| | | <if test="query.account != null and query.account != ''"> |
| | | AND account like concat('%',#{query.account},'%') |
| | | </if> |
| | | <if test="query.shortName != null and query.shortName != ''"> |
| | | AND user_name like concat('%',#{query.shortName},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.endTime != null"> |
| | | AND DATE_FORMAT(login_time, '%Y-%m-%d %H:%i:%s') >= #{query.startTime} |
| | | AND DATE_FORMAT(login_time, '%Y-%m-%d %H:%i:%s') <= #{query.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY login_time DESC |
| | | </select> |
| | | <select id="countToday" resultType="java.lang.Long"> |
| | | select count(DISTINCT (account)) |
| | | from login_log |
| | | where login_time like concat('%', #{today,jdbcType=DATE}, '%') |
| | | </select> |
| | | <select id="countYesterday" resultType="java.lang.Long"> |
| | | select count(DISTINCT (account)) |
| | | from login_log |
| | | where login_time like concat('%', #{yesterday,jdbcType=DATE}, '%') |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecFeeItemsMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecFeeItems"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="percent" property="percent" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, percent, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecResourcesMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecResources"> |
| | | <id column="id" property="id" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | <result column="title" property="title" /> |
| | | <result column="descriptions" property="descriptions" /> |
| | | <result column="sort" property="sort" /> |
| | | <result column="icon" property="icon" /> |
| | | <result column="name" property="name" /> |
| | | <result column="menu" property="menu" /> |
| | | <result column="component" property="component" /> |
| | | <result column="permit" property="permit" /> |
| | | <result column="cate" property="cate" /> |
| | | <result column="type" property="type" /> |
| | | <result column="hidden" property="hidden" /> |
| | | <result column="env_port" property="envPort" /> |
| | | <result column="path" property="path" /> |
| | | <result column="api_url" property="apiUrl" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, parent_id, title, descriptions, sort, icon, name, menu, component, permit, cate, type, hidden, env_port, path, api_url, createBy, createTime, updateBy, updateTime, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecRoleMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecRole"> |
| | | <id column="id" property="id" /> |
| | | <result column="rolename" property="rolename" /> |
| | | <result column="role_desc" property="roleDesc" /> |
| | | <result column="role_state" property="roleState" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, rolename, role_desc, role_state, createBy, createTime, updateBy, updateTime, isDelete, sortBy |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecRoleResourceMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecRoleResource"> |
| | | <result column="role_id" property="roleId" /> |
| | | <result column="resource_id" property="resourceId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | role_id, resource_id |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecSettingMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecSetting"> |
| | | <id column="id" property="id" /> |
| | | <result column="lensThreshold" property="lensThreshold" /> |
| | | <result column="frameThreshold" property="frameThreshold" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, lensThreshold, frameThreshold, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="account" property="account" /> |
| | | <result column="description" property="description" /> |
| | | <result column="password" property="password" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="state" property="state" /> |
| | | <result column="last_login_time" property="lastLoginTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="nick_name" property="nickName" /> |
| | | <result column="avatar_url" property="avatarUrl" /> |
| | | <result column="province" property="province" /> |
| | | <result column="city" property="city" /> |
| | | <result column="area" property="area" /> |
| | | <result column="address" property="address" /> |
| | | <result column="birthday" property="birthday" /> |
| | | <result column="gender" property="gender" /> |
| | | <result column="deptId" property="deptId" /> |
| | | <result column="userType" property="userType" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="areaCode" property="areaCode" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, account, description, password, phone, state, last_login_time, createBy, createTime, updateBy, updateTime, isDelete, nick_name, avatar_url, province, city, area, address, birthday, gender, deptId, userType, provinceCode, cityCode, areaCode |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.SecUserRoleMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.SecUserRole"> |
| | | <result column="role_id" property="roleId" /> |
| | | <result column="user_id" property="userId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | role_id, user_id |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TAppUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TAppUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="realName" property="realName" /> |
| | | <result column="age" property="age" /> |
| | | <result column="gender" property="gender" /> |
| | | <result column="registerTime" property="registerTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, phone, realName, age, gender, registerTime, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TBrandMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TBrand"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="type" property="type" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="isMain" property="isMain" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, type, status, createTime, updateTime, createBy, updateBy, isDelete, isMain |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TCouponMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TCoupon"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="type" property="type" /> |
| | | <result column="amount" property="amount" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="time" property="time" /> |
| | | <result column="amountCondition" property="amountCondition" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="grantStatus" property="grantStatus" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, type, amount, storeId, time, amountCondition, createTime, updateTime, createBy, updateBy, isDelete, grantStatus |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TCouponReceiveMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TCouponReceive"> |
| | | <id column="id" property="id" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="type" property="type" /> |
| | | <result column="amount" property="amount" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="endTime" property="endTime" /> |
| | | <result column="amountCondition" property="amountCondition" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, couponId, userId, type, amount, storeId, endTime, amountCondition, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TFrameWarehousingDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TFrameWarehousingDetail"> |
| | | <id column="id" property="id" /> |
| | | <result column="warehousingId" property="warehousingId" /> |
| | | <result column="brand" property="brand" /> |
| | | <result column="supplier" property="supplier" /> |
| | | <result column="material" property="material" /> |
| | | <result column="total" property="total" /> |
| | | <result column="count" property="count" /> |
| | | <result column="color" property="color" /> |
| | | <result column="model" property="model" /> |
| | | <result column="code" property="code" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="modelId" property="modelId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, warehousingId, brand, supplier, material, total, count, color, model, code, createTime, updateTime, createBy, updateBy, isDelete, modelId |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TInventoryFrameDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TInventoryFrameDetail"> |
| | | <id column="id" property="id" /> |
| | | <result column="inventoryId" property="inventoryId" /> |
| | | <result column="brand" property="brand" /> |
| | | <result column="supplier" property="supplier" /> |
| | | <result column="material" property="material" /> |
| | | <result column="total" property="total" /> |
| | | <result column="category" property="category" /> |
| | | <result column="color" property="color" /> |
| | | <result column="model" property="model" /> |
| | | <result column="count" property="count" /> |
| | | <result column="diff" property="diff" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, inventoryId, brand, supplier, material, total, category, color, model, count, diff, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TInventoryLensDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TInventoryLensDetail"> |
| | | <id column="id" property="id" /> |
| | | <result column="inventoryId" property="inventoryId" /> |
| | | <result column="series" property="series" /> |
| | | <result column="type" property="type" /> |
| | | <result column="total" property="total" /> |
| | | <result column="count" property="count" /> |
| | | <result column="diff" property="diff" /> |
| | | <result column="refractiveIndex" property="refractiveIndex" /> |
| | | <result column="ballMirror" property="ballMirror" /> |
| | | <result column="columnMirror" property="columnMirror" /> |
| | | <result column="category" property="category" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, inventoryId, series, type, total, count, diff, refractiveIndex, ballMirror, columnMirror, category, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TInventoryMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TInventory"> |
| | | <id column="id" property="id" /> |
| | | <result column="status" property="status" /> |
| | | <result column="type" property="type" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, status, type, storeId, remark, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TLensSeriesMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TLensSeries"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="brandId" property="brandId" /> |
| | | <result column="supplierId" property="supplierId" /> |
| | | <result column="type" property="type" /> |
| | | <result column="sphere" property="sphere" /> |
| | | <result column="asphericSurface" property="asphericSurface" /> |
| | | <result column="doubleNon" property="doubleNon" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, brandId, supplierId, type, sphere, asphericSurface, doubleNon, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TLensWarehousingDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TLensWarehousingDetail"> |
| | | <id column="id" property="id" /> |
| | | <result column="brand" property="brand" /> |
| | | <result column="supplier" property="supplier" /> |
| | | <result column="series" property="series" /> |
| | | <result column="refractiveIndex" property="refractiveIndex" /> |
| | | <result column="ballMirror" property="ballMirror" /> |
| | | <result column="columnMirror" property="columnMirror" /> |
| | | <result column="type" property="type" /> |
| | | <result column="total" property="total" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="count" property="count" /> |
| | | <result column="seriesId" property="seriesId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, brand, supplier, series, refractiveIndex, ballMirror, columnMirror, type, total, createTime, updateTime, createBy, updateBy, isDelete, count, seriesId |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TLineUpMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TLineUp"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="optometristId" property="optometristId" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, userId, optometristId, storeId, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TMaterialMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TMaterial"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TModelMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TModel"> |
| | | <id column="id" property="id" /> |
| | | <result column="brandId" property="brandId" /> |
| | | <result column="supplierId" property="supplierId" /> |
| | | <result column="materialId" property="materialId" /> |
| | | <result column="color" property="color" /> |
| | | <result column="sale" property="sale" /> |
| | | <result column="cost" property="cost" /> |
| | | <result column="name" property="name" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, brandId, supplierId, materialId, color, sale, cost, name, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TOptometristMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TOptometrist"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="status" property="status" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="img" property="img" /> |
| | | <result column="registerTime" property="registerTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, phone, status, storeId, img, registerTime, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TOptometryDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TOptometryDetail"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="optometryId" property="optometryId" /> |
| | | <result column="ballMirror" property="ballMirror" /> |
| | | <result column="columnMirror" property="columnMirror" /> |
| | | <result column="axis" property="axis" /> |
| | | <result column="add" property="add" /> |
| | | <result column="pupilHeight" property="pupilHeight" /> |
| | | <result column="pupilDistance" property="pupilDistance" /> |
| | | <result column="correct" property="correct" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="registerTime" property="registerTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, type, optometryId, ballMirror, columnMirror, axis, add, pupilHeight, pupilDistance, correct, storeId, status, registerTime, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TOptometryMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TOptometry"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="age" property="age" /> |
| | | <result column="gender" property="gender" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="optometristId" property="optometristId" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="registerTime" property="registerTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, userId, age, gender, name, phone, optometristId, storeId, status, registerTime, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TOrderAccountingMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TOrderAccounting"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="orderId" property="orderId" /> |
| | | <result column="rLens" property="rLens" /> |
| | | <result column="lLens" property="lLens" /> |
| | | <result column="frame" property="frame" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="commission" property="commission" /> |
| | | <result column="rLensProfit" property="rLensProfit" /> |
| | | <result column="lLensProfit" property="lLensProfit" /> |
| | | <result column="frameProfit" property="frameProfit" /> |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="profitMoney" property="profitMoney" /> |
| | | <result column="profitRating" property="profitRating" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, orderId, rLens, lLens, frame, createTime, updateTime, createBy, updateBy, isDelete, commission, rLensProfit, lLensProfit, frameProfit, payMoney, profitMoney, profitRating |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TOrderAftersalesMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TOrderAftersales"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="sysId" property="sysId" /> |
| | | <result column="optometristId" property="optometristId" /> |
| | | <result column="orderId" property="orderId" /> |
| | | <result column="reason" property="reason" /> |
| | | <result column="handleResult" property="handleResult" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, sysId, optometristId, orderId, reason, handleResult, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TOrder"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="optometryId" property="optometryId" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="modelId" property="modelId" /> |
| | | <result column="color" property="color" /> |
| | | <result column="series" property="series" /> |
| | | <result column="rLens" property="rLens" /> |
| | | <result column="lLens" property="lLens" /> |
| | | <result column="type" property="type" /> |
| | | <result column="refractiveIndex" property="refractiveIndex" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="sysId" property="sysId" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="itemsId" property="itemsId" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="isMail" property="isMail" /> |
| | | <result column="mailName" property="mailName" /> |
| | | <result column="mailPhone" property="mailPhone" /> |
| | | <result column="mailAddress" property="mailAddress" /> |
| | | <result column="orderMoney" property="orderMoney" /> |
| | | <result column="couponMoney" property="couponMoney" /> |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="isMachining" property="isMachining" /> |
| | | <result column="machiningCode" property="machiningCode" /> |
| | | <result column="isAccounting" property="isAccounting" /> |
| | | <result column="accountingName" property="accountingName" /> |
| | | <result column="accountingTime" property="accountingTime" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, userId, optometryId, storeId, modelId, color, series, rLens, lLens, type, refractiveIndex, createTime, updateTime, createBy, updateBy, isDelete, sysId, couponId, itemsId, remark, isMail, mailName, mailPhone, mailAddress, orderMoney, couponMoney, payMoney, isMachining, machiningCode, isAccounting, accountingName, accountingTime |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TStoreMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TStore"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="province" property="province" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="city" property="city" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="area" property="area" /> |
| | | <result column="areaCode" property="areaCode" /> |
| | | <result column="address" property="address" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="lon" property="lon" /> |
| | | <result column="lat" property="lat" /> |
| | | <result column="img" property="img" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, province, provinceCode, city, cityCode, area, areaCode, address, createTime, updateTime, createBy, updateBy, isDelete, lon, lat, img |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TSupplierMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TSupplier"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TTicketMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TTicket"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="type" property="type" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="cloudId" property="cloudId" /> |
| | | <result column="secret" property="secret" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, type, storeId, cloudId, secret, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.common.model.TUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="nickName" property="nickName" /> |
| | | <result column="userName" property="userName" /> |
| | | <result column="userPhone" property="userPhone" /> |
| | | <result column="password" property="password" /> |
| | | <result column="vipType" property="vipType" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | <result column="graduationInstitution" property="graduationInstitution" /> |
| | | <result column="selfIntroduction" property="selfIntroduction" /> |
| | | <result column="firstVipTime" property="firstVipTime" /> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="endTime" property="endTime" /> |
| | | <result column="consumptionAmount" property="consumptionAmount" /> |
| | | <result column="vipLevel" property="vipLevel" /> |
| | | <result column="sex" property="sex" /> |
| | | <result column="birthday" property="birthday" /> |
| | | <result column="weight" property="weight" /> |
| | | <result column="height" property="height" /> |
| | | <result column="provinceName" property="provinceName" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="cityName" property="cityName" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="performerCover" property="performerCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="openId" property="openId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="auditStatus" property="auditStatus" /> |
| | | <result column="auditRemark" property="auditRemark" /> |
| | | <result column="lastLoginTime" property="lastLoginTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="hot" property="hot" /> |
| | | <result column="performerStatus" property="performerStatus" /> |
| | | <result column="vedio" property="vedio" /> |
| | | <result column="hasPay" property="hasPay" /> |
| | | <result column="advatar" property="advatar" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, nickName, userName, userPhone, password, vipType, insertTime, graduationInstitution, selfIntroduction, firstVipTime, startTime, endTime, consumptionAmount, vipLevel, sex, birthday, weight, height, provinceName, provinceCode, cityName, cityCode, performerCover, detailPicture, openId, status, auditStatus, auditRemark, lastLoginTime, createTime, updateTime, createBy, updateBy, isDelete, hot, performerStatus, vedio, hasPay, advatar |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jilongda.applet.mapper.TWarehousingMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.jilongda.applet.model.TWarehousing"> |
| | | <id column="id" property="id" /> |
| | | <result column="status" property="status" /> |
| | | <result column="type" property="type" /> |
| | | <result column="storeId" property="storeId" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, status, type, storeId, remark, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> |
| | | <configuration> |
| | | |
| | | <settings> |
| | | <!-- 打印查询语句 不会写入到日志文件中--> |
| | | <setting name="logImpl" value="STDOUT_LOGGING"/> |
| | | <!--<setting name="logImpl" value="LOG4J" />--> |
| | | <!-- 控制全局缓存(二级缓存),按美团技术团队的说法,尽量别用缓存机制 emmmm.... --> |
| | | <setting name="cacheEnabled" value="true"/> |
| | | <!-- 延迟加载的全局开关。当开启时,所有关联对象都会延迟加载。默认 false --> |
| | | <!-- <setting name="lazyLoadingEnabled" value="true"/> --> |
| | | <!--<setting name="mapUnderscoreToCamelCase" value="false"/>--><!--是否将map下划线方式转为驼峰式命名--> |
| | | <!-- 当开启时,任何方法的调用都会加载该对象的所有属性。默认 false,可通过select标签的 fetchType来覆盖--> |
| | | <!-- <setting name="aggressiveLazyLoading" value="false"/>--> |
| | | <!-- Mybatis 创建具有延迟加载能力的对象所用到的代理工具,默认JAVASSIST --> |
| | | <!--<setting name="proxyFactory" value="CGLIB" />--> |
| | | <!-- 关于mybatis的一二级缓存 请参照:https://tech.meituan.com/2018/01/19/mybatis-cache.html --> |
| | | <!-- 一级缓存范围默认:SESSION ,此范围在复杂应用场景中可能会出现脏读数据--> |
| | | <!-- STATEMENT级别的缓存,使一级缓存,只针对当前执行的这一statement有效 --> |
| | | <!--<setting name="localCacheScope" value="STATEMENT"/>--> |
| | | <setting name="localCacheScope" value="STATEMENT"/> |
| | | </settings> |
| | | |
| | | </configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>sales</artifactId> |
| | | <groupId>com</groupId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>common</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | <hutool.version>5.3.8</hutool.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.alipay.sdk</groupId> |
| | | <artifactId>alipay-sdk-java</artifactId> |
| | | <version>4.8.10.ALL</version> |
| | | </dependency> |
| | | <!-- hutool工具类--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-core</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-crypto</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <!--通过ip获取地址--> |
| | | <dependency> |
| | | <groupId>com.maxmind.geoip2</groupId> |
| | | <artifactId>geoip2</artifactId> |
| | | <version>2.6.0</version> |
| | | </dependency> |
| | | <!--aop实现日志记录--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | | <!--oss--> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.10.2</version> |
| | | </dependency> |
| | | <!-- 阿里云短信 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>2.0.10</version> |
| | | </dependency> |
| | | <!--spirngboot集成rabbitmq--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-amqp</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.bouncycastle</groupId> |
| | | <artifactId>bcprov-jdk15on</artifactId> |
| | | <version>1.47</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-webmvc</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <!-- 保留swagger-ui默认文档 --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>3.0.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>knife4j-spring-boot-starter</artifactId> |
| | | <version>3.0.3</version> |
| | | </dependency> |
| | | <!-- swagger end--> |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>javax.servlet-api</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <!-- springboot end --> |
| | | |
| | | <!-- mybatis-plus start--> |
| | | <!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.4.3.4</version> |
| | | </dependency> |
| | | <!-- jdbc 连接包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>8.0.27</version> |
| | | </dependency> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpcore</artifactId> |
| | | <version>4.4.14</version> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | <version>4.5.13</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-configuration-processor</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.datatype</groupId> |
| | | <artifactId>jackson-datatype-jsr310</artifactId> |
| | | <version>2.12.5</version> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- jwt --> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | <version>0.9.1</version> |
| | | </dependency> |
| | | |
| | | <!--security--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.hibernate.validator</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>6.2.0.Final</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.ben-manes.caffeine</groupId> |
| | | <artifactId>caffeine</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.78</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.0.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>guava</artifactId> |
| | | <groupId>com.google.guava</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | <!--微信v3支付--> |
| | | <dependency> |
| | | <groupId>com.github.wechatpay-apiv3</groupId> |
| | | <artifactId>wechatpay-java</artifactId> |
| | | <version>0.2.12</version> |
| | | </dependency> |
| | | <!--支付宝v3支付--> |
| | | <dependency> |
| | | <groupId>com.alipay.sdk</groupId> |
| | | <artifactId>alipay-sdk-java-v3</artifactId> |
| | | <version>2.9.0.ALL</version> |
| | | </dependency> |
| | | |
| | | <!--华为云服务--> |
| | | <!--<dependency> |
| | | <groupId>com.huaweicloud.sdk</groupId> |
| | | <artifactId>huaweicloud-sdk-msgsms</artifactId> |
| | | <version>3.1.91</version> |
| | | </dependency>--> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.jilongda.common.basic; |
| | | |
| | | |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 前后端交互对象 |
| | | * |
| | | * @param <T> |
| | | */ |
| | | @ToString |
| | | public class ApiResult<T> implements Serializable { |
| | | private static final long serialVersionUID = 5870642374421413864L; |
| | | |
| | | private static final ApiResult<String> SUCCESS_RESULT = new ApiResult<>(); |
| | | |
| | | private static final ApiResult<String> ERROR_RESULT = new ApiResult<>(GlobalResultEnum.FAIL.getCode(), false, GlobalResultEnum.FAIL.getMessage()); |
| | | |
| | | private int code = GlobalResultEnum.SUCCESS.getCode(); |
| | | |
| | | /** |
| | | * 是否成功,默认true |
| | | */ |
| | | private boolean success = Boolean.TRUE; |
| | | /** |
| | | * 提示信息,默认"操作成功" |
| | | */ |
| | | private String msg = GlobalResultEnum.SUCCESS.getMessage(); |
| | | /** |
| | | * 返回数据 |
| | | */ |
| | | private T data; |
| | | |
| | | public ApiResult() { |
| | | this.setMsg(msg); |
| | | } |
| | | |
| | | public ApiResult(T data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | public ApiResult(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public ApiResult(int code, boolean success, String msg) { |
| | | this.code = code; |
| | | this.success = success; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public ApiResult(int code, boolean success, String msg, T data) { |
| | | this.code = code; |
| | | this.success = success; |
| | | this.msg = msg; |
| | | this.data = data; |
| | | } |
| | | |
| | | public static ApiResult<String> success() { |
| | | return SUCCESS_RESULT; |
| | | } |
| | | |
| | | public static ApiResult<String> success(String message) { |
| | | return new ApiResult<>(GlobalResultEnum.SUCCESS.getCode(), true, message); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> success(T data) { |
| | | return new ApiResult<>(data); |
| | | } |
| | | |
| | | public static ApiResult<String> okmsg(String data) { |
| | | ApiResult<String> result = new ApiResult<>(); |
| | | result.setData(data); |
| | | result.setCode(200); |
| | | result.setSuccess(true); |
| | | return result; |
| | | } |
| | | |
| | | public static ApiResult<String> failed() { |
| | | return ERROR_RESULT; |
| | | } |
| | | |
| | | public static ApiResult ofFeign() { |
| | | return failed("远程服务调用失败"); |
| | | } |
| | | |
| | | public static ApiResult<String> failed(String message) { |
| | | return new ApiResult<>(GlobalResultEnum.FAIL.getCode(), false, message); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> failed(String message, T data) { |
| | | return new ApiResult<>(GlobalResultEnum.FAIL.getCode(), false, message, data); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> failed(T data) { |
| | | return new ApiResult<>(GlobalResultEnum.FAIL.getCode(), false, GlobalResultEnum.FAIL.message, data); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> failed(int code, String message) { |
| | | return new ApiResult<>(code, false, message); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> failed(int code, String message, T data) { |
| | | return new ApiResult<>(code, false, message, data); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> status(GlobalResultEnum status) { |
| | | return status(status, null); |
| | | } |
| | | |
| | | public static <T> ApiResult<T> status(GlobalResultEnum status, T data) { |
| | | return new ApiResult<>(status.getCode(), status.getCode() == GlobalResultEnum.SUCCESS.getCode(), status.getMessage(), data); |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public boolean isSuccess() { |
| | | return success; |
| | | } |
| | | |
| | | public void setSuccess(boolean success) { |
| | | this.success = success; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.basic; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName constant |
| | | * @Description |
| | | * @date 2020-08-20 17:19 |
| | | */ |
| | | |
| | | public class Constant { |
| | | public static final int SUCCESS = 200; |
| | | |
| | | public static final int FAIL = 0; |
| | | /** |
| | | * 存储验证码时长 |
| | | */ |
| | | public static final Integer REDIS_EXPIRE = 15 * 60 * 1000; |
| | | /** |
| | | * 商品唯一编号索引 |
| | | */ |
| | | public static final String PRODUCT_NUMBER_UNI = "PRODUCT_NUMBER_UNI"; |
| | | /** |
| | | * 会员手机号唯一索引 |
| | | */ |
| | | public static final String PHONE_UNI = "PHONE_UNI"; |
| | | /** |
| | | * 门店唯一编号索引 |
| | | */ |
| | | public static final String SHOP_NUMBER_UNI = "SHOP_NUMBER_UNI"; |
| | | /** |
| | | * 门店系统生成编号唯一索引 |
| | | */ |
| | | public static final String SHOP_OWN_NUMBER_UNI = "SHOP_OWN_NUMBER_UNI"; |
| | | /** |
| | | * 模板消息发送地址 |
| | | */ |
| | | public static final String TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN"; |
| | | /** |
| | | * 管理员 |
| | | */ |
| | | public static final String ADMIN = "admin"; |
| | | /** |
| | | * 管理员 |
| | | */ |
| | | public static final String TRAIN = "train"; |
| | | /** |
| | | * 默认密码 |
| | | */ |
| | | public static final String DEF_PASSWORD = "123456"; |
| | | /** |
| | | * 默认的令牌请求头 |
| | | */ |
| | | public static final String DEF_TOKEN_HEADER = "Authorization"; |
| | | /** |
| | | * 别名令牌请求头 |
| | | */ |
| | | public static final String ALIAS_TOKEN_HEADER = "token"; |
| | | /** |
| | | * 分隔符 |
| | | */ |
| | | public static final String SEP_COMMA = ","; |
| | | /** |
| | | * 分隔符 |
| | | */ |
| | | public static final String SEP_LINE = "-"; |
| | | /** |
| | | * 分隔符 |
| | | */ |
| | | public static final String SEP_BLANK = " "; |
| | | /** |
| | | * 分隔符 |
| | | */ |
| | | public static final String SEP_COLON = ":"; |
| | | /** |
| | | * LocalDateTime分隔符 |
| | | */ |
| | | public static final String SEP_T = "T"; |
| | | /** |
| | | * . 分隔符 |
| | | */ |
| | | public static final String SEP_DOT = "."; |
| | | /** |
| | | * 时间格式化 |
| | | */ |
| | | public static final String DATE_FORMATTER_TIME = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String DATE_FORMATTER_DATE = "yyyy-MM-dd"; |
| | | public static final String DATE_FORMATTER_DATE_HOUR = "yyyy-MM-dd HH"; |
| | | public static final String DATE_FORMATTER_MIN = "HH:mm"; |
| | | public static final String DATEFORMATTERTIME = "yyyyMMddHHmmss"; |
| | | /** |
| | | * 流水号定义 |
| | | */ |
| | | public static final String DATESTREAMCODE = "yyyyMMdd"; |
| | | public static final String DATETIMESTREAMCODE = "yyyyMMddHHmm"; |
| | | /** |
| | | * 安全框架不需要身份认证的请求 |
| | | */ |
| | | public static final String[] AUTH_WHITELIST = { |
| | | "/" |
| | | , "/api/v1/" |
| | | , "/druid/**" |
| | | , "/druid/**" |
| | | // , "/**" //开发时关闭身份认证 |
| | | , "/files/**" |
| | | , "/login" |
| | | , "/wx/wxLoginByCodeH5" //微信h5登录 |
| | | , "/sales-product/import-template" // 商品导入模板下载 |
| | | , "/sec-user/import-template" // 用户导入模板下载 |
| | | , "/sales-shop/import-template" // 门店导入模板下载 |
| | | , "/sales-personnel-structure/import-template" // 岗位导入模板下载 |
| | | , "/sales-tier-post/import-template" // 层级岗位导入模板 |
| | | , "/sales-tier-post/export/post-list" // 导出层级岗位列表 |
| | | , "/train_butt_joint/getUserList" // 查询用户列表及岗位与层级信息 |
| | | , "/logout" |
| | | , "/cpe/**"//当前H5用户端不采用security |
| | | , "/sales-report/**"//报表目前不做权限校验 |
| | | }; |
| | | public static final String[] APPLET_AUTH_WHITELIST = { |
| | | "/" |
| | | , "/api/v1/" |
| | | , "/druid/**" |
| | | , "/druid/**" |
| | | // , "/**" //开发时关闭身份认证 |
| | | , "/files/**" |
| | | , "/login" |
| | | , "/wx/wxLoginByCodeH5" //微信h5登录 |
| | | , "/logout" |
| | | , "/cpe/**" |
| | | , "/code/login" |
| | | , "/sendCode" //当前H5用户端不采用security |
| | | ,"/pageResetPassword" |
| | | ,"/t-goods/getConfigById" |
| | | ,"/sendPassCode" |
| | | }; |
| | | /** |
| | | * 文档相关资源路径 |
| | | */ |
| | | public static final String[] DOC_LIST = |
| | | {"/js/**", |
| | | "/css/**", |
| | | "/static/**", |
| | | "/assets/**", |
| | | "/web/**", |
| | | "/web/css/**", |
| | | "/web/js/**", |
| | | "/web/image/**", |
| | | "/webass/**", |
| | | "/iconfont/**", |
| | | "/RFIDR/**", |
| | | "/tinymce/**", |
| | | "/file/**", |
| | | "/img/**", |
| | | "/images/**", |
| | | "/fonts/**", "/index.html", |
| | | "/favicon.ico", "/v3/**", "/v2/**", |
| | | "/error", "/swagger**/**", "/configuration/ui", |
| | | "/configuration/security", "/webjars/**", "/doc**/**" |
| | | }; |
| | | public static final String[] DO_FILTER_LIST = |
| | | { |
| | | "/js/", |
| | | "/css/", |
| | | "/static/", |
| | | "/webass/", |
| | | "/iconfont/", |
| | | "/RFIDR/", |
| | | "/tinymce/", |
| | | "/img/", |
| | | "/images/", |
| | | "/fonts/", "/index.html", |
| | | "/favicon.ico", "/v3/", "/v2/", |
| | | "/error", "/swagger", "/configuration/ui", |
| | | "/configuration/security", "/webjars/", "/doc/", "/api/v1/", "/druid/" |
| | | , "/druid/" |
| | | , "/doc" |
| | | , "/app/doc" |
| | | , "/files/" |
| | | , "/login" |
| | | , "/logout" |
| | | , "/banner" |
| | | , "/activity" |
| | | , "/topic" |
| | | , "/member-info" |
| | | }; |
| | | /** |
| | | * 门店导入时redis存储的key |
| | | */ |
| | | public static final String REDIS_SHOP_KEY = "EXPORT_SHOP_KEY"; |
| | | /** |
| | | * JWT-token 在 缓存中 中保存的key前缀 |
| | | */ |
| | | public static String JWT_TOKEN_KEY_PREFIX = ":security:jwt:token:"; |
| | | /** |
| | | * JWT-refresh-token 在 缓存中 中保存的key前缀 |
| | | */ |
| | | public static String JWT_REFRESH_TOKEN_KEY_PREFIX = ":security:jwt:refresh-token:"; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.basic; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author xiaochen |
| | | * @Date 2019/08/26 10:28 AM |
| | | * @Description |
| | | */ |
| | | @JsonIgnoreProperties({"orders", "optimizeCountSql", "hitCount", "countId", "maxLimit", "searchCount"}) |
| | | public class PageInfo<T> extends Page<T> implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | private boolean hasNextPage; |
| | | private boolean hasPrevPage; |
| | | private long startIndex; |
| | | |
| | | public PageInfo(long currentPage, long pageShowCount) { |
| | | super(currentPage, pageShowCount); |
| | | this.startIndex = super.offset(); |
| | | } |
| | | |
| | | public PageInfo() { |
| | | super(); |
| | | } |
| | | |
| | | private static boolean hasPrevPage(long currentPage) { |
| | | return currentPage != 1; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<T> setRecords(List<T> records) { |
| | | super.setRecords(records); |
| | | this.hasNextPage = super.hasNext(); |
| | | this.hasPrevPage = super.hasPrevious(); |
| | | return this; |
| | | } |
| | | |
| | | public boolean getHasNextPage() { |
| | | return hasNextPage; |
| | | } |
| | | |
| | | public void setHasNextPage(boolean hasNextPage) { |
| | | this.hasNextPage = hasNextPage; |
| | | } |
| | | |
| | | public boolean getHasPrevPage() { |
| | | return hasPrevPage; |
| | | } |
| | | |
| | | public void setHasPrevPage(boolean hasPrevPage) { |
| | | this.hasPrevPage = hasPrevPage; |
| | | } |
| | | |
| | | private boolean hasNextPage(long currentPage, long totalPage) { |
| | | return currentPage < totalPage && totalPage != 0; |
| | | } |
| | | |
| | | public long getStartIndex() { |
| | | return startIndex; |
| | | } |
| | | |
| | | public void setStartIndex(long startIndex) { |
| | | this.startIndex = startIndex; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.cache; |
| | | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 缓存 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | public class Cache { |
| | | /** |
| | | * 缓存的初始化容量 |
| | | */ |
| | | private int initialCapacity = 50; |
| | | /** |
| | | * 缓存最大容量 |
| | | */ |
| | | private long maximumSize = 200L; |
| | | /** |
| | | * 缓存时长 |
| | | */ |
| | | private long duration = 7000L; |
| | | /** |
| | | * 时长单位,自动转换 |
| | | * 支持: |
| | | * 时 |
| | | * 分 |
| | | * 秒 |
| | | * 天 |
| | | */ |
| | | private TimeUnit timeunit = TimeUnit.SECONDS; |
| | | |
| | | private Cache(Builder builder) { |
| | | this.initialCapacity = 0 == builder.initialCapacity ? this.initialCapacity : builder.initialCapacity; |
| | | this.maximumSize = 0L == builder.maximumSize ? this.maximumSize : builder.maximumSize; |
| | | this.duration = 0L == builder.duration ? this.duration : builder.duration; |
| | | this.timeunit = null == builder.timeunit ? this.timeunit : builder.timeunit; |
| | | } |
| | | |
| | | public static Builder options() { |
| | | return new Builder(); |
| | | } |
| | | |
| | | public int getInitialCapacity() { |
| | | return initialCapacity; |
| | | } |
| | | |
| | | public void setInitialCapacity(int initialCapacity) { |
| | | this.initialCapacity = initialCapacity; |
| | | } |
| | | |
| | | public long getMaximumSize() { |
| | | return maximumSize; |
| | | } |
| | | |
| | | public void setMaximumSize(long maximumSize) { |
| | | this.maximumSize = maximumSize; |
| | | } |
| | | |
| | | public long getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(long duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public TimeUnit getTimeunit() { |
| | | return timeunit; |
| | | } |
| | | |
| | | public void setTimeunit(TimeUnit timeunit) { |
| | | this.timeunit = timeunit; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Cache{" + |
| | | "initialCapacity=" + initialCapacity + |
| | | ", maximumSize=" + maximumSize + |
| | | ", duration=" + duration + |
| | | ", timeunit=" + timeunit + |
| | | '}'; |
| | | } |
| | | |
| | | public static class Builder { |
| | | private int initialCapacity; |
| | | private long maximumSize; |
| | | private long duration; |
| | | private TimeUnit timeunit; |
| | | |
| | | public Builder setInitialCapacity(int initialCapacity) { |
| | | this.initialCapacity = initialCapacity; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setMaximumSize(long maximumSize) { |
| | | this.maximumSize = maximumSize; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setDuration(long duration) { |
| | | this.duration = duration; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setTimeUnit(TimeUnit timeunit) { |
| | | this.timeunit = timeunit; |
| | | return this; |
| | | } |
| | | |
| | | public Cache build() { |
| | | return new Cache(this); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.cache; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName CacheTemplate |
| | | * @Description |
| | | * @date 2021-01-11 11:27 |
| | | */ |
| | | public interface CacheTemplate<T> { |
| | | /** |
| | | * 保存key |
| | | * |
| | | * @param key |
| | | * @param value |
| | | * @param tokenExpireTime |
| | | * @return |
| | | */ |
| | | boolean setKey(String key, T value, long tokenExpireTime); |
| | | |
| | | /** |
| | | * 不设置过期时间 |
| | | * |
| | | * @param key |
| | | * @param value |
| | | * @return |
| | | */ |
| | | boolean setKey(String key, T value); |
| | | |
| | | /** |
| | | * 获取缓存 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | T getKey(String key); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | boolean delKey(String key); |
| | | } |
New file |
| | |
| | | package com.jilongda.common.cache; |
| | | |
| | | import com.github.benmanes.caffeine.cache.LoadingCache; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AbstractCaffineCache |
| | | * @Description |
| | | * @date 2021-01-11 11:27 |
| | | */ |
| | | public class CaffineCache<T> implements CacheTemplate<T> { |
| | | /** |
| | | * 缓存环境 |
| | | */ |
| | | private String env; |
| | | |
| | | /** |
| | | * 本地缓存实例 |
| | | */ |
| | | private LoadingCache<String, Object> loadingCache; |
| | | |
| | | /** |
| | | * 构造函数 |
| | | * |
| | | * @param cache |
| | | */ |
| | | public CaffineCache(Cache cache) { |
| | | // 构建本地缓存实例 |
| | | this.loadingCache = CaffineCacheManage.caffineCacheManage(cache); |
| | | } |
| | | |
| | | /** |
| | | * 构造函数 |
| | | * |
| | | * @param env |
| | | * @param cache |
| | | */ |
| | | public CaffineCache(String env, Cache cache) { |
| | | this.env = env; |
| | | this.loadingCache = CaffineCacheManage.caffineCacheManage(cache); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean setKey(String key, T value, long tokenExpireTime) { |
| | | if (Objects.isNull(this.loadingCache)) { |
| | | return Boolean.FALSE; |
| | | } |
| | | if (StringUtils.hasLength(this.env)) { |
| | | this.loadingCache.put(this.env + ":" + key, value); |
| | | } else { |
| | | this.loadingCache.put(key, value); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | @Override |
| | | public boolean setKey(String key, T value) { |
| | | return setKey(key, value, 0); |
| | | } |
| | | |
| | | @Override |
| | | public T getKey(String key) { |
| | | if (Objects.isNull(this.loadingCache)) { |
| | | return null; |
| | | } |
| | | try { |
| | | if (StringUtils.hasLength(this.env)) { |
| | | return (T) this.loadingCache.get(this.env + ":" + key); |
| | | } else { |
| | | return (T) this.loadingCache.get(key); |
| | | } |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean delKey(String key) { |
| | | if (Objects.isNull(this.loadingCache)) { |
| | | return Boolean.FALSE; |
| | | } |
| | | if (StringUtils.hasLength(this.env)) { |
| | | this.loadingCache.invalidate(this.env + ":" + key); |
| | | } else { |
| | | this.loadingCache.invalidate(key); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.cache; |
| | | |
| | | import com.github.benmanes.caffeine.cache.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @Author li heng |
| | | * @Description token本地缓存,使用caffine缓存实现 |
| | | * @Date 2019/6/1 17:28 |
| | | * @Version 1.0 |
| | | */ |
| | | @Slf4j |
| | | public class CaffineCacheManage { |
| | | |
| | | /** |
| | | * 缓存管理 |
| | | * |
| | | * @param cache |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> LoadingCache<String, T> caffineCacheManage(Cache cache) { |
| | | log.info("初始化缓存的实体数据:{}", cache); |
| | | if (Objects.isNull(cache)) { |
| | | throw new NullPointerException("请实例化一个Cache对象!"); |
| | | } |
| | | LoadingCache<String, T> localcache = |
| | | // 构建本地缓存,调用链的方式 |
| | | // ,1000是设置缓存的初始化容量,maximumSize是设置缓存最大容量,当超过了最大容量,guava将使用LRU算法(最少使用算法),来移除缓存项 |
| | | // expireAfterAccess(12,TimeUnit.HOURS)设置缓存有效期为12个小时 |
| | | Caffeine.newBuilder().initialCapacity(cache.getInitialCapacity()).maximumSize(cache.getMaximumSize()) |
| | | // 设置写缓存后n秒钟过期 |
| | | // .expireAfterWrite(30, TimeUnit.SECONDS) |
| | | .expireAfterWrite(cache.getDuration(), cache.getTimeunit()) |
| | | // 设置读写缓存后n秒钟过期,实际很少用到,类似于expireAfterWrite |
| | | //.expireAfterAccess(googleCache.getDuration(), googleCache.getTimeunit()) |
| | | // 只阻塞当前数据加载线程,其他线程返回旧值 |
| | | //.refreshAfterWrite(10, TimeUnit.SECONDS) |
| | | // 设置缓存的移除通知//用户手动移除EXPLICIT, |
| | | // //用户手动替换REPLACED,//被垃圾回收COLLECTED,//超时过期EXPIRED,//SIZE由于缓存大小限制 |
| | | .removalListener(new RemovalListener<String, T>() { |
| | | @Override |
| | | public void onRemoval(String key, Object value, RemovalCause cause) { |
| | | log.info(key + ":" + value + ":" + cause.name()); |
| | | } |
| | | }) |
| | | // build里面要实现一个匿名抽象类 |
| | | .build(new CacheLoader<String, T>() { |
| | | // 这个方法是默认的数据加载实现,get的时候,如果key没有对应的值,就调用这个方法进行加载。此处是没有默认值则返回null |
| | | @Override |
| | | public T load(String key) throws Exception { |
| | | return null; |
| | | } |
| | | }); |
| | | return localcache; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.component; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AliOss |
| | | * @Description |
| | | * @date 2020-04-15 10:23 |
| | | */ |
| | | public class AliOss { |
| | | /** |
| | | * 请填写您的AccessKeyId。LTAI5tPbJsVfBZZTPqPe8A2r |
| | | */ |
| | | public static final String accessKeyId = "LTAI5tQZzqsZYX5gw8yRNchQ"; |
| | | // public static final String accessKeyId = "LTAI5tPbJsVfBZZTPqPe8A2r"; |
| | | /** |
| | | * 请填写您的AccessKeySecret。 |
| | | */ |
| | | public static final String accessKeySecret = "5yJVdXwRzwPZwKKXp07lRAc7tkTxQp"; |
| | | // public static final String accessKeySecret = "BvRc85RcX0bgrl9TMUOGHEMLUPlCr2"; |
| | | /** |
| | | * 请填写您的 endpoint。 |
| | | */ |
| | | public static final String endpoint = "oss-cn-hongkong.aliyuncs.com"; |
| | | /** |
| | | * 请填写您的 bucketname 。 |
| | | */ |
| | | // public static final String bucketName = "sales-bucket"; |
| | | public static final String bucketName = "bizuphk"; |
| | | /** |
| | | * cdn |
| | | */ |
| | | // public static final String cdn = "https://cdn.pharmacylinked.com"; |
| | | // public static final String cdn = "https://nncdn.pharmacylinked.com"; |
| | | /** |
| | | * host的格式为 bucketname.endpoint |
| | | */ |
| | | public static final String host = "https://" + bucketName + "." + endpoint; |
| | | |
| | | // 此处不需要回调 |
| | | // callbackUrl为上传回调服务器的URL,请将下面的IP和Port配置为您自己的真实信息。 |
| | | public static final String callbackUrl = "https://alwaystest.xisheninfo.com/api/ali-oss/callback"; |
| | | public static String dir = "hollywood/"; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.component; |
| | | |
| | | |
| | | import com.aliyun.oss.OSS; |
| | | import com.aliyun.oss.OSSClientBuilder; |
| | | import com.aliyun.oss.common.utils.BinaryUtil; |
| | | import com.aliyun.oss.model.MatchMode; |
| | | import com.aliyun.oss.model.OSSObject; |
| | | import com.aliyun.oss.model.PolicyConditions; |
| | | import com.aliyun.oss.model.PutObjectResult; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.utils.WebUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * @author feiyunchuan |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "Ali-OSS文件上传接口") |
| | | @RestController |
| | | @RequestMapping("/ali-oss/") |
| | | public class AliOssFileUploadController { |
| | | |
| | | @Value("${file.cdn:https://nncdn.pharmacylinked.com}") |
| | | private String FILE_CDN; |
| | | |
| | | |
| | | @ApiOperation(value = "单文件上传", notes = "单文件上传,rename 默认不重命名") |
| | | @PostMapping(value = "strUpload", headers = "content-type=multipart/form-data") |
| | | public String strUploads(@RequestParam(value = "file") MultipartFile mf) throws IOException { |
| | | if (mf.isEmpty()) { |
| | | return "请传入文件!"; |
| | | } |
| | | String fileName = mf.getOriginalFilename(); |
| | | String TimeDir =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| | | // String realPath = "D:\\" + TimeDir; |
| | | String realPath = "/usr/local/nginx/html/images/" + TimeDir; |
| | | File file = new File(realPath); |
| | | // 没有目录就创建 |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | File targetFile = new File(realPath, fileName);//目标文件 |
| | | //开始从源文件拷贝到目标文件 |
| | | //传图片一步到位 |
| | | mf.transferTo(targetFile); |
| | | //拼接数据 |
| | | return "http://sales.chelota.com/images/" + TimeDir +"/"+ fileName; |
| | | } |
| | | @ApiOperation(value = "服务端上传", notes = "服务端上传") |
| | | @PostMapping(value = "upload") |
| | | public ApiResult<String> fileUpload(@RequestParam(value = "file") MultipartFile file) throws IOException { |
| | | InputStream inputStream = file.getInputStream(); |
| | | String filename = System.currentTimeMillis() + file.getOriginalFilename(); |
| | | // Endpoint以杭州为例,其它Region请按实际情况填写。 |
| | | final String endpoint = AliOss.endpoint; |
| | | // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。 |
| | | final String accessKeyId = AliOss.accessKeyId; |
| | | final String accessKeySecret = AliOss.accessKeySecret; |
| | | final String bucketName = AliOss.bucketName; |
| | | // <yourObjectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 |
| | | String objectName = AliOss.dir + filename; |
| | | log.info(objectName); |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); |
| | | // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。 |
| | | // InputStream inputStream = new FileInputStream("D:\\localpath\\examplefile.txt"); |
| | | // 依次填写Bucket名称(例如examplebucket)和Object完整路径(例如exampledir/exampleobject.txt)。Object完整路径中不能包含Bucket名称。 |
| | | PutObjectResult putObjectResult = ossClient.putObject(bucketName, objectName, inputStream); |
| | | log.info("上传结果:{}", putObjectResult); |
| | | OSSObject ossObject = ossClient.getObject(bucketName, objectName); |
| | | String uri = ossObject.getResponse().getUri(); |
| | | // 关闭OSSClient。 |
| | | ossClient.shutdown(); |
| | | // uri = uri.replace("http://nn-bucket.oss-cn-shanghai.aliyuncs.com",FILE_CDN); |
| | | return ApiResult.okmsg(uri); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "服务端签名后直传", notes = "服务端签名后直传") |
| | | @PostMapping("signature") |
| | | public ApiResult<Map<String, String>> signature() { |
| | | OSS builder = new OSSClientBuilder().build(AliOss.endpoint, AliOss.accessKeyId, AliOss.accessKeySecret); |
| | | long expireTime = 30; |
| | | long expireEndTime = System.currentTimeMillis() + expireTime * 1000; |
| | | Date expiration = new Date(expireEndTime); |
| | | PolicyConditions policyConds = new PolicyConditions(); |
| | | policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, 1048576000); |
| | | policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, AliOss.dir); |
| | | String postPolicy = builder.generatePostPolicy(expiration, policyConds); |
| | | byte[] binaryData = postPolicy.getBytes(StandardCharsets.UTF_8); |
| | | String encodedPolicy = BinaryUtil.toBase64String(binaryData); |
| | | String postSignature = builder.calculatePostSignature(postPolicy); |
| | | Map<String, String> respMap = new LinkedHashMap<>(6); |
| | | respMap.put("accessid", AliOss.accessKeyId); |
| | | respMap.put("policy", encodedPolicy); |
| | | respMap.put("signature", postSignature); |
| | | // 示例为dir |
| | | respMap.put("dir", AliOss.dir); |
| | | // 前端为key |
| | | // respMap.put("key", AliOss.dir); |
| | | respMap.put("host", AliOss.host); |
| | | // respMap.put("cdn", AliOss.cdn); |
| | | respMap.put("expire", String.valueOf(expireEndTime / 1000)); |
| | | // // 回调 |
| | | // if (StringUtils.hasLength(AliOss.callbackUrl)) { |
| | | // JSONObject jasonCallback = new JSONObject(); |
| | | // jasonCallback.put("callbackUrl", AliOss.callbackUrl); |
| | | // String callbackBody = "{\"filename\":${object},\"size\":${size},\"mimeType\":${mimeType}}"; |
| | | // jasonCallback.put("callbackBody", callbackBody); |
| | | // jasonCallback.put("callbackBodyType", "application/json"); |
| | | // String base64CallbackBody = BinaryUtil.toBase64String(jasonCallback.toString().getBytes()); |
| | | // respMap.put("callback", base64CallbackBody); |
| | | // } |
| | | |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "GET, POST"); |
| | | |
| | | // 关闭OSSClient。 |
| | | builder.shutdown(); |
| | | return ApiResult.success(respMap); |
| | | } |
| | | |
| | | @ApiOperation(value = "服务端上传(二进制字符串)", notes = "服务端上传") |
| | | @PostMapping(value = "str/upload") |
| | | public String strUpload(InputStream inputStream, String filename) throws IOException { |
| | | //String filename = System.currentTimeMillis() + CodeGenerateUtils.generateVolumeSn()+".jpg"; |
| | | // Endpoint以杭州为例,其它Region请按实际情况填写。 |
| | | final String endpoint = AliOss.endpoint; |
| | | // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。 |
| | | final String accessKeyId = AliOss.accessKeyId; |
| | | final String accessKeySecret = AliOss.accessKeySecret; |
| | | final String bucketName = AliOss.bucketName; |
| | | // <yourObjectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 |
| | | String objectName = AliOss.dir + filename; |
| | | log.info(objectName); |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); |
| | | // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。 |
| | | // InputStream inputStream = new FileInputStream("D:\\localpath\\examplefile.txt"); |
| | | // 依次填写Bucket名称(例如examplebucket)和Object完整路径(例如exampledir/exampleobject.txt)。Object完整路径中不能包含Bucket名称。 |
| | | PutObjectResult putObjectResult = ossClient.putObject(bucketName, objectName, inputStream); |
| | | log.info("上传结果:{}", putObjectResult); |
| | | OSSObject ossObject = ossClient.getObject(bucketName, objectName); |
| | | String uri = ossObject.getResponse().getUri(); |
| | | // 关闭OSSClient。 |
| | | ossClient.shutdown(); |
| | | return uri; |
| | | } |
| | | |
| | | /** |
| | | * oss上传成功回调 |
| | | * |
| | | * @param callback |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "oss回调", notes = "oss回调") |
| | | @PostMapping(value = "/callback") |
| | | public ApiResult callback(@RequestBody Map<String, Object> callback) { |
| | | log.info("oss回调{}", callback); |
| | | String filename = "http://".concat(AliOss.bucketName).concat(".").concat(AliOss.endpoint).concat("/").concat(callback.get("filename").toString()); |
| | | return ApiResult.okmsg(filename); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import com.jilongda.common.cache.Cache; |
| | | import com.jilongda.common.cache.CaffineCache; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName AccessTokenConfig |
| | | * @Description |
| | | * @date 2021-01-02 19:56 |
| | | */ |
| | | @Configuration |
| | | public class AccessTokenConfig { |
| | | @Value("${token.env:none}") |
| | | private String env; |
| | | @Value("${token.tokenExpireTime:7200}") |
| | | private long tokenExpireTime; |
| | | @Value("${token.refreshTokenExpireTime:86400}") |
| | | private long refreshTokenExpireTime; |
| | | |
| | | /** |
| | | * 令牌缓存 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public CaffineCache<String> accessTokenCache() { |
| | | Cache cache = Cache.options().setDuration(tokenExpireTime).setTimeUnit(TimeUnit.SECONDS).build(); |
| | | return new CaffineCache(env, cache); |
| | | } |
| | | |
| | | /** |
| | | * 刷新令牌缓存 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public CaffineCache<String> refreshTokenCache() { |
| | | Cache cache = Cache.options().setDuration(refreshTokenExpireTime).setTimeUnit(TimeUnit.SECONDS).build(); |
| | | return new CaffineCache(env, cache); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import org.hibernate.validator.HibernateValidator; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | import javax.validation.Validation; |
| | | import javax.validation.Validator; |
| | | import javax.validation.ValidatorFactory; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName ValidatorConf |
| | | * @Description 校验模式 |
| | | * 在上面的例子中,我们使用BindingResult验证不通过的结果集合,但是通常按顺序验证到第一个字段不符合验证要求时,就可以直接拒绝请求了。这就涉及到两种校验模式的配置: |
| | | * <p> |
| | | * 普通模式(默认是这个模式): 会校验完所有的属性,然后返回所有的验证失败信息 |
| | | * 快速失败模式: 只要有一个验证失败,则返回 |
| | | * 如果想要配置第二种模式,需要添加如下配置类: |
| | | * @date 2019/12/27 14:56 |
| | | * @Version 1.0 |
| | | */ |
| | | @Configuration |
| | | public class CommConfig implements WebMvcConfigurer { |
| | | /** |
| | | * 静态资源路径 |
| | | */ |
| | | //@Value("${static-resources-locations}") |
| | | private String staticResourceslocations; |
| | | |
| | | @Bean |
| | | public Validator validator() { |
| | | ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class) |
| | | .configure() |
| | | .failFast(true) |
| | | .buildValidatorFactory(); |
| | | Validator validator = validatorFactory.getValidator(); |
| | | |
| | | return validator; |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 接口请求拦截配置 |
| | | // * |
| | | // * @param registry |
| | | // */ |
| | | // @Override |
| | | // public void addViewControllers(ViewControllerRegistry registry) { |
| | | // registry.addRedirectViewController("/", "/web/index.html"); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 虚拟路径配置 |
| | | * |
| | | * @param registry |
| | | */ |
| | | // @Override |
| | | // public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | // registry.addResourceHandler("/web/**").addResourceLocations("file:" + staticResourceslocations); |
| | | // } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.cors.CorsConfiguration; |
| | | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
| | | import org.springframework.web.filter.CorsFilter; |
| | | |
| | | import java.util.Collections; |
| | | |
| | | /** |
| | | * 实现基本的跨域请求 |
| | | * 2.4.0 通多配置 |
| | | * |
| | | * @author xiaochen |
| | | * @Override public void addCorsMappings(CorsRegistry registry) { |
| | | * registry.addMapping("/**") |
| | | * // SpringBoot2.4.0 [allowedOriginPatterns]代替[allowedOrigins] |
| | | * .allowedOriginPatterns("*") |
| | | * .allowedMethods("*") |
| | | * .maxAge(3600) |
| | | * .allowCredentials(true); |
| | | * } |
| | | */ |
| | | @Configuration |
| | | public class CorsConfig { |
| | | private CorsConfiguration buildConfig() { |
| | | CorsConfiguration corsConfiguration = new CorsConfiguration(); |
| | | //1.允许任何来源 |
| | | corsConfiguration.setAllowedOriginPatterns(Collections.singletonList("*")); |
| | | //2.允许任何请求头 |
| | | corsConfiguration.addAllowedHeader(CorsConfiguration.ALL); |
| | | //3.允许任何方法 |
| | | corsConfiguration.addAllowedMethod(CorsConfiguration.ALL); |
| | | //4.允许凭证 |
| | | corsConfiguration.setAllowCredentials(true); |
| | | |
| | | |
| | | |
| | | |
| | | return corsConfiguration; |
| | | } |
| | | |
| | | @Bean |
| | | public CorsFilter corsFilter() { |
| | | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
| | | // 对接口配置跨域设置 |
| | | // source.registerCorsConfiguration("/v2/api-docs/**", buildConfig()); |
| | | source.registerCorsConfiguration("/**", buildConfig()); |
| | | return new CorsFilter(source); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DataUpdateInterceptor |
| | | * @Description 数据更新操作处理 |
| | | * @date 2021-12-15 |
| | | * <p> |
| | | * 注意,之前在此处注入了 JwtTokenUtils |
| | | * <p> |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | /** |
| | | * 新增数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | String userName = JwtTokenUtils.getUsername(); |
| | | if (StringUtils.isNotBlank(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | /*String userName = JwtTokenUtils.getUsername(); |
| | | if (StringUtils.isNotBlank(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | }*/ |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.core.JsonParser; |
| | | import com.fasterxml.jackson.databind.DeserializationContext; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | import com.fasterxml.jackson.databind.deser.std.DateDeserializers; |
| | | import com.fasterxml.jackson.databind.ser.std.DateSerializer; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; |
| | | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName LocalDateTimeSerializerConfig |
| | | * @Description |
| | | * @date 2020-09-22 11:22 |
| | | */ |
| | | @Configuration |
| | | public class JacksonConfig { |
| | | public static final String dateFormat = "yyyy-MM-dd"; |
| | | public static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | |
| | | @Bean |
| | | public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { |
| | | return builder -> { |
| | | // Long型精度丢失问题 |
| | | builder.serializerByType(Long.TYPE, ToStringSerializer.instance); |
| | | builder.serializerByType(Long.class, ToStringSerializer.instance); |
| | | // 时间格式化 |
| | | builder.simpleDateFormat(dateTimeFormat); |
| | | builder.serializers(new LocalDateSerializer(DateTimeFormatter.ofPattern(dateFormat))); |
| | | builder.serializers(new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(dateTimeFormat))); |
| | | // builder.serializers(new CustomDateSerializer()); |
| | | //builder.deserializers(new CustomDateDeSerializer()); |
| | | builder.deserializers(new LocalDateDeserializer(DateTimeFormatter.ofPattern(dateFormat))); |
| | | builder.deserializers(new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(dateTimeFormat))); |
| | | }; |
| | | } |
| | | |
| | | static class CustomDateDeSerializer extends DateDeserializers.DateDeserializer { |
| | | SimpleDateFormat format = new SimpleDateFormat(dateTimeFormat); |
| | | |
| | | @Override |
| | | public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { |
| | | if (p != null) { |
| | | String time = p.getText(); |
| | | if (StringUtils.hasLength(time)) { |
| | | try { |
| | | return format.parse(time); |
| | | } catch (ParseException e) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | return super.deserialize(p, ctxt); |
| | | } |
| | | } |
| | | |
| | | class CustomDateSerializer extends DateSerializer { |
| | | @Override |
| | | public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException { |
| | | if (Objects.nonNull(value)) { |
| | | SimpleDateFormat format = new SimpleDateFormat(dateTimeFormat); |
| | | jgen.writeString(format.format(value)); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName MybatisPlusConfig |
| | | * @Description MybatisPlus相关配置 |
| | | * @date 2020-09-22 11:22、 |
| | | * 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @EnableTransactionManagement(proxyTargetClass = true) |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | |
| | | @Autowired |
| | | public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) { |
| | | this.dataUpdateHandler = dataUpdateHandler; |
| | | } |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * 自动填充功能 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public GlobalConfig globalConfig() { |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | globalConfig.setMetaObjectHandler(dataUpdateHandler); |
| | | return globalConfig; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.config; |
| | | |
| | | import org.springframework.boot.web.client.RestTemplateBuilder; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | @Configuration |
| | | public class RestTemplateConfig { |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate() { |
| | | //复杂构造函数的使用 |
| | | SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); |
| | | // 设置超时 |
| | | requestFactory.setConnectTimeout(6000); |
| | | requestFactory.setReadTimeout(6000); |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | restTemplate.setRequestFactory(requestFactory); |
| | | return restTemplate; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName RefAccessTokenDto |
| | | * @Description 重新刷新token |
| | | * @date 2019/12/7 18:57 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "重新刷新tokenDto") |
| | | public class RefAccessTokenDTO { |
| | | @ApiModelProperty(value = "登录账号") |
| | | @NotBlank(message = "登录账号不能为空") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "refAccessToken") |
| | | @NotBlank(message = "refAccessToken不能为空") |
| | | private String refAccessToken; |
| | | } |
New file |
| | |
| | | package com.jilongda.common.dto; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName TimeRangePageDTO |
| | | * @Description |
| | | * @date 2021-05-24 14:42 |
| | | */ |
| | | @ApiModel("时间范围分页dto") |
| | | public class TimeRangePageDTO extends BasePage { |
| | | @ApiModelProperty("开始时间 格式 yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDate startTime; |
| | | |
| | | @ApiModelProperty("结束时间 格式 yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDate endTime; |
| | | |
| | | public String getStartTime() { |
| | | if (Objects.nonNull(startTime)) { |
| | | return LocalDateTime.of(startTime, LocalTime.parse("00:00:00")).format(DateTimeFormatter.ofPattern(Constant.DATE_FORMATTER_TIME)); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setStartTime(LocalDate startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | if (Objects.nonNull(endTime)) { |
| | | return LocalDateTime.of(endTime, LocalTime.parse("23:59:59")).format(DateTimeFormatter.ofPattern(Constant.DATE_FORMATTER_TIME)); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setEndTime(LocalDate endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return super.toString() + "TimeRangePageDTO{" + |
| | | "startTime=" + startTime + |
| | | ", endTime=" + endTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum ApproveIdeaEnum { |
| | | |
| | | WAIT_AUDIT(1, "待审核"), |
| | | PASSED(2, "已通过"), |
| | | REJECT(3, "已驳回"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ApproveIdeaEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ApproveIdeaEnum fromCode(Integer code) { |
| | | ApproveIdeaEnum[] resultTypes = ApproveIdeaEnum.values(); |
| | | for (ApproveIdeaEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum ApproveTypeEnum { |
| | | |
| | | LEAVE(1, "请假"), |
| | | CLAIM(2, "报销"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ApproveTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ApproveTypeEnum fromCode(Integer code) { |
| | | ApproveTypeEnum[] resultTypes = ApproveTypeEnum.values(); |
| | | for (ApproveTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName Disable |
| | | * @Description |
| | | * @date 2022-06-08 16:55 |
| | | */ |
| | | public enum DisabledEnum { |
| | | NO(0, "否"), |
| | | YES(1, "是"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | DisabledEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static DisabledEnum fromCode(Integer code) { |
| | | DisabledEnum[] resultTypes = DisabledEnum.values(); |
| | | for (DisabledEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10 16:38 |
| | | */ |
| | | public enum LeaveApproveEnum { |
| | | |
| | | WAIT_APPROVAL(1, "待审批"), |
| | | PASSED(2, "已通过"), |
| | | REJECTED(3, "已驳回"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | LeaveApproveEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static LeaveApproveEnum fromCode(Integer code) { |
| | | LeaveApproveEnum[] resultTypes = LeaveApproveEnum.values(); |
| | | for (LeaveApproveEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum PunchCardTypeEnum { |
| | | |
| | | CLOCK_IN(1, "上班打卡"), |
| | | CLOCK_OUT(2, "下班打卡"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | PunchCardTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static PunchCardTypeEnum fromCode(Integer code) { |
| | | PunchCardTypeEnum[] resultTypes = PunchCardTypeEnum.values(); |
| | | for (PunchCardTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/15/01513:51 |
| | | */ |
| | | public enum SalesPersonnelStructureTypeEnum { |
| | | |
| | | MEDICINE_ZERO(1, "药零架构"), |
| | | LEVSKON_ARCHITECTURE(2, "莱弗仕康架构"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | SalesPersonnelStructureTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SalesPersonnelStructureTypeEnum fromCode(Integer code) { |
| | | SalesPersonnelStructureTypeEnum[] resultTypes = SalesPersonnelStructureTypeEnum.values(); |
| | | for (SalesPersonnelStructureTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum SignStateEnum { |
| | | |
| | | NORMAL_SIGN(1, "正常签到"), |
| | | ABNORMAL_SIGN(2, "异常签到"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | SignStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SignStateEnum fromCode(Integer code) { |
| | | SignStateEnum[] resultTypes = SignStateEnum.values(); |
| | | for (SignStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum TargetStateEnum { |
| | | |
| | | WAIT_AUDIT(1, "待审核"), |
| | | UNFINISHED(2, "未完成"), |
| | | FINISHED(3, "已完成"), |
| | | REJECTED(4, "已驳回"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | TargetStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static TargetStateEnum fromCode(Integer code) { |
| | | TargetStateEnum[] resultTypes = TargetStateEnum.values(); |
| | | for (TargetStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum TierTypeEnum { |
| | | |
| | | DR(1, "DR"), |
| | | HC(2, "HC"), |
| | | OTHER(3, "其他"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | TierTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static TierTypeEnum fromCode(Integer code) { |
| | | TierTypeEnum[] resultTypes = TierTypeEnum.values(); |
| | | for (TierTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum UserAreaEnum { |
| | | |
| | | EAST(1, "东区"), |
| | | SOUTH(2, "南区"), |
| | | WEST(3, "西区"), |
| | | NORTH(4, "北区"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | UserAreaEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static UserAreaEnum fromCode(Integer code) { |
| | | UserAreaEnum[] resultTypes = UserAreaEnum.values(); |
| | | for (UserAreaEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum UserTypeEnum { |
| | | |
| | | /*用户岗位类型 1区总 2KAM 3DR 4督导 5HC 6负责人*/ |
| | | TOTAL_AREA(1, "区总"), |
| | | SUPERVISOR(4, "督导"), |
| | | KAM(2, "KAM"), |
| | | DR(3, "DR"), |
| | | HC(5, "HC"), |
| | | PRINCIPAL(6, "负责人"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | UserTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static UserTypeEnum fromCode(Integer code) { |
| | | UserTypeEnum[] resultTypes = UserTypeEnum.values(); |
| | | for (UserTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum UserTypeNumberEnum { |
| | | |
| | | /*用户类型 1全国经理 2东区经理 3南区经理 4北区经理 5KAM 6DR 7HC*/ |
| | | QG(1, "QG"), |
| | | DQ(2, "DQ"), |
| | | NQ(3, "NQ"), |
| | | BQ(4, "BQ"), |
| | | KAM(5, "KAM"), |
| | | DR(6, "DR"), |
| | | HC(7, "HC"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | UserTypeNumberEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static UserTypeNumberEnum fromCode(Integer code) { |
| | | UserTypeNumberEnum[] resultTypes = UserTypeNumberEnum.values(); |
| | | for (UserTypeNumberEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/6/10/010 16:42 |
| | | */ |
| | | public enum VisitTypeEnum { |
| | | |
| | | PLAN_IN(1, "计划内拜访"), |
| | | PLAN_OUT(2, "计划外拜访"), |
| | | NO_PLAN_VISIT(3, "非目标拜访"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | VisitTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static VisitTypeEnum fromCode(Integer code) { |
| | | VisitTypeEnum[] resultTypes = VisitTypeEnum.values(); |
| | | for (VisitTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.exception; |
| | | |
| | | |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.dao.DataIntegrityViolationException; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.converter.HttpMessageNotReadableException; |
| | | import org.springframework.validation.BindException; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.FieldError; |
| | | import org.springframework.web.HttpMediaTypeNotSupportedException; |
| | | import org.springframework.web.HttpRequestMethodNotSupportedException; |
| | | import org.springframework.web.bind.MethodArgumentNotValidException; |
| | | import org.springframework.web.bind.MissingServletRequestParameterException; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseStatus; |
| | | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| | | import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; |
| | | import org.springframework.web.multipart.MaxUploadSizeExceededException; |
| | | import org.springframework.web.multipart.MultipartException; |
| | | import org.springframework.web.servlet.NoHandlerFoundException; |
| | | |
| | | import javax.naming.SizeLimitExceededException; |
| | | import javax.validation.ConstraintViolation; |
| | | import javax.validation.ConstraintViolationException; |
| | | import javax.xml.bind.ValidationException; |
| | | import java.nio.file.AccessDeniedException; |
| | | import java.text.DecimalFormat; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author madman |
| | | * @version 1.0 |
| | | * @date 2019/7/30 16:13 |
| | | * 全局的异常处理 |
| | | */ |
| | | @RestControllerAdvice |
| | | @Slf4j |
| | | public class GlobalExceptionHandler { |
| | | /** |
| | | * 请求参数错误 |
| | | */ |
| | | private final static String BASE_PARAM_ERR_MSG = "参数校验不通过"; |
| | | @Value("${spring.servlet.multipart.max-file-size:10MB}") |
| | | private String maxFileSize; |
| | | @Value("${spring.servlet.multipart.max-request-size:10MB}") |
| | | private String maxRequestSize; |
| | | |
| | | /** |
| | | * 文件大小转换 |
| | | * |
| | | * @param size |
| | | * @return |
| | | */ |
| | | private static String asReadableFileSize(long size) { |
| | | if (size <= 0) { |
| | | return "0"; |
| | | } |
| | | final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"}; |
| | | int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); |
| | | return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + "" + units[digitGroups]; |
| | | } |
| | | |
| | | /** |
| | | * 顶级的异常处理 |
| | | * 处理所有不可知异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler(Exception.class) |
| | | public ApiResult handleException(Exception e) { |
| | | // 打印异常堆栈信息 |
| | | log.error("顶级异常->:" + e.getMessage(), e); |
| | | if (e instanceof TokenException) { |
| | | TokenException e1 = (TokenException) e; |
| | | return ApiResult.failed(e1.getCode(), e.getMessage()); |
| | | } |
| | | return ApiResult.failed(e.getMessage()); |
| | | } |
| | | |
| | | |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({MultipartException.class}) |
| | | public ApiResult fileUpLoad2(MaxUploadSizeExceededException e) { |
| | | log.error("上传文件异常 => : {}", e.getMessage()); |
| | | if (e.getCause().getCause() instanceof FileSizeLimitExceededException) { |
| | | return ApiResult.failed("文件大小超出限制,允许的大小在" + maxFileSize); |
| | | } else if (e.getCause().getCause() instanceof SizeLimitExceededException) { |
| | | return ApiResult.failed("文件单次上传总大小超过限制,允许的大小在" + maxRequestSize); |
| | | } else { |
| | | return ApiResult.failed("文件上传失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自定义的异常处理 |
| | | * 业务异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ExceptionHandler(ServerException.class) |
| | | @ResponseStatus(HttpStatus.OK) |
| | | public ApiResult handleBusinessException(ServerException e) { |
| | | // 打印异常堆栈信息 |
| | | log.error(" ---> 业务处理异常: {}", e.getMessage()); |
| | | return ApiResult.failed(e.getCode(), e.getMessage(), e.getData()); |
| | | } |
| | | |
| | | /** |
| | | * 请求参数类型不匹配异常 |
| | | * 例如本应传递int,却传递了String |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({MethodArgumentTypeMismatchException.class}) |
| | | public ApiResult handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) { |
| | | log.warn("方法参数类型不匹配异常: {}", e); |
| | | return ApiResult.failed("方法请求参数类型不匹配异常"); |
| | | } |
| | | |
| | | /** |
| | | * 缺少servlet请求参数抛出的异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({MissingServletRequestParameterException.class}) |
| | | public ApiResult handleMissingServletRequestParameterException(MissingServletRequestParameterException e) { |
| | | log.warn(" 参数错误: {}", e.getParameterName()); |
| | | return ApiResult.failed(BASE_PARAM_ERR_MSG + ":请求参数"); |
| | | } |
| | | |
| | | /** |
| | | * 请求参数不能正确读取解析时,抛出的异常,比如传入和接受的参数类型不一致 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({HttpMessageNotReadableException.class}) |
| | | public ApiResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e) { |
| | | log.error("参数解析失败:", e); |
| | | return ApiResult.failed("传入和接受的参数类型不一致"); |
| | | } |
| | | |
| | | /** |
| | | * 请求参数无效抛出的异常 |
| | | * 校验参数抛出的异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({MethodArgumentNotValidException.class}) |
| | | public ApiResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { |
| | | BindingResult result = e.getBindingResult(); |
| | | String message = getBindResultMessage(result); |
| | | log.error("参数验证失败:" + message); |
| | | return ApiResult.failed(message.split(":")[1]); |
| | | } |
| | | |
| | | /** |
| | | * 构造参数校验错误信息 |
| | | * |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private String getBindResultMessage(BindingResult result) { |
| | | // 多个错误随机取值的 |
| | | FieldError error = result.getFieldError(); |
| | | String field = error != null ? error.getField() : "空"; |
| | | String code = error != null ? error.getDefaultMessage() : "空"; |
| | | return String.format("%s:%s", field, code); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请求参数绑定到controller请求参数时的异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({BindException.class}) |
| | | public ApiResult handleHttpMessageNotReadableException(BindException e) { |
| | | BindingResult result = e.getBindingResult(); |
| | | String message = getBindResultMessage(result); |
| | | log.error("参数绑定失败:{}", message); |
| | | return ApiResult.failed("请求参数绑定失败"); |
| | | } |
| | | |
| | | /** |
| | | * javax.validation:validation-api 校验参数抛出的异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({ConstraintViolationException.class}) |
| | | public ApiResult handleServiceException(ConstraintViolationException e) { |
| | | Set<ConstraintViolation<?>> violations = e.getConstraintViolations(); |
| | | ConstraintViolation<?> violation = violations.iterator().next(); |
| | | String message = violation.getMessage(); |
| | | log.warn("参数验证失败:{}", message); |
| | | return ApiResult.failed("参数验证失败:" + message); |
| | | } |
| | | |
| | | /** |
| | | * javax.validation 下校验参数时抛出的异常 |
| | | * 400 - Bad Request |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({ValidationException.class}) |
| | | public ApiResult<String> handleValidationException(ValidationException e) { |
| | | log.warn("参数验证失败:{}", e); |
| | | return ApiResult.failed("参数验证失败:" + e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 不支持该请求方法时抛出的异常 |
| | | * 例如本应GET,结果却是POST |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({HttpRequestMethodNotSupportedException.class}) |
| | | public ApiResult<String> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { |
| | | log.warn("不支持当前请求方法: {}", e); |
| | | return ApiResult.failed("Request Method 不正确"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 不支持当前媒体类型抛出的异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler({HttpMediaTypeNotSupportedException.class}) |
| | | public ApiResult<String> handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e) { |
| | | log.warn("不支持当前媒体类型:{} ", e); |
| | | return ApiResult.failed("不支持当前媒体类型"); |
| | | } |
| | | |
| | | /** |
| | | * 操作数据库出现异常:名称重复,外键关联 |
| | | */ |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler(DataIntegrityViolationException.class) |
| | | public ApiResult<String> handleException(DataIntegrityViolationException e) { |
| | | log.error("操作数据库出现异常:{}", e); |
| | | return ApiResult.failed("操作数据库出现异常:" + e.getMessage()); |
| | | } |
| | | |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler(NoHandlerFoundException.class) |
| | | public ApiResult<String> handlerNoFoundException(Exception e) { |
| | | log.error("请求路径匹配异常:" + e.getMessage(), e); |
| | | return ApiResult.failed(GlobalResultEnum.NOT_FOUND.getCode(), "路径不存在,请检查路径是否正确"); |
| | | } |
| | | |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ExceptionHandler(AccessDeniedException.class) |
| | | public ApiResult<String> handleAuthorizationException(AccessDeniedException e) { |
| | | log.warn(e.getMessage()); |
| | | return ApiResult.failed(GlobalResultEnum.FORBIDDEN.getCode(), "没有权限,请联系管理员授权"); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.common.exception; |
| | | |
| | | |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | |
| | | /** |
| | | * 业务异常 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | public class ServerException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = -232388151980021793L; |
| | | |
| | | /** |
| | | * 自定义异常码 |
| | | */ |
| | | private int code = GlobalResultEnum.FAIL.getCode(); |
| | | |
| | | private Object data; |
| | | |
| | | public ServerException() { |
| | | super(); |
| | | } |
| | | |
| | | /** |
| | | * 将定义的异常信息赋给异常 |
| | | * |
| | | * @param code |
| | | * @param msg |
| | | */ |
| | | public ServerException(int code, String msg) { |
| | | this(code, msg, null); |
| | | } |
| | | |
| | | public ServerException(GlobalResultEnum code) { |
| | | this(code, null); |
| | | } |
| | | |
| | | public ServerException(GlobalResultEnum code, Object o) { |
| | | super(code.getMessage()); |
| | | this.code = code.getCode(); |
| | | this.data = o; |
| | | } |
| | | |
| | | public ServerException(int code, String msg, Object o) { |
| | | super(msg); |
| | | this.code = code; |
| | | this.data = o; |
| | | } |
| | | |
| | | public ServerException(String message, Throwable cause) { |
| | | super(message, cause); |
| | | } |
| | | |
| | | public ServerException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | public ServerException(Throwable cause) { |
| | | super(cause); |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Object getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(Object data) { |
| | | this.data = data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.exception; |
| | | |
| | | |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | |
| | | /** |
| | | * 业务异常 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | public class ServiceException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = -232388151980021793L; |
| | | |
| | | /** |
| | | * 自定义异常码 |
| | | */ |
| | | private int code = GlobalResultEnum.FAIL.getCode(); |
| | | |
| | | private Object data; |
| | | |
| | | public ServiceException() { |
| | | super(); |
| | | } |
| | | |
| | | /** |
| | | * 将定义的异常信息赋给异常 |
| | | * |
| | | * @param code |
| | | * @param msg |
| | | */ |
| | | public ServiceException(int code, String msg) { |
| | | this(code, msg, null); |
| | | } |
| | | |
| | | public ServiceException(GlobalResultEnum code) { |
| | | this(code, null); |
| | | } |
| | | |
| | | public ServiceException(GlobalResultEnum code, Object o) { |
| | | super(code.getMessage()); |
| | | this.code = code.getCode(); |
| | | this.data = o; |
| | | } |
| | | |
| | | public ServiceException(int code, String msg, Object o) { |
| | | super(msg); |
| | | this.code = code; |
| | | this.data = o; |
| | | } |
| | | |
| | | public ServiceException(String message, Throwable cause) { |
| | | super(message, cause); |
| | | } |
| | | |
| | | public ServiceException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | public ServiceException(Throwable cause) { |
| | | super(cause); |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Object getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(Object data) { |
| | | this.data = data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.exception; |
| | | |
| | | |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | |
| | | /** |
| | | * <p>token 异常</p> |
| | | * |
| | | * @author xiaochen |
| | | * @date 2020/9/27 18:24 |
| | | */ |
| | | public class TokenException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = -232388151980021793L; |
| | | |
| | | |
| | | /** |
| | | * 自定义异常码 |
| | | */ |
| | | private int code = GlobalResultEnum.TOKEN_EXPIRE.getCode(); |
| | | |
| | | private Object data; |
| | | |
| | | public TokenException(GlobalResultEnum code) { |
| | | this(code, null); |
| | | } |
| | | public TokenException(int code,String msg) { |
| | | this(code, msg,null); |
| | | } |
| | | |
| | | public TokenException(GlobalResultEnum code, Object o) { |
| | | super(code.getMessage()); |
| | | this.code = code.getCode(); |
| | | this.data = o; |
| | | } |
| | | |
| | | public TokenException(int code, String msg, Object o) { |
| | | super(msg); |
| | | this.code = code; |
| | | this.data = o; |
| | | } |
| | | |
| | | public TokenException(String message, Throwable cause) { |
| | | super(message, cause); |
| | | } |
| | | |
| | | public TokenException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | public TokenException(Throwable cause) { |
| | | super(cause); |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Object getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(Object data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.exception; |
| | | |
| | | |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | |
| | | /** |
| | | * <p>token 异常</p> |
| | | * |
| | | * @author xiaochen |
| | | * @date 2020/9/27 18:24 |
| | | */ |
| | | public class UserException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = -232388151980021793L; |
| | | |
| | | |
| | | /** |
| | | * 自定义异常码 |
| | | */ |
| | | private int code = GlobalResultEnum.TOKEN_EXPIRE.getCode(); |
| | | |
| | | private Object data; |
| | | |
| | | public UserException(GlobalResultEnum code) { |
| | | this(code, null); |
| | | } |
| | | public UserException(int code,String msg) { |
| | | this(code, msg,null); |
| | | } |
| | | |
| | | public UserException(GlobalResultEnum code, Object o) { |
| | | super(code.getMessage()); |
| | | this.code = code.getCode(); |
| | | this.data = o; |
| | | } |
| | | |
| | | public UserException(int code, String msg, Object o) { |
| | | super(msg); |
| | | this.code = code; |
| | | this.data = o; |
| | | } |
| | | |
| | | public UserException(String message, Throwable cause) { |
| | | super(message, cause); |
| | | } |
| | | |
| | | public UserException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | public UserException(Throwable cause) { |
| | | super(cause); |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Object getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(Object data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.httpClinet; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | 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.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContexts; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.security.KeyStore; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); |
| | | |
| | | private static PoolingHttpClientConnectionManager connectionManager; |
| | | |
| | | |
| | | { |
| | | //1.创建连接池管理器 |
| | | connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private static CloseableHttpClient getHttpCline(){ |
| | | return HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private static RequestConfig getRequestConfig(){ |
| | | RequestConfig.Builder builder = RequestConfig.custom(); |
| | | builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 |
| | | .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 |
| | | .setExpectContinueEnabled(true) |
| | | .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 |
| | | return builder.build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); |
| | | } |
| | | } |
| | | switch (contentType){ |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s =objectMapper.writeValueAsString(params); |
| | | httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); |
| | | break; |
| | | } |
| | | return getHttpCline().execute(httpPost); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception{ |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | httpGet.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | return getHttpCline().execute(httpGet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed){ |
| | | case "GET": |
| | | httpResponse = setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | httpResponse = setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 请求https发送XML请求 |
| | | * @param url 接口路径 |
| | | * @param xml 内容 |
| | | * @param header 请求头 |
| | | * @param certPassword 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpClient httpCline = this.initCert(certPassword, certPath, certType); |
| | | CloseableHttpResponse httpResponse = httpCline.execute(httpPost); |
| | | String content = null; |
| | | if(httpResponse.getStatusLine().getStatusCode() == 200){ |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | }else{ |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | } |
| | | this.close(httpResponse); |
| | | httpCline.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化https对象(带证书) |
| | | * @param key 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @throws Exception |
| | | */ |
| | | private CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { |
| | | KeyStore keyStore = KeyStore.getInstance(certType); |
| | | InputStream inputStream = new FileInputStream(new File(certPath)); |
| | | try { |
| | | keyStore.load(inputStream, key.toCharArray()); |
| | | } finally { |
| | | inputStream.close(); |
| | | } |
| | | SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); |
| | | SSLConnectionSocketFactory sslsf = |
| | | new SSLConnectionSocketFactory(sslcontext, new String[] {"TLSv1"}, null, |
| | | SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
| | | return HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private static void close(CloseableHttpResponse httpResponse){ |
| | | try { |
| | | if(null != httpResponse){ |
| | | EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | if(null != httpResponse){ |
| | | httpResponse.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.httpClinet; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * http请求返回封装 |
| | | */ |
| | | @Data |
| | | public class HttpResult { |
| | | /** |
| | | * 返回状态码 |
| | | */ |
| | | private Integer code; |
| | | /** |
| | | * 返回结果 |
| | | */ |
| | | private String data; |
| | | |
| | | /** |
| | | * 返回封装结果 |
| | | * @param code |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static HttpResult getHttpResult(Integer code, String data){ |
| | | HttpResult httpResult = new HttpResult(); |
| | | httpResult.setCode(code); |
| | | httpResult.setData(data); |
| | | return httpResult; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.httpClinet; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class MD5AndKL { |
| | | |
| | | /** |
| | | * MD5加码。32位 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String MD5(String inStr) { |
| | | MessageDigest md5 = null; |
| | | try { |
| | | md5 = MessageDigest.getInstance("MD5"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.toString()); |
| | | } |
| | | byte[] md5Bytes = md5.digest(inStr.getBytes()); |
| | | StringBuffer hexValue = new StringBuffer(); |
| | | for (int i = 0; i < md5Bytes.length; i++) { |
| | | int val = ((int) md5Bytes[i]) & 0xff; |
| | | if (val < 16) { |
| | | hexValue.append("0"); |
| | | } |
| | | hexValue.append(Integer.toHexString(val)); |
| | | } |
| | | return hexValue.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 可逆的加密算法 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String KL(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String s = new String(a); |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * 加密后解密 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String JM(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String k = new String(a); |
| | | return k; |
| | | } |
| | | |
| | | |
| | | |
| | | private static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) |
| | | resultSb.append(byteToHexString(b[i])); |
| | | |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | private static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) |
| | | n += 256; |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigits[d1] + hexDigits[d2]; |
| | | } |
| | | |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (charsetname == null || "".equals(charsetname)){ |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | }else{ |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", |
| | | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; |
| | | |
| | | public static void main(String args[]) { |
| | | |
| | | System.out.println("MD5后再加密:" + KL(MD5("123456"))); |
| | | System.out.println(MD5("123456")); |
| | | // System.out.println("加密:" + KL(MD5("123456"))); |
| | | // s = KL(s); |
| | | // System.out.println("解密:" + KL("81dc9bdb52d04dc20036dbd8313ed055")); |
| | | // System.out.println("解密:" + JM(KL(s))); |
| | | // System.out.println("解密为MD5后的:" + KL(KL(MD5(s)))); |
| | | // System.out.println(JM("5d62957bb57d3e49dcf48a0df064be4c")); |
| | | // System.out.println(MD5AndKL.KL(MD5AndKL.MD5("admin"+"87654321"))); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.log; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 自定义登录日志注解 |
| | | * |
| | | * @author wu |
| | | */ |
| | | //注解放置的目标位置,METHOD是可注解在方法级别上 |
| | | @Target(ElementType.METHOD) |
| | | //注解在哪个阶段执行 运行时 |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface OperLoginLog { |
| | | // String operModul() default ""; // 操作模块 |
| | | // String operType() default ""; // 操作类型 |
| | | // String operDesc() default ""; // 操作说明 |
| | | } |
New file |
| | |
| | | package com.jilongda.common.log; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 自定义操作日志注解 |
| | | * |
| | | * @author wu |
| | | */ |
| | | //注解放置的目标位置,METHOD是可注解在方法级别上 |
| | | @Target(ElementType.METHOD) |
| | | //注解在哪个阶段执行 运行时 |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface OperationLog { |
| | | String operModul() default ""; // 操作模块 |
| | | |
| | | String operType() default ""; // 操作类型 |
| | | |
| | | String operDesc() default ""; // 操作说明 |
| | | } |
New file |
| | |
| | | package com.jilongda.common.log; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 参数解析 |
| | | * |
| | | * @author |
| | | * @create 2018-09-26 9:21 |
| | | */ |
| | | @Target(ElementType.PARAMETER) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface ParamParser { |
| | | String value() default "---此类型数据非文本信息,不可记录---"; |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("login_log") |
| | | @ApiModel(value = "LoginLog对象", description = "登录日志") |
| | | public class LoginLog { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "操作人员姓名") |
| | | @TableField("user_name") |
| | | @Excel(name = "操作人员姓名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "操作人员账号") |
| | | @TableField("account") |
| | | @Excel(name = "操作人员账号") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "工作地") |
| | | @TableField("work_address") |
| | | private String workAddress; |
| | | |
| | | @ApiModelProperty(value = "登录地址") |
| | | @TableField("login_address") |
| | | @Excel(name = "登录地址") |
| | | private String loginAddress; |
| | | |
| | | @ApiModelProperty(value = "登录时间") |
| | | @TableField("login_time") |
| | | private LocalDateTime loginTime; |
| | | |
| | | @ApiModelProperty(value = "登录IP") |
| | | @TableField("login_ip") |
| | | @Excel(name = "登录IP") |
| | | private String loginIp; |
| | | |
| | | @ApiModelProperty(value = "登录设备") |
| | | @TableField("equipment") |
| | | @Excel(name = "登录设备") |
| | | private String equipment; |
| | | |
| | | @ApiModelProperty(value = "openId") |
| | | @TableField("open_id") |
| | | @Excel(name = "openId") |
| | | private String openId; |
| | | |
| | | @ApiModelProperty(value = "小程序或后台 1小程序 2后台") |
| | | @TableField("applet_or_manage") |
| | | @Excel(name = "小程序或后台 1小程序 2后台", replace = {"小程序_1", "后台_2"}) |
| | | private Integer appletOrManage; |
| | | |
| | | @TableField(exist = false) |
| | | @Excel(name = "登录时间") |
| | | private String loginTimeExport; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 操作日志 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("oper_log") |
| | | @ApiModel(value = "OperLog对象", description = "操作日志") |
| | | public class OperLog { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户名") |
| | | @TableField("oper_user_name") |
| | | @Excel(name = "用户名") |
| | | private String operUserName; |
| | | |
| | | @ApiModelProperty(value = "账号") |
| | | @TableField("oper_account") |
| | | @Excel(name = "账号") |
| | | private String operAccount; |
| | | |
| | | @ApiModelProperty(value = "操作时间") |
| | | @TableField("oper_operation_time") |
| | | private LocalDateTime operOperationTime; |
| | | |
| | | @ApiModelProperty(value = "IP地址") |
| | | @TableField("oper_ip") |
| | | @Excel(name = "IP地址") |
| | | private String operIp; |
| | | |
| | | @ApiModelProperty(value = "操作模块") |
| | | @TableField("oper_model") |
| | | @Excel(name = "操作模块") |
| | | private String operModel; |
| | | |
| | | @ApiModelProperty(value = "操作类型") |
| | | @TableField("oper_type") |
| | | @Excel(name = "操作类型") |
| | | private String operType; |
| | | |
| | | @ApiModelProperty(value = "操作描述") |
| | | @TableField("oper_desc") |
| | | @Excel(name = "操作描述") |
| | | private String operDesc; |
| | | |
| | | @ApiModelProperty(value = "请求uri地址") |
| | | @TableField("oper_uri") |
| | | @Excel(name = "请求uri地址") |
| | | private String operUri; |
| | | |
| | | @ApiModelProperty(value = "请求方法") |
| | | @TableField("oper_method") |
| | | @Excel(name = "请求方法") |
| | | private String operMethod; |
| | | |
| | | @ApiModelProperty(value = "请求参数") |
| | | @TableField("oper_req_param") |
| | | @Excel(name = "请求参数") |
| | | private String operReqParam; |
| | | |
| | | @ApiModelProperty(value = "操作时间") |
| | | @TableField(exist = false) |
| | | @Excel(name = "操作时间") |
| | | private String operOperationTimeExport; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 轮播图 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_carousel_images") |
| | | @ApiModel(value="TCarouselImages对象", description="轮播图") |
| | | public class TCarouselImages extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "轮播图地址") |
| | | @TableField("imageUrl") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("displayOrder") |
| | | private Integer displayOrder; |
| | | |
| | | @ApiModelProperty(value = "0下架1上架") |
| | | @TableField("status") |
| | | private Boolean status; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 基础配置表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_config") |
| | | @ApiModel(value="TConfig对象", description="基础配置表") |
| | | public class TConfig implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "内容 1=用户协议 2=隐私协议 3=注销协议") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 客户表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_customers") |
| | | @ApiModel(value="TCustomers对象", description="客户表") |
| | | public class TCustomers extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "公司名") |
| | | @Excel(name = "公司名") |
| | | @TableField("companyName") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "子公司名") |
| | | @Excel(name = "子公司名") |
| | | @TableField("subsidiaryName") |
| | | private String subsidiaryName; |
| | | |
| | | @ApiModelProperty(value = "客户姓名") |
| | | @Excel(name = "客户姓名") |
| | | @TableField("customerName") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty(value = "收件人姓名") |
| | | @Excel(name = "收件人姓名") |
| | | @TableField("recipientName") |
| | | private String recipientName; |
| | | |
| | | @ApiModelProperty(value = "收件人电话") |
| | | @Excel(name = "收件人电话") |
| | | @TableField("recipientPhone") |
| | | private String recipientPhone; |
| | | |
| | | @ApiModelProperty(value = "收件地址") |
| | | @Excel(name = "收件地址") |
| | | @TableField("recipientAddress") |
| | | private String recipientAddress; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_dept") |
| | | @ApiModel(value="TDept对象", description="部门表") |
| | | public class TDept extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "部门名称") |
| | | @TableField("deptName") |
| | | private String deptName; |
| | | |
| | | @ApiModelProperty(value = "排序 倒排") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 产品表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_goods") |
| | | @ApiModel(value="TGoods对象", description="产品表") |
| | | public class TGoods extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "产品名称") |
| | | @TableField("goodsName") |
| | | @Length(max = 40,message = "产品名称最长可输入40字符") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "产品图片") |
| | | @TableField("goodsPicture") |
| | | private String goodsPicture; |
| | | |
| | | @ApiModelProperty(value = "产品编号") |
| | | @TableField("goodsNo") |
| | | @Length(max = 10,message = "产品编号最长可输入10字符") |
| | | private String goodsNo; |
| | | |
| | | @ApiModelProperty(value = "产品品牌") |
| | | @TableField("goodsBrand") |
| | | @Length(max = 40,message = "产品品牌最长可输入40字符") |
| | | private String goodsBrand; |
| | | |
| | | @ApiModelProperty(value = "产品性质") |
| | | @TableField("goodsNature") |
| | | @Length(max = 200,message = "产品性质最长可输入200字符") |
| | | private String goodsNature; |
| | | |
| | | @ApiModelProperty(value = "产品类别") |
| | | @TableField("goodsType") |
| | | @Length(max = 40,message = "产品类别最长可输入40字符") |
| | | private String goodsType; |
| | | |
| | | @ApiModelProperty(value = "产品描述") |
| | | @TableField("goodsRemark") |
| | | private String goodsRemark; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 产品规格表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_goods_specifications") |
| | | @ApiModel(value="TGoodsSpecifications对象", description="产品规格表") |
| | | public class TGoodsSpecifications extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | @TableField("goodsId") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "剂型 1=粉剂,2=颗粒,3=液体") |
| | | @TableField("goodsDosage") |
| | | private Integer goodsDosage; |
| | | |
| | | @ApiModelProperty(value = "含量") |
| | | @TableField("goodsContent") |
| | | private String goodsContent; |
| | | |
| | | @ApiModelProperty(value = "规格") |
| | | @TableField("goodsSpecifications") |
| | | private String goodsSpecifications; |
| | | |
| | | @ApiModelProperty(value = "仓库") |
| | | @TableField("warehouse") |
| | | private String warehouse; |
| | | |
| | | @ApiModelProperty(value = "总经理价格") |
| | | @TableField("generalManagerPrice") |
| | | private BigDecimal generalManagerPrice; |
| | | |
| | | @ApiModelProperty(value = "销售总监价格") |
| | | @TableField("salesDirector") |
| | | private BigDecimal salesDirector; |
| | | |
| | | @ApiModelProperty(value = "客户经理价格") |
| | | @TableField("accountManager") |
| | | private BigDecimal accountManager; |
| | | |
| | | @ApiModelProperty(value = "用户权限,用户id逗号分隔") |
| | | @TableField("userIds") |
| | | private String userIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order") |
| | | @ApiModel(value="TOrder对象", description="订单表") |
| | | public class TOrder extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "客户id") |
| | | @TableField("customerId") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "订单金额") |
| | | @TableField("orderAmount") |
| | | private BigDecimal orderAmount; |
| | | |
| | | @ApiModelProperty(value = "下单人员id") |
| | | @TableField("orderingPersonId") |
| | | private Long orderingPersonId; |
| | | |
| | | @ApiModelProperty(value = "订单状态(1待审批,2已通过,3已拒绝,4待发货,5已发货,6.已撤回)") |
| | | @TableField("orderStatus") |
| | | private Integer orderStatus; |
| | | |
| | | @ApiModelProperty(value = "款期") |
| | | @TableField("paymentTerms") |
| | | private LocalDateTime paymentTerms; |
| | | |
| | | @ApiModelProperty(value = "发票类型1专票、2普票、3不开票") |
| | | @TableField("invoiceType") |
| | | private Integer invoiceType; |
| | | |
| | | @ApiModelProperty(value = "物流1自提,2配送") |
| | | @TableField("logistics") |
| | | private Integer logistics; |
| | | |
| | | @ApiModelProperty(value = "要求到货时间") |
| | | @TableField("expectedDeliveryDate") |
| | | private LocalDate expectedDeliveryDate; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("orderCode") |
| | | private String orderCode; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "收件人姓名") |
| | | @TableField("recipientName") |
| | | private String recipientName; |
| | | |
| | | @ApiModelProperty(value = "收件人电话") |
| | | @TableField("recipientPhone") |
| | | private String recipientPhone; |
| | | |
| | | @ApiModelProperty(value = "收件地址") |
| | | @TableField("recipientAddress") |
| | | private String recipientAddress; |
| | | |
| | | @ApiModelProperty(value = "审批人") |
| | | @TableField("passUserId") |
| | | private Long passUserId; |
| | | |
| | | @ApiModelProperty(value = "审批备注") |
| | | @TableField("passRemark") |
| | | private String passRemark; |
| | | |
| | | @ApiModelProperty(value = "检测报告") |
| | | @TableField("reportPics") |
| | | private String reportPics; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单产品中间表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_order_good") |
| | | @ApiModel(value="TOrderGood对象", description="订单产品中间表") |
| | | public class TOrderGood implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "产品id") |
| | | @TableField("goodsId") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "规格id") |
| | | @TableField("specId") |
| | | private Long specId; |
| | | |
| | | @ApiModelProperty(value = "购买数量") |
| | | @TableField("buyNum") |
| | | private Integer buyNum; |
| | | |
| | | @ApiModelProperty(value = "产品名称") |
| | | @TableField("goodsName") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "产品图片") |
| | | @TableField("goodsPicture") |
| | | private String goodsPicture; |
| | | |
| | | @ApiModelProperty(value = "产品编号") |
| | | @TableField("goodsNo") |
| | | private String goodsNo; |
| | | |
| | | @ApiModelProperty(value = "产品品牌") |
| | | @TableField("goodsBrand") |
| | | private String goodsBrand; |
| | | |
| | | @ApiModelProperty(value = "产品性质") |
| | | @TableField("goodsNature") |
| | | private String goodsNature; |
| | | |
| | | @ApiModelProperty(value = "产品类别") |
| | | @TableField("goodsType") |
| | | private String goodsType; |
| | | |
| | | @ApiModelProperty(value = "产品描述") |
| | | @TableField("goodsRemark") |
| | | private String goodsRemark; |
| | | |
| | | @ApiModelProperty(value = "剂型 1=粉剂,2=颗粒,3=液体") |
| | | @TableField("goodsDosage") |
| | | private Integer goodsDosage; |
| | | |
| | | @ApiModelProperty(value = "含量") |
| | | @TableField("goodsContent") |
| | | private String goodsContent; |
| | | |
| | | @ApiModelProperty(value = "规格") |
| | | @TableField("goodsSpecifications") |
| | | private String goodsSpecifications; |
| | | |
| | | @ApiModelProperty(value = "仓库") |
| | | @TableField("warehouse") |
| | | private String warehouse; |
| | | |
| | | @ApiModelProperty(value = "产品价格") |
| | | @TableField("goodsPrice") |
| | | private BigDecimal goodsPrice; |
| | | |
| | | @ApiModelProperty(value = "修改后价格") |
| | | @TableField("updateGoodsPrice") |
| | | private BigDecimal updateGoodsPrice; |
| | | |
| | | @ApiModelProperty(value = "商品小计") |
| | | @TableField("goodsTotal") |
| | | private BigDecimal goodsTotal; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_region") |
| | | @ApiModel(value="TRegion对象", description="省市管理") |
| | | public class TRegion implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "城市名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "城市代码") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "城市code") |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty(value = "父级ID") |
| | | @TableField("parentId") |
| | | private Long parentId; |
| | | |
| | | @ApiModelProperty(value = "英文名称") |
| | | @TableField("english") |
| | | private String english; |
| | | |
| | | @ApiModelProperty(value = "首字母") |
| | | @TableField("initial") |
| | | private String initial; |
| | | |
| | | @TableField(exist = false) |
| | | private List<TRegion> children; |
| | | } |
New file |
| | |
| | | package com.jilongda.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.jilongda.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_user") |
| | | @ApiModel(value="TUser对象", description="用户管理") |
| | | public class TUser extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "昵称") |
| | | @TableField("nickName") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | @TableField("userName") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("userPhone") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "密码") |
| | | @TableField("password") |
| | | private String password; |
| | | |
| | | @ApiModelProperty(value = "会员类型 1=个人会员 2=企业会员 3=普通用户") |
| | | @TableField("vipType") |
| | | private Integer vipType; |
| | | |
| | | @ApiModelProperty(value = "注册时间") |
| | | @TableField("insertTime") |
| | | private LocalDateTime insertTime; |
| | | |
| | | @ApiModelProperty(value = "毕业院校") |
| | | @TableField("graduationInstitution") |
| | | private String graduationInstitution; |
| | | |
| | | @ApiModelProperty(value = "自我介绍") |
| | | @TableField("selfIntroduction") |
| | | private String selfIntroduction; |
| | | |
| | | @ApiModelProperty(value = "首次成为会员时间") |
| | | @TableField("firstVipTime") |
| | | private LocalDateTime firstVipTime; |
| | | |
| | | @ApiModelProperty(value = "会员开始时间") |
| | | @TableField("startTime") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "会员到期时间") |
| | | @TableField("endTime") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "已消费金额") |
| | | @TableField("consumptionAmount") |
| | | private Double consumptionAmount; |
| | | |
| | | @ApiModelProperty(value = "会员等级") |
| | | @TableField("vipLevel") |
| | | private Integer vipLevel; |
| | | |
| | | @ApiModelProperty(value = "性别 1=男 2=女 0=未知") |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | |
| | | @ApiModelProperty(value = "生日") |
| | | @TableField("birthday") |
| | | private LocalDateTime birthday; |
| | | |
| | | @ApiModelProperty(value = "体重") |
| | | @TableField("weight") |
| | | private Double weight; |
| | | |
| | | @ApiModelProperty(value = "身高") |
| | | @TableField("height") |
| | | private Double height; |
| | | |
| | | @ApiModelProperty(value = "省份") |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | |
| | | @ApiModelProperty(value = "省份code") |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | |
| | | @ApiModelProperty(value = "城市") |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | |
| | | @ApiModelProperty(value = "城市code") |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty(value = "演员封面") |
| | | @TableField("performerCover") |
| | | private String performerCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "openId") |
| | | @TableField("openId") |
| | | private String openId; |
| | | |
| | | @ApiModelProperty(value = "状态 1=正常 2=冻结 3=已过期") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "审核状态 1=待审核 2=通过 3=驳回") |
| | | @TableField("auditStatus") |
| | | private Integer auditStatus; |
| | | |
| | | @ApiModelProperty(value = "审核备注") |
| | | @TableField("auditRemark") |
| | | private String auditRemark; |
| | | |
| | | @ApiModelProperty(value = "最后一次登录时间") |
| | | @TableField("lastLoginTime") |
| | | private LocalDateTime lastLoginTime; |
| | | |
| | | @ApiModelProperty(value = "得票数") |
| | | @TableField("hot") |
| | | private Integer hot; |
| | | |
| | | @ApiModelProperty(value = "演员状态 1=正常 2=冻结") |
| | | @TableField("performerStatus") |
| | | private Integer performerStatus; |
| | | |
| | | @ApiModelProperty(value = "视频") |
| | | @TableField("vedio") |
| | | private String vedio; |
| | | |
| | | @ApiModelProperty(value = "已消费金额") |
| | | @TableField("hasPay") |
| | | private Double hasPay; |
| | | |
| | | @ApiModelProperty(value = "头像") |
| | | @TableField("advatar") |
| | | private String advatar; |
| | | |
| | | @ApiModelProperty(value = "类型1总经理2销售总监3客户经理") |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.msg; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class HuaweiCloudSMSUtil { |
| | | |
| | | @Value("${hw.sms.url}") |
| | | private String url; |
| | | @Value("${hw.sms.appKey}") |
| | | private String appKey; |
| | | @Value("${hw.sms.appSecret}") |
| | | private String appSecret; |
| | | //国内短信签名通道号 |
| | | @Value("${hw.sms.sender}") |
| | | private String sender; |
| | | //模板ID |
| | | @Value("${hw.sms.templateId}") |
| | | private String templateId; |
| | | //签名名称 |
| | | @Value("${hw.sms.signature}") |
| | | private String signature; |
| | | |
| | | //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 |
| | | private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\""; |
| | | //无需修改,用于格式化鉴权头域,给"Authorization"参数赋值 |
| | | private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\""; |
| | | |
| | | public void sendSMS(String receiver, String sendCode) { |
| | | |
| | | /** |
| | | * 选填,使用无变量模板时请赋空值 String templateParas = ""; |
| | | * 单变量模板示例:模板内容为"您的验证码是${1}"时,templateParas可填写为"[\"369751\"]" |
| | | * 双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" |
| | | * 模板中的每个变量都必须赋值,且取值不能为空 |
| | | * 查看更多模板规范和变量规范:产品介绍>短信模板须知和短信变量须知 |
| | | */ |
| | | String templateParas = "[\"" + sendCode + "\"]"; //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。 |
| | | |
| | | //请求Body,不携带签名名称时,signature请填null |
| | | String body = buildRequestBody(sender, receiver, templateId, templateParas, "", signature); |
| | | if (null == body || body.isEmpty()) { |
| | | System.out.println("body is null."); |
| | | return; |
| | | } |
| | | |
| | | //请求Headers中的X-WSSE参数值 |
| | | String wsseHeader = buildWsseHeader(appKey, appSecret); |
| | | if (null == wsseHeader || wsseHeader.isEmpty()) { |
| | | System.out.println("wsse header is null."); |
| | | return; |
| | | } |
| | | |
| | | Writer out = null; |
| | | BufferedReader in = null; |
| | | StringBuffer result = new StringBuffer(); |
| | | HttpsURLConnection connection = null; |
| | | InputStream is = null; |
| | | |
| | | HostnameVerifier hv = new HostnameVerifier() { |
| | | |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) { |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | try { |
| | | trustAllHttpsCertificates(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | try { |
| | | URL realUrl = new URL(url); |
| | | connection = (HttpsURLConnection) realUrl.openConnection(); |
| | | |
| | | connection.setHostnameVerifier(hv); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setUseCaches(true); |
| | | //请求方法 |
| | | connection.setRequestMethod("POST"); |
| | | //请求Headers参数 |
| | | connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
| | | connection.setRequestProperty("Authorization", AUTH_HEADER_VALUE); |
| | | connection.setRequestProperty("X-WSSE", wsseHeader); |
| | | |
| | | connection.connect(); |
| | | out = new OutputStreamWriter(connection.getOutputStream()); |
| | | out.write(body); //发送请求Body参数 |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | int status = connection.getResponseCode(); |
| | | if (200 == status) { //200 |
| | | is = connection.getInputStream(); |
| | | } else { //400/401 |
| | | is = connection.getErrorStream(); |
| | | } |
| | | in = new BufferedReader(new InputStreamReader(is, "UTF-8")); |
| | | String line = ""; |
| | | while ((line = in.readLine()) != null) { |
| | | result.append(line); |
| | | } |
| | | System.out.println(result.toString()); //打印响应消息实体 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (null != out) { |
| | | out.close(); |
| | | } |
| | | if (null != is) { |
| | | is.close(); |
| | | } |
| | | if (null != in) { |
| | | in.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 构造请求Body体 |
| | | * |
| | | * @param sender |
| | | * @param receiver |
| | | * @param templateId |
| | | * @param templateParas |
| | | * @param statusCallBack |
| | | * @param signature | 签名名称,使用国内短信通用模板时填写 |
| | | * @return |
| | | */ |
| | | static String buildRequestBody(String sender, String receiver, String templateId, String templateParas, |
| | | String statusCallBack, String signature) { |
| | | if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty() |
| | | || templateId.isEmpty()) { |
| | | System.out.println("buildRequestBody(): sender, receiver or templateId is null."); |
| | | return null; |
| | | } |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | |
| | | map.put("from", sender); |
| | | map.put("to", receiver); |
| | | map.put("templateId", templateId); |
| | | if (null != templateParas && !templateParas.isEmpty()) { |
| | | map.put("templateParas", templateParas); |
| | | } |
| | | if (null != statusCallBack && !statusCallBack.isEmpty()) { |
| | | map.put("statusCallback", statusCallBack); |
| | | } |
| | | if (null != signature && !signature.isEmpty()) { |
| | | map.put("signature", signature); |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | String temp = ""; |
| | | |
| | | for (String s : map.keySet()) { |
| | | try { |
| | | temp = URLEncoder.encode(map.get(s), "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | sb.append(s).append("=").append(temp).append("&"); |
| | | } |
| | | |
| | | return sb.deleteCharAt(sb.length() - 1).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 构造X-WSSE参数值 |
| | | * |
| | | * @param appKey |
| | | * @param appSecret |
| | | * @return |
| | | */ |
| | | static String buildWsseHeader(String appKey, String appSecret) { |
| | | if (null == appKey || null == appSecret || appKey.isEmpty() || appSecret.isEmpty()) { |
| | | System.out.println("buildWsseHeader(): appKey or appSecret is null."); |
| | | return null; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); |
| | | String time = sdf.format(new Date()); //Created |
| | | String nonce = UUID.randomUUID().toString().replace("-", ""); //Nonce |
| | | |
| | | MessageDigest md; |
| | | byte[] passwordDigest = null; |
| | | |
| | | try { |
| | | md = MessageDigest.getInstance("SHA-256"); |
| | | md.update((nonce + time + appSecret).getBytes()); |
| | | passwordDigest = md.digest(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //如果JDK版本是1.8,请加载原生Base64类,并使用如下代码 |
| | | String passwordDigestBase64Str = Base64.getEncoder().encodeToString(passwordDigest); //PasswordDigest |
| | | //如果JDK版本低于1.8,请加载三方库提供Base64类,并使用如下代码 |
| | | //String passwordDigestBase64Str = Base64.encodeBase64String(passwordDigest); //PasswordDigest |
| | | //若passwordDigestBase64Str中包含换行符,请执行如下代码进行修正 |
| | | //passwordDigestBase64Str = passwordDigestBase64Str.replaceAll("[\\s*\t\n\r]", ""); |
| | | return String.format(WSSE_HEADER_FORMAT, appKey, passwordDigestBase64Str, nonce, time); |
| | | } |
| | | |
| | | /*** @throws Exception |
| | | */ |
| | | static void trustAllHttpsCertificates() throws Exception { |
| | | TrustManager[] trustAllCerts = new TrustManager[]{ |
| | | new X509TrustManager() { |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
| | | return; |
| | | } |
| | | |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
| | | return; |
| | | } |
| | | |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return null; |
| | | } |
| | | } |
| | | }; |
| | | SSLContext sc = SSLContext.getInstance("SSL"); |
| | | sc.init(null, trustAllCerts, null); |
| | | HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName BaseModel |
| | | * @Description |
| | | * @date 2021-04-02 19:38 |
| | | */ |
| | | @Data |
| | | public class BaseModel implements Serializable { |
| | | /** |
| | | * 字段常量属性 |
| | | */ |
| | | public static final String ID = "id"; |
| | | |
| | | public static final String CREATE_TIME = "createTime"; |
| | | |
| | | public static final String UPDATE_TIME = "updateTime"; |
| | | |
| | | private static final long serialVersionUID = 2553749188490103197L; |
| | | /** |
| | | * 新增执行 |
| | | */ |
| | | @ApiModelProperty(value = "记录创建人,前端忽略") |
| | | @TableField(value = "createBy", fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 新增和更新执行 |
| | | */ |
| | | @ApiModelProperty(value = "记录修改人,前端忽略") |
| | | //@JsonIgnore |
| | | @TableField(value = "updateBy", fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | /** |
| | | * 删除 未删除 |
| | | */ |
| | | @JsonIgnore |
| | | @TableField("isDelete") |
| | | @TableLogic |
| | | private Boolean isDelete; |
| | | |
| | | @ApiModelProperty(value = "记录创建时间,前端忽略") |
| | | @TableField("createTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 最后修改时间 |
| | | */ |
| | | @ApiModelProperty(value = "记录修改时间,前端忽略") |
| | | @JsonIgnore |
| | | @TableField("updateTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | public String getCreateBy() { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public String getUpdateBy() { |
| | | return updateBy; |
| | | } |
| | | |
| | | public void setUpdateBy(String updateBy) { |
| | | this.updateBy = updateBy; |
| | | } |
| | | |
| | | public Boolean getDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setDelete(Boolean delete) { |
| | | isDelete = delete; |
| | | } |
| | | |
| | | public LocalDateTime getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(LocalDateTime createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public LocalDateTime getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(LocalDateTime updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * <p></p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/8/24 16:39 |
| | | */ |
| | | @ApiModel(value = "基础查询列表dto") |
| | | public class BasePage { |
| | | /** |
| | | * 分页参数,当前页码 |
| | | */ |
| | | @ApiModelProperty(value = "分页参数,当前页码") |
| | | private Integer pageNum = 1; |
| | | /** |
| | | * 分页参数,每页数量 |
| | | */ |
| | | @ApiModelProperty(value = "分页参数,每页数量,默认为10") |
| | | private Integer pageSize = 10; |
| | | |
| | | public Integer getPageNum() { |
| | | return pageNum; |
| | | } |
| | | |
| | | public void setPageNum(Integer pageNum) { |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | public Integer getPageSize() { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(Integer pageSize) { |
| | | this.pageSize = pageSize; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "BasePage{" + |
| | | "pageNum=" + pageNum + |
| | | ", pageSize=" + pageSize + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.redis; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.PropertyAccessor; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.cache.Cache; |
| | | 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.KeyGenerator; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Import; |
| | | import org.springframework.data.redis.cache.RedisCacheConfiguration; |
| | | import org.springframework.data.redis.cache.RedisCacheManager; |
| | | import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.RedisSerializationContext; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.time.Duration; |
| | | |
| | | |
| | | /** |
| | | * swagger2 的spring-boot启动器 |
| | | * <p> |
| | | * <p> |
| | | * 开启缓存配置 |
| | | * |
| | | * @author xiaochen |
| | | */ |
| | | @Configuration |
| | | @Slf4j |
| | | @EnableCaching |
| | | @Import(RedisAutoTemplate.class) |
| | | public class RedisAutoConfiguration extends CachingConfigurerSupport { |
| | | |
| | | private final LettuceConnectionFactory lettuceConnectionFactory; |
| | | |
| | | @Autowired |
| | | public RedisAutoConfiguration(LettuceConnectionFactory lettuceConnectionFactory) { |
| | | this.lettuceConnectionFactory = lettuceConnectionFactory; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 默认生成key |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | @Override |
| | | public KeyGenerator keyGenerator() { |
| | | return new KeyGenerator() { |
| | | @Override |
| | | public Object generate(Object target, Method method, Object... params) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(target.getClass().getName()); |
| | | sb.append("::" + method.getName() + ":"); |
| | | for (Object obj : params) { |
| | | sb.append(obj.toString()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 缓存管理器 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Bean |
| | | public CacheManager cacheManager() { |
| | | // 序列化 配置RedisCacheConfiguration的序列化方式为json |
| | | RedisSerializer<String> redisSerializer = new StringRedisSerializer(); |
| | | //创建Json序列化对象 |
| | | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); |
| | | //解决查询缓存转换异常的问题 |
| | | ObjectMapper om = new ObjectMapper(); |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); |
| | | jackson2JsonRedisSerializer.setObjectMapper(om); |
| | | |
| | | // 将默认序列化改为Jackson2JsonRedisSerializer序列化 |
| | | RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() |
| | | // 默认5秒过期 |
| | | .entryTtl(Duration.ofSeconds(5L)) |
| | | .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer)) |
| | | // value 使用jdk的序列化方式 |
| | | //.setValueSerializer(new JdkSerializationRedisSerializer()); |
| | | .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer)) |
| | | .disableCachingNullValues(); |
| | | RedisCacheManager cacheManager = RedisCacheManager.builder(lettuceConnectionFactory) |
| | | .cacheDefaults(config) |
| | | .build(); |
| | | return cacheManager; |
| | | } |
| | | |
| | | /** |
| | | * RedisTemplate配置 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public RedisTemplate<String, Object> redisTemplate() { |
| | | //解决查询缓存转换异常的问题 |
| | | ObjectMapper om = new ObjectMapper(); |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); |
| | | // 配置redisTemplate |
| | | RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); |
| | | redisTemplate.setConnectionFactory(lettuceConnectionFactory); |
| | | // 使用fastjson序列化 |
| | | // FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); |
| | | //设置序列化 |
| | | Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); |
| | | jackson2JsonRedisSerializer.setObjectMapper(om); |
| | | RedisSerializer<String> stringSerializer = new StringRedisSerializer(); |
| | | // key序列化 |
| | | redisTemplate.setKeySerializer(stringSerializer); |
| | | // value序列化 |
| | | redisTemplate.setValueSerializer(jackson2JsonRedisSerializer); |
| | | // Hash key序列化 |
| | | redisTemplate.setHashKeySerializer(stringSerializer); |
| | | // Hash value序列化 |
| | | redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer); |
| | | redisTemplate.afterPropertiesSet(); |
| | | return redisTemplate; |
| | | } |
| | | |
| | | @Bean |
| | | @ConditionalOnMissingBean(StringRedisTemplate.class) |
| | | public StringRedisTemplate stringRedisTemplate() { |
| | | StringRedisTemplate template = new StringRedisTemplate(); |
| | | template.setConnectionFactory(lettuceConnectionFactory); |
| | | return template; |
| | | } |
| | | |
| | | @Bean |
| | | public RedisMessageListenerContainer redisMessageListenerContainer() { |
| | | RedisMessageListenerContainer redisMessageListenerContainer = new RedisMessageListenerContainer(); |
| | | redisMessageListenerContainer.setConnectionFactory(lettuceConnectionFactory); |
| | | return redisMessageListenerContainer; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * redis 异常日志 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Bean |
| | | public CacheErrorHandler errorHandler() { |
| | | // 异常处理,当Redis发生异常时,打印日志,但是程序正常走 |
| | | log.info("初始化 -> [{}]", "Redis CacheErrorHandler"); |
| | | CacheErrorHandler cacheErrorHandler = new CacheErrorHandler() { |
| | | @Override |
| | | public void handleCacheGetError(RuntimeException e, Cache cache, Object key) { |
| | | log.error("Redis occur handleCacheGetError:key -> [{}]", key, e); |
| | | } |
| | | |
| | | @Override |
| | | public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) { |
| | | log.error("Redis occur handleCachePutError:key -> [{}];value -> [{}]", key, value, e); |
| | | } |
| | | |
| | | @Override |
| | | public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) { |
| | | log.error("Redis occur handleCacheEvictError:key -> [{}]", key, e); |
| | | } |
| | | |
| | | @Override |
| | | public void handleCacheClearError(RuntimeException e, Cache cache) { |
| | | log.error("Redis occur handleCacheClearError:", e); |
| | | } |
| | | }; |
| | | return cacheErrorHandler; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.redis; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * Redis工具类 |
| | | * |
| | | * @author xiaochen |
| | | * @date 2023年2月25日 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public final class RedisAutoTemplate { |
| | | |
| | | private final RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | public RedisAutoTemplate(RedisTemplate<String, Object> redisTemplate) { |
| | | this.redisTemplate = redisTemplate; |
| | | } |
| | | |
| | | /* Common 相关 */ |
| | | |
| | | /** |
| | | * 指定缓存失效时间 |
| | | * |
| | | * @param key 键 |
| | | * @param time 时间(秒) |
| | | * @return |
| | | */ |
| | | public boolean expire(String key, long time) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | if (time > 0) { |
| | | redisTemplate.expire(key, time, TimeUnit.SECONDS); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 判断key是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hasKey(String key) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | return redisTemplate.hasKey(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 匹配符合正则的key |
| | | * 如果用keys模糊,好像会产生性能问题 |
| | | * |
| | | * @param patternKey |
| | | * @return key的集合 |
| | | */ |
| | | public Set<String> keys(String patternKey) { |
| | | log.debug(" keys key :{}", patternKey); |
| | | try { |
| | | if (isEmpty(patternKey)) { |
| | | return Collections.emptySet(); |
| | | } |
| | | return redisTemplate.keys(patternKey); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据key删除缓存 |
| | | * |
| | | * @param key |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean del(String... key) { |
| | | log.debug(" delete key :{}", key.toString()); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | Set<String> keySet = new HashSet<>(); |
| | | for (String str : key) { |
| | | keySet.add(str); |
| | | } |
| | | redisTemplate.delete(keySet); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 根据key删除缓存 |
| | | * |
| | | * @param key |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean delPattern(String key) { |
| | | log.debug(" delete Pattern keys :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | redisTemplate.delete(redisTemplate.keys(key)); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 删除一组key值 |
| | | * |
| | | * @param keys |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean del(Set<String> keys) { |
| | | log.debug(" delete keys :{}", keys.toString()); |
| | | try { |
| | | if (isEmpty(keys)) { |
| | | return false; |
| | | } |
| | | redisTemplate.delete(keys); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 设置过期时间 |
| | | * |
| | | * @param key 缓存key |
| | | * @param seconds 过期秒数 |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean setExpire(String key, long seconds) { |
| | | log.debug(" setExp key :{}, seconds: {}", key, seconds); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | return redisTemplate.expire(key, seconds, TimeUnit.SECONDS); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 查询过期时间 |
| | | * |
| | | * @param key 缓存key |
| | | * @return 秒数 返回0代表为永久有效 |
| | | */ |
| | | public Long getExpire(String key) { |
| | | log.debug(" getExpire key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.getExpire(key, TimeUnit.SECONDS); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | /** |
| | | * 缓存中的最大值并+1 |
| | | * |
| | | * @param key 缓存key值 |
| | | * @return long 缓存中的最大值+1 |
| | | */ |
| | | public long incr(String key) { |
| | | log.debug(" incr key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, 1); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | /** |
| | | * *递增 |
| | | * |
| | | * @param key 键 |
| | | * @param delta 要增加几(大于0) |
| | | * @return |
| | | */ |
| | | public long incr(String key, long delta) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | if (delta < 0) { |
| | | throw new RuntimeException("递增因子必须大于0"); |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, delta); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | /** |
| | | * 递减 |
| | | * |
| | | * @param key 键 |
| | | * @param delta 要减少几(小于0) |
| | | * @return |
| | | */ |
| | | public long decr(String key, long delta) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | if (delta < 0) { |
| | | throw new RuntimeException("递减因子必须大于0"); |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, -delta); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | /* String 相关 */ |
| | | |
| | | /** |
| | | * * 缓存存入key-value |
| | | * |
| | | * @param key 缓存键 |
| | | * @param value 缓存值 |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean setStr(String key, String value) { |
| | | log.debug(" setString key :{}, value: {}", key, value); |
| | | try { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 缓存存入key-value |
| | | * |
| | | * @param key 缓存键 |
| | | * @param value 缓存值 |
| | | * @param seconds 秒数 |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean setStr(String key, String value, long seconds) { |
| | | log.debug(" setString key :{}, value: {}, timeout:{}", key, value, seconds); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForValue().set(key, value, seconds, TimeUnit.SECONDS); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 根据key取出String value |
| | | * |
| | | * @param key 缓存key值 |
| | | * @return String 缓存的String |
| | | */ |
| | | public String getStr(String key) { |
| | | log.debug(" getString key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return (String) redisTemplate.opsForValue().get(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /* 对象 相关 */ |
| | | |
| | | /** |
| | | * * 缓存中存入序列化的Object对象 |
| | | * |
| | | * @param key 缓存key |
| | | * @param obj 存入的序列化对象 |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean setObj(String key, Object obj) { |
| | | log.debug(" set key :{}, value:{}", key, obj); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(obj)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForValue().set(key, obj); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 缓存中存入序列化的Object对象 |
| | | * |
| | | * @param seconds 秒 |
| | | * @param key 缓存key |
| | | * @param obj 存入的序列化对象 |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean setObj(String key, Object obj, long seconds) { |
| | | log.debug(" set key :{}, value:{}, seconds:{}", key, obj, seconds); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(obj)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForValue().set(key, obj); |
| | | if (seconds > 0) { |
| | | redisTemplate.expire(key, seconds, TimeUnit.SECONDS); |
| | | } else { |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 取出缓存中存储的序列化对象 |
| | | * |
| | | * @param key 缓存key |
| | | */ |
| | | public Object getObj(String key) { |
| | | log.debug(" get key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return redisTemplate.opsForValue().get(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * * 取出缓存中存储的序列化对象 |
| | | * |
| | | * @param key 缓存key |
| | | * @param clazz 对象类 |
| | | * @return <T> 序列化对象 |
| | | */ |
| | | public <T> T getObj(String key, Class<T> clazz) { |
| | | log.debug(" get key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return (T) redisTemplate.opsForValue().get(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /* Map 相关 */ |
| | | |
| | | /** |
| | | * * 存入Map数组 |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param map 缓存map |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public <T> boolean setMap(String key, Map<String, T> map) { |
| | | try { |
| | | if (isEmpty(key) || isEmpty(map)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForHash().putAll(key, map); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 存入Map数组并设置时间 |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param map 缓存map |
| | | * @param seconds 秒数 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean setMap(String key, Map<String, T> map, long seconds) { |
| | | log.debug(" setMapExp key :{}, value: {}, seconds:{}", key, map, seconds); |
| | | try { |
| | | if (setMap(key, map)) { |
| | | redisTemplate.expire(key, seconds, TimeUnit.SECONDS); |
| | | } else { |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 根据key以及hashKey取出对应的Object对象 |
| | | * |
| | | * @param key 缓存key |
| | | * @param hashKey 对应map的key |
| | | * @return object map中的对象 |
| | | */ |
| | | public <T> T getMapObj(String key, String hashKey, Class<T> clazz) { |
| | | log.debug(" getMapkey :{}, hashKey:{}", key, hashKey); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(hashKey)) { |
| | | return null; |
| | | } |
| | | return (T) redisTemplate.opsForHash().get(key, hashKey); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取出缓存key的map,对应的所有键值 |
| | | * |
| | | * @param key 缓存key |
| | | * @return map 缓存的map |
| | | */ |
| | | public Map getMap(String key) { |
| | | log.debug(" getMap key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * * map中加入新的key |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param hashKey map的Key值 |
| | | * @param value map的value值 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean addMap(String key, Object hashKey, T value) { |
| | | log.debug(" addMap key :{}, hashKey: {}, value:{}", key, hashKey, value); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(hashKey) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForHash().put(key, hashKey, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * map中加入新的key |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param hashKey map的Key值 |
| | | * @param value map的value值 |
| | | * @param seconds 秒数 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean addMap(String key, Object hashKey, T value, long seconds) { |
| | | log.debug(" addMap key :{}, hashKey: {}, seconds:{}, value:{}", key, hashKey, seconds, value); |
| | | try { |
| | | if (seconds > 0) { |
| | | if (addMap(key, hashKey, value)) { |
| | | expire(key, seconds); |
| | | } else { |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 取出缓存中map的所有key值 |
| | | * |
| | | * @param key 缓存key |
| | | * @return Set<String> map的key值合集 |
| | | */ |
| | | public Set<Object> getMapKeys(String key) { |
| | | log.debug(" getMapKeys key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return Collections.emptySet(); |
| | | } |
| | | return redisTemplate.opsForHash().keys(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | /** |
| | | * * 删除map中指定的key值,删除hash表中的值 |
| | | * |
| | | * @param key 缓存key |
| | | * @param hashKey map中指定的hashKey |
| | | * @return true:成功 false:失败 |
| | | */ |
| | | public boolean delMapKey(String key, Object... hashKey) { |
| | | log.debug(" delMapKey key :{}, hashKey:{}", key, hashKey); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(hashKey)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForHash().delete(key, hashKey); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断hash表中是否有该项的值 |
| | | * |
| | | * @param key 缓存key |
| | | * @param hashKey map中指定的hashKey |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hasKeyMap(String key, Object hashKey) { |
| | | log.debug(" hasKeyMap key :{}, hashKey:{}", key, hashKey); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(hashKey)) { |
| | | return false; |
| | | } |
| | | return redisTemplate.opsForHash().hasKey(key, hashKey); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * hash递增 如果不存在,就会创建一个 并把新增后的值返回 |
| | | * |
| | | * @param key 键 |
| | | * @param hashKey 项 |
| | | * @param by 要增加几(大于0) |
| | | * @return |
| | | */ |
| | | public double incrMap(String key, Object hashKey, double by) { |
| | | try { |
| | | if (isEmpty(key) || isEmpty(hashKey)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.opsForHash().increment(key, hashKey, by); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | /** |
| | | * hash递减 |
| | | * |
| | | * @param key 键 |
| | | * @param hashKey 项 |
| | | * @param by 要减少记(小于0) |
| | | * @return |
| | | */ |
| | | public double decrMap(String key, Object hashKey, double by) { |
| | | try { |
| | | if (isEmpty(key) || isEmpty(hashKey)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.opsForHash().increment(key, hashKey, -by); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询缓存的map的集合大小 |
| | | * |
| | | * @param key 缓存key |
| | | * @return long 缓存map的集合大小 |
| | | */ |
| | | public long getMapSize(String key) { |
| | | log.debug(" getMap key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.opsForHash().size(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | |
| | | |
| | | /* List 相关 */ |
| | | |
| | | |
| | | /** |
| | | * * 缓存存入List |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param list 缓存List |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean setList(String key, List<T> list) { |
| | | log.debug("setList key :{}, list: {}", key, list); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(list)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForList().leftPushAll(key, list.toArray()); |
| | | // redisTemplate.opsForList().rightPushAll(key, list.toArray()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 缓存存入List |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param list 缓存List |
| | | * @param seconds 秒数 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean setList(String key, List<T> list, long seconds) { |
| | | log.debug(" setList key :{}, value:{}, seconds:{}", key, list, seconds); |
| | | try { |
| | | if (seconds > 0) { |
| | | if (setList(key, list)) { |
| | | expire(key, seconds); |
| | | } else { |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * * Object存入List |
| | | * |
| | | * @param key 缓存key |
| | | * @param value List中的值 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean addList(String key, Object value) { |
| | | log.debug(" addList key :{}, value:{}", key, value); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForList().leftPush(key, value); |
| | | // redisTemplate.opsForList().rightPush(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * Object存入List |
| | | * |
| | | * @param key 缓存key |
| | | * @param value List中的值 |
| | | * @param seconds 秒数 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean addList(String key, Object value, long seconds) { |
| | | log.debug(" addList key :{}, value:{}", key, value); |
| | | try { |
| | | if (seconds > 0) { |
| | | if (addList(key, value)) { |
| | | expire(key, seconds); |
| | | } else { |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 获取list缓存的内容 |
| | | * |
| | | * @param key 键 |
| | | * @param start 开始 |
| | | * @param end 结束 0 到 -1代表所有值 |
| | | * @return |
| | | */ |
| | | public List<Object> getList(String key, long start, long end) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return redisTemplate.opsForList().range(key, start, end); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * * 根据key值取出对应的list合集 |
| | | * |
| | | * @param key 缓存key |
| | | * @return List<Object> 缓存中对应的list合集 |
| | | */ |
| | | public <V> List<V> getList(String key) { |
| | | log.debug(" getList key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | List<V> lists = (List<V>) redisTemplate.opsForList().range(key, 0, -1); |
| | | return lists.size() == 0 ? null : lists; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * * 根据key值截取对应的list合集 |
| | | * |
| | | * @param key 缓存key |
| | | * @param start 开始位置 |
| | | * @param end 结束位置 |
| | | * @return |
| | | */ |
| | | public boolean trimList(String key, long start, long end) { |
| | | log.debug(" trimList key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForList().trim(key, start, end); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 取出list合集中指定位置的对象 |
| | | * |
| | | * @param key 缓存key |
| | | * @param index 索引位置 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 |
| | | * @return Object list指定索引位置的对象 |
| | | */ |
| | | public Object getIndexList(String key, long index) { |
| | | log.debug(" getIndexList key :{}, index:{}", key, index); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return redisTemplate.opsForList().index(key, index); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取list缓存的长度 |
| | | * |
| | | * @param key 键 |
| | | * @return |
| | | */ |
| | | public long getListSize(String key) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.opsForList().size(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | return 0L; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据索引修改list中的某条数据 |
| | | * |
| | | * @param key 键 |
| | | * @param index 索引 |
| | | * @param value 值 |
| | | * @return |
| | | */ |
| | | public boolean updateIndexList(String key, long index, Object value) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForList().set(key, index, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 移除N个值为value |
| | | * |
| | | * @param key 键 |
| | | * @param count 移除多少个 |
| | | * @param value 值 |
| | | * @return 移除的个数 |
| | | */ |
| | | public long removeList(String key, long count, Object value) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | Long remove = redisTemplate.opsForList().remove(key, count, value); |
| | | return remove; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | return 0L; |
| | | } |
| | | } |
| | | |
| | | |
| | | /* Set 相关 */ |
| | | |
| | | /** |
| | | * * set集合存入缓存 |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param set 缓存set集合 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean setSet(String key, Set<T> set) { |
| | | log.debug(" setSet key :{}, value:{}", key, set); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(set)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForSet().add(key, set.toArray()); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * set集合中增加value |
| | | * |
| | | * @param key 缓存key |
| | | * @param value 增加的value |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean addSet(String key, Object value) { |
| | | log.debug(" addSet key :{}, value:{}", key, value); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForSet().add(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 将数据放入set缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param values 值 可以是多个 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean addSet(String key, Object... values) { |
| | | try { |
| | | if (isEmpty(key) || isEmpty(values)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForSet().add(key, values); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * set集合存入缓存 |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @param set 缓存set集合 |
| | | * @param seconds 秒数 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public <T> boolean setSet(String key, Set<T> set, long seconds) { |
| | | log.debug(" setSet key :{}, value:{}, seconds:{}", key, set, seconds); |
| | | try { |
| | | if (seconds > 0) { |
| | | if (setSet(key, set)) { |
| | | redisTemplate.expire(key, seconds, TimeUnit.SECONDS); |
| | | } else { |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 取出缓存中对应的set合集 |
| | | * |
| | | * @param <T> |
| | | * @param key 缓存key |
| | | * @return Set<Object> |
| | | * 缓存中的set合集 |
| | | */ |
| | | public <T> Set<T> getSet(String key) { |
| | | log.debug(" getSet key :{}", key); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return null; |
| | | } |
| | | return (Set<T>) redisTemplate.opsForSet().members(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return null; |
| | | } |
| | | public void removeSetMember(String key, Long member) { |
| | | redisTemplate.opsForSet().remove(key, member); |
| | | } |
| | | |
| | | /** |
| | | * * 有序集合存入数值 |
| | | * |
| | | * @param key 缓存key |
| | | * @param value 缓存value |
| | | * @param score 评分 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean addZSet(String key, Object value, double score) { |
| | | log.debug(" addZSet key :{},value:{}, score:{}", key, value, score); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | return redisTemplate.opsForZSet().add(key, value, score); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 从有序集合中删除指定值 |
| | | * |
| | | * @param key 缓存key |
| | | * @param value 缓存value |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean removeZSet(String key, Object value) { |
| | | log.debug(" removeZSet key :{},value:{}", key, value); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForZSet().remove(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public boolean removeFromSet(String key, Object value) { |
| | | log.debug("removeZSet key: {}, value: {}", key, value); |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | Long removedCount = redisTemplate.opsForZSet().remove(key, value); |
| | | if (removedCount != null && removedCount > 0) { |
| | | log.debug("Successfully removed value {} from ZSet {}", value, key); |
| | | return true; |
| | | } else { |
| | | log.debug("Value {} not found in ZSet {}", value, key); |
| | | return false; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("Error removing value {} from ZSet {}: {}", value, key, e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * * 从有序集合中删除指定位置的值 |
| | | * |
| | | * @param key 缓存key |
| | | * @param start 起始位置 |
| | | * @param end 结束为止 |
| | | * @return true:成功 * false:失败 |
| | | */ |
| | | public boolean removeZSet(String key, long start, long end) { |
| | | log.debug(" removeZSet key :{},start:{}, end:{}", key, start, end); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return false; |
| | | } |
| | | redisTemplate.opsForZSet().removeRange(key, start, end); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 移除值为value的 |
| | | * |
| | | * @param key 键 |
| | | * @param values 值 可以是多个 |
| | | * @return 移除的个数 |
| | | */ |
| | | public long setRemove(String key, Object... values) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | Long count = redisTemplate.opsForSet().remove(key, values); |
| | | return count; |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | /** |
| | | * * 从有序集合中获取指定位置的值 |
| | | * |
| | | * @param key 缓存key |
| | | * @param start 起始位置 |
| | | * @param end 结束为止 |
| | | * @return Set<Object> |
| | | * 缓存中的set合集 |
| | | */ |
| | | public <T> Set<T> getZSet(String key, long start, long end) { |
| | | log.debug(" getZSet key :{},start:{}, end:{}", key, start, end); |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return Collections.emptySet(); |
| | | } |
| | | return (Set<T>) redisTemplate.opsForZSet().range(key, start, end); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据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 hasKeySet(String key, Object value) { |
| | | try { |
| | | if (isEmpty(key) || isEmpty(value)) { |
| | | return false; |
| | | } |
| | | return redisTemplate.opsForSet().isMember(key, value); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取set缓存的长度 |
| | | * |
| | | * @param key 键 |
| | | * @return |
| | | */ |
| | | public long getSetSize(String key) { |
| | | try { |
| | | if (isEmpty(key)) { |
| | | return 0L; |
| | | } |
| | | return redisTemplate.opsForSet().size(key); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断是否为空 |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | private boolean isEmpty(Object obj) { |
| | | if (Objects.isNull(obj)) { |
| | | return true; |
| | | } |
| | | if (obj instanceof String) { |
| | | String str = obj.toString(); |
| | | if ("".equals(str.trim())) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof List) { |
| | | List<Object> list = (List<Object>) obj; |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof Map) { |
| | | Map map = (Map) obj; |
| | | if (map.isEmpty()) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof Set) { |
| | | Set set = (Set) obj; |
| | | if (CollectionUtils.isEmpty(set)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof Object[]) { |
| | | Object[] objs = (Object[]) obj; |
| | | if (objs.length <= 0) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /* Set lock */ |
| | | |
| | | /** |
| | | * 加锁 |
| | | * 参考:https://blog.csdn.net/qq_37892957/article/details/89322334 |
| | | * |
| | | * @param key seckillId |
| | | * @param value 当前时间+超时时间 |
| | | * @return |
| | | */ |
| | | public boolean lock(String key, String value) { |
| | | // 可以设置返回true |
| | | Boolean isLock = redisTemplate.opsForValue().setIfAbsent(key, value); |
| | | if (isLock) { |
| | | return true; |
| | | } |
| | | String currentValue = (String) redisTemplate.opsForValue().get(key); |
| | | // 如果锁已经过期 |
| | | if (StringUtils.hasLength(currentValue) |
| | | && Long.valueOf(currentValue) < System.currentTimeMillis()) { |
| | | // 获取上一个锁的时间,并设置新锁的时间 |
| | | // 获取上一个锁的时间 如果高并发的情况可能会出现已经被修改的问题 所以多一次判断保证线程的安全 |
| | | String oldValue = (String) redisTemplate.opsForValue().getAndSet(key, value); |
| | | if (StringUtils.hasLength(oldValue) |
| | | && oldValue.equals(currentValue)) { |
| | | log.info("锁过期并返回true"); |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 解锁 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public void unlock(String key, String value) { |
| | | try { |
| | | String currentValue = (String) redisTemplate.opsForValue().get(key); |
| | | if (StringUtils.hasLength(currentValue) |
| | | && currentValue.equals(value)) { |
| | | redisTemplate.opsForValue().getOperations().delete(key); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("redis分布式锁,解锁异常, {}", e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.common.security; |
| | | |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | |
| | | /** |
| | | * 权限封装 |
| | | * |
| | | * @author Louis |
| | | * @date Jun 29, 2019 |
| | | */ |
| | | public class GrantedAuthorityImpl implements GrantedAuthority { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String authority; |
| | | |
| | | public GrantedAuthorityImpl(String authority) { |
| | | this.authority = authority; |
| | | } |
| | | |
| | | @Override |
| | | public String getAuthority() { |
| | | return this.authority; |
| | | } |
| | | |
| | | public void setAuthority(String authority) { |
| | | this.authority = authority; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security; |
| | | |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import com.jilongda.common.exception.TokenException; |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | import io.jsonwebtoken.*; |
| | | import io.jsonwebtoken.impl.DefaultClaims; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.util.Base64Utils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.Serializable; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * JWT工具类 |
| | | * |
| | | * @author Louis |
| | | * @date Jun 29, 2019 |
| | | */ |
| | | @Slf4j |
| | | public class JwtTokenUtils implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * 用户名称 |
| | | */ |
| | | private static final String USERNAME = Claims.SUBJECT; |
| | | |
| | | /** |
| | | * 环境信息 |
| | | */ |
| | | private static final String ENV = "env"; |
| | | |
| | | /** |
| | | * 用户主体信息 |
| | | */ |
| | | private static final String USERID = "userId"; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private static final String CREATED = "created"; |
| | | /** |
| | | * 权限列表 |
| | | */ |
| | | private static final String AUTHORITIES = "authorities"; |
| | | |
| | | /** |
| | | * JWT Token 签发机构 |
| | | */ |
| | | private static final String ISSUING_AGENCY = "Lingser Technology ISSUER"; |
| | | /** |
| | | * JWT Token 默认的密钥 |
| | | */ |
| | | private static final String SIGNING_KEY = "Lingser Technology SIGNING_KEY"; |
| | | private static final long serialVersionUID = -576504484244573039L; |
| | | |
| | | /** |
| | | * 从数据声明生成令牌 |
| | | * |
| | | * @param payload 载荷 |
| | | * @param tokenExpireTime |
| | | * @return |
| | | */ |
| | | private static String generateToken(Map<String, Object> payload, long tokenExpireTime) { |
| | | // token存在时间 |
| | | Date expirationDate = new Date(System.currentTimeMillis() + tokenExpireTime * 1000L); |
| | | Claims claims = new DefaultClaims(); |
| | | // 签发机构 |
| | | claims.setIssuer(ISSUING_AGENCY); |
| | | // 载荷 |
| | | claims.putAll(payload); |
| | | // |
| | | String token = Jwts.builder() |
| | | .setClaims(claims) |
| | | .setExpiration(expirationDate) |
| | | .signWith(SignatureAlgorithm.HS512, SIGNING_KEY) |
| | | .compact(); |
| | | return token; |
| | | } |
| | | |
| | | /** |
| | | * 生成token |
| | | * |
| | | * @param userName |
| | | * @param tokenExpireTime |
| | | * @return |
| | | */ |
| | | public static String generateToken(String userName, long tokenExpireTime) { |
| | | Map<String, Object> payload = new HashMap<>(2); |
| | | payload.put(USERNAME, userName); |
| | | payload.put(CREATED, new Date()); |
| | | return generateToken(payload, tokenExpireTime); |
| | | } |
| | | |
| | | /** |
| | | * 主要用于token不需要托管,但有多个场景的情况 |
| | | * 生成token |
| | | * |
| | | * @param userName |
| | | * @param evn |
| | | * @param tokenExpireTime |
| | | * @return |
| | | */ |
| | | public static String generateToken(String userName, String evn, long tokenExpireTime) { |
| | | Map<String, Object> payload = new HashMap<>(3); |
| | | payload.put(USERNAME, userName); |
| | | payload.put(ENV, evn); |
| | | payload.put(CREATED, new Date()); |
| | | return generateToken(payload, tokenExpireTime); |
| | | } |
| | | |
| | | /** |
| | | * 从令牌中获取用户名 |
| | | * |
| | | * @param token 令牌 |
| | | * @return 用户名 |
| | | */ |
| | | public static String getUsername(String token) { |
| | | Claims claims = getClaimsFromToken(token); |
| | | return claims.getSubject(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据请求令牌获取登录认证信息 |
| | | * |
| | | * @param token |
| | | * @return |
| | | */ |
| | | public static Authentication getAuthenticatione(String token) { |
| | | Authentication authentication = getAuthentication(); |
| | | if (StringUtils.hasLength(token)) { |
| | | // 上下文认证为空 |
| | | if (Objects.isNull(authentication)) { |
| | | // 上下文中Authentication为空 |
| | | Claims claims = getClaimsFromToken(token); |
| | | if (Objects.isNull(claims)) { |
| | | throw new ServiceException("从令牌中获取数据声明失败"); |
| | | } |
| | | String username = claims.getSubject(); |
| | | Object userDetails = claims.get(USERID); |
| | | if (!StringUtils.hasLength(username)) { |
| | | throw new ServiceException("获取用户名失败"); |
| | | } |
| | | // 如果需要手动续期,此项判断需要注释 |
| | | if (isTokenExpired(token)) { |
| | | throw new TokenException(GlobalResultEnum.TOKEN_EXPIRE.getCode(),GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } |
| | | List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); |
| | | authentication = new UsernamePasswordAuthenticationToken(username, userDetails, authorities); |
| | | } else { |
| | | if (validateToken(token, getUsername())) { |
| | | // 如果上下文中Authentication非空,且请求令牌合法,直接返回当前登录认证信息 |
| | | authentication = getAuthentication(); |
| | | } |
| | | } |
| | | } |
| | | return authentication; |
| | | } |
| | | |
| | | /** |
| | | * 从令牌中获取数据声明 |
| | | * 解析JWT Token |
| | | * |
| | | * @param token 令牌 |
| | | * @return 数据声明 |
| | | */ |
| | | public static Claims getClaimsFromToken(String token) { |
| | | try { |
| | | // 传入令牌,判断accessToken是否存在 |
| | | Claims claims = Jwts.parser().setSigningKey(SIGNING_KEY).parseClaimsJws(token).getBody(); |
| | | return claims; |
| | | } catch (ExpiredJwtException e) { |
| | | log.error("Token 已过期"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_EXPIRE.getCode(),GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } catch (UnsupportedJwtException e) { |
| | | log.error("不支持的 Token"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_PARSE_ERROR); |
| | | } catch (MalformedJwtException e) { |
| | | log.error("Token 无效"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_PARSE_ERROR); |
| | | } catch (SignatureException e) { |
| | | log.error("无效的 Token 签名"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_PARSE_ERROR); |
| | | } catch (IllegalArgumentException e) { |
| | | log.error("Token 参数不存在"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_PARSE_ERROR); |
| | | } catch (TokenException e) { |
| | | log.error("Token 已过期"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_EXPIRE.getCode(),GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } catch (Exception e) { |
| | | log.error("token 解析失败,请尝试重新登录"); |
| | | throw new TokenException(GlobalResultEnum.TOKEN_PARSE_ERROR); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 验证令牌 |
| | | * |
| | | * @param token |
| | | * @param username |
| | | * @return |
| | | */ |
| | | public static Boolean validateToken(String token, String username) { |
| | | String userName = getUsername(token); |
| | | if (!StringUtils.hasLength(userName)) { |
| | | throw new IllegalArgumentException("请求令牌无效"); |
| | | } |
| | | return (userName.equals(username) && !isTokenExpired(token)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 刷新令牌,重新生成 |
| | | * |
| | | * @param token |
| | | * @return |
| | | */ |
| | | public static String refreshToken(String token, long tokenExpireTime) { |
| | | String refreshedToken; |
| | | try { |
| | | Claims claims = getClaimsFromToken(token); |
| | | String userName = claims.getSubject(); |
| | | refreshedToken = generateToken(userName, tokenExpireTime); |
| | | } catch (Exception e) { |
| | | throw new SecurityException("刷新令牌出错!"); |
| | | } |
| | | return refreshedToken; |
| | | } |
| | | |
| | | /** |
| | | * 刷新令牌,重新生成 |
| | | * |
| | | * @param token |
| | | * @param env |
| | | * @param tokenExpireTime |
| | | * @return |
| | | */ |
| | | public static String refreshToken(String token, String env, long tokenExpireTime) { |
| | | String refreshedToken; |
| | | try { |
| | | Claims claims = getClaimsFromToken(token); |
| | | String userName = claims.getSubject(); |
| | | refreshedToken = generateToken(userName, env, tokenExpireTime); |
| | | } catch (Exception e) { |
| | | throw new SecurityException("刷新令牌出错!"); |
| | | } |
| | | return refreshedToken; |
| | | } |
| | | |
| | | /** |
| | | * 判断令牌是否过期 |
| | | * |
| | | * @param token 令牌 |
| | | * @return 是否过期 |
| | | */ |
| | | public static Boolean isTokenExpired(String token) { |
| | | try { |
| | | Claims claims = getClaimsFromToken(token); |
| | | Date expiration = claims.getExpiration(); |
| | | return expiration.before(new Date()); |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取请求token |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(Constant.DEF_TOKEN_HEADER); |
| | | String asToken = request.getHeader(Constant.ALIAS_TOKEN_HEADER); |
| | | // 如果这两个头部信息均不存在 |
| | | if (!StringUtils.hasLength(token) && !StringUtils.hasLength(asToken)) { |
| | | throw new ServiceException("资源未认证,访问受限"); |
| | | } |
| | | // token转换 |
| | | if (!StringUtils.hasLength(token)) { |
| | | token = asToken; |
| | | } |
| | | String tokenHead = "Bearer "; |
| | | if (token.contains(tokenHead)) { |
| | | token = token.substring(tokenHead.length()); |
| | | } |
| | | if (!StringUtils.hasLength(token)) { |
| | | throw new ServiceException("访问令牌不能为空"); |
| | | } |
| | | // base64 解码 |
| | | try { |
| | | token = new String(Base64Utils.decode(token.getBytes())); |
| | | } catch (IllegalArgumentException e) { |
| | | throw new IllegalArgumentException("无效的令牌"); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取当前用户名 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getUsername() { |
| | | String username = null; |
| | | Authentication authentication = getAuthentication(); |
| | | if (Objects.nonNull(authentication)) { |
| | | Object principal = authentication.getPrincipal(); |
| | | if (Objects.nonNull(principal)) { |
| | | username = (String) principal; |
| | | } |
| | | } |
| | | return username; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取当前用户信息id |
| | | * |
| | | * @return |
| | | */ |
| | | public static Object getUserInfo() { |
| | | Object userInfo = null; |
| | | Authentication authentication = getAuthentication(); |
| | | if (Objects.nonNull(authentication)) { |
| | | userInfo = authentication.getDetails(); |
| | | } |
| | | return userInfo; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户名 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getUsername(Authentication authentication) { |
| | | String username = null; |
| | | if (Objects.nonNull(authentication)) { |
| | | Object principal = authentication.getPrincipal(); |
| | | if (Objects.nonNull(principal) && principal instanceof UserDetails) { |
| | | username = (String) principal; |
| | | } |
| | | } |
| | | return username; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录信息 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Authentication getAuthentication() { |
| | | if (Objects.isNull(SecurityContextHolder.getContext())) { |
| | | return null; |
| | | } |
| | | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| | | return authentication; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.jilongda.common.dto.RefAccessTokenDTO; |
| | | import com.jilongda.common.basic.Constant; |
| | | import com.jilongda.common.cache.CaffineCache; |
| | | import com.jilongda.common.exception.TokenException; |
| | | import com.jilongda.common.model.TUser; |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | import com.jilongda.common.utils.JsonUtils; |
| | | import com.jilongda.common.utils.WebUtils; |
| | | import io.jsonwebtoken.Claims; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; |
| | | import org.springframework.util.Base64Utils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * Security相关操作 |
| | | * |
| | | * @author xiaochen |
| | | * @date Jun 29, 2019 |
| | | */ |
| | | @Slf4j |
| | | public class SecurityUtils { |
| | | /** |
| | | * 有效期,以秒为单位 |
| | | */ |
| | | private static final long TOKEN_EXPIRE_TIME = 2 * 60 * 60 * 1000L; |
| | | |
| | | /** |
| | | * 令牌存储 |
| | | */ |
| | | private CaffineCache<String> accessTokenCache; |
| | | |
| | | /** |
| | | * 刷新令牌存储 |
| | | */ |
| | | private CaffineCache<String> refreshAccessTokenCache; |
| | | |
| | | /** |
| | | * token过期时间 |
| | | */ |
| | | private long tokenExpireTime; |
| | | |
| | | |
| | | /** |
| | | * token不需要托管 |
| | | */ |
| | | public SecurityUtils() { |
| | | this(TOKEN_EXPIRE_TIME); |
| | | } |
| | | |
| | | /** |
| | | * token不需要托管 |
| | | * |
| | | * @param tokenExpireTime |
| | | */ |
| | | public SecurityUtils(long tokenExpireTime) { |
| | | this.tokenExpireTime = tokenExpireTime; |
| | | } |
| | | |
| | | /** |
| | | * 数据构造,将token托管 |
| | | * |
| | | * @param accessTokenCache |
| | | * @param refreshAccessTokenCache |
| | | */ |
| | | public SecurityUtils(CaffineCache<String> accessTokenCache, CaffineCache<String> refreshAccessTokenCache) { |
| | | this(TOKEN_EXPIRE_TIME, accessTokenCache, refreshAccessTokenCache); |
| | | } |
| | | |
| | | /** |
| | | * 数据构造,将token托管 |
| | | * |
| | | * @param tokenExpireTime |
| | | * @param accessTokenCache |
| | | * @param refreshAccessTokenCache |
| | | */ |
| | | public SecurityUtils(long tokenExpireTime, CaffineCache<String> accessTokenCache, CaffineCache<String> refreshAccessTokenCache) { |
| | | this.tokenExpireTime = tokenExpireTime; |
| | | this.accessTokenCache = accessTokenCache; |
| | | this.refreshAccessTokenCache = refreshAccessTokenCache; |
| | | } |
| | | |
| | | /** |
| | | * 系统登录认证 |
| | | * |
| | | * @param userName |
| | | * @param obj |
| | | * @param authenticationManager |
| | | * @param clazz |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | /*public <T> Map<String, Object> login(String userName, Object obj, |
| | | AuthenticationManager authenticationManager, Class<?> clazz) { |
| | | UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(userName, obj); |
| | | usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(WebUtils.request())); |
| | | // 执行登录认证过程 |
| | | Authentication authentication = authenticationManager.authenticate(usernamePasswordAuthenticationToken); |
| | | // 认证成功存储认证信息到上下文 |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | // 生成令牌并返回给客户端 |
| | | Map<String, String> tokenInfo = saveToken(userName); |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | log.info("----------------------" + authentication.getDetails().toString()); |
| | | map.put("userInfo", clazz.cast(authentication.getDetails())); |
| | | map.put("tokenInfo", tokenInfo); |
| | | return map; |
| | | }*/ |
| | | |
| | | |
| | | |
| | | /** |
| | | * 系统登录认证 |
| | | * |
| | | * @param userName |
| | | * @param obj |
| | | * @param authenticationManager |
| | | * @param clazz |
| | | * @param flag true 管理后台 false 小程序 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public <T> Map<String, Object> login(String userName, Object obj, |
| | | AuthenticationManager authenticationManager, Class<?> clazz, Integer flag) { |
| | | UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(userName, obj); |
| | | Authentication authentication; |
| | | if (flag == 1) { |
| | | log.info("<<<<<<<<管理后台login开始<<<<<<<<"); |
| | | // usernamePasswordAuthenticationToken.setDetails(obj); |
| | | // usernamePasswordAuthenticationToken.setAuthenticated(false); |
| | | // authentication = usernamePasswordAuthenticationToken; |
| | | |
| | | |
| | | usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(userName, obj); |
| | | usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(WebUtils.request())); |
| | | // 执行登录认证过程 |
| | | authentication = authenticationManager.authenticate(usernamePasswordAuthenticationToken); |
| | | // 手机号存储 |
| | | //usernamePasswordAuthenticationToken.setDetails(userName); |
| | | //usernamePasswordAuthenticationToken.setAuthenticated(false); |
| | | //authentication = usernamePasswordAuthenticationToken; |
| | | }else if (flag == 2) { |
| | | //短信登录 |
| | | usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(WebUtils.request())); |
| | | usernamePasswordAuthenticationToken.setAuthenticated(false); |
| | | authentication = usernamePasswordAuthenticationToken; |
| | | } |
| | | else if (flag == 3) { |
| | | log.info("<<<<<<<<微信小程序login开始<<<<<<<<"); |
| | | usernamePasswordAuthenticationToken.setDetails(obj); |
| | | usernamePasswordAuthenticationToken.setAuthenticated(false); |
| | | authentication = usernamePasswordAuthenticationToken; |
| | | } else { |
| | | usernamePasswordAuthenticationToken.setDetails(obj); |
| | | usernamePasswordAuthenticationToken.setAuthenticated(false); |
| | | authentication = usernamePasswordAuthenticationToken; |
| | | } |
| | | // 认证成功存储认证信息到上下文 |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | // 生成令牌并返回给客户端 |
| | | Map<String, String> tokenInfo = saveToken(userName); |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | if(flag!=2){ |
| | | map.put("userInfo", clazz.cast(authentication.getDetails())); |
| | | } |
| | | map.put("tokenInfo", tokenInfo); |
| | | log.info("用户返回数据:{}", JsonUtils.toJsonString(authentication.getDetails())); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 保存token |
| | | * |
| | | * @param userName |
| | | * @return |
| | | */ |
| | | public Map<String, String> saveToken(String userName) { |
| | | String token = JwtTokenUtils.generateToken(userName, this.tokenExpireTime); |
| | | // 返回token信息 |
| | | String accessToken = new String(Base64Utils.encode(token.getBytes())); |
| | | String refreshToken = UUID.randomUUID().toString(); |
| | | Map<String, String> tokenInfo = new HashMap<>(2); |
| | | // 将token托管 |
| | | if (Objects.nonNull(this.accessTokenCache) && Objects.nonNull(this.refreshAccessTokenCache)) { |
| | | this.accessTokenCache.setKey(Constant.JWT_TOKEN_KEY_PREFIX + userName, accessToken); |
| | | this.refreshAccessTokenCache.setKey(Constant.JWT_REFRESH_TOKEN_KEY_PREFIX + userName, refreshToken); |
| | | } |
| | | tokenInfo.put("accessToken", accessToken); |
| | | tokenInfo.put("refreshToken", refreshToken); |
| | | return tokenInfo; |
| | | } |
| | | |
| | | /** |
| | | * 通过刷新令牌 获取新的 访问令牌 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | public String getAccessTokenByRefreshToken(RefAccessTokenDTO dto) { |
| | | // 判断 refreshToken 是否过期,若也已过期则需重新登录 |
| | | String userName = dto.getAccount(); |
| | | CaffineCache<String> tokenCache; |
| | | if (Objects.nonNull(this.refreshAccessTokenCache)) { |
| | | tokenCache = this.refreshAccessTokenCache; |
| | | } else { |
| | | throw new RuntimeException("未定义刷新令牌的存储"); |
| | | } |
| | | String refreshToken = tokenCache.getKey(Constant.JWT_REFRESH_TOKEN_KEY_PREFIX + userName); |
| | | if (!StringUtils.hasLength(refreshToken)) { |
| | | throw new TokenException(GlobalResultEnum.LOGIN_EXPIRE); |
| | | } |
| | | if (!dto.getRefAccessToken().equals(refreshToken)) { |
| | | throw new TokenException(GlobalResultEnum.LOGIN_EXPIRE); |
| | | } |
| | | // 重新产生新的访问令牌 |
| | | String accessToken = generateAccessTokenByRefreshToken(userName); |
| | | return accessToken; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取令牌进行检查并认证 |
| | | * |
| | | * @param request |
| | | */ |
| | | public void checkAuthentication(HttpServletRequest request) { |
| | | String token = JwtTokenUtils.getToken(request); |
| | | // 获取摘要信息 |
| | | Claims claims = JwtTokenUtils.getClaimsFromToken(token); |
| | | CaffineCache<String> tokenCache = null; |
| | | // 清理托管缓存 |
| | | if (Objects.nonNull(this.accessTokenCache)) { |
| | | tokenCache = this.accessTokenCache; |
| | | } |
| | | // 如果token被托管 |
| | | if (Objects.nonNull(tokenCache)) { |
| | | String accessToken = tokenCache.getKey(Constant.JWT_TOKEN_KEY_PREFIX + claims.getSubject()); |
| | | if (Objects.isNull(accessToken)) { |
| | | throw new TokenException(GlobalResultEnum.TOKEN_EXPIRE.getCode(), GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } |
| | | accessToken = new String(Base64Utils.decode(accessToken.getBytes())); |
| | | if (!token.equals(accessToken)) { |
| | | throw new TokenException(GlobalResultEnum.TOKEN_EXPIRE.getCode(), GlobalResultEnum.TOKEN_EXPIRE.getMessage()); |
| | | } |
| | | } |
| | | // 获取令牌并根据令牌获取登录认证信息 |
| | | Authentication authentication = JwtTokenUtils.getAuthenticatione(token); |
| | | // 设置登录认证信息到上下文 |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | |
| | | |
| | | // Object principal = authentication.getPrincipal(); |
| | | // if (principal instanceof SecurityUserDetails) { |
| | | // SecurityUserDetails userDetails = (SecurityUserDetails) principal; |
| | | // if (userDetails.isFrozen()) { // 假设isFrozen()方法用于检查用户是否被冻结 |
| | | // throw new TokenException(GlobalResultEnum.ACCOUNT_FROZEN.getCode(), GlobalResultEnum.ACCOUNT_FROZEN.getMessage()); |
| | | // } |
| | | // } else { |
| | | // throw new IllegalStateException("Principal is not of type SecurityUserDetails"); |
| | | // } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置JWT令牌过期 |
| | | * 默认不支持手动过期,需要借助缓存托管 |
| | | * |
| | | * @param |
| | | */ |
| | | public boolean invalidateToken(HttpServletRequest request) { |
| | | String accessToken = JwtTokenUtils.getToken(request); |
| | | String userName = JwtTokenUtils.getUsername(accessToken); |
| | | // 从缓存中清除JWT |
| | | // 清理托管缓存 |
| | | if (Objects.nonNull(this.accessTokenCache)) { |
| | | return this.accessTokenCache.delKey(Constant.JWT_TOKEN_KEY_PREFIX + userName); |
| | | } else { |
| | | throw new RuntimeException("退出失败,此模式下无法手动过期"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据刷新令牌重新生成令牌 |
| | | * |
| | | * @param userName 用户 |
| | | * @return |
| | | */ |
| | | public String generateAccessTokenByRefreshToken(String userName) { |
| | | String token = JwtTokenUtils.generateToken(userName, this.tokenExpireTime); |
| | | String accessToken = new String(Base64Utils.encode(token.getBytes())); |
| | | CaffineCache<String> tokenCache = null; |
| | | if (Objects.nonNull(this.refreshAccessTokenCache)) { |
| | | tokenCache = this.refreshAccessTokenCache; |
| | | } |
| | | if (Objects.nonNull(tokenCache)) { |
| | | tokenCache.setKey(Constant.JWT_TOKEN_KEY_PREFIX + userName, accessToken); |
| | | } |
| | | return accessToken; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security.filter; |
| | | |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.security.SecurityUtils; |
| | | import com.jilongda.common.utils.ResponseUtils; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import com.jilongda.common.exception.TokenException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.filter.OncePerRequestFilter; |
| | | |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | |
| | | /** |
| | | * 登录认证检查过滤器 |
| | | * |
| | | * @author xiaochen |
| | | * @date Jun 29, 2020 |
| | | * <p> |
| | | * OncePerRequestFilter是在一次外部请求中只过滤一次。对于服务器内部之间的forward等请求,不会再次执行过滤方法。 |
| | | * <p> |
| | | * 文档参见:https://www.jianshu.com/p/b2aa7dd346a2 |
| | | */ |
| | | @Slf4j |
| | | public class AuthenticationFilter extends OncePerRequestFilter { |
| | | private final SecurityUtils securityUtils; |
| | | |
| | | public AuthenticationFilter(SecurityUtils securityUtils) { |
| | | this.securityUtils = securityUtils; |
| | | } |
| | | |
| | | @Override |
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { |
| | | // 全局异常无法捕捉过滤器异常,需在此处做处理 |
| | | try { |
| | | |
| | | |
| | | |
| | | |
| | | securityUtils.checkAuthentication(request); |
| | | chain.doFilter(request, response); |
| | | } catch (Exception e) { |
| | | // 如果是业务异常,需返回状态码 |
| | | if (e instanceof ServiceException) { |
| | | ServiceException e1 = (ServiceException) e; |
| | | ResponseUtils.renderJson(response, ApiResult.failed(e1.getCode(), e.getMessage())); |
| | | } else if (e instanceof TokenException) { |
| | | TokenException e1 = (TokenException) e; |
| | | ResponseUtils.renderJson(response, ApiResult.failed(e1.getCode(), e.getMessage())); |
| | | } else { |
| | | ResponseUtils.renderJson(response, ApiResult.failed(e.getMessage())); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security.filter; |
| | | |
| | | import com.aliyun.oss.HttpMethod; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.google.common.net.HttpHeaders; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.logging.LoggerFactory; |
| | | |
| | | import javax.servlet.*; |
| | | import javax.servlet.annotation.WebFilter; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.logging.Logger; |
| | | |
| | | @Slf4j |
| | | @WebFilter(urlPatterns = {"/*"}, filterName = "corsFilter") |
| | | public class CorsFilter implements Filter { |
| | | // private static final Logger logger = LoggerFactory.getLogger(IsvSearchController.class); |
| | | |
| | | private String allowOrigin = "http://***.**.com,http://***.**.com:8080,http://***.**.com"; |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | // logger.info("doFilter start ..."); |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | if (StringUtils.isNotEmpty(allowOrigin)) { |
| | | List<String> allowOriginList = Arrays.asList(allowOrigin.split(",")); |
| | | if (!CollectionUtils.isEmpty(allowOriginList)) { |
| | | String currentOrigin = request.getHeader("Origin"); |
| | | if (allowOriginList.contains(currentOrigin)) { |
| | | response.setHeader("Access-Control-Allow-Origin", currentOrigin); |
| | | } |
| | | } |
| | | } |
| | | response.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | response.setHeader("Access-Control-Allow-Headers", "content-Type"); |
| | | if (HttpMethod.OPTIONS.name().equalsIgnoreCase(request.getMethod()) &&/*options 请求返回允许跨域的头*/ |
| | | request.getHeader(HttpHeaders.ORIGIN) != null) { |
| | | // logger.info("doFilter options request"); |
| | | return; |
| | | } |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security.filter; |
| | | |
| | | import org.apache.commons.lang3.StringEscapeUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | |
| | | /** |
| | | * @author yu 2019/1/20. |
| | | */ |
| | | public class XssAndSqlHttpServletRequestWrapper extends HttpServletRequestWrapper { |
| | | |
| | | private HttpServletRequest request; |
| | | |
| | | public XssAndSqlHttpServletRequestWrapper(HttpServletRequest request) { |
| | | super(request); |
| | | this.request = request; |
| | | } |
| | | |
| | | @Override |
| | | public String getParameter(String name) { |
| | | String value = request.getParameter(name); |
| | | if (!StringUtils.isEmpty(value)) { |
| | | value = StringEscapeUtils.escapeHtml4(value); |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public String[] getParameterValues(String name) { |
| | | String[] parameterValues = super.getParameterValues(name); |
| | | if (parameterValues == null) { |
| | | return null; |
| | | } |
| | | for (int i = 0; i < parameterValues.length; i++) { |
| | | String value = parameterValues[i]; |
| | | parameterValues[i] = StringEscapeUtils.escapeHtml4(value); |
| | | } |
| | | return parameterValues; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security.filter; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.module.SimpleModule; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
| | | |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author yu 2019/1/20. |
| | | */ |
| | | public class XssFilter implements Filter { |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException { |
| | | HttpServletRequest req = (HttpServletRequest) request; |
| | | XssAndSqlHttpServletRequestWrapper xssRequestWrapper = new XssAndSqlHttpServletRequestWrapper(req); |
| | | |
| | | |
| | | chain.doFilter(xssRequestWrapper, response); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 过滤json类型的 |
| | | * |
| | | * @param builder |
| | | * @return |
| | | */ |
| | | @Bean |
| | | @Primary |
| | | public ObjectMapper xssObjectMapper(Jackson2ObjectMapperBuilder builder) { |
| | | //解析器 |
| | | ObjectMapper objectMapper = builder.createXmlMapper(false).build(); |
| | | //注册xss解析器 |
| | | SimpleModule xssModule = new SimpleModule("XssStringJsonSerializer"); |
| | | xssModule.addSerializer(new XssStringJsonSerializer()); |
| | | objectMapper.registerModule(xssModule); |
| | | //返回 |
| | | return objectMapper; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security.filter; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.databind.JsonSerializer; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | import org.apache.commons.lang3.StringEscapeUtils; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author yu 2019/1/20. |
| | | */ |
| | | public class XssStringJsonSerializer extends JsonSerializer<String> { |
| | | |
| | | @Override |
| | | public Class<String> handledType() { |
| | | return String.class; |
| | | } |
| | | |
| | | @Override |
| | | public void serialize(String value, JsonGenerator jsonGenerator, |
| | | SerializerProvider serializerProvider) throws IOException { |
| | | if (value != null) { |
| | | String encodedValue = StringEscapeUtils.escapeHtml4(value); |
| | | jsonGenerator.writeString(encodedValue); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.security.hadler; |
| | | |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.utils.ResponseUtils; |
| | | import com.jilongda.common.swagger.GlobalResultEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.web.AuthenticationEntryPoint; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * 未授权用户访问无权限时的处理 |
| | | * |
| | | * @author lirong |
| | | * @date 2019-8-8 17:37:27 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class SecurityAuthenticationEntryPoint implements AuthenticationEntryPoint { |
| | | |
| | | @Override |
| | | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) { |
| | | ResponseUtils.renderJson(response, ApiResult.failed(GlobalResultEnum.UNAUTHORIZED.getCode(), GlobalResultEnum.UNAUTHORIZED.getMessage())); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.swagger; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName: ResultCode |
| | | * @Description: 返回的状态码 |
| | | * @date 2021-12-03 9:26 |
| | | */ |
| | | |
| | | public enum GlobalResultEnum { |
| | | |
| | | /** |
| | | * HTTP接口通信相关 |
| | | */ |
| | | FAIL(500, "操作失败"), |
| | | |
| | | SUCCESS(200, "操作成功"), |
| | | |
| | | /** |
| | | * 账号相关 |
| | | */ |
| | | USER_NOT_EXIST(100, "该用户不存在"), |
| | | |
| | | PHONE_UNLIKE_BIND(101, "手机号非当前用户绑定手机"), |
| | | |
| | | TWICE_PASSWORD_DISAGREED(102, "两次输入密码不一致"), |
| | | |
| | | ACCOUNT_DISABLED(103, "账号已被禁用"), |
| | | |
| | | UPDATE_INIT_PWD(104, "请修改初始密码"), |
| | | |
| | | USER_PASS_ERRO(105, "账户或密码错误"), |
| | | |
| | | /** |
| | | * 资源相关 |
| | | */ |
| | | NOT_FOUND(404, "找不到资源"), |
| | | |
| | | FORBIDDEN(403, "没有访问权限"), |
| | | |
| | | UNAUTHORIZED(401, "未认证,请登录后操作"), |
| | | |
| | | FAIL_AUTHORIZED(405, "认证失败"), |
| | | |
| | | /** |
| | | * 应用相关 |
| | | */ |
| | | ERROR(505, "服务器内部错误"), |
| | | |
| | | APPLY_STOP(502, "应用已停止运行"), |
| | | |
| | | |
| | | /** |
| | | * 会话相关 |
| | | */ |
| | | TOKEN_EXPIRE(401, "请重新登录"), |
| | | TOKEN_PARSE_ERROR(601, "令牌解析错误,请检查令牌是否正确"), |
| | | REF_TOKEN_EXPIRE(602, "刷新令牌过期或无效,请重新登录"), |
| | | LOGIN_EXPIRE(603, "登陆过期,请重新登录"); |
| | | |
| | | |
| | | public int code; |
| | | |
| | | public String message; |
| | | |
| | | GlobalResultEnum(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.swagger; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.reflect.FieldUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Profile; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.ReflectionUtils; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistration; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | import springfox.documentation.builders.*; |
| | | import springfox.documentation.oas.annotations.EnableOpenApi; |
| | | import springfox.documentation.service.*; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * swagger3 的spring-boot启动器 |
| | | * |
| | | * @author ck |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(name = "web.swagger.enabled") |
| | | @EnableConfigurationProperties(SwaggerProperties.class) |
| | | @EnableOpenApi |
| | | @ConditionalOnClass(Docket.class) |
| | | @Profile({"dev", "test","prod"}) |
| | | public class SwaggerAutoConfiguration implements WebMvcConfigurer { |
| | | |
| | | private final SwaggerProperties swaggerProperties; |
| | | |
| | | @Autowired |
| | | public SwaggerAutoConfiguration(SwaggerProperties swaggerProperties) { |
| | | this.swaggerProperties = swaggerProperties; |
| | | } |
| | | |
| | | /** |
| | | * 文档相关资源路径 |
| | | */ |
| | | public static final String[] DOC_LIST = |
| | | {"/js/**", |
| | | "/css/**", |
| | | "/static/**", |
| | | "/webass/**", |
| | | "/iconfont/**", |
| | | "/RFIDR/**", |
| | | "/tinymce/**", |
| | | "/img/**", |
| | | "/images/**", |
| | | "/fonts/**","/index.html", |
| | | "/favicon.ico", "/v3/**", "/v2/**", |
| | | "/error", "/swagger**/**", "/configuration/ui", |
| | | "/configuration/security", "/webjars/**", "/doc**/**" |
| | | ,"/swagger-resources/**", "/swagger-ui.html/**" |
| | | }; |
| | | |
| | | /** |
| | | * 支持的通讯协议集合 |
| | | * |
| | | * @return |
| | | */ |
| | | private Set<String> protocols() { |
| | | Set<String> set = new HashSet<>(); |
| | | set.add("https"); |
| | | set.add("http"); |
| | | return set; |
| | | } |
| | | |
| | | /** |
| | | * 响应状态集合 |
| | | * |
| | | * @return |
| | | */ |
| | | private List<Response> responseList() { |
| | | List<Response> responseList = new ArrayList<>(); |
| | | Arrays.stream(GlobalResultEnum.values()).forEach(errorEnum -> { |
| | | responseList.add( |
| | | new ResponseBuilder().code(String.valueOf(errorEnum.getCode())).description(errorEnum.getMessage()).build() |
| | | ); |
| | | }); |
| | | return responseList; |
| | | } |
| | | |
| | | /** |
| | | * 设置文档基本信息 |
| | | * |
| | | * @return |
| | | */ |
| | | private ApiInfo apiInfo(SwaggerProperties.Contact contact) { |
| | | SwaggerProperties.Contact cont = Objects.isNull(contact) ? swaggerProperties.getContact() : contact; |
| | | return new ApiInfoBuilder() |
| | | .title(swaggerProperties.getTitle()) |
| | | .description(swaggerProperties.getDescription()) |
| | | .termsOfServiceUrl(swaggerProperties.getServiceUrl()) |
| | | .contact(new Contact(cont.getName(), cont.getUrl(), cont.getEmail())) |
| | | .version(swaggerProperties.getVersion()) |
| | | .license(swaggerProperties.getLicense()) |
| | | .licenseUrl(swaggerProperties.getLicenseUrl()) |
| | | .build(); |
| | | } |
| | | |
| | | /** |
| | | * 生成全局头部通用参数 |
| | | * |
| | | * @return |
| | | */ |
| | | private List<RequestParameter> setFixedParameter(List<SwaggerProperties.ReqFixedParameter> reqFixedParameters) { |
| | | List<RequestParameter> parameters = new ArrayList<>(); |
| | | List<SwaggerProperties.ReqFixedParameter> fixedParameters = CollectionUtils.isEmpty(reqFixedParameters) ? swaggerProperties.getReqFixedParameters() : reqFixedParameters; |
| | | for (SwaggerProperties.ReqFixedParameter reqFixedParameter : fixedParameters) { |
| | | parameters.add(new RequestParameterBuilder() |
| | | .name(reqFixedParameter.getParamKey()) |
| | | .description(reqFixedParameter.getDescription()) |
| | | .required(reqFixedParameter.isRequired()) |
| | | .in(ParameterType.HEADER) |
| | | .build()); |
| | | } |
| | | return parameters; |
| | | } |
| | | |
| | | /** |
| | | * 默认分组 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | @ConditionalOnMissingBean |
| | | public Docket docket() { |
| | | return new Docket(DocumentationType.OAS_30) |
| | | .enable(swaggerProperties.isEnabled()) |
| | | .groupName("全部") |
| | | .globalResponses(HttpMethod.GET, responseList()) |
| | | .globalResponses(HttpMethod.POST, responseList()) |
| | | .globalResponses(HttpMethod.PUT, responseList()) |
| | | .globalResponses(HttpMethod.DELETE, responseList()) |
| | | .apiInfo(apiInfo(swaggerProperties.getContact())) |
| | | .select() |
| | | // 表示任何包 |
| | | // 加了ApiOperation注解的类,才生成接口文档 |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | // 避免使用swagger api的默认basic-error-controller |
| | | // .paths(PathSelectors.regex("(?!/error.*).*")) |
| | | .build() |
| | | // .securitySchemes(securitySchemes()) |
| | | // 支持的通讯协议集合 |
| | | .protocols(protocols()) |
| | | //.securityContexts(securityContexts()) |
| | | .pathMapping(swaggerProperties.getPathMapping()) |
| | | .globalRequestParameters(setFixedParameter(swaggerProperties.getReqFixedParameters())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 接口请求拦截配置 |
| | | * |
| | | * @param registry |
| | | */ |
| | | @Override |
| | | public void addViewControllers(ViewControllerRegistry registry) { |
| | | registry.addRedirectViewController("/swagger", "/swagger-ui/index.html"); |
| | | } |
| | | |
| | | /** |
| | | * 通用拦截器排除swagger设置,所有拦截器都会自动加swagger相关的资源排除信息 |
| | | */ |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | Field registrationsField = FieldUtils.getField(InterceptorRegistry.class, "registrations", true); |
| | | List<InterceptorRegistration> registrations = (List<InterceptorRegistration>) ReflectionUtils.getField(registrationsField, registry); |
| | | if (!CollectionUtils.isEmpty(registrations)) { |
| | | for (InterceptorRegistration interceptorRegistration : registrations) { |
| | | interceptorRegistration |
| | | .excludePathPatterns(DOC_LIST); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.swagger; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.boot.context.properties.NestedConfigurationProperty; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ck |
| | | * @version 1.0 |
| | | * @date 2021-12-03 12:21 |
| | | * swagger2的配置参数 |
| | | * 并设定默认开关,@ConfigurationProperties |
| | | */ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "web.swagger") |
| | | public class SwaggerProperties { |
| | | |
| | | /** |
| | | * 是否启动Swagger2,默认开启 |
| | | */ |
| | | private boolean enabled = true; |
| | | /** |
| | | * Swagger2扫描的包,默认为:com |
| | | */ |
| | | private String basePackage = "com"; |
| | | /** |
| | | * 基础映射路径,默认当前项目根路径 |
| | | */ |
| | | private String pathMapping = "/"; |
| | | /** |
| | | * 标题 |
| | | */ |
| | | private String title="未定义标题"; |
| | | |
| | | /** |
| | | * 描述 |
| | | */ |
| | | private String description; |
| | | /** |
| | | * 服务地址 |
| | | */ |
| | | private String serviceUrl; |
| | | /** |
| | | * 证书 eg: The Apache License, Version 2.0 |
| | | */ |
| | | private String license; |
| | | /** |
| | | * 证书地址 eg: http://www.apache.org/licenses/LICENSE-2.0.html |
| | | */ |
| | | private String licenseUrl; |
| | | /** |
| | | * 联系:默认 |
| | | */ |
| | | @NestedConfigurationProperty |
| | | private Contact contact = new Contact(); |
| | | /** |
| | | * 版本,默认为:1.0.0 |
| | | */ |
| | | private String version = "1.0.0"; |
| | | /** |
| | | * 文档需要填充的固定参数,例如token之类的 |
| | | * 填充示例 |
| | | * web.swagger.reqFixedParameters[0].paramKey=token |
| | | * web.swagger.reqFixedParameters[0].description=description |
| | | * web.swagger.reqFixedParameters[0].required=fasle |
| | | * web.swagger.reqFixedParameters[1].paramKey=token |
| | | * web.swagger.reqFixedParameters[1].description=description |
| | | * web.swagger.reqFixedParameters[1].required=true |
| | | * --------------------- |
| | | */ |
| | | private List<ReqFixedParameter> reqFixedParameters; |
| | | /** |
| | | * 联系内部类===作者信息 |
| | | */ |
| | | @Data |
| | | static class Contact { |
| | | |
| | | /** |
| | | * 联系名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 网址 |
| | | */ |
| | | private String url; |
| | | /** |
| | | * Email地址 |
| | | */ |
| | | private String email; |
| | | } |
| | | |
| | | /** |
| | | * 联系内部类===请求头部固定参数类 |
| | | */ |
| | | @Data |
| | | static class ReqFixedParameter { |
| | | |
| | | /** |
| | | * 参数名 |
| | | */ |
| | | private String paramKey; |
| | | /** |
| | | * 描述 |
| | | */ |
| | | private String description; |
| | | /** |
| | | * 是否必填,默认非必填 |
| | | */ |
| | | private boolean required = false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * @Description 活动订单操作 |
| | | * @Author xiaochen |
| | | * @Date 2021/7/28 10:26 |
| | | */ |
| | | public class CodeGenerateUtils { |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 获取商品编码 |
| | | * 商品编码规则:nanoTime(后5位)*5位随机数(10000~99999) |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateProductCode() { |
| | | long nanoPart = System.nanoTime() % 100000L; |
| | | if (nanoPart < 10000L) { |
| | | nanoPart += 10000L; |
| | | } |
| | | long randomPart = (long) (Math.random() * (90000) + 10000); |
| | | String code = "0" + String.valueOf((new BigDecimal(nanoPart).multiply(new BigDecimal(randomPart)))); |
| | | return code.substring(code.length() - 10); |
| | | } |
| | | |
| | | /** |
| | | * @param id: 用户id |
| | | * @return |
| | | * @Description 生成订单编号 |
| | | * 订单编号规则:(10位):(年末尾*月,取后2位)+(用户ID%3.33*日取整后2位)+(timestamp*10000以内随机数,取后6位) |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateOrderSn(long id) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | year = year % 10; |
| | | if (year == 0) year = 10; |
| | | int month = calendar.get(Calendar.MONTH) + 1; |
| | | int yearMonth = year * month; |
| | | String yearMonthPart = "0" + yearMonth; |
| | | yearMonthPart = yearMonthPart.substring(yearMonthPart.length() - 2); |
| | | |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | int dayNum = (int) ((id % 3.33) * day); |
| | | String dayPart = "0" + dayNum; |
| | | dayPart = dayPart.substring(dayPart.length() - 2); |
| | | |
| | | String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); |
| | | timestampPart = timestampPart.replace(".", "").replace("E", ""); |
| | | timestampPart = timestampPart.substring(0, 6); |
| | | return yearMonthPart + dayPart + timestampPart; |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 生成统一支付单号 规则:年(2)月(2)日(2)时(2)分(2)+timestamp*5位随机整数取后5位 |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateVolumeSn() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); |
| | | String dateTime = dateFormat.format(calendar.getTime()); |
| | | dateTime = dateTime.substring(2); |
| | | String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); |
| | | timestampPart = timestampPart.replace(".", "").replace("E", ""); |
| | | timestampPart = timestampPart.substring(0, 5); |
| | | return dateTime + timestampPart; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | for (long i = 0; i < 20; i++) { |
| | | //String timestampPart = ""+(Math.random() * 10000) * (System.currentTimeMillis()/10000); |
| | | //System.out.println(timestampPart); |
| | | //System.out.println(generateOrderSn(i)); |
| | | long l = System.currentTimeMillis() * Long.valueOf(CodeGenerateUtils.generateProductCode().substring(0, 5)); |
| | | System.out.println(String.valueOf(l).substring(0,10)); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @description id补0生成编号 |
| | | * @author jqs |
| | | * @date 2024/4/17 14:19 |
| | | * @param totalLength |
| | | * @param id |
| | | * @return String |
| | | */ |
| | | public static String toFillZeroCode(int totalLength, Long id) { |
| | | String idStr = id.toString(); |
| | | int length = idStr.length(); |
| | | if(totalLength <= length){ |
| | | return idStr; |
| | | } |
| | | int fillLength = totalLength - length; |
| | | StringBuilder idsbs = new StringBuilder(); |
| | | for (int i = 0; i < fillLength; i++) { |
| | | idsbs.append("0"); |
| | | } |
| | | return idsbs.append(idStr).toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/7/5/00510:16 |
| | | */ |
| | | public class EncodeAndDecodeUtil { |
| | | |
| | | /** |
| | | * @Title: unicodeEncode |
| | | * @Description: unicode编码 将中文字符转换成Unicode字符 |
| | | * @param string |
| | | * @return |
| | | */ |
| | | public static String unicodeEncode(String string) { |
| | | char[] utfBytes = string.toCharArray(); |
| | | String unicodeBytes = ""; |
| | | for (int i = 0; i < utfBytes.length; i++) { |
| | | String hexB = Integer.toHexString(utfBytes[i]); |
| | | if (hexB.length() <= 2) { |
| | | hexB = "00" + hexB; |
| | | } |
| | | unicodeBytes = unicodeBytes + "\\u" + hexB; |
| | | } |
| | | return unicodeBytes; |
| | | } |
| | | |
| | | /** |
| | | * @param string |
| | | * @return 转换之后的内容 |
| | | * @Title: unicodeDecode |
| | | * @Description: unicode解码 将Unicode的编码转换为中文 |
| | | */ |
| | | public static String unicodeDecode(String string) { |
| | | Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))"); |
| | | Matcher matcher = pattern.matcher(string); |
| | | char ch; |
| | | while (matcher.find()) { |
| | | ch = (char) Integer.parseInt(matcher.group(2), 16); |
| | | string = string.replace(matcher.group(1), ch + ""); |
| | | } |
| | | return string; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.Consts; |
| | | import org.apache.http.HttpStatus; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.client.protocol.HttpClientContext; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.apache.http.util.TextUtils; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2021/11/30/03020:51 |
| | | */ |
| | | @Slf4j |
| | | public class HttpClientUtil { |
| | | |
| | | |
| | | public static String post(String strURL, String params, String token) { |
| | | System.out.println(strURL); |
| | | System.out.println(params); |
| | | String result = ""; |
| | | BufferedReader reader = null; |
| | | try { |
| | | URL url = new URL(strURL);// 创建连接 |
| | | HttpURLConnection connection = (HttpURLConnection) url |
| | | .openConnection(); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setUseCaches(false); |
| | | connection.setInstanceFollowRedirects(true); |
| | | connection.setRequestMethod("POST"); // 设置请求方式 |
| | | connection.setRequestProperty("Accept", "application/json"); // 设置接收数据的格式 |
| | | connection.setRequestProperty("Content-Type", "application/json"); // 设置发送数据的格式 |
| | | connection.setRequestProperty("Authorization", token); // 设置token |
| | | connection.connect(); |
| | | if (params != null && !TextUtils.isEmpty(params)) { |
| | | byte[] writebytes = params.getBytes(); |
| | | // 设置文件长度 |
| | | // connection.setRequestProperty("Content-Length", String.valueOf(writebytes.length)); |
| | | OutputStream outwritestream = connection.getOutputStream(); |
| | | outwritestream.write(params.getBytes()); |
| | | outwritestream.flush(); |
| | | outwritestream.close(); |
| | | // Log.d("hlhupload", "doJsonPost: conn"+connection.getResponseCode()); |
| | | } |
| | | if (connection.getResponseCode() == 200) { |
| | | log.info("<<<<<<<<<<<<<请求响应错误信息:{}", connection.getResponseMessage()); |
| | | reader = new BufferedReader( |
| | | new InputStreamReader(connection.getInputStream())); |
| | | result = reader.readLine(); |
| | | log.info("<<<<<<<<<<<<<请求响应:{}", result); |
| | | } else { |
| | | throw new ServiceException(connection.getResponseMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException("http的post请求异常!" + e.getMessage()); |
| | | } finally { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 请求发送执行 |
| | | * |
| | | * @param httpMethd |
| | | * @return |
| | | */ |
| | | /** |
| | | * PSOT JSON方式提交 |
| | | * |
| | | * @param url 请求url |
| | | * @param params json串 |
| | | * @return |
| | | */ |
| | | public static String postFromJson(String url, String params, String token) { |
| | | HttpPost request = new HttpPost(url); |
| | | request.setHeader("Content-type", "application/json"); |
| | | request.setHeader("Accept", "application/json"); |
| | | request.setHeader("Authorization", token); |
| | | RequestConfig requestConfig = RequestConfig.custom() |
| | | .setSocketTimeout(12000) |
| | | .setConnectTimeout(8000) |
| | | .build(); |
| | | request.setConfig(requestConfig); |
| | | StringEntity entity = new StringEntity(params, StandardCharsets.UTF_8); |
| | | entity.setContentType("application/json"); |
| | | request.setEntity(entity); |
| | | CloseableHttpClient httpClient = HttpClients.createDefault(); |
| | | try (CloseableHttpResponse httpResponse = httpClient.execute(request, HttpClientContext.create())) { |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { |
| | | log.error("响应失败 statusCode:{}", statusCode); |
| | | String result = EntityUtils.toString(httpResponse.getEntity(), Consts.UTF_8); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | String message = jsonObject.getString("message"); |
| | | throw new ServiceException(message); |
| | | } else { |
| | | String response = EntityUtils.toString(httpResponse.getEntity(), Consts.UTF_8); |
| | | log.info("响应成功 response {}", response); |
| | | return response; |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.Consts; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.HttpStatus; |
| | | import org.apache.http.client.ClientProtocolException; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | 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.methods.HttpUriRequest; |
| | | import org.apache.http.client.protocol.HttpClientContext; |
| | | import org.apache.http.client.utils.URIBuilder; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | public class HttpUtils { |
| | | |
| | | //请求超时时间 |
| | | private final static Integer TIME_OUT = 8 * 1000; |
| | | //http连接池 |
| | | private static volatile PoolingHttpClientConnectionManager poolingHttpClientConnectionManager; |
| | | //请求配置 |
| | | private static RequestConfig requestConfig; |
| | | |
| | | public static PoolingHttpClientConnectionManager getPoolingHttpClientConnectionManager() { |
| | | if (poolingHttpClientConnectionManager == null) { |
| | | synchronized (HttpUtils.class) { |
| | | if (poolingHttpClientConnectionManager == null) { |
| | | poolingHttpClientConnectionManager = new PoolingHttpClientConnectionManager(); |
| | | //连接池最大连接数 |
| | | poolingHttpClientConnectionManager.setMaxTotal(1024); |
| | | //每个路由最大连接数 |
| | | poolingHttpClientConnectionManager.setDefaultMaxPerRoute(32); |
| | | |
| | | //配置请求的超时设置 |
| | | requestConfig = |
| | | RequestConfig.custom().setConnectionRequestTimeout(TIME_OUT).setConnectTimeout(TIME_OUT).setSocketTimeout(TIME_OUT).build(); |
| | | } |
| | | } |
| | | } |
| | | return poolingHttpClientConnectionManager; |
| | | } |
| | | |
| | | public static CloseableHttpClient getHttpClient() { |
| | | return HttpClients.custom().setConnectionManager(getPoolingHttpClientConnectionManager()).setDefaultRequestConfig(requestConfig).build(); |
| | | } |
| | | |
| | | /** |
| | | * 请求发送执行 |
| | | * |
| | | * @param httpMethd |
| | | * @return |
| | | */ |
| | | public static String registRequest(HttpUriRequest httpMethd) { |
| | | CloseableHttpClient httpClient = getHttpClient(); |
| | | try (CloseableHttpResponse httpResponse = httpClient.execute(httpMethd, HttpClientContext.create())) { |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { |
| | | log.error("响应失败 statusCode {}", statusCode); |
| | | httpMethd.abort(); |
| | | } |
| | | log.debug("响应成功 statusCode {}", statusCode); |
| | | String response = EntityUtils.toString(httpResponse.getEntity(), Consts.UTF_8); |
| | | log.debug("响应成功 response {}", response); |
| | | return response; |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("请求失败", e); |
| | | } |
| | | } |
| | | |
| | | public static List<BasicNameValuePair> toPairs(Map<String, Object> params) { |
| | | List<BasicNameValuePair> pairs = new ArrayList<>(params.size()); |
| | | if (params != null && !params.isEmpty()) { |
| | | pairs = params.entrySet().stream().map(entry -> new BasicNameValuePair(entry.getKey(), |
| | | entry.getValue().toString())).collect(Collectors.toList()); |
| | | } |
| | | return pairs; |
| | | } |
| | | |
| | | /** |
| | | * get url请求 |
| | | * |
| | | * @param url |
| | | * @return |
| | | */ |
| | | public static String get(String url) { |
| | | HttpGet request = new HttpGet(); |
| | | try { |
| | | request.setURI(new URI(url)); |
| | | return registRequest(request); |
| | | } catch (Exception e) { |
| | | log.error("请求失败", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /*** |
| | | * get请求(带参数) |
| | | * @param url |
| | | * @return String |
| | | */ |
| | | public static String getReq(String url, Map<String, String> params) { |
| | | String result = null; |
| | | try { |
| | | URIBuilder uriBuilder = new URIBuilder(url); |
| | | Iterator maplist = params.entrySet().iterator(); |
| | | while (maplist.hasNext()) { |
| | | Map.Entry<String, String> map = (Map.Entry<String, String>) maplist.next(); |
| | | uriBuilder.addParameter(map.getKey(), map.getValue()); |
| | | } |
| | | CloseableHttpClient client = HttpClientBuilder.create().build(); |
| | | HttpGet get = new HttpGet(uriBuilder.build()); |
| | | get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36"); |
| | | HttpResponse response = client.execute(get); |
| | | result = EntityUtils.toString(response.getEntity(), "UTF-8"); |
| | | |
| | | } catch (URISyntaxException e) { |
| | | e.printStackTrace(); |
| | | } catch (ClientProtocolException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * PSOT URL方式提交 |
| | | * |
| | | * @param url 请求url |
| | | * @param params 请求参数 |
| | | * @return |
| | | */ |
| | | public static String postFromUrl(String url, Map<String, Object> params) { |
| | | HttpPost request = new HttpPost(url); |
| | | request.setEntity(new UrlEncodedFormEntity(toPairs(params), Consts.UTF_8)); |
| | | try { |
| | | return registRequest(request); |
| | | } catch (Exception e) { |
| | | log.error("请求失败", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * PSOT JSON方式提交 |
| | | * |
| | | * @param url 请求url |
| | | * @param params json串 |
| | | * @return |
| | | */ |
| | | public static String postFromJson(String url, String params) { |
| | | HttpPost request = new HttpPost(url); |
| | | request.setHeader("Content-type", "application/json"); |
| | | request.setHeader("Accept", "application/json"); |
| | | RequestConfig requestConfig = RequestConfig.custom() |
| | | .setSocketTimeout(8000) |
| | | .setConnectTimeout(6000) |
| | | .build(); |
| | | request.setConfig(requestConfig); |
| | | StringEntity entity = new StringEntity(params, StandardCharsets.UTF_8); |
| | | entity.setContentType("application/json"); |
| | | request.setEntity(entity); |
| | | try { |
| | | return registRequest(request); |
| | | } catch (Exception e) { |
| | | log.error("请求失败", e); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.maxmind.geoip2.DatabaseReader; |
| | | import com.maxmind.geoip2.model.CityResponse; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description 获取IP的地址 |
| | | * @Author xiaochen |
| | | * @Date 2021/12/21 18:00 |
| | | */ |
| | | public class IPAddressUtil { |
| | | |
| | | /** |
| | | * description 地址库查询 |
| | | * |
| | | * @param ip 地址 |
| | | * @return java.lang.String |
| | | * @version 1.0 |
| | | */ |
| | | public static String getRealAddress(String ip) { |
| | | String result = ""; |
| | | try { |
| | | // 加载地址库 |
| | | ClassPathResource resource = new ClassPathResource("GeoLite2-City.mmdb"); |
| | | DatabaseReader reader = new DatabaseReader.Builder(resource.getInputStream()).build(); |
| | | InetAddress inetAddress = InetAddress.getByName(ip); |
| | | CityResponse response = reader.city(inetAddress); |
| | | // 获取所在国家 |
| | | String country = response.getCountry().getNames().get("ja"); |
| | | // 库内获取不到的IP,访问ali的地域查询 |
| | | if (response.getSubdivisions().size() > 0) { |
| | | // 获取所在省份 |
| | | String province = response.getSubdivisions().get(0).getNames().get("zh-CN"); |
| | | // 获取所在城市 |
| | | String city = response.getCity().getNames().get("zh-CN"); |
| | | city = city == null ? "" : city; |
| | | result = country + province + city; |
| | | } else { |
| | | result = getAlibaba(ip); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * description ali地域查询 |
| | | * |
| | | * @param ip ip地址 |
| | | * @return java.lang.String |
| | | * @version 1.0 |
| | | */ |
| | | public static String getAlibaba(String ip) { |
| | | Map map = new HashMap(); |
| | | map.put("ip", ip); |
| | | map.put("accessKey", "alibaba-inc"); |
| | | String result = HttpClientUtil.post("http://ip.taobao.com", JSONObject.toJSONString(map), null); |
| | | Map valueMap = JSONObject.parseObject(result, Map.class); |
| | | |
| | | // 请求成功,解析响应数据 |
| | | if ("query success".equals(valueMap.get("msg"))) { |
| | | Map<String, String> dataMap = (Map<String, String>) valueMap.get("data"); |
| | | String country = dataMap.get("country"); |
| | | String region = dataMap.get("region"); |
| | | String city = dataMap.get("city"); |
| | | return country + region + city; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.jilongda.common.exception.ServiceException; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @version 1.0 |
| | | * @ClassName: IPUtil |
| | | * @Desc: Ip工具类 |
| | | * @date 2021/12/21 |
| | | * @history v1.0 |
| | | */ |
| | | public class IPUtil { |
| | | |
| | | /** |
| | | * 描述:获取IP地址 |
| | | * |
| | | * @param request |
| | | * @return |
| | | * @author xiaochen |
| | | * @date 2021/12/21 |
| | | */ |
| | | public static String getIpAddress(HttpServletRequest request) { |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("HTTP_CLIENT_IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("HTTP_X_FORWARDED_FOR"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | // 如果是多级代理,那么取第一个IP为客户端IP |
| | | if (ip != null && ip.indexOf(",") != -1) { |
| | | ip = ip.substring(0, ip.indexOf(",")).trim(); |
| | | } |
| | | return ip; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 描述:获取IP+[IP所属地址] |
| | | * |
| | | * @param request |
| | | * @return |
| | | * @author huaping hu |
| | | * @date 2016年6月1日下午6:01:09 |
| | | */ |
| | | public static String getIpBelongAddress(HttpServletRequest request) { |
| | | |
| | | String ip = getIpAddress(request); |
| | | String belongIp = getIPbelongAddress(ip); |
| | | |
| | | return ip + belongIp; |
| | | } |
| | | |
| | | /** |
| | | * 描述:获取IP所属地址 |
| | | * |
| | | * @param ip |
| | | * @return |
| | | * @author huaping hu |
| | | * @date 2016年6月1日下午5:59:43 |
| | | */ |
| | | public static String getIPbelongAddress(String ip) { |
| | | |
| | | String ipAddress = "[]"; |
| | | try { |
| | | //淘宝提供的服务地址 |
| | | String context = call("http://ip.taobao.com?ip=" + ip); |
| | | JSONObject fromObject = JSONObject.parseObject(context); |
| | | String code = fromObject.getString("code"); |
| | | if (code.equals("0")) { |
| | | JSONObject jsonObject = fromObject.getJSONObject("data"); |
| | | ipAddress = "[" + jsonObject.get("country") + "/" + jsonObject.get("city") + "]"; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException("获取IP所属地址出错", e); |
| | | } |
| | | return ipAddress; |
| | | } |
| | | |
| | | /** |
| | | * 描述:获取Ip所属地址 |
| | | * |
| | | * @param urlStr |
| | | * @return |
| | | * @author huaping hu |
| | | * @date 2016年6月1日下午5:38:55 |
| | | */ |
| | | public static String call(String urlStr) { |
| | | |
| | | try { |
| | | |
| | | URL url = new URL(urlStr); |
| | | HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); |
| | | |
| | | httpCon.setConnectTimeout(3000); |
| | | httpCon.setDoInput(true); |
| | | httpCon.setRequestMethod("GET"); |
| | | |
| | | int code = httpCon.getResponseCode(); |
| | | |
| | | if (code == 200) { |
| | | return streamConvertToSting(httpCon.getInputStream()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException("获取IP所属地址出错", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 描述:将InputStream转换成String |
| | | * |
| | | * @param is |
| | | * @return |
| | | * @author huaping hu |
| | | * @date 2016年6月1日下午5:51:53 |
| | | */ |
| | | public static String streamConvertToSting(InputStream is) { |
| | | |
| | | String tempStr = ""; |
| | | try { |
| | | |
| | | if (is == null) return null; |
| | | ByteArrayOutputStream arrayOut = new ByteArrayOutputStream(); |
| | | byte[] by = new byte[1024]; |
| | | int len = 0; |
| | | while ((len = is.read(by)) != -1) { |
| | | arrayOut.write(by, 0, len); |
| | | } |
| | | tempStr = new String(arrayOut.toByteArray()); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return tempStr; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户ip地址 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getUserIp() { |
| | | HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); |
| | | //获取IP地址 |
| | | return getIpAddress(request); |
| | | } |
| | | |
| | | public static String getUserLocationByIp() { |
| | | String url = "https://restapi.amap.com/v3/ip"; |
| | | Map<String, String> paramMap = new HashMap<>(); |
| | | paramMap.put("key", "5935f1310fa27e918e99c620f2afb39f"); |
| | | paramMap.put("ip", getUserIp()); |
| | | String result1 = HttpUtils.getReq(url, paramMap); |
| | | JSONObject jsonObject = JSONObject.parseObject(result1); |
| | | IpLocation ipLocation = jsonObject.toJavaObject(IpLocation.class); |
| | | return ipLocation.getProvince() + ipLocation.getCity(); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | String context = call("http://ip.taobao.com/service/getIpInfo.php?ip=120.192.182.1"); |
| | | |
| | | JSONObject fromObject = JSONObject.parseObject(context); |
| | | //JSONObject jsonObject = fromObject.getJSONObject("data"); |
| | | System.out.println(fromObject); |
| | | //System.err.println(jsonObject.get("city")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.Constant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 导出返回信息 |
| | | */ |
| | | @Slf4j |
| | | public class ImportExcelUtil { |
| | | |
| | | /** |
| | | * @param errorLines 错误行数 |
| | | * @param successLines 成功行数 |
| | | * @param errorMessage 错误信息 |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static ApiResult<String> importReturnMsg(int errorLines, int successLines, List<String> errorMessage) throws IOException { |
| | | if (errorLines == 0) { |
| | | return ApiResult.success("共" + successLines + "行数据全部导入成功!"); |
| | | } else { |
| | | JSONObject result = new JSONObject(5); |
| | | int totalCount = successLines + errorLines; |
| | | result.put("totalCount", totalCount); |
| | | result.put("errorCount", errorLines); |
| | | result.put("errorMessage", errorMessage); |
| | | result.put("successCount", successLines); |
| | | result.put("msg", "总上传行数:" + totalCount + ",已导入行数:" + successLines + ",错误行数:" + errorLines); |
| | | return ApiResult.success(JSON.toJSONString(result)); |
| | | } |
| | | } |
| | | |
| | | public static List<String> importDateSave(List<?> list, Class serviceClass, List<String> errorMessage, String errorFlag) { |
| | | IService bean = (IService) SpringContextUtils.getBean(serviceClass); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | try { |
| | | log.info("保存前=================================="); |
| | | boolean save = bean.save(list.get(i)); |
| | | log.info("保存后=================================="); |
| | | if (!save) { |
| | | throw new Exception(errorFlag); |
| | | } |
| | | } catch (Exception e) { |
| | | String message = e.getMessage().toLowerCase(); |
| | | int lineNumber = i + 1; |
| | | // 通过索引名判断出错信息 |
| | | if (message.contains(Constant.PRODUCT_NUMBER_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:商品编号已经存在,忽略导入。"); |
| | | } else if (message.contains(Constant.PHONE_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:人员手机号已经存在,忽略导入。"); |
| | | } else if (message.contains(Constant.SHOP_NUMBER_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:门店编号已经存在,忽略导入。"); |
| | | } else if (message.contains(Constant.SHOP_OWN_NUMBER_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:门店系统生成编号已经存在,忽略导入。"); |
| | | } else { |
| | | errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入"); |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | | return errorMessage; |
| | | } |
| | | |
| | | public static List<String> importUserSave(List<?> list, Class serviceClass, List<String> errorMessage, String errorFlag) { |
| | | IService bean = (IService) SpringContextUtils.getBean(serviceClass); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | try { |
| | | log.info("保存前=================================="); |
| | | boolean save = bean.save(list.get(i)); |
| | | log.info("保存后=================================="); |
| | | if (!save) { |
| | | throw new Exception(errorFlag); |
| | | } |
| | | } catch (Exception e) { |
| | | String message = e.getMessage().toLowerCase(); |
| | | int lineNumber = i + 1; |
| | | // 通过索引名判断出错信息 |
| | | if (message.contains(Constant.PRODUCT_NUMBER_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:商品编号已经存在,忽略导入。"); |
| | | } else if (message.contains(Constant.PHONE_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:人员手机号已经存在,忽略导入。"); |
| | | } else if (message.contains(Constant.SHOP_NUMBER_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:门店编号已经存在,忽略导入。"); |
| | | } else if (message.contains(Constant.SHOP_OWN_NUMBER_UNI)) { |
| | | errorMessage.add("第 " + lineNumber + " 行:门店系统生成编号已经存在,忽略导入。"); |
| | | } else { |
| | | errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入"); |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | | return errorMessage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/9/21/02114:06 |
| | | */ |
| | | @Data |
| | | public class IpLocation { |
| | | String status; |
| | | String info; |
| | | String infocode; |
| | | String province; |
| | | String city; |
| | | String adcode; |
| | | String rectangle; |
| | | |
| | | } |
New file |
| | |
| | | package com.jilongda.common.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.JsonSerializer; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.jilongda.common.config.JacksonConfig; |
| | | import com.jilongda.common.exception.ServerException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * Json转换工具类 |
| | | * 参考:https://blog.csdn.net/weixin_38413579/article/details/82562634 |
| | | * |
| | | * @author madman |
| | | */ |
| | | @Slf4j |
| | | public final class JsonUtils { |
| | | |
| | | private static final ObjectMapper OM = new ObjectMapper(); |
| | | private static final JavaTimeModule timeModule = new JavaTimeModule(); |
| | | |
| | | /** |
| | | * 设置 ObjectMapper |
| | | * |
| | | * @return |
| | | */ |
| | | private static ObjectMapper getObjectMapper() { |
| | | // 序列化 |
| | | timeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer()); |
| | | timeModule.addSerializer(LocalDate.class, new LocalDateSerializer()); |
| | | // 反序列化 |
| | | timeModule.addDeserializer(LocalDateTime.class, |
| | | new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(JacksonConfig.dateTimeFormat))); |
| | | timeModule.addDeserializer(LocalDate.class, |
| | | new LocalDateDeserializer(DateTimeFormatter.ofPattern(JacksonConfig.dateFormat))); |
| | | // 允许对象忽略json中不存在的属性 |
| | | OM.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | OM.registerModule(timeModule); |
| | | return OM; |
| | | } |
| | | |
| | | /** |
| | | * 将对象序列化 |
| | | */ |
| | | public static <T> String toJsonString(T obj) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.writeValueAsString(obj); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("转json字符串失败:{}", obj); |
| | | e.printStackTrace(); |
| | | throw new ServerException("转json字符串失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化对象字符串 |
| | | */ |
| | | public static <T> T parseObject(String json, Class<T> clazz) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, clazz); |
| | | } catch (JsonProcessingException e) { |
| | | throw new ServerException("反序列化对象字符串失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化字符串成为对象 |
| | | */ |
| | | public static <T> T parseObject(String json, TypeReference<T> valueTypeRef) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, valueTypeRef); |
| | | } catch (JsonProcessingException e) { |
| | | throw new ServerException("反序列化字符串成为对象失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换LocalDateTime |
| | | */ |
| | | static class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> { |
| | | @Override |
| | | public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDateTime.format(DateTimeFormatter.ofPattern(JacksonConfig.dateTimeFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换LocalDate |
| | | */ |
| | | static class LocalDateSerializer extends JsonSerializer<LocalDate> { |
| | | @Override |
| | | public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDate.format(DateTimeFormatter.ofPattern(JacksonConfig.dateFormat))); |
| | | } |
| | | } |
| | | |
| | | } |
common/src/main/java/com/jilongda/common/utils/PayMoneyUtil.java
common/src/main/java/com/jilongda/common/utils/ResponseUtils.java
common/src/main/java/com/jilongda/common/utils/SpringContextUtils.java
common/src/main/java/com/jilongda/common/utils/SpringUtils.java
common/src/main/java/com/jilongda/common/utils/TimeUtils.java
common/src/main/java/com/jilongda/common/utils/UUIDUtil.java
common/src/main/java/com/jilongda/common/utils/UserUtil.java
common/src/main/java/com/jilongda/common/utils/WebUtils.java
common/src/main/java/com/jilongda/common/wxPay/certificate/CertificateService.java
common/src/main/java/com/jilongda/common/wxPay/certificate/model/Data.java
common/src/main/java/com/jilongda/common/wxPay/certificate/model/DownloadCertificateResponse.java
common/src/main/java/com/jilongda/common/wxPay/certificate/model/EncryptCertificate.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/AppService.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/AppServiceExtension.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/Amount.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/CloseOrderRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/CloseRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/Detail.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/GoodsDetail.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/PrepayRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/PrepayResponse.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/PrepayWithRequestPaymentResponse.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/QueryOrderByIdRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/SceneInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/SettleInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/app/model/StoreInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/H5Service.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/Amount.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/CloseOrderRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/CloseRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/Detail.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/GoodsDetail.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/H5Info.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/PrepayRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/PrepayResponse.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/QueryOrderByIdRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/SceneInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/SettleInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/h5/model/StoreInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/JsapiService.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/JsapiServiceExtension.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/Amount.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/CloseOrderRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/CloseRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/Detail.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/GoodsDetail.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/Payer.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/PrepayRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/PrepayResponse.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/PrepayWithRequestPaymentResponse.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/QueryOrderByIdRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/SceneInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/SettleInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/jsapi/model/StoreInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/model/PromotionDetail.java
common/src/main/java/com/jilongda/common/wxPay/payments/model/PromotionGoodsDetail.java
common/src/main/java/com/jilongda/common/wxPay/payments/model/Transaction.java
common/src/main/java/com/jilongda/common/wxPay/payments/model/TransactionAmount.java
common/src/main/java/com/jilongda/common/wxPay/payments/model/TransactionPayer.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/NativePayService.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/Amount.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/CloseOrderRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/CloseRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/Detail.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/GoodsDetail.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/PrepayRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/PrepayResponse.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/QueryOrderByIdRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/SceneInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/SettleInfo.java
common/src/main/java/com/jilongda/common/wxPay/payments/nativepay/model/StoreInfo.java
common/src/main/java/com/jilongda/common/wxPay/refund/RefundService.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Account.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Amount.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/AmountReq.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Channel.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/CreateRequest.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/FundsAccount.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/FundsFromItem.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/GoodsDetail.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Promotion.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/QueryByOutRefundNoRequest.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Refund.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/RefundNotification.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/ReqFundsAccount.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Scope.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Status.java
common/src/main/java/com/jilongda/common/wxPay/refund/model/Type.java
common/target/classes/META-INF/spring-configuration-metadata.json
common/target/maven-archiver/pom.properties
common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
generator/pom.xml
generator/src/test/java/com/jilongda/CodeGeneratorTests.java
generator/target/maven-archiver/pom.properties
generator/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
generator/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
generator/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
generator/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
logs/app.log
logs/app.log.2022-08-11.0.gz
logs/app.log.2022-12-02.0.gz
logs/app.log.2022-12-06.0.gz
logs/app.log.2023-02-15.0.gz
logs/app.log.2023-02-27.0.gz
logs/app.log.2023-11-03.0.gz
logs/app.log.2024-06-13.0.gz
manage/logs/app.log
manage/logs/app.log.2022-08-16.0.gz
manage/logs/app.log.2022-08-17.0.gz
manage/logs/app.log.2024-03-01.0.gz
manage/logs/app.log.2024-04-15.0.gz
manage/pom.xml
manage/src/main/java/com/jilongda/manage/ManageApplication.java
manage/src/main/java/com/jilongda/manage/authority/controller/LoginController.java
manage/src/main/java/com/jilongda/manage/authority/controller/SecResourcesController.java
manage/src/main/java/com/jilongda/manage/authority/controller/SecRoleController.java
manage/src/main/java/com/jilongda/manage/authority/controller/SecRoleResourceController.java
manage/src/main/java/com/jilongda/manage/authority/controller/SecUserController.java
manage/src/main/java/com/jilongda/manage/authority/controller/SecUserRoleController.java
manage/src/main/java/com/jilongda/manage/authority/dto/Btn.java
manage/src/main/java/com/jilongda/manage/authority/dto/LoginCodeDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/LoginDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/Meta.java
manage/src/main/java/com/jilongda/manage/authority/dto/ResetPasswordDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecResDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecRoleDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecRoleResDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecRolesDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecUserDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecUserQueryDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecUserRoleDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SecUsersDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SysSourcesDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/SysSourcesListDTO.java
manage/src/main/java/com/jilongda/manage/authority/dto/VerificationCodeDTO.java
manage/src/main/java/com/jilongda/manage/authority/mapper/SecResourcesMapper.java
manage/src/main/java/com/jilongda/manage/authority/mapper/SecRoleMapper.java
manage/src/main/java/com/jilongda/manage/authority/mapper/SecRoleResourceMapper.java
manage/src/main/java/com/jilongda/manage/authority/mapper/SecUserMapper.java
manage/src/main/java/com/jilongda/manage/authority/mapper/SecUserRoleMapper.java
manage/src/main/java/com/jilongda/manage/authority/model/SecResources.java
manage/src/main/java/com/jilongda/manage/authority/model/SecRole.java
manage/src/main/java/com/jilongda/manage/authority/model/SecRoleResource.java
manage/src/main/java/com/jilongda/manage/authority/model/SecUser.java
manage/src/main/java/com/jilongda/manage/authority/model/SecUserRole.java
manage/src/main/java/com/jilongda/manage/authority/query/SecUserLowerQuery.java
manage/src/main/java/com/jilongda/manage/authority/service/SecResourcesService.java
manage/src/main/java/com/jilongda/manage/authority/service/SecRoleResourceService.java
manage/src/main/java/com/jilongda/manage/authority/service/SecRoleService.java
manage/src/main/java/com/jilongda/manage/authority/service/SecUserRoleService.java
manage/src/main/java/com/jilongda/manage/authority/service/SecUserService.java
manage/src/main/java/com/jilongda/manage/authority/service/impl/SecResourcesServiceImpl.java
manage/src/main/java/com/jilongda/manage/authority/service/impl/SecRoleResourceServiceImpl.java
manage/src/main/java/com/jilongda/manage/authority/service/impl/SecRoleServiceImpl.java
manage/src/main/java/com/jilongda/manage/authority/service/impl/SecUserRoleServiceImpl.java
manage/src/main/java/com/jilongda/manage/authority/service/impl/SecUserServiceImpl.java
manage/src/main/java/com/jilongda/manage/authority/vo/SecResourceVO.java
manage/src/main/java/com/jilongda/manage/authority/vo/SecUserRoleResouceVO.java
manage/src/main/java/com/jilongda/manage/authority/vo/SecUserVO.java
manage/src/main/java/com/jilongda/manage/authority/vo/SecUsersVO.java
manage/src/main/java/com/jilongda/manage/component/AliOssManageFileUploadController.java
manage/src/main/java/com/jilongda/manage/component/AliOssMange.java
manage/src/main/java/com/jilongda/manage/config/AsyncConfiguration.java
manage/src/main/java/com/jilongda/manage/config/WebSecurityConfig.java
manage/src/main/java/com/jilongda/manage/controller/SecFeeItemsController.java
manage/src/main/java/com/jilongda/manage/controller/SecResourcesController.java
manage/src/main/java/com/jilongda/manage/controller/SecRoleController.java
manage/src/main/java/com/jilongda/manage/controller/SecRoleResourceController.java
manage/src/main/java/com/jilongda/manage/controller/SecSettingController.java
manage/src/main/java/com/jilongda/manage/controller/SecUserController.java
manage/src/main/java/com/jilongda/manage/controller/SecUserRoleController.java
manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java
manage/src/main/java/com/jilongda/manage/controller/TBrandController.java
manage/src/main/java/com/jilongda/manage/controller/TCouponController.java
manage/src/main/java/com/jilongda/manage/controller/TCouponReceiveController.java
manage/src/main/java/com/jilongda/manage/controller/TFrameWarehousingDetailController.java
manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java
manage/src/main/java/com/jilongda/manage/controller/TInventoryFrameDetailController.java
manage/src/main/java/com/jilongda/manage/controller/TInventoryLensDetailController.java
manage/src/main/java/com/jilongda/manage/controller/TLensSeriesController.java
manage/src/main/java/com/jilongda/manage/controller/TLensWarehousingDetailController.java
manage/src/main/java/com/jilongda/manage/controller/TLineUpController.java
manage/src/main/java/com/jilongda/manage/controller/TMaterialController.java
manage/src/main/java/com/jilongda/manage/controller/TModelController.java
manage/src/main/java/com/jilongda/manage/controller/TOptometristController.java
manage/src/main/java/com/jilongda/manage/controller/TOptometryController.java
manage/src/main/java/com/jilongda/manage/controller/TOptometryDetailController.java
manage/src/main/java/com/jilongda/manage/controller/TOrderAccountingController.java
manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java
manage/src/main/java/com/jilongda/manage/controller/TOrderController.java
manage/src/main/java/com/jilongda/manage/controller/TStoreController.java
manage/src/main/java/com/jilongda/manage/controller/TSupplierController.java
manage/src/main/java/com/jilongda/manage/controller/TTicketController.java
manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java
manage/src/main/java/com/jilongda/manage/dto/TDeptDTO.java
manage/src/main/java/com/jilongda/manage/dto/TGoodsDTO.java
manage/src/main/java/com/jilongda/manage/log/LoginLogAspect.java
manage/src/main/java/com/jilongda/manage/log/OperationLogAspect.java
manage/src/main/java/com/jilongda/manage/mapper/LoginLogMapper.java
manage/src/main/java/com/jilongda/manage/mapper/OperLogMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecFeeItemsMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecResourcesMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecRoleMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecRoleResourceMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecSettingMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecUserMapper.java
manage/src/main/java/com/jilongda/manage/mapper/SecUserRoleMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TAppUserMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TBrandMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TCouponMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TCouponReceiveMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TFrameWarehousingDetailMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TInventoryFrameDetailMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TInventoryLensDetailMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TInventoryMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TLensSeriesMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TLensWarehousingDetailMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TLineUpMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TMaterialMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TModelMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TOptometristMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TOptometryDetailMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TOptometryMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TOrderAccountingMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TOrderAftersalesMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TOrderMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TStoreMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TSupplierMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TTicketMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TUserMapper.java
manage/src/main/java/com/jilongda/manage/mapper/TWarehousingMapper.java
manage/src/main/java/com/jilongda/manage/model/SecFeeItems.java
manage/src/main/java/com/jilongda/manage/model/SecResources.java
manage/src/main/java/com/jilongda/manage/model/SecRole.java
manage/src/main/java/com/jilongda/manage/model/SecRoleResource.java
manage/src/main/java/com/jilongda/manage/model/SecSetting.java
manage/src/main/java/com/jilongda/manage/model/SecUser.java
manage/src/main/java/com/jilongda/manage/model/SecUserRole.java
manage/src/main/java/com/jilongda/manage/model/TAppUser.java
manage/src/main/java/com/jilongda/manage/model/TBrand.java
manage/src/main/java/com/jilongda/manage/model/TCoupon.java
manage/src/main/java/com/jilongda/manage/model/TCouponReceive.java
manage/src/main/java/com/jilongda/manage/model/TFrameWarehousingDetail.java
manage/src/main/java/com/jilongda/manage/model/TInventory.java
manage/src/main/java/com/jilongda/manage/model/TInventoryFrameDetail.java
manage/src/main/java/com/jilongda/manage/model/TInventoryLensDetail.java
manage/src/main/java/com/jilongda/manage/model/TLensSeries.java
manage/src/main/java/com/jilongda/manage/model/TLensWarehousingDetail.java
manage/src/main/java/com/jilongda/manage/model/TLineUp.java
manage/src/main/java/com/jilongda/manage/model/TMaterial.java
manage/src/main/java/com/jilongda/manage/model/TModel.java
manage/src/main/java/com/jilongda/manage/model/TOptometrist.java
manage/src/main/java/com/jilongda/manage/model/TOptometry.java
manage/src/main/java/com/jilongda/manage/model/TOptometryDetail.java
manage/src/main/java/com/jilongda/manage/model/TOrder.java
manage/src/main/java/com/jilongda/manage/model/TOrderAccounting.java
manage/src/main/java/com/jilongda/manage/model/TOrderAftersales.java
manage/src/main/java/com/jilongda/manage/model/TStore.java
manage/src/main/java/com/jilongda/manage/model/TSupplier.java
manage/src/main/java/com/jilongda/manage/model/TTicket.java
manage/src/main/java/com/jilongda/manage/model/TWarehousing.java
manage/src/main/java/com/jilongda/manage/query/LoginLogQuery.java
manage/src/main/java/com/jilongda/manage/query/OperLogQuery.java
manage/src/main/java/com/jilongda/manage/security/AuthenticationProvider.java
manage/src/main/java/com/jilongda/manage/security/RbacAuthorityService.java
manage/src/main/java/com/jilongda/manage/security/SecurityAccessDeniedHandler.java
manage/src/main/java/com/jilongda/manage/security/SecurityUserDetails.java
manage/src/main/java/com/jilongda/manage/security/SecurityUserRoleResouce.java
manage/src/main/java/com/jilongda/manage/security/SysUserDetailsService.java
manage/src/main/java/com/jilongda/manage/service/LoginLogService.java
manage/src/main/java/com/jilongda/manage/service/OperLogService.java
manage/src/main/java/com/jilongda/manage/service/SecFeeItemsService.java
manage/src/main/java/com/jilongda/manage/service/SecResourcesService.java
manage/src/main/java/com/jilongda/manage/service/SecRoleResourceService.java
manage/src/main/java/com/jilongda/manage/service/SecRoleService.java
manage/src/main/java/com/jilongda/manage/service/SecSettingService.java
manage/src/main/java/com/jilongda/manage/service/SecUserRoleService.java
manage/src/main/java/com/jilongda/manage/service/SecUserService.java
manage/src/main/java/com/jilongda/manage/service/TAppUserService.java
manage/src/main/java/com/jilongda/manage/service/TBrandService.java
manage/src/main/java/com/jilongda/manage/service/TCouponReceiveService.java
manage/src/main/java/com/jilongda/manage/service/TCouponService.java
manage/src/main/java/com/jilongda/manage/service/TFrameWarehousingDetailService.java
manage/src/main/java/com/jilongda/manage/service/TInventoryFrameDetailService.java
manage/src/main/java/com/jilongda/manage/service/TInventoryLensDetailService.java
manage/src/main/java/com/jilongda/manage/service/TInventoryService.java
manage/src/main/java/com/jilongda/manage/service/TLensSeriesService.java
manage/src/main/java/com/jilongda/manage/service/TLensWarehousingDetailService.java
manage/src/main/java/com/jilongda/manage/service/TLineUpService.java
manage/src/main/java/com/jilongda/manage/service/TMaterialService.java
manage/src/main/java/com/jilongda/manage/service/TModelService.java
manage/src/main/java/com/jilongda/manage/service/TOptometristService.java
manage/src/main/java/com/jilongda/manage/service/TOptometryDetailService.java
manage/src/main/java/com/jilongda/manage/service/TOptometryService.java
manage/src/main/java/com/jilongda/manage/service/TOrderAccountingService.java
manage/src/main/java/com/jilongda/manage/service/TOrderAftersalesService.java
manage/src/main/java/com/jilongda/manage/service/TOrderService.java
manage/src/main/java/com/jilongda/manage/service/TStoreService.java
manage/src/main/java/com/jilongda/manage/service/TSupplierService.java
manage/src/main/java/com/jilongda/manage/service/TTicketService.java
manage/src/main/java/com/jilongda/manage/service/TUserService.java
manage/src/main/java/com/jilongda/manage/service/TWarehousingService.java
manage/src/main/java/com/jilongda/manage/service/impl/LoginLogServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/OperLogServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecFeeItemsServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecResourcesServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecRoleResourceServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecRoleServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecSettingServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecUserRoleServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/SecUserServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TAppUserServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TBrandServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TCouponReceiveServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TFrameWarehousingDetailServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TInventoryFrameDetailServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TInventoryLensDetailServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TInventoryServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TLensSeriesServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TLensWarehousingDetailServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TLineUpServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TMaterialServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TModelServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TOptometristServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TOptometryDetailServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TOptometryServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TOrderAccountingServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TOrderAftersalesServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TOrderServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TStoreServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TSupplierServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TTicketServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TUserServiceImpl.java
manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java
manage/src/main/java/com/jilongda/manage/utils/FileUtils.java
manage/src/main/java/com/jilongda/manage/utils/GoodsImportValidator.java
manage/src/main/java/com/jilongda/manage/utils/LoginInfoUtil.java
manage/src/main/java/com/jilongda/manage/utils/MsgUtils.java
manage/src/main/java/com/jilongda/manage/utils/UserUtil.java
manage/src/main/java/com/jilongda/manage/vo/UserAddListVO.java
manage/src/main/java/com/jilongda/manage/vo/UserLevelVO.java
manage/src/main/resources/application.yml
manage/src/main/resources/mapping/LoginLogMapper.xml
manage/src/main/resources/mapping/OperLogMapper.xml
manage/src/main/resources/mapping/SecFeeItemsMapper.xml
manage/src/main/resources/mapping/SecResourcesMapper.xml
manage/src/main/resources/mapping/SecRoleMapper.xml
manage/src/main/resources/mapping/SecRoleResourceMapper.xml
manage/src/main/resources/mapping/SecSettingMapper.xml
manage/src/main/resources/mapping/SecUserMapper.xml
manage/src/main/resources/mapping/SecUserRoleMapper.xml
manage/src/main/resources/mapping/TAppUserMapper.xml
manage/src/main/resources/mapping/TBrandMapper.xml
manage/src/main/resources/mapping/TCouponMapper.xml
manage/src/main/resources/mapping/TCouponReceiveMapper.xml
manage/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml
manage/src/main/resources/mapping/TInventoryFrameDetailMapper.xml
manage/src/main/resources/mapping/TInventoryLensDetailMapper.xml
manage/src/main/resources/mapping/TInventoryMapper.xml
manage/src/main/resources/mapping/TLensSeriesMapper.xml
manage/src/main/resources/mapping/TLensWarehousingDetailMapper.xml
manage/src/main/resources/mapping/TLineUpMapper.xml
manage/src/main/resources/mapping/TMaterialMapper.xml
manage/src/main/resources/mapping/TModelMapper.xml
manage/src/main/resources/mapping/TOptometristMapper.xml
manage/src/main/resources/mapping/TOptometryDetailMapper.xml
manage/src/main/resources/mapping/TOptometryMapper.xml
manage/src/main/resources/mapping/TOrderAccountingMapper.xml
manage/src/main/resources/mapping/TOrderAftersalesMapper.xml
manage/src/main/resources/mapping/TOrderMapper.xml
manage/src/main/resources/mapping/TStoreMapper.xml
manage/src/main/resources/mapping/TSupplierMapper.xml
manage/src/main/resources/mapping/TTicketMapper.xml
manage/src/main/resources/mapping/TUserMapper.xml
manage/src/main/resources/mapping/TWarehousingMapper.xml
manage/src/main/resources/mybatis-config.xml
manage/src/test/java/com/jilongda/manage/ManageTest.java
manage/src/test/java/com/jilongda/manage/MyComplexTemplateTest.java
manage/target/classes/application.yml
manage/target/classes/mapping/LoginLogMapper.xml
manage/target/classes/mapping/OperLogMapper.xml
manage/target/classes/mapping/SecResourcesMapper.xml
manage/target/classes/mapping/SecRoleMapper.xml
manage/target/classes/mapping/SecRoleResourceMapper.xml
manage/target/classes/mapping/SecUserMapper.xml
manage/target/classes/mapping/SecUserRoleMapper.xml
manage/target/classes/mapping/TCarouselImagesMapper.xml
manage/target/classes/mapping/TConfigMapper.xml
manage/target/classes/mapping/TCustomersMapper.xml
manage/target/classes/mapping/TDeptMapper.xml
manage/target/classes/mapping/TGoodsMapper.xml
manage/target/classes/mapping/TGoodsSpecificationsMapper.xml
manage/target/classes/mapping/TOrderGoodMapper.xml
manage/target/classes/mapping/TOrderMapper.xml
manage/target/classes/mapping/TRegionMapper.xml
manage/target/classes/mapping/TUserMapper.xml
manage/target/classes/mybatis-config.xml
manage/target/classes/template/销售数据列表.xls
manage/target/manage.jar.original
manage/target/maven-archiver/pom.properties
mvnw
mvnw.cmd
optometry/pom.xml
optometry/src/main/java/com/jilongda/optometry/AppletApplication.java
optometry/src/main/java/com/jilongda/optometry/aspect/StateAspect.java
optometry/src/main/java/com/jilongda/optometry/config/AuthenticationFilter1.java
optometry/src/main/java/com/jilongda/optometry/config/GlobalResultEnum.java
optometry/src/main/java/com/jilongda/optometry/config/WebSecurityConfig.java
optometry/src/main/java/com/jilongda/optometry/controller/SecFeeItemsController.java
optometry/src/main/java/com/jilongda/optometry/controller/SecResourcesController.java
optometry/src/main/java/com/jilongda/optometry/controller/SecRoleController.java
optometry/src/main/java/com/jilongda/optometry/controller/SecRoleResourceController.java
optometry/src/main/java/com/jilongda/optometry/controller/SecSettingController.java
optometry/src/main/java/com/jilongda/optometry/controller/SecUserController.java
optometry/src/main/java/com/jilongda/optometry/controller/SecUserRoleController.java
optometry/src/main/java/com/jilongda/optometry/controller/TAppUserController.java
optometry/src/main/java/com/jilongda/optometry/controller/TBrandController.java
optometry/src/main/java/com/jilongda/optometry/controller/TCouponController.java
optometry/src/main/java/com/jilongda/optometry/controller/TCouponReceiveController.java
optometry/src/main/java/com/jilongda/optometry/controller/TFrameWarehousingDetailController.java
optometry/src/main/java/com/jilongda/optometry/controller/TInventoryController.java
optometry/src/main/java/com/jilongda/optometry/controller/TInventoryFrameDetailController.java
optometry/src/main/java/com/jilongda/optometry/controller/TInventoryLensDetailController.java
optometry/src/main/java/com/jilongda/optometry/controller/TLensSeriesController.java
optometry/src/main/java/com/jilongda/optometry/controller/TLensWarehousingDetailController.java
optometry/src/main/java/com/jilongda/optometry/controller/TLineUpController.java
optometry/src/main/java/com/jilongda/optometry/controller/TMaterialController.java
optometry/src/main/java/com/jilongda/optometry/controller/TModelController.java
optometry/src/main/java/com/jilongda/optometry/controller/TOptometristController.java
optometry/src/main/java/com/jilongda/optometry/controller/TOptometryController.java
optometry/src/main/java/com/jilongda/optometry/controller/TOptometryDetailController.java
optometry/src/main/java/com/jilongda/optometry/controller/TOrderAccountingController.java
optometry/src/main/java/com/jilongda/optometry/controller/TOrderAftersalesController.java
optometry/src/main/java/com/jilongda/optometry/controller/TOrderController.java
optometry/src/main/java/com/jilongda/optometry/controller/TStoreController.java
optometry/src/main/java/com/jilongda/optometry/controller/TSupplierController.java
optometry/src/main/java/com/jilongda/optometry/controller/TTicketController.java
optometry/src/main/java/com/jilongda/optometry/controller/TWarehousingController.java
optometry/src/main/java/com/jilongda/optometry/dto/AliSms.java
optometry/src/main/java/com/jilongda/optometry/dto/AppCustomerPageDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/AppGoodsSpecDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/AppOrderPageDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/AppPassOrderDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/Btn.java
optometry/src/main/java/com/jilongda/optometry/dto/LoginCodeDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/LoginDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/Meta.java
optometry/src/main/java/com/jilongda/optometry/dto/ResetPasswordDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecResDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecRoleDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecRoleResDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecRolesDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecUserDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecUserQueryDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecUserRoleDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SecUsersDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SysSourcesDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/SysSourcesListDTO.java
optometry/src/main/java/com/jilongda/optometry/dto/VerificationCodeDTO.java
optometry/src/main/java/com/jilongda/optometry/log/LoginLogAspect.java
optometry/src/main/java/com/jilongda/optometry/mapper/LoginLogMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecFeeItemsMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecResourcesMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecRoleMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecRoleResourceMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecSettingMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecUserMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/SecUserRoleMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TAppUserMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TBrandMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TCouponMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TCouponReceiveMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TFrameWarehousingDetailMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TInventoryFrameDetailMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TInventoryLensDetailMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TInventoryMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TLensSeriesMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TLensWarehousingDetailMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TLineUpMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TMaterialMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TModelMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TOptometristMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TOptometryDetailMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TOptometryMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TOrderAccountingMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TOrderAftersalesMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TOrderMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TStoreMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TSupplierMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TTicketMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TUserMapper.java
optometry/src/main/java/com/jilongda/optometry/mapper/TWarehousingMapper.java
optometry/src/main/java/com/jilongda/optometry/model/SecFeeItems.java
optometry/src/main/java/com/jilongda/optometry/model/SecResources.java
optometry/src/main/java/com/jilongda/optometry/model/SecRole.java
optometry/src/main/java/com/jilongda/optometry/model/SecRoleResource.java
optometry/src/main/java/com/jilongda/optometry/model/SecSetting.java
optometry/src/main/java/com/jilongda/optometry/model/SecUser.java
optometry/src/main/java/com/jilongda/optometry/model/SecUserRole.java
optometry/src/main/java/com/jilongda/optometry/model/TAppUser.java
optometry/src/main/java/com/jilongda/optometry/model/TBrand.java
optometry/src/main/java/com/jilongda/optometry/model/TCoupon.java
optometry/src/main/java/com/jilongda/optometry/model/TCouponReceive.java
optometry/src/main/java/com/jilongda/optometry/model/TFrameWarehousingDetail.java
optometry/src/main/java/com/jilongda/optometry/model/TInventory.java
optometry/src/main/java/com/jilongda/optometry/model/TInventoryFrameDetail.java
optometry/src/main/java/com/jilongda/optometry/model/TInventoryLensDetail.java
optometry/src/main/java/com/jilongda/optometry/model/TLensSeries.java
optometry/src/main/java/com/jilongda/optometry/model/TLensWarehousingDetail.java
optometry/src/main/java/com/jilongda/optometry/model/TLineUp.java
optometry/src/main/java/com/jilongda/optometry/model/TMaterial.java
optometry/src/main/java/com/jilongda/optometry/model/TModel.java
optometry/src/main/java/com/jilongda/optometry/model/TOptometrist.java
optometry/src/main/java/com/jilongda/optometry/model/TOptometry.java
optometry/src/main/java/com/jilongda/optometry/model/TOptometryDetail.java
optometry/src/main/java/com/jilongda/optometry/model/TOrder.java
optometry/src/main/java/com/jilongda/optometry/model/TOrderAccounting.java
optometry/src/main/java/com/jilongda/optometry/model/TOrderAftersales.java
optometry/src/main/java/com/jilongda/optometry/model/TStore.java
optometry/src/main/java/com/jilongda/optometry/model/TSupplier.java
optometry/src/main/java/com/jilongda/optometry/model/TTicket.java
optometry/src/main/java/com/jilongda/optometry/model/TWarehousing.java
optometry/src/main/java/com/jilongda/optometry/query/LoginLogQuery.java
optometry/src/main/java/com/jilongda/optometry/query/OperLogQuery.java
optometry/src/main/java/com/jilongda/optometry/schedule/SystemSchedule.java
optometry/src/main/java/com/jilongda/optometry/security/AuthenticationProvider.java
optometry/src/main/java/com/jilongda/optometry/security/SecurityUserDetails.java
optometry/src/main/java/com/jilongda/optometry/security/SecurityUserRoleResouce.java
optometry/src/main/java/com/jilongda/optometry/security/SysUserDetailsService.java
optometry/src/main/java/com/jilongda/optometry/service/LoginLogService.java
optometry/src/main/java/com/jilongda/optometry/service/SecFeeItemsService.java
optometry/src/main/java/com/jilongda/optometry/service/SecResourcesService.java
optometry/src/main/java/com/jilongda/optometry/service/SecRoleResourceService.java
optometry/src/main/java/com/jilongda/optometry/service/SecRoleService.java
optometry/src/main/java/com/jilongda/optometry/service/SecSettingService.java
optometry/src/main/java/com/jilongda/optometry/service/SecUserRoleService.java
optometry/src/main/java/com/jilongda/optometry/service/SecUserService.java
optometry/src/main/java/com/jilongda/optometry/service/TAppUserService.java
optometry/src/main/java/com/jilongda/optometry/service/TBrandService.java
optometry/src/main/java/com/jilongda/optometry/service/TCouponReceiveService.java
optometry/src/main/java/com/jilongda/optometry/service/TCouponService.java
optometry/src/main/java/com/jilongda/optometry/service/TFrameWarehousingDetailService.java
optometry/src/main/java/com/jilongda/optometry/service/TInventoryFrameDetailService.java
optometry/src/main/java/com/jilongda/optometry/service/TInventoryLensDetailService.java
optometry/src/main/java/com/jilongda/optometry/service/TInventoryService.java
optometry/src/main/java/com/jilongda/optometry/service/TLensSeriesService.java
optometry/src/main/java/com/jilongda/optometry/service/TLensWarehousingDetailService.java
optometry/src/main/java/com/jilongda/optometry/service/TLineUpService.java
optometry/src/main/java/com/jilongda/optometry/service/TMaterialService.java
optometry/src/main/java/com/jilongda/optometry/service/TModelService.java
optometry/src/main/java/com/jilongda/optometry/service/TOptometristService.java
optometry/src/main/java/com/jilongda/optometry/service/TOptometryDetailService.java
optometry/src/main/java/com/jilongda/optometry/service/TOptometryService.java
optometry/src/main/java/com/jilongda/optometry/service/TOrderAccountingService.java
optometry/src/main/java/com/jilongda/optometry/service/TOrderAftersalesService.java
optometry/src/main/java/com/jilongda/optometry/service/TOrderService.java
optometry/src/main/java/com/jilongda/optometry/service/TStoreService.java
optometry/src/main/java/com/jilongda/optometry/service/TSupplierService.java
optometry/src/main/java/com/jilongda/optometry/service/TTicketService.java
optometry/src/main/java/com/jilongda/optometry/service/TUserService.java
optometry/src/main/java/com/jilongda/optometry/service/TWarehousingService.java
optometry/src/main/java/com/jilongda/optometry/service/impl/LoginLogServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecFeeItemsServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecResourcesServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecRoleResourceServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecRoleServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecSettingServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecUserRoleServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/SecUserServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TAppUserServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TBrandServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TCouponReceiveServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TCouponServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TFrameWarehousingDetailServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TInventoryFrameDetailServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TInventoryLensDetailServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TInventoryServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TLensSeriesServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TLensWarehousingDetailServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TLineUpServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TMaterialServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TModelServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TOptometristServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TOptometryDetailServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TOptometryServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TOrderAccountingServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TOrderAftersalesServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TOrderServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TStoreServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TSupplierServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TTicketServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TUserServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/service/impl/TWarehousingServiceImpl.java
optometry/src/main/java/com/jilongda/optometry/utils/ALiSendSms.java
optometry/src/main/java/com/jilongda/optometry/utils/DistanceCalculator.java
optometry/src/main/java/com/jilongda/optometry/utils/LoginInfoUtil.java
optometry/src/main/java/com/jilongda/optometry/utils/MsgUtils.java
optometry/src/main/java/com/jilongda/optometry/utils/ObsUploadUtil.java
optometry/src/main/java/com/jilongda/optometry/utils/PayMoneyUtil.java
optometry/src/main/java/com/jilongda/optometry/utils/UUIDUtil.java
optometry/src/main/java/com/jilongda/optometry/utils/dingding/AccessTokenUtil.java
optometry/src/main/java/com/jilongda/optometry/utils/dingding/DingTalkAccessTokenRequest.java
optometry/src/main/java/com/jilongda/optometry/vo/AppOrderGoodsVO.java
optometry/src/main/java/com/jilongda/optometry/vo/AppOrderPageVO.java
optometry/src/main/java/com/jilongda/optometry/vo/AppOrderVO.java
optometry/src/main/java/com/jilongda/optometry/vo/AppUserVO.java
optometry/src/main/java/com/jilongda/optometry/vo/GoodDetailVO.java
optometry/src/main/java/com/jilongda/optometry/vo/IndexGoodVO.java
optometry/src/main/java/com/jilongda/optometry/vo/PriceGoodsVo.java
optometry/src/main/java/com/jilongda/optometry/vo/SecResourceVO.java
optometry/src/main/java/com/jilongda/optometry/vo/SecUserRoleResouceVO.java
optometry/src/main/java/com/jilongda/optometry/vo/SecUserVO.java
optometry/src/main/java/com/jilongda/optometry/vo/SecUsersVO.java
optometry/src/main/java/com/jilongda/optometry/vo/vo/TOrderVO.java
optometry/src/main/java/com/jilongda/optometry/wx/body/resp/AccessTokenRespBody.java
optometry/src/main/java/com/jilongda/optometry/wx/body/resp/Code2SessionRespBody.java
optometry/src/main/java/com/jilongda/optometry/wx/body/resp/RespBody.java
optometry/src/main/java/com/jilongda/optometry/wx/body/resq/Code2SessionResqBody.java
optometry/src/main/java/com/jilongda/optometry/wx/pojo/AppletPhoneEncrypteData.java
optometry/src/main/java/com/jilongda/optometry/wx/pojo/AppletUserDecodeData.java
optometry/src/main/java/com/jilongda/optometry/wx/pojo/AppletUserEncrypteData.java
optometry/src/main/java/com/jilongda/optometry/wx/pojo/Watermark.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/JsonUtils.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/SHA1.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WebUtils.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WeixinProperties.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WxAppletTools.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WxCache.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WxCacheTemplate.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WxCaffineCache.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WxException.java
optometry/src/main/java/com/jilongda/optometry/wx/utils/WxJsonUtils.java
optometry/src/main/java/com/jilongda/optometry/wxtemplate/Template.java
optometry/src/main/resources/application.yml
optometry/src/main/resources/mapping/LoginLogMapper.xml
optometry/src/main/resources/mapping/SecFeeItemsMapper.xml
optometry/src/main/resources/mapping/SecResourcesMapper.xml
optometry/src/main/resources/mapping/SecRoleMapper.xml
optometry/src/main/resources/mapping/SecRoleResourceMapper.xml
optometry/src/main/resources/mapping/SecSettingMapper.xml
optometry/src/main/resources/mapping/SecUserMapper.xml
optometry/src/main/resources/mapping/SecUserRoleMapper.xml
optometry/src/main/resources/mapping/TAppUserMapper.xml
optometry/src/main/resources/mapping/TBrandMapper.xml
optometry/src/main/resources/mapping/TCouponMapper.xml
optometry/src/main/resources/mapping/TCouponReceiveMapper.xml
optometry/src/main/resources/mapping/TFrameWarehousingDetailMapper.xml
optometry/src/main/resources/mapping/TInventoryFrameDetailMapper.xml
optometry/src/main/resources/mapping/TInventoryLensDetailMapper.xml
optometry/src/main/resources/mapping/TInventoryMapper.xml
optometry/src/main/resources/mapping/TLensSeriesMapper.xml
optometry/src/main/resources/mapping/TLensWarehousingDetailMapper.xml
optometry/src/main/resources/mapping/TLineUpMapper.xml
optometry/src/main/resources/mapping/TMaterialMapper.xml
optometry/src/main/resources/mapping/TModelMapper.xml
optometry/src/main/resources/mapping/TOptometristMapper.xml
optometry/src/main/resources/mapping/TOptometryDetailMapper.xml
optometry/src/main/resources/mapping/TOptometryMapper.xml
optometry/src/main/resources/mapping/TOrderAccountingMapper.xml
optometry/src/main/resources/mapping/TOrderAftersalesMapper.xml
optometry/src/main/resources/mapping/TOrderMapper.xml
optometry/src/main/resources/mapping/TStoreMapper.xml
optometry/src/main/resources/mapping/TSupplierMapper.xml
optometry/src/main/resources/mapping/TTicketMapper.xml
optometry/src/main/resources/mapping/TUserMapper.xml
optometry/src/main/resources/mapping/TWarehousingMapper.xml
optometry/src/main/resources/mybatis-config.xml
pom.xml |