New file |
| | |
| | | package com.ruoyi.account; |
| | | |
| | | import com.ruoyi.common.security.annotation.EnableCustomConfig; |
| | | import com.ruoyi.common.security.annotation.EnableRyFeignClients; |
| | | import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 账户模块 |
| | | * @author ruoyi |
| | | */ |
| | | @EnableCustomConfig |
| | | @MapperScan({"com.ruoyi.account.mapper"}) |
| | | @EnableCustomSwagger2 |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @ServletComponentScan |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiAccountApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiAccountApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 账户模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | | " |(_ o _) / _( )_ .' \n" + |
| | | " | (_,_).' __ ___(_ o _)' \n" + |
| | | " | |\\ \\ | || |(_,_)' \n" + |
| | | " | | \\ `' /| `-' / \n" + |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DataUpdateInterceptor |
| | | * @Description 数据更新操作处理 |
| | | * @date 2021-12-15 |
| | | * <p> |
| | | * 注意,之前在此处注入了 JwtTokenUtils |
| | | * <p> |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 新增数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | // 获取登录信息 |
| | | // LoginUser loginUser = tokenService.getLoginUser(); |
| | | // String userName = loginUser.getUsername(); |
| | | // if (StringUtils.hasLength(userName)) { |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("createTime", new Date(), metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | // } else { |
| | | // this.setFieldValByName("createBy", "", metaObject); |
| | | // this.setFieldValByName("updateBy", "", metaObject); |
| | | // this.setFieldValByName("createTime", "", metaObject); |
| | | // this.setFieldValByName("updateTime", "", metaObject); |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 修改数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | // this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | // 获取登录信息 |
| | | // LoginUser loginUser = tokenService.getLoginUser(); |
| | | // System.err.println(loginUser); |
| | | // String userName = loginUser.getUsername(); |
| | | // if (StringUtils.hasLength(userName)) { |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("createTime", new Date(), metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | // } else { |
| | | // this.setFieldValByName("createBy", "", metaObject); |
| | | // this.setFieldValByName("updateBy", "", metaObject); |
| | | // this.setFieldValByName("createTime", "", metaObject); |
| | | // this.setFieldValByName("updateTime", "", metaObject); |
| | | // } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * <p>文件上传配置</p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/10/13 16:10 |
| | | */ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "file.upload") |
| | | public class FileUploadConfig { |
| | | private String accessPath; |
| | | private String allowExt; |
| | | private String location; |
| | | private String qrLocation; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.client.RestTemplateBuilder; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | /** |
| | | * http请求工具配置 |
| | | * |
| | | * @author: KingKong |
| | | * @create: 2018-11-14 10:47 |
| | | **/ |
| | | @Configuration |
| | | public class HttpConfig { |
| | | |
| | | @Autowired |
| | | private RestTemplateBuilder builder; |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate() { |
| | | return builder.build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName MybatisPlusConfig |
| | | * @Description MybatisPlus相关配置 |
| | | * @date 2020-09-22 11:22、 |
| | | * 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @EnableTransactionManagement(proxyTargetClass = true) |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | |
| | | @Autowired |
| | | public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) { |
| | | this.dataUpdateHandler = dataUpdateHandler; |
| | | } |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * 自动填充功能 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public GlobalConfig globalConfig() { |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | globalConfig.setMetaObjectHandler(dataUpdateHandler); |
| | | return globalConfig; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/agent-application") |
| | | public class AgentApplicationController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.ruoyi.account.api.model.AppUserBank; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 15:07 |
| | | */ |
| | | @Api(tags = {"个人中心-我的银行卡-小程序"}) |
| | | @RestController |
| | | @RequestMapping("/appUserBank") |
| | | public class AppUserBankController { |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/saveAppUserBank") |
| | | @ApiOperation(value = "保存银行卡") |
| | | public AjaxResult saveAppUserBank(@RequestBody AppUserBank appUserBank){ |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getAppUserBank") |
| | | @ApiOperation(value = "获取银行卡信息") |
| | | public AjaxResult<AppUserBank> getAppUserBank(){ |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.StoreClient; |
| | | import org.junit.Test; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Api(tags = {"登录注册-小程序"}) |
| | | @RestController |
| | | @RequestMapping("/app-user") |
| | | public class AppUserController extends BaseController { |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | @Resource |
| | | private UserCouponService userCouponService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/mobileLogin") |
| | | @ApiOperation(value = "手机号登录") |
| | | public R<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin){ |
| | | return appUserService.mobileLogin(mobileLogin); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/appletLogin") |
| | | @ApiOperation(value = "小程序一键登录") |
| | | public R<LoginVo> appletLogin(@RequestBody AppletLogin appletLogin){ |
| | | return appUserService.appletLogin(appletLogin); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getAppUserById") |
| | | public AppUser getAppUserById(@RequestParam("id") Long id){ |
| | | return appUserService.getById(id); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/editAppUserById") |
| | | public R<Void> editAppUserById(@RequestParam("appUser") AppUser appUser) { |
| | | appUserService.updateById(appUser); |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getCouponCount") |
| | | public R<Long> getCouponCount(@RequestParam("userId")Long userId, @RequestParam("couponId") Integer couponId ){ |
| | | Long count = userCouponService.lambdaQuery().eq(UserCoupon::getAppUserId, userId).eq(UserCoupon::getCouponId, couponId).count(); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getVipCount") |
| | | public R<Long> getVipCount(@RequestParam("userId")Long userId, @RequestParam("vipId") Integer vipId ){ |
| | | Long count = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, userId).eq(AppUser::getVipId, vipId).count(); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSMSCode") |
| | | @ApiOperation(value = "获取短信验证码") |
| | | public R getSMSCode(@RequestBody SMSCode smsCode){ |
| | | return appUserService.getSMSCode(smsCode); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/registerAccount") |
| | | @ApiOperation(value = "注册新账号") |
| | | public R<LoginVo> registerAccount(@RequestBody RegisterAccount registerAccount){ |
| | | return appUserService.registerAccount(registerAccount); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getReferrer/{id}") |
| | | @ApiOperation(value = "获取推荐人信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "推荐人id", required = true, dataType = "long") |
| | | }) |
| | | public R<String> getReferrer(@PathVariable("id") Long id){ |
| | | AppUser appUser = appUserService.getById(id); |
| | | String phone = appUser.getPhone(); |
| | | phone = phone.substring(0, 3) + "****" + phone.substring(7); |
| | | return R.ok(appUser.getName() + "-" + phone); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getNearbyReferrer") |
| | | @ApiOperation(value = "获取附近推荐人列表") |
| | | public TableDataInfo<NearbyReferrerVo> getNearbyReferrer(NearbyReferrer nearbyReferrer){ |
| | | startPage(); |
| | | List<NearbyReferrerVo> list = appUserService.getNearbyReferrer(nearbyReferrer); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/info") |
| | | @ApiOperation(value = "我的资料", tags = {"小程序-个人中心首页-我的资料"}) |
| | | public R<AppUser> info(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser user = appUserService.getById(userId); |
| | | return R.ok(user); |
| | | } |
| | | @Resource |
| | | private UserCancellationLogService userCancellationLogService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/unregis") |
| | | @ApiOperation(value = "注销", tags = {"小程序-个人中心首页-我的资料"}) |
| | | public R unregis(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser user = appUserService.getById(userId); |
| | | |
| | | //添加注销记录 |
| | | UserCancellationLog userCancellationLog = new UserCancellationLog(); |
| | | userCancellationLog.setAppUserId(user.getId()); |
| | | userCancellationLog.setVipId(user.getVipId()); |
| | | userCancellationLogService.save(userCancellationLog); |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/index") |
| | | @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) |
| | | public R<AppUser> index(){ |
| | | System.err.println("=-===="); |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | //当前用户信息 |
| | | AppUser user = appUserService.getById(userId); |
| | | //当前用户的推荐人信息 |
| | | if (user.getInviteUserId()!=null){ |
| | | AppUser inviteUser = appUserService.getById(user.getInviteUserId()); |
| | | user.setInviteUserName(inviteUser.getName()); |
| | | } |
| | | //当前绑定门店的店铺信息 |
| | | if (user.getShopId()!=null){ |
| | | R<Shop> storeById = storeClient.getStoreById(user.getShopId()); |
| | | if (storeById.getData()!=null){ |
| | | user.setShopName(storeById.getData().getName()); |
| | | } |
| | | } |
| | | Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getTopInviteId, 1).count(); |
| | | Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getTopInviteId, userId).count(); |
| | | user.setCount1(count1); |
| | | user.setCount2(count2); |
| | | user.setCount3(count3); |
| | | user.setCount4(count4); |
| | | user.setCount5(count5); |
| | | user.setCount6(count6); |
| | | user.setCount7(count7); |
| | | return R.ok(user); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取用户的祖籍列表 |
| | | */ |
| | | @GetMapping("/getUserAncestorList") |
| | | public R<List<AppUser>> getUserAncestorList(Long id){ |
| | | List<AppUser> list = appUserService.getUserAncestorList(id,null); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.account.service.UserAddressService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.account.service.UserAddressService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-address") |
| | | public class UserAddressController { |
| | | |
| | | @Resource |
| | | private UserAddressService userAddressService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | /** |
| | | * 获取用户默认地址 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getDefaultUserAddress") |
| | | public R<UserAddress> getDefaultUserAddress(@RequestParam("userId") Long userId){ |
| | | List<UserAddress> list = userAddressService.list(new LambdaQueryWrapper<UserAddress>().eq(UserAddress::getAppUserId, userId).eq(UserAddress::getDelFlag, 0)); |
| | | if(list.size() == 0){ |
| | | return R.ok(); |
| | | } |
| | | UserAddress userAddress = list.stream().filter(s -> s.getIsDefault() == 1).findFirst().get(); |
| | | if(null == userAddress){ |
| | | userAddress = list.get(0); |
| | | } |
| | | return R.ok(userAddress); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R add(@RequestBody UserAddress userAddress){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | userAddress.setAppUserId(userId); |
| | | userAddressService.save(userAddress); |
| | | return R.ok(); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "编辑", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R edit(@RequestBody UserAddress userAddress){ |
| | | userAddressService.updateById(userAddress); |
| | | return R.ok(); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/delete") |
| | | @ApiOperation(value = "删除", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R edit(@RequestParam Integer id){ |
| | | userAddressService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/set") |
| | | @ApiOperation(value = "设为默认", tags = {"小程序-个人中心首页-我的地址"}) |
| | | public R set(@RequestParam Integer id){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).list(); |
| | | for (UserAddress userAddress : list) { |
| | | userAddress.setIsDefault(0); |
| | | } |
| | | userAddressService.updateBatchById(list); |
| | | |
| | | UserAddress byId = userAddressService.getById(id); |
| | | byId.setIsDefault(1); |
| | | userAddressService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 根据id获取用户地址信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getUserAddressById") |
| | | public R<UserAddress> getUserAddressById(@RequestParam("id") Integer id){ |
| | | UserAddress userAddress = userAddressService.getById(id); |
| | | return R.ok(userAddress); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-cancellation-log") |
| | | public class UserCancellationLogController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-change-log") |
| | | public class UserChangeLogController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-click-log") |
| | | public class UserClickLogController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCouponVo; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCoupon; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Banner; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-coupon") |
| | | public class UserCouponController { |
| | | @Resource |
| | | private UserCouponService userCouponService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | @Resource |
| | | private UserPointService userPointService; |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("/mine/list") |
| | | @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"}) |
| | | public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Page<UserCoupon> page = userCouponService.lambdaQuery() |
| | | .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime) |
| | | .isNotNull(status!=null&&status==2,UserCoupon::getUseTime) |
| | | .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()) |
| | | .eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum, pageSize)); |
| | | for (UserCoupon record : page.getRecords()) { |
| | | CouponInfo data = couponClient.detail(record.getCouponId()).getData(); |
| | | CouponInfoVo vo = new CouponInfoVo(); |
| | | BeanUtils.copyProperties(data,vo); |
| | | record.setCouponInfoVo(vo); |
| | | if (record.getUseTime()==null){ |
| | | record.setStatus(1); |
| | | if (record.getEndTime().isBefore(LocalDateTime.now())){ |
| | | record.setStatus(3); |
| | | } |
| | | }else { |
| | | record.setStatus(2); |
| | | } |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/get") |
| | | @ApiOperation(value = "领取或者兑换优惠券", tags = {"小程序-个人中心-优惠劵"}) |
| | | public R<Page<UserCoupon>> get(@RequestParam Integer couponId) { |
| | | |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser byId = appUserService.getById(userid); |
| | | |
| | | CouponInfo data = couponClient.detail(couponId).getData(); |
| | | //检验当前优惠券是否存在 |
| | | if (data==null){ |
| | | return R.fail("当前优惠券不存在,请刷新后重试"); |
| | | } |
| | | if (data.getSendType()!=1&&byId.getLavePoint().compareTo(data.getNeedPoint().intValue())==-1){ |
| | | return R.fail("当前积分不足,兑换失败"); |
| | | } |
| | | //检验发放时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | if (now.isBefore(data.getSendStartTime())||now.isAfter(data.getSendEndTime())){ |
| | | return R.fail("领取失败,不在发放有效期"); |
| | | } |
| | | //如果是积分兑换,增加积分的历史记录 |
| | | if (data.getSendType()!=1){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(4); |
| | | userPoint.setHistoricalPoint(byId.getLavePoint()); |
| | | userPoint.setVariablePoint(data.getNeedPoint().intValue()); |
| | | userPoint.setAppUserId(userid); |
| | | userPoint.setObjectId(Long.valueOf(data.getId())); |
| | | userPointService.save(userPoint); |
| | | //扣除积分 |
| | | byId.setLavePoint(byId.getLavePoint() - userPoint.getVariablePoint()); |
| | | appUserService.updateById(byId); |
| | | } |
| | | //增加优惠券记录,根据时间类型设置开始结束时间 |
| | | UserCoupon userCoupon = new UserCoupon(); |
| | | userCoupon.setAppUserId(userid); |
| | | if (data.getPeriodType()==1) { |
| | | userCoupon.setStartTime(data.getPeriodStartTime()); |
| | | userCoupon.setEndTime(data.getPeriodEndTime()); |
| | | }else { |
| | | userCoupon.setStartTime(now); |
| | | userCoupon.setEndTime(now.plusDays(data.getPeriodDays())); |
| | | } |
| | | userCoupon.setCouponId(data.getId()); |
| | | userCouponService.save(userCoupon); |
| | | return R.ok(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取支付页面用户优惠券列表数据 |
| | | * @param paymentUserCoupon |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getPaymentUserCoupon") |
| | | public R<List<PaymentUserCouponVo>> getPaymentUserCoupon(@RequestBody PaymentUserCoupon paymentUserCoupon){ |
| | | List<PaymentUserCouponVo> userCoupon = userCouponService.getUserCoupon(paymentUserCoupon.getUserId(), paymentUserCoupon.getType()); |
| | | return R.ok(userCoupon); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户优惠券id获取优惠券详情 |
| | | * @param userCouponId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getCouponInfo") |
| | | public R<CouponInfoVo> getCouponInfo(@RequestParam("userCouponId") Long userCouponId){ |
| | | UserCoupon userCoupon = userCouponService.getById(userCouponId); |
| | | CouponInfo data = couponClient.detail(userCoupon.getCouponId()).getData(); |
| | | CouponInfoVo couponInfoVo = new CouponInfoVo(); |
| | | BeanUtils.copyProperties(data, couponInfoVo); |
| | | return R.ok(couponInfoVo); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-point") |
| | | @Api(tags = "个人积分") |
| | | public class UserPointController extends BaseController { |
| | | @Resource |
| | | private UserPointService userPointService; |
| | | |
| | | |
| | | /** |
| | | * 获取个人积分 |
| | | */ |
| | | @GetMapping("/getUserPoint") |
| | | @ApiOperation("获取个人积分") |
| | | public R<UserPointVO> getUserPoint(){ |
| | | return R.ok(userPointService.getUserPoint(SecurityUtils.getUserId())); |
| | | } |
| | | |
| | | /** |
| | | * 获取变更明细 |
| | | */ |
| | | @GetMapping("/getUserPointDetail") |
| | | @ApiOperation("获取变更明细") |
| | | public TableDataInfo getUserPointDetail(@ApiParam("指定日期") LocalDateTime date, |
| | | @ApiParam("变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 " + |
| | | "5 = 门店业绩积分 6 =门店返佣积分7=技师业绩积分8 =转赠积分 9 =做工积分 " + |
| | | "10 =注册积分)") Integer type){ |
| | | startPage(); |
| | | List<UserPointDetailVO> list = userPointService.getUserPointDetail(SecurityUtils.getUserId(), date, type); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 转赠积分 |
| | | */ |
| | | @PostMapping("/transferPoint") |
| | | @ApiOperation("转赠积分") |
| | | public R<Void> transferPoint(@ApiParam("积分") BigDecimal point, @ApiParam("手机号") Long phone){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存积分流水记录 |
| | | * @param userPoint |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveUserPoint") |
| | | public R saveUserPoint(@RequestBody UserPoint userPoint){ |
| | | userPointService.save(userPoint); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-sign-record") |
| | | public class UserSignRecordController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.BalanceChangeRecordService; |
| | | import com.ruoyi.account.service.WalletService; |
| | | import com.ruoyi.account.vo.WalletVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.ruoyi.order.model.Order; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api(tags = "小程序-个人中心-我的钱包") |
| | | @RestController |
| | | @RequestMapping("wallet") |
| | | public class WalletController extends BaseController { |
| | | @Resource |
| | | private BalanceChangeRecordService balanceChangeRecordService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private WalletService walletService; |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | /** |
| | | * 钱包详情 |
| | | */ |
| | | @GetMapping("detail") |
| | | @ApiOperation(value = "钱包详情", notes = "钱包详情") |
| | | public R<WalletVO> detail() { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | WalletVO walletVO = walletService.getWalletByUserId(loginUserApplet.getUserid()); |
| | | return R.ok(walletVO); |
| | | } |
| | | |
| | | /** |
| | | * 变更明细 |
| | | */ |
| | | @ApiOperation(value = "变更明细", notes = "变更明细") |
| | | @GetMapping("change") |
| | | public R<List<BalanceChangeRecord>> change(@ApiParam(value = "变更类型") |
| | | @RequestParam(required = false) Integer changeType, |
| | | @ApiParam(value = "创建时间") |
| | | @RequestParam(required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | LocalDate createTime) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | if (createTime != null) { |
| | | // 将 createTime 设置为当天的开始时间 (00:00) |
| | | startTime = createTime.atStartOfDay(); |
| | | |
| | | // 使用 YearMonth 来获取该月的最后一天 |
| | | YearMonth yearMonth = YearMonth.from(createTime); |
| | | LocalDate lastDayOfMonth = yearMonth.atEndOfMonth(); |
| | | |
| | | // 将最后一天转换为 LocalDateTime,并设置为当天的最后一秒 (23:59:59.999) |
| | | endTime = lastDayOfMonth.atTime(LocalTime.MAX); |
| | | } |
| | | |
| | | List<BalanceChangeRecord> list = balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>() |
| | | .eq(changeType != null, BalanceChangeRecord::getChangeType, changeType) |
| | | .between(startTime != null, BalanceChangeRecord::getCreateTime, startTime, endTime) |
| | | .eq(BalanceChangeRecord::getAppUserId, userId)); |
| | | |
| | | List<Long> orderIds = list.stream().map(BalanceChangeRecord::getOrderId).collect(Collectors.toList()); |
| | | R<List<Order>> r = remoteOrderGoodsClient.getOrderListByIds(orderIds); |
| | | if (!R.isSuccess(r)){ |
| | | return R.fail(r.getMsg()); |
| | | } |
| | | List<Order> orderList = r.getData(); |
| | | list.forEach(bc -> { |
| | | orderList.stream().filter(o -> o.getId().equals(bc.getOrderId())).findFirst().ifPresent(o -> { |
| | | Long appUserId = o.getAppUserId(); |
| | | AppUser appUser = appUserService.getById(appUserId); |
| | | bc.setUserName(appUser.getName()); |
| | | bc.setAmount(o.getPaymentAmount()); |
| | | }); |
| | | }); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | // /** |
| | | // * 充值 |
| | | // */ |
| | | // @GetMapping("recharge") |
| | | // @ApiOperation(value = "充值", notes = "钱包充值") |
| | | // public AjaxResult recharge(@ApiParam(value = "充值金额", required = true) @RequestParam BigDecimal amount) { |
| | | // Long userId = SecurityUtils.getUserId(); |
| | | // String openId; |
| | | // // 商户号 |
| | | // String partnerTradeNo; |
| | | // // TODO 充值 |
| | | // return AjaxResult.success(); |
| | | // } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.dto.WithdrawalRequestsDTO; |
| | | import com.ruoyi.account.service.WithdrawalRequestsService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/withdrawal-requests") |
| | | @Api(tags = "提现申请") |
| | | public class WithdrawalRequestsController { |
| | | |
| | | @Resource |
| | | private WithdrawalRequestsService withdrawalRequestsService; |
| | | |
| | | /** |
| | | * 提现申请 |
| | | */ |
| | | @PostMapping("/withdrawalApply") |
| | | @ApiOperation(value = "提现申请", tags = {"提现申请-小程序"}) |
| | | public AjaxResult withdrawalApply(@RequestBody WithdrawalRequestsDTO params){ |
| | | withdrawalRequestsService.withdrawalApply(params); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.account.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @ApiModel(value="提现申请对象", description="") |
| | | @Data |
| | | public class WithdrawalRequestsDTO { |
| | | |
| | | @ApiModelProperty(value = "提现金额") |
| | | private BigDecimal withdrawalAmount; |
| | | |
| | | @ApiModelProperty(value = "1微信2银行卡") |
| | | private Integer withdrawalMethod; |
| | | |
| | | @ApiModelProperty(value = "开户人") |
| | | private String accountHolder; |
| | | |
| | | @ApiModelProperty(value = "银行卡号") |
| | | private String bankCardNumber; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | AppUser appUser = appUserService.getById(userid); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | |
| | | } |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.AgentApplication; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface AgentApplicationMapper extends BaseMapper<AgentApplication> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.vo.NearbyReferrer; |
| | | import com.ruoyi.account.vo.NearbyReferrerVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface AppUserMapper extends BaseMapper<AppUser> { |
| | | |
| | | |
| | | /** |
| | | * 获取附件推广人 |
| | | * @param cityCode |
| | | * @return |
| | | */ |
| | | List<NearbyReferrerVo> getNearbyReferrer(@Param("cityCode") String cityCode, @Param("nearbyReferrer") NearbyReferrer nearbyReferrer); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | |
| | | public interface BalanceChangeRecordMapper extends BaseMapper<BalanceChangeRecord> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserAddressMapper extends BaseMapper<UserAddress> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserCancellationLogMapper extends BaseMapper<UserCancellationLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserChangeLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserChangeLogMapper extends BaseMapper<UserChangeLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserClickLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserClickLogMapper extends BaseMapper<UserClickLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserCouponMapper extends BaseMapper<UserCoupon> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserPointMapper extends BaseMapper<UserPoint> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserSignRecordMapper extends BaseMapper<UserSignRecord> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface WithdrawalRequestsMapper extends BaseMapper<WithdrawalRequests> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.AgentApplication; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface AgentApplicationService extends IService<AgentApplication> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface AppUserService extends IService<AppUser> { |
| | | |
| | | |
| | | /** |
| | | * 小程序一键登录 |
| | | * @param appletLogin |
| | | * @return |
| | | */ |
| | | R appletLogin(AppletLogin appletLogin); |
| | | |
| | | |
| | | /** |
| | | * 手机号码登录 |
| | | * @param mobileLogin |
| | | * @return |
| | | */ |
| | | R<LoginVo> mobileLogin(MobileLogin mobileLogin); |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * @param smsCode |
| | | * @return |
| | | */ |
| | | R getSMSCode(SMSCode smsCode); |
| | | |
| | | |
| | | /** |
| | | * 注册账号 |
| | | * @param registerAccount |
| | | * @return |
| | | */ |
| | | R<LoginVo> registerAccount(RegisterAccount registerAccount); |
| | | |
| | | |
| | | /** |
| | | * 获取附近的推广人 |
| | | * @param nearbyReferrer |
| | | * @return |
| | | */ |
| | | List<NearbyReferrerVo> getNearbyReferrer(NearbyReferrer nearbyReferrer); |
| | | |
| | | /** |
| | | * 获取用户的祖籍列表 |
| | | */ |
| | | List<AppUser> getUserAncestorList(Long id,List<AppUser> list); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | |
| | | public interface BalanceChangeRecordService extends IService<BalanceChangeRecord> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserAddressService extends IService<UserAddress> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserCancellationLogService extends IService<UserCancellationLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserChangeLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserChangeLogService extends IService<UserChangeLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserClickLog; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserClickLogService extends IService<UserClickLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCouponVo; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserCouponService extends IService<UserCoupon> { |
| | | |
| | | /** |
| | | * 获取用户支付页面的优惠券列表 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<PaymentUserCouponVo> getUserCoupon(Long userId, Integer type); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserPointService extends IService<UserPoint> { |
| | | |
| | | UserPointVO getUserPoint(Long userId); |
| | | |
| | | |
| | | List<UserPointDetailVO> getUserPointDetail(Long userId, LocalDateTime date, Integer type); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface UserSignRecordService extends IService<UserSignRecord> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.ruoyi.account.vo.WalletVO; |
| | | |
| | | public interface WalletService { |
| | | |
| | | WalletVO getWalletByUserId(Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | import com.ruoyi.account.dto.WithdrawalRequestsDTO; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | public interface WithdrawalRequestsService extends IService<WithdrawalRequests> { |
| | | |
| | | /** |
| | | * 提现申请 |
| | | */ |
| | | void withdrawalApply(WithdrawalRequestsDTO params); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.AgentApplication; |
| | | import com.ruoyi.account.mapper.AgentApplicationMapper; |
| | | import com.ruoyi.account.service.AgentApplicationService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class AgentApplicationServiceImpl extends ServiceImpl<AgentApplicationMapper, AgentApplication> implements AgentApplicationService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.AppUserShop; |
| | | import com.ruoyi.account.mapper.AppUserMapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.AppUserShopService; |
| | | import com.ruoyi.account.util.weChat.WeChatUtil; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements AppUserService { |
| | | |
| | | @Resource |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | |
| | | @Resource |
| | | private AppUserShopService appUserShopService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 小程序一键登录 |
| | | * @param appletLogin |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R appletLogin(AppletLogin appletLogin) { |
| | | //使用jscode获取微信openid |
| | | Map<String, Object> map = weChatUtil.code2Session(appletLogin.getJscode()); |
| | | Integer errcode = Integer.valueOf(map.get("errcode").toString()); |
| | | if(0 != errcode){ |
| | | return R.fail(map.get("msg").toString()); |
| | | } |
| | | String openid = map.get("openid").toString(); |
| | | //查询用户是否注册,没有注册则跳转到注册页面 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null == appUser){ |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(2); |
| | | return R.ok(loginVo); |
| | | } |
| | | //账户被冻结,给出提示 |
| | | if(2 == appUser.getStatus()){ |
| | | return R.fail("账户已被冻结,请联系管理员!"); |
| | | } |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | | loginVo.setFirstTime(false); |
| | | loginVo.setPhone(appUser.getPhone()); |
| | | //构建token |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setUserid(appUser.getId()); |
| | | loginUser.setUsername(appUser.getName()); |
| | | Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser); |
| | | loginVo.setToken(tokenApplet.get("access_token").toString()); |
| | | loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); |
| | | return R.ok(loginVo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手机号码登录 |
| | | * @param mobileLogin |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R<LoginVo> mobileLogin(MobileLogin mobileLogin) { |
| | | //校验验证码 TODO 待完善 |
| | | // String code = redisService.getCacheObject(mobileLogin.getPhone()); |
| | | // if(null == code || !code.equals(mobileLogin.getCode())){ |
| | | // return R.fail("验证码错误"); |
| | | // } |
| | | |
| | | //查询用户是否注册,没有注册则跳转到注册页面 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null == appUser){ |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(2); |
| | | return R.ok(loginVo); |
| | | } |
| | | //账户被冻结,给出提示 |
| | | if(2 == appUser.getStatus()){ |
| | | return R.fail("账户已被冻结,请联系管理员!"); |
| | | } |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | | loginVo.setFirstTime(false); |
| | | loginVo.setPhone(appUser.getPhone()); |
| | | //构建token |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setUserid(appUser.getId()); |
| | | loginUser.setUsername(appUser.getName()); |
| | | Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser); |
| | | loginVo.setToken(tokenApplet.get("access_token").toString()); |
| | | loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); |
| | | return R.ok(loginVo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * @param smsCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getSMSCode(SMSCode smsCode) { |
| | | //校验验证码获取评率(1分钟5次) |
| | | String key = smsCode.getType() + "&" + smsCode.getPhone(); |
| | | Map<String, Object> cacheMap = redisService.getCacheMap(key); |
| | | if(null != cacheMap){ |
| | | Integer number = Integer.valueOf(cacheMap.get("number").toString()) + 1; |
| | | Long startTime = Long.valueOf(cacheMap.get("startTime").toString()); |
| | | if(number > 5 && (System.currentTimeMillis() - startTime) < 60000){ |
| | | return R.fail("获取验证码太频繁,请稍后重试!"); |
| | | } |
| | | if(number <= 5){ |
| | | cacheMap.put("number", number); |
| | | }else{ |
| | | cacheMap.put("number", 1); |
| | | cacheMap.put("startTime", System.currentTimeMillis()); |
| | | } |
| | | }else{ |
| | | cacheMap = new HashMap<>(); |
| | | cacheMap.put("number", 1); |
| | | cacheMap.put("startTime", System.currentTimeMillis()); |
| | | } |
| | | //存储计数器到缓存中,5分钟有效期 |
| | | redisService.setCacheMap(key, cacheMap, 300); |
| | | |
| | | //开始构建验证码内容 |
| | | String code = ""; |
| | | for (int i = 0; i < 6; i++) { |
| | | code += Double.valueOf(Math.random() * 10).intValue(); |
| | | } |
| | | //发送短信 todo 待对接短信 |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注册账号 |
| | | * @param registerAccount |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R<LoginVo> registerAccount(RegisterAccount registerAccount) { |
| | | // TODO 待完善 |
| | | //校验验证码 |
| | | // String code = redisService.getCacheObject(registerAccount.getPhone()); |
| | | // if(null == code || !code.equals(registerAccount.getCode())){ |
| | | // return R.fail("验证码错误"); |
| | | // } |
| | | //使用jscode获取微信openid |
| | | // Map<String, Object> map = weChatUtil.code2Session(registerAccount.getJscode()); |
| | | // Integer errcode = Integer.valueOf(map.get("errcode").toString()); |
| | | // if(0 != errcode){ |
| | | // return R.fail(map.get("msg").toString()); |
| | | // } |
| | | // String openid = map.get("openid").toString(); |
| | | // //查询用户是否注册 |
| | | // AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | // if(null != appUser){ |
| | | // return R.fail("此微信号已注册,请直接登录!"); |
| | | // } |
| | | AppUser appUser = null; |
| | | AppUser appUser1 = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, registerAccount.getPhone()).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null != appUser1){ |
| | | return R.fail("手机号已注册,请直接登录!"); |
| | | } |
| | | if(null == appUser){ |
| | | appUser = new AppUser(); |
| | | appUser.setName(registerAccount.getName()); |
| | | appUser.setPhone(registerAccount.getPhone()); |
| | | // appUser.setWxOpenid(openid); |
| | | //注册默认为普通会员 |
| | | appUser.setVipId(1); |
| | | appUser.setStatus(1); |
| | | appUser.setCreateTime(LocalDateTime.now()); |
| | | appUser.setDelFlag(false); |
| | | appUser.setFirstAdd(1); |
| | | appUser.setLastLoginTime(LocalDateTime.now()); |
| | | //顶级推广人 |
| | | AppUser topAppUser = getTopAppUser(registerAccount.getPromoter()); |
| | | appUser.setTopInviteId(topAppUser.getId()); |
| | | //绑定门店为推荐人绑定的门店 |
| | | AppUser appUser2 = this.getById(registerAccount.getPromoter()); |
| | | appUser.setInviteUserId(registerAccount.getPromoter()); |
| | | appUser.setShopId(appUser2.getShopId()); |
| | | appUser.setPartPoint(0); |
| | | appUser.setPartGrowPoint(0); |
| | | appUser.setShopPoint(0); |
| | | appUser.setSharePoint(0); |
| | | appUser.setShopAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawableAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawnAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRechargeAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRedPacketAmount(BigDecimal.ZERO); |
| | | appUser.setTotalDistributionAmount(BigDecimal.ZERO); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | appUser.setLavePoint(0); |
| | | //根据平台的配置未达标,则标注为可修改推广人 |
| | | appUser.setChangePromoter(0); |
| | | appUser.setLongitude(registerAccount.getLongitude()); |
| | | appUser.setLatitude(registerAccount.getLatitude()); |
| | | //调用地图获取省市区数据 TODO 待完善 |
| | | // appUser.setProvince(); |
| | | // appUser.setProvinceCode(); |
| | | // appUser.setCity(); |
| | | // appUser.setCityCode(); |
| | | // appUser.setDistrict(); |
| | | // appUser.setDistrictCode(); |
| | | this.save(appUser); |
| | | |
| | | //查询当前注册的手机号是都和门店管理员手机号相同 |
| | | Shop shop = shopClient.getShopByPhone(registerAccount.getPhone()).getData(); |
| | | if(null != shop){ |
| | | //添加门店用户关系数据 |
| | | AppUserShop appUserShop = appUserShopService.getOne(new LambdaQueryWrapper<AppUserShop>().eq(AppUserShop::getAppUserId, appUser.getId()).eq(AppUserShop::getShopId, shop.getId())); |
| | | if(null == appUserShop){ |
| | | appUserShop = new AppUserShop(); |
| | | appUserShop.setShopId(shop.getId()); |
| | | appUserShop.setAppUserId(appUser.getId()); |
| | | appUserShopService.save(appUserShop); |
| | | //添加管理后台账号 |
| | | SysUser user = new SysUser(); |
| | | user.setDeptId(1L); |
| | | user.setUserName(appUser.getName()); |
| | | user.setNickName(appUser.getName()); |
| | | user.setPhonenumber(appUser.getPhone()); |
| | | user.setAvatar(appUser.getAvatar()); |
| | | user.setStatus("0"); |
| | | user.setDelFlag("0"); |
| | | user.setRoleType(2); |
| | | user.setObjectId(shop.getId()); |
| | | user.setAppUserId(appUser.getId()); |
| | | sysUserClient.saveShopUser(user); |
| | | } |
| | | } |
| | | |
| | | } |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | | loginVo.setFirstTime(false); |
| | | loginVo.setPhone(appUser.getPhone()); |
| | | //构建token |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setUserid(appUser.getId()); |
| | | loginUser.setUsername(appUser.getName()); |
| | | Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser); |
| | | loginVo.setToken(tokenApplet.get("access_token").toString()); |
| | | loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); |
| | | return R.ok(loginVo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 递归查询顶级推广人 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public AppUser getTopAppUser(Long id){ |
| | | List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0)); |
| | | return getTopAppUser(list, id); |
| | | } |
| | | |
| | | public AppUser getTopAppUser(List<AppUser> list, Long id){ |
| | | AppUser appUser = list.stream().filter(s -> s.getId().equals(id)).findFirst().get(); |
| | | if(null == appUser.getInviteUserId()){ |
| | | return appUser; |
| | | } |
| | | return getTopAppUser(list, appUser.getInviteUserId()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取附近推广人 |
| | | * @param nearbyReferrer |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<NearbyReferrerVo> getNearbyReferrer(NearbyReferrer nearbyReferrer) { |
| | | //使用地图获取省市区数据 |
| | | String longitude = nearbyReferrer.getLongitude(); |
| | | String latitude = nearbyReferrer.getLatitude(); |
| | | String cityCode = ""; // TODO 待完善 |
| | | List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<AppUser> getUserAncestorList(Long id, List<AppUser> list) { |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | |
| | | Set<Long> visitedIds = new HashSet<>(); |
| | | Long currentId = id; |
| | | |
| | | while (currentId != null && !visitedIds.contains(currentId)) { |
| | | AppUser appUser = getById(currentId); |
| | | if (appUser == null) { |
| | | break; // 如果用户不存在,终止循环 |
| | | } |
| | | |
| | | Long inviteUserId = appUser.getInviteUserId(); |
| | | if (inviteUserId != null) { |
| | | AppUser invitedUser = getById(inviteUserId); |
| | | if (invitedUser != null) { |
| | | list.add(invitedUser); |
| | | visitedIds.add(currentId); |
| | | currentId = inviteUserId; |
| | | } else { |
| | | break; // 如果邀请用户不存在,终止循环 |
| | | } |
| | | } else { |
| | | break; // 如果没有邀请用户,终止循环 |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.mapper.BalanceChangeRecordMapper; |
| | | import com.ruoyi.account.service.BalanceChangeRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class BalanceChangeRecordServiceImpl extends ServiceImpl<BalanceChangeRecordMapper, BalanceChangeRecord> implements BalanceChangeRecordService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.mapper.UserAddressMapper; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.account.service.UserAddressService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserAddress> implements UserAddressService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.mapper.UserCancellationLogMapper; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserCancellationLogServiceImpl extends ServiceImpl<UserCancellationLogMapper, UserCancellationLog> implements UserCancellationLogService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.mapper.UserChangeLogMapper; |
| | | import com.ruoyi.account.api.model.UserChangeLog; |
| | | import com.ruoyi.account.service.UserChangeLogService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserChangeLogServiceImpl extends ServiceImpl<UserChangeLogMapper, UserChangeLog> implements UserChangeLogService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.mapper.UserClickLogMapper; |
| | | import com.ruoyi.account.api.model.UserClickLog; |
| | | import com.ruoyi.account.service.UserClickLogService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserClickLogServiceImpl extends ServiceImpl<UserClickLogMapper, UserClickLog> implements UserClickLogService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCouponVo; |
| | | import com.ruoyi.account.mapper.UserCouponMapper; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.api.feignClient.CouponInfoClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.Instant; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserCouponServiceImpl extends ServiceImpl<UserCouponMapper, UserCoupon> implements UserCouponService { |
| | | |
| | | @Resource |
| | | private CouponInfoClient couponInfoClient; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取支付页面的优惠券列表数据 |
| | | * @param userId |
| | | * @param orderMoney |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PaymentUserCouponVo> getUserCoupon(Long userId, Integer type) { |
| | | List<UserCoupon> list = this.list(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getAppUserId, userId).eq(UserCoupon::getDelFlag, 0) |
| | | .last(" and now() between start_time and end_time")); |
| | | List<Integer> couponIds = list.stream().map(UserCoupon::getCouponId).collect(Collectors.toList()); |
| | | if(couponIds.size() == 0){ |
| | | return null; |
| | | } |
| | | List<CouponInfo> couponInfoList = couponInfoClient.getCouponInfoList(couponIds).getData(); |
| | | //构建返回数据 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | List<PaymentUserCouponVo> infoVoList = new ArrayList<>(); |
| | | for (UserCoupon userCoupon : list) { |
| | | CouponInfo couponInfo = couponInfoList.stream().filter(s -> s.getId().equals(userCoupon.getCouponId())).findFirst().get(); |
| | | //排除商品券(商品券线下领取) |
| | | if(4 == couponInfo.getCouponType()){ |
| | | continue; |
| | | } |
| | | PaymentUserCouponVo couponInfoVo = new PaymentUserCouponVo(); |
| | | couponInfoVo.setId(userCoupon.getId()); |
| | | couponInfoVo.setName(couponInfo.getCouponName()); |
| | | couponInfoVo.setCouponType(couponInfo.getCouponType()); |
| | | couponInfoVo.setConditionAmount(couponInfo.getConditionAmount()); |
| | | couponInfoVo.setDiscountAmount(couponInfo.getDiscountAmount()); |
| | | couponInfoVo.setMoneyAmount(couponInfo.getMoneyAmount()); |
| | | couponInfoVo.setDiscount(couponInfo.getDiscount()); |
| | | couponInfoVo.setPeriodEndTime(couponInfo.getPeriodStartTime().format(formatter)); |
| | | couponInfoVo.setPeriodEndTime(couponInfo.getPeriodEndTime().format(formatter)); |
| | | String forGoodIds = couponInfo.getForGoodIds(); |
| | | Integer instant = JSON.parseArray(forGoodIds).getInteger(0); |
| | | if(-1 == instant){ |
| | | couponInfoVo.setForGoodIds(null); |
| | | }else{ |
| | | couponInfoVo.setForGoodIds(JSON.parseArray(forGoodIds, Integer.class)); |
| | | } |
| | | couponInfoVo.setAvailable(false); |
| | | infoVoList.add(couponInfoVo); |
| | | } |
| | | return infoVoList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.enums.PointChangeType; |
| | | import com.ruoyi.account.mapper.UserPointMapper; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserPointServiceImpl extends ServiceImpl<UserPointMapper, UserPoint> implements UserPointService { |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Override |
| | | public UserPointVO getUserPoint(Long userId) { |
| | | AppUser appUser = appUserClient.getAppUserById(userId); |
| | | List<UserPoint> userPointList = list(new LambdaQueryWrapper<UserPoint>() |
| | | .eq(UserPoint::getAppUserId, userId)); |
| | | |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | |
| | | Integer lavePoint = appUser.getLavePoint(); |
| | | UserPointVO userPointVO = new UserPointVO(); |
| | | userPointVO.setTotalPoint(lavePoint); |
| | | userPointVO.setShopPoint(userBalanceMap.get(PointChangeType.CONSUME.getCode())); |
| | | userPointVO.setSharePoint(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode())); |
| | | userPointVO.setPullNewPoint(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode())); |
| | | userPointVO.setShopAchievementPoint(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode())); |
| | | userPointVO.setShopSharePoint(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode())); |
| | | return userPointVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<UserPointDetailVO> getUserPointDetail(Long userId, LocalDateTime date, Integer type) { |
| | | List<UserPoint> userPointList = list(new LambdaQueryWrapper<UserPoint>() |
| | | .eq(UserPoint::getAppUserId, userId)); |
| | | if (CollectionUtil.isNotEmpty(userPointList)) { |
| | | return userPointList.stream().map(p -> { |
| | | UserPointDetailVO userPointDetailVO = new UserPointDetailVO(); |
| | | userPointDetailVO.setType(p.getType()); |
| | | userPointDetailVO.setVariablePoint(p.getVariablePoint()); |
| | | userPointDetailVO.setCreateTime(p.getCreateTime()); |
| | | return userPointDetailVO; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.mapper.UserSignRecordMapper; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | import com.ruoyi.account.service.UserSignRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class UserSignRecordServiceImpl extends ServiceImpl<UserSignRecordMapper, UserSignRecord> implements UserSignRecordService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.enums.WithdrawalAuditStatus; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.WalletService; |
| | | import com.ruoyi.account.service.WithdrawalRequestsService; |
| | | import com.ruoyi.account.vo.WalletVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class WalletServiceImpl implements WalletService { |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private RemoteVipSettingClient remoteVipSettingClient; |
| | | @Resource |
| | | private WithdrawalRequestsService withdrawalRequestsService; |
| | | |
| | | @Override |
| | | public WalletVO getWalletByUserId(Long userId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | if (appUser == null) { |
| | | throw new RuntimeException("用户不存在"); |
| | | } |
| | | Integer vipId = appUser.getVipId(); |
| | | R<VipSetting> r = remoteVipSettingClient.getVipSettingById(vipId); |
| | | VipSetting data = r.getData(); |
| | | if (data == null) { |
| | | throw new RuntimeException("会员设置信息为空"); |
| | | } |
| | | |
| | | // 获取提现审核中的金额 |
| | | List<WithdrawalRequests> waitAuditList = withdrawalRequestsService.list(new LambdaQueryWrapper<WithdrawalRequests>() |
| | | .eq(WithdrawalRequests::getAppUserId, userId) |
| | | .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT)); |
| | | |
| | | WalletVO walletVO = new WalletVO(); |
| | | walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount()); |
| | | walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount()); |
| | | walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount()); |
| | | walletVO.setTotalRechargeAmount(appUser.getTotalRechargeAmount()); |
| | | walletVO.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount()); |
| | | walletVO.setTotalDistributionAmount(appUser.getTotalDistributionAmount()); |
| | | walletVO.setAuditAmount(waitAuditList.stream() |
| | | .map(WithdrawalRequests::getWithdrawalAmount) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | |
| | | return walletVO; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.dto.WithdrawalRequestsDTO; |
| | | import com.ruoyi.account.mapper.WithdrawalRequestsMapper; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | import com.ruoyi.account.service.WithdrawalRequestsService; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-21 |
| | | */ |
| | | @Service |
| | | public class WithdrawalRequestsServiceImpl extends ServiceImpl<WithdrawalRequestsMapper, WithdrawalRequests> implements WithdrawalRequestsService { |
| | | |
| | | @Override |
| | | public void withdrawalApply(WithdrawalRequestsDTO params) { |
| | | WithdrawalRequests withdrawalRequests = new WithdrawalRequests(); |
| | | BeanUtils.copyBeanProp(withdrawalRequests, params); |
| | | withdrawalRequests.setDelFlag(0); |
| | | withdrawalRequests.setAppUserId(SecurityUtils.getUserId()); |
| | | withdrawalRequests.setAuditStatus(1); |
| | | save(withdrawalRequests); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util.weChat; |
| | | |
| | | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 定时任务工具类 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void sendVipCoupon(){ |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void changeVipId(){ |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util.weChat; |
| | | |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.security.*; |
| | | |
| | | /** |
| | | * AES加密 |
| | | * @author pzb |
| | | * @Date 2021/12/3 15:43 |
| | | */ |
| | | public class AES { |
| | | |
| | | public static boolean initialized = false; |
| | | |
| | | /** |
| | | * AES解密 |
| | | * |
| | | * @param content |
| | | * 密文 |
| | | * @return |
| | | * @throws InvalidAlgorithmParameterException |
| | | * @throws NoSuchProviderException |
| | | */ |
| | | public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException { |
| | | initialize(); |
| | | try { |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); |
| | | Key sKeySpec = new SecretKeySpec(keyByte, "AES"); |
| | | cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 初始化 |
| | | byte[] result = cipher.doFinal(content); |
| | | return result; |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchProviderException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void initialize() { |
| | | if (initialized) |
| | | return; |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | initialized = true; |
| | | } |
| | | |
| | | // 生成iv |
| | | public static AlgorithmParameters generateIV(byte[] iv) throws Exception { |
| | | AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); |
| | | params.init(new IvParameterSpec(iv)); |
| | | return params; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util.weChat; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | public class WXCore { |
| | | |
| | | private static final String WATERMARK = "watermark"; |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private static String appid ; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 解密数据 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decrypt(String encryptedData, String sessionKey, String iv){ |
| | | String result = ""; |
| | | try { |
| | | AES aes = new AES(); |
| | | byte[] resultByte = aes.decrypt(Base64.decodeBase64(encryptedData), Base64.decodeBase64(sessionKey), Base64.decodeBase64(iv)); |
| | | if(null != resultByte && resultByte.length > 0){ |
| | | result = new String(WxPKCS7Encoder.decode(resultByte), "UTF-8"); |
| | | // JSONObject jsonObject = JSON.parseObject(result); |
| | | // String decryptAppid = jsonObject.getJSONObject(WATERMARK).getString("appid"); |
| | | // if(!appid.equals(decryptAppid)){ |
| | | // result = ""; |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | result = ""; |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | String appId = "wx4f4bc4dec97d474b"; |
| | | String encryptedData = "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew=="; |
| | | String sessionKey = "tiihtNczf5v6AKRyjwEUhQ=="; |
| | | String iv = "r7BXXKkLb8qrSNn05n0qiA=="; |
| | | System.out.println(decrypt(encryptedData, sessionKey, iv)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util.weChat; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 微信工具类 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class WeChatUtil { |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String wxAppletsAppid; |
| | | |
| | | @Value("${wx.appletsAppSecret}") |
| | | private String wxAppletsAppSecret; |
| | | |
| | | // @Value("${wx.appid}") |
| | | private String webAppId; |
| | | |
| | | // @Value("${wx.appSecret}") |
| | | private String webAppSecret; |
| | | |
| | | |
| | | /** |
| | | * 小程序使用jscode获取openid |
| | | * @param jscode |
| | | * @return |
| | | */ |
| | | public Map<String, Object> code2Session(String jscode) { |
| | | String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret |
| | | + "&js_code=" + jscode + "&grant_type=authorization_code"; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | HttpResponse response = get.execute(); |
| | | int status = response.getStatus(); |
| | | if(200 != status){ |
| | | throw new RuntimeException(response.body()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response.body()); |
| | | int errcode = jsonObject.getIntValue("errcode"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("errcode", errcode); |
| | | if(errcode == 0){//成功 |
| | | map.put("openid", jsonObject.getString("openid")); |
| | | map.put("sessionKey", jsonObject.getString("session_key")); |
| | | map.put("unionid", jsonObject.getString("unionid")); |
| | | return map; |
| | | } |
| | | if(errcode == -1){//系统繁忙,此时请开发者稍候再试 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 40029){//code 无效 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 45011){//频率限制,每个用户每分钟100次 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取微信小程序token |
| | | * @return |
| | | */ |
| | | public String getWxAppletsAccessToken() throws Exception{ |
| | | String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | HttpResponse response = get.execute(); |
| | | if(response.getStatus() != 200){ |
| | | return ""; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response.body()); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 网站应用登录 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public Map<String, String> webAccessToken(String code) throws Exception{ |
| | | String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + webAppId + "&secret=" + webAppSecret + "&code=" + code + "&grant_type=authorization_code"; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | HttpResponse response = get.execute(); |
| | | if(response.getStatus() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response.body()); |
| | | int errcode = jsonObject.getIntValue("errcode"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if(errcode == 0){//成功 |
| | | map.put("access_token", jsonObject.getString("access_token")); |
| | | map.put("openid", jsonObject.getString("openid")); |
| | | map.put("refresh_token", jsonObject.getString("refresh_token")); |
| | | map.put("unionid", jsonObject.getString("unionid")); |
| | | return map; |
| | | } |
| | | if(errcode == -1){//系统繁忙,此时请开发者稍候再试 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 40029){//code 无效 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 45011){//频率限制,每个用户每分钟100次 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取微信个人信息 |
| | | * @param access_token |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | public Map<String, Object> getUserInfo(String access_token, String openid) throws Exception{ |
| | | String url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | HttpResponse response = get.execute(); |
| | | if(response.getStatus() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response.body()); |
| | | int errcode = jsonObject.getIntValue("errcode"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(errcode == 0){//成功 |
| | | map.put("nickname", jsonObject.getString("nickname")); |
| | | map.put("openid", jsonObject.getString("openid")); |
| | | map.put("sex", jsonObject.getString("sex")); |
| | | map.put("headimgurl", jsonObject.getString("headimgurl")); |
| | | return map; |
| | | } |
| | | if(errcode == -1){//系统繁忙,此时请开发者稍候再试 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 40029){//code 无效 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 45011){//频率限制,每个用户每分钟100次 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // /** |
| | | // * 获取小程序二维码 |
| | | // * @param page 跳转页 例如 pages/index/index |
| | | // * @param scene 参数 a=1&b=2 |
| | | // */ |
| | | // public InputStream getwxacodeunlimit(String page, String scene){ |
| | | // try { |
| | | // String token = getWxAppletsAccessToken(); |
| | | // if(StringUtils.isEmpty(token)){ |
| | | // System.err.println("获取接口调用凭证失败"); |
| | | // } |
| | | // String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + token; |
| | | // Map<String, Object> param = new HashMap<>(); |
| | | // param.put("scene", scene); |
| | | // param.put("page", page); |
| | | // HttpHeaders httpHeaders = new HttpHeaders(); |
| | | // MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); |
| | | // httpHeaders.setContentType(type); |
| | | // HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders); |
| | | // ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class, new Object[0]); |
| | | // String body1 = exchange.getBody(); |
| | | //// System.err.println(body1); |
| | | // ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | // byte[] body = entity.getBody(); |
| | | //// System.err.println(Base64.encodeBase64String(body)); |
| | | // return new ByteArrayInputStream(body); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.util.weChat; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 微信小程序加解密 |
| | | * @author pzb |
| | | * @Date 2021/12/3 15:43 |
| | | */ |
| | | public class WxPKCS7Encoder { |
| | | private static final Charset CHARSET = Charset.forName("utf-8"); |
| | | private static final int BLOCK_SIZE = 32; |
| | | |
| | | /** |
| | | * 获得对明文进行补位填充的字节. |
| | | * |
| | | * @param count |
| | | * 需要进行填充补位操作的明文字节个数 |
| | | * @return 补齐用的字节数组 |
| | | */ |
| | | public static byte[] encode(int count) { |
| | | // 计算需要填充的位数 |
| | | int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); |
| | | if (amountToPad == 0) { |
| | | amountToPad = BLOCK_SIZE; |
| | | } |
| | | // 获得补位所用的字符 |
| | | char padChr = chr(amountToPad); |
| | | String tmp = new String(); |
| | | for (int index = 0; index < amountToPad; index++) { |
| | | tmp += padChr; |
| | | } |
| | | return tmp.getBytes(CHARSET); |
| | | } |
| | | |
| | | /** |
| | | * 删除解密后明文的补位字符 |
| | | * |
| | | * @param decrypted |
| | | * 解密后的明文 |
| | | * @return 删除补位字符后的明文 |
| | | */ |
| | | public static byte[] decode(byte[] decrypted) { |
| | | int pad = decrypted[decrypted.length - 1]; |
| | | if (pad < 1 || pad > 32) { |
| | | pad = 0; |
| | | } |
| | | return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); |
| | | } |
| | | |
| | | /** |
| | | * 将数字转化成ASCII码对应的字符,用于对明文进行补码 |
| | | * |
| | | * @param a |
| | | * 需要转化的数字 |
| | | * @return 转化得到的字符 |
| | | */ |
| | | public static char chr(int a) { |
| | | byte target = (byte) (a & 0xFF); |
| | | return (char) target; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/21 11:40 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class AppletLogin { |
| | | @ApiModelProperty(value = "微信jscode", required = true) |
| | | private String jscode; |
| | | @ApiModelProperty(value = "手机号加密数据", required = true) |
| | | private String encryptedData_phone; |
| | | @ApiModelProperty(value = "加密算法的初始向量", required = true) |
| | | private String iv_phone; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 9:39 |
| | | */ |
| | | @Data |
| | | @ApiModel("登录结果") |
| | | public class LoginVo { |
| | | @ApiModelProperty("token") |
| | | private String token; |
| | | @ApiModelProperty("失效时间(秒)") |
| | | private Long failureTime; |
| | | @ApiModelProperty("跳转页面(1=首页,2=注册页)") |
| | | private Integer skipPage; |
| | | @ApiModelProperty("微信解密的手机号") |
| | | private String phone; |
| | | @ApiModelProperty("是否首次登录") |
| | | private Boolean firstTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 9:48 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MobileLogin { |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("短信验证码") |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 10:36 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class NearbyReferrer extends BasePage { |
| | | @ApiModelProperty(value = "经度", required = true) |
| | | private String longitude; |
| | | @ApiModelProperty(value = "纬度", required = true) |
| | | private String latitude; |
| | | @ApiModelProperty(value = "搜索内容", required = false) |
| | | private String name; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 10:42 |
| | | */ |
| | | @Data |
| | | @ApiModel("附近推荐人") |
| | | public class NearbyReferrerVo { |
| | | @ApiModelProperty("id") |
| | | private String id; |
| | | @ApiModelProperty("头像") |
| | | private String avatar; |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("会员类型名称") |
| | | private String vip; |
| | | @ApiModelProperty("距离(m)") |
| | | private BigDecimal distance; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 10:03 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class RegisterAccount { |
| | | @ApiModelProperty(value = "微信jscode", required = true) |
| | | private String jscode; |
| | | @ApiModelProperty(value = "推广人id", required = true) |
| | | private Long promoter; |
| | | @ApiModelProperty(value = "头像", required = true) |
| | | private String avatar; |
| | | @ApiModelProperty(value = "姓名", required = true) |
| | | private String name; |
| | | @ApiModelProperty(value = "手机号", required = true) |
| | | private String phone; |
| | | @ApiModelProperty(value = "短信验证码", required = true) |
| | | private String code; |
| | | @ApiModelProperty(value = "经度", required = true) |
| | | private String longitude; |
| | | @ApiModelProperty(value = "纬度", required = true) |
| | | private String latitude; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 9:53 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class SMSCode { |
| | | @ApiModelProperty("类型(1=登录注册)") |
| | | private Integer type; |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value="UserPointDetail对象", description="") |
| | | public class UserPointDetailVO { |
| | | |
| | | @ApiModelProperty(value = "变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 5 = 门店业绩积分 6 =门店返佣积分7=技师业绩积分8 =转赠积分 9 =做工积分 10 =注册积分)") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "变动金额") |
| | | private Integer variablePoint; |
| | | |
| | | @ApiModelProperty(value = "变动时间") |
| | | private LocalDateTime createTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value="UserPoint对象", description="") |
| | | public class UserPointVO { |
| | | |
| | | @ApiModelProperty(value = "总积分") |
| | | private Integer totalPoint; |
| | | |
| | | @ApiModelProperty(value = "消费积分数") |
| | | private Integer shopPoint; |
| | | |
| | | @ApiModelProperty(value = "返佣积分数") |
| | | private Integer sharePoint; |
| | | |
| | | @ApiModelProperty(value = "拉新积分") |
| | | private Integer pullNewPoint; |
| | | |
| | | @ApiModelProperty(value = "门店业绩积分") |
| | | private Integer shopAchievementPoint; |
| | | |
| | | @ApiModelProperty(value = "门店返佣积分") |
| | | private Integer shopSharePoint; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value="钱包对象", description="") |
| | | public class WalletVO { |
| | | |
| | | @ApiModelProperty(value = "账户余额") |
| | | private BigDecimal balance; |
| | | |
| | | @ApiModelProperty(value = "可提现金额") |
| | | private BigDecimal withdrawalAmount; |
| | | |
| | | @ApiModelProperty(value = "已提现金额") |
| | | private BigDecimal withdrawnAmount; |
| | | |
| | | @ApiModelProperty(value = "最低提现门槛") |
| | | private BigDecimal vipWithdrawalMinAmount; |
| | | |
| | | @ApiModelProperty(value = "提现审核中金额") |
| | | private BigDecimal auditAmount; |
| | | |
| | | @ApiModelProperty(value = "充值总金额") |
| | | private BigDecimal totalRechargeAmount; |
| | | |
| | | @ApiModelProperty(value = "红包总金额") |
| | | private BigDecimal totalRedPacketAmount; |
| | | |
| | | @ApiModelProperty(value = "分销总金额") |
| | | private BigDecimal totalDistributionAmount; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account; |
| | | |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiAccountApplication.class) |
| | | public class RuoYiAccountApplicationTests { |
| | | |
| | | } |