first commit
This commit is contained in:
12
src/main/java/com/sqx/modules/app/annotation/Login.java
Normal file
12
src/main/java/com/sqx/modules/app/annotation/Login.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.sqx.modules.app.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* app登录效验
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Login {
|
||||
}
|
||||
16
src/main/java/com/sqx/modules/app/annotation/LoginUser.java
Normal file
16
src/main/java/com/sqx/modules/app/annotation/LoginUser.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.sqx.modules.app.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 登录用户信息
|
||||
*
|
||||
*/
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface LoginUser {
|
||||
|
||||
}
|
||||
38
src/main/java/com/sqx/modules/app/config/WebMvcConfig.java
Normal file
38
src/main/java/com/sqx/modules/app/config/WebMvcConfig.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.sqx.modules.app.config;
|
||||
|
||||
import com.sqx.modules.app.interceptor.AuthorizationInterceptor;
|
||||
import com.sqx.modules.app.resolver.LoginUserHandlerMethodArgumentResolver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* MVC配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
@Autowired
|
||||
private AuthorizationInterceptor authorizationInterceptor;
|
||||
@Autowired
|
||||
private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/app/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(loginUserHandlerMethodArgumentResolver);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.sqx.modules.app.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.App;
|
||||
import com.sqx.modules.app.service.AppService;
|
||||
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.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* APP登录授权
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appinfo")
|
||||
@Api(value = "APP升级管理", tags = {"APP升级管理"})
|
||||
public class AppUpgradeController {
|
||||
|
||||
@Autowired
|
||||
private AppService iAppService;
|
||||
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台升级详情")
|
||||
@ResponseBody
|
||||
public Result list(Integer page,Integer limit) {
|
||||
IPage<App> pages =new Page<>(page,limit);
|
||||
return Result.success().put("data",iAppService.page(pages));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台升级详情")
|
||||
@ResponseBody
|
||||
public Result getBanner(@PathVariable Long id) {
|
||||
return Result.success().put("data",iAppService.selectAppById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台添加升级信息")
|
||||
@ResponseBody
|
||||
public Result addBanner(@RequestBody App app) {
|
||||
if(app.getId()!=null){
|
||||
iAppService.updateAppById(app);
|
||||
}else{
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
app.setCreateAt(sdf.format(new Date()));
|
||||
iAppService.insertApp(app);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台删除升级信息")
|
||||
public Result deleteBanner(@PathVariable Long id) {
|
||||
iAppService.deleteAppById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
414
src/main/java/com/sqx/modules/app/controller/UserController.java
Normal file
414
src/main/java/com/sqx/modules/app/controller/UserController.java
Normal file
@@ -0,0 +1,414 @@
|
||||
package com.sqx.modules.app.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.entity.UserVip;
|
||||
import com.sqx.modules.app.response.HomeMessageResponse;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.service.UserVipService;
|
||||
import com.sqx.modules.invite.dao.InviteMoneyDao;
|
||||
import com.sqx.modules.invite.entity.InviteMoney;
|
||||
import com.sqx.modules.invite.service.InviteMoneyService;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
import com.sqx.modules.pay.dao.PayDetailsDao;
|
||||
import com.sqx.modules.pay.entity.PayDetails;
|
||||
import com.sqx.modules.pay.service.PayDetailsService;
|
||||
import com.sqx.modules.sys.entity.SysUserEntity;
|
||||
import com.sqx.modules.sys.service.SysUserService;
|
||||
import com.sqx.modules.utils.EasyPoi.ExcelUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/30
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "用户管理", tags = {"用户管理"})
|
||||
@RequestMapping(value = "/user")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private CashOutDao cashOutDao;
|
||||
@Autowired
|
||||
private PayDetailsService payDetailsService;
|
||||
@Autowired
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
@Autowired
|
||||
private UserMoneyService userMoneyService;
|
||||
@Autowired
|
||||
private InviteMoneyService inviteMoneyService;
|
||||
@Autowired
|
||||
private InviteMoneyDao inviteMoneyDao;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private PayDetailsDao payDetailsDao;
|
||||
|
||||
@RequestMapping(value = "/selectUserByInvitationCode", method = RequestMethod.GET)
|
||||
@ApiOperation("获取用户详细信息")
|
||||
@ResponseBody
|
||||
public Result selectUserByInvitationCode(String invitationCode) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
UserEntity userEntity = userService.queryByInvitationCode(invitationCode);
|
||||
Long userId=userEntity.getUserId();
|
||||
//查询用户钱包
|
||||
// Double money = cashOutDao.selectMayMoney(userId);
|
||||
InviteMoney inviteMoney = inviteMoneyService.selectInviteMoneyByUserId(userId);
|
||||
Double money = inviteMoney.getMoney();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = simpleDateFormat.format(new Date());
|
||||
//查询本月充值
|
||||
Double consume = payDetailsService.instantselectSumPay(date, userId);
|
||||
//查询本月提现
|
||||
Double income = userMoneyDetailsService.monthIncome(date, userId);
|
||||
//查询邀请人数
|
||||
int count = userService.queryInviterCount(userEntity.getInvitationCode());
|
||||
UserVip userVip = userVipService.selectUserVipByUserId(userId);
|
||||
if(userVip!=null){
|
||||
userEntity.setMember(userVip.getIsVip());
|
||||
userEntity.setEndTime(userVip.getEndTime());
|
||||
userEntity.setVipType(userVip.getVipType());
|
||||
}
|
||||
map.put("userEntity", userEntity);
|
||||
map.put("money", money);
|
||||
map.put("consume", consume);
|
||||
map.put("income", income);
|
||||
map.put("count", count);
|
||||
return Result.success().put("data", map);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{userId}", method = RequestMethod.GET)
|
||||
@ApiOperation("获取用户详细信息")
|
||||
@ResponseBody
|
||||
public Result selectUserById(@ApiParam("用户id") @PathVariable Long userId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
UserEntity userEntity = userService.queryByUserId(userId);
|
||||
//查询用户钱包
|
||||
// Double money = cashOutDao.selectMayMoney(userId);
|
||||
InviteMoney inviteMoney = inviteMoneyService.selectInviteMoneyByUserId(userId);
|
||||
Double money = inviteMoney.getMoney();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = simpleDateFormat.format(new Date());
|
||||
//查询本月充值
|
||||
Double consume = payDetailsService.instantselectSumPay(date, userId);
|
||||
//查询本月提现
|
||||
Double income = userMoneyDetailsService.monthIncome(date, userId);
|
||||
//查询邀请人数
|
||||
int count = userService.queryInviterCount(userEntity.getInvitationCode());
|
||||
UserVip userVip = userVipService.selectUserVipByUserId(userId);
|
||||
if(userVip!=null){
|
||||
userEntity.setMember(userVip.getIsVip());
|
||||
userEntity.setEndTime(userVip.getEndTime());
|
||||
userEntity.setVipType(userVip.getVipType());
|
||||
}
|
||||
map.put("userEntity", userEntity);
|
||||
map.put("money", money);
|
||||
map.put("consume", consume);
|
||||
map.put("income", income);
|
||||
map.put("count", count);
|
||||
return Result.success().put("data", map);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/selectUserList", method = RequestMethod.GET)
|
||||
@ApiOperation("查询所有用户列表")
|
||||
@ResponseBody
|
||||
public Result selectUserList(Integer page, Integer limit,String phone,Integer sex,String platform,
|
||||
String sysPhone,Integer status, Integer member, String inviterCode,
|
||||
String userName, String invitationCode, String startTime, String endTime,
|
||||
String qdCode,String sysUserName,Integer vipType) {
|
||||
return Result.success().put("data", userService.selectUserPage(page, limit, phone, sex, platform, sysPhone, status, member,
|
||||
inviterCode, userName, invitationCode, startTime, endTime,qdCode,sysUserName,vipType));
|
||||
}
|
||||
|
||||
@GetMapping("/userListExcel")
|
||||
public void userListExcel(UserEntity userEntity, String startTime, String endTime, HttpServletResponse response) throws IOException {
|
||||
List<UserEntity> list = userService.userListExcel(startTime, endTime, userEntity);
|
||||
ExcelUtils.exportExcel(list, "用户表", "用户Sheet", UserEntity.class, "用户表", response);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/deleteUserByUserId/{userId}", method = RequestMethod.POST)
|
||||
@ApiOperation("删除用户")
|
||||
@ResponseBody
|
||||
public Result deleteUserByUserId(@PathVariable("userId") Long userId) {
|
||||
userService.removeById(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateUserByUserId", method = RequestMethod.POST)
|
||||
@ApiOperation("修改用户")
|
||||
@ResponseBody
|
||||
public Result updateUserByUserId(@RequestBody UserEntity userEntity) {
|
||||
if(StringUtils.isNotEmpty(userEntity.getPhone())){
|
||||
UserEntity phoneUser = userService.queryByPhone(userEntity.getPhone());
|
||||
if(phoneUser!=null && !phoneUser.getUserId().equals(userEntity.getUserId())){
|
||||
return Result.error("手机号已被其他用户绑定!");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(userEntity.getQdCode())){
|
||||
SysUserEntity sysUserEntity = sysUserService.getOne(new QueryWrapper<SysUserEntity>().eq("qd_code", userEntity.getQdCode()));
|
||||
if(sysUserEntity==null){
|
||||
return Result.error("渠道码不正确!");
|
||||
}
|
||||
}
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateUserStatusByUserId", method = RequestMethod.GET)
|
||||
@ApiOperation("禁用或启用用户")
|
||||
@ResponseBody
|
||||
public Result updateUserByUserId(Long userId) {
|
||||
UserEntity byId = userService.getById(userId);
|
||||
if (byId.getStatus().equals(1)) {
|
||||
byId.setStatus(2);
|
||||
} else {
|
||||
byId.setStatus(1);
|
||||
}
|
||||
userService.updateById(byId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户密码")
|
||||
@RequestMapping(value = "/updatePwd", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Result forgetPwd(String pwd, Long userId) {
|
||||
UserEntity userEntity = userService.selectUserById(userId);
|
||||
userEntity.setPassword(DigestUtils.sha256Hex(pwd));
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取openid
|
||||
*
|
||||
* @param code 微信code
|
||||
* @return openid
|
||||
*/
|
||||
@GetMapping("/openId/{code:.+}/{userId}")
|
||||
@ApiOperation("根据code获取openid")
|
||||
public Result getOpenid(@PathVariable("code") String code, @PathVariable("userId") Long userId) {
|
||||
return userService.getOpenId(code, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息分析
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/homeMessage")
|
||||
@ApiOperation("信息分析")
|
||||
public Result homeMessage(Long sysUserId) {
|
||||
String qdCode=null;
|
||||
if(sysUserId!=null){
|
||||
qdCode=sysUserService.getById(sysUserId).getQdCode();
|
||||
}
|
||||
HomeMessageResponse homeMessageResponse = new HomeMessageResponse();
|
||||
// 0查总 1查天 2查月 3查年
|
||||
//设置总用户人数
|
||||
homeMessageResponse.setTotalUsers(userService.queryUserCount(0, null,null,qdCode));
|
||||
//设置今日新增
|
||||
homeMessageResponse.setNewToday(userService.queryUserCount(1, null,null,qdCode));
|
||||
//设置本月新增
|
||||
homeMessageResponse.setNewMonth(userService.queryUserCount(2, null,null,qdCode));
|
||||
//设置本年新增
|
||||
homeMessageResponse.setNewYear(userService.queryUserCount(3, null,null,qdCode));
|
||||
//设置总收入
|
||||
homeMessageResponse.setTotalRevenue(userService.queryPayMoney(0,qdCode));
|
||||
//设置今日收入
|
||||
homeMessageResponse.setTodayRevenue(userService.queryPayMoney(1,qdCode));
|
||||
//设置本月收入
|
||||
homeMessageResponse.setMonthRevenue(userService.queryPayMoney(2,qdCode));
|
||||
//设置本年收入
|
||||
homeMessageResponse.setYearRevenue(userService.queryPayMoney(3,qdCode));
|
||||
//查询指定日期下的短剧购买的 量
|
||||
return Result.success().put("data", homeMessageResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 短剧分析
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/courseMessage")
|
||||
@ApiOperation("短剧分析")
|
||||
public Result courseMessage(Long page, Long limit, String date, int type,Long sysUserId) {
|
||||
Page<Map<String, Object>> iPage = new Page<>(page, limit);
|
||||
IPage<Map<String, Object>> mapIPage = userService.queryCourseOrder(iPage, type, date,sysUserId);
|
||||
return Result.success().put("data", new PageUtils(mapIPage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户分析
|
||||
*/
|
||||
@GetMapping("/userMessage")
|
||||
@ApiOperation("用户分析")
|
||||
public Result userMessage(String date, int type,Long sysUserId) {
|
||||
String qdCode=null;
|
||||
if(sysUserId!=null){
|
||||
qdCode=sysUserService.getById(sysUserId).getQdCode();
|
||||
}
|
||||
int sumUserCount = userService.queryUserCount(type, date,null,qdCode);
|
||||
int h5Count = userService.queryUserCount(type, date,"h5",qdCode);
|
||||
int appCount = userService.queryUserCount(type, date,"app",qdCode);
|
||||
int wxCount = userService.queryUserCount(type, date,"小程序",qdCode);
|
||||
int dyCount = userService.queryUserCount(type, date,"抖音",qdCode);
|
||||
int giveMemberCount = userService.userMessage(date, type,qdCode,1);
|
||||
int moneyMemberCount = userService.userMessage(date, type,qdCode,2);
|
||||
int memberCount = userService.userMessage(date, type,qdCode,null);
|
||||
int userCount = sumUserCount-memberCount;
|
||||
Map<String,Integer> result=new HashMap<>();
|
||||
result.put("sumUserCount",sumUserCount);
|
||||
result.put("h5Count",h5Count);
|
||||
result.put("appCount",appCount);
|
||||
result.put("wxCount",wxCount);
|
||||
result.put("dyCount",dyCount);
|
||||
result.put("memberCount",memberCount);
|
||||
result.put("giveMemberCount",giveMemberCount);
|
||||
result.put("moneyMemberCount",moneyMemberCount);
|
||||
result.put("userCount",userCount);
|
||||
return Result.success().put("data", result);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("addCannotMoney/{userId}/{money}")
|
||||
@ApiOperation("添加金豆")
|
||||
public Result addCannotMoney(@PathVariable("userId") Long userId, @PathVariable("money") Double money) {
|
||||
userMoneyService.updateMoney(1, userId, money);
|
||||
//inviteMoneyDao.updateInviteMoneySum(money,userId);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setUserId(userId);
|
||||
userMoneyDetails.setTitle("[增加金豆]平台增加金豆:" + money);
|
||||
userMoneyDetails.setContent("[增加金豆]平台增加金豆:" + money);
|
||||
userMoneyDetails.setType(1);
|
||||
userMoneyDetails.setClassify(1);
|
||||
userMoneyDetails.setMoney(new BigDecimal(money));
|
||||
userMoneyDetails.setCreateTime(sdf.format(new Date()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
PayDetails payDetails=new PayDetails();
|
||||
payDetails.setState(1);
|
||||
payDetails.setCreateTime(sdf.format(new Date()));
|
||||
payDetails.setUserId(userId);
|
||||
payDetails.setMoney(money);
|
||||
payDetails.setClassify(9);
|
||||
payDetails.setType(1);
|
||||
payDetails.setPayTime(sdf.format(new Date()));
|
||||
payDetailsDao.insert(payDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("subCannotMoney/{userId}/{money}")
|
||||
@ApiOperation("减少金豆")
|
||||
public Result subCannotMoney(@PathVariable("userId") Long userId, @PathVariable("money") Double money) {
|
||||
userMoneyService.updateMoney(2, userId, money);
|
||||
//inviteMoneyDao.updateInviteMoneySumSub(money,userId);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setUserId(userId);
|
||||
userMoneyDetails.setTitle("[减少金豆]平台减少金豆:" + money);
|
||||
userMoneyDetails.setContent("平台减少金豆:" + money);
|
||||
userMoneyDetails.setType(1);
|
||||
userMoneyDetails.setClassify(1);
|
||||
userMoneyDetails.setMoney(new BigDecimal(money));
|
||||
userMoneyDetails.setCreateTime(sdf.format(new Date()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateSysUserMoney")
|
||||
@ApiOperation("修改金豆")
|
||||
public Result updateSysUserMoney(Long userId, Double money,Integer type) {
|
||||
userMoneyService.updateSysMoney(type, userId, money);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setSysUserId(userId);
|
||||
if(type==1){
|
||||
userMoneyDetails.setTitle("[增加金豆]平台增加金豆:" + money);
|
||||
userMoneyDetails.setContent("[增加金豆]平台增加金豆:" + money);
|
||||
}else{
|
||||
userMoneyDetails.setTitle("[减少金豆]平台减少金豆:" + money);
|
||||
userMoneyDetails.setContent("[减少金豆]平台减少金豆:" + money);
|
||||
}
|
||||
userMoneyDetails.setType(type);
|
||||
userMoneyDetails.setClassify(1);
|
||||
userMoneyDetails.setMoney(new BigDecimal(money));
|
||||
userMoneyDetails.setCreateTime(sdf.format(new Date()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/selectInviteUserList")
|
||||
@ApiOperation("邀请用户排行榜")
|
||||
public Result selectInviteUserList(Integer page,Integer limit,String phone,String userName){
|
||||
return userService.selectInviteUserList(page, limit, userName, phone);
|
||||
}
|
||||
|
||||
@GetMapping("/selectUserOnLineCount")
|
||||
@ApiOperation("统计当前在线人数")
|
||||
public Result selectUserCount(Long sysUserId){
|
||||
String qdCode=null;
|
||||
if(sysUserId!=null){
|
||||
qdCode=sysUserService.getById(sysUserId).getQdCode();
|
||||
}
|
||||
return userService.selectUserOnLineCount(qdCode);
|
||||
}
|
||||
|
||||
@GetMapping("/selectUserCountStatisticsByTime")
|
||||
@ApiOperation("用户统计")
|
||||
public Result selectUserCountStatisticsByTime(String startTime,String endTime){
|
||||
List<Integer> userCountList=new ArrayList<>();
|
||||
List<String> year=new ArrayList<>();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
Date parse = null;
|
||||
try {
|
||||
parse = simpleDateFormat.parse(startTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
calendar.setTime(parse);
|
||||
while (true){
|
||||
String dateTime = simpleDateFormat.format(calendar.getTime());
|
||||
int i = userService.queryUserCount(1, dateTime,null,null);
|
||||
userCountList.add(i);
|
||||
year.add(dateTime);
|
||||
if(dateTime.equals(endTime)){
|
||||
break;
|
||||
}
|
||||
calendar.add(Calendar.DATE,1);
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("userCountList",userCountList);
|
||||
result.put("year",year);
|
||||
return Result.success().put("data",result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.sqx.modules.app.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/moneyDetails")
|
||||
@AllArgsConstructor
|
||||
@Api("钱包明细")
|
||||
public class UserMoneyDetailsController {
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
private UserMoneyService userMoneyService;
|
||||
|
||||
|
||||
@ApiOperation("钱包明细")
|
||||
@GetMapping("/queryUserMoneyDetails")
|
||||
public Result queryUserMoneyDetails(Integer page, Integer limit,Long sysUserId, Long userId,Integer classify,Integer type) {
|
||||
return userMoneyDetailsService.queryUserMoneyDetails(page, limit, sysUserId, userId,classify,type);
|
||||
}
|
||||
|
||||
@GetMapping("/selectUserMoney")
|
||||
@ApiOperation("我的钱包")
|
||||
public Result selectUserMoney(Long userId){
|
||||
return Result.success().put("data",userMoneyService.selectUserMoneyByUserId(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/selectSysUserMoney")
|
||||
@ApiOperation("代理钱包")
|
||||
public Result selectSysUserMoney(Long userId){
|
||||
return Result.success().put("data",userMoneyService.selectSysUserMoneyByUserId(userId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.sqx.modules.app.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserVip;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
import com.sqx.modules.app.service.UserVipService;
|
||||
import com.sqx.modules.app.service.VipDetailsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@Api(value = "会员管理", tags = {"会员管理"})
|
||||
@RequestMapping(value = "/vipDetails")
|
||||
public class VipDetailsController {
|
||||
|
||||
@Autowired
|
||||
private VipDetailsService vipDetailsService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
|
||||
@PostMapping("/sendVip")
|
||||
@ApiOperation("赠送会员")
|
||||
public Result sendVip(Long userId,Integer num){
|
||||
UserVip userVip = userVipService.selectUserVipByUserId(userId);
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
if(userVip!=null){
|
||||
if(userVip.getIsVip()==2){
|
||||
Date date = DateUtils.stringToDate(userVip.getEndTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
calendar.setTime(date);
|
||||
}
|
||||
}else{
|
||||
userVip=new UserVip();
|
||||
userVip.setUserId(userId);
|
||||
userVip.setCreateTime(DateUtils.format(new Date()));
|
||||
}
|
||||
userVip.setVipType(1);
|
||||
userVip.setIsVip(2);
|
||||
calendar.add(Calendar.DAY_OF_MONTH,num);
|
||||
userVip.setEndTime(DateUtils.format(calendar.getTime()));
|
||||
if(userVip.getVipId()!=null){
|
||||
userVipService.updateById(userVip);
|
||||
}else{
|
||||
userVipService.save(userVip);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteVip")
|
||||
@ApiOperation("取消会员")
|
||||
public Result deleteVip(Long userId){
|
||||
UserVip userVip = userVipService.selectUserVipByUserId(userId);
|
||||
if(userVip!=null){
|
||||
userVipService.removeById(userVip.getVipId());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiParam("添加会员的详情信息")
|
||||
@PostMapping("/insertVipDetails")
|
||||
public Result insertVipDetails(@RequestBody VipDetails vipDetails) {
|
||||
return vipDetailsService.insertVipDetails(vipDetails);
|
||||
}
|
||||
|
||||
|
||||
@ApiParam("修改会员的详情信息")
|
||||
@PostMapping("/updateVipDetails")
|
||||
public Result updateVipDetails(@RequestBody VipDetails vipDetails) {
|
||||
vipDetailsService.updateById(vipDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiParam("删除的详情信息")
|
||||
@PostMapping("/deleteVipDetails")
|
||||
public Result deleteVipDetails(Long id) {
|
||||
vipDetailsService.removeById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiParam("查询会员列表")
|
||||
@GetMapping("/selectVipDetailsList")
|
||||
public Result selectVipDetailsList(Integer page,Integer limit) {
|
||||
return Result.success().put("data",new PageUtils(vipDetailsService.page(new Page<>(page,limit))));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.annotation.LoginUser;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.AppService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* APP登录授权
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/user")
|
||||
@Api(value = "APP管理", tags = {"APP管理"})
|
||||
public class AppController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private AppService appService;
|
||||
|
||||
@PostMapping("/authenticationRegister")
|
||||
@ApiOperation("认证创建账号")
|
||||
public Result authenticationRegister(@RequestBody JSONObject jsonObject, HttpServletRequest request){
|
||||
return userService.authenticationRegister(jsonObject,request);
|
||||
}
|
||||
|
||||
@Login
|
||||
@PostMapping("/getNewUserRed")
|
||||
@ApiOperation("领取新用户红包")
|
||||
public Result getNewUserRed(@RequestAttribute Long userId){
|
||||
return userService.getNewUserRed(userId);
|
||||
}
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updatePwd", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation("用户端修改密码")
|
||||
public Result updatePwd(@LoginUser UserEntity user,String pwd,String oldPwd) {
|
||||
if(!user.getPassword().equals(DigestUtils.sha256Hex(oldPwd))){
|
||||
return Result.error("原始密码不正确!");
|
||||
}
|
||||
if(pwd.equals(oldPwd)){
|
||||
return Result.error("新密码不能与旧密码相同!");
|
||||
}
|
||||
user.setPassword(DigestUtils.sha256Hex(pwd));
|
||||
userService.updateById(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updatePhone", method = RequestMethod.POST)
|
||||
@ApiOperation("用户端换绑手机号")
|
||||
@ResponseBody
|
||||
public Result updatePhone(@RequestAttribute("userId") Long userId,@RequestParam String phone, @RequestParam String msg) {
|
||||
return userService.updatePhone(phone, msg,userId);
|
||||
}
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updateUser", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改个人信息")
|
||||
@ResponseBody
|
||||
public Result updateUserImageUrl(@RequestAttribute("userId") Long userId,String zhiFuBao,String zhiFuBaoName) {
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setZhiFuBao(zhiFuBao);
|
||||
userEntity.setZhiFuBaoName(zhiFuBaoName);
|
||||
userEntity.setUserId(userId);
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updateUsers", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改个人信息")
|
||||
@ResponseBody
|
||||
public Result updateUsers(@RequestAttribute("userId") Long userId,@RequestBody UserEntity userEntity) {
|
||||
userEntity.setUserId(userId);
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
/*@Login
|
||||
@RequestMapping(value = "/updateUsers", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改个人信息")
|
||||
@ResponseBody
|
||||
public Result updateUsers(@RequestAttribute("userId") Long userId,String userName,String avatar,String phone) {
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setUserId(userId);
|
||||
userEntity.setUserName(userName);
|
||||
userEntity.setAvatar(avatar);
|
||||
userEntity.setPhone(phone);
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}*/
|
||||
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updateUserImageUrl", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改头像")
|
||||
@ResponseBody
|
||||
public Result updateUserImageUrl(@LoginUser UserEntity user,String avatar) {
|
||||
user.setAvatar(avatar);
|
||||
userService.updateById(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/updateUserName", method = RequestMethod.POST)
|
||||
@ApiOperation("用户修改昵称")
|
||||
@ResponseBody
|
||||
public Result updateUserName(@LoginUser UserEntity user,String userName) {
|
||||
user.setUserName(userName);
|
||||
userService.updateById(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Login
|
||||
@RequestMapping(value = "/selectUserById", method = RequestMethod.GET)
|
||||
@ApiOperation("获取用户详细信息")
|
||||
@ResponseBody
|
||||
public Result selectUserById(@LoginUser UserEntity user) {
|
||||
return Result.success().put("data",user);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/selectNewApp", method = RequestMethod.GET)
|
||||
@ApiOperation("升级检测")
|
||||
@ResponseBody
|
||||
public Result selectNewApp() {
|
||||
return Result.success().put("data",appService.selectNewApp());
|
||||
}
|
||||
|
||||
@GetMapping("/openId/{code:.+}/{userId}")
|
||||
@ApiOperation("根据code获取openid")
|
||||
public Result getOpenid(@PathVariable("code") String code,@PathVariable("userId")Long userId) {
|
||||
return userService.getOpenId(code,userId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateClientId", method = RequestMethod.GET)
|
||||
@ApiOperation("绑定ClientId")
|
||||
@ResponseBody
|
||||
public Result updateClientId(String clientId,Long userId,Integer sysPhone ) {
|
||||
userService.updateUserClientIdIsNull(clientId);
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setSysPhone(sysPhone);
|
||||
userEntity.setUserId(userId);
|
||||
userEntity.setClientid(clientId);
|
||||
userService.updateById(userEntity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.IAppleService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.utils.UserConstantInterface;
|
||||
import com.sqx.modules.app.utils.WxPhone;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.utils.HttpClientUtil;
|
||||
import com.sqx.modules.utils.SenInfoCheckUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import weixin.popular.api.SnsAPI;
|
||||
import weixin.popular.bean.sns.SnsToken;
|
||||
|
||||
/**
|
||||
* APP登录授权
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/Login")
|
||||
@Api("APP登录接口")
|
||||
@Slf4j
|
||||
public class AppLoginController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private IAppleService appleService;
|
||||
@Autowired
|
||||
private CommonInfoService commonInfoService;
|
||||
|
||||
@ApiOperation("微信小程序登陆")
|
||||
@RequestMapping(value = "/wxLogin", method = RequestMethod.GET)
|
||||
public Result wxLogin(@ApiParam("小程序code码") String code){
|
||||
return userService.wxLogin(code);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("小程序登录新增或修改个人信息")
|
||||
@RequestMapping(value = "/insertWxUser", method = RequestMethod.POST)
|
||||
public Result insertWxUser(@RequestBody UserEntity userInfo){
|
||||
return userService.wxRegister(userInfo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/dyLogin", method = RequestMethod.POST)
|
||||
@ApiOperation("抖音登录")
|
||||
@ResponseBody
|
||||
public Result dyLogin(String code,String anonymous_code) {
|
||||
return userService.dyLogin(code,anonymous_code);
|
||||
}
|
||||
|
||||
@ApiOperation("抖音登录新增或修改个人信息")
|
||||
@RequestMapping(value = "/dyRegister", method = RequestMethod.POST)
|
||||
public Result dyRegister(@RequestBody UserEntity userInfo){
|
||||
return userService.dyRegister(userInfo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ksLogin", method = RequestMethod.POST)
|
||||
@ApiOperation("快手登录")
|
||||
@ResponseBody
|
||||
public Result ksLogin(String code) {
|
||||
return userService.ksLogin(code);
|
||||
}
|
||||
|
||||
@ApiOperation("快手登录新增或修改个人信息")
|
||||
@RequestMapping(value = "/ksRegister", method = RequestMethod.POST)
|
||||
public Result ksRegister(@RequestBody UserEntity userInfo){
|
||||
return userService.ksRegister(userInfo);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/appleLogin", method = RequestMethod.GET)
|
||||
@ApiOperation("苹果登陆获取appleUserId")
|
||||
public Result loginVerify(@RequestParam("identityToken") String identityToken) {
|
||||
try {
|
||||
log.info("苹果token:{}", identityToken);
|
||||
JSONObject jsonObject = JSON.parseObject(identityToken);
|
||||
JSONObject userInfo = jsonObject.getJSONObject("userInfo");
|
||||
String identityTokens = userInfo.getString("identityToken");
|
||||
return appleService.getAppleUserInfo(identityTokens);
|
||||
} catch (Exception e) {
|
||||
log.error("苹果token校验失败:{}", identityToken, e);
|
||||
return Result.error("苹果账号验证失败,请退出重试!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("苹果登录")
|
||||
@RequestMapping(value = "/insertAppleUser", method = RequestMethod.GET)
|
||||
public Result insertAppleUser(@RequestParam String appleId){
|
||||
return userService.iosRegister(appleId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/iosBindMobile", method = RequestMethod.POST)
|
||||
@ApiOperation("苹果登录绑定手机号")
|
||||
@ResponseBody
|
||||
public Result iosBindMobile(@RequestParam String phone,@RequestParam String code,@RequestParam String appleId,
|
||||
@RequestParam String platform,@RequestParam Integer sysPhone,String inviterCode,String qdCode) {
|
||||
return userService.iosBindMobile(phone, code, appleId, platform, sysPhone,inviterCode,qdCode);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/wxAppLogin", method = RequestMethod.POST)
|
||||
@ApiOperation("微信APP登录")
|
||||
@ResponseBody
|
||||
public Result wxAppLogin(@RequestParam String wxOpenId,@RequestParam String token) {
|
||||
return userService.wxAppLogin(wxOpenId,token);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/wxBindMobile", method = RequestMethod.POST)
|
||||
@ApiOperation("微信登录绑定手机号")
|
||||
@ResponseBody
|
||||
public Result wxBindMobile(@RequestParam String phone,@RequestParam String code,@RequestParam String wxOpenId,@RequestParam String token,
|
||||
@RequestParam String platform,@RequestParam Integer sysPhone,String inviterCode,String qdCode) {
|
||||
return userService.wxBindMobile(phone, code, wxOpenId, token, platform, sysPhone,inviterCode,qdCode);
|
||||
}
|
||||
|
||||
@PostMapping("/phoneLogin")
|
||||
@ApiOperation("手机号一键登录")
|
||||
@ResponseBody
|
||||
public Result phoneLogin(String phone){
|
||||
return userService.phoneLogin(phone);
|
||||
}
|
||||
|
||||
@PostMapping("/bindMobile")
|
||||
@ApiOperation("手机号一键登录")
|
||||
@ResponseBody
|
||||
public Result bindMobile(String phone,String platform, Integer sysPhone,String inviterCode,String qdCode){
|
||||
return userService.bindMobile(phone, platform, sysPhone, inviterCode, qdCode);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/registerCode", method = RequestMethod.POST)
|
||||
@ApiOperation("app或h5注册或登录")
|
||||
@ResponseBody
|
||||
public Result registerCode(@RequestParam String phone,String msg,String platform,Integer sysPhone,
|
||||
String password,String inviterCode,String wxId,String qdCode) {
|
||||
return userService.registerCode(phone,msg,platform,sysPhone,password,inviterCode,wxId,qdCode);
|
||||
}
|
||||
|
||||
@PostMapping("/bindWxOpenPhone")
|
||||
@ApiOperation("微信公众号绑定手机号")
|
||||
public Result bindWxOpenPhone(Long userId,String phone,String msg){
|
||||
return userService.bindWxOpenPhone(userId, phone, msg);
|
||||
}
|
||||
|
||||
@ApiOperation("用户端发送验证码")
|
||||
@RequestMapping(value = "/sendMsg/{phone}/{state}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result sendMsg(@PathVariable String phone, @PathVariable String state) {
|
||||
return userService.sendMsg(phone, state,null);
|
||||
}
|
||||
|
||||
@ApiOperation("解密手机号")
|
||||
@RequestMapping(value = "/selectPhone",method = RequestMethod.POST)
|
||||
public Result getPhoneNumberBeanS5(@RequestBody WxPhone wxPhone) {
|
||||
return UserConstantInterface.decryptS5(wxPhone.getDecryptData(), wxPhone.getKey(), wxPhone.getIv());
|
||||
}
|
||||
|
||||
@ApiOperation("微信小程序解密手机号")
|
||||
@RequestMapping(value = "/wxPhone",method = RequestMethod.POST)
|
||||
public Result wxPhone(String code) {
|
||||
String url="https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="+SenInfoCheckUtil.getMpToken();
|
||||
JSONObject param=new JSONObject();
|
||||
param.put("code",code);
|
||||
String result = HttpClientUtil.doPostJson(url, param.toJSONString());
|
||||
return Result.success().put("data",JSONObject.parseObject(result));
|
||||
}
|
||||
|
||||
@ApiOperation("用户端忘记密码")
|
||||
@RequestMapping(value = "/forgetPwd", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Result forgetPwd(String pwd, String phone, String msg) {
|
||||
return userService.forgetPwd(pwd, phone, msg);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getOpenId")
|
||||
@ApiOperation("公众号根据code换取openId")
|
||||
public Result getOpenId(String code,Long userId) {
|
||||
try {
|
||||
//微信appid
|
||||
CommonInfo one = commonInfoService.findOne(5);
|
||||
//微信秘钥
|
||||
CommonInfo two = commonInfoService.findOne(21);
|
||||
SnsToken snsToken = SnsAPI.oauth2AccessToken(one.getValue(), two.getValue(), code);
|
||||
String openid = snsToken.getOpenid();
|
||||
return Result.success().put("data",openid);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("GET_OPENID_FAIL");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("用户端openid登录呢")
|
||||
@RequestMapping(value = "/openid/login", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result loginByOpenId(@RequestParam String openId) {
|
||||
return userService.loginByOpenId(openId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/moneyDetails")
|
||||
@AllArgsConstructor
|
||||
@Api("钱包明细")
|
||||
public class AppUserMoneyDetailsController {
|
||||
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
private UserMoneyService userMoneyService;
|
||||
|
||||
|
||||
@Login
|
||||
@ApiOperation("钱包明细")
|
||||
@GetMapping("/queryUserMoneyDetails")
|
||||
public Result queryUserMoneyDetails(Integer page, Integer limit, @RequestAttribute Long userId,Integer classify,Integer type) {
|
||||
return userMoneyDetailsService.queryUserMoneyDetails(page, limit,null, userId,1,type);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectUserMoney")
|
||||
@ApiOperation("我的钱包")
|
||||
public Result selectUserMoney(@RequestAttribute Long userId){
|
||||
return Result.success().put("data",userMoneyService.selectUserMoneyByUserId(userId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.service.UserVipService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Api(value = "用户会员信息", tags = {"用户会员信息"})
|
||||
@RequestMapping(value = "/app/UserVip")
|
||||
public class AppUserVipController extends AbstractController {
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Login
|
||||
@GetMapping("/selectUserVip")
|
||||
@ApiOperation("查询用户会员信息")
|
||||
public Result selectUserVip(@RequestAttribute Long userId){
|
||||
return Result.success().put("data",userVipService.selectUserVipByUserId(userId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
import com.sqx.modules.app.service.VipDetailsService;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/VipDetails")
|
||||
@AllArgsConstructor
|
||||
@Api("会员详情信息")
|
||||
public class AppVipDetailsController {
|
||||
private VipDetailsService appVipDetailsService;
|
||||
private OrdersService ordersService;
|
||||
|
||||
/**
|
||||
* 查询会员的详情信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@ApiParam("查询会员的详情信息")
|
||||
@GetMapping("/selectVipDetails")
|
||||
public Result selectVipDetails() {
|
||||
return appVipDetailsService.selectVipDetails();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加会员的详情信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@ApiParam("添加会员的详情信息")
|
||||
@GetMapping("/insertVipDetails")
|
||||
public Result insertVipDetails(VipDetails vipDetails) {
|
||||
return appVipDetailsService.insertVipDetails(vipDetails);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
src/main/java/com/sqx/modules/app/dao/AppDao.java
Normal file
20
src/main/java/com/sqx/modules/app/dao/AppDao.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.App;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户升级
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppDao extends BaseMapper<App> {
|
||||
|
||||
List<App> selectNewApp();
|
||||
|
||||
|
||||
|
||||
}
|
||||
20
src/main/java/com/sqx/modules/app/dao/MsgDao.java
Normal file
20
src/main/java/com/sqx/modules/app/dao/MsgDao.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.Msg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsgDao extends BaseMapper<Msg> {
|
||||
|
||||
Msg findByPhone(String phone);
|
||||
|
||||
Msg findByPhoneAndCode(String phone, String msg);
|
||||
|
||||
|
||||
|
||||
}
|
||||
47
src/main/java/com/sqx/modules/app/dao/UserDao.java
Normal file
47
src/main/java/com/sqx/modules/app/dao/UserDao.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserDao extends BaseMapper<UserEntity> {
|
||||
|
||||
|
||||
IPage<UserEntity> selectUserPage(@Param("page") Page<UserEntity> page, @Param("search") String search, @Param("sex") Integer sex, @Param("platform") String platform,
|
||||
@Param("sysPhone") String sysPhone, @Param("status") Integer status, @Param("member") Integer member,
|
||||
@Param("inviterCode") String inviterCode, @Param("userName") String userName,
|
||||
@Param("invitationCode") String invitationCode, @Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,@Param("qdCode") String qdCode,@Param("sysUserName") String sysUserName,Integer vipType);
|
||||
|
||||
List<UserEntity> userListExcel(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("userEntity") UserEntity userEntity);
|
||||
|
||||
int queryInviterCount(@Param("inviterCode") String inviterCode);
|
||||
|
||||
int queryUserCount(@Param("type") int type, @Param("date") String date,String platform,String qdCode);
|
||||
|
||||
Double queryPayMoney(@Param("type") int type, @Param("date") String date,String qdCode);
|
||||
|
||||
IPage<Map<String, Object>> queryCourseOrder(Page iPage,@Param("type") int type, @Param("date") String date,Long sysUserId);
|
||||
|
||||
int userMessage( String date, int type,String qdCode,Integer vipType);
|
||||
|
||||
int insertUser(UserEntity userEntity);
|
||||
|
||||
IPage<UserEntity> selectInviteUserList(Page<UserEntity> page,String userName,String phone);
|
||||
|
||||
int selectUserOnLineCount(String qdCode);
|
||||
|
||||
int updateUserClientIdIsNull(String clientid);
|
||||
|
||||
|
||||
}
|
||||
14
src/main/java/com/sqx/modules/app/dao/UserMoneyDao.java
Normal file
14
src/main/java/com/sqx/modules/app/dao/UserMoneyDao.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface UserMoneyDao extends BaseMapper<UserMoney> {
|
||||
|
||||
void updateMayMoney(@Param("type") Integer type, @Param("userId")Long userId, @Param("money") Double money);
|
||||
|
||||
void updateSysMoney(@Param("type") Integer type, @Param("sysUserId")Long sysUserId, @Param("money") Double money);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface UserMoneyDetailsDao extends BaseMapper<UserMoneyDetails> {
|
||||
|
||||
|
||||
Double monthIncome(@Param("date") String date,@Param("userId") Long userId);
|
||||
|
||||
}
|
||||
12
src/main/java/com/sqx/modules/app/dao/UserVipDao.java
Normal file
12
src/main/java/com/sqx/modules/app/dao/UserVipDao.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.UserVip;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserVipDao extends BaseMapper<UserVip> {
|
||||
|
||||
int updateUserVipByEndTime();
|
||||
|
||||
}
|
||||
9
src/main/java/com/sqx/modules/app/dao/VipDetailsDao.java
Normal file
9
src/main/java/com/sqx/modules/app/dao/VipDetailsDao.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.sqx.modules.app.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface VipDetailsDao extends BaseMapper<VipDetails> {
|
||||
}
|
||||
35
src/main/java/com/sqx/modules/app/entity/App.java
Normal file
35
src/main/java/com/sqx/modules/app/entity/App.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 广告位
|
||||
*/
|
||||
@Data
|
||||
@TableName("app")
|
||||
public class App implements Serializable {
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
private String createAt;
|
||||
|
||||
private String androidWgtUrl;
|
||||
|
||||
private String iosWgtUrl;
|
||||
|
||||
private String wgtUrl;
|
||||
|
||||
private String version;
|
||||
|
||||
private String iosVersion;
|
||||
|
||||
private String method;
|
||||
|
||||
private String des;
|
||||
|
||||
}
|
||||
|
||||
23
src/main/java/com/sqx/modules/app/entity/AppUserInfo.java
Normal file
23
src/main/java/com/sqx/modules/app/entity/AppUserInfo.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AppUserInfo {
|
||||
|
||||
|
||||
|
||||
private String openid;
|
||||
private String nickname;
|
||||
private int sex;
|
||||
private String province;
|
||||
private String city;
|
||||
private String country;
|
||||
private String headimgurl;
|
||||
private String unionid;
|
||||
private List<String> privilege;
|
||||
|
||||
|
||||
}
|
||||
27
src/main/java/com/sqx/modules/app/entity/Msg.java
Normal file
27
src/main/java/com/sqx/modules/app/entity/Msg.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/10
|
||||
*/
|
||||
@Data
|
||||
@TableName("msg")
|
||||
public class Msg implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String phone;
|
||||
|
||||
|
||||
}
|
||||
27
src/main/java/com/sqx/modules/app/entity/UserDetails.java
Normal file
27
src/main/java/com/sqx/modules/app/entity/UserDetails.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class UserDetails {
|
||||
/**
|
||||
* 本月订单数量
|
||||
*/
|
||||
private int monthlyOrderNum;
|
||||
/**
|
||||
* 本月充值金豆
|
||||
*/
|
||||
private BigDecimal monthlyRechargeMoney;
|
||||
/**
|
||||
*本月提现数量
|
||||
*/
|
||||
private int monthWithdrawalNum;
|
||||
/**
|
||||
* 本月提现金豆
|
||||
*/
|
||||
private BigDecimal monthlyWithdrawalMoney;
|
||||
|
||||
|
||||
}
|
||||
202
src/main/java/com/sqx/modules/app/entity/UserEntity.java
Normal file
202
src/main/java/com/sqx/modules/app/entity/UserEntity.java
Normal file
@@ -0,0 +1,202 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
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 java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户")
|
||||
@TableName("tb_user")
|
||||
public class UserEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户id", orderNum = "1")
|
||||
@ApiModelProperty("用户id")
|
||||
@TableId(type = IdType.AUTO, value = "user_id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Excel(name = "用户昵称", orderNum = "2")
|
||||
@ApiModelProperty("用户名")
|
||||
@TableField("user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Excel(name = "手机号", orderNum = "4")
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Excel(name = "头像", orderNum = "3")
|
||||
@ApiModelProperty("头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 性别 1男 2女
|
||||
*/
|
||||
@ApiModelProperty("性别 1男 2女")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 微信小程序openid
|
||||
*/
|
||||
@ApiModelProperty("微信小程序openid")
|
||||
@TableField("open_id")
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 微信小程序openid
|
||||
*/
|
||||
@ApiModelProperty("微信公众号openid")
|
||||
@TableField("wx_id")
|
||||
private String wxId;
|
||||
|
||||
/**
|
||||
* 微信app openid
|
||||
*/
|
||||
@ApiModelProperty("微信app openid")
|
||||
@TableField("wx_open_id")
|
||||
private String wxOpenId;
|
||||
|
||||
/**
|
||||
* 抖音小程序openId
|
||||
*/
|
||||
private String dyOpenId;
|
||||
|
||||
/**
|
||||
* 快手小程序openId
|
||||
*/
|
||||
private String ksOpenId;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", orderNum = "13", width = 18)
|
||||
@TableField("create_time")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("update_time")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 苹果id
|
||||
*/
|
||||
@TableField("apple_id")
|
||||
private String appleId;
|
||||
|
||||
/**
|
||||
* 手机类型 1安卓 2ios
|
||||
*/
|
||||
@TableField("sys_phone")
|
||||
private Integer sysPhone;
|
||||
|
||||
/**
|
||||
* 状态 1正常 2禁用
|
||||
*/
|
||||
@Excel(name = "状态", orderNum = "13", replace = {"正常_1", "禁用_1"})
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 来源 app 小程序 公众号
|
||||
*/
|
||||
@Excel(name = "渠道来源", orderNum = "9")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
private Integer jifen;
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@Excel(name = "邀请码", orderNum = "5")
|
||||
@TableField("invitation_code")
|
||||
private String invitationCode;
|
||||
|
||||
/**
|
||||
* 邀请人邀请码
|
||||
*/
|
||||
@Excel(name = "邀请人邀请码", orderNum = "6",width = 15)
|
||||
@TableField("inviter_code")
|
||||
private String inviterCode;
|
||||
|
||||
private String clientid;
|
||||
|
||||
@Excel(name = "支付宝账号", orderNum = "8", width = 18)
|
||||
private String zhiFuBao;
|
||||
|
||||
@Excel(name = "支付宝名称", orderNum = "8", width = 18)
|
||||
private String zhiFuBaoName;
|
||||
|
||||
@Excel(name = "一级推广收益比例", orderNum = "8", width = 18)
|
||||
private BigDecimal rate;
|
||||
|
||||
@Excel(name = "二级推广收益比例", orderNum = "8", width = 18)
|
||||
private BigDecimal twoRate;
|
||||
|
||||
/**
|
||||
* 最后一次在线时间
|
||||
*/
|
||||
private String onLineTime;
|
||||
|
||||
/**
|
||||
* 渠道码
|
||||
*/
|
||||
private String qdCode;
|
||||
|
||||
/**
|
||||
* 是否是新用户 1否
|
||||
*/
|
||||
private Integer isNewUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String sysUserName;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer member;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer counts;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal money;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String endTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer vipType;
|
||||
|
||||
|
||||
}
|
||||
49
src/main/java/com/sqx/modules/app/entity/UserMoney.java
Normal file
49
src/main/java/com/sqx/modules/app/entity/UserMoney.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
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.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("user_money")
|
||||
@ApiModel("用户钱包")
|
||||
public class UserMoney implements Serializable {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty("主键id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 钱包金豆
|
||||
*/
|
||||
@ApiModelProperty("钱包金豆")
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty("用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 渠道用户id
|
||||
*/
|
||||
@ApiModelProperty("渠道用户id")
|
||||
@TableField("sys_user_id")
|
||||
private Long sysUserId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
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.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("user_money_details")
|
||||
@ApiModel("钱包详情")
|
||||
public class UserMoneyDetails implements Serializable {
|
||||
/**
|
||||
* 钱包详情id
|
||||
*/
|
||||
@ApiModelProperty("钱包详情id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 渠道用户id
|
||||
*/
|
||||
@ApiModelProperty("渠道用户id")
|
||||
@TableField("sys_user_id")
|
||||
private Long sysUserId;
|
||||
|
||||
/**
|
||||
* 对应用户id
|
||||
*/
|
||||
@TableField("by_user_id")
|
||||
@ApiModelProperty("对应用户id")
|
||||
private Long byUserId;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty("标题")
|
||||
private String title;
|
||||
/**
|
||||
* 1注册 2首次购买 3购买 4提现
|
||||
*/
|
||||
@ApiModelProperty("1充值钱包明细 2提现钱包明细")
|
||||
private Integer classify;
|
||||
/**
|
||||
* 类别(1充值2支出)
|
||||
*/
|
||||
@ApiModelProperty("类别(1充值2支出)")
|
||||
private Integer type;
|
||||
/**
|
||||
* 状态 1待支付 2已到账 3取消
|
||||
*/
|
||||
@ApiModelProperty("状态 1待支付 2已到账 3取消")
|
||||
private Integer state;
|
||||
/**
|
||||
* 金豆
|
||||
*/
|
||||
@ApiModelProperty("金豆")
|
||||
private BigDecimal money;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@ApiModelProperty("内容")
|
||||
private String content;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@ApiModelProperty("创建时间")
|
||||
private String createTime;
|
||||
|
||||
|
||||
}
|
||||
47
src/main/java/com/sqx/modules/app/entity/UserVip.java
Normal file
47
src/main/java/com/sqx/modules/app/entity/UserVip.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@Data
|
||||
@TableName("user_vip")
|
||||
public class UserVip implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 用户会员ID
|
||||
*/
|
||||
@TableId
|
||||
private Long vipId;
|
||||
/**
|
||||
* 会员类型
|
||||
*/
|
||||
private Integer vipNameType;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 会员是否到期
|
||||
*/
|
||||
private Integer isVip;
|
||||
|
||||
|
||||
/**
|
||||
* 购买时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 到期时间
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 会员类型 1活动赠送 2充值开通
|
||||
*/
|
||||
private Integer vipType;
|
||||
|
||||
public UserVip() {}
|
||||
}
|
||||
38
src/main/java/com/sqx/modules/app/entity/VipDetails.java
Normal file
38
src/main/java/com/sqx/modules/app/entity/VipDetails.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.sqx.modules.app.entity;
|
||||
|
||||
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.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("vip_details")
|
||||
@ApiModel("会员详情")
|
||||
public class VipDetails implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("会员类型")
|
||||
@TableField("vip_name_type")
|
||||
private Integer vipNameType;
|
||||
|
||||
@ApiModelProperty("会员价格")
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 支付钻石
|
||||
*/
|
||||
private BigDecimal payDiamond;
|
||||
|
||||
}
|
||||
24
src/main/java/com/sqx/modules/app/form/LoginForm.java
Normal file
24
src/main/java/com/sqx/modules/app/form/LoginForm.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.sqx.modules.app.form;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 登录表单
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "登录表单")
|
||||
public class LoginForm {
|
||||
@ApiModelProperty(value = "手机号")
|
||||
@NotBlank(message="手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
@NotBlank(message="密码不能为空")
|
||||
private String password;
|
||||
|
||||
}
|
||||
24
src/main/java/com/sqx/modules/app/form/RegisterForm.java
Normal file
24
src/main/java/com/sqx/modules/app/form/RegisterForm.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.sqx.modules.app.form;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 注册表单
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "注册表单")
|
||||
public class RegisterForm {
|
||||
@ApiModelProperty(value = "手机号")
|
||||
@NotBlank(message="手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
@NotBlank(message="密码不能为空")
|
||||
private String password;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.sqx.modules.app.interceptor;
|
||||
|
||||
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.utils.JwtUtils;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 权限(Token)验证
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
public static final String USER_KEY = "userId";
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
Login annotation;
|
||||
if(handler instanceof HandlerMethod) {
|
||||
annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class);
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(annotation == null){
|
||||
return true;
|
||||
}
|
||||
|
||||
//获取用户凭证
|
||||
String token = request.getHeader(jwtUtils.getHeader());
|
||||
if(StringUtils.isBlank(token)){
|
||||
token = request.getParameter(jwtUtils.getHeader());
|
||||
}
|
||||
|
||||
//凭证为空
|
||||
if(StringUtils.isBlank(token)){
|
||||
throw new SqxException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
|
||||
}
|
||||
|
||||
Claims claims = jwtUtils.getClaimByToken(token);
|
||||
if(claims == null || jwtUtils.isTokenExpired(claims.getExpiration())){
|
||||
throw new SqxException(jwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value());
|
||||
}
|
||||
|
||||
//设置userId到request里,后续根据userId,获取用户信息
|
||||
long userId = Long.parseLong(claims.getSubject());
|
||||
request.setAttribute(USER_KEY, userId);
|
||||
//记录用户最后一次调用接口的时间
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setUserId(userId);
|
||||
userEntity.setOnLineTime(DateUtils.format(new Date()));
|
||||
userService.updateById(userEntity);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.sqx.modules.app.resolver;
|
||||
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.interceptor.AuthorizationInterceptor;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.app.annotation.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
/**
|
||||
* 有@LoginUser注解的方法参数,注入当前登录用户
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return parameter.getParameterType().isAssignableFrom(UserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container,
|
||||
NativeWebRequest request, WebDataBinderFactory factory) throws Exception {
|
||||
//获取用户ID
|
||||
Object object = request.getAttribute(AuthorizationInterceptor.USER_KEY, RequestAttributes.SCOPE_REQUEST);
|
||||
if(object == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
UserEntity user = userService.getById((Long)object);
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.app.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CourseOrderResponse implements Serializable {
|
||||
/**
|
||||
* 短剧名称
|
||||
*/
|
||||
private String coursename;
|
||||
/**
|
||||
* 售卖笔数
|
||||
*/
|
||||
private int coursenum;
|
||||
/**
|
||||
* 售卖金豆
|
||||
*/
|
||||
private Double coursemoney;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.sqx.modules.app.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 首页信息返回实体
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class HomeMessageResponse implements Serializable {
|
||||
/**
|
||||
* 总用户数
|
||||
*/
|
||||
private int totalUsers;
|
||||
/**
|
||||
*今日新增
|
||||
*/
|
||||
private int newToday;
|
||||
/**
|
||||
*本月新增
|
||||
*/
|
||||
private int newMonth;
|
||||
/**
|
||||
* 本年新增
|
||||
*/
|
||||
private int newYear;
|
||||
/**
|
||||
* 总收入
|
||||
*/
|
||||
private Double totalRevenue;
|
||||
/**
|
||||
* 今日收入
|
||||
*/
|
||||
private Double todayRevenue;
|
||||
/**
|
||||
* 本月收入
|
||||
*/
|
||||
private Double monthRevenue;
|
||||
/**
|
||||
* 本年收入
|
||||
*/
|
||||
private Double yearRevenue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.app.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserMessageResponse implements Serializable {
|
||||
/**
|
||||
* 总人数
|
||||
*/
|
||||
private int totalNumber;
|
||||
/**
|
||||
* 普通用户人数
|
||||
*/
|
||||
private int userNumber;
|
||||
/**
|
||||
* 会员人数
|
||||
*/
|
||||
private int vipUserNumber;
|
||||
}
|
||||
25
src/main/java/com/sqx/modules/app/service/AppService.java
Normal file
25
src/main/java/com/sqx/modules/app/service/AppService.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.app.entity.App;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 升级
|
||||
*
|
||||
*/
|
||||
public interface AppService extends IService<App> {
|
||||
|
||||
App selectAppById(Long id);
|
||||
|
||||
int insertApp(App app);
|
||||
|
||||
int updateAppById(App app);
|
||||
|
||||
int deleteAppById(Long id);
|
||||
|
||||
List<App> selectNewApp();
|
||||
|
||||
}
|
||||
10
src/main/java/com/sqx/modules/app/service/IAppleService.java
Normal file
10
src/main/java/com/sqx/modules/app/service/IAppleService.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
|
||||
public interface IAppleService {
|
||||
|
||||
Result getAppleUserInfo(String identityToken) throws Exception;
|
||||
|
||||
}
|
||||
17
src/main/java/com/sqx/modules/app/service/MsgService.java
Normal file
17
src/main/java/com/sqx/modules/app/service/MsgService.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.app.entity.Msg;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*
|
||||
*/
|
||||
public interface MsgService extends IService<Msg> {
|
||||
|
||||
Msg findByPhone(String phone);
|
||||
|
||||
Msg findByPhoneAndCode(String phone, String msg);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
|
||||
public interface UserMoneyDetailsService extends IService<UserMoneyDetails> {
|
||||
Result queryUserMoneyDetails(Integer page, Integer limit,Long sysUserId,Long userId,Integer classify,Integer type);
|
||||
Double monthIncome(String date,Long userId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
|
||||
public interface UserMoneyService extends IService<UserMoney> {
|
||||
|
||||
UserMoney selectUserMoneyByUserId(Long userId);
|
||||
|
||||
UserMoney selectSysUserMoneyByUserId(Long userId);
|
||||
|
||||
void updateMoney(int i, Long userId, double money);
|
||||
|
||||
void updateSysMoney(int i, Long userId, double money);
|
||||
|
||||
}
|
||||
230
src/main/java/com/sqx/modules/app/service/UserService.java
Normal file
230
src/main/java/com/sqx/modules/app/service/UserService.java
Normal file
@@ -0,0 +1,230 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author fang
|
||||
* @date 2021/2/27
|
||||
*/
|
||||
public interface UserService extends IService<UserEntity> {
|
||||
|
||||
|
||||
Result authenticationRegister(JSONObject jsonObject, HttpServletRequest request);
|
||||
|
||||
|
||||
Result getNewUserRed(Long userId);
|
||||
|
||||
/**
|
||||
* 根据手机号查询用户
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @return
|
||||
*/
|
||||
UserEntity queryByPhone(String phone);
|
||||
|
||||
/**
|
||||
* 根据小程序微信openId查询用户
|
||||
*
|
||||
* @param openId 微信小程序openId
|
||||
* @return
|
||||
*/
|
||||
UserEntity queryByOpenId(String openId);
|
||||
|
||||
UserEntity queryByWxId(String wxId);
|
||||
|
||||
UserEntity queryByDyOpenId(String dyOpenId);
|
||||
|
||||
UserEntity queryByKsOpenId(String ksOpenId);
|
||||
|
||||
/**
|
||||
* 根据微信APP openId查询用户
|
||||
*
|
||||
* @param openId 微信APP openId
|
||||
* @return
|
||||
*/
|
||||
UserEntity queryByWxOpenId(String openId);
|
||||
|
||||
/**
|
||||
* 根据userId查询用户
|
||||
*
|
||||
* @param userId userId
|
||||
* @return
|
||||
*/
|
||||
UserEntity queryByUserId(Long userId);
|
||||
|
||||
UserEntity queryByInvitationCode(String invitationCode);
|
||||
|
||||
/**
|
||||
* 根据用户appleId查询用户
|
||||
* @param appleId
|
||||
* @return
|
||||
*/
|
||||
UserEntity queryByAppleId(String appleId);
|
||||
|
||||
|
||||
Result wxLogin(String code);
|
||||
|
||||
/**
|
||||
* 注册或更新用户信息
|
||||
*
|
||||
* @param userInfo1 用户信息
|
||||
* @return 用户信息
|
||||
*/
|
||||
Result wxRegister(UserEntity userInfo1);
|
||||
|
||||
Result dyLogin(String code,String anonymous_code);
|
||||
|
||||
Result dyRegister(UserEntity userInfo1);
|
||||
|
||||
Result ksLogin(String code);
|
||||
|
||||
Result ksRegister(UserEntity userInfo1);
|
||||
|
||||
/**
|
||||
* 注册或更新用户信息
|
||||
*
|
||||
* @param appleId 苹果账号id
|
||||
* @return 用户信息
|
||||
*/
|
||||
Result iosRegister(String appleId);
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param state 验证码类型
|
||||
* @return
|
||||
*/
|
||||
Result sendMsg(String phone, String state,String pwd);
|
||||
|
||||
Result forgetPwd(String pwd, String phone, String msg);
|
||||
|
||||
/**
|
||||
* 绑定手机号
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param code 验证码
|
||||
* @return
|
||||
*/
|
||||
Result wxBindMobile(String phone, String code, String wxOpenId, String token, String platform, Integer sysPhone,String inviterCode,String qdCode);
|
||||
|
||||
/**
|
||||
* @param phone
|
||||
* @param code
|
||||
* @param appleId
|
||||
* @param platform
|
||||
* @param sysPhone
|
||||
* @return
|
||||
*/
|
||||
Result iosBindMobile(String phone, String code, String appleId, String platform, Integer sysPhone,String inviterCode,String qdCode);
|
||||
|
||||
Result phoneLogin(String phone);
|
||||
|
||||
Result bindMobile(String phone,String platform, Integer sysPhone,String inviterCode,String qdCode);
|
||||
|
||||
|
||||
/**
|
||||
* 换绑手机号
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param msg 验证码
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
Result updatePhone(String phone, String msg, Long userId);
|
||||
|
||||
/**
|
||||
* 登录token
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
Result getResult(UserEntity user);
|
||||
|
||||
/**
|
||||
* app注册或h5注册
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param msg 验证按
|
||||
* @param pwd 密码
|
||||
* @param platform 来源 app h5
|
||||
* @return
|
||||
*/
|
||||
Result registerCode(String phone, String msg, String platform, Integer sysPhone,String password,
|
||||
String inviterCode,String wxId,String qdCode);
|
||||
|
||||
Result bindWxOpenPhone(Long userId, String phone, String msg);
|
||||
|
||||
|
||||
Result wxAppLogin(String wxOpenId, String token);
|
||||
|
||||
|
||||
/**
|
||||
* app或h5登录
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param pwd 密码
|
||||
* @return
|
||||
*/
|
||||
Result login(String phone, String pwd);
|
||||
|
||||
|
||||
/**
|
||||
* 根据 code 获取openId
|
||||
*
|
||||
* @param code
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Result getOpenId(String code, Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户id查询用户
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
UserEntity selectUserById(Long userId);
|
||||
|
||||
void pushToSingle(String title, String content, String clientId);
|
||||
|
||||
PageUtils selectUserPage(Integer page, Integer limit,String phone,Integer sex,String platform,String sysPhone,Integer status,
|
||||
Integer member, String inviterCode, String userName, String invitationCode, String startTime,
|
||||
String endTime,String qdCode,String sysUserName,Integer vipType);
|
||||
|
||||
List<UserEntity> userListExcel(String startTime, String endTime, UserEntity userEntity);
|
||||
|
||||
int queryInviterCount(String inviterCode);
|
||||
|
||||
int queryUserCount(int type,String date,String platform,String qdCode);
|
||||
|
||||
Double queryPayMoney(int type,String qdCode);
|
||||
|
||||
IPage<Map<String, Object>> queryCourseOrder(Page<Map<String, Object>> iPage, int type, String date,Long sysUserId);
|
||||
|
||||
int userMessage( String date, int type,String qdCode,Integer vipType);
|
||||
|
||||
|
||||
Result selectInviteUserList(Integer page,Integer limit,String userName,String phone);
|
||||
|
||||
Result loginByOpenId(String openId);
|
||||
|
||||
Result selectUserOnLineCount(String qdCode);
|
||||
|
||||
int updateUserClientIdIsNull(String clientid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.app.entity.UserVip;
|
||||
|
||||
public interface UserVipService extends IService<UserVip> {
|
||||
|
||||
UserVip selectUserVipByUserId(Long userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sqx.modules.app.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
|
||||
public interface VipDetailsService extends IService<VipDetails> {
|
||||
/**
|
||||
* 查询会员的详情信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result selectVipDetails();
|
||||
|
||||
/**
|
||||
* 添加会员的详情信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result insertVipDetails(VipDetails vipDetails);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.app.dao.AppDao;
|
||||
import com.sqx.modules.app.entity.App;
|
||||
import com.sqx.modules.app.service.AppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service("AppService")
|
||||
public class AppServiceImpl extends ServiceImpl<AppDao, App> implements AppService {
|
||||
|
||||
@Autowired
|
||||
private AppDao appDao;
|
||||
|
||||
|
||||
@Override
|
||||
public App selectAppById(Long id) {
|
||||
return appDao.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertApp(App app) {
|
||||
return appDao.insert(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAppById(App app) {
|
||||
return appDao.updateById(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAppById(Long id) {
|
||||
return appDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<App> selectNewApp() {
|
||||
return appDao.selectNewApp();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
|
||||
import com.auth0.jwk.Jwk;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.service.IAppleService;
|
||||
import io.jsonwebtoken.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.tomcat.util.codec.binary.Base64;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
/**
|
||||
* @Description 苹果登录service
|
||||
* @author fang
|
||||
* @date 2020/11/4
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AppleServiceImpl implements IAppleService {
|
||||
|
||||
@Override
|
||||
public Result getAppleUserInfo(String identityToken) throws Exception {
|
||||
//验证identityToken
|
||||
if (!verify(identityToken)) {
|
||||
log.error("苹果解析失败!");
|
||||
return Result.error("苹果账号验证失败,请退出重试!");
|
||||
}
|
||||
//对identityToken解码
|
||||
JSONObject json = parserIdentityToken(identityToken);
|
||||
if (json == null) {
|
||||
return Result.error("苹果账号验证失败,请退出重试!");
|
||||
}
|
||||
String appleUserId = String.valueOf(json.get("sub"));
|
||||
log.error("苹果账号解析成功:"+appleUserId);
|
||||
System.err.println(appleUserId);
|
||||
return Result.success().put("data",appleUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对前端传来的JWT字符串identityToken的第二部分进行解码
|
||||
* 主要获取其中的aud和sub,aud大概对应ios前端的包名,sub大概对应当前用户的授权的openID
|
||||
*
|
||||
* @param identityToken 身份token
|
||||
* @return {"aud":"com.xkj.****","sub":"000***.8da764d3f9e34d2183e8da08a1057***.0***","c_hash":"UsKAuEoI-****","email_verified":"true","auth_time":1574673481,"iss":"https://appleid.apple.com","exp":1574674081,"iat":1574673481,"email":"****@qq.com"}
|
||||
*/
|
||||
private JSONObject parserIdentityToken(String identityToken) {
|
||||
String[] arr = identityToken.split("\\.");
|
||||
String decode = new String(Base64.decodeBase64(arr[1]));
|
||||
String substring = decode.substring(0, decode.indexOf("}") + 1);
|
||||
return JSONObject.fromObject(substring);
|
||||
}
|
||||
|
||||
|
||||
public Boolean verify(String jwt) throws Exception {
|
||||
JSONArray arr = getAuthKeys();
|
||||
if (arr == null) {
|
||||
log.error("获取不到苹果的验证秘钥!!");
|
||||
return false;
|
||||
}
|
||||
|
||||
JSONObject authKey = null;
|
||||
//先取苹果第一个key进行校验
|
||||
if(arr.size()==2){
|
||||
authKey = JSONObject.fromObject(arr.getString(0));
|
||||
if (verifyExc(jwt, authKey)) {
|
||||
log.error("苹果解析成功!1");
|
||||
return true;
|
||||
} else {
|
||||
//再取第二个key校验
|
||||
authKey = JSONObject.fromObject(arr.getString(1));
|
||||
return verifyExc(jwt, authKey);
|
||||
}
|
||||
}else{
|
||||
authKey = JSONObject.fromObject(arr.getString(0));
|
||||
if (verifyExc(jwt, authKey)) {
|
||||
log.error("苹果解析成功!1");
|
||||
return true;
|
||||
}
|
||||
//再取第二个key校验
|
||||
authKey = JSONObject.fromObject(arr.getString(1));
|
||||
if(verifyExc(jwt, authKey)){
|
||||
log.error("苹果解析成功!2");
|
||||
return true;
|
||||
}else{
|
||||
authKey = JSONObject.fromObject(arr.getString(2));
|
||||
return verifyExc(jwt, authKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对前端传来的identityToken进行验证
|
||||
*
|
||||
* @param jwt 对应前端传来的 identityToken
|
||||
* @param authKey 苹果的公钥 authKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private static Boolean verifyExc(String jwt, JSONObject authKey) throws Exception {
|
||||
|
||||
Jwk jwa = Jwk.fromValues(authKey);
|
||||
PublicKey publicKey = jwa.getPublicKey();
|
||||
|
||||
String aud = "";
|
||||
String sub = "";
|
||||
if (jwt.split("\\.").length > 1) {
|
||||
String claim = new String(Base64.decodeBase64(jwt.split("\\.")[1]));
|
||||
aud = JSONObject.fromObject(claim).get("aud").toString();
|
||||
sub = JSONObject.fromObject(claim).get("sub").toString();
|
||||
}
|
||||
JwtParser jwtParser = Jwts.parser().setSigningKey(publicKey);
|
||||
jwtParser.requireIssuer("https://appleid.apple.com");
|
||||
jwtParser.requireAudience(aud);
|
||||
jwtParser.requireSubject(sub);
|
||||
|
||||
try {
|
||||
Jws<Claims> claim = jwtParser.parseClaimsJws(jwt);
|
||||
if (claim != null && claim.getBody().containsKey("auth_time")) {
|
||||
System.out.println(claim);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (ExpiredJwtException e) {
|
||||
log.error("[AppleServiceImpl.verifyExc] [error] [apple identityToken expired]", e);
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
log.error("[AppleServiceImpl.verifyExc] [error] [apple identityToken illegal]", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取苹果的公钥
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static JSONArray getAuthKeys() {
|
||||
String url = "https://appleid.apple.com/auth/keys";
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
JSONObject json = restTemplate.getForObject(url, JSONObject.class);
|
||||
if (json != null) {
|
||||
return json.getJSONArray("keys");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.app.dao.MsgDao;
|
||||
import com.sqx.modules.app.entity.Msg;
|
||||
import com.sqx.modules.app.service.MsgService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service("MsgService")
|
||||
public class MsgServiceImpl extends ServiceImpl<MsgDao, Msg> implements MsgService {
|
||||
|
||||
@Autowired
|
||||
private MsgDao msgDao;
|
||||
|
||||
@Override
|
||||
public Msg findByPhone(String phone){
|
||||
return msgDao.findByPhone(phone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Msg findByPhoneAndCode(String phone, String msg){
|
||||
return msgDao.findByPhoneAndCode(phone,msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.dao.UserMoneyDetailsDao;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao, UserMoneyDetails> implements UserMoneyDetailsService {
|
||||
|
||||
@Override
|
||||
public Result queryUserMoneyDetails(Integer page, Integer limit,Long sysUserId,Long userId,Integer classify,Integer type) {
|
||||
IPage<UserMoneyDetails> page1 = new Page(page, limit);
|
||||
QueryWrapper<UserMoneyDetails> queryWrapper = new QueryWrapper();
|
||||
if(sysUserId!=null){
|
||||
queryWrapper.eq("sys_user_id", sysUserId);
|
||||
}
|
||||
if(userId!=null){
|
||||
queryWrapper.eq("user_id", userId);
|
||||
}
|
||||
if(classify!=null){
|
||||
queryWrapper.eq("classify", classify);
|
||||
}
|
||||
if(type!=null){
|
||||
queryWrapper.eq("type", type);
|
||||
}
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return Result.success().put("data", baseMapper.selectPage(page1, queryWrapper));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double monthIncome(String date, Long userId) {
|
||||
return baseMapper.monthIncome(date,userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.app.dao.UserMoneyDao;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Service
|
||||
public class UserMoneyServiceImpl extends ServiceImpl<UserMoneyDao, UserMoney> implements UserMoneyService {
|
||||
|
||||
@Override
|
||||
public void updateMoney(int i, Long userId, double money){
|
||||
selectUserMoneyByUserId(userId);
|
||||
baseMapper.updateMayMoney(i,userId,money);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSysMoney(int i, Long userId, double money){
|
||||
selectSysUserMoneyByUserId(userId);
|
||||
baseMapper.updateSysMoney(i,userId,money);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserMoney selectUserMoneyByUserId(Long userId){
|
||||
UserMoney userMoney = baseMapper.selectOne(new QueryWrapper<UserMoney>().eq("user_id", userId));
|
||||
if(userMoney==null){
|
||||
userMoney=new UserMoney();
|
||||
userMoney.setUserId(userId);
|
||||
userMoney.setMoney(new BigDecimal("0.00"));
|
||||
baseMapper.insert(userMoney);
|
||||
}
|
||||
return userMoney;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserMoney selectSysUserMoneyByUserId(Long userId){
|
||||
UserMoney userMoney = baseMapper.selectOne(new QueryWrapper<UserMoney>().eq("sys_user_id", userId));
|
||||
if(userMoney==null){
|
||||
userMoney=new UserMoney();
|
||||
userMoney.setSysUserId(userId);
|
||||
userMoney.setMoney(new BigDecimal("0.00"));
|
||||
baseMapper.insert(userMoney);
|
||||
}
|
||||
return userMoney;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1450
src/main/java/com/sqx/modules/app/service/impl/UserServiceImpl.java
Normal file
1450
src/main/java/com/sqx/modules/app/service/impl/UserServiceImpl.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.app.dao.UserVipDao;
|
||||
import com.sqx.modules.app.entity.UserVip;
|
||||
import com.sqx.modules.app.service.UserVipService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> implements UserVipService {
|
||||
|
||||
@Override
|
||||
public UserVip selectUserVipByUserId(Long userId) {
|
||||
QueryWrapper<UserVip> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",userId);
|
||||
return baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Scheduled(cron="0 */1 * * * ?")
|
||||
public void getEndVip() {
|
||||
baseMapper.updateUserVipByEndTime();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.dao.VipDetailsDao;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
import com.sqx.modules.app.service.VipDetailsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class VipDetailsServiceImpl extends ServiceImpl<VipDetailsDao, VipDetails> implements VipDetailsService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result selectVipDetails() {
|
||||
return Result.success().put("data", baseMapper.selectList(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result insertVipDetails(VipDetails vipDetails) {
|
||||
int cpunt = baseMapper.insert(vipDetails);
|
||||
if (cpunt > 0) {
|
||||
return Result.success("添加成功!");
|
||||
} else {
|
||||
return Result.error("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
86
src/main/java/com/sqx/modules/app/utils/JwtUtils.java
Normal file
86
src/main/java/com/sqx/modules/app/utils/JwtUtils.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package com.sqx.modules.app.utils;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* jwt工具类
|
||||
*
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "sqx.jwt")
|
||||
@Component
|
||||
public class JwtUtils {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private String secret;
|
||||
private long expire;
|
||||
private String header;
|
||||
|
||||
/**
|
||||
* 生成jwt token
|
||||
*/
|
||||
public String generateToken(long userId) {
|
||||
Date nowDate = new Date();
|
||||
//过期时间
|
||||
Date expireDate = new Date(nowDate.getTime() + expire * 1000);
|
||||
|
||||
return Jwts.builder()
|
||||
.setHeaderParam("typ", "JWT")
|
||||
.setSubject(userId+"")
|
||||
.setIssuedAt(nowDate)
|
||||
.setExpiration(expireDate)
|
||||
.signWith(SignatureAlgorithm.HS512, secret)
|
||||
.compact();
|
||||
}
|
||||
|
||||
public Claims getClaimByToken(String token) {
|
||||
try {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(secret)
|
||||
.parseClaimsJws(token)
|
||||
.getBody();
|
||||
}catch (Exception e){
|
||||
logger.debug("validate is token error ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* token是否过期
|
||||
* @return true:过期
|
||||
*/
|
||||
public boolean isTokenExpired(Date expiration) {
|
||||
return expiration.before(new Date());
|
||||
}
|
||||
|
||||
public String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
public long getExpire() {
|
||||
return expire;
|
||||
}
|
||||
|
||||
public void setExpire(long expire) {
|
||||
this.expire = expire;
|
||||
}
|
||||
|
||||
public String getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
public void setHeader(String header) {
|
||||
this.header = header;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.sqx.modules.app.utils;
|
||||
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.sqx.common.utils.Result;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
/**
|
||||
* 参数配置
|
||||
*/
|
||||
public interface UserConstantInterface {
|
||||
|
||||
|
||||
/**
|
||||
* 请求的网址
|
||||
*/
|
||||
String WX_LOGIN_URL = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
|
||||
/**
|
||||
* 固定参数
|
||||
*/
|
||||
String WX_LOGIN_GRANT_TYPE = "authorization_code";
|
||||
|
||||
/**
|
||||
* 解密手机号
|
||||
* @param decryptData 加密手机号(微信返回)
|
||||
* @param key session_key
|
||||
* @param iv iv(微信返回)
|
||||
* @return
|
||||
*/
|
||||
static Result decryptS5(String decryptData, String key, String iv) {
|
||||
try {
|
||||
byte[] encData = Base64.decode(decryptData);
|
||||
byte[] ivs = Base64.decode(iv);
|
||||
byte[] keys = Base64.decode(key);
|
||||
AlgorithmParameterSpec ivSpec = new IvParameterSpec(ivs);
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
SecretKeySpec keySpec = new SecretKeySpec(keys, "AES");
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||
return Result.success("获取手机号成功").put("data", JSON.parseObject(new String(cipher.doFinal(encData), "UTF-8")));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(-1,"获取手机号失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
14
src/main/java/com/sqx/modules/app/utils/WxPhone.java
Normal file
14
src/main/java/com/sqx/modules/app/utils/WxPhone.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.sqx.modules.app.utils;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WxPhone {
|
||||
|
||||
private String decryptData;
|
||||
|
||||
private String key;
|
||||
|
||||
private String iv;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.sqx.modules.banner.controller;
|
||||
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.banner.entity.Activity;
|
||||
import com.sqx.modules.banner.service.ActivityService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/9
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "菜单和活动管理", tags = {"菜单和活动管理"})
|
||||
@RequestMapping(value = "/activity")
|
||||
public class ActivityController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ActivityService activityService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台详情")
|
||||
@ResponseBody
|
||||
public Result getBanner(@PathVariable Long id) {
|
||||
return Result.success().put("data",activityService.selectActivityById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/state/{state}", method = RequestMethod.GET)
|
||||
@ApiOperation("根据状态查询菜单列表")
|
||||
@ResponseBody
|
||||
public Result getBannerState(@PathVariable String state) {
|
||||
return Result.success().put("data",activityService.selectByState(state));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateActivity", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台修改")
|
||||
@ResponseBody
|
||||
public Result addBanner(@RequestBody Activity activity) {
|
||||
activityService.updateActivity(activity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateActivityStatus", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台修改状态")
|
||||
@ResponseBody
|
||||
public Result updateActivity(Long id) {
|
||||
Activity activity = activityService.selectActivityById(id);
|
||||
if("1".equals(activity.getState())){
|
||||
activity.setState("2");
|
||||
activityService.updateActivity(activity);
|
||||
}else{
|
||||
activity.setState("1");
|
||||
activityService.updateActivity(activity);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/insertActivity")
|
||||
@ApiOperation("添加")
|
||||
@ResponseBody
|
||||
public Result insertActivity(@RequestBody Activity activity){
|
||||
activityService.insertActivity(activity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台删除")
|
||||
public Result deleteBanner(@PathVariable Long id) {
|
||||
activityService.deleteActivity(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||
@ApiOperation("用户端获取广告位")
|
||||
@ResponseBody
|
||||
public Result getBannerList() {
|
||||
return Result.success().put("data",activityService.selectActivity());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/selectActivity", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台获取全部广告位")
|
||||
@ResponseBody
|
||||
public Result selectActivity() {
|
||||
return Result.success().put("data",activityService.selectActivitys());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.sqx.modules.banner.controller;
|
||||
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.banner.entity.Banner;
|
||||
import com.sqx.modules.banner.service.BannerService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/9
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "banner图", tags = {"banner图"})
|
||||
@RequestMapping(value = "/banner")
|
||||
public class BannerController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BannerService bannerService;
|
||||
|
||||
|
||||
@RequestMapping(value = "/selectBannerList", method = RequestMethod.GET)
|
||||
@ApiOperation("查询所有banner图")
|
||||
@ResponseBody
|
||||
public Result selectBannerList(Integer classify){
|
||||
return Result.success().put("data",bannerService.selectBannerLists(classify));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/selectBannerPage", method = RequestMethod.GET)
|
||||
@ApiOperation("查询所有banner图")
|
||||
@ResponseBody
|
||||
public Result selectBannerPage(Integer page,Integer limit,Integer classify){
|
||||
return Result.success().put("data",bannerService.selectBannerPage(page,limit,classify));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/selectBannerById", method = RequestMethod.GET)
|
||||
@ApiOperation("根据id查看详细信息")
|
||||
@ResponseBody
|
||||
public Result selectBannerById(Long id){
|
||||
return Result.success().put("data",bannerService.selectBannerById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateBannerStateById", method = RequestMethod.GET)
|
||||
@ApiOperation("隐藏banner图")
|
||||
@ResponseBody
|
||||
public Result updateBannerStateById(Long id){
|
||||
|
||||
return bannerService.updateBannerStateById(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateBannerById", method = RequestMethod.POST)
|
||||
@ApiOperation("修改banner图")
|
||||
@ResponseBody
|
||||
public Result updateBannerById(@RequestBody Banner banner){
|
||||
bannerService.updateBannerById(banner);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/deleteBannerById", method = RequestMethod.GET)
|
||||
@ApiOperation("删除banner图")
|
||||
@ResponseBody
|
||||
public Result deleteBannerById(String ids){
|
||||
bannerService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/insertBanner", method = RequestMethod.POST)
|
||||
@ApiOperation("添加banner图")
|
||||
@ResponseBody
|
||||
public Result insertBanner(@RequestBody Banner banner){
|
||||
bannerService.insertBanner(banner);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.sqx.modules.banner.controller.app;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.banner.entity.Banner;
|
||||
import com.sqx.modules.banner.service.BannerService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/9
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "app banner图", tags = {"app banner图"})
|
||||
@RequestMapping(value = "/app/banner")
|
||||
public class AppBannerController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BannerService bannerService;
|
||||
|
||||
@RequestMapping(value = "/selectBannerList", method = RequestMethod.GET)
|
||||
@ApiOperation("查询所有banner图")
|
||||
@ResponseBody
|
||||
public Result selectBannerList(Integer classify) {
|
||||
return Result.success().put("data", bannerService.selectBannerList(classify));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/selectBannerPage", method = RequestMethod.GET)
|
||||
@ApiOperation("查询所有banner图")
|
||||
@ResponseBody
|
||||
public Result selectBannerPage(Integer page,Integer limit,Integer classify) {
|
||||
return Result.success().put("data", new PageUtils(bannerService.page(new Page<>(page,limit),new QueryWrapper<Banner>().eq("classify",classify))));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/clickBanner", method = RequestMethod.GET)
|
||||
@ApiOperation("点击金刚图")
|
||||
@ResponseBody
|
||||
public Result clickBanner(Integer bannerId,int page,int limit) {
|
||||
return bannerService.clickBanner(bannerId,page,limit);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
19
src/main/java/com/sqx/modules/banner/dao/ActivityDao.java
Normal file
19
src/main/java/com/sqx/modules/banner/dao/ActivityDao.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.sqx.modules.banner.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.banner.entity.Activity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/9
|
||||
*/
|
||||
@Mapper
|
||||
public interface ActivityDao extends BaseMapper<Activity> {
|
||||
|
||||
|
||||
List<Activity> selectByState(String state);
|
||||
|
||||
}
|
||||
26
src/main/java/com/sqx/modules/banner/dao/BannerDao.java
Normal file
26
src/main/java/com/sqx/modules/banner/dao/BannerDao.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.sqx.modules.banner.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.banner.entity.Banner;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/9
|
||||
*/
|
||||
@Mapper
|
||||
public interface BannerDao extends BaseMapper<Banner> {
|
||||
|
||||
|
||||
List<Banner> selectLists(@Param("classify") Integer classify);
|
||||
|
||||
List<Banner> selectList(@Param("classify") Integer classify);
|
||||
|
||||
IPage<Banner> selectBannerPage(Page<Banner> page,@Param("classify") Integer classify);
|
||||
|
||||
}
|
||||
29
src/main/java/com/sqx/modules/banner/entity/Activity.java
Normal file
29
src/main/java/com/sqx/modules/banner/entity/Activity.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.sqx.modules.banner.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 活动推广
|
||||
*/
|
||||
@Data
|
||||
@TableName("activity")
|
||||
public class Activity implements Serializable {
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
private String createAt;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
private String url;
|
||||
|
||||
private String title;
|
||||
|
||||
private String state;
|
||||
|
||||
}
|
||||
77
src/main/java/com/sqx/modules/banner/entity/Banner.java
Normal file
77
src/main/java/com/sqx/modules/banner/entity/Banner.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.sqx.modules.banner.entity;
|
||||
|
||||
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.sqx.modules.course.entity.Course;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/9
|
||||
*/
|
||||
@Data
|
||||
@TableName("banner")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Banner implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* banner图id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 状态 1正常 2隐藏
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 分类 1 banner图 2 首页分类
|
||||
*/
|
||||
private Integer classify;
|
||||
|
||||
/**
|
||||
* 跳转地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String describes;
|
||||
/**
|
||||
* 短剧信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<Course> course;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sqx.modules.banner.service;
|
||||
|
||||
|
||||
import com.sqx.modules.banner.entity.Activity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityService {
|
||||
|
||||
|
||||
List<Activity> selectByState(String state);
|
||||
|
||||
Activity selectActivityById(Long id);
|
||||
|
||||
int insertActivity(Activity info);
|
||||
|
||||
int updateActivity(Activity info);
|
||||
|
||||
int deleteActivity(Long id);
|
||||
|
||||
List<Activity> selectActivity();
|
||||
|
||||
List<Activity> selectActivitys();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.sqx.modules.banner.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.banner.entity.Banner;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BannerService extends IService<Banner> {
|
||||
|
||||
List<Banner> selectBannerList(Integer classify);
|
||||
|
||||
List<Banner> selectBannerLists(Integer classify);
|
||||
|
||||
PageUtils selectBannerPage(Integer page, Integer limit, Integer classify);
|
||||
|
||||
int saveBody(String image, String url, Integer sort);
|
||||
|
||||
Banner selectBannerById(Long id);
|
||||
|
||||
int deleteBannerById(Long id);
|
||||
|
||||
Result updateBannerStateById(Long id);
|
||||
|
||||
int updateBannerById(Banner banner);
|
||||
|
||||
int insertBanner(Banner banner);
|
||||
|
||||
Result clickBanner(Integer bannerId,int page,int limit);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.sqx.modules.banner.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.banner.dao.ActivityDao;
|
||||
import com.sqx.modules.banner.entity.Activity;
|
||||
import com.sqx.modules.banner.service.ActivityService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动推广
|
||||
*/
|
||||
@Service
|
||||
public class ActivityServiceImpl extends ServiceImpl<ActivityDao, Activity> implements ActivityService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ActivityDao activityDao;
|
||||
|
||||
@Override
|
||||
public List<Activity> selectByState(String state) {
|
||||
return activityDao.selectByState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Activity selectActivityById(Long id) {
|
||||
return activityDao.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertActivity(Activity activity) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date now = new Date();
|
||||
activity.setCreateAt(sdf.format(now));
|
||||
return activityDao.insert(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateActivity(Activity activity) {
|
||||
return activityDao.updateById(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteActivity(Long id) {
|
||||
return activityDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Activity> selectActivity() {
|
||||
return activityDao.selectList(new QueryWrapper<Activity>().eq("state", 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Activity> selectActivitys() {
|
||||
return activityDao.selectList(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.sqx.modules.banner.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.banner.dao.BannerDao;
|
||||
import com.sqx.modules.banner.entity.Banner;
|
||||
import com.sqx.modules.banner.service.BannerService;
|
||||
import com.sqx.modules.course.dao.CourseDao;
|
||||
import com.sqx.modules.course.dao.CourseDetailsDao;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* banner图
|
||||
*/
|
||||
@Service
|
||||
public class BannerServiceImpl extends ServiceImpl<BannerDao, Banner> implements BannerService {
|
||||
|
||||
@Autowired
|
||||
private CourseDao courseDao;
|
||||
@Autowired
|
||||
private BannerDao bannerDao;
|
||||
@Autowired
|
||||
private CourseDetailsDao courseDetailsDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Banner> selectBannerList(Integer classify) {
|
||||
return bannerDao.selectList(classify);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Banner> selectBannerLists(Integer classify) {
|
||||
return bannerDao.selectLists(classify);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils selectBannerPage(Integer page,Integer limit,Integer classify) {
|
||||
Page<Banner> pages=new Page<>(page,limit);
|
||||
return new PageUtils(bannerDao.selectBannerPage(pages,classify));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveBody(String image, String url, Integer sort) {
|
||||
Banner banner = new Banner();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date now = new Date();
|
||||
banner.setImageUrl(image);
|
||||
banner.setCreateTime(sdf.format(now));
|
||||
banner.setState(1);
|
||||
banner.setUrl(url);
|
||||
banner.setSort(sort == null ? 1 : sort);
|
||||
return bannerDao.insert(banner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertBanner(Banner banner) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date now = new Date();
|
||||
banner.setCreateTime(sdf.format(now));
|
||||
banner.setState(2);
|
||||
return bannerDao.insert(banner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result clickBanner(Integer bannerId, int page, int limit) {
|
||||
Page<Course> page1 = new Page<>(page, limit);
|
||||
QueryWrapper<Course> queryWrapper = new QueryWrapper();
|
||||
//查询banner 对应短剧
|
||||
queryWrapper.eq("banner_id", bannerId);
|
||||
IPage<Course> coursePage = courseDao.selectPage(page1, queryWrapper);
|
||||
return Result.success().put("data", coursePage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Banner selectBannerById(Long id) {
|
||||
return bannerDao.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBannerById(Long id) {
|
||||
return bannerDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateBannerStateById(Long id) {
|
||||
Banner banner = selectBannerById(id);
|
||||
if (banner != null) {
|
||||
if (banner.getState() == 1) {
|
||||
banner.setState(2);
|
||||
} else {
|
||||
banner.setState(1);
|
||||
}
|
||||
bannerDao.updateById(banner);
|
||||
return Result.success();
|
||||
} else {
|
||||
return Result.error("修改对象为空!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBannerById(Banner banner) {
|
||||
return bannerDao.updateById(banner);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.sqx.modules.common.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "通用配置管理", tags = {"通用配置管理"})
|
||||
@RequestMapping(value = "/common")
|
||||
public class CommonController {
|
||||
@Autowired
|
||||
private CommonInfoService commonService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台通用配置详情")
|
||||
@ResponseBody
|
||||
public Result getCommon(@PathVariable Integer id) {
|
||||
return Result.success().put("data",commonService.findOne(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台添加通用配置")
|
||||
@ResponseBody
|
||||
public Result addCommon(@RequestBody CommonInfo app) {
|
||||
|
||||
return commonService.update(app);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台删除通用配置")
|
||||
public Result deleteCommon(@PathVariable int id) {
|
||||
return commonService.delete(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/type/{type}", method = RequestMethod.GET)
|
||||
@ApiOperation("用户端根据type获取对象 1客服二维码\n" +
|
||||
" 2公众号二维码\n" +
|
||||
" 3佣金开启\n" +
|
||||
" 4注册邀请码\n" +
|
||||
" 5微信APPID\n" +
|
||||
" 21微信秘钥\n" +
|
||||
" 6淘宝APPID\n" +
|
||||
" 7淘宝秘钥\n" +
|
||||
" 8淘宝授权地址\n" +
|
||||
" 9淘宝PID\n" +
|
||||
" 10好单库key\n" +
|
||||
" 11淘宝名\n" +
|
||||
" 12后台服务名称\n" +
|
||||
" 13京东APPID\n" +
|
||||
" 14京东秘钥\n" +
|
||||
" 15私域邀请码(唯一不变)\n" +
|
||||
" 16公众号Token\n" +
|
||||
" 17公众号EncodingAESKey\n" +
|
||||
" 18提现通知管理员openid\n" +
|
||||
" 19后台服务域名配置\n" +
|
||||
" 20后台管理平台域名配置\n" +
|
||||
" 22拼多多优惠券地址")
|
||||
@ResponseBody
|
||||
public Result getCommonList(@PathVariable Integer type) {
|
||||
return commonService.findByType(type);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/type/condition/{condition}", method = RequestMethod.GET)
|
||||
@ApiOperation("根据condition去查询 xitong xitongs shouye")
|
||||
@ResponseBody
|
||||
public Result findByTypeAndCondition(@PathVariable String condition) {
|
||||
return commonService.findByTypeAndCondition(condition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sqx.modules.common.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "通用配置管理", tags = {"通用配置管理"})
|
||||
@RequestMapping(value = "/app/common")
|
||||
public class AppCommonController {
|
||||
@Autowired
|
||||
private CommonInfoService commonService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台通用配置详情")
|
||||
@ResponseBody
|
||||
public Result getCommon(@PathVariable Integer id) {
|
||||
return Result.success().put("data",commonService.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/type/{type}", method = RequestMethod.GET)
|
||||
@ApiOperation("用户端根据type获取对象 1客服二维码\n" +
|
||||
" 2公众号二维码\n" +
|
||||
" 3佣金开启\n" +
|
||||
" 4注册邀请码\n" +
|
||||
" 5微信APPID\n" +
|
||||
" 21微信秘钥\n" +
|
||||
" 6淘宝APPID\n" +
|
||||
" 7淘宝秘钥\n" +
|
||||
" 8淘宝授权地址\n" +
|
||||
" 9淘宝PID\n" +
|
||||
" 10好单库key\n" +
|
||||
" 11淘宝名\n" +
|
||||
" 12后台服务名称\n" +
|
||||
" 13京东APPID\n" +
|
||||
" 14京东秘钥\n" +
|
||||
" 15私域邀请码(唯一不变)\n" +
|
||||
" 16公众号Token\n" +
|
||||
" 17公众号EncodingAESKey\n" +
|
||||
" 18提现通知管理员openid\n" +
|
||||
" 19后台服务域名配置\n" +
|
||||
" 20后台管理平台域名配置\n" +
|
||||
" 22拼多多优惠券地址")
|
||||
@ResponseBody
|
||||
public Result getCommonList(@PathVariable Integer type) {
|
||||
return commonService.findByType(type);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/type/condition/{condition}", method = RequestMethod.GET)
|
||||
@ApiOperation("根据condition去查询 xitong xitongs shouye")
|
||||
@ResponseBody
|
||||
public Result findByTypeAndCondition(@PathVariable String condition) {
|
||||
return commonService.findByTypeAndCondition(condition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
24
src/main/java/com/sqx/modules/common/dao/CommonInfoDao.java
Normal file
24
src/main/java/com/sqx/modules/common/dao/CommonInfoDao.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.sqx.modules.common.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
@Mapper
|
||||
public interface CommonInfoDao extends BaseMapper<CommonInfo> {
|
||||
|
||||
List<CommonInfo> findByCondition(@Param("condition") String condition);
|
||||
|
||||
CommonInfo findOne(@Param("type") int type);
|
||||
|
||||
|
||||
|
||||
}
|
||||
33
src/main/java/com/sqx/modules/common/entity/CommonInfo.java
Normal file
33
src/main/java/com/sqx/modules/common/entity/CommonInfo.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.sqx.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 通用配置管理
|
||||
*/
|
||||
@Data
|
||||
@TableName("common_info")
|
||||
public class CommonInfo implements Serializable {
|
||||
|
||||
@TableId(type = IdType.INPUT)
|
||||
private long id;
|
||||
|
||||
private String createAt;
|
||||
|
||||
private Integer type; //1表示客服二维码 2表示公众号二维码 3表示全局佣金是否开启 4注册客服渠道id配置 5、佣金规则 6、
|
||||
|
||||
private String value;
|
||||
|
||||
private String max;
|
||||
|
||||
private String min;
|
||||
|
||||
private String conditionFrom;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.sqx.modules.common.service;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
public interface CommonInfoService {
|
||||
|
||||
/**
|
||||
* 保存对象
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
Result update(CommonInfo commonInfo);
|
||||
|
||||
/**
|
||||
* 获取一个对象
|
||||
*/
|
||||
CommonInfo findOne(int id);
|
||||
|
||||
/**
|
||||
* 删除一个
|
||||
*/
|
||||
Result delete(long id);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Result updateBody(CommonInfo commonInfo);
|
||||
/**
|
||||
* 通过类型查询
|
||||
*/
|
||||
Result findByType(Integer type);
|
||||
|
||||
/**
|
||||
* 通过类型查询
|
||||
*/
|
||||
Result findByTypeAndCondition(String condition);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.sqx.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
@Service
|
||||
public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo> implements CommonInfoService {
|
||||
|
||||
@Autowired
|
||||
private CommonInfoDao commonInfoDao;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result update(CommonInfo commonInfo) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date now = new Date();
|
||||
commonInfo.setCreateAt(sdf.format(now));
|
||||
if(commonInfo.getType()==820){
|
||||
Result result = courseService.setDyNotifyUrl(commonInfo.getValue());
|
||||
String code = String.valueOf(result.get("code"));
|
||||
if(!"0".equals(code)){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CommonInfo findOne(int id) {
|
||||
return commonInfoDao.findOne(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result delete(long id) {
|
||||
commonInfoDao.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result updateBody(CommonInfo commonInfo) {
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findByType(Integer type) {
|
||||
return Result.success().put("data",commonInfoDao.findOne(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findByTypeAndCondition(String condition) {
|
||||
return Result.success().put("data",commonInfoDao.findByCondition(condition));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.sqx.modules.coupon.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.coupon.entity.Coupon;
|
||||
import com.sqx.modules.coupon.service.CouponService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "邀请码", tags = {"邀请码"})
|
||||
@RequestMapping(value = "/coupon")
|
||||
public class CouponController extends AbstractController {
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
|
||||
@PostMapping("/insertCoupon")
|
||||
@ApiOperation("新增优惠券")
|
||||
public Result insertInviter(@RequestBody Coupon coupon){
|
||||
return couponService.insertCoupon(coupon);
|
||||
}
|
||||
@PostMapping("/updateCoupon")
|
||||
@ApiOperation("修改优惠券")
|
||||
public Result updateCoupon(@RequestBody Coupon coupon){
|
||||
return couponService.updateCoupon(coupon);
|
||||
}
|
||||
@GetMapping("/deleteCoupon")
|
||||
@ApiOperation("删除优惠券")
|
||||
public Result deleteCoupon(Long id){
|
||||
return couponService.deleteCoupon(id);
|
||||
}
|
||||
@GetMapping("/selectCoupon")
|
||||
@ApiOperation("优惠券列表")
|
||||
public Result selectCoupon(Integer page, Integer limit, String couponName){
|
||||
return couponService.selectCoupon(page,limit,couponName);
|
||||
}
|
||||
@GetMapping("/selectOne")
|
||||
@ApiOperation("优惠券列表")
|
||||
public Result selectOne(Long id){
|
||||
return couponService.selectOne(id);
|
||||
}
|
||||
}
|
||||
9
src/main/java/com/sqx/modules/coupon/dao/CouponDao.java
Normal file
9
src/main/java/com/sqx/modules/coupon/dao/CouponDao.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.sqx.modules.coupon.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.coupon.entity.Coupon;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CouponDao extends BaseMapper<Coupon> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sqx.modules.coupon.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.coupon.entity.CouponUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CouponUserDao extends BaseMapper<CouponUser> {
|
||||
}
|
||||
35
src/main/java/com/sqx/modules/coupon/entity/Coupon.java
Normal file
35
src/main/java/com/sqx/modules/coupon/entity/Coupon.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.sqx.modules.coupon.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@TableName("coupon")
|
||||
public class Coupon implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 优惠券d
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long couponId;
|
||||
/**
|
||||
* 优惠券名称
|
||||
*/
|
||||
private String couponName;
|
||||
/**
|
||||
* 可抵扣金豆
|
||||
*/
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 所属类型1邀请好友-
|
||||
*/
|
||||
private Integer couponType;
|
||||
|
||||
public Coupon() {}
|
||||
}
|
||||
33
src/main/java/com/sqx/modules/coupon/entity/CouponUser.java
Normal file
33
src/main/java/com/sqx/modules/coupon/entity/CouponUser.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.sqx.modules.coupon.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@TableName("coupon_user")
|
||||
public class CouponUser implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 用户优惠券id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long couponUserId;
|
||||
/**
|
||||
*用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 优惠券金豆
|
||||
*/
|
||||
private BigDecimal couponMoney;
|
||||
/**
|
||||
* 优惠券使用规则
|
||||
*/
|
||||
private String couponName;
|
||||
public CouponUser() {}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sqx.modules.coupon.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.coupon.entity.Coupon;
|
||||
|
||||
public interface CouponService extends IService<Coupon> {
|
||||
Result insertCoupon(Coupon coupon);
|
||||
Result updateCoupon(Coupon coupon);
|
||||
Result deleteCoupon(Long id);
|
||||
Result selectCoupon(Integer page, Integer limit,String couponName);
|
||||
Result selectOne(Long id);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.sqx.modules.coupon.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.coupon.dao.CouponDao;
|
||||
import com.sqx.modules.coupon.entity.Coupon;
|
||||
import com.sqx.modules.coupon.service.CouponService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements CouponService {
|
||||
|
||||
@Override
|
||||
public Result insertCoupon(Coupon coupon) {
|
||||
baseMapper.insert(coupon);
|
||||
return Result.success("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateCoupon(Coupon coupon) {
|
||||
baseMapper.updateById(coupon);
|
||||
return Result.success("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteCoupon(Long id) {
|
||||
baseMapper.deleteById(id);
|
||||
return Result.success("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectCoupon(Integer page, Integer limit, String couponName) {
|
||||
IPage<Coupon> pages = new Page<>(page, limit);
|
||||
QueryWrapper<Coupon> queryWrapper1 = new QueryWrapper<>();
|
||||
if(couponName!=null){
|
||||
queryWrapper1.eq("coupon_name",couponName);
|
||||
}
|
||||
pages=baseMapper.selectPage(pages,queryWrapper1);
|
||||
return Result.success().put("data",pages.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectOne(Long id) {
|
||||
return Result.success().put("data",baseMapper.selectById(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,521 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.common.auth.CredentialsProviderFactory;
|
||||
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||
import com.aliyun.oss.model.ListObjectsRequest;
|
||||
import com.aliyun.oss.model.OSSObjectSummary;
|
||||
import com.aliyun.oss.model.ObjectListing;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||
import com.qcloud.cos.auth.COSCredentials;
|
||||
import com.qcloud.cos.exception.CosClientException;
|
||||
import com.qcloud.cos.exception.CosServiceException;
|
||||
import com.qcloud.cos.http.HttpProtocol;
|
||||
import com.qcloud.cos.model.COSObjectSummary;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.volcengine.tos.TOSV2;
|
||||
import com.volcengine.tos.TOSV2ClientBuilder;
|
||||
import com.volcengine.tos.model.object.ListObjectsType2Input;
|
||||
import com.volcengine.tos.model.object.ListObjectsType2Output;
|
||||
import com.volcengine.tos.model.object.ListedCommonPrefix;
|
||||
import com.volcengine.tos.model.object.ListedObjectV2;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@RestController
|
||||
@Api(value = "读取短剧", tags = {"读取短剧"})
|
||||
@Slf4j
|
||||
@RequestMapping(value = "/aliossCourse")
|
||||
public class AliossCourseController {
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
@Autowired
|
||||
private CommonInfoService commonInfoService;
|
||||
static boolean flag=false;
|
||||
Pattern pattern = Pattern.compile("\\d+"); // 正则表达式匹配一个或多个数字
|
||||
/**
|
||||
* 创建线程池
|
||||
*/
|
||||
private ExecutorService newCachedThreadPool = new ThreadPoolExecutor(30, 100, 0L,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(1024),
|
||||
Executors.defaultThreadFactory(),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
|
||||
@GetMapping("/sysnAliOssCourse")
|
||||
@ApiOperation("同步短剧")
|
||||
public Result sysnAliOssCourse(Integer type,String filePath, Integer freeNum, BigDecimal coursePrice,Integer maxGood,Integer minGood){
|
||||
if(flag){
|
||||
return Result.error("短剧正在同步中!");
|
||||
}
|
||||
Map<String, Object> alioss = null;
|
||||
//读取oss或cos短剧信息
|
||||
if(type==1){
|
||||
alioss = alioss(filePath);
|
||||
}else if(type==2){
|
||||
alioss = txCos(filePath);
|
||||
}else{
|
||||
alioss = dyOss(filePath);
|
||||
}
|
||||
|
||||
if(alioss==null){
|
||||
return Result.error("读取oss短剧失败,请检查配置!");
|
||||
}
|
||||
Map<String, List<String>> videoFile=(Map<String, List<String>>)alioss.get("videoFile");
|
||||
if(videoFile==null || videoFile.size()==0){
|
||||
return Result.error("读取oss短剧失败,请检查配置!");
|
||||
}
|
||||
Map<String, String> imageFile=(Map<String, String>)alioss.get("imageFile");
|
||||
|
||||
flag=true;
|
||||
newCachedThreadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String url =null;
|
||||
Random rand = new Random();
|
||||
if(type==1){
|
||||
url = commonInfoService.findOne(73).getValue();
|
||||
if(StringUtils.isEmpty(url)){
|
||||
url = commonInfoService.findOne(72).getValue();
|
||||
}
|
||||
}else if(type==2){
|
||||
url = commonInfoService.findOne(883).getValue();
|
||||
if(StringUtils.isEmpty(url)){
|
||||
url = commonInfoService.findOne(804).getValue();
|
||||
}
|
||||
}else{
|
||||
url = commonInfoService.findOne(891).getValue();
|
||||
}
|
||||
|
||||
for (String key : videoFile.keySet()) {
|
||||
// System.err.println("短剧名称: " + key);
|
||||
String image = url+"/"+imageFile.get(key);
|
||||
String value = commonInfoService.findOne(887).getValue();
|
||||
String[] split = value.split(",");
|
||||
int min = 0; // 指定范围的最小值(包含)
|
||||
int max = split.length-1; // 指定范围的最大值(包含)
|
||||
int randomNum1 = min + rand.nextInt(max - min + 1);
|
||||
int randomNum2 = min + rand.nextInt(max - min + 1);
|
||||
int randomNum3 = min + rand.nextInt(max - min + 1);
|
||||
String courseLabel=split[randomNum1]+","+split[randomNum2]+","+split[randomNum3];
|
||||
Course course = courseService.getOne(new QueryWrapper<Course>().eq("title", key).eq("is_delete",0));
|
||||
if(course==null){
|
||||
course=new Course();
|
||||
course.setTitle(key);
|
||||
course.setTitleImg(image);
|
||||
course.setPrice(coursePrice);
|
||||
course.setCourseLabel(courseLabel);
|
||||
course.setPayNum(0);
|
||||
course.setImg(image);
|
||||
course.setDetails(key);
|
||||
course.setIsDelete(0);
|
||||
course.setCreateTime(DateUtils.format(new Date()));
|
||||
course.setUpdateTime(course.getCreateTime());
|
||||
course.setIsRecommend(0);
|
||||
course.setStatus(1);
|
||||
course.setIsPrice(1);
|
||||
course.setViewCounts(0);
|
||||
course.setIsOver(1);
|
||||
courseService.save(course);
|
||||
}else{
|
||||
course.setTitleImg(image);
|
||||
course.setImg(image);
|
||||
courseService.updateById(course);
|
||||
}
|
||||
List<String> valueList = videoFile.get(key);
|
||||
valueList.sort(Comparator.comparingInt(this::extractNumberFromFileName));
|
||||
int i=1;
|
||||
int priceNum=valueList.size()-freeNum;
|
||||
BigDecimal courseDetailsPrice = BigDecimal.ZERO;
|
||||
if(priceNum>0){
|
||||
courseDetailsPrice = coursePrice.divide(BigDecimal.valueOf(priceNum), 2, BigDecimal.ROUND_UP);
|
||||
}
|
||||
for(String str:valueList){
|
||||
String[] splits = str.split("/");
|
||||
String fileName=splits[splits.length-1];
|
||||
String substring = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
Matcher matcher = pattern.matcher(substring);
|
||||
Integer num=0;
|
||||
if(matcher.find()){
|
||||
num = Integer.parseInt(matcher.group());
|
||||
}
|
||||
String courseDetailsName=key+"-第"+num+"集";
|
||||
|
||||
CourseDetails courseDetails = courseDetailsService.getOne(new QueryWrapper<CourseDetails>()
|
||||
.eq("course_id",course.getCourseId()).eq("course_details_name", courseDetailsName));
|
||||
if(courseDetails==null){
|
||||
int goodNum = minGood + rand.nextInt(maxGood - minGood + 1);
|
||||
courseDetails=new CourseDetails();
|
||||
courseDetails.setCourseId(course.getCourseId());
|
||||
courseDetails.setCourseDetailsName(courseDetailsName);
|
||||
courseDetails.setVideoUrl(url+"/"+str);
|
||||
courseDetails.setCreateTime(DateUtils.format(new Date()));
|
||||
courseDetails.setTitleImg(image);
|
||||
courseDetails.setContent(courseDetailsName);
|
||||
courseDetails.setGoodNum(goodNum);
|
||||
if(i<=freeNum){
|
||||
courseDetails.setPrice(BigDecimal.ZERO);
|
||||
courseDetails.setIsPrice(2);
|
||||
}else{
|
||||
courseDetails.setPrice(courseDetailsPrice);
|
||||
courseDetails.setIsPrice(1);
|
||||
}
|
||||
courseDetails.setSort(num);
|
||||
courseDetailsService.insert(courseDetails);
|
||||
}else{
|
||||
int goodNum = minGood + rand.nextInt(maxGood - minGood + 1);
|
||||
courseDetails.setCourseId(course.getCourseId());
|
||||
courseDetails.setCourseDetailsName(courseDetailsName);
|
||||
courseDetails.setVideoUrl(url+"/"+str);
|
||||
courseDetails.setCreateTime(DateUtils.format(new Date()));
|
||||
courseDetails.setTitleImg(image);
|
||||
courseDetails.setContent(courseDetailsName);
|
||||
courseDetails.setGoodNum(goodNum);
|
||||
if(i<=freeNum){
|
||||
courseDetails.setPrice(BigDecimal.ZERO);
|
||||
courseDetails.setIsPrice(2);
|
||||
}else{
|
||||
courseDetails.setPrice(courseDetailsPrice);
|
||||
courseDetails.setIsPrice(1);
|
||||
}
|
||||
courseDetails.setSort(num);
|
||||
courseDetailsService.updateById(courseDetails);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("同步短剧出错:"+e.getMessage(),e);
|
||||
}finally {
|
||||
flag=false;
|
||||
}
|
||||
}
|
||||
|
||||
public int extractNumberFromFileName(String fileUrl) {
|
||||
String[] split = fileUrl.split("/");
|
||||
String fileName=split[split.length-1];
|
||||
String substring = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
Matcher matcher = pattern.matcher(substring);
|
||||
Integer num=0;
|
||||
if(matcher.find()){
|
||||
num = Integer.parseInt(matcher.group());
|
||||
}
|
||||
return num;
|
||||
}
|
||||
});
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String,Object> alioss(String keyPrefix) {
|
||||
// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。
|
||||
String endpoint = commonInfoService.findOne(68).getValue();
|
||||
// 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
|
||||
DefaultCredentialProvider defaultCredentialProvider = CredentialsProviderFactory.newDefaultCredentialProvider(commonInfoService.findOne(69).getValue(), commonInfoService.findOne(70).getValue());
|
||||
// 填写Bucket名称,例如examplebucket。
|
||||
String bucketName = commonInfoService.findOne(71).getValue();
|
||||
// 指定前缀,例如exampledir/object。
|
||||
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, defaultCredentialProvider);
|
||||
// 设置每页列举200个文件。
|
||||
int maxKeys = 200;
|
||||
List<String> filePaths=new ArrayList<>();
|
||||
try {
|
||||
String nextMarker = null;
|
||||
ObjectListing objectListing;
|
||||
do {
|
||||
objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName).withMarker(nextMarker).withMaxKeys(maxKeys).withPrefix(keyPrefix));
|
||||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
|
||||
for (OSSObjectSummary s : sums) {
|
||||
filePaths.add(s.getKey());
|
||||
}
|
||||
nextMarker = objectListing.getNextMarker();
|
||||
|
||||
} while (objectListing.isTruncated());
|
||||
|
||||
Map<String, List<String>> videoFile = new HashMap<>();
|
||||
Map<String, String> imageFile = new HashMap<>();
|
||||
for (String filePath : filePaths) {
|
||||
if(filePath.contains(".")){
|
||||
String[] split = filePath.split("/");
|
||||
String directory = split[split.length-2];
|
||||
String extension = filePath.substring(filePath.lastIndexOf('.') + 1);
|
||||
switch (extension) {
|
||||
case "mp4":
|
||||
case "avi":
|
||||
case "wmv":
|
||||
case "flv":
|
||||
case "m3u8":
|
||||
case "mov":
|
||||
List<String> videoList = videoFile.get(directory);
|
||||
if(videoList==null){
|
||||
videoList=new ArrayList<>();
|
||||
}
|
||||
videoList.add(filePath);
|
||||
videoFile.put(directory,videoList);
|
||||
break;
|
||||
default:
|
||||
String image = imageFile.get(directory);
|
||||
if(StringUtils.isEmpty(image)){
|
||||
imageFile.put(directory,filePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("阿里云读取oss报错:"+e.getMessage(),e);
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> txCos(String keyPrefix) {
|
||||
COSClient cosClient = createCOSClient();
|
||||
// 存储桶的命名格式为 BucketName-APPID,此处填写的存储桶名称必须为此格式
|
||||
String bucketName = commonInfoService.findOne(803).getValue();
|
||||
|
||||
com.qcloud.cos.model.ListObjectsRequest listObjectsRequest = new com.qcloud.cos.model.ListObjectsRequest();
|
||||
// 设置 bucket 名称
|
||||
listObjectsRequest.setBucketName(bucketName);
|
||||
// 设置列出的对象名以 prefix 为前缀
|
||||
listObjectsRequest.setPrefix(keyPrefix);
|
||||
// 保存列出的结果
|
||||
com.qcloud.cos.model.ObjectListing objectListing = null;
|
||||
String nextMarker = null;
|
||||
List<String> filePaths=new ArrayList<>();
|
||||
do {
|
||||
listObjectsRequest.setMarker(nextMarker);
|
||||
listObjectsRequest.setMaxKeys(100);
|
||||
try {
|
||||
objectListing = cosClient.listObjects(listObjectsRequest);
|
||||
} catch (CosServiceException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CosClientException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
List<COSObjectSummary> cosObjectSummaries = objectListing.getObjectSummaries();
|
||||
|
||||
for (COSObjectSummary cosObjectSummary : cosObjectSummaries) {
|
||||
// 对象的 key
|
||||
String key = cosObjectSummary.getKey();
|
||||
filePaths.add(key);
|
||||
}
|
||||
nextMarker = objectListing.getNextMarker();
|
||||
} while (objectListing.isTruncated());
|
||||
|
||||
|
||||
// 确认本进程不再使用 cosClient 实例之后,关闭即可
|
||||
cosClient.shutdown();
|
||||
|
||||
Map<String, List<String>> videoFile = new HashMap<>();
|
||||
Map<String, String> imageFile = new HashMap<>();
|
||||
for (String filePath : filePaths) {
|
||||
if(filePath.contains(".")){
|
||||
String[] split = filePath.split("/");
|
||||
String directory = split[split.length-2];
|
||||
String extension = filePath.substring(filePath.lastIndexOf('.') + 1);
|
||||
switch (extension) {
|
||||
case "mp4":
|
||||
case "avi":
|
||||
case "wmv":
|
||||
case "flv":
|
||||
case "m3u8":
|
||||
case "mov":
|
||||
List<String> videoList = videoFile.get(directory);
|
||||
if(videoList==null){
|
||||
videoList=new ArrayList<>();
|
||||
}
|
||||
videoList.add(filePath);
|
||||
videoFile.put(directory,videoList);
|
||||
break;
|
||||
default:
|
||||
String image = imageFile.get(directory);
|
||||
if(StringUtils.isEmpty(image)){
|
||||
imageFile.put(directory,filePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 创建 COSClient 实例,这个实例用来后续调用请求
|
||||
public COSClient createCOSClient() {
|
||||
// 设置用户身份信息。
|
||||
// SECRETID 和 SECRETKEY 请登录访问管理控制台 https://console.cloud.tencent.com/cam/capi 进行查看和管理
|
||||
String secretId = commonInfoService.findOne(800).getValue();//用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140
|
||||
String secretKey = commonInfoService.findOne(801).getValue();//用户的 SecretKey,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140
|
||||
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
|
||||
|
||||
|
||||
// ClientConfig 中包含了后续请求 COS 的客户端设置:
|
||||
ClientConfig clientConfig = new ClientConfig();
|
||||
|
||||
|
||||
// 设置 bucket 的地域
|
||||
// COS_REGION 请参见 https://cloud.tencent.com/document/product/436/6224
|
||||
clientConfig.setRegion(new Region(commonInfoService.findOne(802).getValue()));
|
||||
|
||||
|
||||
// 设置请求协议, http 或者 https
|
||||
// 5.6.53 及更低的版本,建议设置使用 https 协议
|
||||
// 5.6.54 及更高版本,默认使用了 https
|
||||
clientConfig.setHttpProtocol(HttpProtocol.https);
|
||||
|
||||
|
||||
// 以下的设置,是可选的:
|
||||
|
||||
|
||||
// 设置 socket 读取超时,默认 30s
|
||||
clientConfig.setSocketTimeout(30*1000);
|
||||
// 设置建立连接超时,默认 30s
|
||||
clientConfig.setConnectionTimeout(30*1000);
|
||||
|
||||
|
||||
// 如果需要的话,设置 http 代理,ip 以及 port
|
||||
// clientConfig.setHttpProxyIp("httpProxyIp");
|
||||
// clientConfig.setHttpProxyPort(80);
|
||||
|
||||
|
||||
// 生成 cos 客户端。
|
||||
return new COSClient(cred, clientConfig);
|
||||
}
|
||||
|
||||
public Map<String,Object> dyOss(String keyPrefix) {
|
||||
String endpoint = "tos-cn-beijing.volces.com";
|
||||
String region = "cn-beijing";
|
||||
String accessKey = commonInfoService.findOne(888).getValue();
|
||||
String secretKey = commonInfoService.findOne(889).getValue();
|
||||
|
||||
String bucketName = commonInfoService.findOne(890).getValue();
|
||||
|
||||
String delimiter = "/";
|
||||
|
||||
TOSV2 tos = new TOSV2ClientBuilder().build(region, endpoint, accessKey, secretKey);
|
||||
try{
|
||||
String continuationToken = null;
|
||||
boolean isTruncated = true;
|
||||
Map<String, List<String>> videoFile = new HashMap<>();
|
||||
Map<String, String> imageFile = new HashMap<>();
|
||||
while (isTruncated) {
|
||||
ListObjectsType2Input input = new ListObjectsType2Input().setBucket(bucketName)
|
||||
.setDelimiter(delimiter).setContinuationToken(continuationToken).setPrefix(keyPrefix+"/");
|
||||
ListObjectsType2Output output = tos.listObjectsType2(input);
|
||||
if (output.getCommonPrefixes() != null) {
|
||||
for (int i = 0; i < output.getCommonPrefixes().size(); i++) {
|
||||
|
||||
|
||||
ListedCommonPrefix commonPrefix = output.getCommonPrefixes().get(i);
|
||||
//System.err.println("Listed commonPrefix is " + commonPrefix.getPrefix());
|
||||
Map<String, Object> stringObjectMap = listCommonPrefix(bucketName, delimiter, commonPrefix.getPrefix(), tos,videoFile,imageFile);
|
||||
videoFile = (Map<String, List<String>>)stringObjectMap.get("videoFile");
|
||||
imageFile = (Map<String, String>)stringObjectMap.get("imageFile");
|
||||
}
|
||||
}
|
||||
isTruncated = output.isTruncated();
|
||||
continuationToken = output.getNextContinuationToken();
|
||||
}
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("抖音云同步文件出错:"+e.getMessage(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Map<String,Object> listCommonPrefix(String bucketName, String delimiter, String prefix, TOSV2 tos,
|
||||
Map<String, List<String>> videoFile,Map<String, String> imageFile) {
|
||||
boolean isTruncated = true;
|
||||
String continuationToken = null;
|
||||
List<String> videoList=new ArrayList<>();
|
||||
String image=null;
|
||||
String[] split = prefix.split("/");
|
||||
System.err.println(split[split.length-1]);
|
||||
while (isTruncated) {
|
||||
ListObjectsType2Input input = new ListObjectsType2Input().setBucket(bucketName)
|
||||
.setDelimiter(delimiter).setContinuationToken(continuationToken).setPrefix(prefix);
|
||||
ListObjectsType2Output output = tos.listObjectsType2(input);
|
||||
if (output.getContents() != null) {
|
||||
for (int i = 0; i < output.getContents().size(); i++) {
|
||||
ListedObjectV2 object = output.getContents().get(i);
|
||||
if(object.getSize()>0){
|
||||
String extension = object.getKey().substring(object.getKey().lastIndexOf('.') + 1);
|
||||
switch (extension) {
|
||||
case "mp4":
|
||||
case "avi":
|
||||
case "wmv":
|
||||
case "flv":
|
||||
case "m3u8":
|
||||
case "mov":
|
||||
videoList.add(object.getKey());
|
||||
break;
|
||||
default:
|
||||
image=object.getKey();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
isTruncated = output.isTruncated();
|
||||
continuationToken = output.getNextContinuationToken();
|
||||
}
|
||||
videoFile.put(split[split.length-1],videoList);
|
||||
imageFile.put(split[split.length-1],image);
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("videoFile",videoFile);
|
||||
result.put("imageFile",imageFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseClassification;
|
||||
import com.sqx.modules.course.service.CourseClassificationService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "短剧分类信息", tags = {"短剧分类信息"})
|
||||
@RequestMapping(value = "/courseClassification")
|
||||
public class CourseClassificationController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseClassificationService courseClassificationService;
|
||||
|
||||
@GetMapping("/selectCourseClassification")
|
||||
@ApiOperation("查询短剧分类信息")
|
||||
public Result selectCourseClassification(Integer page, Integer limit, String classificationName) {
|
||||
return courseClassificationService.selectCourseClassification(page, limit, classificationName);
|
||||
}
|
||||
|
||||
@PostMapping("/insertCourseClassification")
|
||||
@ApiOperation("添加短剧分类信息")
|
||||
public Result insertCourseClassification(@RequestBody CourseClassification courseClassification) {
|
||||
return courseClassificationService.insertCourseClassification(courseClassification);
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourseClassification")
|
||||
@ApiOperation("修改短剧分类信息")
|
||||
public Result updateCourseClassification(@RequestBody CourseClassification courseClassification) {
|
||||
return courseClassificationService.updateCourseClassification(courseClassification);
|
||||
}
|
||||
|
||||
@GetMapping("/updateDelete")
|
||||
@ApiOperation("假删除")
|
||||
public Result updateDelete(Long id) {
|
||||
return courseClassificationService.updateDelete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseClassificationById")
|
||||
@ApiOperation("根据id查询短剧分类信息")
|
||||
public CourseClassification selectCourseClassificationById(Long id) {
|
||||
return courseClassificationService.selectCourseClassificationById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.service.CourseCollectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Api(value = "短剧收藏", tags = {"短剧收藏"})
|
||||
@RequestMapping(value = "/courseCollect")
|
||||
@AllArgsConstructor
|
||||
public class CourseCollectController {
|
||||
|
||||
private CourseCollectService courseCollectService;
|
||||
|
||||
@GetMapping("/selectByUserId")
|
||||
@ApiOperation("查询收藏短剧信息")
|
||||
public Result selectByUserId(Integer page, Integer limit, Long userId,Integer classify){
|
||||
return courseCollectService.selectByUserId(page,limit,userId,classify);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import com.sqx.modules.course.service.CourseCommentService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "短剧信息", tags = {"短剧评论信息"})
|
||||
@RequestMapping(value = "/courseComment")
|
||||
public class CourseCommentController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseCommentService courseCommentService;
|
||||
|
||||
@GetMapping("/selectCourseComment")
|
||||
@ApiOperation("查看评论")
|
||||
public Result selectCourseComment(Integer page, Integer limit, Long courseId) {
|
||||
return courseCommentService.selectCourseComment(page, limit, courseId,1L);
|
||||
}
|
||||
|
||||
@PostMapping("/insertCourseComment")
|
||||
@ApiOperation("添加评论")
|
||||
public Result insertCourseComment(@RequestBody CourseComment courseComment){
|
||||
return courseCommentService.insertCourseComment(courseComment);
|
||||
}
|
||||
@PostMapping("/deleteCourseComment")
|
||||
@ApiOperation("删除评论")
|
||||
public Result deleteCourseComment(Long courseCommentId) {
|
||||
return courseCommentService.deleteCourseComment(courseCommentId);
|
||||
}
|
||||
@GetMapping("/selectCourseCommentUser")
|
||||
@ApiOperation("我的评论")
|
||||
public Result selectCourseCommentUser(Integer page, Integer limit,Long userId) {
|
||||
return courseCommentService.selectCourseCommentUser(page,limit,userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.course.service.CourseUserService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import com.sqx.modules.utils.SenInfoCheckUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "短剧信息", tags = {"短剧信息"})
|
||||
@RequestMapping(value = "/course")
|
||||
public class CourseController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseUserService courseUserService;
|
||||
|
||||
|
||||
@GetMapping("/selectCourse")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectCourse(@ApiParam("页") Integer page,@ApiParam("条") Integer limit,@ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title,Integer isRecommend,Integer status,Long bannerId,Integer sort,
|
||||
Integer isPrice,Integer over,Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow) {
|
||||
return courseService.selectCourse(page, limit, classifyId, title,isRecommend,status,bannerId,sort,null,
|
||||
isPrice,1,over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@PostMapping("/insertCourse")
|
||||
@ApiOperation("添加短剧信息")
|
||||
public Result insertCourse(@RequestBody Course course) {
|
||||
return courseService.insertCourse(course);
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourse")
|
||||
@ApiOperation("修改短剧信息")
|
||||
public Result updateCourse(@RequestBody Course course) {
|
||||
return courseService.updateCourse(course);
|
||||
}
|
||||
|
||||
@GetMapping("/updateDelete")
|
||||
@ApiOperation("假删除")
|
||||
public Result updateDelete(Long id) {
|
||||
return courseService.updateDelete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseById")
|
||||
@ApiOperation("根据id查询短剧详细信息")
|
||||
public Result selectCourseById(Integer page,Integer limit,Long id,Integer good) {
|
||||
return courseService.selectCourseById(page,limit,id,good);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectCourseUserbyid")
|
||||
@ApiOperation("我的短剧")
|
||||
public Result selectCourseUser(Integer page, Integer limit, Long userId) {
|
||||
return courseUserService.selectCourseUser(page, limit, userId);
|
||||
}
|
||||
|
||||
@GetMapping("/updateCourse")
|
||||
@ApiOperation("修改状态")
|
||||
public Result updateCourse(Long courseId){
|
||||
Course byId = courseService.getById(courseId);
|
||||
if(byId!=null){
|
||||
if(byId.getStatus().equals(1)){
|
||||
byId.setStatus(2);
|
||||
}else{
|
||||
byId.setStatus(1);
|
||||
}
|
||||
courseService.updateById(byId);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/synCourse")
|
||||
@ApiOperation("采集视频")
|
||||
public Result synCourse(){
|
||||
return courseService.synCourse();
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourseDetails")
|
||||
@ApiOperation("批量修改集")
|
||||
public Result updateCourseDetails(String ids, BigDecimal price,String content,String titleImg){
|
||||
return courseService.updateCourseDetails(ids,price,content,titleImg);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updateCourseStatus")
|
||||
@ApiOperation("批量上下架剧")
|
||||
public Result updateCourseStatus(String ids, Integer status){
|
||||
return courseService.updateCourseStatus(ids,status);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCourseByIds")
|
||||
@ApiOperation("批量删除剧")
|
||||
public Result deleteCourseByIds(String ids){
|
||||
return courseService.deleteCourseByIds(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCourseDetailsByIds")
|
||||
@ApiOperation("批量删除集")
|
||||
public Result deleteCourseDetailsByIds(String ids){
|
||||
return courseService.deleteCourseDetailsByIds(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/dyVideoUpload")
|
||||
@ApiOperation("抖音短剧上传")
|
||||
public Result dyVideoUpload(Long courseId){
|
||||
return courseService.dyVideoUpload(courseId);
|
||||
}
|
||||
|
||||
@PostMapping("/dyVideoAudit")
|
||||
@ApiOperation("抖音短剧送审")
|
||||
public Result dyVideoAudit(Long courseId){
|
||||
return courseService.dyVideoAudit(courseId);
|
||||
}
|
||||
|
||||
@PostMapping("/dyVideoUp")
|
||||
@ApiOperation("抖音短剧上线")
|
||||
public Result dyVideoUp(Long courseId){
|
||||
return courseService.dyVideoUp(courseId);
|
||||
}
|
||||
|
||||
@PostMapping("/setDyNotifyUrl")
|
||||
@ApiOperation("设置抖音视频回调地址")
|
||||
public Result setDyNotifyUrl(String url){
|
||||
return courseService.setDyNotifyUrl(url);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadCourseDetails")
|
||||
@ApiOperation("单个集上传")
|
||||
public Result uploadCourseDetails(Long courseDetailsId){
|
||||
return courseService.uploadCourseDetails(courseDetailsId);
|
||||
}
|
||||
|
||||
@PostMapping("/updateDyCourse")
|
||||
@ApiOperation("修改抖音短剧")
|
||||
public Result updateDyCourse(@RequestBody Course course){
|
||||
return courseService.updateDyCourse(course);
|
||||
}
|
||||
|
||||
@GetMapping("/sysWxCourse")
|
||||
@ApiOperation("同步微信已提交审核的短剧")
|
||||
public Result sysWxCourse(Integer freeNum, BigDecimal coursePrice,Integer maxGood,Integer minGood){
|
||||
return courseService.sysWxCourse(freeNum, coursePrice, maxGood, minGood);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadWxCourse")
|
||||
@ApiOperation("提交微信备案审核")
|
||||
public Result uploadWxCourse(Long courseId,Integer qualificationType,String registrationNumber,
|
||||
String qualificationCertificateMaterialId,String costOfProduction,String costCommitmentLetterMaterialId){
|
||||
return courseService.uploadWxCourse(courseId, qualificationType, registrationNumber, qualificationCertificateMaterialId, costOfProduction, costCommitmentLetterMaterialId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getWxToken")
|
||||
@ApiOperation("获取微信小程序token")
|
||||
public Result getWxToken(){
|
||||
return Result.success().put("data",SenInfoCheckUtil.getMpToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 剧导入列表--导入
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "剧导入列表--导入")
|
||||
@PostMapping(value = "/courseListExcelIn")
|
||||
public Result courseListExcelIn(@ApiParam(name = "file", value = "excel文件") @RequestPart MultipartFile file) throws Exception {
|
||||
try {
|
||||
if (file == null) {
|
||||
return Result.error("文件不能为空!");
|
||||
}
|
||||
return courseService.courseListExcelIn(file);
|
||||
} catch (Exception e) {
|
||||
log.error("剧导入列表--导入异常:", e);
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return Result.error("导入失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.sqx.modules.course.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "短剧视频信息", tags = {"短剧视频信息"})
|
||||
@RequestMapping(value = "/courseDetails")
|
||||
public class CourseDetailsController {
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
|
||||
@PostMapping("/insertCourseDetails")
|
||||
@ApiOperation("添加短剧视频信息")
|
||||
public Result insertCourseDetails(@RequestBody CourseDetails courseDetails) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
courseDetails.setCreateTime(sdf.format(new Date()));
|
||||
courseDetailsService.insert(courseDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateCourseDetails")
|
||||
@ApiOperation("修改短剧视频信息")
|
||||
public Result updateCourseDetails(@RequestBody CourseDetails courseDetails) {
|
||||
courseDetailsService.updateCourseDetails(courseDetails);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteCourseDetails")
|
||||
@ApiOperation("删除短剧视频信息")
|
||||
public Result deleteCourseDetails(String ids) {
|
||||
courseDetailsService.deleteCourseDetails(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 集导入列表--导入
|
||||
* @param file 上传文件
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "集导入列表--导入")
|
||||
@PostMapping(value = "/courseDetailsListExcelIn")
|
||||
public Result courseDetailsListExcelIn(@ApiParam(name = "file", value = "excel文件") @RequestPart MultipartFile file, Long courseId) throws Exception {
|
||||
try {
|
||||
if (file == null) {
|
||||
return Result.error("文件不能为空!");
|
||||
}
|
||||
return courseDetailsService.courseDetailsListExcelIn(file,courseId);
|
||||
} catch (Exception e) {
|
||||
log.error("集导入列表--导入异常:", e);
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return Result.error("导入失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.course.response.ClassificationResponse;
|
||||
import com.sqx.modules.course.response.CurriculumResponse;
|
||||
import com.sqx.modules.course.service.CourseClassificationService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教育首页面展示
|
||||
*
|
||||
* @author liyuan
|
||||
* @since 2021-07-15
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "App短剧分类信息", tags = {"App短剧分类信息"})
|
||||
@RequestMapping(value = "/app/courseClassification")
|
||||
@Slf4j
|
||||
public class AppClassificationController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseClassificationService courseClassificationService;
|
||||
|
||||
@GetMapping("/selectClassification")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectClassification() {
|
||||
return Result.success().put("data", courseClassificationService.selectClassification());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询短剧的分类信息 (未删除)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryClassification", method = RequestMethod.GET)
|
||||
public Result queryClassification() {
|
||||
try {
|
||||
List<ClassificationResponse> classificationResponses = courseClassificationService.queryClassification();
|
||||
return Result.success().put("data", classificationResponses);
|
||||
} catch (Exception e) {
|
||||
log.error("系统发生异常!");
|
||||
return Result.error("系统发生异常!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import com.sqx.modules.course.service.CourseCollectService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "app短剧收藏", tags = {"app短剧收藏"})
|
||||
@RequestMapping(value = "/app/courseCollect")
|
||||
public class AppCourseCollectController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private CourseCollectService courseCollectService;
|
||||
|
||||
@Login
|
||||
@PostMapping("/insertCourseCollect")
|
||||
@ApiOperation("app收藏短剧信息")
|
||||
public Result insertCourseCollect(@RequestBody CourseCollect courseCollect,@RequestAttribute("userId") Long userId){
|
||||
courseCollect.setUserId(userId);
|
||||
return courseCollectService.insertCourseCollect(courseCollect);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectByUserId")
|
||||
@ApiOperation("app查询收藏短剧信息")
|
||||
public Result selectByUserId(Integer page, Integer limit,@RequestAttribute("userId") Long userId,Integer classify){
|
||||
return courseCollectService.selectByUserId(page,limit,userId,classify);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import com.sqx.modules.course.service.CourseCommentService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 修改部分代码逻辑
|
||||
*
|
||||
* @author liyuan
|
||||
* @since 2021-07-16
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "短剧评论信息", tags = {"短剧评论信息"})
|
||||
@RequestMapping(value = "/app/courseComment")
|
||||
public class AppCourseCommentController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseCommentService courseCommentService;
|
||||
|
||||
@Login
|
||||
@PostMapping("/insertCourseComment")
|
||||
@ApiOperation("添加评论")
|
||||
public Result insertCourseComment(@RequestBody CourseComment courseComment, @RequestAttribute("userId") Long userId) {
|
||||
courseComment.setUserId(userId);
|
||||
return courseCommentService.insertCourseComment(courseComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有赞时取消点赞 没赞时点赞
|
||||
*
|
||||
* @param courseCommentId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@GetMapping("/updateGoodsNum")
|
||||
@ApiOperation("点赞评论")
|
||||
public Result updateGoodsNum(Long courseCommentId, @RequestAttribute("userId") Long userId) {
|
||||
return courseCommentService.updateGoodsNum(courseCommentId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看短剧下的所有评论内容 时间 评论人 评论人图像 评论点赞次数
|
||||
*
|
||||
* @param page
|
||||
* @param limit
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@GetMapping("/selectCourseComment")
|
||||
@ApiOperation("查看评论")
|
||||
public Result selectCourseComment(Integer page, Integer limit, Long courseId, @RequestAttribute("userId") Long userId) {
|
||||
return courseCommentService.selectCourseComment(page, limit, courseId,userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论(删除评论的信息 删除评论的点赞关联 )
|
||||
*
|
||||
* @param courseCommentId
|
||||
* @return
|
||||
*/
|
||||
@Login
|
||||
@GetMapping("/deleteCourseComment")
|
||||
@ApiOperation("删除评论")
|
||||
public Result deleteCourseComment(Long courseCommentId) {
|
||||
return courseCommentService.deleteCourseComment(courseCommentId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@Api(value = "APP短剧信息", tags = {"APP短剧信息"})
|
||||
@RequestMapping(value = "/app/course")
|
||||
public class AppCourseController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
|
||||
@GetMapping("/selectCourse")
|
||||
@ApiOperation("查询短剧信息")
|
||||
public Result selectCourse(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title, Long bannerId, Integer sort, String token, Integer isPrice,
|
||||
Integer over,Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow, HttpServletRequest request) {
|
||||
if(StringUtils.isEmpty(token)){
|
||||
token = request.getHeader("Token");
|
||||
if(StringUtils.isBlank(token)){
|
||||
token = request.getParameter("Token");
|
||||
}
|
||||
}
|
||||
return courseService.selectCourse(page, limit, classifyId, title,null,1,bannerId,sort,token,isPrice,
|
||||
null, over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectCourseDetailsById")
|
||||
@ApiOperation("根据id查询短剧详情")
|
||||
public Result selectCourseDetailsById(Long id,String token,String courseDetailsId){
|
||||
return courseDetailsService.selectCourseDetailsById(id,token,courseDetailsId);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseDetailsList")
|
||||
@ApiOperation("查询推荐视频")
|
||||
public Result selectCourseDetailsList(Integer page,Integer limit,String token,String randomNum,Integer wxShow,Integer dyShow){
|
||||
return courseDetailsService.selectCourseDetailsList(page, limit, token,randomNum,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectCourseTitle")
|
||||
@ApiOperation("模糊根据短剧标题查询短剧")
|
||||
public Result selectCourseTitle(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title,Long bannerId,Integer sort,String token, Integer isPrice,Integer over,
|
||||
Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow) {
|
||||
return courseService.selectCourse(page, limit, classifyId, title,null,1,bannerId,sort,token,isPrice,
|
||||
null, over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCourseTitles")
|
||||
@ApiOperation("模糊根据短剧标题查询短剧")
|
||||
public Result selectCourseTitles(@ApiParam("页") Integer page, @ApiParam("条") Integer limit, @ApiParam("分类id") Long classifyId,
|
||||
@ApiParam("搜索内容") String title,Long bannerId,Integer sort,String token, Integer isPrice,Integer over,
|
||||
Integer wxCourse,Integer dyCourse,Integer wxShow,Integer dyShow) {
|
||||
return courseService.selectCourse(page, limit, classifyId, title,null,1,bannerId,sort,token,isPrice,
|
||||
null, over,wxCourse,dyCourse,wxShow,dyShow);
|
||||
}
|
||||
|
||||
@Login
|
||||
@PostMapping("/courseNotify")
|
||||
@ApiOperation("看广告解锁视频")
|
||||
public Result courseNotify(@RequestAttribute Long userId, Long courseId, Long courseDetailsId){
|
||||
return courseService.courseNotify(userId, courseId, courseDetailsId);
|
||||
}
|
||||
|
||||
@PostMapping("/notifyUrl")
|
||||
@ApiOperation("抖音视频回调")
|
||||
public JSONObject notifyUrl(@RequestBody JSONObject jsonObject){
|
||||
return courseService.notifyUrl(jsonObject);
|
||||
}
|
||||
|
||||
@PostMapping("/selectWxVideoUrl")
|
||||
@ApiOperation("查询微信短剧播放链接")
|
||||
public Result selectWxVideoUrl(@RequestBody JSONObject jsonObject){
|
||||
String wxCourseDetailsIds = jsonObject.getString("wxCourseDetailsIds");
|
||||
return courseService.selectWxVideoUrl(wxCourseDetailsIds);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.service.CourseUserService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@Api(value = "我的短剧", tags = {"我的短剧"})
|
||||
@RequestMapping(value = "/app/CourseUser")
|
||||
public class AppCourseUserController extends AbstractController {
|
||||
@Autowired
|
||||
private CourseUserService courseUserService;
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectCourseUser")
|
||||
@ApiOperation("App我的短剧")
|
||||
public Result selectCourseUser(Integer page, Integer limit, Long userId) {
|
||||
return courseUserService.selectCourseUser(page, limit, userId);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/updateTime")
|
||||
@ApiOperation("修改时间")
|
||||
public void updateTime(Long courseId) {
|
||||
courseUserService.updateTime(courseId);
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectLatelyCourse")
|
||||
@ApiOperation("最近学习")
|
||||
public Result selectLatelyCourse(Integer page, Integer limit, Long userId) {
|
||||
return courseUserService.selectLatelyCourse(page, limit, userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.course.entity.CommentGood;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CommentGoodDao extends BaseMapper<CommentGood> {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.CourseClassification;
|
||||
import com.sqx.modules.course.response.ClassificationResponse;
|
||||
import com.sqx.modules.course.response.CurriculumResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseClassificationDao extends BaseMapper<CourseClassification> {
|
||||
|
||||
IPage<Map<String, Object>> selectCourseClassificationPage(Page<Map<String, Object>> pages, @Param("classificationName") String classificationName);
|
||||
|
||||
IPage<Map<String, Object>> selectCourseClassificationList(@Param("classificationName") String classificationName);
|
||||
|
||||
int updateDelete(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询短剧的分类信息
|
||||
*/
|
||||
List<ClassificationResponse> queryClassification();
|
||||
|
||||
/**
|
||||
* 查询推荐短剧信息
|
||||
*/
|
||||
List<CurriculumResponse> queryCurriculum(String limit);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseCollect;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
||||
|
||||
IPage<Course> selectCourseByCollect(Page<Course> page, @Param("userId") Long userId,@Param("classify") Integer classify);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.CourseComment;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseCommentDao extends BaseMapper<CourseComment> {
|
||||
|
||||
int updateCourseComment(@Param("type") Integer type, @Param("courseCommentId") Long courseCommentId);
|
||||
|
||||
IPage<CourseComment> selectCourseComment(Page<CourseComment> page, @Param("courseId") Long courseId,@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 删除评论的点赞关联
|
||||
* @param courseCommentId
|
||||
* @return
|
||||
*/
|
||||
int deleteCommentGood(@Param("courseCommentId") Long courseCommentId);
|
||||
|
||||
IPage<Map<String,Object>> selectCourseCommentByUserId(Page<Map<String,Object>> page,@Param("userId") Long userId);
|
||||
|
||||
|
||||
}
|
||||
43
src/main/java/com/sqx/modules/course/dao/CourseDao.java
Normal file
43
src/main/java/com/sqx/modules/course/dao/CourseDao.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseDao extends BaseMapper<Course> {
|
||||
|
||||
int updateDelete(@Param("id") Long id);
|
||||
|
||||
IPage<Map<String, Object>> selectCourse(Page<Map<String, Object>> pages, @Param("classifyId") Long classifyId,
|
||||
@Param("title") String title,@Param("isRecommend") Integer isRecommend,
|
||||
@Param("status") Integer status,@Param("bannerId") Long bannerId,
|
||||
@Param("sort") Integer sort,@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,@Param("userId") Long userId,
|
||||
@Param("isPrice") Integer isPrice,@Param("over") Integer over,
|
||||
@Param("wxCourse") Integer wxCourse,@Param("dyCourse") Integer dyCourse,
|
||||
@Param("wxShow") Integer wxShow,@Param("dyShow") Integer dyShow);
|
||||
|
||||
IPage<Map<String, Object>> selectCourseAdmin(Page<Map<String, Object>> pages, @Param("classifyId") Long classifyId,
|
||||
@Param("title") String title,@Param("isRecommend") Integer isRecommend,
|
||||
@Param("status") Integer status,@Param("bannerId") Long bannerId,
|
||||
@Param("sort") Integer sort,@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,@Param("userId") Long userId,
|
||||
@Param("isPrice") Integer isPrice,@Param("over") Integer over,
|
||||
@Param("wxCourse") Integer wxCourse,@Param("dyCourse") Integer dyCourse,
|
||||
@Param("wxShow") Integer wxShow,@Param("dyShow") Integer dyShow);
|
||||
|
||||
/**
|
||||
* 根据title 模糊查询短剧
|
||||
* @param pages
|
||||
* @param title
|
||||
* @return
|
||||
*/
|
||||
IPage<Map<String, Object>> selectCourseTitle(Page<Map<String, Object>> pages, @Param("title")String title);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.CourseDetails;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
||||
|
||||
List<CourseDetails> findByCourseId(@Param("id") Long id,@Param("userId") Long userId);
|
||||
|
||||
IPage<CourseDetails> selectCoursePageByCourseId(Page<CourseDetails> page, @Param("id") Long id,@Param("good") Integer good);
|
||||
|
||||
List<CourseDetails> findByCourseIdNotUrl(@Param("id") Long id,@Param("userId") Long userId);
|
||||
|
||||
int deleteCourseDetails(String[] ids);
|
||||
|
||||
IPage<CourseDetails> selectCourseDetailsList(Page<CourseDetails> page,String randomNum,Integer wxShow,Integer dyShow);
|
||||
|
||||
}
|
||||
41
src/main/java/com/sqx/modules/course/dao/CourseUserDao.java
Normal file
41
src/main/java/com/sqx/modules/course/dao/CourseUserDao.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.sqx.modules.course.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.entity.CourseUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CourseUserDao extends BaseMapper<CourseUser> {
|
||||
|
||||
IPage<Course> selectLatelyCourse(Page<Course> pages, @Param("userId") Long userId);
|
||||
|
||||
IPage<Course> selectCourseByCourseUser(Page<Course> pages, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询用户是否订购
|
||||
*
|
||||
* @param id
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
CourseUser selectCourseUser(@Param("id") Long id, @Param("userId") Long userId);
|
||||
|
||||
List<CourseUser> selectCourseUserList(@Param("id") Long id, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*
|
||||
* @param courseUser
|
||||
* @return
|
||||
*/
|
||||
int updateCourseTime(@Param("courseUser") CourseUser courseUser);
|
||||
|
||||
int deleteCourseUserByVipUser(Long userId);
|
||||
|
||||
}
|
||||
42
src/main/java/com/sqx/modules/course/entity/CommentGood.java
Normal file
42
src/main/java/com/sqx/modules/course/entity/CommentGood.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description comment_good 评论点赞
|
||||
* @author fang
|
||||
* @date 2021-06-23
|
||||
*/
|
||||
@Data
|
||||
public class CommentGood implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 评论点赞id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long commentGoodId;
|
||||
|
||||
/**
|
||||
* 评论id
|
||||
*/
|
||||
private Long courseCommentId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public CommentGood() {}
|
||||
}
|
||||
332
src/main/java/com/sqx/modules/course/entity/Course.java
Normal file
332
src/main/java/com/sqx/modules/course/entity/Course.java
Normal file
@@ -0,0 +1,332 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
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.sqx.modules.orders.entity.Orders;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description course 短剧
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course")
|
||||
public class Course implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String bannerImg;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
@TableField("title_img")
|
||||
private String titleImg;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 上下架 1上架 2下架
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否完结 0未完结 1已完结
|
||||
*/
|
||||
private Integer isOver;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@TableField("classify_id")
|
||||
private Long classifyId;
|
||||
/**
|
||||
* 短剧分类对象
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private CourseClassification courseClassification;
|
||||
|
||||
/**
|
||||
* 购买次数
|
||||
*/
|
||||
@TableField("pay_num")
|
||||
private Integer payNum;
|
||||
|
||||
/**
|
||||
* 短剧标签
|
||||
*/
|
||||
@TableField("course_label")
|
||||
private String courseLabel;
|
||||
|
||||
@TableField("course_label_ids")
|
||||
private String courseLabelIds;
|
||||
|
||||
/**
|
||||
* 内容图
|
||||
*/
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 短剧介绍
|
||||
*/
|
||||
private String details;
|
||||
|
||||
/**
|
||||
* 删除标识 0未删除 1已删除
|
||||
*/
|
||||
@TableField("is_delete")
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("update_time")
|
||||
private String updateTime;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
@TableField("msg_url")
|
||||
private String msgUrl;
|
||||
/**
|
||||
* 上传方式0OSS-1本地
|
||||
*/
|
||||
@TableField("msg_type")
|
||||
private Integer msgType;
|
||||
|
||||
/**
|
||||
* 是否是推荐商品
|
||||
*/
|
||||
@TableField("is_recommend")
|
||||
private Integer isRecommend;
|
||||
/**
|
||||
* 首页金刚区分类
|
||||
*/
|
||||
private Integer bannerId;
|
||||
|
||||
/**
|
||||
* 是否收费 1是 2免费
|
||||
*/
|
||||
private Integer isPrice;
|
||||
|
||||
/**
|
||||
* 短剧目录
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<CourseDetails> listsDetail;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 短剧分类 1短剧 2链接 3文档
|
||||
*/
|
||||
private Integer courseType;
|
||||
|
||||
/**
|
||||
* 播放量
|
||||
*/
|
||||
private Integer viewCounts;
|
||||
|
||||
/**
|
||||
* 抖音封面图id
|
||||
*/
|
||||
private String dyImgId;
|
||||
|
||||
/**
|
||||
* 抖音短剧id
|
||||
*/
|
||||
private String dyCourseId;
|
||||
|
||||
/**
|
||||
* 抖音提审状态 1已提交 2已通过 3已拒绝 4已上线
|
||||
*/
|
||||
private Integer dyStatus;
|
||||
|
||||
/**
|
||||
* 抖音审核内容
|
||||
*/
|
||||
private String dyStatusContent;
|
||||
|
||||
/**
|
||||
* 当前版本号
|
||||
*/
|
||||
private String dyVersion;
|
||||
|
||||
/**
|
||||
* 资质 许可证号
|
||||
*/
|
||||
private String licenseNum;
|
||||
|
||||
/**
|
||||
* 资质 登记号
|
||||
*/
|
||||
private String registrationNum;
|
||||
|
||||
/**
|
||||
* 资质 普通备案号
|
||||
*/
|
||||
private String ordinaryRecordNum;
|
||||
|
||||
/**
|
||||
* 资质 重点备案号
|
||||
*/
|
||||
private String keyRecordNum;
|
||||
|
||||
/**
|
||||
* 微信短剧id
|
||||
*/
|
||||
private String wxCourseId;
|
||||
|
||||
/**
|
||||
* 微信是否显示 1是
|
||||
*/
|
||||
private Integer wxShow;
|
||||
|
||||
/**
|
||||
* 抖音是否显示 1是
|
||||
*/
|
||||
private Integer dyShow;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
*平均单集时长,单位分钟
|
||||
*/
|
||||
private Integer duration;
|
||||
|
||||
/**
|
||||
*制作机构
|
||||
*/
|
||||
private String productionOrganisation;
|
||||
|
||||
/**
|
||||
* 导演
|
||||
*/
|
||||
private String director;
|
||||
|
||||
/**
|
||||
* 制作人
|
||||
*/
|
||||
private String producer;
|
||||
|
||||
/**
|
||||
* 演员
|
||||
*/
|
||||
private String actor;
|
||||
|
||||
/**
|
||||
* 内容梗概(1000 汉字以内)
|
||||
*/
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 成本配置比例情况图片
|
||||
*/
|
||||
private String costDistributionUri;
|
||||
|
||||
/**
|
||||
*承诺书
|
||||
*/
|
||||
private String assuranceUri;
|
||||
|
||||
/**
|
||||
*制作成本类型
|
||||
* - 10:30万以下
|
||||
* - 20:30~100万
|
||||
* - 30:100万以
|
||||
*/
|
||||
private Integer playletProductionCost;
|
||||
|
||||
/**
|
||||
* 剧目资质:1-取得《网络剧片发行许可证》或重点节目备案号;2-未取得《网络剧片发行许可证》或重点节目备案,且制作成本小于30万元
|
||||
* 注:
|
||||
* 1、
|
||||
* (1)剧目资质=1:需上传“网络剧片发行许可证”或“广电备案系统截图”,平台会在视频播放环节展示备案号水印;
|
||||
* (2)剧目资质=2:制作成本在30万以内,需上传《成本配置比例情况报告》。剧目经平台审核后由平台下发备案号(备案号仅适用微信小程序平台)并在视频播放环节展示备案号水印。
|
||||
* 2、2024年5月27日前发起提审的剧目可支持修改,且同一剧目仅支持修改一次。
|
||||
*/
|
||||
private Integer qualificationType;
|
||||
|
||||
/**
|
||||
* 剧目备案号,当qualification_type=1时必填。根据提供的剧目资质证明文件填写对应的网络剧片发行许可证编号或剧目备案号。如:(沪)网剧审字(2023)第001号 或 V123456788888888
|
||||
*/
|
||||
private String registrationNumber;
|
||||
|
||||
/**
|
||||
* 剧目资质证明文件,当qualification_type=1时必填。请提供网络剧片发行许可证或广电备案系统截图
|
||||
*/
|
||||
private String qualificationCertificateMaterialId;
|
||||
|
||||
/**
|
||||
* 剧目制作成本(单位:万元),当qualification_type=2时必填。请填写“1-29” 的整数(如非整数将截断取整),数值需与《成本配置比例情况报告》中对应剧目制作成本一致。
|
||||
*/
|
||||
private String costOfProduction;
|
||||
|
||||
/**
|
||||
* 《成本配置比例情况报告》material_id,当qualification_type=2时必填
|
||||
*/
|
||||
private String costCommitmentLetterMaterialId;
|
||||
|
||||
private Integer wxCourseStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String avatar;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String courseCount;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isMyCourse;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Orders orders;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String courseDetailsName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long courseDetailsId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer courseDetailsCount;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer isCollect;
|
||||
|
||||
public Course() {}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* @description CourseClassification 短剧分类
|
||||
* @author wang
|
||||
* @date 2021-03-29
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_classification")
|
||||
public class CourseClassification implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long classificationId;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String classificationName;
|
||||
/**
|
||||
* 是否删除0正常1已删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sqx.modules.course.entity;
|
||||
|
||||
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 lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description course_collect 收藏
|
||||
* @author fang
|
||||
* @date 2021-03-27
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_collect")
|
||||
public class CourseCollect implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 收藏id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long courseCollectId;
|
||||
|
||||
/**
|
||||
* 短剧id
|
||||
*/
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 集id
|
||||
*/
|
||||
private Long courseDetailsId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 分类 1收藏 2点赞 3历史记录
|
||||
*/
|
||||
private Integer classify;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
@TableField(exist = false)
|
||||
private Integer type;
|
||||
|
||||
|
||||
|
||||
public CourseCollect() {}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user