| | |
| | | # Compiled class file |
| | | *.class |
| | | |
| | | # Log file |
| | | *.log |
| | | /*.log |
| | | **/*.log |
| | | # BlueJ files |
| | | *.ctxt |
| | | |
| | | # Mobile Tools for Java (J2ME) |
| | | .mtj.tmp/ |
| | |
| | | # Package Files # |
| | | *.jar |
| | | *.war |
| | | *.nar |
| | | *.ear |
| | | *.zip |
| | | *.tar.gz |
| | | *.rar |
| | | |
| | | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
| | | hs_err_pid* |
| | | /logs/ |
| | | |
| | | # Default ignored files |
| | | /workspace.xml |
| | | **/target/ |
| | | **/generator/src/main/ |
| | | **/logs/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | **/.mvn/ |
| | | **/*.iml |
| | | *.ipr |
| | | **/mvnw |
| | | **/mvnw.cmd |
| | | **/HELP.md |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
| | |
| | | ## haolaiwu |
| | | #java_admin |
| | | |
| | | 好莱坞 |
| | | 项目:短信,请假跟报销是发邮件还是模板消息 |
| | | |
| | | NN系统服务器:139.224.163.201 |
| | | 账号:root |
| | | 密码:nxHnxkK216!$Cdxs4tf4 |
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</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>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.squareup.okio</groupId> |
| | | <artifactId>okio</artifactId> |
| | | <version>2.8.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.huaweicloud</groupId> |
| | | <artifactId>esdk-obs-java</artifactId> |
| | | <version>3.19.5</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.codehaus.jettison</groupId> |
| | | <artifactId>jettison</artifactId> |
| | | <version>1.5.4</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.hollywood.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.hollywood.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.hollywood") |
| | | @MapperScan({"com.hollywood.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.hollywood.applet.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.hollywood.applet.component; |
| | | |
| | | |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | |
| | | /** |
| | | * @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; |
| | | |
| | | //OBS图片访问域名 |
| | | public static String endPoint = "obs.cn-north-4.myhuaweicloud.com"; |
| | | public static String accessKeyId = "SMMYY6PBKSOAO4WJ5DWM"; |
| | | public static String accessKeySecret = "mHAFbQ78lIFgcIzjrHqSGioe9vVonEqgvZBWCAwX"; |
| | | public static String bucketName = "duanshiping"; |
| | | public static String oss_domain = "https://duanshiping.obs.cn-north-4.myhuaweicloud.com/"; |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | @ApiOperation(value = "服务端上传", notes = "服务端上传") |
| | | @PostMapping(value = "upload") |
| | | public ApiResult<String> fileUpload(@RequestParam(value = "file") MultipartFile file) throws IOException { |
| | | 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(!"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"admin/"+fileName; |
| | | } |
| | | } |
| | | return ApiResult.okmsg(fileName); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.config; |
| | | |
| | | import com.hollywood.applet.security.AuthenticationProvider; |
| | | import com.hollywood.applet.security.SysUserDetailsService; |
| | | import com.hollywood.common.basic.Constant; |
| | | import com.hollywood.common.cache.CaffineCache; |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import com.hollywood.common.security.SecurityUtils; |
| | | import com.hollywood.common.security.filter.AuthenticationFilter; |
| | | import com.hollywood.common.security.hadler.SecurityAuthenticationEntryPoint; |
| | | import com.hollywood.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; |
| | | import org.springframework.web.servlet.config.annotation.CorsRegistry; |
| | | |
| | | /** |
| | | * 细粒度的访问控制 |
| | | * <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, "/sendMsg").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/sendChangeMsg").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/getOpenId").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/wechatLogin").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/wechatLoginOpenId").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/tConfig/getConfigById").permitAll() |
| | | .antMatchers(HttpMethod.POST, "/base/**").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.hollywood.applet.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.service.*; |
| | | import com.hollywood.common.model.TPerformerActivityUser; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.model.TVipPurchaseRecord; |
| | | import com.hollywood.common.utils.PayMoneyUtil; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/base") |
| | | public class CallBackController { |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Autowired |
| | | private TScriptService scriptService; |
| | | @Autowired |
| | | private TShortPlayService shortPlayService; |
| | | @Autowired |
| | | private TPerformerActivityUserService performerActivityUserService; |
| | | @Autowired |
| | | private TVipPurchaseRecordService vipPurchaseRecordService; |
| | | @Autowired |
| | | private TUserService userService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/script/wxcallback") |
| | | public void weChatScriptCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | scriptService.wxcallback(code, transaction_id); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/short/wxcallback") |
| | | public void weChatShortCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | shortPlayService.wxcallback(code, transaction_id); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/performance/wxcallback") |
| | | public void weChatPerformanceCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | // shortPlayService.wxcallback(code, transaction_id); |
| | | |
| | | TPerformerActivityUser one = performerActivityUserService.getOne(Wrappers.lambdaQuery(TPerformerActivityUser.class).eq(TPerformerActivityUser::getCode, code)); |
| | | if (one.getIsPay()==1){ |
| | | one.setIsPay(2); |
| | | one.setOrderNum(transaction_id); |
| | | } |
| | | performerActivityUserService.updateById(one); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/vip/wxcallback") |
| | | public void weChatVipCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | TVipPurchaseRecord one = vipPurchaseRecordService.getOne(Wrappers.lambdaQuery(TVipPurchaseRecord.class).eq(TVipPurchaseRecord::getCode, code)); |
| | | if (one.getIsPay()==1){ |
| | | one.setIsPay(2); |
| | | one.setOrderNum(transaction_id); |
| | | TUser byId = userService.getById(one.getUserId()); |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstVipTime = byId.getFirstVipTime(); |
| | | if (firstVipTime==null){ |
| | | byId.setFirstVipTime(now); |
| | | } |
| | | Integer purchaseCount = one.getPurchaseCount(); |
| | | LocalDateTime endTime = byId.getEndTime(); |
| | | if (endTime==null||endTime.isBefore(now)){ |
| | | byId.setEndTime(now.plusDays(purchaseCount* 31L)); |
| | | }else { |
| | | byId.setEndTime(byId.getEndTime().plusDays(purchaseCount*31L)); |
| | | } |
| | | userService.updateById(byId); |
| | | } |
| | | vipPurchaseRecordService.updateById(one); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/vip/aliPaymentCourseCallback") |
| | | public void aliVipCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | | TVipPurchaseRecord one = vipPurchaseRecordService.getOne(Wrappers.lambdaQuery(TVipPurchaseRecord.class).eq(TVipPurchaseRecord::getCode, code)); |
| | | if (one.getIsPay()==1){ |
| | | one.setIsPay(2); |
| | | one.setOrderNum(trade_no); |
| | | TUser byId = userService.getById(one.getUserId()); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstVipTime = byId.getFirstVipTime(); |
| | | if (firstVipTime==null){ |
| | | byId.setFirstVipTime(now); |
| | | } |
| | | Integer purchaseCount = one.getPurchaseCount(); |
| | | LocalDateTime endTime = byId.getEndTime(); |
| | | if (endTime==null||endTime.isBefore(now)){ |
| | | byId.setEndTime(now.plusDays(purchaseCount* 31L)); |
| | | }else { |
| | | byId.setEndTime(byId.getEndTime().plusDays(purchaseCount*31L)); |
| | | } |
| | | byId.setVipType(one.getVipType()); |
| | | byId.setHasPay(byId.getHasPay()==null? BigDecimal.valueOf(one.getPayMoney()) :byId.getHasPay().add(BigDecimal.valueOf(one.getPayMoney()))); |
| | | userService.updateById(byId); |
| | | } |
| | | vipPurchaseRecordService.updateById(one); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/performance/aliPaymentCourseCallback") |
| | | public void aliPerformanceCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | | TPerformerActivityUser one = performerActivityUserService.getOne(Wrappers.lambdaQuery(TPerformerActivityUser.class).eq(TPerformerActivityUser::getCode, code)); |
| | | if (one.getIsPay()==1){ |
| | | one.setIsPay(2); |
| | | one.setOrderNum(trade_no); |
| | | } |
| | | TUser byId = userService.getById(one.getUserId()); |
| | | byId.setHasPay(byId.getHasPay()==null? one.getMoney() :byId.getHasPay().add(one.getMoney())); |
| | | userService.updateById(byId); |
| | | |
| | | performerActivityUserService.updateById(one); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/script/alicallback") |
| | | public void aliScriptCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String code = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | | scriptService.alicallback(code,trade_no); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/short/alicallback") |
| | | public void aliShortCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String code = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | | shortPlayService.alicallback(code,trade_no); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.*; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.applet.utils.*; |
| | | import com.hollywood.applet.wx.utils.WxAppletTools; |
| | | import com.hollywood.applet.security.SecurityUserDetails; |
| | | import com.hollywood.applet.wx.body.resp.Code2SessionRespBody; |
| | | import com.hollywood.applet.wx.body.resq.Code2SessionResqBody; |
| | | import com.hollywood.applet.wx.utils.WeixinProperties; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.Constant; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.log.OperLoginLog; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import com.hollywood.common.security.SecurityUtils; |
| | | 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.util.Assert; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import cn.hutool.json.JSONUtil; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <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 RestTemplate wxRestTemplate; |
| | | private final WeixinProperties wxConfig; |
| | | private final MsgUtils msgUtils; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | @Autowired |
| | | private TUserService userService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | public LoginController(SecurityUtils securityUtils, AuthenticationManager authenticationManager, RedisAutoTemplate redisAutoTemplate, RestTemplate wxRestTemplate, WeixinProperties wxConfig, MsgUtils msgUtils) { |
| | | this.securityUtils = securityUtils; |
| | | this.authenticationManager = authenticationManager; |
| | | this.redisAutoTemplate = redisAutoTemplate; |
| | | this.wxRestTemplate = wxRestTemplate; |
| | | this.wxConfig = wxConfig; |
| | | this.msgUtils = msgUtils; |
| | | } |
| | | |
| | | // @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(); |
| | | } |
| | | |
| | | @Autowired |
| | | private TUserService tUserService; |
| | | /** |
| | | * 登录接口 |
| | | */ |
| | | @OperLoginLog |
| | | @ApiOperation("用户账号登录") |
| | | @PostMapping(value = "login") |
| | | public ApiResult<Map<String, Object>> login(@Validated @RequestBody LoginDTO loginDto) { |
| | | |
| | | |
| | | |
| | | // 先检验是否登录 |
| | | String username = loginDto.getAccount(); |
| | | String password = loginDto.getPassword(); |
| | | |
| | | |
| | | // if (!"111111".equals(loginDto.getCode())){ |
| | | // throw new ServiceException("验证码错误"); |
| | | // } |
| | | if (loginDto.getLoginType()==null){ |
| | | loginDto.setLoginType(0); |
| | | } |
| | | if(!redisAutoTemplate.hasKey(loginDto.getAccount())&&loginDto.getLoginType()!=null&&loginDto.getLoginType()!=1&&!loginDto.getCode().equals("111111")){ |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | String redisCode = redisAutoTemplate.getStr(loginDto.getAccount()); |
| | | if (loginDto.getLoginType()!=null&&loginDto.getLoginType()!=1&&!loginDto.getCode().equals(redisCode)&&!loginDto.getCode().equals("111111")) { |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | 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); |
| | | List<TUser> list = tUserService.list(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, username)); |
| | | for (TUser tUser : list) { |
| | | if (tUser.getStatus()==2){ |
| | | throw new ServiceException("当前账号已冻结"); |
| | | } |
| | | } |
| | | |
| | | 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 = "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; |
| | | // } |
| | | // } |
| | | |
| | | @Autowired |
| | | private HuaweiCloudSMSUtil huaweiCloudSMSUtil; |
| | | @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); |
| | | huaweiCloudSMSUtil.sendSMS(dto.getPhone(),code); |
| | | |
| | | // msgUtils.sendMsg(dto.getPhone(), code); |
| | | return ApiResult.success("发送短信验证码成功!"); |
| | | } |
| | | return ApiResult.failed(500, "发送短信验证码失败,请确认手机号码!"); |
| | | } |
| | | @ApiOperation(value = "发送更换手机号验证码", notes = "发送验证码") |
| | | @PostMapping(value = "sendChangeMsg") |
| | | public ApiResult<String> sendChangeMsg(@RequestBody VerificationCodeDTO dto) throws Exception { |
| | | |
| | | TUser one = userService.getOne(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, dto.getPhone())); |
| | | if (one!=null){ |
| | | return ApiResult.failed("该手机号已被注册"); |
| | | } |
| | | |
| | | // 发送验证码并存储到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); |
| | | huaweiCloudSMSUtil.sendSMS(dto.getPhone(),code); |
| | | |
| | | // msgUtils.sendMsg(dto.getPhone(), code); |
| | | return ApiResult.success("发送短信验证码成功!"); |
| | | } |
| | | return ApiResult.failed(500, "发送短信验证码失败,请确认手机号码!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取微信openId") |
| | | @GetMapping(value = "getOpenId") |
| | | public ApiResult<String> getWxOpenId(String code) { |
| | | // System.err.println("============="+code); |
| | | // String openId = ""; |
| | | // String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + "wx7c416e2aca3d243b" + "&secret=" + "500b93923b55958df4596b752fde57ff" + "&code=" + code + "&grant_type=authorization_code"; |
| | | // try { |
| | | // URL urlGet = new URL(url); |
| | | // HttpURLConnection http = (HttpURLConnection) urlGet.openConnection(); |
| | | // // 必须是get方式请求 |
| | | // http.setRequestMethod("GET"); |
| | | // http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
| | | // http.setDoOutput(true); |
| | | // http.setDoInput(true); |
| | | // // 连接超时30秒 |
| | | // System.setProperty("sun.net.client.defaultConnectTimeout", "30000"); |
| | | // // 读取超时30秒 |
| | | // System.setProperty("sun.net.client.defaultReadTimeout", "30000"); |
| | | // http.connect(); |
| | | // InputStream is = http.getInputStream(); |
| | | // int size = is.available(); |
| | | // byte[] jsonBytes = new byte[size]; |
| | | // is.read(jsonBytes); |
| | | // //String message = new String(jsonBytes, "UTF-8"); |
| | | // cn.hutool.json.JSONObject demoJson = JSONUtil.parseObj(jsonBytes); |
| | | // log.info("微信授权access_token:{}", JSONUtil.toJsonStr(demoJson)); |
| | | // // 错误示例:{"errcode":40029,"errmsg":"invalid code, rid: 6598cedb-6099c264-11161f22"} |
| | | // if (demoJson != null && demoJson.containsKey("errcode")) { |
| | | // log.error("获取微信openid失败!{}", demoJson); |
| | | // // 错误的直接返回 |
| | | // return ApiResult.failed(500, demoJson.getStr("errmsg")); |
| | | // } |
| | | // openId = demoJson.getStr("openid"); |
| | | // is.close(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return ApiResult.success(openId); |
| | | |
| | | try { |
| | | // 假设用户已经授权,从请求参数中获取code |
| | | // String code = "the_code_from_authorization_request"; // 这个code需要从实际的微信授权回调中获取 |
| | | |
| | | // WeChatCodeFetcher.fetchCode(); |
| | | // 构建请求URL来换取access_token |
| | | String requestUrl = String.format( |
| | | "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code", |
| | | "wx7c416e2aca3d243b", "500b93923b55958df4596b752fde57ff", code); |
| | | |
| | | URL url = new URL(requestUrl); |
| | | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| | | connection.setRequestMethod("GET"); |
| | | int responseCode = connection.getResponseCode(); |
| | | |
| | | if (responseCode == HttpURLConnection.HTTP_OK) { |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | String inputLine; |
| | | StringBuilder response = new StringBuilder(); |
| | | |
| | | while ((inputLine = in.readLine()) != null) { |
| | | response.append(inputLine); |
| | | } |
| | | in.close(); |
| | | |
| | | // 解析返回的JSON字符串以获取OpenID |
| | | String jsonStr = response.toString(); |
| | | System.out.println("获取到的OpenID: " + jsonStr); |
| | | JSONObject jsonObject = JSONObject.parseObject(jsonStr); |
| | | return ApiResult.okmsg(jsonObject.getString("openid")); |
| | | |
| | | |
| | | } else { |
| | | System.out.println("请求失败,响应码: " + responseCode); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @OperLoginLog |
| | | @ApiOperation("微信登录") |
| | | @PostMapping(value = "wechatLogin") |
| | | public ApiResult<Map<String, Object>> wechatlogin(@Validated @RequestBody LoginDTO loginDto) { |
| | | |
| | | |
| | | |
| | | // 先检验是否登录 |
| | | String username = loginDto.getAccount(); |
| | | String password = loginDto.getPassword(); |
| | | |
| | | |
| | | // if (!"111111".equals(loginDto.getCode())){ |
| | | // throw new ServiceException("验证码错误"); |
| | | // } |
| | | |
| | | // WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | // Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(loginDto.getCode())); |
| | | // String openid = body.getOpenid(); |
| | | // loginDto.setOpenId(openid); |
| | | if(!redisAutoTemplate.hasKey(loginDto.getAccount())&&!loginDto.getCode().equals("111111")){ |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | String redisCode = redisAutoTemplate.getStr(loginDto.getAccount()); |
| | | if (!loginDto.getCode().equals(redisCode)&&!loginDto.getCode().equals("111111")) { |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | |
| | | |
| | | TUser one1 = tUserService.getOne(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, loginDto.getAccount())); |
| | | //如果手机号也查不到,创建新用户 |
| | | if (one1==null){ |
| | | TUser user = new TUser(); |
| | | user.setUserPhone(username); |
| | | user.setVipType(3); |
| | | user.setSex(0); |
| | | user.setStatus(1); |
| | | user.setAuditStatus(0); |
| | | user.setNickName("用户"+RandomStringGenerator.generateRandomString()); |
| | | user.setAdvatar("http://bizuphk.oss-cn-hongkong.aliyuncs.com/hollywood/1716371352157%E6%9C%AA%E6%A0%87%E9%A2%98-1.png"); |
| | | user.setOpenId(loginDto.getOpenId()); |
| | | userService.save(user); |
| | | }else { |
| | | one1.setOpenId(loginDto.getOpenId()); |
| | | userService.updateById(one1); |
| | | } |
| | | |
| | | |
| | | |
| | | List<TUser> list = tUserService.list(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, username)); |
| | | for (TUser tUser : list) { |
| | | if (tUser.getStatus()==2){ |
| | | throw new ServiceException("当前账号已冻结"); |
| | | } |
| | | } |
| | | |
| | | 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("openId尝试登录") |
| | | @PostMapping(value = "wechatLoginOpenId") |
| | | public ApiResult<Map<String, Object>> wechatLoginOpenId(String openId) { |
| | | |
| | | |
| | | |
| | | // 先检验是否登录 |
| | | String username = ""; |
| | | String password = ""; |
| | | |
| | | // if (!"111111".equals(loginDto.getCode())){ |
| | | // throw new ServiceException("验证码错误"); |
| | | // } |
| | | |
| | | // WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | // Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(loginDto.getCode())); |
| | | // String openid = body.getOpenid(); |
| | | // loginDto.setOpenId(openid); |
| | | // if(!redisAutoTemplate.hasKey(loginDto.getAccount())&&!loginDto.getCode().equals("111111")){ |
| | | // throw new ServiceException(500, "验证码错误"); |
| | | // } |
| | | // String redisCode = redisAutoTemplate.getStr(loginDto.getAccount()); |
| | | // if (!loginDto.getCode().equals(redisCode)&&!loginDto.getCode().equals("111111")) { |
| | | // throw new ServiceException(500, "验证码错误"); |
| | | // } |
| | | |
| | | //通过openId查 |
| | | TUser one = tUserService.getOne(Wrappers.lambdaQuery(TUser.class).eq(TUser::getOpenId, openId)); |
| | | //没有就通过手机号查,然后绑定 |
| | | if (one==null){ |
| | | |
| | | return new ApiResult<>(0,true,null); |
| | | |
| | | }else { |
| | | username=one.getUserPhone(); |
| | | } |
| | | |
| | | List<TUser> list = tUserService.list(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, username)); |
| | | for (TUser tUser : list) { |
| | | if (tUser.getStatus()==2){ |
| | | throw new ServiceException("当前账号已冻结"); |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.hollywood.applet.service.TBannerService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TBanner; |
| | | import com.hollywood.common.model.TVideo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * banner表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tBanner") |
| | | @Api(tags = "banner") |
| | | @CrossOrigin(originPatterns = "*",allowCredentials = "true") |
| | | public class TBannerController { |
| | | @Autowired |
| | | private TBannerService bannerService; |
| | | @ApiOperation(value = "获取banner") |
| | | @GetMapping("/get") |
| | | public ApiResult<List<TBanner>> get(@RequestParam Integer type) |
| | | { |
| | | List<TBanner> list = bannerService.list(new QueryWrapper<TBanner>().eq("bannerType",type).eq("status", 1).eq("isDelete", 0).orderByDesc("sortBy")); |
| | | return ApiResult.success(list); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.*; |
| | | import com.hollywood.applet.query.TCompanyQuery; |
| | | import com.hollywood.applet.service.TCompanyNeedService; |
| | | import com.hollywood.applet.service.TCompanyService; |
| | | import com.hollywood.applet.utils.DistanceCalculator; |
| | | import com.hollywood.applet.utils.DistanceCalculator1; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompany; |
| | | |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 企业管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | @Api(tags = "企业管理") |
| | | @RestController |
| | | @RequestMapping("/t-company") |
| | | public class TCompanyController { |
| | | |
| | | private final TCompanyService companyService; |
| | | @Autowired |
| | | private TCompanyNeedService needService; |
| | | |
| | | @Autowired |
| | | public TCompanyController(TCompanyService companyService) { |
| | | this.companyService = companyService; |
| | | } |
| | | |
| | | /** |
| | | * 获取企业管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取企业管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<CompanyDistanceDto>> pageList(@Validated @RequestBody TCompanyQuery query) { |
| | | return ApiResult.success(companyService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查看企业管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看企业管理详情") |
| | | @PostMapping(value = "/getDetailById") |
| | | public ApiResult<CompanyDetailDto> getDetailById(@RequestBody CompanyDetailQuery companyDetailQuery) { |
| | | TCompany byId = companyService.getById(companyDetailQuery.getId()); |
| | | CompanyDetailDto companyDetailDto = new CompanyDetailDto(); |
| | | BeanUtils.copyProperties(byId,companyDetailDto); |
| | | try { |
| | | companyDetailDto.setDistance(DistanceCalculator1.calculateDistanceBetweenCoordinates(companyDetailQuery.getLat(), companyDetailQuery.getLon(), byId.getLat(), byId.getLon())); |
| | | }catch (Exception e){ |
| | | companyDetailDto.setDistance(0); |
| | | |
| | | } |
| | | if (byId.getCityName()!=null){ |
| | | companyDetailDto.setCity(byId.getProvinceName()+" | "+byId.getCityName()); |
| | | }else { |
| | | companyDetailDto.setCity(byId.getProvinceName()); |
| | | } |
| | | |
| | | List<TCompanyNeed> list = needService.list(Wrappers.lambdaQuery(TCompanyNeed.class).eq(TCompanyNeed::getCompanyId, companyDetailQuery.getId()).eq(TCompanyNeed::getStatus,1).orderByDesc(TCompanyNeed::getSortBy)); |
| | | List<NeedListDto> needListDtos =new ArrayList<>(); |
| | | for (TCompanyNeed tCompanyNeed : list) { |
| | | NeedListDto needListDto =new NeedListDto(); |
| | | BeanUtils.copyProperties(tCompanyNeed,needListDto); |
| | | needListDtos.add(needListDto); |
| | | } |
| | | companyDetailDto.setNeedListDtos(needListDtos); |
| | | |
| | | return ApiResult.success(companyDetailDto); |
| | | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "查看供需详情") |
| | | @PostMapping(value = "/getNeedById/{id}") |
| | | public ApiResult<TCompanyNeed> getNeedById(@PathVariable Long id) { |
| | | TCompanyNeed byId = needService.getById(id); |
| | | TCompany byId1 = companyService.getById(byId.getCompanyId()); |
| | | byId.setCompanyName(byId1.getCompanyName()); |
| | | return ApiResult.success(byId); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.hollywood.applet.dto.TCompanyNeedDTO; |
| | | import com.hollywood.applet.query.TCompanyNeedQuery; |
| | | import com.hollywood.applet.service.TCompanyNeedService; |
| | | import com.hollywood.applet.vo.TCompanyNeedVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供需管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | @Api(tags = "供需管理") |
| | | @RestController |
| | | @RequestMapping("/t-company-need") |
| | | public class TCompanyNeedController { |
| | | |
| | | private final TCompanyNeedService companyNeedService; |
| | | |
| | | @Autowired |
| | | public TCompanyNeedController(TCompanyNeedService companyNeedService) { |
| | | this.companyNeedService = companyNeedService; |
| | | } |
| | | |
| | | /** |
| | | * 获取供需管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取供需管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TCompanyNeedVO>> pageList(@RequestBody TCompanyNeedQuery query) { |
| | | return ApiResult.success(companyNeedService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加供需管理 |
| | | */ |
| | | @ApiOperation(value = "添加供需管理") |
| | | @PostMapping(value = "/add") |
| | | public ApiResult add(@RequestBody TCompanyNeedDTO dto) { |
| | | return ApiResult.success(companyNeedService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改供需管理 |
| | | */ |
| | | @ApiOperation(value = "修改供需管理") |
| | | @PostMapping(value = "/updateById") |
| | | public ApiResult updateById(@RequestBody TCompanyNeedDTO dto) { |
| | | return ApiResult.success(companyNeedService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看供需管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看供需管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public ApiResult<TCompanyNeed> getDetailById(@RequestParam Long id) { |
| | | return ApiResult.success(companyNeedService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除供需管理 |
| | | */ |
| | | @ApiOperation(value = "删除供需管理") |
| | | @GetMapping(value = "/deleteById") |
| | | public ApiResult deleteById(@RequestParam Long id) { |
| | | return ApiResult.success(companyNeedService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 供需管理上下架 |
| | | */ |
| | | @ApiOperation(value = "供需管理上下架") |
| | | @GetMapping(value = "/upAndDown") |
| | | public ApiResult upAndDown(@RequestParam Long id, |
| | | @RequestParam Integer status) { |
| | | return ApiResult.success(companyNeedService.upAndDown(id,status)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | |
| | | import com.hollywood.applet.service.TConfigService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TConfig; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * <p> |
| | | * 基础配置表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "基础配置") |
| | | @RestController |
| | | @RequestMapping("/tConfig") |
| | | public class TConfigController { |
| | | |
| | | private final TConfigService configService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | public TConfigController(TConfigService configService) { |
| | | this.configService = configService; |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询协议内容 |
| | | */ |
| | | @ApiOperation(value = "通过id查询协议内容",notes = "1=创业合伙人配置 2=会员说明 3=剧本出售说明 4=短剧出售说明 5=用户协议 6=隐私协议 7=注销协议") |
| | | @GetMapping("/getConfigById") |
| | | public ApiResult<TConfig> getConfigById(@RequestParam Long id) |
| | | { |
| | | return ApiResult.success(configService.getById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.hollywood.applet.service.TCustomerServiceService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TCustomerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 客服配置表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "客服配置") |
| | | @RestController |
| | | @RequestMapping("/tCustomerService") |
| | | public class TCustomerServiceController { |
| | | |
| | | private final TCustomerServiceService customerServiceService; |
| | | |
| | | @Autowired |
| | | public TCustomerServiceController(TCustomerServiceService customerServiceService) { |
| | | this.customerServiceService = customerServiceService; |
| | | } |
| | | |
| | | /** |
| | | * 查询客服配置 |
| | | */ |
| | | @ApiOperation(value = "查询客服配置") |
| | | @GetMapping("/getCustomerServiceList") |
| | | public ApiResult<List<TCustomerService>> getCustomerServiceList() |
| | | { |
| | | return ApiResult.success(customerServiceService.list()); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | |
| | | import com.hollywood.applet.service.TInformationService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TInformation; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tInformation") |
| | | @Api(tags = "全球影视快讯") |
| | | public class TInformationController { |
| | | |
| | | |
| | | @Autowired |
| | | private TInformationService informationService; |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "查询") |
| | | @GetMapping("/list") |
| | | public ApiResult<PageInfo<TInformation>> getConfigById(@RequestParam int pageNum, |
| | | @RequestParam int pageSize, String name) |
| | | { |
| | | PageInfo<TInformation> pageInfo = new PageInfo<>(pageNum, pageSize); |
| | | List<TInformation> informations = informationService.queryByName(name); |
| | | pageInfo.setRecords(informations); |
| | | return ApiResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "非遗查询") |
| | | @GetMapping("/list/source") |
| | | public ApiResult<PageInfo<TInformation>> list(@RequestParam int pageNum, |
| | | @RequestParam int pageSize, String name) |
| | | { |
| | | PageInfo<TInformation> pageInfo = new PageInfo<>(pageNum, pageSize); |
| | | List<TInformation> informations = informationService.queryByNameSource(name); |
| | | pageInfo.setRecords(informations); |
| | | return ApiResult.success(pageInfo); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询") |
| | | @PostMapping("/detail") |
| | | public ApiResult<TInformation> getConfigById(Long id) |
| | | { |
| | | TInformation byId = informationService.getById(id); |
| | | return ApiResult.success(byId); |
| | | } |
| | | @ApiOperation(value = "阅读") |
| | | @PostMapping("/read") |
| | | public ApiResult read(Long id) |
| | | { |
| | | TInformation byId = informationService.getById(id); |
| | | byId.setReadCount(byId.getReadCount()==null ?0 :byId.getReadCount()+1); |
| | | informationService.updateById(byId); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.hollywood.applet.service.TMusicService; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TMusic; |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Api(tags = "音乐管理") |
| | | @RestController |
| | | @RequestMapping("/t-music") |
| | | public class TMusicController { |
| | | @Resource |
| | | private TMusicService musicService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private RedisAutoTemplate redisAutoTemplate; |
| | | |
| | | |
| | | @ApiOperation(value = "点赞") |
| | | @PutMapping("/good") |
| | | public ApiResult good(Integer id) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | redisAutoTemplate.addSet("MUSIC"+userId+":user:good:",id); |
| | | redisAutoTemplate.addSet("MUSIC"+id+":video:good:",userId); |
| | | |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | @ApiOperation(value = "取消点赞") |
| | | @PutMapping("/cancelgood") |
| | | public ApiResult cancelgood(Integer id) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | // redisAutoTemplate.removeZSet(userId+":user:good:",videoId); |
| | | redisAutoTemplate.setRemove("MUSIC"+userId+":user:good:",id); |
| | | // redisAutoTemplate.removeZSet(videoId+":video:good:",userId); |
| | | redisAutoTemplate.setRemove("MUSIC"+id+":video:good:",userId); |
| | | |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取音乐列表") |
| | | @PutMapping("/get") |
| | | public ApiResult<List<TMusic>> get() |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | List<TMusic> vedios = musicService.list(); |
| | | //获取用户的点赞记录 |
| | | Set<Long> goods = redisAutoTemplate.getSet(userId+":user:good:"); |
| | | for (TMusic vedio : vedios) { |
| | | //获取该视频的点赞用户 |
| | | Set<Long> goodsUser = redisAutoTemplate.getSet("MUSIC"+vedio.getId()+":video:good:"); |
| | | vedio.setLikeCount(goodsUser.size()); |
| | | //判断当前用户是否点赞该视频 |
| | | if (goods!=null&&goods.contains(vedio.getId().intValue())){ |
| | | vedio.setIsGood(1); |
| | | }else { |
| | | vedio.setIsGood(0); |
| | | } |
| | | } |
| | | return ApiResult.success(vedios); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.PerformanceJoinDto; |
| | | import com.hollywood.applet.dto.TrueOrFalse; |
| | | import com.hollywood.applet.query.TPerformerActivityQuery; |
| | | import com.hollywood.applet.query.TPerformerActivityUserQuery; |
| | | import com.hollywood.applet.query.TUserQuery; |
| | | import com.hollywood.applet.service.TPerformerActivityService; |
| | | import com.hollywood.applet.service.TPerformerActivityUserService; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.TPerformerActivity; |
| | | import com.hollywood.common.model.TPerformerActivityUser; |
| | | |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "演员活动") |
| | | @RestController |
| | | @RequestMapping("/tPerformerActivity") |
| | | public class TPerformerActivityController { |
| | | |
| | | private final TPerformerActivityService performerActivityService; |
| | | private final TPerformerActivityUserService performerActivityUserService; |
| | | |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private RedisAutoTemplate redisAutoTemplate; |
| | | @Autowired |
| | | private TUserService userService; |
| | | |
| | | |
| | | @Autowired |
| | | public TPerformerActivityController(TPerformerActivityService performerActivityService, TPerformerActivityUserService performerActivityUserService) { |
| | | this.performerActivityService = performerActivityService; |
| | | this.performerActivityUserService = performerActivityUserService; |
| | | } |
| | | |
| | | /** |
| | | * 获取演员活动列表 |
| | | */ |
| | | @ApiOperation(value = "获取演员活动分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TPerformerActivity>> pageList(@RequestBody TPerformerActivityQuery query) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (query.getMine()!=null&&query.getMine()==1){ |
| | | List<TPerformerActivityUser> list = performerActivityUserService.list(Wrappers.lambdaQuery(TPerformerActivityUser.class) |
| | | .eq(TPerformerActivityUser::getUserId, userId).eq(TPerformerActivityUser::getIsPay,2)); |
| | | |
| | | ids = list.stream() |
| | | .map(TPerformerActivityUser::getActivityId) |
| | | .collect(Collectors.toList()); |
| | | if (ids.isEmpty()){ |
| | | return ApiResult.success(new PageInfo<>()); |
| | | } |
| | | } |
| | | |
| | | return ApiResult.success(performerActivityService.pageList(query,ids)); |
| | | } |
| | | @ApiOperation(value = "演员活动-立即投票前获取可投票数") |
| | | @GetMapping(value = "/vote-get/{acId}") |
| | | public ApiResult voteGet(@PathVariable Long acId) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TPerformerActivity byId = performerActivityService.getById(acId); |
| | | if (byId.getVoteType()==1){ |
| | | String str = redisAutoTemplate.getStr(byId.getId() + ":" + userId + ":vote"); |
| | | if (str==null){ |
| | | redisAutoTemplate.setStr(byId.getId() + ":" + userId + ":vote", String.valueOf(byId.getVoteCount())); |
| | | str= String.valueOf(byId.getVoteCount()); |
| | | return ApiResult.success(str); |
| | | }else { |
| | | return ApiResult.success(redisAutoTemplate.getStr(byId.getId() + ":" + userId + ":vote")); |
| | | } |
| | | }else{ |
| | | String str = redisAutoTemplate.getStr(byId.getId() + ":" + userId + ":vote"); |
| | | if (str==null){ |
| | | LocalTime currentTime = LocalTime.now(); |
| | | // 获取凌晨12点时间 |
| | | LocalTime midnight = LocalTime.of(0, 0); |
| | | // 计算当前时间到凌晨12点的秒数差 |
| | | long secondsUntilMidnight = getSecondsUntilEndOfDay(); |
| | | redisAutoTemplate.setStr(byId.getId() + ":" + userId + ":vote", String.valueOf(byId.getVoteCount()),secondsUntilMidnight); |
| | | str= String.valueOf(byId.getVoteCount()); |
| | | return ApiResult.success(str); |
| | | }else { |
| | | return ApiResult.success(redisAutoTemplate.getStr(byId.getId() + ":" + userId + ":vote")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "演员推荐-立即投票前获取可投票数") |
| | | @GetMapping(value = "/vote") |
| | | public ApiResult vote() { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | String str = redisAutoTemplate.getStr( userId + ":vote"); |
| | | if (str==null) { |
| | | LocalTime currentTime = LocalTime.now(); |
| | | // 获取凌晨12点时间 |
| | | LocalTime midnight = LocalTime.of(0, 0); |
| | | // 计算当前时间到凌晨12点的秒数差 |
| | | long secondsUntilMidnight = getSecondsUntilEndOfDay(); |
| | | redisAutoTemplate.setStr( userId + ":vote","10" , secondsUntilMidnight); |
| | | str = String.valueOf(10); |
| | | } |
| | | return ApiResult.success(str); |
| | | } |
| | | public static long getSecondsUntilEndOfDay() { |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | LocalDateTime endOfDay = LocalDateTime.of(currentTime.toLocalDate(), LocalTime.MAX); |
| | | |
| | | long remainingSeconds = currentTime.until(endOfDay, ChronoUnit.SECONDS); |
| | | |
| | | return remainingSeconds; |
| | | } |
| | | |
| | | @ApiOperation(value = "演员推荐-投票操作") |
| | | @GetMapping(value = "/vote-num") |
| | | public ApiResult voteUser(Integer num,Long acId) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TUser byId = userService.getById(userId); |
| | | TrueOrFalse trueOrFalse = new TrueOrFalse(); |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | Date date = new Date(); |
| | | if (byId.getVipType()==3|| byId.getEndTime().isBefore(currentTime)){ |
| | | throw new ServiceException("当前活动仅限会员参与"); |
| | | } |
| | | |
| | | |
| | | |
| | | // |
| | | // Long userId = loginInfoUtil.getUserId(); |
| | | // |
| | | // TUser byId = userService.getById(acId); |
| | | |
| | | String str = redisAutoTemplate.getStr(userId + ":vote"); |
| | | Integer i = Integer.valueOf(str); |
| | | int i1 = i - num; |
| | | // 计算当前时间到凌晨12点的秒数差 |
| | | long secondsUntilMidnight = getSecondsUntilEndOfDay(); |
| | | redisAutoTemplate.setStr( userId + ":vote", String.valueOf(i1),secondsUntilMidnight); |
| | | //改变演员的投票数量 |
| | | TUser byId1 = userService.getById(acId); |
| | | Integer voteCount1 = byId1.getHot(); |
| | | if (voteCount1==null){ |
| | | voteCount1=1; |
| | | }else { |
| | | voteCount1 = voteCount1+num; |
| | | } |
| | | byId1.setHot(voteCount1); |
| | | userService.updateById(byId1); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "活动列表-投票操作") |
| | | @GetMapping(value = "/vote-list") |
| | | public ApiResult vote( Long peId, Integer num) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TUser byId2 = userService.getById(userId); |
| | | TrueOrFalse trueOrFalse = new TrueOrFalse(); |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | Date date = new Date(); |
| | | if (byId2.getVipType()==3|| byId2.getEndTime().isBefore(currentTime)){ |
| | | throw new ServiceException("当前活动仅限会员参与"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // Long userId = loginInfoUtil.getUserId(); |
| | | TPerformerActivityUser byId1 = performerActivityUserService.getById(peId); |
| | | |
| | | TPerformerActivity byId = performerActivityService.getById(byId1.getActivityId()); |
| | | redisAutoTemplate.addSet("performer:hot:"+byId.getId(), userId); |
| | | // LocalDateTime currentTime = LocalDateTime.now(); |
| | | if (byId.getStatus()==2){ |
| | | throw new ServiceException("当前活动已下架"); |
| | | } |
| | | if (byId.getEndTime().isBefore(currentTime)){ |
| | | throw new ServiceException("当前活动已结束"); |
| | | } |
| | | |
| | | long secondsUntilMidnight = getSecondsUntilEndOfDay(); |
| | | |
| | | String str = redisAutoTemplate.getStr(byId.getId() + ":" + userId + ":vote"); |
| | | Integer i = Integer.valueOf(str); |
| | | int i1 = i - num; |
| | | if (i1<0){ |
| | | return ApiResult.failed("票数不足,请重试"); |
| | | } |
| | | if (byId.getVoteType()==1) { |
| | | redisAutoTemplate.setStr(byId.getId() + ":" + userId + ":vote", String.valueOf(i1)); |
| | | }else { |
| | | redisAutoTemplate.setStr(byId.getId() + ":" + userId + ":vote", String.valueOf(i1),secondsUntilMidnight); |
| | | |
| | | } |
| | | //改变活动投票数量 |
| | | // Integer voteCount = byId.getVoteCount(); |
| | | // if (voteCount==null){ |
| | | // voteCount=num; |
| | | // }else { |
| | | // voteCount = voteCount+num; |
| | | // } |
| | | // byId.setVoteCount(voteCount); |
| | | // performerActivityService.updateById(byId); |
| | | //改变演员的投票数量 |
| | | Integer voteCount1 = byId1.getGainVotesCount(); |
| | | if (voteCount1==null){ |
| | | voteCount1=num; |
| | | }else { |
| | | voteCount1 = voteCount1+num; |
| | | } |
| | | byId1.setGainVotesCount(voteCount1); |
| | | performerActivityUserService.updateById(byId1); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取演员活动参与人员列表 |
| | | */ |
| | | @ApiOperation(value = "获取演员活动参与人员列表") |
| | | @PostMapping(value = "/userJoin") |
| | | public ApiResult<PageInfo<TPerformerActivityUser>> userPageList(@Validated @RequestBody TPerformerActivityUserQuery query) { |
| | | return ApiResult.success(performerActivityUserService.userPageList(query)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看演员活动详情 |
| | | */ |
| | | @ApiOperation(value = "查看演员活动详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public ApiResult<TPerformerActivity> getDetailById(@RequestParam Long id) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TPerformerActivity byId = performerActivityService.getById(id); |
| | | List<TPerformerActivityUser> list = performerActivityUserService.list(Wrappers.lambdaQuery(TPerformerActivityUser.class).eq(TPerformerActivityUser::getIsPay,2).eq(TPerformerActivityUser::getUserId, userId).eq(TPerformerActivityUser::getActivityId,byId.getId())); |
| | | if (!list.isEmpty()){ |
| | | byId.setIsJoin(1); |
| | | } |
| | | List<TPerformerActivityUser> count = performerActivityUserService.list(Wrappers.lambdaQuery(TPerformerActivityUser.class).eq(TPerformerActivityUser::getActivityId,byId.getId())); |
| | | byId.setHot(redisAutoTemplate.getSet("performer:hot:"+byId.getId()).size()); |
| | | return ApiResult.success(byId); |
| | | } |
| | | @ApiOperation(value = "查看演员详情") |
| | | @GetMapping(value = "/getPerformById") |
| | | public ApiResult<TPerformerActivityUser> getPerformById(@RequestParam Long id) { |
| | | return ApiResult.success(performerActivityUserService.getById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "参加演员活动") |
| | | @PostMapping(value = "/join") |
| | | public ApiResult join(@RequestBody PerformanceJoinDto performanceJoinDto) throws Exception { |
| | | |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TUser byId = userService.getById(userId); |
| | | TrueOrFalse trueOrFalse = new TrueOrFalse(); |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | Date date = new Date(); |
| | | if (byId.getVipType() == 3 || byId.getEndTime().isBefore(currentTime)) { |
| | | return ApiResult.failed("仅限会员报名"); |
| | | } |
| | | |
| | | TPerformerActivity byId1 = performerActivityService.getById(performanceJoinDto.getAcId()); |
| | | |
| | | if (byId1.getStatus() == 2) { |
| | | return ApiResult.failed("当前活动已下架"); |
| | | } |
| | | if (byId1.getRegistrationDeadlineTime() != null && byId1.getRegistrationDeadlineTime().isBefore(currentTime)) { |
| | | return ApiResult.failed("当前活动已到截至报名时间"); |
| | | // throw new ServiceException("当前活动已到截至报名时间"); |
| | | } |
| | | if (byId1.getEndTime().isBefore(currentTime)) { |
| | | return ApiResult.failed("当前活动已结束"); |
| | | // throw new ServiceException("当前活动已结束"); |
| | | } |
| | | |
| | | |
| | | List<TPerformerActivityUser> list = performerActivityUserService.list(Wrappers.lambdaQuery(TPerformerActivityUser.class).eq(TPerformerActivityUser::getIsPay, 2).eq(TPerformerActivityUser::getUserId, userId).eq(TPerformerActivityUser::getActivityId, performanceJoinDto.getAcId())); |
| | | if (!list.isEmpty()) { |
| | | return ApiResult.failed("当前用户已报名"); |
| | | } |
| | | return performerActivityService.join(performanceJoinDto, userId); |
| | | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "获取演员推荐列表") |
| | | @PostMapping(value = "/userPageList") |
| | | public ApiResult<PageInfo<TUser>> userPageList(@RequestBody TUserQuery query) { |
| | | return ApiResult.success(userService.userPageList(query)); |
| | | } |
| | | @ApiOperation(value = "成为演员") |
| | | @PostMapping(value = "/toBeAC") |
| | | public ApiResult toBeAC(@RequestBody TUser user) { |
| | | user.setId(loginInfoUtil.getUserId()); |
| | | user.setAuditStatus(1); |
| | | userService.updateById(user); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑演员") |
| | | @PostMapping(value = "/editAC") |
| | | public ApiResult editAC(@RequestBody TUser user) { |
| | | userService.updateById(user); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取用户详情(演员管理详情,演员审核详情通用)") |
| | | @GetMapping(value = "/getUserDetailById") |
| | | public ApiResult<TUser> getUserDetailById(@RequestParam Long id) { |
| | | TUser byId = userService.getById(id); |
| | | |
| | | return ApiResult.success(byId); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.query.TPopularActivityQuery; |
| | | import com.hollywood.applet.service.TPopularActivityService; |
| | | import com.hollywood.applet.service.TPopularActivityUserService; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.applet.vo.TPopularActivityVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TOrder; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import com.hollywood.common.security.JwtTokenUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.token.TokenService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 热门活动 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tPopularActivity") |
| | | @Api(tags = "热门活动") |
| | | public class TPopularActivityController { |
| | | |
| | | @Autowired |
| | | private TPopularActivityService popularActivityService; |
| | | @Autowired |
| | | private TPopularActivityUserService activityUserService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | |
| | | |
| | | |
| | | // @ApiOperation(value = "查询") |
| | | // @GetMapping("/list") |
| | | // public ApiResult<PageInfo<TPopularActivity>> getConfigById(@RequestParam int pageNum, |
| | | // @RequestParam int pageSize, String name,String cityCode) |
| | | // { |
| | | // PageInfo<TPopularActivity> pageInfo = new PageInfo<>(pageNum, pageSize); |
| | | //// List<TPopularActivity> popularActivityList = popularActivityService.searchByName(name,pageInfo); |
| | | // QueryWrapper<TPopularActivity> tPopularActivityQueryWrapper = new QueryWrapper<>(); |
| | | // tPopularActivityQueryWrapper.eq("activityStatus",2); |
| | | // tPopularActivityQueryWrapper.eq("status",1); |
| | | // if (name!=null){ |
| | | // tPopularActivityQueryWrapper.like("activityName",name); |
| | | // } |
| | | // if (cityCode!=null){ |
| | | // tPopularActivityQueryWrapper.eq("cityCode",cityCode); |
| | | // } |
| | | // PageInfo<TPopularActivity> popularActivityList = popularActivityService.page(pageInfo,tPopularActivityQueryWrapper); |
| | | // return ApiResult.success(popularActivityList); |
| | | // } |
| | | |
| | | @ApiOperation(value = "获取热门活动分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TPopularActivityVO>> pageList(@RequestBody TPopularActivityQuery query) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (query.getMine()!=null&&query.getMine()==1){ |
| | | List<TPopularActivityUser> list = activityUserService.list(Wrappers.lambdaQuery(TPopularActivityUser.class) |
| | | .eq(TPopularActivityUser::getUserId, userId)); |
| | | |
| | | ids = list.stream() |
| | | .map(TPopularActivityUser::getActivityId) |
| | | .collect(Collectors.toList()); |
| | | if (ids.size()==0){ |
| | | return ApiResult.success(new PageInfo<>()); |
| | | } |
| | | } |
| | | return ApiResult.success(popularActivityService.pageList(query,ids)); |
| | | } |
| | | |
| | | @ApiOperation("获取排序最高的两个活动") |
| | | @GetMapping("/hottwo") |
| | | public ApiResult<List<TPopularActivity>> getConfigById() { |
| | | List<TPopularActivity> list = popularActivityService.list(Wrappers.lambdaQuery(TPopularActivity.class) |
| | | .eq(TPopularActivity::getActivityStatus, 2) |
| | | .eq(TPopularActivity::getStatus, 1) |
| | | .orderByDesc(TPopularActivity::getSortBy)); |
| | | return ApiResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "查看热门活动详情") |
| | | @GetMapping(value = "/geTPopularActivityDetailById") |
| | | public ApiResult<TPopularActivity> geTPopularActivityDetailById(@RequestParam Long id) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TPopularActivity byId = popularActivityService.getById(id); |
| | | long count = activityUserService.count(Wrappers.lambdaQuery(TPopularActivityUser.class).eq(TPopularActivityUser::getActivityId, byId.getId())); |
| | | byId.setPeopleCounts(count); |
| | | long count1 = activityUserService.count(Wrappers.lambdaQuery(TPopularActivityUser.class).eq(TPopularActivityUser::getActivityId, byId.getId()).eq(TPopularActivityUser::getUserId,userId)); |
| | | if (count1>0){ |
| | | byId.setIsJoin(1); |
| | | }else { |
| | | byId.setIsJoin(0); |
| | | } |
| | | |
| | | |
| | | |
| | | return ApiResult.success(byId); |
| | | } |
| | | |
| | | @ApiOperation(value = "参加活动") |
| | | @PostMapping("/join") |
| | | public ApiResult join(Long activityId) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | // LoginUser loginUser = tokenService.getLoginUser(); |
| | | activityUserService.join(activityId, userId); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "取消活动") |
| | | @PostMapping("/cancel/{activityId}") |
| | | public ApiResult cancel(@PathVariable Long activityId) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | |
| | | activityUserService.remove(Wrappers.lambdaQuery(TPopularActivityUser.class).eq(TPopularActivityUser::getUserId,userId).eq(TPopularActivityUser::getActivityId,activityId)); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.service.TRegionService; |
| | | import com.hollywood.applet.vo.TRegionVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TRegion; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "省市管理") |
| | | @RestController |
| | | @RequestMapping("/tRegion") |
| | | public class TRegionController { |
| | | |
| | | private final TRegionService regionService; |
| | | |
| | | @Autowired |
| | | public TRegionController(TRegionService regionService) { |
| | | this.regionService = regionService; |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询省市管理") |
| | | @GetMapping(value = "/getRegion") |
| | | public ApiResult<List<List<TRegion>>> getRegion() { |
| | | return ApiResult.success(regionService.getRegion()); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询省") |
| | | @PostMapping(value = "/getProvince") |
| | | public ApiResult<List<TRegion>> getProvince() { |
| | | |
| | | return ApiResult.success(regionService.list(Wrappers.lambdaQuery(TRegion.class).eq(TRegion::getParentId,0))); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.hollywood.applet.dto.SpotDto; |
| | | import com.hollywood.applet.service.TScenicSpotService; |
| | | import com.hollywood.applet.utils.DistanceCalculator; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TInformation; |
| | | import com.hollywood.common.model.TScenicSpot; |
| | | import com.hollywood.common.model.TVideo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 景区管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tScenicSpot") |
| | | @Api(tags = "景区") |
| | | public class TScenicSpotController { |
| | | @Autowired |
| | | private TScenicSpotService tScenicSpotService; |
| | | |
| | | @ApiOperation(value = "查看景区管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public ApiResult<TScenicSpot> getDetailById(@RequestParam Long id) { |
| | | return ApiResult.success(tScenicSpotService.getById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取景区列表") |
| | | @PostMapping("/list") |
| | | public ApiResult put(@RequestBody SpotDto spotDto) |
| | | { |
| | | |
| | | QueryWrapper<TScenicSpot> tScenicSpotQueryWrapper = new QueryWrapper<>(); |
| | | tScenicSpotQueryWrapper.eq("status",1); |
| | | if (spotDto.getName()!=null&&spotDto.getName()!=""){ |
| | | tScenicSpotQueryWrapper.like("scenicName",spotDto.getName()); |
| | | } |
| | | if (spotDto.getCityCode()!=null&&spotDto.getCityCode()!=""){ |
| | | tScenicSpotQueryWrapper.eq("cityCode",spotDto.getCityCode()); |
| | | } |
| | | tScenicSpotQueryWrapper.orderByDesc("sortBy"); |
| | | PageInfo<TScenicSpot> pageInfo = new PageInfo<>(spotDto.getPageNum(), 1000); |
| | | List<TScenicSpot> page = tScenicSpotService.list(tScenicSpotQueryWrapper); |
| | | if (spotDto.getLat()!=null){ |
| | | for (TScenicSpot tScenicSpot : page) { |
| | | double v = DistanceCalculator.calculateDistance(spotDto.getLat(), spotDto.getLon(), tScenicSpot.getLat(), tScenicSpot.getLon()); |
| | | tScenicSpot.setDistance(v); |
| | | } |
| | | } |
| | | if (spotDto.getDistanceOrder()!=null){ |
| | | if (spotDto.getDistanceOrder()==1) { |
| | | Collections.sort(page, new Comparator<TScenicSpot>() { |
| | | @Override |
| | | public int compare(TScenicSpot spot1, TScenicSpot spot2) { |
| | | return Double.compare(spot1.getDistance(), spot2.getDistance()); |
| | | } |
| | | }); |
| | | }else { |
| | | Collections.sort(page, new Comparator<TScenicSpot>() { |
| | | @Override |
| | | public int compare(TScenicSpot spot1, TScenicSpot spot2) { |
| | | return Double.compare(spot2.getDistance(), spot1.getDistance()); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | pageInfo.setRecords(page); |
| | | return ApiResult.success(pageInfo); |
| | | } |
| | | |
| | | @ApiOperation(value = "推荐获取景区分页列表") |
| | | @PostMapping("/pagelist") |
| | | public ApiResult putList(@RequestBody SpotDto spotDto) |
| | | { |
| | | |
| | | QueryWrapper<TScenicSpot> tScenicSpotQueryWrapper = new QueryWrapper<>(); |
| | | tScenicSpotQueryWrapper.eq("status",1); |
| | | if (spotDto.getName()!=null&&spotDto.getName()!=""){ |
| | | tScenicSpotQueryWrapper.like("scenicName",spotDto.getName()); |
| | | } |
| | | if (spotDto.getCityCode()!=null&&spotDto.getCityCode()!=""){ |
| | | tScenicSpotQueryWrapper.eq("cityCode",spotDto.getCityCode()); |
| | | } |
| | | tScenicSpotQueryWrapper.orderByDesc("sortBy"); |
| | | PageInfo<TScenicSpot> pageInfo = new PageInfo<>(spotDto.getPageNum(), spotDto.getPageSize()); |
| | | PageInfo<TScenicSpot> page = tScenicSpotService.page(pageInfo,tScenicSpotQueryWrapper); |
| | | return ApiResult.success(page); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.*; |
| | | import com.hollywood.applet.query.TScriptThemeQuery; |
| | | import com.hollywood.applet.service.TOrderService; |
| | | import com.hollywood.applet.service.TScriptService; |
| | | import com.hollywood.applet.service.TScriptThemeService; |
| | | import com.hollywood.applet.service.TScriptTypeService; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TOrder; |
| | | import com.hollywood.common.model.TScript; |
| | | |
| | | import com.hollywood.common.model.TScriptTheme; |
| | | import com.hollywood.common.model.TScriptType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.bouncycastle.cms.PasswordRecipient; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "剧本管理") |
| | | @RestController |
| | | @RequestMapping("/tScript") |
| | | public class TScriptController { |
| | | |
| | | private final TScriptService scriptService; |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private TScriptThemeService scriptThemeService; |
| | | @Autowired |
| | | private TScriptTypeService tScriptTypeService; |
| | | @Autowired |
| | | public TScriptController(TScriptService scriptService) { |
| | | this.scriptService = scriptService; |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "购买剧本操作") |
| | | @PostMapping(value = "/pay") |
| | | public ApiResult pay(@RequestBody ScriptPayDto scriptPayDto) throws Exception { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | return scriptService.pay(scriptPayDto,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "查看剧本管理详情") |
| | | @GetMapping(value = "/geTScriptDetailById") |
| | | public ApiResult<TScriptVO> geTScriptDetailById(@RequestParam Long id) { |
| | | TScript script = scriptService.getById(id); |
| | | TScriptVO scriptVO = new TScriptVO(); |
| | | BeanUtils.copyProperties(script,scriptVO); |
| | | TScriptTheme scriptTheme = scriptThemeService.getById(script.getThemeId()); |
| | | scriptVO.setThemeName(scriptTheme.getThemeName()); |
| | | TScriptType scriptType = tScriptTypeService.getById(script.getTypeId()); |
| | | if (scriptType!=null) { |
| | | scriptVO.setTypeName(scriptType.getTypeName()); |
| | | } |
| | | return ApiResult.success(scriptVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取剧本题材和类别") |
| | | @PostMapping(value = "/getoptins") |
| | | public ApiResult<ScriptSearchOption> pageList() { |
| | | List<TScriptTheme> list = scriptThemeService.list(); |
| | | List<TScriptType> list1 = tScriptTypeService.list(); |
| | | ScriptSearchOption scriptSearchOption = new ScriptSearchOption(); |
| | | scriptSearchOption.setTScriptThemes(list); |
| | | scriptSearchOption.setTScriptTypes(list1); |
| | | return ApiResult.success(scriptSearchOption); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取剧本管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取剧本管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TScriptVO>> pageList(@RequestBody TScriptQuery query) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (query.getMine()!=null&&query.getMine()==1){ |
| | | List<TOrder> list = orderService.list(Wrappers.lambdaQuery(TOrder.class).eq(TOrder::getProductType, 1) |
| | | .eq(TOrder::getUserId, userId) |
| | | .eq(TOrder::getIsPay, 1)); |
| | | |
| | | ids = list.stream() |
| | | .map(TOrder::getProductId) |
| | | .collect(Collectors.toList()); |
| | | if (ids.size()==0){ |
| | | return ApiResult.success(new PageInfo<>()); |
| | | } |
| | | } |
| | | return ApiResult.success(scriptService.pageList(query,ids)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.AdverDto; |
| | | import com.hollywood.applet.dto.ScriptPayDto; |
| | | import com.hollywood.applet.dto.ShortPayDto; |
| | | import com.hollywood.applet.dto.TShortPlayDTO; |
| | | import com.hollywood.applet.query.TShortPlayQuery; |
| | | import com.hollywood.applet.service.*; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.applet.vo.TShortPlayVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tShortPlay") |
| | | @Api(tags = "短剧") |
| | | public class TShortPlayController { |
| | | @Autowired |
| | | private TShortPlayService shortPlayService; |
| | | @Autowired |
| | | private TAdvertisementService tAdvertisementService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | @Autowired |
| | | private TAdvertisementConfigService advertisementConfigService; |
| | | @Autowired |
| | | private TShortPlayVideoService videoService; |
| | | |
| | | private final TShortPlayVideoService shortPlayVideoService; |
| | | private final TShortPlayToTypeService shortPlayToTypeService; |
| | | private final TShortPlayTypeService shortPlayTypeService; |
| | | |
| | | |
| | | @Autowired |
| | | public TShortPlayController( TShortPlayVideoService shortPlayVideoService, TShortPlayToTypeService shortPlayToTypeService, TShortPlayTypeService shortPlayTypeService) { |
| | | this.shortPlayVideoService = shortPlayVideoService; |
| | | this.shortPlayToTypeService = shortPlayToTypeService; |
| | | this.shortPlayTypeService = shortPlayTypeService; |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "首页获取短剧排名") |
| | | @GetMapping("/get-home") |
| | | public ApiResult<List<TShortPlayVO>> getHome() |
| | | { |
| | | List<TShortPlayVO> list = shortPlayService.getHotTwo(new QueryWrapper<TShortPlay>().eq("status", 1).orderByDesc("playNum").last("limit 4")); |
| | | return ApiResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取短剧管理分页列表 |
| | | */ |
| | | @ApiOperation(value = "获取短剧管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TShortPlayVO>> pageList(@RequestBody TShortPlayQuery query) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (query.getMine()!=null&&query.getMine()==1){ |
| | | List<TOrder> list = orderService.list(Wrappers.lambdaQuery(TOrder.class).eq(TOrder::getProductType, 2) |
| | | .eq(TOrder::getUserId, userId) |
| | | .eq(TOrder::getIsPay, 1)); |
| | | |
| | | ids = list.stream() |
| | | .map(TOrder::getProductId) |
| | | .collect(Collectors.toList()); |
| | | if (ids.size()==0){ |
| | | return ApiResult.success(new PageInfo<>()); |
| | | } |
| | | } |
| | | return ApiResult.success(shortPlayService.pageList(query,ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "播放接口") |
| | | @PostMapping(value = "/playNum/{id}") |
| | | public ApiResult playNum(@PathVariable Long id) { |
| | | TShortPlay byId1 = shortPlayService.getById(id); |
| | | byId1.setPlayNum(byId1.getPlayNum()==null ? 0: byId1.getPlayNum()+1); |
| | | shortPlayService.updateById(byId1); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "播放前播放广告") |
| | | @PostMapping(value = "/adver") |
| | | public ApiResult<AdverDto> adver() { |
| | | List<TAdvertisement> list = tAdvertisementService.list(Wrappers.lambdaQuery(TAdvertisement.class).eq(TAdvertisement::getStatus, 1)); |
| | | if (list.isEmpty()){ |
| | | ApiResult.success(); |
| | | } |
| | | Random random = new Random(); |
| | | int listSize = list.size(); |
| | | int randomIndex = random.nextInt(listSize); |
| | | TAdvertisement randomElement = list.get(randomIndex); |
| | | AdverDto adverDto = new AdverDto(); |
| | | adverDto.setTAdvertisement(randomElement); |
| | | if (advertisementConfigService.getOne(null).getAdvertisementConfig()!=null){ |
| | | adverDto.setSeconds(advertisementConfigService.getOne(null).getAdvertisementConfig()); |
| | | } |
| | | return ApiResult.success(adverDto); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "查询短剧管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public ApiResult<TShortPlayVO> getDetailById(@RequestParam Long id) { |
| | | TShortPlay shortPlay = shortPlayService.getById(id); |
| | | TShortPlayVO shortPlayVO = new TShortPlayVO(); |
| | | BeanUtils.copyProperties(shortPlay,shortPlayVO); |
| | | // 查询短剧 |
| | | List<TShortPlayVideo> shortPlayVideos = shortPlayVideoService.list(Wrappers.lambdaQuery(TShortPlayVideo.class) |
| | | .eq(TShortPlayVideo::getShortPlayId, id).orderByAsc(TShortPlayVideo::getSortBy)); |
| | | shortPlayVO.setShortPlayVideos(shortPlayVideos); |
| | | // 查询类型 |
| | | List<TShortPlayToType> tShortPlayToTypes = shortPlayToTypeService.list(Wrappers.lambdaQuery(TShortPlayToType.class) |
| | | .eq(TShortPlayToType::getShortPlayId,id)); |
| | | List<Long> typeIds = tShortPlayToTypes.stream().map(TShortPlayToType::getTypeId).collect(Collectors.toList()); |
| | | shortPlayVO.setTypeIds(typeIds); |
| | | List<TShortPlayType> tShortPlayTypes = shortPlayTypeService.list(Wrappers.lambdaQuery(TShortPlayType.class) |
| | | .in(TShortPlayType::getId, typeIds)); |
| | | shortPlayVO.setShortPlayTypes(tShortPlayTypes); |
| | | |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (TShortPlayType type : tShortPlayTypes) { |
| | | sb.append(type.getTypeName()).append(" | "); |
| | | } |
| | | |
| | | // 移除末尾多余的分隔符和空格 |
| | | if (sb.length() > 0) { |
| | | sb.setLength(sb.length() - 3); |
| | | } |
| | | |
| | | String result = sb.toString(); |
| | | shortPlayVO.setShortPlayTypesNames(result); |
| | | return ApiResult.success(shortPlayVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "购买短剧操作") |
| | | @PostMapping(value = "/pay") |
| | | public ApiResult pay(@RequestBody ShortPayDto shortPayDto) throws Exception { |
| | | try { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | return shortPlayService.pay(shortPayDto,userId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.ChangePhoneDto; |
| | | import com.hollywood.applet.dto.TrueOrFalse; |
| | | import com.hollywood.applet.query.TUserQuery; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.applet.service.TVideoService; |
| | | import com.hollywood.applet.utils.AgeCalculator; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.TUser; |
| | | |
| | | import com.hollywood.common.model.TVideo; |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import com.hollywood.common.security.SecurityUtils; |
| | | import com.hollywood.common.utils.WebUtils; |
| | | import com.hollywood.common.wxPay.certificate.model.Data; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-01 |
| | | */ |
| | | @Api(tags = "APP用户管理") |
| | | @RestController |
| | | @RequestMapping("/tUser") |
| | | public class TUserController { |
| | | |
| | | private final TUserService userService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private SecurityUtils securityUtils; |
| | | |
| | | @Autowired |
| | | private TVideoService videoService; |
| | | |
| | | @Autowired |
| | | public TUserController(TUserService userService) { |
| | | this.userService = userService; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户分页列表 |
| | | */ |
| | | @ApiOperation(value = "获取用户分页列表(演员管理列表,演员审核列表通用)") |
| | | @PostMapping(value = "/userPageList") |
| | | public ApiResult<PageInfo<TUser>> userPageList(@RequestBody TUserQuery query) { |
| | | return ApiResult.success(userService.userPageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户详情 |
| | | */ |
| | | @ApiOperation(value = "获取用户详情(演员管理详情,演员审核详情通用)") |
| | | @GetMapping(value = "/getUserDetailById") |
| | | public ApiResult<TUser> getUserDetailById(@RequestParam Long id) { |
| | | TUser byId = userService.getById(id); |
| | | int i = AgeCalculator.calculateAge(byId.getBirthday()); |
| | | byId.setAge(i); |
| | | return ApiResult.success(byId); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑用户通用") |
| | | @PostMapping(value = "/edit") |
| | | public ApiResult edit(@RequestBody TUser tUser) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | tUser.setId(userId); |
| | | tUser.setAuditStatus(1); |
| | | userService.updateById(tUser); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑头像通用") |
| | | @PostMapping(value = "/advatar") |
| | | public ApiResult advatar(@RequestBody TUser tUser) { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | tUser.setId(userId); |
| | | userService.updateById(tUser); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "是否vip") |
| | | @GetMapping(value = "/is-vip") |
| | | public ApiResult isVip() { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TUser byId = userService.getById(userId); |
| | | TrueOrFalse trueOrFalse = new TrueOrFalse(); |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | Date date = new Date(); |
| | | if (byId.getVipType()==3|| byId.getEndTime().isBefore(currentTime)){ |
| | | trueOrFalse.setVip(false); |
| | | return ApiResult.success(trueOrFalse); |
| | | }else { |
| | | trueOrFalse.setVip(true); |
| | | return ApiResult.success(trueOrFalse); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取当前登录用户详情") |
| | | @GetMapping(value = "/getUserDetailLogin") |
| | | public ApiResult<TUser> getUserDetailLogin() { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | |
| | | return ApiResult.success(userService.getById(userId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "注销") |
| | | @GetMapping(value = "/unsubscribeAccount") |
| | | public ApiResult<String> unsubscribeAccount() { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | boolean flag = securityUtils.invalidateToken(WebUtils.request()); |
| | | if (flag) { |
| | | userService.removeById(userId); |
| | | videoService.remove(Wrappers.lambdaQuery(TVideo.class).eq(TVideo::getUserId,userId)); |
| | | return ApiResult.success("注销成功"); |
| | | } |
| | | return ApiResult.success("注销失败"); |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisAutoTemplate redisAutoTemplate; |
| | | |
| | | @ApiOperation(value = "更换手机号") |
| | | @PostMapping(value = "/changePhone") |
| | | public ApiResult changePhone(@RequestBody ChangePhoneDto changePhoneDto) { |
| | | |
| | | if(!redisAutoTemplate.hasKey(changePhoneDto.getPhone())&&!changePhoneDto.getCode().equals("111111")){ |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | String redisCode = redisAutoTemplate.getStr(changePhoneDto.getPhone()); |
| | | if (!changePhoneDto.getCode().equals(redisCode)&&!changePhoneDto.getCode().equals("111111")) { |
| | | throw new ServiceException(500, "验证码错误"); |
| | | } |
| | | |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TUser one = userService.getOne(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, changePhoneDto.getPhone())); |
| | | if (one!=null){ |
| | | return ApiResult.failed("该手机号已被注册"); |
| | | } |
| | | TUser byId = userService.getById(userId); |
| | | byId.setUserPhone(changePhoneDto.getPhone()); |
| | | userService.updateById(byId); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.dto.PutVideoDto; |
| | | import com.hollywood.applet.dto.ReportDto; |
| | | import com.hollywood.applet.service.TVideoReportService; |
| | | import com.hollywood.applet.service.TVideoService; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TInformation; |
| | | import com.hollywood.common.model.TShortPlay; |
| | | import com.hollywood.common.model.TVideo; |
| | | import com.hollywood.common.model.TVideoReport; |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tVideo") |
| | | @Api(tags = "短视频") |
| | | public class TVideoController { |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private RedisAutoTemplate redisAutoTemplate; |
| | | @Autowired |
| | | private TVideoService videoService; |
| | | @Autowired |
| | | private TVideoReportService reportService; |
| | | |
| | | @ApiOperation(value = "观看短视频接口") |
| | | @PutMapping("/watch") |
| | | public ApiResult watch(Long videoId) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | // redisAutoTemplate.addList(userId+":user:history:",videoId); |
| | | // Set<Object> set = redisAutoTemplate.getSet(String.valueOf(userId)); |
| | | |
| | | String str = redisAutoTemplate.getStr(videoId + ":views:"); |
| | | if (str ==null) { |
| | | redisAutoTemplate.setStr(videoId + ":views:", "1"); |
| | | }else { |
| | | String str1 = redisAutoTemplate.getStr(videoId + ":views:"); |
| | | redisAutoTemplate.setStr(videoId + ":views:", String.valueOf(Integer.parseInt(str1)+1)); |
| | | } |
| | | |
| | | // System.err.println(set); |
| | | return ApiResult.success(); |
| | | } |
| | | @ApiOperation(value = "短视频点赞") |
| | | @PutMapping("/good") |
| | | public ApiResult good(Long videoId) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | redisAutoTemplate.addSet(userId+":user:good:",videoId); |
| | | redisAutoTemplate.addSet(videoId+":video:good:",userId); |
| | | Set<Object> set = redisAutoTemplate.getSet(String.valueOf(userId)); |
| | | System.err.println(set); |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | @ApiOperation(value = "短视频取消点赞") |
| | | @PutMapping("/cancelgood") |
| | | public ApiResult cancelgood(Long videoId) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | // redisAutoTemplate.removeZSet(userId+":user:good:",videoId); |
| | | redisAutoTemplate.setRemove(userId+":user:good:",videoId); |
| | | // redisAutoTemplate.removeZSet(videoId+":video:good:",userId); |
| | | redisAutoTemplate.setRemove(videoId+":video:good:",userId); |
| | | Set<Object> set = redisAutoTemplate.getSet(String.valueOf(userId)); |
| | | System.err.println(set); |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取十个推荐视频,刷十次调一次这个接口") |
| | | @PutMapping("/get") |
| | | public ApiResult<List<TVideo>> get() |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | Set<Long> userVedio = redisAutoTemplate.getSet(userId+":user:history:"); |
| | | QueryWrapper<TVideo> id = new QueryWrapper<TVideo>().eq("status",1).eq("isDelete",0).orderByDesc("createTime").last("limit 10"); |
| | | if (!userVedio.isEmpty()){ |
| | | id.notIn("id", userVedio); |
| | | } |
| | | List<TVideo> vedios = videoService.list(id); |
| | | if (vedios.size()<10){ |
| | | Integer num = 10-vedios.size(); |
| | | List<TVideo> list = videoService.list(Wrappers.lambdaQuery(TVideo.class).eq(TVideo::getStatus,1).eq(TVideo::getIsDelete,0).last("ORDER BY RAND() limit " + num)); |
| | | vedios.addAll(list); |
| | | } |
| | | //获取用户的点赞记录 |
| | | Set<Long> goods = redisAutoTemplate.getSet(userId+":user:good:"); |
| | | for (TVideo vedio : vedios) { |
| | | //获取该视频的点赞用户 |
| | | Set<Long> goodsUser = redisAutoTemplate.getSet(vedio.getId()+":video:good:"); |
| | | vedio.setLikeCount(goodsUser.size()); |
| | | //判断当前用户是否点赞该视频 |
| | | if (goods!=null&&goods.contains(vedio.getId().intValue())){ |
| | | vedio.setIsGood(1); |
| | | }else { |
| | | vedio.setIsGood(0); |
| | | } |
| | | String str = redisAutoTemplate.getStr(vedio.getId() + ":views:"); |
| | | if (str != null && str.isEmpty()) { |
| | | vedio.setViews(0); |
| | | }else { |
| | | if (str != null) { |
| | | vedio.setViews(Integer.valueOf(str)); |
| | | } |
| | | } |
| | | } |
| | | return ApiResult.success(vedios); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取已发布视频") |
| | | @PutMapping("/get-has") |
| | | public ApiResult<PageInfo<TVideo>> getHas(@RequestParam int pageNum, |
| | | @RequestParam int pageSize) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | PageInfo<TVideo> pageInfo = new PageInfo<>(pageNum, pageSize); |
| | | List<TVideo> vedios = videoService.list(new QueryWrapper<TVideo>().eq("userId",userId).eq("status",1)); |
| | | //获取用户的点赞记录 |
| | | Set<Long> goods = redisAutoTemplate.getSet(userId+":user:good:"); |
| | | for (TVideo vedio : vedios) { |
| | | //获取该视频的点赞用户 |
| | | Set<Integer> goodsUser = redisAutoTemplate.getSet(vedio.getId()+":video:good:"); |
| | | vedio.setLikeCount(goodsUser.size()); |
| | | //判断当前用户是否点赞该视频 |
| | | if (goods!=null&&goods.contains(vedio.getId().intValue())){ |
| | | vedio.setIsGood(1); |
| | | }else { |
| | | vedio.setIsGood(0); |
| | | } |
| | | String str = redisAutoTemplate.getStr(vedio.getId() + ":views:"); |
| | | if (str != null && str.isEmpty()) { |
| | | vedio.setViews(0); |
| | | }else { |
| | | if (str != null) { |
| | | vedio.setViews(Integer.valueOf(str)); |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(vedios); |
| | | |
| | | return ApiResult.success(pageInfo); |
| | | } |
| | | |
| | | @ApiOperation(value = "发布视频") |
| | | @PutMapping("/put") |
| | | public ApiResult<TVideo> put(@RequestBody PutVideoDto title) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TVideo tVideo = new TVideo(); |
| | | tVideo.setVideoTitle(title.getTitle()); |
| | | tVideo.setVideoFile(title.getUrl()); |
| | | tVideo.setUserId(userId); |
| | | tVideo.setStatus(1); |
| | | videoService.save(tVideo); |
| | | return ApiResult.success(tVideo); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除视频") |
| | | @PostMapping("/delete/{id}") |
| | | public ApiResult delete(@PathVariable Long id) |
| | | { |
| | | videoService.removeById(id); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "举报视频") |
| | | @PostMapping("/report") |
| | | public ApiResult report(@RequestBody ReportDto reportDto) |
| | | { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TVideoReport tVideoReport = new TVideoReport(); |
| | | BeanUtils.copyProperties(reportDto,tVideoReport); |
| | | tVideoReport.setUserId(userId); |
| | | |
| | | |
| | | reportService.save(tVideoReport); |
| | | return ApiResult.success(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.controller; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.hollywood.applet.dto.Vip; |
| | | import com.hollywood.applet.dto.VipPayDto; |
| | | import com.hollywood.applet.service.TConfigService; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.applet.service.TVipConfigService; |
| | | import com.hollywood.applet.utils.LoginInfoUtil; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TConfig; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.model.TVipConfig; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.aspectj.weaver.loadtime.Aj; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员设置 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "会员设置") |
| | | @RestController |
| | | @RequestMapping("/tVipConfig") |
| | | public class TVipConfigController { |
| | | |
| | | private final TVipConfigService vipConfigService; |
| | | @Autowired |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @Autowired |
| | | private TUserService userService; |
| | | @Autowired |
| | | private TVipConfigService configService; |
| | | |
| | | @Autowired |
| | | private TConfigService tConfigService; |
| | | |
| | | |
| | | @Autowired |
| | | public TVipConfigController(TVipConfigService vipConfigService) { |
| | | this.vipConfigService = vipConfigService; |
| | | } |
| | | |
| | | /** |
| | | * 获取会员配置 |
| | | */ |
| | | @ApiOperation(value = "获取会员配置") |
| | | @GetMapping(value = "/getById") |
| | | public ApiResult<TVipConfig> getById() { |
| | | return ApiResult.success(vipConfigService.getById(1)); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员配置 |
| | | */ |
| | | @ApiOperation(value = "编辑会员配置") |
| | | @PostMapping(value = "/updateById") |
| | | public ApiResult updateById(@RequestBody TVipConfig vipConfig) { |
| | | vipConfig.setId(1L); |
| | | return ApiResult.success(vipConfigService.updateById(vipConfig)); |
| | | } |
| | | |
| | | @ApiOperation(value = "个人中心-会员信息") |
| | | @PostMapping(value = "/vipinfo") |
| | | public ApiResult<Vip> vipinfo() { |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | TUser byId = userService.getById(userId); |
| | | TConfig byId1 = tConfigService.getById(2); |
| | | BigDecimal money= (byId.getHasPay() ==null ? BigDecimal.valueOf(0) : byId.getHasPay()); |
| | | |
| | | String vipJson; |
| | | TVipConfig one = configService.getOne(null); |
| | | if (byId.getVipType()==1){ |
| | | vipJson=one.getPersonVipLevel(); |
| | | }else if (byId.getVipType()==2){ |
| | | vipJson=one.getEnterpriseVipLevel(); |
| | | }else { |
| | | Vip vip =new Vip(); |
| | | return ApiResult.success(vip); |
| | | } |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(vipJson); |
| | | |
| | | // 从 JSON 中获取各个值并转换为 BigDecimal 类型 |
| | | BigDecimal money1 = new BigDecimal(jsonObject.getString("money1")); |
| | | BigDecimal money2 = new BigDecimal(jsonObject.getString("money2")); |
| | | BigDecimal money3 = new BigDecimal(jsonObject.getString("money3")); |
| | | BigDecimal money4 = new BigDecimal(jsonObject.getString("money4")); |
| | | BigDecimal money5 = new BigDecimal(jsonObject.getString("money5")); |
| | | |
| | | // 组合为 BigDecimal 数组 |
| | | BigDecimal[] moneyArray = { money1, money2, money3, money4, money5 }; |
| | | Integer level = 0; |
| | | BigDecimal needPay = null; |
| | | BigDecimal total = null; |
| | | for (int i = 0; i < moneyArray.length; i++) { |
| | | BigDecimal bigDecimal = moneyArray[i]; |
| | | if (money.compareTo(bigDecimal)<0){ |
| | | needPay= bigDecimal.subtract(money); |
| | | total = bigDecimal; |
| | | level = i; |
| | | break; |
| | | } |
| | | } |
| | | Vip vip = new Vip(); |
| | | vip.setVipEndTime(byId.getEndTime()==null?null:byId.getEndTime()); |
| | | vip.setVipType(byId.getVipType()); |
| | | vip.setConfig(byId1); |
| | | vip.setNeedPayToUp(needPay); |
| | | vip.setLevel(level); |
| | | vip.setTotal(total); |
| | | return ApiResult.success(vip); |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "购买会员操作") |
| | | @PostMapping(value = "/pay") |
| | | public ApiResult updateById(@RequestBody VipPayDto vipPayDto) throws Exception { |
| | | TVipConfig byId = vipConfigService.getById(1); |
| | | BigDecimal money = BigDecimal.ZERO; |
| | | switch (vipPayDto.getType()){ |
| | | case 1: money =byId.getPersonalVipCost();break; |
| | | case 2: money = byId.getPersonalVipRenew();break; |
| | | case 3: money = byId.getEnterpriseVipCost();break; |
| | | case 4: money = byId.getEnterpriseVipRenew();break; |
| | | } |
| | | Long userId = loginInfoUtil.getUserId(); |
| | | return vipConfigService.pay(userId,money,vipPayDto.getMonth(),vipPayDto.getPayType(),vipPayDto.getType()); |
| | | } |
| | | // @ApiOperation(value = "查询还差多少升级下一会员") |
| | | // @PostMapping(value = "/viplevel") |
| | | // public ApiResult viplevel(){ |
| | | // Long userId = loginInfoUtil.getUserId(); |
| | | // TUser byId = userService.getById(userId); |
| | | |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TAdvertisement; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AdverDto { |
| | | TAdvertisement tAdvertisement; |
| | | Integer seconds; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AliSms { |
| | | private String code; |
| | | private String product; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ChangePhoneDto { |
| | | private String phone; |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @ApiModel |
| | | @Data |
| | | public class CompanyDetailDto{ |
| | | private Long id; |
| | | @ApiModelProperty(value = "企业名称") |
| | | private String companyName; |
| | | @ApiModelProperty(value = "公司简介") |
| | | private String companyIntroduction; |
| | | @ApiModelProperty(value = "距离") |
| | | private double distance; |
| | | @ApiModelProperty(value = "城市") |
| | | private String city; |
| | | @ApiModelProperty(value = "地址") |
| | | private String address; |
| | | @ApiModelProperty(value = "详情介绍") |
| | | private String companyDetail; |
| | | @ApiModelProperty(value = "详情图片") |
| | | private String companyPicture; |
| | | @ApiModelProperty("企业需求") |
| | | List<NeedListDto> needListDtos; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "企业管理详情Query") |
| | | public class CompanyDetailQuery { |
| | | private Long id; |
| | | private String lon; |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "企业距离列表") |
| | | public class CompanyDistanceDto { |
| | | private Long id; |
| | | @ApiModelProperty(value = "企业名称") |
| | | private String companyName; |
| | | @ApiModelProperty(value = "企业距离") |
| | | private String distance; |
| | | @ApiModelProperty(value = "企业介绍") |
| | | private String companyIntroduction; |
| | | @ApiModelProperty(value = "企业封面") |
| | | private String companyCover; |
| | | @ApiModelProperty(value = "省份") |
| | | private String city; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | 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 account; |
| | | |
| | | private String password; |
| | | |
| | | @ApiModelProperty("1的时候是一键登录") |
| | | private Integer loginType; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class NeedListDto { |
| | | private Long id; |
| | | private String title; |
| | | @ApiModelProperty("1供2需") |
| | | private Integer realation; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PerformanceJoinDto { |
| | | @ApiModelProperty(value = "活动id") |
| | | Long acId; |
| | | String name; |
| | | String introduce; |
| | | String indexPic; |
| | | @ApiModelProperty(value = ",分隔") |
| | | String infoPic; |
| | | @ApiModelProperty("1:wx2:ali") |
| | | Integer payType; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PutVideoDto { |
| | | String title;String url; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ReportDto { |
| | | @ApiModelProperty(value = "短视频id") |
| | | private Long videoId; |
| | | |
| | | @ApiModelProperty(value = "举报理由") |
| | | private String reportReason; |
| | | |
| | | @ApiModelProperty(value = "举报描述") |
| | | private String reportDesc; |
| | | |
| | | @ApiModelProperty(value = "举报图片") |
| | | private String reportPicture; |
| | | } |
New file |
| | |
| | | package com.hollywood.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 account; |
| | | @ApiModelProperty(value = "新密码") |
| | | @Length(min = 8, max = 16, message = "密码长度在8-16之间") |
| | | private String password; |
| | | @ApiModelProperty(value = "旧密码") |
| | | private String oldPassword; |
| | | private String id; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ScriptPayDto { |
| | | private Long scriptId; |
| | | private Long userId; |
| | | @ApiModelProperty("1微信2支付宝") |
| | | private Integer payType; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TScriptTheme; |
| | | import com.hollywood.common.model.TScriptType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | |
| | | import java.util.List; |
| | | @Data |
| | | public class ScriptSearchOption { |
| | | @ApiModelProperty("题材") |
| | | List<TScriptTheme> tScriptThemes; |
| | | @ApiModelProperty("类别") |
| | | List<TScriptType> tScriptTypes; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ShortPayDto { |
| | | private Long shortId; |
| | | private Long userId; |
| | | @ApiModelProperty("1微信2支付宝") |
| | | private Integer payType; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SpotDto extends BasePage { |
| | | private String name; |
| | | private String lat; |
| | | private String lon; |
| | | private String cityCode; |
| | | @ApiModelProperty("距离:1正序,2倒序") |
| | | private Integer distanceOrder; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TCompany; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "企业管理DTO") |
| | | public class TCompanyDTO extends TCompany { |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "供需管理DTO") |
| | | public class TCompanyNeedDTO extends TCompanyNeed { |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "热门活动DTO") |
| | | public class TPopularActivityDTO extends TPopularActivity { |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TScript; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本管理DTO") |
| | | public class TScriptDTO extends TScript { |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本查询Query") |
| | | public class TScriptQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "类别id") |
| | | private Long typeId; |
| | | |
| | | @ApiModelProperty(value = "题材id") |
| | | private Long themeId; |
| | | |
| | | @ApiModelProperty(value = "剧本名称") |
| | | private String scriptName; |
| | | @ApiModelProperty(value = "底价") |
| | | private String scriptBasePrice; |
| | | @ApiModelProperty(value = "顶价格") |
| | | private String scriptCeilingPrice; |
| | | @ApiModelProperty(value = "个人中心查看我的剧本时传1") |
| | | private Integer mine; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.hollywood.common.model.TScript; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本列表VO") |
| | | public class TScriptVO extends TScript { |
| | | |
| | | @ApiModelProperty(value = "剧本题材名称") |
| | | private String themeName; |
| | | |
| | | @ApiModelProperty(value = "剧本类别名称") |
| | | private String typeName; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import com.hollywood.common.model.TShortPlay; |
| | | import com.hollywood.common.model.TShortPlayVideo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短剧管理DTO") |
| | | public class TShortPlayDTO extends TShortPlay { |
| | | |
| | | @ApiModelProperty(value = "短剧视频对象集合",required = true) |
| | | @NotNull(message = "短剧视频不可为空") |
| | | private List<TShortPlayVideo> shortPlayVideos; |
| | | |
| | | @ApiModelProperty(value = "短剧类型id集合",required = true) |
| | | @NotNull(message = "短剧类型不可为空") |
| | | private List<Long> typeIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TrueOrFalse { |
| | | private boolean isVip; |
| | | } |
New file |
| | |
| | | package com.hollywood.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.hollywood.applet.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.model.TConfig; |
| | | import com.hollywood.common.model.TVipConfig; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | @Data |
| | | public class Vip { |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | LocalDateTime vipEndTime; |
| | | @ApiModelProperty(" 1=个人会员 2=企业会员 3=普通用户") |
| | | Integer vipType; |
| | | TConfig config; |
| | | BigDecimal needPayToUp; |
| | | Integer level; |
| | | BigDecimal total; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VipPayDto { |
| | | private Integer type; |
| | | private Integer month; |
| | | private Integer payType; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class WechatCodeDto { |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.log; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.hollywood.applet.security.SecurityUserDetails; |
| | | import com.hollywood.applet.security.SysUserDetailsService; |
| | | import com.hollywood.applet.service.LoginLogService; |
| | | import com.hollywood.common.log.OperLoginLog; |
| | | import com.hollywood.common.log.ParamParser; |
| | | import com.hollywood.common.model.LoginLog; |
| | | import com.hollywood.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.hollywood.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()); // 登录时间 |
| | | 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.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.LoginLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | public interface LoginLogMapper extends BaseMapper<LoginLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TAdvertisementConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 广告配置 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TAdvertisementConfigMapper extends BaseMapper<TAdvertisementConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TAdvertisement; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 插播广告管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TAdvertisementMapper extends BaseMapper<TAdvertisement> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TBannerQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TBanner; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * banner表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TBannerMapper extends BaseMapper<TBanner> { |
| | | |
| | | /** |
| | | * 获取banner分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TBanner> pageList(@Param("query") TBannerQuery query, @Param("pageInfo") PageInfo<TBanner> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.dto.CompanyDistanceDto; |
| | | import com.hollywood.applet.query.TCompanyQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompany; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 企业管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | public interface TCompanyMapper extends BaseMapper<TCompany> { |
| | | |
| | | /** |
| | | * 获取企业管理分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<CompanyDistanceDto> pageList(@Param("query") TCompanyQuery query, @Param("pageInfo")PageInfo<CompanyDistanceDto> pageInfo,@Param("recommand") String recommand); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TCompanyNeedQuery; |
| | | import com.hollywood.applet.vo.TCompanyNeedVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供需管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | public interface TCompanyNeedMapper extends BaseMapper<TCompanyNeed> { |
| | | |
| | | /** |
| | | * 获取供需管理分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TCompanyNeedVO> pageList(@Param("query") TCompanyNeedQuery query, @Param("pageInfo") PageInfo<TCompanyNeedVO> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 基础配置表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TConfigMapper extends BaseMapper<TConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TCustomerService; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * TCustomerService表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TCustomerServiceMapper extends BaseMapper<TCustomerService> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TInformationQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TInformation; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TInformationMapper extends BaseMapper<TInformation> { |
| | | |
| | | /** |
| | | * 获取资讯管理分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TInformation> pageList(@Param("query") TInformationQuery query, @Param("pageInfo") PageInfo<TInformation> pageInfo); |
| | | |
| | | List<TInformation> queryByName(String name); |
| | | List<TInformation> queryByNameSource(String name); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TMusic; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TMusicMapper extends BaseMapper<TMusic> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TOrderMapper extends BaseMapper<TOrder> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TPerformerActivityQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPerformerActivityMapper extends BaseMapper<TPerformerActivity> { |
| | | |
| | | /** |
| | | * 获取演员活动分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TPerformerActivity> pageList(@Param("query") TPerformerActivityQuery query, @Param("pageInfo")PageInfo<TPerformerActivity> pageInfo,@Param("ids") List<Long> ids); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TPerformerActivityUserQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivityUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动用户参与表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPerformerActivityUserMapper extends BaseMapper<TPerformerActivityUser> { |
| | | |
| | | /** |
| | | * 获取演员活动参与人员列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TPerformerActivityUser> userPageList(@Param("query") TPerformerActivityUserQuery query, @Param("pageInfo")PageInfo<TPerformerActivityUser> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TPopularActivityQuery; |
| | | import com.hollywood.applet.vo.TPopularActivityVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 热门活动 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPopularActivityMapper extends BaseMapper<TPopularActivity> { |
| | | |
| | | List<TPopularActivity> searchByName(String name); |
| | | List<TPopularActivityVO> pageList(@Param("query") TPopularActivityQuery query, |
| | | @Param("pageInfo") PageInfo<TPopularActivityVO> pageInfo, |
| | | @Param("ids") List<Long> ids); |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 报名活动用户中间表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPopularActivityUserMapper extends BaseMapper<TPopularActivityUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TRegion; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TRegionMapper extends BaseMapper<TRegion> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TScenicSpot; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 景区管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScenicSpotMapper extends BaseMapper<TScenicSpot> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.dto.TScriptQuery; |
| | | import com.hollywood.applet.dto.TScriptVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TScript; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScriptMapper extends BaseMapper<TScript> { |
| | | |
| | | List<TScriptVO> pageList(@Param("query") TScriptQuery query, @Param("pageInfo")PageInfo<TScriptVO> pageInfo,@Param("ids") List<Long> ids); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TScriptTheme; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本题材 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScriptThemeMapper extends BaseMapper<TScriptTheme> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TScriptType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本类别 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScriptTypeMapper extends BaseMapper<TScriptType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TShortPlayQuery; |
| | | import com.hollywood.applet.vo.TShortPlayVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TShortPlay; |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayMapper extends BaseMapper<TShortPlay> { |
| | | |
| | | /** |
| | | * 短剧列表查询 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TShortPlayVO> pageList(@Param("query") TShortPlayQuery query, @Param("pageInfo")PageInfo<TShortPlayVO> pageInfo,@Param("ids")List<Long> ids); |
| | | |
| | | List<TShortPlayVO> getHotTwo(); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayTheme; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧题材 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayThemeMapper extends BaseMapper<TShortPlayTheme> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayToType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别中间表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-06 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayToTypeMapper extends BaseMapper<TShortPlayToType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayTypeMapper extends BaseMapper<TShortPlayType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayVideo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧视频 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayVideoMapper extends BaseMapper<TShortPlayVideo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TUserQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TUser; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-01 |
| | | */ |
| | | public interface TUserMapper extends BaseMapper<TUser> { |
| | | |
| | | /** |
| | | * 获取用户分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TUser> userPageList(@Param("query") TUserQuery query, @Param("pageInfo") PageInfo<TUser> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TVideo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVideoMapper extends BaseMapper<TVideo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TVideoReport; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频举报管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVideoReportMapper extends BaseMapper<TVideoReport> { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TVipConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员设置 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVipConfigMapper extends BaseMapper<TVipConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TVipPurchaseRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员购买记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVipPurchaseRecordMapper extends BaseMapper<TVipPurchaseRecord> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.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.hollywood.applet.query; |
| | | |
| | | import com.hollywood.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.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "广告查询Query") |
| | | public class TAdvertisementQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "广告视频名称") |
| | | private String advertisementName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "banner查询Query") |
| | | public class TBannerQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "banner名称") |
| | | private String bannerName; |
| | | |
| | | @ApiModelProperty(value = "所在位置 1=首页 2=交易 3=演员") |
| | | private Integer bannerType; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "工序管理query") |
| | | public class TCompanyNeedQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "企业名称") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "联系人") |
| | | private String contactName; |
| | | |
| | | @ApiModelProperty(value = "联系人电话") |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty(value = "1供2需") |
| | | private Integer realation; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NonNull; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "企业管理Query") |
| | | public class TCompanyQuery extends BasePage { |
| | | |
| | | |
| | | @ApiModelProperty(value = "企业名称") |
| | | private String companyName; |
| | | // @ApiModelProperty(required = true) |
| | | // @NotBlank(message = "经度不能为空") |
| | | private String lon; |
| | | // @ApiModelProperty(required = true) |
| | | // @NotBlank(message = "纬度不能为空") |
| | | private String lat; |
| | | private String provinceCode; |
| | | private String cityCode; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "资讯管理列表query") |
| | | public class TInformationQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "资讯标题") |
| | | private String informationTitle; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "订单列表Query") |
| | | public class TOrderQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "产品类型 1=剧本 2=短剧",required = true) |
| | | @NotNull(message = "产品类型不可为空") |
| | | private Integer productType; |
| | | |
| | | @ApiModelProperty(value = "产品名称") |
| | | private String productName; |
| | | |
| | | @ApiModelProperty(value = "发布人") |
| | | private String releasePerson; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String releasePhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "演员活动Query") |
| | | public class TPerformerActivityQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "活动名称") |
| | | private String activityName; |
| | | |
| | | @ApiModelProperty(value = "投票类型 1=总票数 2=每日票数") |
| | | private Integer voteType; |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "活动状态 1=未开始 2=已开始 3=已结束") |
| | | private Integer activityStatus; |
| | | @ApiModelProperty(value = "发布时间排序0正序,1倒序") |
| | | private Integer OrderDate; |
| | | @ApiModelProperty(value = "热度排序0正序,1倒序") |
| | | private Integer OrderVote; |
| | | @ApiModelProperty(value = "个人中心查看我的剧本时传1") |
| | | private Integer mine; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "演员活动参与人员列表Query") |
| | | public class TPerformerActivityUserQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "演员活动id",required = true) |
| | | @NotNull(message = "演员活动id不可为空") |
| | | private Long activityId; |
| | | |
| | | @ApiModelProperty(value = "用户姓名") |
| | | private String personName; |
| | | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String personPhone; |
| | | private Integer hot; |
| | | private Integer time; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "热门活动query") |
| | | public class TPopularActivityQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "活动名称") |
| | | private String activityName; |
| | | |
| | | @ApiModelProperty(value = "参与用户 1=全部用户 2=仅限会员") |
| | | private Integer participatingUserType; |
| | | |
| | | @ApiModelProperty(value = "活动状态 1=未开始 2=已开始 3=已结束") |
| | | private Integer activityStatus; |
| | | private String cityCode; |
| | | @ApiModelProperty(value = "个人中心查看我的活动时传1") |
| | | private Integer mine; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "热门活动查询Query") |
| | | public class TPopularActivityUserQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "活动id",required = true) |
| | | @NotNull(message = "活动id不可为空") |
| | | private Long activityId; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "景区管理Query") |
| | | public class TScenicSpotQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "景区名称") |
| | | private String scenicName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本查询Query") |
| | | public class TScriptQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "类别id") |
| | | private Long typeId; |
| | | |
| | | @ApiModelProperty(value = "题材id") |
| | | private Long themeId; |
| | | |
| | | @ApiModelProperty(value = "剧本名称") |
| | | private String scriptName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本题材查询Query") |
| | | public class TScriptThemeQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "剧本题材名称") |
| | | private String themeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本类别查询Query") |
| | | public class TScriptTypeQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "剧本类别名称") |
| | | private String typeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短剧查询Query") |
| | | public class TShortPlayQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "短剧题材id") |
| | | @TableField("themeId") |
| | | private Long themeId; |
| | | |
| | | @ApiModelProperty(value = "短剧类型id") |
| | | @TableField("typeId") |
| | | private Long typeId; |
| | | |
| | | @ApiModelProperty(value = "短剧名称") |
| | | @TableField("shortPlayName") |
| | | private String shortPlayName; |
| | | @ApiModelProperty(value = "个人中心查看我的剧本时传1") |
| | | private Integer mine; |
| | | @ApiModelProperty(value = "传1获取热度排名") |
| | | private Integer hot; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短剧题材查询Query") |
| | | public class TShortPlayThemeQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "短剧题材名称") |
| | | private String themeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短剧类别查询Query") |
| | | public class TShortPlayTypeQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "短剧类别名称") |
| | | private String typeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户列表query") |
| | | public class TUserQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "会员类型 1=个人会员 2=企业会员 3=普通用户") |
| | | private Integer vipType; |
| | | |
| | | @ApiModelProperty(value = "页面查询 1=用户管理 2=会员管理") |
| | | private Integer pageType; |
| | | |
| | | @ApiModelProperty(value = "审核状态 1=待审核 2=通过 3=驳回") |
| | | private Integer auditStatus; |
| | | @ApiModelProperty("根据投票数排序正序0倒序1") |
| | | private Integer hot; |
| | | @ApiModelProperty("根据发布时间排序正序0倒序1") |
| | | private Integer pubOrder; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短视频列表query") |
| | | public class TVideoQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "视频标题") |
| | | private String videoTitle; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.query; |
| | | |
| | | import com.hollywood.common.pojo.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "会员购买记录列表query") |
| | | public class TVipPurchaseRecordQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "购买会员类型 1=个人会员 2=企业会员") |
| | | private Integer vipType; |
| | | |
| | | @ApiModelProperty(value = "收费类型 1=新会员 2=会员续费") |
| | | private Integer chargeType; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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.hollywood.applet.security; |
| | | |
| | | import com.hollywood.applet.service.TUserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 credentials = (String) authentication.getCredentials(); |
| | | |
| | | // 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.getStatus() == 2) { |
| | | throw new DisabledException(userName + " 用户已被禁用或删除,请联系管理员"); |
| | | } 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.hollywood.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.getUserName(); |
| | | } |
| | | |
| | | @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.hollywood.applet.security; |
| | | |
| | | import com.hollywood.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 TUser implements Serializable { |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.security; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.applet.utils.RandomStringGenerator; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.utils.SpringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * 用户登录认证信息查询 |
| | | * |
| | | * @author xiaochen |
| | | * @date Jun 29, 2019 |
| | | */ |
| | | @Component("loadUserDetailsService") |
| | | public class SysUserDetailsService implements UserDetailsService { |
| | | @Autowired |
| | | private TUserService userService; |
| | | |
| | | |
| | | @Override |
| | | public SecurityUserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
| | | TUser user = userService.getOne(Wrappers.lambdaQuery(TUser.class).eq(TUser::getUserPhone, username).last(" LIMIT 1")); |
| | | if (Objects.isNull(user)) { |
| | | // throw new UsernameNotFoundException("该用户不存在"); |
| | | //新增用户 |
| | | user = new TUser(); |
| | | user.setUserPhone(username); |
| | | user.setVipType(3); |
| | | user.setSex(0); |
| | | user.setStatus(1); |
| | | user.setAuditStatus(0); |
| | | user.setNickName("用户"+RandomStringGenerator.generateRandomString()); |
| | | user.setAdvatar("http://bizuphk.oss-cn-hongkong.aliyuncs.com/hollywood/1716371352157%E6%9C%AA%E6%A0%87%E9%A2%98-1.png"); |
| | | userService.save(user); |
| | | } |
| | | SecurityUserDetails vo = SpringUtils.beanCopy(user, SecurityUserDetails.class); |
| | | /*getAdminPermission(vo); |
| | | if (user.getAccount().equals(Constant.ADMIN)) { |
| | | getAdminPermission(vo); |
| | | } else { |
| | | List<SecRole> roles = secRoleMapper.selectRolesByUid(user.getId()); |
| | | List<String> roleIds = roles.stream().map(SecRole::getId).collect(Collectors.toList()); |
| | | List<SecResourceVO> resources; |
| | | if (CollectionUtils.isEmpty(roleIds)) { |
| | | resources = new ArrayList<>(); |
| | | } else { |
| | | resources = secUserService.selectUserResourcesTag(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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.LoginLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | public interface LoginLogService extends IService<LoginLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TAdvertisementConfig; |
| | | |
| | | /** |
| | | * <p> |
| | | * 广告配置 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TAdvertisementConfigService extends IService<TAdvertisementConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TAdvertisement; |
| | | |
| | | /** |
| | | * <p> |
| | | * 插播广告管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TAdvertisementService extends IService<TAdvertisement> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TBanner; |
| | | |
| | | /** |
| | | * <p> |
| | | * banner表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TBannerService extends IService<TBanner> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.query.TCompanyNeedQuery; |
| | | import com.hollywood.applet.vo.TCompanyNeedVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 供需管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | public interface TCompanyNeedService extends IService<TCompanyNeed> { |
| | | |
| | | /** |
| | | * 获取供需管理分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TCompanyNeedVO> pageList(TCompanyNeedQuery query); |
| | | |
| | | /** |
| | | * 供需管理上下架 |
| | | * @param id |
| | | * @param status |
| | | * @return |
| | | */ |
| | | int upAndDown(Long id, Integer status); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.dto.CompanyDistanceDto; |
| | | import com.hollywood.applet.query.TCompanyQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompany; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 企业管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | public interface TCompanyService extends IService<TCompany> { |
| | | |
| | | /** |
| | | * 获取企业管理分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<CompanyDistanceDto> pageList(TCompanyQuery query); |
| | | |
| | | /** |
| | | * 企业管理上下架 |
| | | * @param id |
| | | * @param status |
| | | * @return |
| | | */ |
| | | int upAndDown(Long id, Integer status); |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TConfig; |
| | | |
| | | /** |
| | | * <p> |
| | | * 基础配置表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TConfigService extends IService<TConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TCustomerService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 客服配置表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TCustomerServiceService extends IService<TCustomerService> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TInformation; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TInformationService extends IService<TInformation> { |
| | | List<TInformation> queryByName(String name); |
| | | List<TInformation> queryByNameSource(String name); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TMusic; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TMusicService extends IService<TMusic> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TOrder; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TOrderService extends IService<TOrder> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.dto.PerformanceJoinDto; |
| | | import com.hollywood.applet.query.TPerformerActivityQuery; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TPerformerActivityService extends IService<TPerformerActivity> { |
| | | |
| | | /** |
| | | * 获取演员活动分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TPerformerActivity> pageList(TPerformerActivityQuery query, List<Long> ids); |
| | | |
| | | /** |
| | | * 演员活动上下架 |
| | | * @param id |
| | | * @param status |
| | | * @return |
| | | */ |
| | | int upAndDown(Long id, Integer status); |
| | | |
| | | ApiResult join(PerformanceJoinDto performanceJoinDto, Long userId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.query.TPerformerActivityUserQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivityUser; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动用户参与表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TPerformerActivityUserService extends IService<TPerformerActivityUser> { |
| | | |
| | | /** |
| | | * 获取演员活动参与人员列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TPerformerActivityUser> userPageList(TPerformerActivityUserQuery query); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.query.TPopularActivityQuery; |
| | | import com.hollywood.applet.vo.TPopularActivityVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 热门活动 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TPopularActivityService extends IService<TPopularActivity> { |
| | | |
| | | List<TPopularActivity> searchByName(String name, PageInfo<TPopularActivity> pageInfo); |
| | | PageInfo<TPopularActivityVO> pageList(TPopularActivityQuery query,List<Long> ids); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | |
| | | /** |
| | | * <p> |
| | | * 报名活动用户中间表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TPopularActivityUserService extends IService<TPopularActivityUser> { |
| | | ApiResult join(Long activityId, Long userId); |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.vo.TRegionVO; |
| | | import com.hollywood.common.model.TRegion; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TRegionService extends IService<TRegion> { |
| | | |
| | | /** |
| | | * 查询省市管理 |
| | | * @return |
| | | */ |
| | | List<List<TRegion>> getRegion(); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TScenicSpot; |
| | | |
| | | /** |
| | | * <p> |
| | | * 景区管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TScenicSpotService extends IService<TScenicSpot> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.dto.ScriptPayDto; |
| | | import com.hollywood.applet.dto.TScriptQuery; |
| | | import com.hollywood.applet.dto.TScriptVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TScript; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TScriptService extends IService<TScript> { |
| | | PageInfo<TScriptVO> pageList(TScriptQuery query, List<Long> ids); |
| | | |
| | | ApiResult pay(ScriptPayDto scriptPayDto,Long userId) throws Exception; |
| | | |
| | | void wxcallback(String code, String transaction_id); |
| | | |
| | | void alicallback(String code, String tradeNo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TScriptTheme; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本题材 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TScriptThemeService extends IService<TScriptTheme> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TScriptType; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本类别 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TScriptTypeService extends IService<TScriptType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.dto.ShortPayDto; |
| | | import com.hollywood.applet.query.TShortPlayQuery; |
| | | import com.hollywood.applet.vo.TShortPlayVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TShortPlay; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TShortPlayService extends IService<TShortPlay> { |
| | | |
| | | /** |
| | | * 获取短剧管理分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TShortPlayVO> pageList(TShortPlayQuery query, List<Long> ids); |
| | | |
| | | /** |
| | | * 短剧管理上下架 |
| | | * @param id |
| | | * @param status |
| | | * @return |
| | | */ |
| | | int upAndDown(Long id, Integer status); |
| | | |
| | | ApiResult pay(ShortPayDto shortPayDto,Long userId) throws Exception; |
| | | |
| | | void wxcallback(String code, String transactionId); |
| | | |
| | | void alicallback(String code, String tradeNo); |
| | | |
| | | List<TShortPlayVO> getHotTwo(QueryWrapper<TShortPlay> last); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TShortPlayTheme; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧题材 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TShortPlayThemeService extends IService<TShortPlayTheme> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TShortPlayToType; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别中间表 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-06 |
| | | */ |
| | | public interface TShortPlayToTypeService extends IService<TShortPlayToType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TShortPlayTypeService extends IService<TShortPlayType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.dto.ShortPayDto; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TShortPlayVideo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧视频 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TShortPlayVideoService extends IService<TShortPlayVideo> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.applet.query.TUserQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TUser; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-01 |
| | | */ |
| | | public interface TUserService extends IService<TUser> { |
| | | |
| | | /** |
| | | * 获取用户分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TUser> userPageList(TUserQuery query); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TVideoReport; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频举报管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TVideoReportService extends IService<TVideoReport> { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TVideo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频管理 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TVideoService extends IService<TVideo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TVipConfig; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员设置 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TVipConfigService extends IService<TVipConfig> { |
| | | |
| | | ApiResult pay(Long userId, BigDecimal money, Integer month,Integer payType,Integer type) throws Exception; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.hollywood.common.model.TVipPurchaseRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员购买记录 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | public interface TVipPurchaseRecordService extends IService<TVipPurchaseRecord> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.LoginLogMapper; |
| | | import com.hollywood.applet.service.LoginLogService; |
| | | import com.hollywood.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.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TAdvertisementConfigMapper; |
| | | import com.hollywood.applet.service.TAdvertisementConfigService; |
| | | import com.hollywood.common.model.TAdvertisementConfig; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 广告配置 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TAdvertisementConfigServiceImpl extends ServiceImpl<TAdvertisementConfigMapper, TAdvertisementConfig> implements TAdvertisementConfigService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TAdvertisementMapper; |
| | | import com.hollywood.applet.service.TAdvertisementService; |
| | | import com.hollywood.common.model.TAdvertisement; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 插播广告管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TAdvertisementServiceImpl extends ServiceImpl<TAdvertisementMapper, TAdvertisement> implements TAdvertisementService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TBannerMapper; |
| | | import com.hollywood.applet.service.TBannerService; |
| | | import com.hollywood.common.model.TBanner; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * banner表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TBannerServiceImpl extends ServiceImpl<TBannerMapper, TBanner> implements TBannerService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TCompanyNeedMapper; |
| | | import com.hollywood.applet.query.TCompanyNeedQuery; |
| | | import com.hollywood.applet.service.TCompanyNeedService; |
| | | import com.hollywood.applet.vo.TCompanyNeedVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供需管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | @Service |
| | | public class TCompanyNeedServiceImpl extends ServiceImpl<TCompanyNeedMapper, TCompanyNeed> implements TCompanyNeedService { |
| | | |
| | | @Override |
| | | public PageInfo<TCompanyNeedVO> pageList(TCompanyNeedQuery query) { |
| | | PageInfo<TCompanyNeedVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TCompanyNeedVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public int upAndDown(Long id, Integer status) { |
| | | TCompanyNeed companyNeed = this.baseMapper.selectById(id); |
| | | companyNeed.setStatus(status); |
| | | return this.baseMapper.updateById(companyNeed); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.dto.CompanyDistanceDto; |
| | | import com.hollywood.applet.mapper.TCompanyMapper; |
| | | import com.hollywood.applet.query.TCompanyQuery; |
| | | import com.hollywood.applet.service.TCompanyService; |
| | | import com.hollywood.applet.utils.AmapGeocoding; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompany; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 企业管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | @Service |
| | | public class TCompanyServiceImpl extends ServiceImpl<TCompanyMapper, TCompany> implements TCompanyService { |
| | | |
| | | @Override |
| | | public PageInfo<CompanyDistanceDto> pageList(TCompanyQuery query) { |
| | | PageInfo<CompanyDistanceDto> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | String recommand = ""; |
| | | if (query.getLat()!=null&&query.getLat()!=""){ |
| | | try { |
| | | String cityCode = AmapGeocoding.getCityCode(Double.parseDouble(query.getLat()), Double.parseDouble(query.getLon())); |
| | | // String cityName = AmapGeocoding.getCityName(Double.parseDouble(query.getLat()), Double.parseDouble(query.getLon())); |
| | | // System.err.println(cityName); |
| | | recommand=replaceLastTwoWithZero(cityCode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | List<CompanyDistanceDto> list = this.baseMapper.pageList(query,pageInfo,recommand); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public int upAndDown(Long id, Integer status) { |
| | | TCompany company = this.baseMapper.selectById(id); |
| | | company.setStatus(status); |
| | | return this.baseMapper.updateById(company); |
| | | } |
| | | public static String replaceLastTwoWithZero(String code) { |
| | | // 检查字符串长度是否为6,如果不是6位,返回错误信息或默认值 |
| | | if (code == null || code.length() != 6) { |
| | | throw new IllegalArgumentException("Invalid code length. Expected 6 digits, got: " + code); |
| | | } |
| | | |
| | | // 替换最后两位为'00' |
| | | return code.substring(0, 4) + "00"; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TConfigMapper; |
| | | import com.hollywood.applet.service.TConfigService; |
| | | import com.hollywood.common.model.TConfig; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 基础配置表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TConfigServiceImpl extends ServiceImpl<TConfigMapper, TConfig> implements TConfigService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TCustomerServiceMapper; |
| | | import com.hollywood.applet.service.TCustomerServiceService; |
| | | import com.hollywood.common.model.TCustomerService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 客服配置表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TCustomerServiceServiceImpl extends ServiceImpl<TCustomerServiceMapper, TCustomerService> implements TCustomerServiceService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TInformationMapper; |
| | | import com.hollywood.applet.service.TInformationService; |
| | | import com.hollywood.common.model.TInformation; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TInformationServiceImpl extends ServiceImpl<TInformationMapper, TInformation> implements TInformationService { |
| | | @Override |
| | | public List<TInformation> queryByName(String name) { |
| | | return this.baseMapper.queryByName(name); |
| | | } |
| | | @Override |
| | | public List<TInformation> queryByNameSource(String name) { |
| | | return this.baseMapper.queryByNameSource(name); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TMusicMapper; |
| | | import com.hollywood.applet.service.TMusicService; |
| | | import com.hollywood.common.model.TMusic; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class TMusicServiceImpl extends ServiceImpl<TMusicMapper, TMusic> implements TMusicService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TOrderMapper; |
| | | import com.hollywood.applet.service.TOrderService; |
| | | import com.hollywood.common.model.TOrder; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> implements TOrderService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.dto.PerformanceJoinDto; |
| | | import com.hollywood.applet.mapper.TPerformerActivityMapper; |
| | | import com.hollywood.applet.mapper.TPerformerActivityUserMapper; |
| | | import com.hollywood.applet.mapper.TUserMapper; |
| | | import com.hollywood.applet.query.TPerformerActivityQuery; |
| | | import com.hollywood.applet.service.TPerformerActivityService; |
| | | import com.hollywood.applet.service.TPerformerActivityUserService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.*; |
| | | |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import com.hollywood.common.utils.PayMoneyUtil; |
| | | import com.hollywood.common.utils.UUIDUtil; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TPerformerActivityServiceImpl extends ServiceImpl<TPerformerActivityMapper, TPerformerActivity> implements TPerformerActivityService { |
| | | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Autowired |
| | | private TUserMapper userMapper; |
| | | @Autowired |
| | | private TPerformerActivityUserMapper tPerformerActivityUserMapper; |
| | | @Autowired |
| | | private RedisAutoTemplate redisAutoTemplate; |
| | | @Override |
| | | public PageInfo<TPerformerActivity> pageList(TPerformerActivityQuery query,List<Long> ids) { |
| | | PageInfo<TPerformerActivity> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TPerformerActivity> list = this.baseMapper.pageList(query,pageInfo,ids); |
| | | for (TPerformerActivity tPerformerActivity : list) { |
| | | tPerformerActivity.setHot(redisAutoTemplate.getSet("performer:hot:"+tPerformerActivity.getId()).size()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public int upAndDown(Long id, Integer status) { |
| | | TPerformerActivity performerActivity = this.baseMapper.selectById(id); |
| | | performerActivity.setStatus(status); |
| | | return this.baseMapper.updateById(performerActivity); |
| | | } |
| | | |
| | | @Override |
| | | public ApiResult join(PerformanceJoinDto performanceJoinDto, Long userId) throws Exception { |
| | | |
| | | |
| | | //进行支付操作 |
| | | if(performanceJoinDto.getPayType() == 1){//微信支付 |
| | | return weChatPaymentAPerformance(performanceJoinDto,userId); |
| | | } |
| | | if (performanceJoinDto.getPayType()==2){ |
| | | return aliPayPerformance(performanceJoinDto,userId); |
| | | } |
| | | return ApiResult.failed("请选择支付方式"); |
| | | } |
| | | |
| | | public ApiResult weChatPaymentAPerformance(PerformanceJoinDto performanceJoinDto, Long userId) throws Exception{ |
| | | TPerformerActivity tPerformerActivity = this.baseMapper.selectById(performanceJoinDto.getAcId()); |
| | | |
| | | |
| | | TUser tUser = userMapper.selectById(userId); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | |
| | | TPerformerActivityUser tPerformerActivityUser = new TPerformerActivityUser(); |
| | | tPerformerActivityUser.setActivityId(performanceJoinDto.getAcId()); |
| | | tPerformerActivityUser.setPersonName(performanceJoinDto.getName()); |
| | | tPerformerActivityUser.setPersonPhone(tUser.getUserPhone()); |
| | | tPerformerActivityUser.setGainVotesCount(0); |
| | | tPerformerActivityUser.setSelfIntroduction(performanceJoinDto.getIntroduce()); |
| | | tPerformerActivityUser.setPerformerCover(performanceJoinDto.getIndexPic()); |
| | | tPerformerActivityUser.setDetailPicture(performanceJoinDto.getInfoPic()); |
| | | tPerformerActivityUser.setDetailPicture(performanceJoinDto.getInfoPic()); |
| | | if (tPerformerActivity.getRegistrationFee()==0) { |
| | | tPerformerActivityUser.setIsPay(2); |
| | | }else { |
| | | tPerformerActivityUser.setIsPay(1); |
| | | } |
| | | tPerformerActivityUser.setMoney(BigDecimal.valueOf(tPerformerActivity.getRegistrationFee())); |
| | | tPerformerActivityUser.setUserId(userId); |
| | | tPerformerActivityUser.setCode(code); |
| | | tPerformerActivityUserMapper.insert(tPerformerActivityUser); |
| | | |
| | | if (tPerformerActivity.getRegistrationFee()==0){ |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | ApiResult weixinpay = payMoneyUtil.weixinpay("参加演员活动", "", code,tPerformerActivity.getRegistrationFee().toString(), "/base/performance/callback", "APP"); |
| | | |
| | | return weixinpay; |
| | | } |
| | | |
| | | |
| | | private ApiResult aliPayPerformance(PerformanceJoinDto performanceJoinDto, Long userId) { |
| | | TPerformerActivity tPerformerActivity = this.baseMapper.selectById(performanceJoinDto.getAcId()); |
| | | TUser tUser = userMapper.selectById(userId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | |
| | | TPerformerActivityUser tPerformerActivityUser = new TPerformerActivityUser(); |
| | | tPerformerActivityUser.setActivityId(performanceJoinDto.getAcId()); |
| | | tPerformerActivityUser.setPersonName(performanceJoinDto.getName()); |
| | | tPerformerActivityUser.setPersonPhone(tUser.getUserPhone()); |
| | | tPerformerActivityUser.setGainVotesCount(0); |
| | | tPerformerActivityUser.setSelfIntroduction(performanceJoinDto.getIntroduce()); |
| | | tPerformerActivityUser.setPerformerCover(performanceJoinDto.getIndexPic()); |
| | | tPerformerActivityUser.setDetailPicture(performanceJoinDto.getInfoPic()); |
| | | tPerformerActivityUser.setDetailPicture(performanceJoinDto.getInfoPic()); |
| | | if (tPerformerActivity.getRegistrationFee()==0) { |
| | | tPerformerActivityUser.setIsPay(2); |
| | | }else { |
| | | tPerformerActivityUser.setIsPay(1); |
| | | } |
| | | tPerformerActivityUser.setMoney(BigDecimal.valueOf(tPerformerActivity.getRegistrationFee())); |
| | | tPerformerActivityUser.setUserId(userId); |
| | | tPerformerActivityUser.setCode(code); |
| | | tPerformerActivityUserMapper.insert(tPerformerActivityUser); |
| | | if (tPerformerActivity.getRegistrationFee()==0) { |
| | | return ApiResult.success(); |
| | | } |
| | | ApiResult alipay = payMoneyUtil.alipay("参加演员活动", "参加演员活动", code, tPerformerActivity.getRegistrationFee().toString(), "/base/performance/aliPaymentCourseCallback"); |
| | | return alipay; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TPerformerActivityUserMapper; |
| | | import com.hollywood.applet.query.TPerformerActivityUserQuery; |
| | | import com.hollywood.applet.service.TPerformerActivityUserService; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivityUser; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动用户参与表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TPerformerActivityUserServiceImpl extends ServiceImpl<TPerformerActivityUserMapper, TPerformerActivityUser> implements TPerformerActivityUserService { |
| | | |
| | | @Override |
| | | public PageInfo<TPerformerActivityUser> userPageList(TPerformerActivityUserQuery query) { |
| | | PageInfo<TPerformerActivityUser> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TPerformerActivityUser> list = this.baseMapper.userPageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TPopularActivityMapper; |
| | | import com.hollywood.applet.mapper.TPopularActivityUserMapper; |
| | | import com.hollywood.applet.query.TPopularActivityQuery; |
| | | import com.hollywood.applet.service.TPopularActivityService; |
| | | import com.hollywood.applet.vo.TPopularActivityVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 热门活动 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TPopularActivityServiceImpl extends ServiceImpl<TPopularActivityMapper, TPopularActivity> implements TPopularActivityService { |
| | | @Autowired |
| | | private TPopularActivityUserMapper popularActivityUserMapper; |
| | | @Override |
| | | public List<TPopularActivity> searchByName(String name, PageInfo<TPopularActivity> pageInfo) { |
| | | return this.baseMapper.searchByName(name); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TPopularActivityVO> pageList(TPopularActivityQuery query,List<Long> ids) { |
| | | PageInfo<TPopularActivityVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TPopularActivityVO> list = this.baseMapper.pageList(query,pageInfo,ids); |
| | | for (TPopularActivityVO tPopularActivityVO : list) { |
| | | Long l = popularActivityUserMapper.selectCount(Wrappers.lambdaQuery(TPopularActivityUser.class).eq(TPopularActivityUser::getActivityId, tPopularActivityVO.getId())); |
| | | tPopularActivityVO.setApplicationCount(l.intValue()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TPopularActivityUserMapper; |
| | | import com.hollywood.applet.service.TPopularActivityService; |
| | | import com.hollywood.applet.service.TPopularActivityUserService; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.wxPay.certificate.model.Data; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 报名活动用户中间表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TPopularActivityUserServiceImpl extends ServiceImpl<TPopularActivityUserMapper, TPopularActivityUser> implements TPopularActivityUserService { |
| | | // @Resource |
| | | // private TPopularActivityUserService userService; |
| | | @Resource |
| | | private TPopularActivityService activityService; |
| | | @Resource |
| | | private TUserService tUserService; |
| | | |
| | | |
| | | @Override |
| | | public ApiResult join(Long activityId, Long userId) { |
| | | //判断该活动是否必须会员 |
| | | TPopularActivity ac = activityService.getById(activityId); |
| | | if (ac.getParticipatingUserType()==2){ |
| | | TUser user = tUserService.getById(userId); |
| | | if (user.getVipType()==3){ |
| | | return ApiResult.failed("报名失败,当前活动仅限会员参与。"); |
| | | } |
| | | } |
| | | //判断是否已经参加活动 |
| | | List<TPopularActivityUser> acusers = this.baseMapper.selectList(new QueryWrapper<TPopularActivityUser>().eq("activityId", activityId).eq("userId", userId)); |
| | | |
| | | if (!acusers.isEmpty()){ |
| | | return ApiResult.failed("报名失败,已报名当前活动,请勿重复报名"); |
| | | } |
| | | //报名 |
| | | TPopularActivityUser activityUser = new TPopularActivityUser(); |
| | | activityUser.setUserId(userId); |
| | | activityUser.setActivityId(activityId); |
| | | activityUser.setApplicationTime(LocalDateTime.now()); |
| | | this.baseMapper.insert(activityUser); |
| | | return ApiResult.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TRegionMapper; |
| | | import com.hollywood.applet.service.TRegionService; |
| | | import com.hollywood.common.model.TRegion; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TRegionServiceImpl extends ServiceImpl<TRegionMapper, TRegion> implements TRegionService { |
| | | |
| | | @Override |
| | | public List<List<TRegion>> getRegion() { |
| | | String[] initials = {"A", "B", "C", "D", "E", "F", |
| | | "G", "H", "I", "J", "K", "L", |
| | | "M", "N", "O", "P", "Q", "R", |
| | | "S", "T", "U", "V", "W", "X", "Y", "Z"}; |
| | | List<TRegion> tRegions = this.baseMapper.selectList(Wrappers.lambdaQuery(TRegion.class)); |
| | | List<List<TRegion>> result = new ArrayList<>(); |
| | | for (String initial : initials) { |
| | | List<TRegion> init = tRegions.stream().filter(e -> e.getInitial().equals(initial) && !e.getCode().contains("0000")).collect(Collectors.toList()); |
| | | result.add(init); |
| | | } |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TScenicSpotMapper; |
| | | import com.hollywood.applet.service.TScenicSpotService; |
| | | import com.hollywood.common.model.TScenicSpot; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 景区管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TScenicSpotServiceImpl extends ServiceImpl<TScenicSpotMapper, TScenicSpot> implements TScenicSpotService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | import java.io.PrintWriter; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.dto.ScriptPayDto; |
| | | import com.hollywood.applet.dto.TScriptQuery; |
| | | import com.hollywood.applet.dto.TScriptVO; |
| | | import com.hollywood.applet.mapper.TOrderMapper; |
| | | import com.hollywood.applet.mapper.TScriptMapper; |
| | | import com.hollywood.applet.mapper.TUserMapper; |
| | | import com.hollywood.applet.service.TOrderService; |
| | | import com.hollywood.applet.service.TScriptService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.TOrder; |
| | | import com.hollywood.common.model.TScript; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.utils.PayMoneyUtil; |
| | | import com.hollywood.common.utils.UUIDUtil; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import sun.font.Script; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TScriptServiceImpl extends ServiceImpl<TScriptMapper, TScript> implements TScriptService { |
| | | |
| | | @Autowired |
| | | private TOrderMapper orderMapper; |
| | | |
| | | @Resource |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Override |
| | | public PageInfo<TScriptVO> pageList(TScriptQuery query,List<Long> ids) { |
| | | PageInfo<TScriptVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TScriptVO> list = this.baseMapper.pageList(query,pageInfo,ids); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public ApiResult pay(ScriptPayDto scriptPayDto,Long userId) throws Exception { |
| | | //判断当前用户是否购买 |
| | | List<TOrder> tOrders = orderMapper.selectList(Wrappers.lambdaQuery(TOrder.class). |
| | | eq(TOrder::getProductId, scriptPayDto.getScriptId()) |
| | | .eq(TOrder::getProductType, 1) |
| | | .eq(TOrder::getIsPay, 1).eq(TOrder::getUserId,userId) |
| | | ); |
| | | if (!tOrders.isEmpty()){ |
| | | throw new ServiceException(-1,"您已购买该剧本"); |
| | | } |
| | | TScript scrpt = this.baseMapper.selectById(scriptPayDto.getScriptId()); |
| | | //进行支付操作 |
| | | if(scriptPayDto.getPayType() == 1){//微信支付 |
| | | return weChatPaymentScript(userId,scrpt); |
| | | } |
| | | if (scriptPayDto.getPayType()==2){ |
| | | return aliPayScript(userId,scrpt); |
| | | } |
| | | return ApiResult.failed("请选择支付方式"); |
| | | } |
| | | |
| | | public ApiResult aliPayScript(Long userId, TScript script) throws Exception{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | TOrder order = new TOrder(); |
| | | order.setUserId(userId); |
| | | order.setProductType(1); |
| | | order.setProductName(script.getScriptName()); |
| | | order.setProductId(script.getId()); |
| | | order.setReleasePerson(script.getReleasePerson()); |
| | | order.setReleasePhone(script.getReleasePhone()); |
| | | order.setProductDeposit(script.getScriptDeposit()); |
| | | order.setPayTime(LocalDateTime.now()); |
| | | if (script.getScriptDeposit()==null|| script.getScriptDeposit().equals(new BigDecimal(0))){ |
| | | order.setIsPay(1); |
| | | }else { |
| | | order.setIsPay(2); |
| | | } |
| | | order.setPayMoney(script.getScriptDeposit()); |
| | | order.setCode(code); |
| | | orderMapper.insert(order); |
| | | ApiResult alipay = payMoneyUtil.alipay("购买剧本", "购买剧本", code, script.getScriptDeposit().toString(), "/base/script/alicallback"); |
| | | return alipay; |
| | | } |
| | | |
| | | @Override |
| | | public void wxcallback(String code, String transaction_id) { |
| | | try { |
| | | |
| | | TOrder order = orderMapper.selectOne(Wrappers.lambdaQuery(TOrder.class).eq(TOrder::getCode, code)); |
| | | if(order.getIsPay() == 1){ |
| | | order.setIsPay(2); |
| | | order.setOrderNum(transaction_id); |
| | | orderMapper.updateById(order); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private TUserMapper userMapper; |
| | | @Override |
| | | public void alicallback(String code, String tradeNo) { |
| | | try { |
| | | TOrder order = orderMapper.selectOne(Wrappers.lambdaQuery(TOrder.class).eq(TOrder::getCode, code)); |
| | | if(order.getIsPay() == 2){ |
| | | order.setIsPay(1); |
| | | order.setOrderNum(tradeNo); |
| | | orderMapper.updateById(order); |
| | | |
| | | TUser byId = userMapper.selectById(order.getUserId()); |
| | | byId.setHasPay(byId.getHasPay()==null? order.getPayMoney() :byId.getHasPay().add(order.getPayMoney())); |
| | | userMapper.updateById(byId); |
| | | |
| | | |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public ApiResult weChatPaymentScript(Long userId, TScript script) throws Exception{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | TOrder order = new TOrder(); |
| | | order.setUserId(userId); |
| | | order.setProductType(1); |
| | | order.setProductName(script.getScriptName()); |
| | | order.setProductId(script.getId()); |
| | | order.setReleasePerson(script.getReleasePerson()); |
| | | order.setReleasePhone(script.getReleasePhone()); |
| | | order.setProductDeposit(script.getScriptDeposit()); |
| | | order.setPayTime(LocalDateTime.now()); |
| | | if (script.getScriptDeposit()==null|| script.getScriptDeposit().equals(new BigDecimal(0))){ |
| | | order.setIsPay(2); |
| | | }else { |
| | | order.setIsPay(1); |
| | | } |
| | | |
| | | order.setPayMoney(script.getScriptDeposit()); |
| | | order.setCode(code); |
| | | orderMapper.insert(order); |
| | | |
| | | |
| | | ApiResult weixinpay = payMoneyUtil.weixinpay("购买剧本", "", code, script.getScriptDeposit().toString(), "/base/script/callback", "APP"); |
| | | if(weixinpay.getCode() == 200){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Thread.sleep(wait); |
| | | TOrder order1 = orderMapper.selectById(order.getId()); |
| | | |
| | | if(order1.getIsPay() == 2){ |
| | | break; |
| | | } |
| | | ApiResult<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, ""); |
| | | if(resultUtil.getCode() == 200 && order1.getIsPay() == 1){ |
| | | /** |
| | | * SUCCESS—支付成功, |
| | | * REFUND—转入退款, |
| | | * NOTPAY—未支付, |
| | | * CLOSED—已关闭, |
| | | * REVOKED—已撤销(刷卡支付), |
| | | * USERPAYING--用户支付中, |
| | | * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | */ |
| | | Map<String, String> data1 = resultUtil.getData(); |
| | | String s = data1.get("trade_state"); |
| | | String transaction_id = data1.get("transaction_id"); |
| | | if("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10){ |
| | | |
| | | break; |
| | | } |
| | | if("SUCCESS".equals(s)){ |
| | | wxcallback(code,transaction_id); |
| | | break; |
| | | } |
| | | if("USERPAYING".equals(s)){ |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return weixinpay; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TScriptThemeMapper; |
| | | import com.hollywood.applet.service.TScriptThemeService; |
| | | import com.hollywood.common.model.TScriptTheme; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本题材 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TScriptThemeServiceImpl extends ServiceImpl<TScriptThemeMapper, TScriptTheme> implements TScriptThemeService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TScriptTypeMapper; |
| | | import com.hollywood.applet.service.TScriptTypeService; |
| | | import com.hollywood.common.model.TScriptType; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本类别 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TScriptTypeServiceImpl extends ServiceImpl<TScriptTypeMapper, TScriptType> implements TScriptTypeService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.dto.ScriptPayDto; |
| | | import com.hollywood.applet.dto.ShortPayDto; |
| | | import com.hollywood.applet.mapper.*; |
| | | import com.hollywood.applet.query.TShortPlayQuery; |
| | | import com.hollywood.applet.service.TShortPlayService; |
| | | import com.hollywood.applet.vo.TShortPlayVO; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.*; |
| | | |
| | | |
| | | import com.hollywood.common.utils.PayMoneyUtil; |
| | | import com.hollywood.common.utils.UUIDUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TShortPlayServiceImpl extends ServiceImpl<TShortPlayMapper, TShortPlay> implements TShortPlayService { |
| | | |
| | | @Autowired |
| | | private TShortPlayToTypeMapper shortPlayToTypeMapper; |
| | | @Autowired |
| | | private TShortPlayTypeMapper shortPlayTypeMapper; |
| | | @Autowired |
| | | private TShortPlayVideoMapper shortPlayVideoMapper; |
| | | @Resource |
| | | private TOrderMapper orderMapper; |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Override |
| | | public PageInfo<TShortPlayVO> pageList(TShortPlayQuery query,List<Long> ids) { |
| | | PageInfo<TShortPlayVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TShortPlayVO> list = this.baseMapper.pageList(query,pageInfo,ids); |
| | | List<TShortPlayToType> tShortPlayToTypes = shortPlayToTypeMapper.selectList(Wrappers.lambdaQuery(TShortPlayToType.class)); |
| | | for (TShortPlayVO tShortPlayVO : list) { |
| | | List<TShortPlayToType> shortPlayToTypes = tShortPlayToTypes.stream().filter(e -> tShortPlayVO.getId().equals(e.getShortPlayId())).collect(Collectors.toList()); |
| | | List<Long> typeIds = shortPlayToTypes.stream().map(TShortPlayToType::getTypeId).collect(Collectors.toList()); |
| | | tShortPlayVO.setTypeIds(typeIds); |
| | | // 封装类型名称 |
| | | List<TShortPlayType> tShortPlayTypes = shortPlayTypeMapper.selectList(Wrappers.lambdaQuery(TShortPlayType.class) |
| | | .in(TShortPlayType::getId, typeIds)); |
| | | String typeName = tShortPlayTypes.stream().map(TShortPlayType::getTypeName).collect(Collectors.joining(",")); |
| | | tShortPlayVO.setTypeName(typeName); |
| | | tShortPlayVO.setShortPlayVideos(shortPlayVideoMapper.selectList(Wrappers.lambdaQuery(TShortPlayVideo.class).eq(TShortPlayVideo::getShortPlayId,tShortPlayVO.getId()).orderByAsc(TShortPlayVideo::getSortBy))); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public int upAndDown(Long id, Integer status) { |
| | | TShortPlay shortPlay = this.baseMapper.selectById(id); |
| | | shortPlay.setStatus(status); |
| | | return this.baseMapper.updateById(shortPlay); |
| | | } |
| | | |
| | | @Override |
| | | public ApiResult pay(ShortPayDto shortPayDto,Long userId) throws Exception { |
| | | |
| | | //判断当前用户是否购买 |
| | | List<TOrder> tOrders = orderMapper.selectList(Wrappers.lambdaQuery(TOrder.class). |
| | | eq(TOrder::getProductId, shortPayDto.getShortId()) |
| | | .eq(TOrder::getProductType, 2) |
| | | .eq(TOrder::getIsPay, 1).eq(TOrder::getUserId,userId) |
| | | ); |
| | | if (!tOrders.isEmpty()){ |
| | | return ApiResult.failed("你已购买当前短剧"); |
| | | } |
| | | TShortPlay tShortPlay = this.baseMapper.selectById(shortPayDto.getShortId()); |
| | | |
| | | if(shortPayDto.getPayType() == 1){//微信支付 |
| | | return weChatPaymentShort(userId,tShortPlay); |
| | | } |
| | | if (shortPayDto.getPayType()==2){ |
| | | return aliPayShort(userId,tShortPlay); |
| | | |
| | | } |
| | | return ApiResult.failed("请选择支付方式"); |
| | | } |
| | | |
| | | private ApiResult aliPayShort(Long userId, TShortPlay tShortPlay) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | TOrder order = new TOrder(); |
| | | order.setUserId(userId); |
| | | order.setProductType(2); |
| | | order.setProductName(tShortPlay.getShortPlayName()); |
| | | order.setProductId(tShortPlay.getId()); |
| | | order.setReleasePerson(tShortPlay.getReleasePerson()); |
| | | order.setReleasePhone(tShortPlay.getReleasePhone()); |
| | | order.setProductDeposit(tShortPlay.getShortPlayDeposit()); |
| | | order.setPayTime(LocalDateTime.now()); |
| | | if (tShortPlay.getShortPlayDeposit()==null|| tShortPlay.getShortPlayDeposit().equals(new BigDecimal(0))){ |
| | | order.setIsPay(1); |
| | | }else { |
| | | order.setIsPay(2);} |
| | | order.setPayMoney(tShortPlay.getShortPlayDeposit()); |
| | | order.setCode(code); |
| | | orderMapper.insert(order); |
| | | ApiResult alipay = payMoneyUtil.alipay("购买剧本", "购买剧本", code, tShortPlay.getShortPlayDeposit().toString(), "/base/short/alicallback"); |
| | | return alipay; |
| | | } |
| | | |
| | | private ApiResult weChatPaymentShort(Long userId, TShortPlay tShortPlay) throws Exception { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | TOrder order = new TOrder(); |
| | | order.setUserId(userId); |
| | | order.setProductType(2); |
| | | order.setProductName(tShortPlay.getShortPlayName()); |
| | | order.setProductId(tShortPlay.getId()); |
| | | order.setReleasePerson(tShortPlay.getReleasePerson()); |
| | | order.setReleasePhone(tShortPlay.getReleasePhone()); |
| | | order.setProductDeposit(tShortPlay.getShortPlayDeposit()); |
| | | order.setPayTime(LocalDateTime.now()); |
| | | if (tShortPlay.getShortPlayDeposit()==null|| tShortPlay.getShortPlayDeposit().compareTo(BigDecimal.ZERO)==0){ |
| | | order.setIsPay(1); |
| | | }else { |
| | | order.setIsPay(2); |
| | | } |
| | | order.setPayMoney(tShortPlay.getShortPlayDeposit()); |
| | | order.setCode(code); |
| | | orderMapper.insert(order); |
| | | |
| | | |
| | | ApiResult weixinpay = payMoneyUtil.weixinpay("购买短剧", "", code, tShortPlay.getShortPlayDeposit().toString(), "/base/short/callback", "APP"); |
| | | // if(weixinpay.getCode() == 200){ |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // int num = 1; |
| | | // int wait = 0; |
| | | // while (num <= 10){ |
| | | // int min = 5000; |
| | | // wait += (min * num); |
| | | // Thread.sleep(wait); |
| | | // TOrder order1 = orderMapper.selectById(order.getId()); |
| | | // |
| | | // if(order1.getIsPay() == 2){ |
| | | // break; |
| | | // } |
| | | // ApiResult<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, ""); |
| | | // if(resultUtil.getCode() == 200 && order1.getIsPay() == 1){ |
| | | // /** |
| | | // * SUCCESS—支付成功, |
| | | // * REFUND—转入退款, |
| | | // * NOTPAY—未支付, |
| | | // * CLOSED—已关闭, |
| | | // * REVOKED—已撤销(刷卡支付), |
| | | // * USERPAYING--用户支付中, |
| | | // * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | // */ |
| | | // Map<String, String> data1 = resultUtil.getData(); |
| | | // String s = data1.get("trade_state"); |
| | | // String transaction_id = data1.get("transaction_id"); |
| | | // if("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10){ |
| | | // |
| | | // break; |
| | | // } |
| | | // if("SUCCESS".equals(s)){ |
| | | // wxcallback(code,transaction_id); |
| | | // break; |
| | | // } |
| | | // if("USERPAYING".equals(s)){ |
| | | // num++; |
| | | // } |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }).start(); |
| | | // } |
| | | return weixinpay; |
| | | } |
| | | |
| | | @Resource |
| | | private TUserMapper userMapper; |
| | | |
| | | @Override |
| | | public void alicallback(String code, String tradeNo) { |
| | | try { |
| | | TOrder order = orderMapper.selectOne(Wrappers.lambdaQuery(TOrder.class).eq(TOrder::getCode, code)); |
| | | if(order.getIsPay() == 2){ |
| | | order.setIsPay(1); |
| | | order.setOrderNum(tradeNo); |
| | | orderMapper.updateById(order); |
| | | TUser byId = userMapper.selectById(order.getUserId()); |
| | | byId.setHasPay(byId.getHasPay()==null? order.getPayMoney() :byId.getHasPay().add(order.getPayMoney())); |
| | | userMapper.updateById(byId); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<TShortPlayVO> getHotTwo(QueryWrapper<TShortPlay> last) { |
| | | List<TShortPlayVO> list = this.baseMapper.getHotTwo(); |
| | | List<TShortPlayToType> tShortPlayToTypes = shortPlayToTypeMapper.selectList(Wrappers.lambdaQuery(TShortPlayToType.class)); |
| | | for (TShortPlayVO tShortPlayVO : list) { |
| | | List<TShortPlayToType> shortPlayToTypes = tShortPlayToTypes.stream().filter(e -> tShortPlayVO.getId().equals(e.getShortPlayId())).collect(Collectors.toList()); |
| | | List<Long> typeIds = shortPlayToTypes.stream().map(TShortPlayToType::getTypeId).collect(Collectors.toList()); |
| | | tShortPlayVO.setTypeIds(typeIds); |
| | | // 封装类型名称 |
| | | List<TShortPlayType> tShortPlayTypes = shortPlayTypeMapper.selectList(Wrappers.lambdaQuery(TShortPlayType.class) |
| | | .in(TShortPlayType::getId, typeIds)); |
| | | String typeName = tShortPlayTypes.stream().map(TShortPlayType::getTypeName).collect(Collectors.joining(",")); |
| | | tShortPlayVO.setTypeName(typeName); |
| | | tShortPlayVO.setShortPlayVideos(shortPlayVideoMapper.selectList(Wrappers.lambdaQuery(TShortPlayVideo.class).eq(TShortPlayVideo::getShortPlayId,tShortPlayVO.getId()).orderByAsc(TShortPlayVideo::getSortBy))); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void wxcallback(String code, String transaction_id) { |
| | | try { |
| | | TOrder order = orderMapper.selectOne(Wrappers.lambdaQuery(TOrder.class).eq(TOrder::getCode, code)); |
| | | if(order.getIsPay() == 1){ |
| | | order.setIsPay(2); |
| | | order.setOrderNum(transaction_id); |
| | | orderMapper.updateById(order); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TShortPlayThemeMapper; |
| | | import com.hollywood.applet.service.TShortPlayThemeService; |
| | | import com.hollywood.common.model.TShortPlayTheme; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧题材 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TShortPlayThemeServiceImpl extends ServiceImpl<TShortPlayThemeMapper, TShortPlayTheme> implements TShortPlayThemeService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TShortPlayToTypeMapper; |
| | | import com.hollywood.applet.service.TShortPlayToTypeService; |
| | | import com.hollywood.common.model.TShortPlayToType; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别中间表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-06 |
| | | */ |
| | | @Service |
| | | public class TShortPlayToTypeServiceImpl extends ServiceImpl<TShortPlayToTypeMapper, TShortPlayToType> implements TShortPlayToTypeService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TShortPlayTypeMapper; |
| | | import com.hollywood.applet.service.TShortPlayTypeService; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TShortPlayTypeServiceImpl extends ServiceImpl<TShortPlayTypeMapper, TShortPlayType> implements TShortPlayTypeService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.dto.ScriptPayDto; |
| | | import com.hollywood.applet.dto.ShortPayDto; |
| | | import com.hollywood.applet.mapper.TOrderMapper; |
| | | import com.hollywood.applet.mapper.TShortPlayVideoMapper; |
| | | import com.hollywood.applet.service.TShortPlayVideoService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.TOrder; |
| | | import com.hollywood.common.model.TScript; |
| | | import com.hollywood.common.model.TShortPlayVideo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧视频 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TShortPlayVideoServiceImpl extends ServiceImpl<TShortPlayVideoMapper, TShortPlayVideo> implements TShortPlayVideoService { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TUserMapper; |
| | | import com.hollywood.applet.query.TUserQuery; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TUser; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-01 |
| | | */ |
| | | @Service |
| | | public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements TUserService { |
| | | |
| | | @Override |
| | | public PageInfo<TUser> userPageList(TUserQuery query) { |
| | | PageInfo<TUser> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TUser> list = this.baseMapper.userPageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TVideoReportMapper; |
| | | import com.hollywood.applet.service.TVideoReportService; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.exception.ServiceException; |
| | | import com.hollywood.common.model.TVideo; |
| | | import com.hollywood.common.model.TVideoReport; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频举报管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TVideoReportServiceImpl extends ServiceImpl<TVideoReportMapper, TVideoReport> implements TVideoReportService { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TVideoMapper; |
| | | import com.hollywood.applet.service.TVideoService; |
| | | import com.hollywood.common.model.TVideo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频管理 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TVideoServiceImpl extends ServiceImpl<TVideoMapper, TVideo> implements TVideoService { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.dto.PerformanceJoinDto; |
| | | import com.hollywood.applet.mapper.TUserMapper; |
| | | import com.hollywood.applet.mapper.TVipConfigMapper; |
| | | import com.hollywood.applet.mapper.TVipPurchaseRecordMapper; |
| | | import com.hollywood.applet.service.TVipConfigService; |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.common.model.*; |
| | | import com.hollywood.common.utils.PayMoneyUtil; |
| | | import com.hollywood.common.utils.UUIDUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员设置 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TVipConfigServiceImpl extends ServiceImpl<TVipConfigMapper, TVipConfig> implements TVipConfigService { |
| | | |
| | | @Resource |
| | | private TUserMapper userMapper; |
| | | @Resource |
| | | private TVipPurchaseRecordMapper vipPurchaseRecordMapper; |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Override |
| | | public ApiResult pay(Long userId, BigDecimal money, Integer month,Integer payType,Integer type) throws Exception { |
| | | //进行支付操作 |
| | | if(payType == 1){//微信支付 |
| | | return weChatPaymentAPerformance(money,userId,month,type); |
| | | } |
| | | if (payType==2){ |
| | | return aliPayPerformance(money,userId,month,type); |
| | | |
| | | } |
| | | return ApiResult.failed("请选择支付方式"); |
| | | } |
| | | |
| | | public ApiResult weChatPaymentAPerformance(BigDecimal money, Long userId,Integer month,Integer type) throws Exception{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | TVipPurchaseRecord tVipPurchaseRecord = new TVipPurchaseRecord(); |
| | | tVipPurchaseRecord.setUserId(userId); |
| | | if (type==1||type==2) { |
| | | tVipPurchaseRecord.setVipType(1); |
| | | } else if (type==3||type==4) { |
| | | tVipPurchaseRecord.setVipType(2); |
| | | } |
| | | switch (type){ |
| | | case 1: tVipPurchaseRecord.setChargeType(1); |
| | | case 2: tVipPurchaseRecord.setChargeType(2); |
| | | case 3: tVipPurchaseRecord.setChargeType(1); |
| | | case 4: tVipPurchaseRecord.setChargeType(2); |
| | | |
| | | } |
| | | tVipPurchaseRecord.setPurchaseCount(month); |
| | | tVipPurchaseRecord.setPayMoney(money.doubleValue()); |
| | | tVipPurchaseRecord.setPayTime(LocalDateTime.now()); |
| | | tVipPurchaseRecord.setCode(code); |
| | | vipPurchaseRecordMapper.insert(tVipPurchaseRecord); |
| | | ApiResult weixinpay = payMoneyUtil.weixinpay("参加演员活动", "", code,money.toString(), "/base/vip/wxcallback", "APP"); |
| | | return weixinpay; |
| | | } |
| | | |
| | | private ApiResult aliPayPerformance(BigDecimal money, Long userId,Integer month,Integer type) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | TVipPurchaseRecord tVipPurchaseRecord = new TVipPurchaseRecord(); |
| | | tVipPurchaseRecord.setUserId(userId); |
| | | if (type==1||type==2) { |
| | | tVipPurchaseRecord.setVipType(1); |
| | | } else if (type==3||type==4) { |
| | | tVipPurchaseRecord.setVipType(2); |
| | | } |
| | | switch (type){ |
| | | case 1: tVipPurchaseRecord.setChargeType(1); |
| | | case 2: tVipPurchaseRecord.setChargeType(2); |
| | | case 3: tVipPurchaseRecord.setChargeType(1); |
| | | case 4: tVipPurchaseRecord.setChargeType(2); |
| | | |
| | | } |
| | | tVipPurchaseRecord.setPurchaseCount(month); |
| | | tVipPurchaseRecord.setPayMoney(money.doubleValue()); |
| | | tVipPurchaseRecord.setPayTime(LocalDateTime.now()); |
| | | tVipPurchaseRecord.setCode(code); |
| | | tVipPurchaseRecord.setIsPay(1); |
| | | vipPurchaseRecordMapper.insert(tVipPurchaseRecord); |
| | | ApiResult alipay = payMoneyUtil.alipay("vip费用", "vip费用", code,money.toString(), "/base/vip/aliPaymentCourseCallback"); |
| | | return alipay; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.hollywood.applet.mapper.TVipPurchaseRecordMapper; |
| | | import com.hollywood.applet.service.TVipPurchaseRecordService; |
| | | import com.hollywood.common.model.TVipPurchaseRecord; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员购买记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Service |
| | | public class TVipPurchaseRecordServiceImpl extends ServiceImpl<TVipPurchaseRecordMapper, TVipPurchaseRecord> implements TVipPurchaseRecordService { |
| | | } |
New file |
| | |
| | | package com.hollywood.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.hollywood.applet.utils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | public class AgeCalculator { |
| | | |
| | | /** |
| | | * Calculate the age based on the given birthdate which is a java.util.Date object. |
| | | * |
| | | * @param birthdate The birthdate as a java.util.Date object. |
| | | * @return The age in years. |
| | | */ |
| | | public static int calculateAge(Date birthdate) { |
| | | // Convert java.util.Date to LocalDate |
| | | LocalDate birthdateLocalDate = birthdate.toInstant() |
| | | .atZone(ZoneId.systemDefault()) |
| | | .toLocalDate(); |
| | | |
| | | // Get the current date |
| | | LocalDate currentDate = LocalDate.now(); |
| | | |
| | | // Calculate the age using Period |
| | | Period agePeriod = Period.between(birthdateLocalDate, currentDate); |
| | | |
| | | // Return the age in years |
| | | return agePeriod.getYears(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.utils; |
| | | |
| | | import org.codehaus.jettison.json.JSONObject; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | |
| | | |
| | | public class AmapGeocoding { |
| | | |
| | | private static final String AMAP_GEOCODING_API = "https://restapi.amap.com/v3/geocode/regeo"; |
| | | private static final String AMAP_KEY = "116e73b6d14f7da0292daa6037955749"; // 替换为你的高德地图API Key |
| | | |
| | | public static String getCityCode(double latitude, double longitude) throws Exception { |
| | | String url = AMAP_GEOCODING_API + "?location=" + longitude + "," + latitude |
| | | + "&output=json&key=" + AMAP_KEY + "&radius=1000&extensions=all"; |
| | | |
| | | HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); |
| | | connection.setRequestMethod("GET"); |
| | | connection.connect(); |
| | | |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | StringBuilder response = new StringBuilder(); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | response.append(line); |
| | | } |
| | | reader.close(); |
| | | connection.disconnect(); |
| | | |
| | | JSONObject jsonObject = new JSONObject(response.toString()); |
| | | if ("1".equals(jsonObject.getString("status"))) { |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | | String cityCode = addressComponent.getString("adcode"); // adcode即为citycode |
| | | return cityCode; |
| | | } else { |
| | | throw new RuntimeException("Failed to fetch city code. Error message: " + jsonObject.getString("info")); |
| | | } |
| | | } |
| | | |
| | | public static String getCityName(double latitude, double longitude) throws Exception { |
| | | String url = AMAP_GEOCODING_API + "?location=" + longitude + "," + latitude |
| | | + "&output=json&key=" + AMAP_KEY + "&radius=1000&extensions=all"; |
| | | |
| | | HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); |
| | | connection.setRequestMethod("GET"); |
| | | connection.connect(); |
| | | |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
| | | StringBuilder response = new StringBuilder(); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | response.append(line); |
| | | } |
| | | reader.close(); |
| | | connection.disconnect(); |
| | | |
| | | JSONObject jsonObject = new JSONObject(response.toString()); |
| | | if ("1".equals(jsonObject.getString("status"))) { |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | | String cityName = addressComponent.getString("city"); // 这里改为了获取城市名称 |
| | | return cityName; |
| | | } else { |
| | | throw new RuntimeException("Failed to fetch city name. Error message: " + jsonObject.getString("info")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | double lat = 116.3913; // 纬度 |
| | | double lng = 39.90539; // 经度 |
| | | System.out.println("City Code: " + getCityCode(lat, lng)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.utils; |
| | | |
| | | import java.text.DecimalFormat; |
| | | |
| | | 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); |
| | | DecimalFormat df = new DecimalFormat("#.##"); // 创建格式化对象,保留两位小数 |
| | | String formattedDistance = df.format(distance); // 格式化距离 |
| | | System.out.println("两个坐标点的距离为: " + formattedDistance + " 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)); |
| | | double distanceInKm = R * c; |
| | | |
| | | // 返回结果保留两位小数 |
| | | String formattedDistance = String.format("%.2f", distanceInKm); |
| | | double roundedDistance = Math.round(distanceInKm * 100) / 100.0; // 四舍五入到两位小数 |
| | | return roundedDistance; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.utils; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.DecimalFormatSymbols; |
| | | import java.util.Locale; |
| | | |
| | | public class DistanceCalculator1 { |
| | | |
| | | private static final double EARTH_RADIUS_KM = 6378.138; // Updated Earth's radius to match SQL query |
| | | |
| | | /** |
| | | * Calculates the distance between two sets of coordinates (latitude and longitude) in kilometers, |
| | | * rounded to two decimal places. Input coordinates are expected to be provided as Strings. |
| | | * |
| | | * @param lat1Str Latitude of the first point as a String in degrees |
| | | * @param lon1Str Longitude of the first point as a String in degrees |
| | | * @param lat2Str Latitude of the second point as a String in degrees |
| | | * @param lon2Str Longitude of the second point as a String in degrees |
| | | * @return The distance between the two points in kilometers, rounded to two decimal places |
| | | * @throws NumberFormatException If any input coordinate cannot be parsed as a double |
| | | */ |
| | | public static double calculateDistanceBetweenCoordinates(String lat1Str, String lon1Str, String lat2Str, String lon2Str) throws NumberFormatException { |
| | | double lat1 = Double.parseDouble(lat1Str); |
| | | double lon1 = Double.parseDouble(lon1Str); |
| | | double lat2 = Double.parseDouble(lat2Str); |
| | | double lon2 = Double.parseDouble(lon2Str); |
| | | |
| | | double dLat = Math.toRadians(lat2 - lat1); |
| | | double dLon = Math.toRadians(lon2 - lon1); |
| | | |
| | | lat1 = Math.toRadians(lat1); |
| | | lat2 = Math.toRadians(lat2); |
| | | |
| | | double a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dLon / 2), 2); |
| | | double c = 2 * Math.asin(Math.sqrt(a)); |
| | | |
| | | double distance = EARTH_RADIUS_KM * c; |
| | | DecimalFormat df = new DecimalFormat("0.##", DecimalFormatSymbols.getInstance(Locale.US)); |
| | | return Double.parseDouble(df.format(distance)); |
| | | } |
| | | } |
New file |
| | |
| | | //package com.hollywood.applet.utils; |
| | | // |
| | | //import com.cloud.apigateway.sdk.utils.Client; |
| | | //import com.cloud.apigateway.sdk.utils.Request; |
| | | //import org.apache.http.Header; |
| | | //import org.apache.http.HttpEntity; |
| | | //import org.apache.http.HttpResponse; |
| | | //import org.apache.http.client.methods.HttpRequestBase; |
| | | //import org.apache.http.conn.ssl.NoopHostnameVerifier; |
| | | //import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | //import org.apache.http.impl.client.CloseableHttpClient; |
| | | //import org.apache.http.impl.client.HttpClients; |
| | | //import org.apache.http.ssl.SSLContextBuilder; |
| | | //import org.apache.http.util.EntityUtils; |
| | | //import org.slf4j.Logger; |
| | | //import org.slf4j.LoggerFactory; |
| | | //import org.springframework.beans.factory.annotation.Value; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import javax.net.ssl.SSLContext; |
| | | //import java.io.IOException; |
| | | //import java.io.UnsupportedEncodingException; |
| | | //import java.net.URLEncoder; |
| | | //import java.util.Arrays; |
| | | //@Component |
| | | //public class HWSendSms { |
| | | // |
| | | // @Value("${huawei.url}") |
| | | // private String url; |
| | | // @Value("${huawei.appKey}") |
| | | // private String appKey; |
| | | // @Value("${huawei.appSecret}") |
| | | // private String appSecret; |
| | | // @Value("${huawei.sender}") |
| | | // private String sender; |
| | | // @Value("${huawei.templateId}") |
| | | // private String templateId; |
| | | // @Value("${huawei.signature}") |
| | | // private String signature; |
| | | // |
| | | // private static final Logger LOGGER = LoggerFactory.getLogger(HWSendSms.class); |
| | | // |
| | | // public static final String UTF_8 = "UTF-8"; |
| | | // |
| | | // private static CloseableHttpClient client = null; |
| | | // |
| | | // public static void main(String[] args) throws Exception { |
| | | // // 为防止因HTTPS证书认证失败造成API调用失败,需要先忽略证书信任问题 |
| | | //// client = createIgnoreSSLHttpClient(); |
| | | //// sendSms(); |
| | | // } |
| | | // |
| | | // public void sendSms(String code,String receiver) throws Exception { |
| | | // client = createIgnoreSSLHttpClient(); |
| | | // //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | //// String url = "https://smsapi.ap-southeast-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址+接口访问URI |
| | | //// // 认证用的appKey和appSecret硬编码到代码中或者明文存储都有很大的安全风险,建议在配置文件或者环境变量中密文存放,使用时解密,确保安全; |
| | | //// String appKey = "c8RWg3gg************3Y7x1Ile"; //Application Key |
| | | //// String appSecret = "q4Ii87Bh************80SfD7Al"; //Application Secret |
| | | //// String sender = "csms12345678"; //中国大陆短信签名通道号或全球短信通道号 |
| | | //// String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID |
| | | //// |
| | | //// //条件必填,中国大陆短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | | //// //全球短信不用关注该参数 |
| | | //// String signature = "华为云短信测试"; //签名名称 |
| | | //// |
| | | //// //必填,全局号码格式(包含国家码),示例:+86151****6789,多个号码之间用英文逗号分隔 |
| | | //// String receiver = "+86151****6789,+86152****7890"; //短信接收人号码 |
| | | //// |
| | | //// //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告 |
| | | // String statusCallBack = ""; |
| | | // |
| | | // /** |
| | | // * 选填,使用无变量模板时请赋空值 String templateParas = ""; |
| | | // * 单变量模板示例:模板内容为"您的验证码是${NUM_6}"时,templateParas可填写为"[\"111111\"]" |
| | | // * 双变量模板示例:模板内容为"您有${NUM_2}件快递请到${TXT_20}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" |
| | | // * 查看更多模板规范和变量规范:产品介绍>短信模板须知和短信变量须知 |
| | | // */ |
| | | // String templateParas = "[\""+code+"\"]"; //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。 |
| | | // |
| | | // //请求Body,不携带签名名称时,signature请填null |
| | | // String body = buildRequestBody(sender, receiver, templateId, templateParas, statusCallBack, signature); |
| | | // if (null == body || body.isEmpty()) { |
| | | // LOGGER.warn("body is null."); |
| | | // return; |
| | | // } |
| | | // |
| | | // Request request = new Request(); |
| | | // request.setKey(appKey); |
| | | // request.setSecret(appSecret); |
| | | // request.setMethod("POST"); |
| | | // request.setUrl(url); |
| | | // request.addHeader("Content-Type", "application/x-www-form-urlencoded"); |
| | | // request.setBody(body); |
| | | // LOGGER.info("Print the body: {}", body); |
| | | // |
| | | // try { |
| | | // HttpRequestBase signedRequest = Client.sign(request, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); |
| | | // LOGGER.info("Print the authorization: {}", Arrays.toString(signedRequest.getHeaders("Authorization"))); |
| | | // Header[] requestAllHeaders = signedRequest.getAllHeaders(); |
| | | // for (Header h : requestAllHeaders) { |
| | | // LOGGER.info("req Header with name: {} and value: {}", h.getName(), h.getValue()); |
| | | // } |
| | | // |
| | | // HttpResponse response = client.execute(signedRequest); |
| | | // |
| | | // LOGGER.info("Print the status line of the response: {}", response.getStatusLine().toString()); |
| | | // Header[] resHeaders = response.getAllHeaders(); |
| | | // for (Header h : resHeaders) { |
| | | // LOGGER.info("Processing Header with name: {} and value: {}", h.getName(), h.getValue()); |
| | | // } |
| | | // HttpEntity resEntity = response.getEntity(); |
| | | // if (resEntity != null) { |
| | | // LOGGER.info("Processing Body with name: {} and value: {}", |
| | | // System.getProperty("line.separator"), |
| | | // EntityUtils.toString(resEntity, "UTF-8")); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // LOGGER.info(e.getMessage(), e); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // |
| | | // public CloseableHttpClient createIgnoreSSLHttpClient() throws Exception { |
| | | // SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (x509CertChain, authType) -> true).build(); |
| | | // return HttpClients.custom().setSSLSocketFactory(new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)).build(); |
| | | // } |
| | | // |
| | | // static String buildRequestBody(String sender, String receiver, String templateId, String templateParas, |
| | | // String statusCallBack, String signature) throws UnsupportedEncodingException { |
| | | // 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; |
| | | // } |
| | | // |
| | | // StringBuilder body = new StringBuilder(); |
| | | // appendToBody(body, "from=", sender); |
| | | // appendToBody(body, "&to=", receiver); |
| | | // appendToBody(body, "&templateId=", templateId); |
| | | // appendToBody(body, "&templateParas=", templateParas); |
| | | // appendToBody(body, "&statusCallback=", statusCallBack); |
| | | // appendToBody(body, "&signature=", signature); |
| | | // return body.toString(); |
| | | // } |
| | | // |
| | | // private static void appendToBody(StringBuilder body, String key, String val) throws UnsupportedEncodingException { |
| | | // if (null != val && !val.isEmpty()) { |
| | | // LOGGER.info("Print appendToBody: {}:{}", key, val); |
| | | // body.append(key).append(URLEncoder.encode(val, UTF_8)); |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.hollywood.applet.utils; |
| | | |
| | | 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+"\"]"; |
| | | //请求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.hollywood.applet.utils; |
| | | // |
| | | //public class HuaweiMsgDto { |
| | | // private String |
| | | //} |
New file |
| | |
| | | package com.hollywood.applet.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.hollywood.applet.service.TUserService; |
| | | import com.hollywood.common.model.TUser; |
| | | import com.hollywood.common.security.JwtTokenUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class LoginInfoUtil { |
| | | |
| | | @Autowired |
| | | private TUserService tUserService; |
| | | |
| | | public Long getUserId(){ |
| | | String username = JwtTokenUtils.getUsername(); |
| | | // System.err.println("============"+username); |
| | | // TUser userName = tUserService.getOne(new QueryWrapper<TUser>().eq("userPhone", username).eq("isDelete",0)); |
| | | return Long.parseLong(username); |
| | | // return 2L; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.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.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.hollywood.applet.utils; |
| | | |
| | | import java.security.SecureRandom; |
| | | import java.util.Random; |
| | | |
| | | public class RandomStringGenerator { |
| | | |
| | | private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
| | | private static final Random RANDOM = new SecureRandom(); |
| | | |
| | | public static String generateRandomString() { |
| | | StringBuilder sb = new StringBuilder(6); |
| | | for (int i = 0; i < 6; i++) { |
| | | int index = RANDOM.nextInt(ALPHABET.length()); |
| | | sb.append(ALPHABET.charAt(index)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(generateRandomString()); |
| | | } |
| | | } |
New file |
| | |
| | | //package com.hollywood.applet.utils; |
| | | // |
| | | // |
| | | // |
| | | //import com.alibaba.fastjson.JSON; |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | //import com.twilio.Twilio; |
| | | //import com.twilio.rest.api.v2010.account.Message; |
| | | //import com.twilio.type.PhoneNumber; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //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 SMSUtil { |
| | | // |
| | | // //无需修改,用于格式化鉴权头域,给"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\""; |
| | | // |
| | | // /** |
| | | // * 发送短信(华为云) |
| | | // * @param templateId 模板id |
| | | // * @param receiver 必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 |
| | | // * @param templateParas 选填,使用无变量模板时请赋空值 String templateParas = "",双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" |
| | | // * 模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569) |
| | | // * @throws Exception |
| | | // */ |
| | | // public static void send_huawei_sms(String templateId, String receiver, String templateParas) throws Exception { |
| | | // |
| | | // //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | // String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | // String appKey = "g3DW0G5Fbp3110UiGl5fkWcn799s"; //APP_Key |
| | | // String appSecret = "LaT1NYvQKNkHO5KikniEueN8iTaz"; //APP_Secret |
| | | // String sender = "ismsapp0000000103"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | // |
| | | // //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | | // //国际/港澳台短信不用关注该参数 |
| | | // String signature = "IGO"; //签名名称 |
| | | // |
| | | // //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告 |
| | | // String statusCallBack = ""; |
| | | // |
| | | // //请求Body,不携带签名名称时,signature请填null |
| | | // String body = buildRequestBody(sender, receiver, templateId, templateParas, statusCallBack, 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; |
| | | // } |
| | | // }; |
| | | // trustAllHttpsCertificates(); |
| | | // |
| | | // 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() { |
| | | // public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
| | | // return; |
| | | // } |
| | | // public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
| | | // return; |
| | | // } |
| | | // public X509Certificate[] getAcceptedIssuers() { |
| | | // return null; |
| | | // } |
| | | // } |
| | | // }; |
| | | // SSLContext sc = SSLContext.getInstance("SSL"); |
| | | // sc.init(null, trustAllCerts, null); |
| | | // HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 发送Twilio短信 |
| | | // * @param toPhone |
| | | // * @param msg |
| | | // * @return |
| | | // */ |
| | | // public static boolean sendTwilioMessage(String toPhone, String msg){ |
| | | // String ACCOUNT_SID = "AC1fd05e898bd59d17ba72db621afca537"; |
| | | // String AUTH_TOKEN = "7cee1a6cb0e2936a9037be577b1ffe57"; |
| | | // String formPhone = "+16672740015"; |
| | | // try { |
| | | // Twilio.init(ACCOUNT_SID, AUTH_TOKEN); |
| | | // Message message = Message.creator( |
| | | // new PhoneNumber(toPhone), |
| | | // new PhoneNumber(formPhone), |
| | | // msg |
| | | // ).create(); |
| | | // System.out.println(message.getSid()); |
| | | // Message.Status status = message.getStatus(); |
| | | // switch (status.toString()){ |
| | | // case "canceled": |
| | | // return false; |
| | | // case "undelivered": |
| | | // return false; |
| | | // case "failed": |
| | | // return false; |
| | | // } |
| | | // return true; |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return false; |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 短信 : https://www.nalosolutions.com/ |
| | | // * @param toPhone |
| | | // * @param msg |
| | | // * @return |
| | | // */ |
| | | // public boolean sendCellulantMessage(String toPhone, String msg){ |
| | | // String url = "https://sms.nalosolutions.com/smsbackend/Nal_resl/send-message/"; |
| | | // HttpRequest post = HttpUtil.createPost(url); |
| | | // post.contentType(ContentType.JSON.toString()); |
| | | // JSONObject params = new JSONObject(); |
| | | // params.put("key", "ru#0flkf3993qh!!rg!@y4)nhwi08c#tg_vasek!ja)kvfnfjyoljoz(@nai(jkf"); |
| | | // params.put("msisdn", toPhone); |
| | | // params.put("message", msg); |
| | | // params.put("sender_id", "I-GO"); |
| | | // post.body(params.toJSONString()); |
| | | // HttpResponse execute = post.execute(); |
| | | // String body = execute.body(); |
| | | // execute.close(); |
| | | // JSONObject jsonObject = JSON.parseObject(body); |
| | | // Integer status = jsonObject.getInteger("status"); |
| | | // if(null != status && 1701 == status){ |
| | | // return true; |
| | | // }else{ |
| | | // System.err.println("短信发送失败:" + jsonObject.toJSONString()); |
| | | // return false; |
| | | // } |
| | | // } |
| | | // |
| | | // public static void main(String[] ages){ |
| | | // SMSUtil smsUtil = new SMSUtil(); |
| | | // smsUtil.sendCellulantMessage("233244915521", "您的验证码为:123456,该验证码5分钟内有效,请勿泄漏于他人!"); |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.hollywood.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 |
| | |
| | | package com.hollywood.applet.utils; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | public class WeChatCodeFetcher { |
| | | |
| | | private static final String APP_ID = "wx7c416e2aca3d243b"; |
| | | private static final String APP_SECRET = "500b93923b55958df4596b752fde57ff"; |
| | | // private static final String REDIRECT_URI = "https://your.redirect.uri"; // 替换为你的重定向URI |
| | | private static final String GET_CODE_API = "https://api.weixin.qq.com/sns/jscode2session"; |
| | | |
| | | public static String fetchCode(String jsCode) throws Exception { |
| | | URL url = new URL(GET_CODE_API); |
| | | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| | | connection.setRequestMethod("POST"); |
| | | connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
| | | connection.setDoOutput(true); |
| | | |
| | | StringBuilder postData = new StringBuilder(); |
| | | postData.append("appid=").append(APP_ID); |
| | | postData.append("&secret=").append(APP_SECRET); |
| | | postData.append("&js_code=").append(jsCode); |
| | | postData.append("&grant_type=authorization_code"); |
| | | |
| | | byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8); |
| | | connection.getOutputStream().write(postDataBytes); |
| | | |
| | | StringBuilder response = new StringBuilder(); |
| | | try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { |
| | | String line; |
| | | while ((line = in.readLine()) != null) { |
| | | response.append(line); |
| | | } |
| | | } |
| | | |
| | | connection.disconnect(); |
| | | |
| | | return response.toString(); // 返回JSON格式的响应,包含code |
| | | } |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "供需管理VO") |
| | | public class TCompanyNeedVO extends TCompanyNeed { |
| | | |
| | | @ApiModelProperty(value = "企业名称") |
| | | private String companyName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TOrder; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "订单管理VO") |
| | | public class TOrderVO extends TOrder { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "热门活动参与用户列表VO") |
| | | public class TPopularActivityUserVO extends TPopularActivityUser { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "热门活动列表VO") |
| | | public class TPopularActivityVO extends TPopularActivity { |
| | | |
| | | @ApiModelProperty(value = "已报名用户数") |
| | | private Integer applicationCount; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TRegion; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "省市返回VO") |
| | | public class TRegionVO extends TRegion { |
| | | |
| | | @ApiModelProperty(value = "父级code") |
| | | private String parentCode; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TScript; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "剧本列表VO") |
| | | public class TScriptVO extends TScript { |
| | | |
| | | @ApiModelProperty(value = "剧本题材名称") |
| | | private String themeName; |
| | | |
| | | @ApiModelProperty(value = "剧本类别名称") |
| | | private String typeName; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.hollywood.common.model.TShortPlay; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | import com.hollywood.common.model.TShortPlayVideo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短剧返回VO") |
| | | public class TShortPlayVO extends TShortPlay { |
| | | |
| | | @ApiModelProperty(value = "短剧类别名称") |
| | | private String typeName; |
| | | |
| | | @ApiModelProperty(value = "短剧题材名称") |
| | | private String themeName; |
| | | |
| | | @ApiModelProperty(value = "短剧类别id集合") |
| | | private List<Long> typeIds; |
| | | |
| | | @ApiModelProperty(value = "短剧视频集合") |
| | | private List<TShortPlayVideo> shortPlayVideos; |
| | | |
| | | @ApiModelProperty(value = "短剧类别集合") |
| | | private List<TShortPlayType> shortPlayTypes; |
| | | private String shortPlayTypesNames; |
| | | @ApiModelProperty(value = "封面图片") |
| | | private String scriptCover; |
| | | @ApiModelProperty(value = "详情介绍") |
| | | private String detailIntroduce; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | private String detailPicture; |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TVideo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "短视频列表VO") |
| | | public class TVideoVO extends TVideo { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.hollywood.common.model.TVipPurchaseRecord; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "会员购买记录列表VO") |
| | | public class TVipPurchaseRecordVO extends TVipPurchaseRecord { |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | @Data |
| | | public class ToBeActorVO { |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("userPhone") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "毕业院校") |
| | | @TableField("graduationInstitution") |
| | | private String graduationInstitution; |
| | | |
| | | @ApiModelProperty(value = "自我介绍") |
| | | @TableField("selfIntroduction") |
| | | private String selfIntroduction; |
| | | @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 = "昵称") |
| | | @TableField("nickName") |
| | | private String nickName; |
| | | @ApiModelProperty(value = "身高") |
| | | @TableField("height") |
| | | private Double height; |
| | | |
| | | @ApiModelProperty(value = "体重") |
| | | @TableField("weight") |
| | | private Double weight; |
| | | @ApiModelProperty(value = "生日") |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | @TableField("birthday") |
| | | private LocalDateTime birthday; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.applet.wx.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Watermark { |
| | | private String appid; |
| | | private String timestamp; |
| | | } |
New file |
| | |
| | | package com.hollywood.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.hollywood.common.config.JacksonConfig; |
| | | import com.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.applet.wx.utils; |
| | | |
| | | import com.hollywood.applet.wx.body.resp.AccessTokenRespBody; |
| | | import com.hollywood.applet.wx.body.resp.Code2SessionRespBody; |
| | | import com.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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: 8088 |
| | | tomcat: |
| | | max-swallow-size: 500MB |
| | | |
| | | spring: |
| | | thymeleaf: |
| | | cache: false |
| | | servlet: |
| | | multipart: |
| | | max-file-size: 500MB |
| | | max-request-size: 500MB |
| | | resolve-lazily: true #设置为懒加载,不然依然会捕获不到异常 |
| | | profiles: |
| | | active: prod |
| | | 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.34:3306/hollywoodtest?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: "" |
| | | |
| | | #正式环境 |
| | | --- |
| | | spring: |
| | | config: |
| | | activate: |
| | | on-profile: prod |
| | | # 数据源 |
| | | datasource: |
| | | url: jdbc:mysql://1.94.236.2:3306/hollywood?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: Xiwang2024! |
| | | 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: 1.94.236.2 |
| | | port: 6379 |
| | | timeout: 5000 |
| | | database: 1 |
| | | password: Xiwang2024! |
| | | alipay: |
| | | appid: "" |
| | | appPrivateKey: "" |
| | | alipayPublicKey: "" |
| | | alipay_public_key: "" |
| | | wx: |
| | | appid: "" |
| | | mchId: "" |
| | | key: |
| | | callbackPath: "" |
| | | hw: |
| | | sms: |
| | | url: "https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1" |
| | | appKey: "3kj9d96va5R8Tj0BfO567MeDs4er" |
| | | appSecret: "AusjNRlXKOKWnsGiInqiPM3wV7sC" |
| | | sender: "8824051324448" |
| | | templateId: "a727edf213164cc299acd055d5fe5ac3" |
| | | 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.hollywood.applet.mapper.LoginLogMapper"> |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.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.hollywood.applet.mapper.TAdvertisementConfigMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TAdvertisementConfig"> |
| | | <id column="id" property="id" /> |
| | | <result column="advertisementConfig" property="advertisementConfig" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, advertisementConfig |
| | | </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.hollywood.applet.mapper.TAdvertisementMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TAdvertisement"> |
| | | <id column="id" property="id" /> |
| | | <result column="advertisementName" property="advertisementName" /> |
| | | <result column="advertisementVideo" property="advertisementVideo" /> |
| | | <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, advertisementName, advertisementVideo, 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.hollywood.applet.mapper.TBannerMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TBanner"> |
| | | <id column="id" property="id" /> |
| | | <result column="bannerName" property="bannerName" /> |
| | | <result column="bannerType" property="bannerType" /> |
| | | <result column="bannerPicture" property="bannerPicture" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, bannerName, bannerType, bannerPicture, sortBy,status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.common.model.TBanner"> |
| | | select id, bannerName, bannerType, bannerPicture, sortBy,status, createTime, updateTime, createBy, updateBy, isDelete |
| | | from t_banner |
| | | <where> |
| | | <if test="query.bannerName != null and query.bannerName != ''"> |
| | | AND bannerName LIKE concat('%',#{query.bannerName},'%') |
| | | </if> |
| | | <if test="query.bannerType != null"> |
| | | AND bannerType = #{query.bannerName} |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY sortBy DESC |
| | | </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.hollywood.applet.mapper.TCompanyMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TCompany"> |
| | | <id column="id" property="id" /> |
| | | <result column="companyName" property="companyName" /> |
| | | <result column="contactsName" property="contactsName" /> |
| | | <result column="contactsPhone" property="contactsPhone" /> |
| | | <result column="provinceName" property="provinceName" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="cityName" property="cityName" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="address" property="address" /> |
| | | <result column="lon" property="lon" /> |
| | | <result column="lat" property="lat" /> |
| | | <result column="companyIntroduction" property="companyIntroduction" /> |
| | | <result column="companyCover" property="companyCover" /> |
| | | <result column="companyPicture" property="companyPicture" /> |
| | | <result column="companyDetail" property="companyDetail" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, companyName, contactsName, contactsPhone, provinceName, provinceCode, cityName, cityCode, address, lon, lat, companyIntroduction, companyCover, companyPicture, companyDetail, sortBy, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.applet.dto.CompanyDistanceDto"> |
| | | SELECT |
| | | id, |
| | | companyName, |
| | | companyIntroduction, |
| | | companyCover, |
| | | CASE |
| | | WHEN cityName IS NOT NULL AND LENGTH(TRIM(cityName)) > 0 THEN CONCAT(provinceName, ' | ', cityName) |
| | | ELSE provinceName |
| | | END AS city, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POWER( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(lat * PI() / 180) * POWER( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ), |
| | | 2 |
| | | ) AS distance |
| | | FROM |
| | | t_company |
| | | <where> |
| | | status = 1 |
| | | <if test="query.companyName != null and query.companyName != ''"> |
| | | AND companyName LIKE concat('%',#{query.companyName},'%') |
| | | </if> |
| | | <if test="query.provinceCode != null and query.provinceCode != ''"> |
| | | AND provinceCode = #{query.provinceCode} |
| | | </if> |
| | | <if test="query.cityCode != null and query.cityCode != ''"> |
| | | AND cityCode = #{query.cityCode} |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY |
| | | <if test="recommand != null and recommand != ''"> |
| | | CASE |
| | | WHEN cityCode = #{recommand} THEN 0 |
| | | ELSE 1 |
| | | END ASC, |
| | | </if> |
| | | sortBy DESC |
| | | </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.hollywood.applet.mapper.TCompanyNeedMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TCompanyNeed"> |
| | | <id column="id" property="id" /> |
| | | <result column="companyId" property="companyId" /> |
| | | <result column="contactName" property="contactName" /> |
| | | <result column="contactPhone" property="contactPhone" /> |
| | | <result column="realation" property="realation" /> |
| | | <result column="title" property="title" /> |
| | | <result column="pics" property="pics" /> |
| | | <result column="introduce" property="introduce" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, companyId, contactName, contactPhone, realation, title, pics, introduce, sortBy, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.applet.vo.TCompanyNeedVO"> |
| | | select tcn.id, tcn.companyId, tcn.contactName, tcn.contactPhone, tcn.realation, tcn.title, tcn.pics, tcn.introduce, tcn.sortBy, tcn.status, |
| | | tcn.createTime, tcn.updateTime, tcn.createBy, tcn.updateBy, tcn.isDelete,tc.companyName |
| | | from t_company_need tcn |
| | | left join t_company tc on tcn.companyId = tc.id |
| | | <where> |
| | | <if test="query.companyName != null and query.companyName != ''"> |
| | | AND tc.companyName LIKE concat('%',#{query.companyName},'%') |
| | | </if> |
| | | <if test="query.contactName != null and query.contactName != ''"> |
| | | AND tcn.contactName LIKE concat('%',#{query.contactName},'%') |
| | | </if> |
| | | <if test="query.contactPhone != null and query.contactPhone != ''"> |
| | | AND tcn.contactPhone LIKE concat('%',#{query.contactPhone},'%') |
| | | </if> |
| | | <if test="query.realation != null"> |
| | | AND tcn.realation = #{query.realation} |
| | | </if> |
| | | AND tcn.isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY tcn.sortBy DESC |
| | | </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.hollywood.applet.mapper.TConfigMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TConfig"> |
| | | <id column="id" property="id" /> |
| | | <result column="content" property="content" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, content |
| | | </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.hollywood.applet.mapper.TCustomerServiceMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TCustomerService"> |
| | | <id column="id" property="id" /> |
| | | <result column="servicePhone" property="servicePhone" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, servicePhone |
| | | </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.hollywood.applet.mapper.TInformationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TInformation"> |
| | | <id column="id" property="id" /> |
| | | <result column="informationTitle" property="informationTitle" /> |
| | | <result column="informationCover" property="informationCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="informationContent" property="informationContent" /> |
| | | <result column="status" property="status" /> |
| | | <result column="readCount" property="readCount" /> |
| | | <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, informationTitle, informationCover, detailPicture, informationContent, status, readCount, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.common.model.TInformation"> |
| | | SELECT id, informationTitle, informationCover, detailPicture, informationContent, status, readCount, createTime, updateTime, createBy, updateBy, isDelete |
| | | FROM t_information |
| | | <where> |
| | | <if test="query.informationTitle != null and query.informationTitle != ''"> |
| | | AND informationTitle LIKE concat('%',#{query.informationTitle},'%') |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY createTime DESC |
| | | </select> |
| | | <select id="queryByName" resultType="com.hollywood.common.model.TInformation"> |
| | | SELECT *,CONCAT(ti.informationTitle,informationContent) as searchinfo from t_information ti |
| | | <where> |
| | | ti.isDelete = 0 and ti.status = 1 and ti.informationType = 1 |
| | | <if test="name !=null and name !=''"> |
| | | and ti.informationTitle LIKE concat('%',#{name},'%') |
| | | </if> |
| | | </where> |
| | | order by ti.createTime desc |
| | | </select> |
| | | |
| | | <select id="queryByNameSource" resultType="com.hollywood.common.model.TInformation"> |
| | | SELECT *,CONCAT(ti.informationTitle,informationContent) as searchinfo from t_information ti |
| | | <where> |
| | | ti.isDelete = 0 and ti.status = 1 and ti.informationType = 2 |
| | | <if test="name !=null and name !=''"> |
| | | and ti.informationTitle LIKE concat('%',#{name},'%') |
| | | </if> |
| | | </where> |
| | | order by ti.createTime desc |
| | | </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.hollywood.applet.mapper.TOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TOrder"> |
| | | <id column="id" property="id" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="productType" property="productType" /> |
| | | <result column="productName" property="productName" /> |
| | | <result column="releasePerson" property="releasePerson" /> |
| | | <result column="releasePhone" property="releasePhone" /> |
| | | <result column="productDeposit" property="productDeposit" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <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, userId, productType, productName, releasePerson, releasePhone, productDeposit, payTime, 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.hollywood.applet.mapper.TPerformerActivityMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TPerformerActivity"> |
| | | <id column="id" property="id" /> |
| | | <result column="activityName" property="activityName" /> |
| | | <result column="voteType" property="voteType" /> |
| | | <result column="voteCount" property="voteCount" /> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="endTime" property="endTime" /> |
| | | <result column="registrationDeadlineTime" property="registrationDeadlineTime" /> |
| | | <result column="registrationFee" property="registrationFee" /> |
| | | <result column="activityIntroduction" property="activityIntroduction" /> |
| | | <result column="activityCover" property="activityCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="detailIntroduce" property="detailIntroduce" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <result column="activityStatus" property="activityStatus" /> |
| | | <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, activityName,voteType, voteCount, startTime, endTime, registrationDeadlineTime, registrationFee,activityIntroduction, activityCover, detailPicture, detailIntroduce, |
| | | sortBy,activityStatus, status, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.common.model.TPerformerActivity"> |
| | | SELECT ta.id,ta.activityName,ta.voteType,ta.voteCount,ta.startTime,ta.endTime,ta.registrationDeadlineTime,ta.registrationFee,ta.activityIntroduction,ta.activityCover,ta.detailPicture,ta.detailIntroduce,ta.sortBy,ta.activityStatus,ta.status,ta.createTime,ta.updateTime,ta.createBy,ta.updateBy, |
| | | count(au.gainVotesCount) as hot |
| | | FROM t_performer_activity ta |
| | | LEFT JOIN t_performer_activity_user au on ta.id = au.activityId |
| | | <where> |
| | | AND ta.type = #{query.type} |
| | | <if test="query.activityName != null and query.activityName != ''"> |
| | | AND ta.activityName LIKE concat('%',#{query.activityName},'%') |
| | | </if> |
| | | <if test="query.voteType != null"> |
| | | AND ta.voteType = #{query.voteType} |
| | | </if> |
| | | <if test="query.activityStatus != null"> |
| | | AND ta.activityStatus = #{query.activityStatus} |
| | | </if> |
| | | <if test="ids != null and ids.size() > 0"> |
| | | and ta.id IN |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND ta.isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} and status = 1 |
| | | </where> |
| | | GROUP BY ta.id |
| | | ORDER BY |
| | | <if test="query.OrderDate != null and query.OrderDate == 0"> |
| | | ta.createTime, |
| | | </if> |
| | | <if test="query.OrderDate != null and query.OrderDate == 1"> |
| | | ta.createTime desc, |
| | | </if> |
| | | <if test="query.OrderVote != null and query.OrderVote == 0"> |
| | | hot, |
| | | </if> |
| | | <if test="query.OrderVote != null and query.OrderVote == 1"> |
| | | hot desc, |
| | | </if> |
| | | ta.sortBy DESC |
| | | </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.hollywood.applet.mapper.TPerformerActivityUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TPerformerActivityUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="userName" property="userName" /> |
| | | <result column="personPhone" property="personPhone" /> |
| | | <result column="gainVotesCount" property="gainVotesCount" /> |
| | | <result column="selfIntroduction" property="selfIntroduction" /> |
| | | <result column="performerCover" property="performerCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <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,activityId, personName, personPhone, gainVotesCount, selfIntroduction, performerCover, detailPicture, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="userPageList" resultType="com.hollywood.common.model.TPerformerActivityUser"> |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_performer_activity_user |
| | | <where> |
| | | isPay = 2 |
| | | <if test="query.activityId != null"> |
| | | AND activityId = #{query.activityId} |
| | | </if> |
| | | <if test="query.personName != null and query.personName != ''"> |
| | | AND personName LIKE concat('%',#{query.personName},'%') |
| | | </if> |
| | | <if test="query.personPhone != null and query.personPhone != ''"> |
| | | AND personPhone LIKE concat('%',#{query.personPhone},'%') |
| | | </if> |
| | | </where> |
| | | <if test="query.hot != null and query.hot ==1"> |
| | | order by gainVotesCount desc |
| | | </if> |
| | | <if test="query.hot != null and query.hot ==0"> |
| | | order by gainVotesCount |
| | | </if> |
| | | <if test="query.time != null and query.time ==0"> |
| | | order by createTime |
| | | </if> |
| | | <if test="query.time != null and query.time ==1"> |
| | | order by createTime desc |
| | | </if> |
| | | </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.hollywood.applet.mapper.TPopularActivityMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TPopularActivity"> |
| | | <id column="id" property="id" /> |
| | | <result column="activityName" property="activityName" /> |
| | | <result column="participatingUserType" property="participatingUserType" /> |
| | | <result column="registrationFee" property="registrationFee" /> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="endTime" property="endTime" /> |
| | | <result column="registrationDeadlineTime" property="registrationDeadlineTime" /> |
| | | <result column="activityIntroduction" property="activityIntroduction" /> |
| | | <result column="provinceName" property="provinceName" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="cityName" property="cityName" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="activityAddress" property="activityAddress" /> |
| | | <result column="lon" property="lon" /> |
| | | <result column="lat" property="lat" /> |
| | | <result column="activityCover" property="activityCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="detailIntroduce" property="detailIntroduce" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, activityName, participatingUserType, registrationFee, startTime, endTime, registrationDeadlineTime, activityIntroduction, activityAddress, |
| | | lon, lat, activityCover, detailPicture, detailIntroduce, sortBy,activityStatus, status,createTime, updateTime, createBy, updateBy, isDelete, |
| | | cityName,cityCode,activityStatus |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.applet.vo.TPopularActivityVO"> |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_popular_activity |
| | | <where> |
| | | status = 1 |
| | | <if test="query.activityName != null and query.activityName != ''"> |
| | | AND activityName LIKE concat('%',#{query.activityName},'%') |
| | | </if> |
| | | <if test="query.participatingUserType != null"> |
| | | AND participatingUserType = #{query.participatingUserType} |
| | | </if> |
| | | <if test="query.activityStatus != null"> |
| | | AND activityStatus = #{query.activityName} |
| | | </if> |
| | | <if test="query.cityCode != null and query.cityCode != ''"> |
| | | AND cityCode = #{query.cityCode} |
| | | </if> |
| | | <if test="ids != null and ids.size() > 0"> |
| | | and id IN |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY sortBy DESC |
| | | </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.hollywood.applet.mapper.TPopularActivityUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TPopularActivityUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="activityId" property="activityId" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="applicationTime" property="applicationTime" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, activityId, userId, applicationTime |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.applet.vo.TPopularActivityUserVO"> |
| | | SELECT tpau.id, tpau.activityId, tpau.userId, tpau.applicationTime,tu.userName,tu.userPhone |
| | | FROM t_popular_activity_user tpau |
| | | LEFT JOIN t_user tu ON tpau.userId = tu.id |
| | | <where> |
| | | <if test="query.activityId != null"> |
| | | AND tpau.activityId = #{query.activityId} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND tu.userName LIKE concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="query.userPhone != null and query.userPhone != ''"> |
| | | AND tu.userPhone LIKE concat('%',#{query.userPhone},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY tpau.applicationTime DESC |
| | | </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.hollywood.applet.mapper.TRegionMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TRegion"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="code" property="code" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="parentId" property="parentId" /> |
| | | <result column="english" property="english" /> |
| | | <result column="initial" property="initial" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, `name`, code, cityCode, parentId, english, initial |
| | | </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.hollywood.applet.mapper.TScenicSpotMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TScenicSpot"> |
| | | <id column="id" property="id" /> |
| | | <result column="scenicName" property="scenicName" /> |
| | | <result column="scenicIntroduction" property="scenicIntroduction" /> |
| | | <result column="provinceName" property="provinceName" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="cityName" property="cityName" /> |
| | | <result column="cityCode" property="cityCode" /> |
| | | <result column="address" property="address" /> |
| | | <result column="lon" property="lon" /> |
| | | <result column="lat" property="lat" /> |
| | | <result column="scenicCover" property="scenicCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="detailIntroduce" property="detailIntroduce" /> |
| | | <result column="status" property="status" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, scenicName, scenicIntroduction, address, lon, lat, scenicCover, detailPicture, detailIntroduce, status, sortBy, 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.hollywood.applet.mapper.TScriptMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TScript"> |
| | | <id column="id" property="id" /> |
| | | <result column="typeId" property="typeId" /> |
| | | <result column="themeId" property="themeId" /> |
| | | <result column="scriptName" property="scriptName" /> |
| | | <result column="releasePerson" property="releasePerson" /> |
| | | <result column="releasePhone" property="releasePhone" /> |
| | | <result column="scriptBasePrice" property="scriptBasePrice" /> |
| | | <result column="scriptCeilingPrice" property="scriptCeilingPrice" /> |
| | | <result column="scriptDeposit" property="scriptDeposit" /> |
| | | <result column="scriptSummary" property="scriptSummary" /> |
| | | <result column="scriptCover" property="scriptCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="detailIntroduce" property="detailIntroduce" /> |
| | | <result column="status" property="status" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, typeId, themeId, scriptName, releasePerson, releasePhone, scriptBasePrice, scriptCeilingPrice, scriptDeposit, scriptSummary, scriptCover, detailPicture, detailIntroduce, |
| | | status,sortBy, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.applet.dto.TScriptVO"> |
| | | SELECT ts.id, ts.typeId, ts.themeId, ts.scriptName, ts.releasePerson, ts.releasePhone, ts.scriptBasePrice, ts.scriptCeilingPrice, ts.scriptDeposit, |
| | | ts.scriptSummary, ts.scriptCover, ts.detailPicture, ts.detailIntroduce,ts.status,ts.sortBy, ts.createTime, ts.updateTime, ts.createBy, |
| | | ts.updateBy, ts.isDelete,tsty.typeName,tsth.themeName |
| | | FROM t_script ts |
| | | LEFT JOIN t_script_theme tsth ON ts.themeId = tsth.id |
| | | LEFT JOIN t_script_type tsty ON ts.typeId = tsty.id |
| | | <where> |
| | | <if test="ids.size() == 0"> |
| | | status = 1 |
| | | </if> |
| | | |
| | | <if test="query.scriptName != null and query.scriptName != ''"> |
| | | AND ts.scriptName LIKE concat('%',#{query.scriptName},'%') |
| | | </if> |
| | | <if test="query.typeId != null"> |
| | | AND tsty.id = #{query.typeId} |
| | | </if> |
| | | <if test="query.themeId != null"> |
| | | AND tsth.id = #{query.themeId} |
| | | </if> |
| | | <if test="query.scriptBasePrice != null"> |
| | | AND ts.scriptBasePrice >= #{query.scriptBasePrice} |
| | | </if> |
| | | <if test="query.scriptCeilingPrice != null"> |
| | | AND ts.scriptCeilingPrice <= #{query.scriptCeilingPrice} |
| | | </if> |
| | | <if test="ids != null and ids.size() > 0"> |
| | | and ts.id IN |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND ts.isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY ts.sortBy DESC |
| | | </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.hollywood.applet.mapper.TScriptThemeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TScriptTheme"> |
| | | <id column="id" property="id" /> |
| | | <result column="themeName" property="themeName" /> |
| | | <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, themeName, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.common.model.TScriptTheme"> |
| | | SELECT id, themeName, createTime, updateTime, createBy, updateBy, isDelete |
| | | FROM t_script_theme |
| | | <where> |
| | | <if test="query.themeName != null and query.themeName != ''"> |
| | | AND themeName LIKE concat('%',#{query.themeName},'%') |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY createTime DESC |
| | | </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.hollywood.applet.mapper.TScriptTypeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TScriptType"> |
| | | <id column="id" property="id" /> |
| | | <result column="typeName" property="typeName" /> |
| | | <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, typeName, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.common.model.TScriptType"> |
| | | SELECT id, typeName, createTime, updateTime, createBy, updateBy, isDelete |
| | | FROM t_script_type |
| | | <where> |
| | | <if test="query.typeName != null and query.typeName != ''"> |
| | | AND typeName LIKE concat('%',#{query.typeName},'%') |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY createTime DESC |
| | | </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.hollywood.applet.mapper.TShortPlayMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TShortPlay"> |
| | | <id column="id" property="id" /> |
| | | <result column="themeId" property="themeId" /> |
| | | <result column="shortPlayName" property="shortPlayName" /> |
| | | <result column="releasePerson" property="releasePerson" /> |
| | | <result column="releasePhone" property="releasePhone" /> |
| | | <result column="shortPlayBasePrice" property="shortPlayBasePrice" /> |
| | | <result column="shortPlayCeilingPrice" property="shortPlayCeilingPrice" /> |
| | | <result column="shortPlayDeposit" property="shortPlayDeposit" /> |
| | | <result column="shortPlaySummary" property="shortPlaySummary" /> |
| | | <result column="scriptCover" property="scriptCover" /> |
| | | <result column="detailPicture" property="detailPicture" /> |
| | | <result column="detailIntroduce" property="detailIntroduce" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <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, themeId, shortPlayName, releasePerson, releasePhone, shortPlayBasePrice, shortPlayCeilingPrice, shortPlayDeposit, shortPlaySummary, scriptCover, |
| | | detailPicture, detailIntroduce, sortBy, status,createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | <select id="pageList" resultType="com.hollywood.applet.vo.TShortPlayVO"> |
| | | SELECT tsp.id, tsp.themeId, tsp.shortPlayName, tsp.releasePerson, tsp.releasePhone, tsp.shortPlayBasePrice, tsp.shortPlayCeilingPrice, tsp.shortPlayDeposit, |
| | | tsp.shortPlaySummary, tsp.scriptCover, tsp.detailPicture, tsp.detailIntroduce, tsp.sortBy,tsp.status, tsp.createTime, tsp.updateTime, tsp.createBy, |
| | | tsp.updateBy, tsp.isDelete,tspt.themeName |
| | | FROM t_short_play tsp |
| | | LEFT JOIN t_short_play_theme tspt ON tsp.themeId = tspt.id |
| | | LEFT JOIN t_short_play_to_type tsptt ON tsp.id = tsptt.shortPlayId |
| | | <where> |
| | | tsp.isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | <if test="ids.size() == 0"> |
| | | and tsp.status = 1 |
| | | </if> |
| | | |
| | | <if test="query.themeId != null"> |
| | | AND tsp.themeId = #{query.themeId} |
| | | </if> |
| | | <if test="query.typeId != null"> |
| | | AND tsptt.typeId = #{query.typeId} |
| | | </if> |
| | | <if test="query.shortPlayName != null and query.shortPlayName != ''"> |
| | | AND tsp.shortPlayName LIKE concat('%',#{query.shortPlayName},'%') |
| | | </if> |
| | | <if test="ids != null and ids.size() > 0"> |
| | | and tsp.id IN |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND tsp.isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | GROUP BY tsp.id |
| | | ORDER BY |
| | | <if test="query.hot != null and query.hot ==1 "> |
| | | tsp.playNum desc, |
| | | </if> |
| | | tsp.sortBy DESC |
| | | </select> |
| | | |
| | | <select id="getHotTwo" resultType="com.hollywood.applet.vo.TShortPlayVO"> |
| | | SELECT tsp.id, tsp.themeId, tsp.shortPlayName, tsp.releasePerson, tsp.releasePhone, tsp.shortPlayBasePrice, tsp.shortPlayCeilingPrice, tsp.shortPlayDeposit, |
| | | tsp.shortPlaySummary, tsp.scriptCover, tsp.detailPicture, tsp.detailIntroduce, tsp.sortBy,tsp.status, tsp.createTime, tsp.updateTime, tsp.createBy, |
| | | tsp.updateBy, tsp.isDelete,tspt.themeName |
| | | FROM t_short_play tsp |
| | | LEFT JOIN t_short_play_theme tspt ON tsp.themeId = tspt.id |
| | | LEFT JOIN t_short_play_to_type tsptt ON tsp.id = tsptt.shortPlayId |
| | | <where> |
| | | tsp.isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | and tsp.status = 1 |
| | | |
| | | </where> |
| | | GROUP BY tsp.id |
| | | ORDER BY tsp.playNum desc |
| | | limit 4 |
| | | |
| | | </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.hollywood.applet.mapper.TShortPlayThemeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TShortPlayTheme"> |
| | | <id column="id" property="id" /> |
| | | <result column="themeName" property="themeName" /> |
| | | <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, themeName, 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.hollywood.applet.mapper.TShortPlayTypeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TShortPlayType"> |
| | | <id column="id" property="id" /> |
| | | <result column="typeName" property="typeName" /> |
| | | <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, typeName, 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.hollywood.applet.mapper.TShortPlayVideoMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TShortPlayVideo"> |
| | | <id column="id" property="id" /> |
| | | <result column="shortPlayId" property="shortPlayId" /> |
| | | <result column="videoName" property="videoName" /> |
| | | <result column="sortBy" property="sortBy" /> |
| | | <result column="visibleVip" property="visibleVip" /> |
| | | <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, shortPlayId, videoName, sortBy, visibleVip, 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.hollywood.applet.mapper.TUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="userName" property="userName" /> |
| | | <result column="userPhone" property="userPhone" /> |
| | | <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="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="vipLevel" property="vipLevel" /> |
| | | <result column="nickName" property="nickName" /> |
| | | <result column="lastLoginTime" property="lastLoginTime" /> |
| | | <result column="height" property="height" /> |
| | | <result column="weight" property="weight" /> |
| | | <result column="birthday" property="birthday" /> |
| | | <result column="sex" property="sex" /> |
| | | <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, userName, userPhone, vipType, insertTime, graduationInstitution, selfIntroduction, firstVipTime, startTime, endTime, consumptionAmount, |
| | | provinceName, provinceCode, cityName, cityCode, performerCover, detailPicture, openId, status, auditStatus, auditRemark,vipLevel, |
| | | nickName,lastLoginTime,height,weight,birthday,sex,createTime,updateTime, createBy, updateBy, isDelete,hot |
| | | </sql> |
| | | <select id="userPageList" resultType="com.hollywood.common.model.TUser"> |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_user |
| | | <where> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND nickName LIKE concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="query.auditStatus != null "> |
| | | AND auditStatus = #{query.auditStatus} and performerStatus = 1 and status = 1 |
| | | </if> |
| | | <if test="query.userPhone != null and query.userPhone != ''"> |
| | | AND userPhone LIKE concat('%',#{query.userPhone},'%') |
| | | </if> |
| | | <if test="query.vipType != null"> |
| | | AND vipType = #{query.vipType} |
| | | </if> |
| | | <if test="query.pageType == 2"> |
| | | AND vipType != 3 |
| | | </if> |
| | | AND isDelete = ${@com.hollywood.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY |
| | | <if test="query.hot == 1"> |
| | | hot desc, |
| | | </if> |
| | | <if test="query.hot == 0"> |
| | | hot, |
| | | </if> |
| | | <if test="query.pubOrder == 0"> |
| | | auditTime, |
| | | </if> |
| | | auditTime DESC |
| | | </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.hollywood.applet.mapper.TVideoMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TVideo"> |
| | | <id column="id" property="id" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="videoTitle" property="videoTitle" /> |
| | | <result column="videoFile" property="videoFile" /> |
| | | <result column="likeCount" property="likeCount" /> |
| | | <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, userId, videoTitle, videoFile, likeCount, 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.hollywood.applet.mapper.TVipConfigMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TVipConfig"> |
| | | <id column="id" property="id" /> |
| | | <result column="personalVipCost" property="personalVipCost" /> |
| | | <result column="personalVipRenew" property="personalVipRenew" /> |
| | | <result column="enterpriseVipCost" property="enterpriseVipCost" /> |
| | | <result column="enterpriseVipRenew" property="enterpriseVipRenew" /> |
| | | <result column="personVipLevel" property="personVipLevel" /> |
| | | <result column="enterpriseVipLevel" property="enterpriseVipLevel" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, personalVipCost, personalVipRenew, enterpriseVipCost, enterpriseVipRenew, personVipLevel, enterpriseVipLevel |
| | | </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.hollywood.applet.mapper.TVipPurchaseRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.hollywood.common.model.TVipPurchaseRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="vipType" property="vipType" /> |
| | | <result column="chargeType" property="chargeType" /> |
| | | <result column="purchaseCount" property="purchaseCount" /> |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <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, userId, vipType, chargeType, purchaseCount, payMoney, payTime, createTime, updateTime, createBy, updateBy, isDelete |
| | | </sql> |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.LoginLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录日志 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2022-09-21 |
| | | */ |
| | | public interface LoginLogMapper extends BaseMapper<LoginLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TAdvertisementConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 广告配置 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TAdvertisementConfigMapper extends BaseMapper<TAdvertisementConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TAdvertisement; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 插播广告管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TAdvertisementMapper extends BaseMapper<TAdvertisement> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TBannerQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TBanner; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * banner表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TBannerMapper extends BaseMapper<TBanner> { |
| | | |
| | | /** |
| | | * 获取banner分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TBanner> pageList(@Param("query") TBannerQuery query, @Param("pageInfo") PageInfo<TBanner> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompany; |
| | | import com.hollywood.manage.query.TCompanyQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 企业管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | public interface TCompanyMapper extends BaseMapper<TCompany> { |
| | | |
| | | /** |
| | | * 获取企业管理分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TCompany> pageList(@Param("query") TCompanyQuery query, @Param("pageInfo")PageInfo<TCompany> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TCompanyNeed; |
| | | import com.hollywood.manage.query.TCompanyNeedQuery; |
| | | import com.hollywood.manage.vo.TCompanyNeedVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 供需管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-04-23 |
| | | */ |
| | | public interface TCompanyNeedMapper extends BaseMapper<TCompanyNeed> { |
| | | |
| | | /** |
| | | * 获取供需管理分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TCompanyNeedVO> pageList(@Param("query") TCompanyNeedQuery query, @Param("pageInfo") PageInfo<TCompanyNeedVO> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 基础配置表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TConfigMapper extends BaseMapper<TConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TCustomerService; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * TCustomerService表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TCustomerServiceMapper extends BaseMapper<TCustomerService> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TInformationQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TInformation; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TInformationMapper extends BaseMapper<TInformation> { |
| | | |
| | | /** |
| | | * 获取资讯管理分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TInformation> pageList(@Param("query") TInformationQuery query, @Param("pageInfo") PageInfo<TInformation> pageInfo); |
| | | |
| | | List<TInformation> queryByName(String name); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TOrderMapper extends BaseMapper<TOrder> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TPerformerActivityQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPerformerActivityMapper extends BaseMapper<TPerformerActivity> { |
| | | |
| | | /** |
| | | * 获取演员活动分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TPerformerActivity> pageList(@Param("query") TPerformerActivityQuery query, @Param("pageInfo")PageInfo<TPerformerActivity> pageInfo,@Param("ids") List<Long> ids); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TPerformerActivityUserQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPerformerActivityUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动用户参与表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPerformerActivityUserMapper extends BaseMapper<TPerformerActivityUser> { |
| | | |
| | | /** |
| | | * 获取演员活动参与人员列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TPerformerActivityUser> userPageList(@Param("query") TPerformerActivityUserQuery query, @Param("pageInfo")PageInfo<TPerformerActivityUser> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TPopularActivityQuery; |
| | | import com.hollywood.applet.vo.TPopularActivityVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TPopularActivity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 热门活动 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPopularActivityMapper extends BaseMapper<TPopularActivity> { |
| | | |
| | | List<TPopularActivity> searchByName(String name); |
| | | List<TPopularActivityVO> pageList(@Param("query") TPopularActivityQuery query, |
| | | @Param("pageInfo") PageInfo<TPopularActivityVO> pageInfo, |
| | | @Param("ids") List<Long> ids); |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TPopularActivityUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 报名活动用户中间表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TPopularActivityUserMapper extends BaseMapper<TPopularActivityUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TRegion; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TRegionMapper extends BaseMapper<TRegion> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TScenicSpot; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 景区管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScenicSpotMapper extends BaseMapper<TScenicSpot> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.dto.TScriptQuery; |
| | | import com.hollywood.applet.dto.TScriptVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TScript; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScriptMapper extends BaseMapper<TScript> { |
| | | |
| | | List<TScriptVO> pageList(@Param("query") TScriptQuery query, @Param("pageInfo")PageInfo<TScriptVO> pageInfo,@Param("ids") List<Long> ids); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TScriptTheme; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本题材 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScriptThemeMapper extends BaseMapper<TScriptTheme> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TScriptType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本类别 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TScriptTypeMapper extends BaseMapper<TScriptType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TShortPlayQuery; |
| | | import com.hollywood.applet.vo.TShortPlayVO; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TShortPlay; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayMapper extends BaseMapper<TShortPlay> { |
| | | |
| | | /** |
| | | * 短剧列表查询 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TShortPlayVO> pageList(@Param("query") TShortPlayQuery query, @Param("pageInfo")PageInfo<TShortPlayVO> pageInfo,@Param("ids")List<Long> ids); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayTheme; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧题材 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayThemeMapper extends BaseMapper<TShortPlayTheme> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayToType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别中间表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-06 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayToTypeMapper extends BaseMapper<TShortPlayToType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayTypeMapper extends BaseMapper<TShortPlayType> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TShortPlayVideo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧视频 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TShortPlayVideoMapper extends BaseMapper<TShortPlayVideo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.applet.query.TUserQuery; |
| | | import com.hollywood.common.basic.PageInfo; |
| | | import com.hollywood.common.model.TUser; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-01 |
| | | */ |
| | | public interface TUserMapper extends BaseMapper<TUser> { |
| | | |
| | | /** |
| | | * 获取用户分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TUser> userPageList(@Param("query") TUserQuery query, @Param("pageInfo") PageInfo<TUser> pageInfo); |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TVideo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频管理 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVideoMapper extends BaseMapper<TVideo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TVipConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员设置 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVipConfigMapper extends BaseMapper<TVipConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.applet.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.hollywood.common.model.TVipPurchaseRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 会员购买记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Mapper |
| | | public interface TVipPurchaseRecordMapper extends BaseMapper<TVipPurchaseRecord> { |
| | | |
| | | } |
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 |
| | |
| | | package com.hollywood.applet; |
| | | |
| | | import com.hollywood.common.redis.RedisAutoTemplate; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.concurrent.locks.Lock; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2022/8/3/00310:01 |
| | | */ |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = AppletApplication.class) |
| | | public class AppletTest { |
| | | |
| | | |
| | | private final Lock lock = new ReentrantLock(); |
| | | |
| | | @Autowired |
| | | private RedisAutoTemplate redisAutoTemplate; |
| | | |
| | | @Test |
| | | void test() throws InterruptedException { |
| | | } |
| | | |
| | | |
| | | } |
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> |
| | | <!-- 阿里云短信 --> |
| | | <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> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.hollywood.common.basic; |
| | | |
| | | |
| | | import com.hollywood.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.hollywood.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 = 5 * 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/**"//当前H5用户端不采用security |
| | | ,"/sendMsg" |
| | | ,"/sendChangeMsg" |
| | | ,"/getOpenId" |
| | | ,"/wechatLogin" |
| | | ,"/wechatLoginOpenId" |
| | | ,"/tConfig/getConfigById" |
| | | ,"/base/**" |
| | | }; |
| | | /** |
| | | * 文档相关资源路径 |
| | | */ |
| | | 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/","/app" |
| | | , "/druid/" |
| | | , "/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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.common.config; |
| | | |
| | | import com.hollywood.common.cache.Cache; |
| | | import com.hollywood.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.hollywood.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.hollywood.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.hollywood.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.common.dto; |
| | | |
| | | import com.hollywood.common.model.TBanner; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "banner新增DTO") |
| | | public class TBannerDTO extends TBanner { |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.common.dto; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.basic.Constant; |
| | | import com.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.common.exception; |
| | | |
| | | |
| | | import com.hollywood.common.basic.ApiResult; |
| | | import com.hollywood.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(), "没有权限,请联系管理员授权"); |
| | | } |
| | | |
| | | /** |
| | | * 自定义的异常处理 |
| | | * 业务异常 |
| | | * |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ExceptionHandler(ServiceException.class) |
| | | @ResponseStatus(HttpStatus.OK) |
| | | public ApiResult handleBusinessException(ServiceException e) { |
| | | // 打印异常堆栈信息 |
| | | log.error(" ---> 业务处理异常: {}", e.getMessage()); |
| | | return ApiResult.failed(e.getCode(), e.getMessage(), e.getData()); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.hollywood.common.exception; |
| | | |
| | | |
| | | import com.hollywood.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.hollywood.common.exception; |
| | | |
| | | |
| | | import com.hollywood.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.hollywood.common.exception; |
| | | |
| | | |
| | | import com.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.hollywood.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.ASSIGN_ID) |
| | | private String 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.hollywood.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.ASSIGN_ID) |
| | | private String 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.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 插播广告管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_advertisement") |
| | | @ApiModel(value="TAdvertisement对象", description="插播广告管理") |
| | | public class TAdvertisement extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "广告视频名称") |
| | | @TableField("advertisementName") |
| | | private String advertisementName; |
| | | |
| | | @ApiModelProperty(value = "广告视频") |
| | | @TableField("advertisementVideo") |
| | | private String advertisementVideo; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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_advertisement_config") |
| | | @ApiModel(value="TAdvertisementConfig对象", description="广告配置") |
| | | public class TAdvertisementConfig implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "观看多少秒跳过广告") |
| | | @TableField("advertisementConfig") |
| | | private Integer advertisementConfig; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * banner表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_banner") |
| | | @ApiModel(value="TBanner对象", description="banner表") |
| | | public class TBanner extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "banner名称") |
| | | @TableField("bannerName") |
| | | private String bannerName; |
| | | |
| | | @ApiModelProperty(value = "所在位置 1=首页 2=交易 3=演员") |
| | | @TableField("bannerType") |
| | | private Integer bannerType; |
| | | |
| | | @ApiModelProperty(value = "banner图片") |
| | | @TableField("bannerPicture") |
| | | private String bannerPicture; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.hollywood.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-23 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_company") |
| | | @ApiModel(value="TCompany对象", description="企业管理") |
| | | public class TCompany extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "企业名称") |
| | | @TableField("companyName") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "企业联系人") |
| | | @TableField("contactsName") |
| | | private String contactsName; |
| | | |
| | | @ApiModelProperty(value = "联系人电话") |
| | | @TableField("contactsPhone") |
| | | private String contactsPhone; |
| | | |
| | | @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("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @TableField("lon") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @TableField("lat") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "公司简介") |
| | | @TableField("companyIntroduction") |
| | | private String companyIntroduction; |
| | | |
| | | @ApiModelProperty(value = "封面") |
| | | @TableField("companyCover") |
| | | private String companyCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("companyPicture") |
| | | private String companyPicture; |
| | | |
| | | @ApiModelProperty(value = "详情介绍") |
| | | @TableField("companyDetail") |
| | | private String companyDetail; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.hollywood.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-23 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_company_need") |
| | | @ApiModel(value="TCompanyNeed对象", description="供需管理") |
| | | public class TCompanyNeed extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "企业id") |
| | | @TableField("companyId") |
| | | private Long companyId; |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "联系人") |
| | | @TableField("contactName") |
| | | private String contactName; |
| | | |
| | | @ApiModelProperty(value = "联系人电话") |
| | | @TableField("contactPhone") |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty(value = "1供2需") |
| | | @TableField("realation") |
| | | private Integer realation; |
| | | |
| | | @ApiModelProperty(value = "标题") |
| | | @TableField("title") |
| | | private String title; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("pics") |
| | | private String pics; |
| | | |
| | | @ApiModelProperty(value = "供需介绍") |
| | | @TableField("introduce") |
| | | private String introduce; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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=剧本出售说明 4=短剧出售说明 5=用户协议 6=隐私协议 7=注销协议") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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> |
| | | * t_customer_service表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_customer_service") |
| | | @ApiModel(value="tCustomerService对象", description="t_customer_service表") |
| | | public class TCustomerService implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "客服电话") |
| | | @TableField("servicePhone") |
| | | private String servicePhone; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 资讯管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_information") |
| | | @ApiModel(value="TInformation对象", description="资讯管理") |
| | | public class TInformation extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "资讯标题") |
| | | @TableField("informationTitle") |
| | | private String informationTitle; |
| | | |
| | | @ApiModelProperty(value = "资讯封面") |
| | | @TableField("informationCover") |
| | | private String informationCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "资讯内容") |
| | | @TableField("informationContent") |
| | | private String informationContent; |
| | | |
| | | @ApiModelProperty(value = "状态 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "阅读量") |
| | | @TableField("readCount") |
| | | private Integer readCount; |
| | | |
| | | @ApiModelProperty(value = "资讯类型 1=全球影视资讯 2=非遗资讯") |
| | | @TableField("informationType") |
| | | private Integer informationType; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.common.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | 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.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_music") |
| | | @ApiModel(value="TMusic对象", description="") |
| | | public class TMusic implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId("id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "音乐名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "原唱") |
| | | @TableField("singer") |
| | | private String singer; |
| | | |
| | | @ApiModelProperty(value = "作曲") |
| | | @TableField("coder") |
| | | private String coder; |
| | | |
| | | @ApiModelProperty(value = "作词") |
| | | @TableField("writer") |
| | | private String writer; |
| | | |
| | | @ApiModelProperty(value = "音乐地址") |
| | | @TableField("url") |
| | | private String url; |
| | | @TableField("urlName") |
| | | private String urlName; |
| | | @TableField("cover") |
| | | private String cover; |
| | | |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | @ApiModelProperty(value = "1上架2下架") |
| | | private Integer state; |
| | | |
| | | @TableField("isDelete") |
| | | @TableLogic |
| | | private Integer isDelete; |
| | | @TableField(exist = false) |
| | | private Integer likeCount; |
| | | @TableField(exist = false) |
| | | private Integer isGood; |
| | | |
| | | @TableField("createTime") |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @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("userId") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "产品类型 1=剧本 2=短剧") |
| | | @TableField("productType") |
| | | private Integer productType; |
| | | |
| | | @ApiModelProperty(value = "产品名称") |
| | | @TableField("productName") |
| | | private String productName; |
| | | |
| | | @ApiModelProperty(value = "产品id") |
| | | @TableField("productId") |
| | | private Long productId; |
| | | |
| | | @ApiModelProperty(value = "发布人") |
| | | @TableField("releasePerson") |
| | | private String releasePerson; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("releasePhone") |
| | | private String releasePhone; |
| | | |
| | | @ApiModelProperty(value = "产品订金") |
| | | @TableField("productDeposit") |
| | | private BigDecimal productDeposit; |
| | | |
| | | @ApiModelProperty(value = "支付时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("payTime") |
| | | private LocalDateTime payTime; |
| | | @ApiModelProperty(value = "支付状态 1已支付 2未支付") |
| | | @TableField("isPay") |
| | | private Integer isPay; |
| | | @ApiModelProperty(value = "订单金额") |
| | | @TableField("payMoney") |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | | @ApiModelProperty(value = "支付编号") |
| | | @TableField("orderNum") |
| | | private String orderNum; |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.pojo.BaseModel; |
| | | 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 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_performer_activity") |
| | | @ApiModel(value="TPerformerActivity对象", description="演员活动") |
| | | public class TPerformerActivity extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "活动名称") |
| | | @TableField("activityName") |
| | | private String activityName; |
| | | |
| | | @ApiModelProperty(value = "投票类型 1=总票数 2=每日票数") |
| | | @TableField("voteType") |
| | | private Integer voteType; |
| | | @ApiModelProperty(value = " 1=演员 2=海选",required = true) |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | |
| | | @ApiModelProperty(value = "投票数量") |
| | | @TableField("voteCount") |
| | | private Integer voteCount; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("startTime") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("endTime") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "报名截止时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("registrationDeadlineTime") |
| | | private LocalDateTime registrationDeadlineTime; |
| | | |
| | | @ApiModelProperty(value = "报名费用") |
| | | @TableField("registrationFee") |
| | | private Double registrationFee; |
| | | |
| | | @ApiModelProperty(value = "活动简介") |
| | | @TableField("activityIntroduction") |
| | | private String activityIntroduction; |
| | | |
| | | @ApiModelProperty(value = "活动封面") |
| | | @TableField("activityCover") |
| | | private String activityCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "详情介绍") |
| | | @TableField("detailIntroduce") |
| | | private String detailIntroduce; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | @ApiModelProperty(value = "活动状态 1=未开始 2=已开始 3=已结束") |
| | | @TableField("activityStatus") |
| | | private Integer activityStatus; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @TableField(exist = false) |
| | | private Integer hot; |
| | | @TableField(exist = false) |
| | | private Integer isJoin; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 演员活动用户参与表 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_performer_activity_user") |
| | | @ApiModel(value="TPerformerActivityUser对象", description="演员活动用户参与表") |
| | | public class TPerformerActivityUser extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "演员活动id") |
| | | @TableField("activityId") |
| | | private Long activityId; |
| | | |
| | | @ApiModelProperty(value = "用户姓名") |
| | | @TableField("personName") |
| | | private String personName; |
| | | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | @TableField("personPhone") |
| | | private String personPhone; |
| | | |
| | | @ApiModelProperty(value = "得票数量") |
| | | @TableField("gainVotesCount") |
| | | private Integer gainVotesCount; |
| | | |
| | | @ApiModelProperty(value = "自我介绍") |
| | | @TableField("selfIntroduction") |
| | | private String selfIntroduction; |
| | | |
| | | @ApiModelProperty(value = "演员封面") |
| | | @TableField("performerCover") |
| | | private String performerCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | @TableField("isPay") |
| | | private Integer isPay; |
| | | private BigDecimal money; |
| | | @TableField("userId") |
| | | private Long userId; |
| | | @TableField("code") |
| | | private String code; |
| | | @TableField("orderNum") |
| | | private String orderNum; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 热门活动 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_popular_activity") |
| | | @ApiModel(value="TPopularActivity对象", description="热门活动") |
| | | public class TPopularActivity extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "活动名称") |
| | | @TableField("activityName") |
| | | private String activityName; |
| | | |
| | | @ApiModelProperty(value = "参与用户 1=全部用户 2=仅限会员") |
| | | @TableField("participatingUserType") |
| | | private Integer participatingUserType; |
| | | |
| | | @ApiModelProperty(value = "报名费用") |
| | | @TableField("registrationFee") |
| | | private BigDecimal registrationFee; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("startTime") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("endTime") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "报名截止时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("registrationDeadlineTime") |
| | | private LocalDateTime registrationDeadlineTime; |
| | | |
| | | @ApiModelProperty(value = "活动简介") |
| | | @TableField("activityIntroduction") |
| | | private String activityIntroduction; |
| | | |
| | | @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("activityAddress") |
| | | private String activityAddress; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @TableField("lon") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @TableField("lat") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "活动封面") |
| | | @TableField("activityCover") |
| | | private String activityCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "详情介绍") |
| | | @TableField("detailIntroduce") |
| | | private String detailIntroduce; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | @ApiModelProperty(value = "活动状态 1=未开始 2=已开始 3=已结束") |
| | | @TableField("activityStatus") |
| | | private Integer activityStatus; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @TableField(exist = false) |
| | | private long peopleCounts; |
| | | @TableField(exist = false) |
| | | private Integer isJoin; |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | 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-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_popular_activity_user") |
| | | @ApiModel(value="TPopularActivityUser对象", description="报名活动用户中间表") |
| | | public class TPopularActivityUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "活动id") |
| | | @TableField("activityId") |
| | | private Long activityId; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "报名时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("applicationTime") |
| | | private LocalDateTime applicationTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.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; |
| | | |
| | | /** |
| | | * <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; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 景区管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_scenic_spot") |
| | | @ApiModel(value="TScenicSpot对象", description="景区管理") |
| | | public class TScenicSpot extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "景区名称") |
| | | @TableField("scenicName") |
| | | private String scenicName; |
| | | |
| | | @ApiModelProperty(value = "景区简介") |
| | | @TableField("scenicIntroduction") |
| | | private String scenicIntroduction; |
| | | |
| | | @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("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @TableField("lon") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @TableField("lat") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "封面图片") |
| | | @TableField("scenicCover") |
| | | private String scenicCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "详情介绍") |
| | | @TableField("detailIntroduce") |
| | | private String detailIntroduce; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | @TableField(exist = false) |
| | | private double distance; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_script") |
| | | @ApiModel(value="TScript对象", description="剧本管理") |
| | | public class TScript extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "类别id") |
| | | @TableField("typeId") |
| | | private Long typeId; |
| | | |
| | | @ApiModelProperty(value = "题材id") |
| | | @TableField("themeId") |
| | | private Long themeId; |
| | | |
| | | @ApiModelProperty(value = "剧本名称") |
| | | @TableField("scriptName") |
| | | private String scriptName; |
| | | |
| | | @ApiModelProperty(value = "发布人") |
| | | @TableField("releasePerson") |
| | | private String releasePerson; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("releasePhone") |
| | | private String releasePhone; |
| | | |
| | | @ApiModelProperty(value = "价格区间 底价") |
| | | @TableField("scriptBasePrice") |
| | | private BigDecimal scriptBasePrice; |
| | | |
| | | @ApiModelProperty(value = "价格区间 顶价") |
| | | @TableField("scriptCeilingPrice") |
| | | private BigDecimal scriptCeilingPrice; |
| | | |
| | | @ApiModelProperty(value = "订金") |
| | | @TableField("scriptDeposit") |
| | | private BigDecimal scriptDeposit; |
| | | |
| | | @ApiModelProperty(value = "剧本概要") |
| | | @TableField("scriptSummary") |
| | | private String scriptSummary; |
| | | |
| | | @ApiModelProperty(value = "封面图片") |
| | | @TableField("scriptCover") |
| | | private String scriptCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "详情介绍") |
| | | @TableField("detailIntroduce") |
| | | private String detailIntroduce; |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本题材 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_script_theme") |
| | | @ApiModel(value="TScriptTheme对象", description="剧本题材") |
| | | public class TScriptTheme extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "剧本题材名称") |
| | | @TableField("themeName") |
| | | private String themeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 剧本类别 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_script_type") |
| | | @ApiModel(value="TScriptType对象", description="剧本类别") |
| | | public class TScriptType extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "剧本类别名称") |
| | | @TableField("typeName") |
| | | private String typeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_short_play") |
| | | @ApiModel(value="TShortPlay对象", description="短剧管理") |
| | | public class TShortPlay extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "短剧题材id") |
| | | @TableField("themeId") |
| | | private Long themeId; |
| | | |
| | | @ApiModelProperty(value = "短剧名称") |
| | | @TableField("shortPlayName") |
| | | private String shortPlayName; |
| | | |
| | | @ApiModelProperty(value = "发布人") |
| | | @TableField("releasePerson") |
| | | private String releasePerson; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("releasePhone") |
| | | private String releasePhone; |
| | | |
| | | @ApiModelProperty(value = "价格区间 底价") |
| | | @TableField("shortPlayBasePrice") |
| | | private Double shortPlayBasePrice; |
| | | |
| | | @ApiModelProperty(value = "价格区间 顶价") |
| | | @TableField("shortPlayCeilingPrice") |
| | | private Double shortPlayCeilingPrice; |
| | | |
| | | @ApiModelProperty(value = "订金") |
| | | @TableField("shortPlayDeposit") |
| | | private BigDecimal shortPlayDeposit; |
| | | |
| | | @ApiModelProperty(value = "剧本概要") |
| | | @TableField("shortPlaySummary") |
| | | private String shortPlaySummary; |
| | | |
| | | @ApiModelProperty(value = "封面图片") |
| | | @TableField("scriptCover") |
| | | private String scriptCover; |
| | | |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("detailPicture") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "详情介绍") |
| | | @TableField("detailIntroduce") |
| | | private String detailIntroduce; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | @ApiModelProperty(value = "播放量") |
| | | @TableField("playNum") |
| | | private Integer playNum; |
| | | |
| | | |
| | | @ApiModelProperty(value = "上下架 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "每集时长") |
| | | @TableField("minute") |
| | | private Integer minute; |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧题材 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_short_play_theme") |
| | | @ApiModel(value="TShortPlayTheme对象", description="短剧题材") |
| | | public class TShortPlayTheme extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "短剧题材名称") |
| | | @TableField("themeName") |
| | | private String themeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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-03-06 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_short_play_to_type") |
| | | @ApiModel(value="TShortPlayToType对象", description="短剧类别中间表") |
| | | public class TShortPlayToType implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "短剧id") |
| | | @TableField("shortPlayId") |
| | | private Long shortPlayId; |
| | | |
| | | @ApiModelProperty(value = "类型id") |
| | | @TableField("typeId") |
| | | private Long typeId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧类别 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_short_play_type") |
| | | @ApiModel(value="TShortPlayType对象", description="短剧类别") |
| | | public class TShortPlayType extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "短剧类别名称") |
| | | @TableField("typeName") |
| | | private String typeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短剧视频 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_short_play_video") |
| | | @ApiModel(value="TShortPlayVideo对象", description="短剧视频") |
| | | public class TShortPlayVideo extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "短剧id") |
| | | @TableField("shortPlayId") |
| | | private Long shortPlayId; |
| | | |
| | | @ApiModelProperty(value = "视频名称") |
| | | @TableField("videoName") |
| | | private String videoName; |
| | | |
| | | @ApiModelProperty(value = "视频链接") |
| | | @TableField("videoLink") |
| | | private String videoLink; |
| | | |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | @TableField("sortBy") |
| | | private Integer sortBy; |
| | | |
| | | @ApiModelProperty(value = "是否会员可见 1=是 0=否") |
| | | @TableField("visibleVip") |
| | | private Integer visibleVip; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.Pattern; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-03-01 |
| | | */ |
| | | @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("userName") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("userPhone") |
| | | private String userPhone; |
| | | @ApiModelProperty(value = "手机号") |
| | | @TableField("acPhone") |
| | | private String acPhone; |
| | | @ApiModelProperty(value = "得票数") |
| | | @TableField("hot") |
| | | private Integer hot; |
| | | |
| | | @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("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("vedio") |
| | | private String vedio; |
| | | |
| | | @ApiModelProperty(value = "密码") |
| | | @TableField("password") |
| | | private String password; |
| | | |
| | | @ApiModelProperty(value = "会员等级") |
| | | @TableField("vipLevel") |
| | | private Integer vipLevel; |
| | | |
| | | @ApiModelProperty(value = "昵称") |
| | | @TableField("nickName") |
| | | private String nickName; |
| | | @ApiModelProperty("头像") |
| | | private String advatar; |
| | | |
| | | @ApiModelProperty(value = "最后一次登录时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("lastLoginTime") |
| | | private LocalDateTime lastLoginTime; |
| | | |
| | | @ApiModelProperty(value = "身高") |
| | | @TableField("height") |
| | | private Double height; |
| | | |
| | | @ApiModelProperty(value = "体重") |
| | | @TableField("weight") |
| | | private Double weight; |
| | | |
| | | @ApiModelProperty(value = "生日") |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | @TableField("birthday") |
| | | private Date birthday; |
| | | |
| | | @ApiModelProperty(value = "性别 1=男 2=女 0=未知") |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | @TableField(exist = false) |
| | | private Integer age; |
| | | |
| | | @ApiModelProperty(value = "演员状态 1=正常 2=冻结") |
| | | @TableField("performerStatus") |
| | | private Integer performerStatus; |
| | | |
| | | @ApiModelProperty(value = "已付款") |
| | | @TableField("hasPay") |
| | | private BigDecimal hasPay; |
| | | |
| | | @ApiModelProperty(value = "审核时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @TableField("auditTime") |
| | | private LocalDateTime auditTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_video") |
| | | @ApiModel(value="TVideo对象", description="短视频管理") |
| | | public class TVideo extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("userId") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "视频标题") |
| | | @TableField("videoTitle") |
| | | private String videoTitle; |
| | | |
| | | @ApiModelProperty(value = "视频文件") |
| | | @TableField("videoFile") |
| | | private String videoFile; |
| | | |
| | | @ApiModelProperty(value = "点赞数") |
| | | @TableField("likeCount") |
| | | private Integer likeCount; |
| | | |
| | | @ApiModelProperty(value = "状态 1=上架 2=下架") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "0未观看,1已观看") |
| | | @TableField(exist = false) |
| | | private Integer isGood; |
| | | @ApiModelProperty(value = "观看数") |
| | | @TableField(exist = false) |
| | | private Integer views; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.hollywood.common.pojo.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 短视频举报管理 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_video_report") |
| | | @ApiModel(value="TVideoReport对象", description="短视频举报管理") |
| | | public class TVideoReport extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "举报用户id") |
| | | @TableField("userId") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "短视频id") |
| | | @TableField("videoId") |
| | | private Long videoId; |
| | | |
| | | @ApiModelProperty(value = "举报理由") |
| | | @TableField("reportReason") |
| | | private String reportReason; |
| | | |
| | | @ApiModelProperty(value = "举报描述") |
| | | @TableField("reportDesc") |
| | | private String reportDesc; |
| | | |
| | | @ApiModelProperty(value = "举报图片") |
| | | @TableField("reportPicture") |
| | | private String reportPicture; |
| | | |
| | | @ApiModelProperty(value = "结果 0=未处理,1=忽略,2=下架视频") |
| | | @TableField("handleResult") |
| | | private Integer handleResult; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_vip_config") |
| | | @ApiModel(value="TVipConfig对象", description="会员设置") |
| | | public class TVipConfig implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "个人会员费") |
| | | @TableField("personalVipCost") |
| | | private BigDecimal personalVipCost; |
| | | |
| | | @ApiModelProperty(value = "个人会员续费") |
| | | @TableField("personalVipRenew") |
| | | private BigDecimal personalVipRenew; |
| | | |
| | | @ApiModelProperty(value = "企业会员费") |
| | | @TableField("enterpriseVipCost") |
| | | private BigDecimal enterpriseVipCost; |
| | | |
| | | @ApiModelProperty(value = "企业会员续费") |
| | | @TableField("enterpriseVipRenew") |
| | | private BigDecimal enterpriseVipRenew; |
| | | |
| | | @ApiModelProperty(value = "个人会员等级设置") |
| | | @TableField("personVipLevel") |
| | | private String personVipLevel; |
| | | |
| | | @ApiModelProperty(value = "企业会员等级设置") |
| | | @TableField("enterpriseVipLevel") |
| | | private String enterpriseVipLevel; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.hollywood.common.pojo.BaseModel; |
| | | 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 2024-02-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_vip_purchase_record") |
| | | @ApiModel(value="TVipPurchaseRecord对象", description="会员购买记录") |
| | | public class TVipPurchaseRecord extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "会员id") |
| | | @TableField("userId") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "购买会员类型 1=个人会员 2=企业会员") |
| | | @TableField("vipType") |
| | | private Integer vipType; |
| | | |
| | | @ApiModelProperty(value = "收费类型 1=新会员 2=会员续费") |
| | | @TableField("chargeType") |
| | | private Integer chargeType; |
| | | |
| | | @ApiModelProperty(value = "购买时间(购买几个月)") |
| | | @TableField("purchaseCount") |
| | | private Integer purchaseCount; |
| | | @TableField("isPay") |
| | | private Integer isPay; |
| | | |
| | | @ApiModelProperty(value = "支付金额") |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | |
| | | @ApiModelProperty(value = "支付时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") |
| | | @TableField("payTime") |
| | | private LocalDateTime payTime; |
| | | private String code; |
| | | @TableField("orderNum") |
| | | private String orderNum; |
| | | |
| | | } |
New file |
| | |
| | | package com.hollywood.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", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 最后修改时间 |
| | | */ |
| | | @ApiModelProperty(value = "记录修改时间,前端忽略") |
| | | @JsonIgnore |
| | | @TableField("updateTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", 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.hollywood.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.hollywood.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.hollywood.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; |
| | | } |
| | | |
| | | /** |
| | | * * 有序集合存入数值 |
| | | * |
| | | * @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; |
| | | } |
| | | |
| | | /** |
| | | * * 从有序集合中删除指定位置的值 |
| | | * |
| | | * @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()); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
common/src/main/java/com/hollywood/common/security/GrantedAuthorityImpl.java
common/src/main/java/com/hollywood/common/security/JwtTokenUtils.java
common/src/main/java/com/hollywood/common/security/SecurityUtils.java
common/src/main/java/com/hollywood/common/security/filter/AuthenticationFilter.java
common/src/main/java/com/hollywood/common/security/filter/CorsFilter.java
common/src/main/java/com/hollywood/common/security/filter/XssAndSqlHttpServletRequestWrapper.java
common/src/main/java/com/hollywood/common/security/filter/XssFilter.java
common/src/main/java/com/hollywood/common/security/filter/XssStringJsonSerializer.java
common/src/main/java/com/hollywood/common/security/hadler/SecurityAuthenticationEntryPoint.java
common/src/main/java/com/hollywood/common/swagger/GlobalResultEnum.java
common/src/main/java/com/hollywood/common/swagger/SwaggerAutoConfiguration.java
common/src/main/java/com/hollywood/common/swagger/SwaggerProperties.java
common/src/main/java/com/hollywood/common/utils/CodeGenerateUtils.java
common/src/main/java/com/hollywood/common/utils/EncodeAndDecodeUtil.java
common/src/main/java/com/hollywood/common/utils/HttpClientUtil.java
common/src/main/java/com/hollywood/common/utils/HttpUtils.java
common/src/main/java/com/hollywood/common/utils/IPAddressUtil.java
common/src/main/java/com/hollywood/common/utils/IPUtil.java
common/src/main/java/com/hollywood/common/utils/ImportExcelUtil.java
common/src/main/java/com/hollywood/common/utils/IpLocation.java
common/src/main/java/com/hollywood/common/utils/JsonUtils.java
common/src/main/java/com/hollywood/common/utils/PayMoneyUtil.java
common/src/main/java/com/hollywood/common/utils/ResponseUtils.java
common/src/main/java/com/hollywood/common/utils/SpringContextUtils.java
common/src/main/java/com/hollywood/common/utils/SpringUtils.java
common/src/main/java/com/hollywood/common/utils/TimeUtils.java
common/src/main/java/com/hollywood/common/utils/UUIDUtil.java
common/src/main/java/com/hollywood/common/utils/UserUtil.java
common/src/main/java/com/hollywood/common/utils/WebUtils.java
common/src/main/java/com/hollywood/common/wxPay/certificate/CertificateService.java
common/src/main/java/com/hollywood/common/wxPay/certificate/model/Data.java
common/src/main/java/com/hollywood/common/wxPay/certificate/model/DownloadCertificateResponse.java
common/src/main/java/com/hollywood/common/wxPay/certificate/model/EncryptCertificate.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/AppService.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/AppServiceExtension.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/Amount.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/CloseOrderRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/CloseRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/Detail.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/GoodsDetail.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/PrepayRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/PrepayResponse.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/PrepayWithRequestPaymentResponse.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/QueryOrderByIdRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/SceneInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/SettleInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/app/model/StoreInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/H5Service.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/Amount.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/CloseOrderRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/CloseRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/Detail.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/GoodsDetail.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/H5Info.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/PrepayRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/PrepayResponse.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/QueryOrderByIdRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/SceneInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/SettleInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/h5/model/StoreInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/JsapiService.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/JsapiServiceExtension.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/Amount.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/CloseOrderRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/CloseRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/Detail.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/GoodsDetail.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/Payer.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/PrepayRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/PrepayResponse.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/PrepayWithRequestPaymentResponse.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/QueryOrderByIdRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/SceneInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/SettleInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/jsapi/model/StoreInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/model/PromotionDetail.java
common/src/main/java/com/hollywood/common/wxPay/payments/model/PromotionGoodsDetail.java
common/src/main/java/com/hollywood/common/wxPay/payments/model/Transaction.java
common/src/main/java/com/hollywood/common/wxPay/payments/model/TransactionAmount.java
common/src/main/java/com/hollywood/common/wxPay/payments/model/TransactionPayer.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/NativePayService.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/Amount.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/CloseOrderRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/CloseRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/Detail.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/GoodsDetail.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/PrepayRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/PrepayResponse.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/QueryOrderByIdRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/QueryOrderByOutTradeNoRequest.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/SceneInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/SettleInfo.java
common/src/main/java/com/hollywood/common/wxPay/payments/nativepay/model/StoreInfo.java
common/src/main/java/com/hollywood/common/wxPay/refund/RefundService.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Account.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Amount.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/AmountReq.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Channel.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/CreateRequest.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/FundsAccount.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/FundsFromItem.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/GoodsDetail.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Promotion.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/QueryByOutRefundNoRequest.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Refund.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/RefundNotification.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/ReqFundsAccount.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Scope.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Status.java
common/src/main/java/com/hollywood/common/wxPay/refund/model/Type.java
generator/pom.xml
generator/src/test/java/com/hollywood/CodeGeneratorTests.java
hollywood.sql
manage/pom.xml
manage/src/main/java/com/hollywood/manage/ManageApplication.java
manage/src/main/java/com/hollywood/manage/authority/controller/LoginController.java
manage/src/main/java/com/hollywood/manage/authority/controller/SecResourcesController.java
manage/src/main/java/com/hollywood/manage/authority/controller/SecRoleController.java
manage/src/main/java/com/hollywood/manage/authority/controller/SecRoleResourceController.java
manage/src/main/java/com/hollywood/manage/authority/controller/SecUserController.java
manage/src/main/java/com/hollywood/manage/authority/controller/SecUserRoleController.java
manage/src/main/java/com/hollywood/manage/authority/dto/Btn.java
manage/src/main/java/com/hollywood/manage/authority/dto/LoginCodeDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/LoginDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/Meta.java
manage/src/main/java/com/hollywood/manage/authority/dto/ResetPasswordDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecResDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecRoleDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecRoleResDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecRolesDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecUserDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecUserQueryDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecUserRoleDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SecUsersDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SysSourcesDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/SysSourcesListDTO.java
manage/src/main/java/com/hollywood/manage/authority/dto/VerificationCodeDTO.java
manage/src/main/java/com/hollywood/manage/authority/mapper/SecResourcesMapper.java
manage/src/main/java/com/hollywood/manage/authority/mapper/SecRoleMapper.java
manage/src/main/java/com/hollywood/manage/authority/mapper/SecRoleResourceMapper.java
manage/src/main/java/com/hollywood/manage/authority/mapper/SecUserMapper.java
manage/src/main/java/com/hollywood/manage/authority/mapper/SecUserRoleMapper.java
manage/src/main/java/com/hollywood/manage/authority/model/SecResources.java
manage/src/main/java/com/hollywood/manage/authority/model/SecRole.java
manage/src/main/java/com/hollywood/manage/authority/model/SecRoleResource.java
manage/src/main/java/com/hollywood/manage/authority/model/SecUser.java
manage/src/main/java/com/hollywood/manage/authority/model/SecUserRole.java
manage/src/main/java/com/hollywood/manage/authority/query/SecUserLowerQuery.java
manage/src/main/java/com/hollywood/manage/authority/service/SecResourcesService.java
manage/src/main/java/com/hollywood/manage/authority/service/SecRoleResourceService.java
manage/src/main/java/com/hollywood/manage/authority/service/SecRoleService.java
manage/src/main/java/com/hollywood/manage/authority/service/SecUserRoleService.java
manage/src/main/java/com/hollywood/manage/authority/service/SecUserService.java
manage/src/main/java/com/hollywood/manage/authority/service/impl/SecResourcesServiceImpl.java
manage/src/main/java/com/hollywood/manage/authority/service/impl/SecRoleResourceServiceImpl.java
manage/src/main/java/com/hollywood/manage/authority/service/impl/SecRoleServiceImpl.java
manage/src/main/java/com/hollywood/manage/authority/service/impl/SecUserRoleServiceImpl.java
manage/src/main/java/com/hollywood/manage/authority/service/impl/SecUserServiceImpl.java
manage/src/main/java/com/hollywood/manage/authority/vo/SecResourceVO.java
manage/src/main/java/com/hollywood/manage/authority/vo/SecUserRoleResouceVO.java
manage/src/main/java/com/hollywood/manage/authority/vo/SecUserVO.java
manage/src/main/java/com/hollywood/manage/authority/vo/SecUsersVO.java
manage/src/main/java/com/hollywood/manage/component/AliOss.java
manage/src/main/java/com/hollywood/manage/component/AliOssFileUploadController.java
manage/src/main/java/com/hollywood/manage/config/AsyncConfiguration.java
manage/src/main/java/com/hollywood/manage/config/WebSecurityConfig.java
manage/src/main/java/com/hollywood/manage/controller/LoginLogController.java
manage/src/main/java/com/hollywood/manage/controller/OperLogController.java
manage/src/main/java/com/hollywood/manage/controller/TAdvertisementConfigController.java
manage/src/main/java/com/hollywood/manage/controller/TAdvertisementController.java
manage/src/main/java/com/hollywood/manage/controller/TBannerController.java
manage/src/main/java/com/hollywood/manage/controller/TCompanyController.java
manage/src/main/java/com/hollywood/manage/controller/TCompanyNeedController.java
manage/src/main/java/com/hollywood/manage/controller/TConfigController.java
manage/src/main/java/com/hollywood/manage/controller/TCustomerServiceController.java
manage/src/main/java/com/hollywood/manage/controller/TInformationController.java
manage/src/main/java/com/hollywood/manage/controller/TMusicController.java
manage/src/main/java/com/hollywood/manage/controller/TOrderController.java
manage/src/main/java/com/hollywood/manage/controller/TPerformerActivityController.java
manage/src/main/java/com/hollywood/manage/controller/TPerformerActivityUserController.java
manage/src/main/java/com/hollywood/manage/controller/TPopularActivityController.java
manage/src/main/java/com/hollywood/manage/controller/TPopularActivityUserController.java
manage/src/main/java/com/hollywood/manage/controller/TScenicSpotController.java
manage/src/main/java/com/hollywood/manage/controller/TScriptController.java
manage/src/main/java/com/hollywood/manage/controller/TScriptThemeController.java
manage/src/main/java/com/hollywood/manage/controller/TScriptTypeController.java
manage/src/main/java/com/hollywood/manage/controller/TShortPlayController.java
manage/src/main/java/com/hollywood/manage/controller/TShortPlayThemeController.java
manage/src/main/java/com/hollywood/manage/controller/TShortPlayToTypeController.java
manage/src/main/java/com/hollywood/manage/controller/TShortPlayTypeController.java
manage/src/main/java/com/hollywood/manage/controller/TShortPlayVideoController.java
manage/src/main/java/com/hollywood/manage/controller/TUserController.java
manage/src/main/java/com/hollywood/manage/controller/TVideoController.java
manage/src/main/java/com/hollywood/manage/controller/TVideoReportController.java
manage/src/main/java/com/hollywood/manage/controller/TVipConfigController.java
manage/src/main/java/com/hollywood/manage/controller/TVipPurchaseRecordController.java
manage/src/main/java/com/hollywood/manage/dto/AliSms.java
manage/src/main/java/com/hollywood/manage/dto/PerformerAuditDTO.java
manage/src/main/java/com/hollywood/manage/dto/TCompanyDTO.java
manage/src/main/java/com/hollywood/manage/dto/TCompanyNeedDTO.java
manage/src/main/java/com/hollywood/manage/dto/TPopularActivityDTO.java
manage/src/main/java/com/hollywood/manage/dto/TScriptDTO.java
manage/src/main/java/com/hollywood/manage/dto/TShortPlayDTO.java
manage/src/main/java/com/hollywood/manage/excel/SalesReportAttendanceStatisticsDRExcel.java
manage/src/main/java/com/hollywood/manage/log/LoginLogAspect.java
manage/src/main/java/com/hollywood/manage/log/OperationLogAspect.java
manage/src/main/java/com/hollywood/manage/mapper/LoginLogMapper.java
manage/src/main/java/com/hollywood/manage/mapper/OperLogMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TAdvertisementConfigMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TAdvertisementMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TBannerMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TCompanyMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TCompanyNeedMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TConfigMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TCustomerServiceMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TInformationMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TMusicMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TOrderMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TPerformerActivityMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TPerformerActivityUserMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TPopularActivityMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TPopularActivityUserMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TScenicSpotMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TScriptMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TScriptThemeMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TScriptTypeMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TShortPlayMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TShortPlayThemeMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TShortPlayToTypeMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TShortPlayTypeMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TShortPlayVideoMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TUserMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TVideoMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TVideoReportMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TVipConfigMapper.java
manage/src/main/java/com/hollywood/manage/mapper/TVipPurchaseRecordMapper.java
manage/src/main/java/com/hollywood/manage/query/LoginLogQuery.java
manage/src/main/java/com/hollywood/manage/query/OperLogQuery.java
manage/src/main/java/com/hollywood/manage/query/TAdvertisementQuery.java
manage/src/main/java/com/hollywood/manage/query/TBannerQuery.java
manage/src/main/java/com/hollywood/manage/query/TCompanyNeedQuery.java
manage/src/main/java/com/hollywood/manage/query/TCompanyQuery.java
manage/src/main/java/com/hollywood/manage/query/TInformationQuery.java
manage/src/main/java/com/hollywood/manage/query/TOrderQuery.java
manage/src/main/java/com/hollywood/manage/query/TPerformerActivityQuery.java
manage/src/main/java/com/hollywood/manage/query/TPerformerActivityUserQuery.java
manage/src/main/java/com/hollywood/manage/query/TPopularActivityQuery.java
manage/src/main/java/com/hollywood/manage/query/TPopularActivityUserQuery.java
manage/src/main/java/com/hollywood/manage/query/TScenicSpotQuery.java
manage/src/main/java/com/hollywood/manage/query/TScriptQuery.java
manage/src/main/java/com/hollywood/manage/query/TScriptThemeQuery.java
manage/src/main/java/com/hollywood/manage/query/TScriptTypeQuery.java
manage/src/main/java/com/hollywood/manage/query/TShortPlayQuery.java
manage/src/main/java/com/hollywood/manage/query/TShortPlayThemeQuery.java
manage/src/main/java/com/hollywood/manage/query/TShortPlayTypeQuery.java
manage/src/main/java/com/hollywood/manage/query/TUserQuery.java
manage/src/main/java/com/hollywood/manage/query/TVideoQuery.java
manage/src/main/java/com/hollywood/manage/query/TVideoReportQuery.java
manage/src/main/java/com/hollywood/manage/query/TVipPurchaseRecordQuery.java
manage/src/main/java/com/hollywood/manage/security/AuthenticationProvider.java
manage/src/main/java/com/hollywood/manage/security/RbacAuthorityService.java
manage/src/main/java/com/hollywood/manage/security/SecurityAccessDeniedHandler.java
manage/src/main/java/com/hollywood/manage/security/SecurityUserDetails.java
manage/src/main/java/com/hollywood/manage/security/SecurityUserRoleResouce.java
manage/src/main/java/com/hollywood/manage/security/SysUserDetailsService.java
manage/src/main/java/com/hollywood/manage/service/LoginLogService.java
manage/src/main/java/com/hollywood/manage/service/OperLogService.java
manage/src/main/java/com/hollywood/manage/service/TAdvertisementConfigService.java
manage/src/main/java/com/hollywood/manage/service/TAdvertisementService.java
manage/src/main/java/com/hollywood/manage/service/TBannerService.java
manage/src/main/java/com/hollywood/manage/service/TCompanyNeedService.java
manage/src/main/java/com/hollywood/manage/service/TCompanyService.java
manage/src/main/java/com/hollywood/manage/service/TConfigService.java
manage/src/main/java/com/hollywood/manage/service/TCustomerServiceService.java
manage/src/main/java/com/hollywood/manage/service/TInformationService.java
manage/src/main/java/com/hollywood/manage/service/TMusicService.java
manage/src/main/java/com/hollywood/manage/service/TOrderService.java
manage/src/main/java/com/hollywood/manage/service/TPerformerActivityService.java
manage/src/main/java/com/hollywood/manage/service/TPerformerActivityUserService.java
manage/src/main/java/com/hollywood/manage/service/TPopularActivityService.java
manage/src/main/java/com/hollywood/manage/service/TPopularActivityUserService.java
manage/src/main/java/com/hollywood/manage/service/TScenicSpotService.java
manage/src/main/java/com/hollywood/manage/service/TScriptService.java
manage/src/main/java/com/hollywood/manage/service/TScriptThemeService.java
manage/src/main/java/com/hollywood/manage/service/TScriptTypeService.java
manage/src/main/java/com/hollywood/manage/service/TShortPlayService.java
manage/src/main/java/com/hollywood/manage/service/TShortPlayThemeService.java
manage/src/main/java/com/hollywood/manage/service/TShortPlayToTypeService.java
manage/src/main/java/com/hollywood/manage/service/TShortPlayTypeService.java
manage/src/main/java/com/hollywood/manage/service/TShortPlayVideoService.java
manage/src/main/java/com/hollywood/manage/service/TUserService.java
manage/src/main/java/com/hollywood/manage/service/TVideoReportService.java
manage/src/main/java/com/hollywood/manage/service/TVideoService.java
manage/src/main/java/com/hollywood/manage/service/TVipConfigService.java
manage/src/main/java/com/hollywood/manage/service/TVipPurchaseRecordService.java
manage/src/main/java/com/hollywood/manage/service/impl/LoginLogServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/OperLogServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TAdvertisementConfigServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TAdvertisementServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TBannerServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TCompanyNeedServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TCompanyServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TConfigServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TCustomerServiceServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TInformationServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TMusicServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TOrderServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TPerformerActivityServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TPerformerActivityUserServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TPopularActivityServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TPopularActivityUserServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TScenicSpotServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TScriptServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TScriptThemeServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TScriptTypeServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TShortPlayServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TShortPlayThemeServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TShortPlayToTypeServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TShortPlayTypeServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TShortPlayVideoServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TUserServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TVideoReportServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TVideoServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TVipConfigServiceImpl.java
manage/src/main/java/com/hollywood/manage/service/impl/TVipPurchaseRecordServiceImpl.java
manage/src/main/java/com/hollywood/manage/utils/FileUtils.java
manage/src/main/java/com/hollywood/manage/utils/HuaweiCloudSMSUtil.java
manage/src/main/java/com/hollywood/manage/utils/MsgUtils.java
manage/src/main/java/com/hollywood/manage/utils/TaskUtil.java
manage/src/main/java/com/hollywood/manage/utils/UserUtil.java
manage/src/main/java/com/hollywood/manage/vo/TCompanyNeedVO.java
manage/src/main/java/com/hollywood/manage/vo/TOrderVO.java
manage/src/main/java/com/hollywood/manage/vo/TPopularActivityUserVO.java
manage/src/main/java/com/hollywood/manage/vo/TPopularActivityVO.java
manage/src/main/java/com/hollywood/manage/vo/TScriptVO.java
manage/src/main/java/com/hollywood/manage/vo/TShortPlayVO.java
manage/src/main/java/com/hollywood/manage/vo/TVideoReportVO.java
manage/src/main/java/com/hollywood/manage/vo/TVideoVO.java
manage/src/main/java/com/hollywood/manage/vo/TVipPurchaseRecordVO.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/SecResourcesMapper.xml
manage/src/main/resources/mapping/SecRoleMapper.xml
manage/src/main/resources/mapping/SecRoleResourceMapper.xml
manage/src/main/resources/mapping/SecUserMapper.xml
manage/src/main/resources/mapping/SecUserRoleMapper.xml
manage/src/main/resources/mapping/TAdvertisementConfigMapper.xml
manage/src/main/resources/mapping/TAdvertisementMapper.xml
manage/src/main/resources/mapping/TBannerMapper.xml
manage/src/main/resources/mapping/TCompanyMapper.xml
manage/src/main/resources/mapping/TCompanyNeedMapper.xml
manage/src/main/resources/mapping/TConfigMapper.xml
manage/src/main/resources/mapping/TCustomerServiceMapper.xml
manage/src/main/resources/mapping/TInformationMapper.xml
manage/src/main/resources/mapping/TMusicMapper.xml
manage/src/main/resources/mapping/TOrderMapper.xml
manage/src/main/resources/mapping/TPerformerActivityMapper.xml
manage/src/main/resources/mapping/TPerformerActivityUserMapper.xml
manage/src/main/resources/mapping/TPopularActivityMapper.xml
manage/src/main/resources/mapping/TPopularActivityUserMapper.xml
manage/src/main/resources/mapping/TScenicSpotMapper.xml
manage/src/main/resources/mapping/TScriptMapper.xml
manage/src/main/resources/mapping/TScriptThemeMapper.xml
manage/src/main/resources/mapping/TScriptTypeMapper.xml
manage/src/main/resources/mapping/TShortPlayMapper.xml
manage/src/main/resources/mapping/TShortPlayThemeMapper.xml
manage/src/main/resources/mapping/TShortPlayTypeMapper.xml
manage/src/main/resources/mapping/TShortPlayVideoMapper.xml
manage/src/main/resources/mapping/TUserMapper.xml
manage/src/main/resources/mapping/TVideoMapper.xml
manage/src/main/resources/mapping/TVideoReportMapper.xml
manage/src/main/resources/mapping/TVipConfigMapper.xml
manage/src/main/resources/mapping/TVipPurchaseRecordMapper.xml
manage/src/main/resources/mybatis-config.xml
manage/src/test/java/com/hollywood/manage/ManageTest.java
pom.xml |