Merge remote-tracking branch 'origin/master'
| | |
| | | @TableField("total_register_point") |
| | | private Integer totalRegisterPoint; |
| | | |
| | | @ApiModelProperty(value = "门店业绩积分") |
| | | @TableField("shop_achievement_point") |
| | | private Integer shopAchievementPoint; |
| | | |
| | | @ApiModelProperty(value = "门店返佣积分") |
| | | @TableField("shop_share_point") |
| | | private Integer shopSharePoint; |
| | | |
| | | @ApiModelProperty(value = "门店服务费(门店核销获得)") |
| | | @TableField("shop_service_fee") |
| | | private BigDecimal shopServiceFee; |
| | | |
| | | @ApiModelProperty(value = "门店返佣金额(绑定用户消费后返佣)") |
| | | @TableField("shop_commission") |
| | | private BigDecimal shopCommission; |
| | | |
| | | // @ApiModelProperty(value = "做工积分总数") |
| | | // @TableField("total_work_point") |
| | | // private Integer totalWorkPoint; |
| | |
| | | private Integer totalPerformancePoint; |
| | | |
| | | |
| | | @ApiModelProperty(value = "剩余积分") |
| | | @TableField("lave_point") |
| | | private Integer lavePoint; |
| | | |
| | | @ApiModelProperty(value = "总积分") |
| | | @TableField("total_point") |
| | | private Integer totalPoint; |
| | | |
| | | @ApiModelProperty(value = "剩余积分(可用于消费的积分)") |
| | | @TableField("lave_point") |
| | | private Integer lavePoint; |
| | | |
| | | @ApiModelProperty(value = "是否可更换推广人(0=否,1=是)") |
| | | @TableField("change_promoter") |
| | | private Integer changePromoter; |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | @TableField(exist = false) |
| | | private String shopName; |
| | | |
| | | } |
| | |
| | | @TableField("object_id") |
| | | private Long objectId; |
| | | |
| | | @ApiModelProperty(value = "拓展字段") |
| | | @TableField("extention") |
| | | private String extention; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | @TableField(exist = false) |
| | | private String userName; |
| | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | |
| | | @ApiModelProperty(value = "删除标志(0=否,1=是)") |
| | | @TableField("del_flag") |
| | |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "1图片2视频") |
| | | @TableField("content_type") |
| | | private Integer contentType; |
| | | |
| | | @ApiModelProperty(value = "跳转类型(1=无跳转,2=外部链接,3=商品详情,4=秒杀商品详情,5=领券中心)") |
| | | @TableField("jump_type") |
| | | private Integer jumpType; |
| | |
| | | @TableField("server_point") |
| | | private Integer serverPoint; |
| | | |
| | | @ApiModelProperty(value = "下级门店返佣积分") |
| | | @TableField("lower_level_rebate_points") |
| | | private Integer lowerLevelRebatePoints; |
| | | |
| | | @ApiModelProperty(value = "门店已用积分") |
| | | @TableField("use_point") |
| | | private Integer usePoint; |
| | |
| | | |
| | | @ApiModelProperty(value = "变动类型(1=门店分佣,2=下级门店分佣,3=门店服务费)") |
| | | @TableField("type") |
| | | @Excel(name = "变更类型",readConverterExp = "1=门店分佣,2=下级门店分佣,3=门店服务费") |
| | | @Excel(name = "变更类型",readConverterExp = "1=门店分佣,2=下级门店分佣,3=门店服务费,4=关联用户分佣") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "历史余额") |
| | |
| | | |
| | | @ApiModelProperty(value = "变动时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "变动时间") |
| | | private LocalDateTime createTime; |
| | | |
| | |
| | | @TableField("object_id") |
| | | private Long objectId; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | @TableField("order_num") |
| | | private String orderNum; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | @TableField(exist = false) |
| | | @Excel(name = "门店名称") |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public R<Set<Integer>> getShopIdByName(String shopName) { |
| | | return R.fail("根据门店名称获取门店id失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<ShopBalanceStatement>> getShopBalanceStatementList(ShopBalanceStatement shopBalanceStatement) { |
| | | return R.fail(); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.factory.ShopClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | R<Shop> getShopByPhone(@RequestParam("phone") String phone); |
| | | |
| | | @PostMapping("/getShopByUserIds") |
| | | public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds); |
| | | R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds); |
| | | |
| | | @GetMapping("/getShopIdByName") |
| | | R<Set<Integer>> getShopIdByName(String shopName); |
| | | |
| | | @PostMapping("/shop-balance-statement/getList") |
| | | R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestBody ShopBalanceStatement shopBalanceStatement); |
| | | } |
| | |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.0.0</version> |
| | | <version>4.1.2</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>guava</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.0.0</version> |
| | | <version>4.1.2</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>guava</artifactId> |
| | |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | import com.ruoyi.account.mapper.AppUserMapper; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | public class AppUserController extends BaseController { |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private AppUserMapper appUserMapper; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | public R<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin){ |
| | | return appUserService.mobileLogin(mobileLogin); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSMSCode") |
| | | @ApiOperation(value = "获取短信验证码") |
| | | public R getSMSCode(@RequestBody SMSCode smsCode){ |
| | | return appUserService.getSMSCode(smsCode); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getNearbyReferrer") |
| | | @ApiOperation(value = "获取附近推荐人列表") |
| | |
| | | AppUser user = appUserService.getById(userId); |
| | | return R.ok(user); |
| | | } |
| | | |
| | | @Resource |
| | | private UserCancellationLogService userCancellationLogService; |
| | | |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/index") |
| | | @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) |
| | | public R<AppUser> index(){ |
| | |
| | | appUserService.updateById(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户的祖籍列表 |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/onlineRecord") |
| | | @ApiOperation(value = "10分钟定时任务调用,记录用户在线时长", tags = {"小程序-个人中心首页"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户名称模糊搜索用户列表 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据用户电话模糊搜索用户列表 |
| | | * |
| | | * @param phone |
| | | * @return |
| | | */ |
| | |
| | | @ApiOperation(value = "用户列表", tags = {"管理后台"}) |
| | | public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | AppUser appUser) |
| | | { |
| | | AppUser appUser) { |
| | | IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser); |
| | | return R.ok(appuserPage); |
| | | } |
| | |
| | | @ApiOperation(value = "用户列表", tags = {"门店后台"}) |
| | | public R<IPage<AppUser>> shopGetAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | AppUser appUser) |
| | | { |
| | | AppUser appUser) { |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | |
| | | List<Long> userIds = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/danger/info") |
| | | @ApiOperation(value = "用户列表-保级条件详情", tags = {"管理后台"}) |
| | | public R<DangerInfoDto> dangerinfo(Long id) |
| | | { |
| | | public R<DangerInfoDto> dangerinfo(Long id) { |
| | | AppUser byId = appUserService.getById(id); |
| | | LocalDate now = LocalDate.now(); |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(byId.getVipId()); |
| | |
| | | |
| | | @GetMapping("/danger/down") |
| | | @ApiOperation(value = "用户列表-保级条件降级", tags = {"管理后台"}) |
| | | public R down(Long id) |
| | | { |
| | | public R down(Long id) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setVipId(byId.getVipId()-1); |
| | | appUserService.updateById(byId); |
| | |
| | | ).start(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/frozen") |
| | | @ApiOperation(value = "用户列表-冻结解冻", tags = {"管理后台"}) |
| | | public R frozen(Long id,@ApiParam("1=正常,2=冻结")Integer status) |
| | | { |
| | | public R frozen(Long id, @ApiParam("1=正常,2=冻结") Integer status) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setStatus(status); |
| | | appUserService.updateById(byId); |
| | |
| | | |
| | | @GetMapping("/select") |
| | | @ApiOperation(value = "用户列表-查询绑定人", tags = {"管理后台"}) |
| | | public R<AppUser> select(String phone) |
| | | { |
| | | public R<AppUser> select(String phone) { |
| | | AppUser byId = appUserService.lambdaQuery().eq(AppUser::getPhone,phone).one(); |
| | | if (byId==null){ |
| | | return R.fail("搜索失败,手机号错误。"); |
| | |
| | | |
| | | @GetMapping("/change/bind") |
| | | @ApiOperation(value = "用户列表-更换绑定人", tags = {"管理后台"}) |
| | | public R<AppUser> select(Long id,Long inviteId) |
| | | { |
| | | public R<AppUser> select(Long id, Long inviteId) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setInviteUserId(inviteId); |
| | | byId.setTopInviteId(getTop(inviteId)); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/change/shop") |
| | | @ApiOperation(value = "用户列表-更换门店", tags = {"管理后台"}) |
| | | public R<AppUser> shop(Long id,Long shopId) |
| | | { |
| | | public R<AppUser> shop(Long id, Long shopId) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setShopId(shopId); |
| | | appUserService.updateById(byId); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) |
| | | public R<AppUser> detail(Long id) |
| | | { |
| | | public R<AppUser> detail(Long id) { |
| | | AppUser byId = appUserService.getById(id); |
| | | if (byId.getShopId()!=null) { |
| | | R<Shop> shopById = shopClient.getShopById(Integer.parseInt(String.valueOf(byId.getShopId()))); |
| | |
| | | |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |
| | | @GetMapping("/change/vip") |
| | | @ApiOperation(value = "用户列表-修改会员等级", tags = {"管理后台"}) |
| | | public R<Page<AppUser>> changevip(Long id,Integer vipId) |
| | | { |
| | | public R<Page<AppUser>> changevip(Long id, Integer vipId) { |
| | | AppUser byId = appUserService.getById(id); |
| | | |
| | | UserChangeLog userChangeLog = new UserChangeLog(); |
| | |
| | | |
| | | @GetMapping("/bottom") |
| | | @ApiOperation(value = "用户列表-绑定下级列表", tags = {"管理后台"}) |
| | | public R<Page<AppUser>> bottom(Long id,Integer pageNum,Integer pageSize) |
| | | { |
| | | public R<Page<AppUser>> bottom(Long id, Integer pageNum, Integer pageSize) { |
| | | //绑定下级 |
| | | Page<AppUser> page = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | |
| | | |
| | | @GetMapping("/orders") |
| | | @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) |
| | | public R<List<Order>> orders(Long id) |
| | | { |
| | | public R<List<Order>> orders(Long id) { |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id); |
| | | return R.ok(listR.getData()); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/listByIds") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/getAppUserByPhone1") |
| | | public R<AppUser> getAppUserByPhone1(@RequestParam("phone") String phone){ |
| | | AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1) |
| | |
| | | return R.ok(appUser); |
| | | } |
| | | |
| | | /** |
| | | * 用户统计 |
| | | */ |
| | | @GetMapping("/statistics") |
| | | @ApiOperation(value = "用户统计", tags = {"管理后台-首页统计-用户统计"}) |
| | | public R<UserStatistics> statistics() { |
| | | UserStatistics userStatistics = appUserMapper.getUserStatistics(); |
| | | return R.ok(userStatistics); |
| | | } |
| | | |
| | | /** |
| | | * 用户统计详情 |
| | | */ |
| | | @GetMapping("/statistics/detail") |
| | | @ApiOperation(value = "用户统计详情", tags = {"管理后台-首页统计-用户统计详情"}) |
| | | public R<UserStatisticsDetail> statisticsDetail(@ApiParam(value = "用户id") Long userId) { |
| | | UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(userId); |
| | | return R.ok(userStatisticsDetail); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分佣统计明细 |
| | | */ |
| | | @GetMapping("/commissionDetail") |
| | | @ApiOperation(value = "分佣统计", tags = "管理后台-首页统计") |
| | | public R<CommissionDetail> commissionDetail(BalanceChangeRecord balanceChangeRecord) { |
| | | List<AppUser> appUserList = Optional.ofNullable(appUserService.list()).orElse(Collections.emptyList()); |
| | | |
| | | if (appUserList.isEmpty()) { |
| | | return R.ok(new CommissionDetail()); |
| | | } |
| | | |
| | | BigDecimal totalCommission = BigDecimal.ZERO; |
| | | BigDecimal totalServiceFee = BigDecimal.ZERO; |
| | | BigDecimal totalUserCommission = BigDecimal.ZERO; |
| | | Map<Integer, BigDecimal> vipCommissions = new HashMap<>(); |
| | | |
| | | for (AppUser appUser : appUserList) { |
| | | totalCommission = totalCommission.add(Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO)); |
| | | totalServiceFee = totalServiceFee.add(Optional.ofNullable(appUser.getShopServiceFee()).orElse(BigDecimal.ZERO)); |
| | | totalUserCommission = totalUserCommission.add(Optional.ofNullable(appUser.getShopCommission()).orElse(BigDecimal.ZERO)); |
| | | |
| | | Integer vipId = appUser.getVipId(); |
| | | if (vipId != null && vipId >= 1 && vipId <= 7) { |
| | | vipCommissions.merge(vipId, Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO), BigDecimal::add); |
| | | } |
| | | } |
| | | |
| | | CommissionDetail commissionDetail = new CommissionDetail(); |
| | | commissionDetail.setTotalCommission(totalCommission); |
| | | commissionDetail.setTotalServiceFee(totalServiceFee); |
| | | commissionDetail.setTotalUserCommission(totalUserCommission); |
| | | |
| | | commissionDetail.setTotalNormalCommission(vipCommissions.getOrDefault(1, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalGoldCommission(vipCommissions.getOrDefault(2, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalDiamondCommission(vipCommissions.getOrDefault(3, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalAgentCommission(vipCommissions.getOrDefault(4, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalSuperAgentCommission(vipCommissions.getOrDefault(5, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalTopAgentCommission(vipCommissions.getOrDefault(6, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalPartnerCommission(vipCommissions.getOrDefault(7, BigDecimal.ZERO)); |
| | | |
| | | return R.ok(commissionDetail); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.dto.BalanceQuery; |
| | | import com.ruoyi.account.service.BalanceChangeRecordService; |
| | | import com.ruoyi.account.vo.CommissionDetail; |
| | | import com.ruoyi.account.vo.CommissionStatistics; |
| | | import com.ruoyi.account.vo.WalletStatistics; |
| | | import com.ruoyi.account.vo.WalletStatisticsDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | /** |
| | | * 保存账户流水记录 |
| | | * |
| | | * @param balanceChangeRecord |
| | | * @return |
| | | */ |
| | |
| | | CommissionStatistics commissionStatistics1 = balanceChangeRecordService.commissionStatistics(Page.of(pageNum, pageSize), balanceChangeRecord); |
| | | return R.ok(commissionStatistics1); |
| | | } |
| | | |
| | | // |
| | | // /** |
| | | // * 导出用户分佣统计 |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 钱包统计 |
| | | */ |
| | | @GetMapping("/walletStatistics") |
| | | @ApiOperation(value = "钱包统计", tags = "管理后台-财务统计-钱包统计") |
| | | public R<WalletStatistics> walletStatistics(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | BalanceChangeRecord balanceChangeRecord) { |
| | | WalletStatistics walletStatistics = balanceChangeRecordService.walletStatistics(Page.of(pageNum, pageSize), balanceChangeRecord); |
| | | return R.ok(walletStatistics); |
| | | } |
| | | |
| | | /** |
| | | * 钱包统计导出 |
| | | */ |
| | | @GetMapping("/walletExport") |
| | | @ApiOperation(value = "钱包统计导出", tags = "管理后台-财务统计-钱包统计") |
| | | public void walletExport(HttpServletResponse response, BalanceChangeRecord balanceChangeRecord) { |
| | | WalletStatistics walletStatistics = balanceChangeRecordService.walletStatistics(Page.of(1, Integer.MAX_VALUE), balanceChangeRecord); |
| | | IPage<WalletStatisticsDetail> userPointPage = walletStatistics.getPage(); |
| | | List<WalletStatisticsDetail> userPointList = userPointPage.getRecords(); |
| | | ExcelUtil<WalletStatisticsDetail> util = new ExcelUtil<>(WalletStatisticsDetail.class); |
| | | util.exportExcel(response, userPointList, "钱包统计"); |
| | | } |
| | | |
| | | } |
| | |
| | | return R.ok(userPointPage); |
| | | } |
| | | |
| | | @GetMapping("/user/list") |
| | | @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台") |
| | | public R<Page<UserPoint>> userlist(UserPoint userPoint) { |
| | | Page<UserPoint> page = userPointService.lambdaQuery().eq(UserPoint::getAppUserId, userPoint.getAppUserId()).orderByDesc(UserPoint::getCreateTime).page(Page.of(userPoint.getPageNum(), userPoint.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 导出 |
| | |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "提现申请列表", tags = {"后台"}) |
| | | public R<IPage<WithdrawalRequests>> page(@RequestBody WithQuery withQuery){ |
| | | return R.ok(withdrawalRequestsService.pageList(withQuery)); |
| | | IPage<WithdrawalRequests> withdrawalRequestsIPage = withdrawalRequestsService.pageList(withQuery); |
| | | for (WithdrawalRequests record : withdrawalRequestsIPage.getRecords()) { |
| | | record.setIdStr(record.getId().toString()); |
| | | } |
| | | return R.ok(withdrawalRequestsIPage); |
| | | } |
| | | @PostMapping("/auth") |
| | | @ApiOperation(value = "提现申请审批", tags = {"后台"}) |
| | |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.vo.NearbyReferrer; |
| | | import com.ruoyi.account.vo.NearbyReferrerVo; |
| | | import com.ruoyi.account.vo.UserStatistics; |
| | | import com.ruoyi.account.vo.UserStatisticsDetail; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | IPage<AppUser> getAppuserPage(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser); |
| | | IPage<AppUser> getAppuserPage1(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser,@Param("objectId")Integer objectId,@Param("userIds")List<Long> userIds); |
| | | |
| | | UserStatistics getUserStatistics(); |
| | | |
| | | UserStatisticsDetail getUserStatisticsDetail(Long userId); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface UserPointMapper extends BaseMapper<UserPoint> { |
| | | |
| | | List<UserPoint> findLatestUserPointByTypeForUser(Long userId); |
| | | |
| | | IPage<UserPoint> queryUserPointPage(@Param("page") IPage<UserPoint> page,@Param("userPoint") UserPoint userPoint); |
| | | |
| | | List<UserPoint> selectUserPoint(@Param("userPoint") UserPoint userPoint); |
| | |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.dto.BalanceQuery; |
| | | import com.ruoyi.account.vo.CommissionStatistics; |
| | | import com.ruoyi.account.vo.WalletStatistics; |
| | | |
| | | public interface BalanceChangeRecordService extends IService<BalanceChangeRecord> { |
| | | IPage<BalanceChangeRecord> pageList(BalanceQuery agentQuery); |
| | | |
| | | CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord); |
| | | |
| | | WalletStatistics walletStatistics(Page<BalanceChangeRecord> of, BalanceChangeRecord balanceChangeRecord); |
| | | |
| | | } |
| | |
| | | public interface PointSettingService { |
| | | |
| | | PointSetting getPointSettingByAppUserId(Long appUserId); |
| | | |
| | | PointSetting getPointSettingById(Integer id); |
| | | } |
| | |
| | | // 直推用户已成为代理数量 |
| | | List<AppUser> directAgentUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .eq(AppUser::getUserType, 4)); |
| | | .eq(AppUser::getVipId, 4)); |
| | | agentApplication.setDirectAgentNum(directAgentUserList.size()); |
| | | |
| | | // 已绑定门店数量 |
| | |
| | | //校验验证码获取频率(1分钟5次) |
| | | String key = smsCode.getType() + "&" + smsCode.getPhone(); |
| | | Map<String, Object> cacheMap = redisService.getCacheMap(key); |
| | | if(null != cacheMap){ |
| | | if(null != cacheMap && cacheMap.size() > 0){ |
| | | Integer number = Integer.valueOf(cacheMap.get("number").toString()) + 1; |
| | | Long startTime = Long.valueOf(cacheMap.get("startTime").toString()); |
| | | if(number > 5 && (System.currentTimeMillis() - startTime) < 60000){ |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.api.model.UserClickLog; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | import com.ruoyi.account.dto.BalanceQuery; |
| | | import com.ruoyi.account.mapper.BalanceChangeRecordMapper; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.BalanceChangeRecordService; |
| | | import com.ruoyi.account.vo.CommissionStatistics; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.account.vo.WalletStatistics; |
| | | import com.ruoyi.account.vo.WalletStatisticsDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Service |
| | | public class BalanceChangeRecordServiceImpl extends ServiceImpl<BalanceChangeRecordMapper, BalanceChangeRecord> implements BalanceChangeRecordService { |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | private ShopClient shopClient; |
| | | |
| | | @Override |
| | | public IPage<BalanceChangeRecord> pageList(BalanceQuery agentQuery) { |
| | | Page<BalanceChangeRecord> page = new Page<>(); |
| | | page.setCurrent(agentQuery.getPageNum()); |
| | | page.setSize(agentQuery.getPageSize()); |
| | | IPage<BalanceChangeRecord> shopIPage = this.baseMapper.pageList(page, agentQuery); |
| | | return shopIPage; |
| | | return this.baseMapper.pageList(page, agentQuery); |
| | | } |
| | | |
| | | @Override |
| | |
| | | IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); |
| | | return new CommissionStatistics(totalCommission, balanceChangeRecordIPage); |
| | | } |
| | | |
| | | @Override |
| | | public WalletStatistics walletStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) { |
| | | ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); |
| | | shopBalanceStatement.setType(4); |
| | | |
| | | R<List<ShopBalanceStatement>> r; |
| | | try { |
| | | r = shopClient.getShopBalanceStatementList(shopBalanceStatement); |
| | | } catch (Exception e) { |
| | | log.error("获取店铺余额对账单列表时出错", e); |
| | | return null; |
| | | } |
| | | |
| | | if (R.isError(r)) { |
| | | return null; |
| | | } |
| | | |
| | | List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord); |
| | | |
| | | List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>(); |
| | | for (BalanceChangeRecord changeRecord : balanceChangeRecordList) { |
| | | WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail(); |
| | | BeanUtils.copyBeanProp(walletStatisticsDetail, changeRecord); |
| | | walletStatisticsDetailList.add(walletStatisticsDetail); |
| | | } |
| | | |
| | | walletStatisticsDetailList.addAll(r.getData().stream().map(this::createWalletStatisticsDetail).collect(Collectors.toList())); |
| | | |
| | | // 按时间排序(倒序) |
| | | walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed()); |
| | | |
| | | long current = page.getCurrent(); |
| | | long size = page.getSize(); |
| | | if (current < 1) { |
| | | current = 1; |
| | | } |
| | | int fromIndex = (int) ((current - 1) * size); |
| | | int toIndex = (int) Math.min(fromIndex + size, walletStatisticsDetailList.size()); |
| | | |
| | | if (fromIndex >= walletStatisticsDetailList.size()) { |
| | | throw new ServiceException("页面参数无效"); |
| | | } |
| | | |
| | | List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex); |
| | | |
| | | |
| | | Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | WalletStatisticsDetail::getChangeType, |
| | | Collectors.reducing( |
| | | BigDecimal.ZERO, |
| | | WalletStatisticsDetail::getChangeAmount, |
| | | BigDecimal::add |
| | | ) |
| | | )); |
| | | |
| | | BigDecimal totalRecharge = shopCommissionMap.get(1); |
| | | BigDecimal totalWithdraw = shopCommissionMap.get(2); |
| | | BigDecimal totalShopWithdraw = shopCommissionMap.get(7); |
| | | |
| | | |
| | | WalletStatistics walletStatistics = new WalletStatistics(); |
| | | Page<WalletStatisticsDetail> page1 = new Page<>(); |
| | | page1.setRecords(walletStatisticsDetailList2); |
| | | page1.setTotal(walletStatisticsDetailList.size()); |
| | | page1.setCurrent(current); |
| | | page1.setSize(size); |
| | | walletStatistics.setPage(page1); |
| | | walletStatistics.setTotalRecharge(totalRecharge); |
| | | walletStatistics.setTotalWithdraw(totalWithdraw); |
| | | walletStatistics.setTotalShopWithdraw(totalShopWithdraw); |
| | | return walletStatistics; |
| | | } |
| | | |
| | | private WalletStatisticsDetail createWalletStatisticsDetail(ShopBalanceStatement item) { |
| | | WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail(); |
| | | walletStatisticsDetail.setShopName(item.getShopName()); |
| | | walletStatisticsDetail.setUserName(item.getShopManagerName()); |
| | | walletStatisticsDetail.setUserPhone(item.getPhone()); |
| | | walletStatisticsDetail.setChangeType(4); |
| | | walletStatisticsDetail.setCreateTime(item.getCreateTime()); |
| | | walletStatisticsDetail.setChangeAmount(item.getVariableAmount()); |
| | | return walletStatisticsDetail; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | return r.getData(); |
| | | } |
| | | |
| | | @Override |
| | | public PointSetting getPointSettingById(Integer id) { |
| | | R<PointSetting> r = pointSettingClient.getPointSetting(id); |
| | | if (!R.isSuccess(r)){ |
| | | throw new RuntimeException("获取积分设置失败"); |
| | | } |
| | | return r.getData(); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.other.api.enums.PointChangeType; |
| | | import com.ruoyi.account.mapper.UserPointMapper; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.PointSettingService; |
| | |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.PhoneNumberValidator; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.enums.PointChangeType; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private PointSettingService pointSettingService; |
| | | @Resource |
| | | private UserPointMapper userPointMapper; |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | |
| | | @Override |
| | | public UserPointVO getUserPoint(Long userId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | List<UserPoint> userPointList = this.baseMapper.findLatestUserPointByTypeForUser(userId); |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingByUserId(userId); |
| | | |
| | | UserPointVO userPointVO = new UserPointVO(); |
| | |
| | | userPointVO.setConsumePoint(appUser.getLavePoint()); |
| | | userPointVO.setShopPoint(appUser.getShopPoint()); |
| | | userPointVO.setSharePoint(appUser.getSharePoint()); |
| | | userPointVO.setPullNewPoint(userBalanceMap.get(PointChangeType.PULL_NEW.getCode())); |
| | | userPointVO.setShopAchievementPoint(userBalanceMap.get(PointChangeType.SHOP_ACHIEVEMENT.getCode())); |
| | | userPointVO.setShopSharePoint(userBalanceMap.get(PointChangeType.SHOP_REBATE.getCode())); |
| | | userPointVO.setGiftPoint(vipSetting.getVipGiftRole() == 1 && vipSetting.getId() == 1 ? 1 : 0); |
| | | userPointVO.setPullNewPoint(appUser.getTotalInvitePoint()); |
| | | userPointVO.setShopAchievementPoint(appUser.getShopAchievementPoint()); |
| | | userPointVO.setShopSharePoint(appUser.getShopSharePoint()); |
| | | userPointVO.setGiftPoint(vipSetting.getVipGiftRole() == 1 ? 1 : 0); |
| | | return userPointVO; |
| | | } |
| | | |
| | |
| | | throw new ServiceException("积分设置未找到"); |
| | | } |
| | | // 可转赠积分总数 |
| | | int adjustedPoint = getAdjustedPoint(pointSetting, appUser); |
| | | long adjustedPoint = getAdjustedPoint(pointSetting, appUser); |
| | | |
| | | if (point.compareTo(new BigDecimal(adjustedPoint)) > 0) { |
| | | throw new ServiceException("转赠积分不足"); |
| | |
| | | appUserForPhoe.setTotalPoint(appUserForPhoe.getTotalPoint() + point.intValue()); |
| | | appUserService.updateById(appUserForPhoe); |
| | | |
| | | Integer lavePoint = appUser.getLavePoint(); |
| | | appUser.setLavePoint(lavePoint - point.intValue()); |
| | | Integer totalPoint = appUser.getTotalPoint(); |
| | | appUser.setTotalPoint(totalPoint - point.intValue()); |
| | | appUserService.updateById(appUser); |
| | | log.info("积分转赠完成,用户ID: {}, 新积分: {}", appUserForPhoe.getId(), appUserForPhoe.getLavePoint()); |
| | | } |
| | | |
| | |
| | | * 获取可转赠积分 |
| | | * @param pointSetting 积分设置 |
| | | * @param appUser 用户 |
| | | * @return |
| | | */ |
| | | private int getAdjustedPoint(PointSetting pointSetting, AppUser appUser) { |
| | | int transferPoint = 0; |
| | | |
| | | // 消费积分数 |
| | | Integer buyPointGift = pointSetting.getBuyPointGift(); |
| | | if (buyPointGift == 1){ |
| | | transferPoint += appUser.getShopPoint(); |
| | | private long getAdjustedPoint(PointSetting pointSetting, AppUser appUser) { |
| | | if (pointSetting == null || appUser == null) { |
| | | throw new ServiceException("pointSetting和appUser不能为空"); |
| | | } |
| | | |
| | | // 返佣积分 |
| | | Integer sharePointOpen = pointSetting.getSharePointGift(); |
| | | if (sharePointOpen == 1){ |
| | | transferPoint += appUser.getSharePoint(); |
| | | } |
| | | long transferPoint = 0; |
| | | |
| | | // 门店返佣积分 |
| | | Integer shopSharePointGift = pointSetting.getShopSharePointGift(); |
| | | R<List<Shop>> shops = shopClient.getShopByUserIds(Collections.singletonList(appUser.getId())); |
| | | List<Shop> shopList = shops.getData(); |
| | | if (CollectionUtils.isEmpty(shopList)) { |
| | | throw new ServiceException("未找到门店"); |
| | | } |
| | | if (shopSharePointGift == 1){ |
| | | transferPoint += shopList.stream().mapToInt(Shop::getSharePoint).sum(); |
| | | } |
| | | // 门店业绩积分 |
| | | Integer shopPointOpen = pointSetting.getShopPointGift(); |
| | | if (shopPointOpen == 1){ |
| | | transferPoint += shopList.stream().mapToInt(Shop::getShopPoint).sum(); |
| | | } |
| | | transferPoint += calculatePoint(pointSetting.getBuyPointGift(), appUser.getShopPoint(), pointSetting.getBuyPoint()); |
| | | transferPoint += calculatePoint(pointSetting.getSharePointGift(), appUser.getSharePoint(), pointSetting.getSharePoint()); |
| | | transferPoint += calculatePoint(pointSetting.getShopSharePointGift(), appUser.getShopSharePoint(), pointSetting.getShopSharePoint()); |
| | | transferPoint += calculatePoint(pointSetting.getShopPointGift(), appUser.getShopAchievementPoint(), pointSetting.getShopPoint()); |
| | | transferPoint += calculatePoint(pointSetting.getPersonPointGift(), appUser.getTotalPerformancePoint(), pointSetting.getPersonPoint()); |
| | | transferPoint += calculatePoint(pointSetting.getGetNewPointGift(), appUser.getTotalInvitePoint(), pointSetting.getGetNewPoint()); |
| | | transferPoint += calculatePoint(pointSetting.getGetRegisPointGift(), appUser.getTotalRegisterPoint(), pointSetting.getRegisPoint()); |
| | | transferPoint += calculatePoint(pointSetting.getWorkPointGift(), appUser.getTotalSharePoint() + appUser.getTotalSignPoint() + appUser.getTotalHourPoint(), pointSetting.getWorkPoint()); |
| | | |
| | | // 技师业绩积分 |
| | | Integer personPointOpen = pointSetting.getPersonPointGift(); |
| | | if (personPointOpen == 1){ |
| | | transferPoint += appUser.getTotalPerformancePoint(); |
| | | } |
| | | |
| | | // 拉新积分 |
| | | Integer getNewPointOpen = pointSetting.getGetNewPointGift(); |
| | | if (getNewPointOpen == 1){ |
| | | transferPoint += appUser.getTotalInvitePoint(); |
| | | } |
| | | |
| | | // 注册积分 |
| | | Integer getRegisPointGift = pointSetting.getGetRegisPointGift(); |
| | | if (getRegisPointGift == 1){ |
| | | transferPoint += appUser.getTotalRegisterPoint(); |
| | | } |
| | | |
| | | // 做工积分 |
| | | Integer workPointOpen = pointSetting.getWorkPointGift(); |
| | | if (workPointOpen == 1){ |
| | | transferPoint += appUser.getTotalSharePoint() + appUser.getTotalSignPoint() + appUser.getTotalHourPoint(); |
| | | } |
| | | return transferPoint; |
| | | } |
| | | |
| | | private long calculatePoint(Integer settingValue, double userValue, double pointValue) { |
| | | if (settingValue == 1) { |
| | | try { |
| | | double result = userValue * (pointValue / 100.0); |
| | | return Math.round(result); |
| | | } catch (ArithmeticException e) { |
| | | return 0; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public UserPointStatistics getStatistics(UserPoint userPoint) { |
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(description = "分佣明细") |
| | | public class CommissionDetail { |
| | | |
| | | /** |
| | | * 用户获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "用户获得总分佣金额") |
| | | private BigDecimal totalCommission; |
| | | |
| | | /** |
| | | * 门店获得总服务费用总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "门店获得总服务费用总分佣金额") |
| | | private BigDecimal totalServiceFee; |
| | | |
| | | /** |
| | | * 门店获得关联用户总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "门店获得关联用户总分佣金额") |
| | | private BigDecimal totalUserCommission; |
| | | |
| | | /** |
| | | * 普通会员获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "普通会员获得总分佣金额") |
| | | private BigDecimal totalNormalCommission; |
| | | |
| | | /** |
| | | * 黄金会员获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "黄金会员获得总分佣金额") |
| | | private BigDecimal totalGoldCommission; |
| | | |
| | | /** |
| | | * 钻石会员获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "钻石会员获得总分佣金额") |
| | | private BigDecimal totalDiamondCommission; |
| | | |
| | | /** |
| | | * 准代理获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "准代理获得总分佣金额") |
| | | private BigDecimal totalAgentCommission; |
| | | |
| | | /** |
| | | * 代理获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "代理获得总分佣金额") |
| | | private BigDecimal totalSuperAgentCommission; |
| | | |
| | | /** |
| | | * 总代获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "总代获得总分佣金额") |
| | | private BigDecimal totalTopAgentCommission; |
| | | |
| | | /** |
| | | * 合伙人获得总分佣金额 |
| | | */ |
| | | @ApiModelProperty(value = "合伙人获得总分佣金额") |
| | | private BigDecimal totalPartnerCommission; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("用户统计") |
| | | public class UserStatistics { |
| | | /** |
| | | * 用户总数 |
| | | */ |
| | | @ApiModelProperty(value = "用户总数") |
| | | private Integer totalUser; |
| | | |
| | | /** |
| | | * 拥有门店用户数 |
| | | */ |
| | | @ApiModelProperty(value = "拥有门店用户数") |
| | | private Integer shopUser; |
| | | |
| | | /** |
| | | * 消费者用户数 |
| | | */ |
| | | @ApiModelProperty(value = "消费者用户数") |
| | | private Integer consumerUser; |
| | | |
| | | /** |
| | | * 普通会员数 |
| | | */ |
| | | @ApiModelProperty(value = "普通会员数") |
| | | private Integer commonUser; |
| | | |
| | | /** |
| | | * 黄金会员数 |
| | | */ |
| | | @ApiModelProperty(value = "黄金会员数") |
| | | private Integer goldUser; |
| | | |
| | | /** |
| | | * 钻石会员数 |
| | | */ |
| | | @ApiModelProperty(value = "钻石会员数") |
| | | private Integer diamondUser; |
| | | |
| | | /** |
| | | * 创业者总数 |
| | | */ |
| | | @ApiModelProperty(value = "创业者总数") |
| | | private Integer entrepreneurUser; |
| | | |
| | | /** |
| | | * 准代理数 |
| | | */ |
| | | @ApiModelProperty(value = "准代理数") |
| | | private Integer proxyUser; |
| | | |
| | | /** |
| | | * 代理数 |
| | | */ |
| | | @ApiModelProperty(value = "代理数") |
| | | private Integer agentUser; |
| | | |
| | | /** |
| | | * 总代数 |
| | | */ |
| | | @ApiModelProperty(value = "总代数") |
| | | private Integer totalAgentUser; |
| | | |
| | | /** |
| | | * 合伙人数 |
| | | */ |
| | | @ApiModelProperty(value = "合伙人数") |
| | | private Integer partnerUser; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("用户统计详情") |
| | | public class UserStatisticsDetail { |
| | | |
| | | /** |
| | | * 用户获得总积分 |
| | | */ |
| | | @ApiModelProperty("用户获得总积分") |
| | | private Integer totalScore; |
| | | |
| | | /** |
| | | * 消费积分总数 |
| | | */ |
| | | @ApiModelProperty("消费积分总数") |
| | | private Integer consumeScore; |
| | | |
| | | /** |
| | | * 返佣积分总数 |
| | | */ |
| | | @ApiModelProperty("返佣积分总数") |
| | | private Integer rebateScore; |
| | | |
| | | /** |
| | | * 拉新人积分总数 |
| | | */ |
| | | @ApiModelProperty("拉新人积分总数") |
| | | private Integer inviteScore; |
| | | |
| | | /** |
| | | * 注册积分总数 |
| | | */ |
| | | @ApiModelProperty("注册积分总数") |
| | | private Integer registerScore; |
| | | |
| | | /** |
| | | * 做工积分总数 |
| | | */ |
| | | @ApiModelProperty("做工积分总数") |
| | | private Integer workScore; |
| | | |
| | | /** |
| | | * 技师业绩积分总数 |
| | | */ |
| | | @ApiModelProperty("技师业绩积分总数") |
| | | private Integer achievementScore; |
| | | |
| | | /** |
| | | * 用户获得分佣总金额 |
| | | */ |
| | | @ApiModelProperty("用户获得分佣总金额") |
| | | private Integer totalRebate; |
| | | |
| | | /** |
| | | * 充值金额 |
| | | */ |
| | | @ApiModelProperty("充值金额") |
| | | private Integer totalRecharge; |
| | | |
| | | /** |
| | | * 已提现金额 |
| | | */ |
| | | @ApiModelProperty("已提现金额") |
| | | private Integer totalWithdraw; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class WalletStatistics { |
| | | |
| | | /** |
| | | * 用户充值总金额 |
| | | */ |
| | | private BigDecimal totalRecharge; |
| | | |
| | | /** |
| | | * 用户提现总金额 |
| | | */ |
| | | private BigDecimal totalWithdraw; |
| | | |
| | | /** |
| | | * 门店提现总金额 |
| | | */ |
| | | private BigDecimal totalShopWithdraw; |
| | | |
| | | private IPage<WalletStatisticsDetail> page; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class WalletStatisticsDetail { |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | @ApiModelProperty(value = "门店名称") |
| | | @Excel(name = "门店名称") |
| | | private String shopName; |
| | | |
| | | /** |
| | | * 用户姓名 |
| | | */ |
| | | @ApiModelProperty(value = "用户姓名") |
| | | @Excel(name = "用户姓名") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | @Excel(name = "联系电话") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty("类型:1充值2提现3红包4分佣5商城购物6订单取消回退7门店提现") |
| | | @Excel(name = "变更类型", readConverterExp = "1=充值,2=提现,3=红包,4=分佣,5=商城购物,6=订单取消回退,7=门店提现") |
| | | private Integer changeType; |
| | | |
| | | /** |
| | | * 变更时间 |
| | | */ |
| | | @ApiModelProperty(value = "变更时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "变更时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 变更数量 |
| | | */ |
| | | @ApiModelProperty(value = "变更数量") |
| | | @Excel(name = "变更数量") |
| | | private BigDecimal changeAmount; |
| | | } |
| | |
| | | ) or ta.shop_id = #{objectId} ) |
| | | </where> |
| | | </select> |
| | | <select id="getUserStatistics" resultType="com.ruoyi.account.vo.UserStatistics"> |
| | | SELECT |
| | | COUNT(*) AS totalUser, |
| | | SUM(CASE WHEN tau.user_type = 2 THEN 1 ELSE 0 END) AS shopUser, |
| | | SUM(CASE WHEN tau.vip_id <![CDATA[<]]> 4 THEN 1 ELSE 0 END) AS consumerUser, |
| | | SUM(CASE WHEN tau.vip_id = 1 THEN 1 ELSE 0 END) AS commonUser, |
| | | SUM(CASE WHEN tau.vip_id = 2 THEN 1 ELSE 0 END) AS goldUser, |
| | | SUM(CASE WHEN tau.vip_id = 3 THEN 1 ELSE 0 END) AS diamondUser, |
| | | SUM(CASE WHEN tau.vip_id <![CDATA[>]]> 3 THEN 1 ELSE 0 END) AS entrepreneurUser, |
| | | SUM(CASE WHEN tau.vip_id = 4 THEN 1 ELSE 0 END) AS proxyUser, |
| | | SUM(CASE WHEN tau.vip_id = 5 THEN 1 ELSE 0 END) AS agentUser, |
| | | SUM(CASE WHEN tau.vip_id = 6 THEN 1 ELSE 0 END) AS totalAgentUser, |
| | | SUM(CASE WHEN tau.vip_id = 7 THEN 1 ELSE 0 END) AS partnerUser |
| | | FROM |
| | | t_app_user tau |
| | | </select> |
| | | <select id="getUserStatisticsDetail" resultType="com.ruoyi.account.vo.UserStatisticsDetail"> |
| | | SELECT |
| | | SUM(tau.total_point) totalScore, |
| | | SUM(tau.shop_point) consumeScore, |
| | | SUM(tau.share_point) rebateScore, |
| | | SUM(tau.total_invite_point) inviteScore, |
| | | SUM(tau.total_register_point) registerScore, |
| | | SUM(tau.total_share_point+tau.total_sign_point+tau.total_hour_point) workScore, |
| | | SUM(tau.total_performance_point) achievementScore, |
| | | SUM(tau.total_distribution_amount) totalRebate, |
| | | SUM(tau.total_recharge_amount) totalRecharge, |
| | | SUM(tau.withdrawn_amount) totalWithdraw |
| | | FROM |
| | | t_app_user tau |
| | | <where> |
| | | <if test="null != userName and '' != userName"> |
| | | and tau.id = #{userId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, type, historical_point, variable_point, create_time, app_user_id, object_id |
| | | </sql> |
| | | <select id="findLatestUserPointByTypeForUser" resultType="com.ruoyi.account.api.model.UserPoint"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | t_user_point t1 |
| | | INNER JOIN ( SELECT type, MAX( create_time ) AS max_create_time FROM t_user_point WHERE app_user_id = #{userId} GROUP BY type ) t2 ON t1.type = t2.type |
| | | AND t1.create_time = t2.max_create_time |
| | | WHERE |
| | | t1.app_user_id = #{userId} |
| | | </select> |
| | | |
| | | <sql id="userPointList"> |
| | | SELECT |
| | |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.0.0</version> |
| | | <version>4.1.2</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>guava</artifactId> |
| | |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.enums.OrderStatus; |
| | | import com.ruoyi.order.mapper.OrderMapper; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.service.CommissionService; |
| | | import com.ruoyi.order.service.OrderService; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private CommissionService commissionService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | @Resource |
| | | private OrderMapper orderMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | |
| | | @PutMapping("/confirmDelivery/{orderId}") |
| | | @PostMapping("/confirmDelivery") |
| | | @ApiOperation(value = "已发货操作", tags = {"管理后台-订单管理"}) |
| | | public R confirmDelivery(@PathVariable("orderId") String orderId, String code){ |
| | | return orderService.confirmDelivery(orderId, code); |
| | | public R confirmDelivery(@RequestBody ConfirmDelivery confirmDelivery){ |
| | | return orderService.confirmDelivery(confirmDelivery.getOrderId(), confirmDelivery.getCode()); |
| | | } |
| | | |
| | | |
| | |
| | | public R<PageInfo<OrderPageListVo>> getOrderPageList(OrderPageList orderPageList){ |
| | | return R.ok(orderService.getOrderPageList(orderPageList)); |
| | | } |
| | | |
| | | /** |
| | | * 订单统计 |
| | | */ |
| | | @GetMapping("/getOrderStatistics") |
| | | @ApiOperation(value = "订单统计", tags = {"管理后台-首页统计"}) |
| | | public R<OrderStatistics> getOrderStatistics(@RequestParam("startTime") String startTime, |
| | | @RequestParam("endTime") String endTime){ |
| | | |
| | | List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>() |
| | | .between(Order::getCreateTime, LocalDateTime.parse(startTime), LocalDateTime.parse(endTime))); |
| | | Map<String, List<Order>> orderMap = orderList.stream() |
| | | .collect(Collectors.groupingBy(o -> o.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))); |
| | | |
| | | Map<String, Integer> serviceOrderMap = new HashMap<>(); |
| | | Map<String, Integer> singleOrderMap = new HashMap<>(); |
| | | Map<String, Integer> totalOrderMap = new HashMap<>(); |
| | | |
| | | orderMap.forEach((date, orders) -> { |
| | | long serviceCount = orders.stream().filter(o -> o.getOrderType() == 1).count(); |
| | | long singleCount = orders.stream().filter(o -> o.getOrderType() == 2).count(); |
| | | long totalCount = orders.size(); |
| | | |
| | | serviceOrderMap.put(date, (int) serviceCount); |
| | | singleOrderMap.put(date, (int) singleCount); |
| | | totalOrderMap.put(date, (int) totalCount); |
| | | }); |
| | | |
| | | OrderStatistics orderStatistics = orderMapper.getOrderStatistics(LocalDateTime.parse(startTime), LocalDateTime.parse(endTime)); |
| | | orderStatistics.setServiceOrderMap(serviceOrderMap); |
| | | orderStatistics.setSingleOrderMap(singleOrderMap); |
| | | orderStatistics.setTotalOrderMap(totalOrderMap); |
| | | |
| | | return R.ok(orderStatistics); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.order.model.RefundPass; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.service.RefundPassService; |
| | | import com.ruoyi.order.vo.ApplyRefundPass; |
| | | import com.ruoyi.order.vo.OrderRefundPassList; |
| | | import com.ruoyi.order.vo.OrderRefundPassListVo; |
| | | import com.ruoyi.order.vo.RefundPassInfo; |
| | | import com.ruoyi.order.vo.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/authPassStatus/{id}/{status}") |
| | | @PostMapping("/authPassStatus") |
| | | @ApiOperation(value = "审核售后", tags = {"管理后台-售后管理", "门店后台-售后管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "status", value = "审核状态(2=同意,3=拒绝)", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "passRemark", value = "审核备注", required = false, dataType = "string"), |
| | | }) |
| | | public R authPassStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status, @RequestParam("passRemark") String passRemark){ |
| | | return refundPassService.authPassStatus(id, status, passRemark); |
| | | public R authPassStatus(@RequestBody AuthPassStatus authPassStatus){ |
| | | return refundPassService.authPassStatus(authPassStatus.getId(), authPassStatus.getStatus(), authPassStatus.getPassRemark()); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.vo.OrderPageList; |
| | | import com.ruoyi.order.vo.OrderPageListVo; |
| | | import com.ruoyi.order.vo.OrderStatistics; |
| | | import com.ruoyi.order.vo.OrderVO; |
| | | import com.ruoyi.order.model.Order; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | List<OrderPageListVo> getOrderPageList(PageInfo<OrderPageListVo> pageInfo, @Param("item") OrderPageList orderPageList); |
| | | |
| | | OrderStatistics getOrderStatistics(@Param("startTime")LocalDateTime startTime, |
| | | @Param("endTime") LocalDateTime endTime); |
| | | } |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | R confirmDelivery(String orderId, String code); |
| | | R confirmDelivery(Long orderId, String code); |
| | | |
| | | |
| | | /** |
| | |
| | | orderGoodsVO.setOriginalPrice(goods.getOriginalPrice()); |
| | | goodsList.add(orderGoodsVO); |
| | | } |
| | | |
| | | |
| | | |
| | | // 收货地址 |
| | | String addressJson = order.getAddressJson(); |
| | | UserAddress userAddress = new UserAddress(); |
| | |
| | | userAddress = JSONObject.parseObject(addressJson, UserAddress.class); |
| | | |
| | | } |
| | | |
| | | // 优惠券 |
| | | String couponJson = order.getCouponJson(); |
| | | CouponInfo couponInfo = new CouponInfo(); |
| | |
| | | if (StringUtils.isNotEmpty(activityJson)){ |
| | | orderActivityInfo = JSONObject.parseObject(activityJson, OrderActivityInfo.class); |
| | | } |
| | | |
| | | OrderDetailVO orderDetailVO = new OrderDetailVO(); |
| | | |
| | | if (CollectionUtil.isNotEmpty(orderGoods)){ |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R confirmDelivery(String orderId, String code) { |
| | | public R confirmDelivery(Long orderId, String code) { |
| | | Order order = this.getById(orderId); |
| | | if(1 == order.getPayStatus()){ |
| | | return R.fail("订单还未完成支付"); |
| | |
| | | //余额退款 |
| | | OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, order.getId())); |
| | | BigDecimal balance = appUser.getBalance(); |
| | | if(null != orderBalancePayment){ |
| | | appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | appUser.setBalance(balance.add(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setShopAmount(appUser.getShopAmount().subtract(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | |
| | |
| | | VipSetting vipSetting = vipSettingClient.getVipSetting(vipId).getData(); |
| | | Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); |
| | | Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); |
| | | if(1 == vipLevelUpShopRole && shopPoint < vipLevelUpShop){ |
| | | return true; |
| | | } |
| | | return false; |
| | | return 1 == vipLevelUpShopRole && shopPoint < vipLevelUpShop; |
| | | } |
| | | |
| | | |
| | |
| | | refundPassInfo.setRefundReason(refundPass.getRefundReason()); |
| | | refundPassInfo.setUserRemark(refundPass.getUserRemark()); |
| | | refundPassInfo.setPics(refundPass.getPics()); |
| | | refundPassInfo.setPassStatus(refundPass.getPassStatus()); |
| | | refundPassInfo.setPassRemark(refundPass.getPassRemark()); |
| | | return refundPassInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2024/12/19 14:49 |
| | | */ |
| | | @Data |
| | | public class AuthPassStatus { |
| | | @ApiModelProperty("售后数据id") |
| | | private Long id; |
| | | @ApiModelProperty("审核状态(2=同意,3=拒绝)") |
| | | private Integer status; |
| | | @ApiModelProperty("审核备注") |
| | | private String passRemark; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2024/12/19 14:22 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class ConfirmDelivery { |
| | | @ApiModelProperty("订单id") |
| | | private Long orderId; |
| | | @ApiModelProperty("快递json信息{\"com\":\"shunfeng\",\"num\":\"123456\"}") |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("订单统计") |
| | | public class OrderStatistics { |
| | | /** |
| | | * 订单总数 |
| | | */ |
| | | @ApiModelProperty(value = "订单总数") |
| | | private Integer total; |
| | | |
| | | /** |
| | | * 服务类型订单数量 |
| | | */ |
| | | @ApiModelProperty(value = "服务类型订单数量") |
| | | private Integer serviceTotal; |
| | | |
| | | /** |
| | | * 单品类型订单数量 |
| | | */ |
| | | @ApiModelProperty(value = "单品类型订单数量") |
| | | private Integer singleTotal; |
| | | |
| | | /** |
| | | * 订单总金额 |
| | | */ |
| | | @ApiModelProperty(value = "订单总金额") |
| | | private Double totalMoney; |
| | | |
| | | /** |
| | | * 服务类型订单总金额 |
| | | */ |
| | | @ApiModelProperty(value = "服务类型订单总金额") |
| | | private Double serviceTotalMoney; |
| | | |
| | | /** |
| | | * 单品类型订单总金额 |
| | | */ |
| | | @ApiModelProperty(value = "单品类型订单总金额") |
| | | private Double singleTotalMoney; |
| | | |
| | | /** |
| | | * 服务类型订单数量map(key:日期,value:数量) |
| | | */ |
| | | @ApiModelProperty(value = "服务类型订单数量map(key:日期,value:数量)") |
| | | private Map<String, Integer> serviceOrderMap; |
| | | |
| | | @ApiModelProperty(value = "单品类型订单数量map(key:日期,value:数量)") |
| | | private Map<String, Integer> singleOrderMap; |
| | | |
| | | @ApiModelProperty(value = "订单总数map(key:日期,value:数量)") |
| | | private Map<String, Integer> totalOrderMap; |
| | | } |
| | |
| | | @ApiModelProperty("审核状态(1待审核2同意3拒绝)") |
| | | private Integer passStatus; |
| | | @ApiModelProperty("审核注释") |
| | | private Integer passRemark; |
| | | private String passRemark; |
| | | @ApiModelProperty("售后申请时间") |
| | | private String passCreateTime; |
| | | @ApiModelProperty("售后类型(1退货退款2仅退款)") |
| | |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getOrderStatistics" resultType="com.ruoyi.order.vo.OrderStatistics"> |
| | | SELECT |
| | | count(*), |
| | | SUM( CASE WHEN tor.order_type = 1 THEN 1 ELSE 0 END ) a, |
| | | SUM( CASE WHEN tor.order_type = 2 THEN 1 ELSE 0 END ) b, |
| | | SUM( tor.total_amount ) c, |
| | | SUM( CASE WHEN tor.order_type = 1 THEN tor.total_amount ELSE 0 END ), |
| | | SUM( CASE WHEN tor.order_type = 2 THEN tor.total_amount ELSE 0 END ) |
| | | FROM |
| | | t_order tor |
| | | <where> |
| | | <if test="startTime != null"> |
| | | and tor.create_time <![CDATA[>=]]> #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and tor.create_time <![CDATA[<=]]> #{endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>netty-all</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel-core</artifactId> |
| | | <version>RELEASE</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.alibaba</groupId>--> |
| | | <!-- <artifactId>easyexcel-core</artifactId>--> |
| | | <!-- <version>RELEASE</version>--> |
| | | <!-- <scope>compile</scope>--> |
| | | <!-- </dependency>--> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| | |
| | | import com.ruoyi.other.service.BannerService; |
| | | 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; |
| | |
| | | private BannerService bannerService; |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "banner列表", tags = {"小程序-banner"}) |
| | | public R<List<Banner>> list(String name, Integer jumpType, Integer position){ |
| | | public R<List<Banner>> list(@ApiParam("名称") String name, |
| | | @ApiParam("跳转类型(1=无跳转,2=外部链接,3=商品详情,4=秒杀商品详情,5=领券中心)") Integer jumpType, |
| | | @ApiParam("位置(1=首页,2=商城首页)") Integer position){ |
| | | List<Banner> list = bannerService.lambdaQuery().like(StringUtils.isNotEmpty(name), Banner::getName, name) |
| | | .eq(jumpType!=null,Banner::getJumpType, jumpType) |
| | | .eq(position!=null,Banner::getPosition, position) |
| | |
| | | |
| | | |
| | | |
| | | @PostMapping("/getRefundPassSetting") |
| | | @GetMapping("/getRefundPassSetting") |
| | | @ApiOperation(value = "获取售后设置", tags = {"管理后台-售后管理"}) |
| | | public R<RefundPassSettingVo> getRefundPassSetting(){ |
| | | BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5)); |
| | |
| | | } |
| | | @GetMapping("/search") |
| | | @ApiOperation(value = "积分配置查询", tags = {"后台"}) |
| | | public R<List<PointSetting>> search(@RequestParam Integer id) { |
| | | public R<List<PointSetting>> search() { |
| | | List<PointSetting> list = pointSettingService.list(); |
| | | return R.ok(list); |
| | | } |
| | | @PostMapping("/save") |
| | | @ApiOperation(value = "积分配置", tags = {"后台"}) |
| | | public R<PointSetting> save(@RequestBody PointSettingDto pointSettingDto) { |
| | | pointSettingService.remove(Wrappers.lambdaQuery()); |
| | | pointSettingService.saveBatch(pointSettingDto.getPointSettings()); |
| | | pointSettingService.saveOrUpdateBatch(pointSettingDto.getPointSettings()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.api.model.UserClickLog; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.RechargeSet; |
| | | import com.ruoyi.other.dto.RechargeDto; |
| | | import com.ruoyi.other.service.RechargeSetService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | } |
| | | @PostMapping("/set") |
| | | @ApiOperation(value = "充值设置", tags = {"后台"}) |
| | | public R<List<RechargeSet>> detail(@RequestBody List<RechargeSet> rechargeSets) { |
| | | boolean remove = rechargeSetService.remove(Wrappers.lambdaQuery()); |
| | | rechargeSetService.saveBatch(rechargeSets); |
| | | public R<List<RechargeSet>> detail(@RequestBody RechargeDto rechargeDto) { |
| | | List<RechargeSet> list = rechargeSetService.list(); |
| | | rechargeSetService.removeBatchByIds(list); |
| | | rechargeSetService.saveBatch(rechargeDto.getRechargeSets()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.dto.ShopBalanceDto; |
| | | import com.ruoyi.other.mapper.ShopBalanceStatementMapper; |
| | | import com.ruoyi.other.service.ShopBalanceStatementService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.ShopCommissionStatisticsVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class ShopBalanceStatementController { |
| | | @Resource |
| | | private ShopBalanceStatementService shopBalanceStatementService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private ShopBalanceStatementMapper shopBalanceStatementMapper; |
| | | |
| | | /** |
| | | * 门店分佣统计 |
| | |
| | | } |
| | | @GetMapping("/commissionStatistics/list") |
| | | @ApiOperation(value = "门店余额明细", notes = "门店余额明细", tags = {"门店后台"}) |
| | | public R<ShopCommissionStatisticsVO> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | ShopBalanceStatement shopBalanceStatement){ |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(pageNum, pageSize), shopBalanceStatement); |
| | | return R.ok(shopCommissionStatisticsVO); |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | Page<ShopBalanceStatement> page = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(shopBalanceStatement.getType() != null, ShopBalanceStatement::getType, shopBalanceStatement.getType()) |
| | | .orderByDesc(ShopBalanceStatement::getCreateTime) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | |
| | | return R.ok(page); |
| | | |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private ShopService shopService; |
| | | @GetMapping("/commissionStatistics/info") |
| | | @ApiOperation(value = "门店余额明细上方数据", notes = "门店余额明细", tags = {"门店后台"}) |
| | | public R<ShopBalanceDto> shopCommissionStatisticsinfo(){ |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | ShopBalanceDto dto = new ShopBalanceDto(); |
| | | List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 3).list(); |
| | | List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 4).list(); |
| | | BigDecimal bigDecimal1 = new BigDecimal(0); |
| | | for (ShopBalanceStatement shopBalanceStatement : list) { |
| | | bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount()); |
| | | } |
| | | for (ShopBalanceStatement shopBalanceStatement : list1) { |
| | | bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount()); |
| | | } |
| | | dto.setBigDecimal1(bigDecimal1); |
| | | |
| | | BigDecimal bigDecimal2= new BigDecimal(0); |
| | | for (ShopBalanceStatement shopBalanceStatement : list) { |
| | | bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount()); |
| | | } |
| | | dto.setBigDecimal2(bigDecimal2); |
| | | |
| | | BigDecimal bigDecimal3= new BigDecimal(0); |
| | | for (ShopBalanceStatement shopBalanceStatement : list1) { |
| | | bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount()); |
| | | } |
| | | dto.setBigDecimal3(bigDecimal3); |
| | | |
| | | List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 2).list(); |
| | | BigDecimal bigDecimal4= new BigDecimal(0); |
| | | for (ShopBalanceStatement shopBalanceStatement : list2) { |
| | | bigDecimal4 = bigDecimal4.add(shopBalanceStatement.getVariableAmount()); |
| | | } |
| | | dto.setBigDecimal4(bigDecimal4); |
| | | |
| | | Shop byId = shopService.getById(objectId); |
| | | dto.setBigDecimal5(byId.getCanWithdrawMoney()); |
| | | dto.setBigDecimal6(byId.getWithdrawMoney()); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出门店分佣统计 |
| | |
| | | util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/getList") |
| | | public R<List<ShopBalanceStatement>> getList(@RequestBody ShopBalanceStatement shopBalanceStatement){ |
| | | return R.ok(shopBalanceStatementMapper.selectShopBalanceStatementList(shopBalanceStatement)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopScore; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.service.ShopScoreService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import com.ruoyi.other.vo.ShopStatistics; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private ShopMapper shopMapper; |
| | | |
| | | |
| | | |
| | |
| | | shop.setShopPoint(0); |
| | | shop.setSharePoint(0); |
| | | shop.setServerPoint(0); |
| | | shop.setLowerLevelRebatePoints(0); |
| | | shop.setUsePoint(0); |
| | | shop.setGiveawayAllMoney(BigDecimal.ZERO); |
| | | shop.setGiveawayMoney(BigDecimal.ZERO); |
| | |
| | | appUserShop.setShopId(shop.getId()); |
| | | R<Void> r = appUserClient.addAppUserShop(appUserShop); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("添加失败"); |
| | | } |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | if (appUser == null){ |
| | | throw new RuntimeException("添加失败"); |
| | | } |
| | | appUser.setUserType(2); |
| | | R<Void> editAppUserR = appUserClient.editAppUserById(appUser); |
| | | if (R.isError(editAppUserR)){ |
| | | throw new RuntimeException("添加失败"); |
| | | } |
| | | return R.ok(); |
| | |
| | | @PutMapping("/editShop") |
| | | @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台-门店管理"}) |
| | | public R<Void> editShop(@RequestBody Shop shop){ |
| | | String phone = shop.getPhone(); |
| | | if (!shopService.cheUserByPhone(phone)) { |
| | | return R.fail("该手机号未注册"); |
| | | } |
| | | shopService.updateById(shop); |
| | | return R.ok(); |
| | | } |
| | |
| | | R<List<AppUserShop>> r = appUserClient.getAppUserShop(SecurityUtils.getUserId()); |
| | | if (R.isSuccess(r)){ |
| | | List<AppUserShop> appUserShopList = r.getData(); |
| | | if (CollectionUtils.isEmpty(appUserShopList)){ |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<Integer> shopIds = appUserShopList.stream().map(AppUserShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shopList = shopService.listByIds(shopIds); |
| | | return R.ok(shopList); |
| | |
| | | return R.ok(list.stream().map(Shop::getId).collect(Collectors.toSet())); |
| | | } |
| | | |
| | | /** |
| | | * 门店统计 |
| | | */ |
| | | @GetMapping("/shopStatistics") |
| | | @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"}) |
| | | public R<ShopStatistics> shopStatistics(@ApiParam("门店名称") String shopName) { |
| | | ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopName); |
| | | return R.ok(shopStatistics); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "门店积分统计列表", notes = "门店积分统计", tags = {"门店后台"}) |
| | | public R<Page<ShopPoint>> shopstatisticslist(ShopPoint shopPoint,Integer pageNum,Integer pageSize) { |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | Page<ShopPoint> page = shopPointService.lambdaQuery().eq(ShopPoint::getShopId, objectId).eq(ShopPoint::getType, shopPoint.getType()) |
| | | Page<ShopPoint> page = shopPointService.lambdaQuery().eq(ShopPoint::getShopId, objectId).eq(shopPoint.getType()!=null,ShopPoint::getType, shopPoint.getType()) |
| | | .like(shopPoint.getOrderNum()!=null,ShopPoint::getOrderNum, shopPoint.getOrderNum()) |
| | | .orderByDesc(ShopPoint::getCreateTime) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | @GetMapping("/statistics/list") |
| | | @ApiOperation(value = "门店积分明细必传门店id", tags = {"后台"}) |
| | | public R<Page<ShopPoint>> statisticslist(ShopPoint shopPoint,Integer pageNum,Integer pageSize) { |
| | | Page<ShopPoint> page = shopPointService.lambdaQuery().eq(ShopPoint::getShopId, shopPoint.getShopId()).eq(shopPoint.getType()!=null,ShopPoint::getType, shopPoint.getType()) |
| | | .like(shopPoint.getOrderNum()!=null,ShopPoint::getOrderNum, shopPoint.getOrderNum()) |
| | | .orderByDesc(ShopPoint::getCreateTime) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出门店积分统计 |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopWithdraw; |
| | | import com.ruoyi.other.dto.ShopBalanceDto; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.service.ShopWithdrawService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @GetMapping("/shop/list") |
| | | @ApiOperation(value = "提现申请列表", notes = "提现申请列表", tags = {"门店后台"}) |
| | | public R<IPage<ShopWithdraw>> shoplist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | ShopWithdraw shopWithdraw) { |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>() |
| | | .eq(ShopWithdraw::getShopId,objectId) |
| | | .eq(shopWithdraw.getAuditStatus()!=null,ShopWithdraw::getAuditStatus,shopWithdraw.getAuditStatus()) |
| | | .orderByDesc(ShopWithdraw::getCreateTime) |
| | | ); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @GetMapping("/shop/info") |
| | | @ApiOperation(value = "提现申请列表上方数据", notes = "提现申请列表", tags = {"门店后台"}) |
| | | public R<Shop> shopCommissionStatisticsinfo(){ |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | Shop byId = shopService.getById(objectId); |
| | | return R.ok(byId); |
| | | } |
| | | @GetMapping("/shop/with") |
| | | @ApiOperation(value = "提现申请", notes = "提现申请列表", tags = {"门店后台"}) |
| | | public R<Shop> shopwith(@RequestParam BigDecimal money){ |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | Shop byId = shopService.getById(objectId); |
| | | if (money.compareTo(byId.getCanWithdrawMoney())>0){ |
| | | return R.fail("提现金额不能大于可提现金额"); |
| | | } |
| | | ShopWithdraw shopWithdraw = new ShopWithdraw(); |
| | | shopWithdraw.setShopId(objectId); |
| | | shopWithdraw.setMoney(money); |
| | | shopWithdraw.setAuditStatus(0); |
| | | shopWithdraw.setStatus(1); |
| | | shopWithdrawService.save(shopWithdraw); |
| | | |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 审核 |
| | | */ |
New file |
| | |
| | | package com.ruoyi.other.dto; |
| | | |
| | | import com.ruoyi.other.api.domain.RechargeSet; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2024/12/18 18:03 |
| | | */ |
| | | @Data |
| | | public class RechargeDto { |
| | | private List<RechargeSet> rechargeSets; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | @Data |
| | | public class ShopBalanceDto { |
| | | @ApiModelProperty("分佣总金额") |
| | | private BigDecimal bigDecimal1; |
| | | @ApiModelProperty("服务费分佣") |
| | | private BigDecimal bigDecimal2; |
| | | @ApiModelProperty("关联用户分佣") |
| | | private BigDecimal bigDecimal3; |
| | | @ApiModelProperty("下级门店分佣") |
| | | private BigDecimal bigDecimal4; |
| | | @ApiModelProperty("可提现金额") |
| | | private BigDecimal bigDecimal5; |
| | | @ApiModelProperty("已提现金额") |
| | | private BigDecimal bigDecimal6; |
| | | } |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopBalanceStatementMapper extends BaseMapper<ShopBalanceStatement> { |
| | | List<ShopBalanceStatement> findLatestChangeByType(ShopBalanceStatement shopBalanceStatement); |
| | | |
| | | IPage<ShopBalanceStatement> queryShopBalanceStatementPage(@Param("page") IPage<ShopBalanceStatement> page, |
| | | @Param("bs") ShopBalanceStatement shopBalanceStatement); |
| | | |
| | | List<ShopBalanceStatement> selectShopBalanceStatementList(@Param("bs") ShopBalanceStatement shopBalanceStatement); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import com.ruoyi.other.vo.ShopStatistics; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | ShopDetailVO selectShopDetail(Integer shopId); |
| | | |
| | | ShopStatistics getShopStatistics(String shopName); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.mapper.ShopBalanceStatementMapper; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.mapper.ShopBalanceStatementMapper; |
| | | import com.ruoyi.other.service.ShopBalanceStatementService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.ShopCommissionStatisticsVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class ShopBalanceStatementServiceImpl extends ServiceImpl<ShopBalanceStatementMapper, ShopBalanceStatement> implements ShopBalanceStatementService { |
| | | @Resource |
| | | private ShopBalanceStatementMapper shopBalanceStatementMapper; |
| | | @Resource |
| | | private ShopService shopService; |
| | | |
| | | |
| | | @Override |
| | | public ShopCommissionStatisticsVO shopCommissionStatistics(IPage<ShopBalanceStatement> page, ShopBalanceStatement shopBalanceStatement) { |
| | | List<ShopBalanceStatement> latestChangeByType = shopBalanceStatementMapper.findLatestChangeByType(shopBalanceStatement); |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = new ShopCommissionStatisticsVO(); |
| | | for (ShopBalanceStatement sp : latestChangeByType) { |
| | | switch (sp.getType()) { |
| | | case 1: |
| | | shopCommissionStatisticsVO.setTotalCommission(sp.getBalance()); |
| | | break; |
| | | case 2: |
| | | shopCommissionStatisticsVO.setTotalSubordinateCommission(sp.getBalance()); |
| | | break; |
| | | case 3: |
| | | shopCommissionStatisticsVO.setTotalServiceCharge(sp.getBalance()); |
| | | break; |
| | | } |
| | | } |
| | | shopCommissionStatisticsVO.setTotalAmount(shopCommissionStatisticsVO.getTotalCommission() |
| | | .add(shopCommissionStatisticsVO.getTotalSubordinateCommission()) |
| | | .add(shopCommissionStatisticsVO.getTotalServiceCharge())); |
| | | List<ShopBalanceStatement> shopBalanceStatements = this.baseMapper.selectShopBalanceStatementList(shopBalanceStatement); |
| | | |
| | | Map<Integer, BigDecimal> shopCommissionMap = shopBalanceStatements.stream() |
| | | .collect(Collectors.groupingBy( |
| | | ShopBalanceStatement::getType, |
| | | Collectors.reducing( |
| | | BigDecimal.ZERO, |
| | | ShopBalanceStatement::getVariableAmount, |
| | | BigDecimal::add |
| | | ) |
| | | )); |
| | | |
| | | BigDecimal totalCommission = shopCommissionMap.getOrDefault(1,BigDecimal.ZERO); |
| | | BigDecimal totalSubordinateCommission = shopCommissionMap.getOrDefault(2,BigDecimal.ZERO); |
| | | BigDecimal totalServiceCharge = shopCommissionMap.getOrDefault(3,BigDecimal.ZERO); |
| | | |
| | | BigDecimal totalAmount = totalCommission.add(totalSubordinateCommission).add(totalServiceCharge); |
| | | shopCommissionStatisticsVO.setTotalAmount(totalAmount); |
| | | |
| | | IPage<ShopBalanceStatement> statementIPage = this.baseMapper.queryShopBalanceStatementPage(page, shopBalanceStatement); |
| | | shopCommissionStatisticsVO.setStatementIPage(statementIPage); |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("门店统计") |
| | | public class ShopStatistics { |
| | | |
| | | /** |
| | | * 门店积分总数 |
| | | */ |
| | | @ApiModelProperty("门店积分总数") |
| | | private Integer totalPoint; |
| | | |
| | | /** |
| | | * 门店返佣积分总数 |
| | | */ |
| | | @ApiModelProperty("门店返佣积分总数") |
| | | private Integer commissionPoint; |
| | | |
| | | /** |
| | | * 门店服务积分总数 |
| | | */ |
| | | @ApiModelProperty("门店服务积分总数") |
| | | private Integer servicePoint; |
| | | |
| | | /** |
| | | * 绑定下级门店返佣积分总数 |
| | | */ |
| | | @ApiModelProperty("绑定下级门店返佣积分总数") |
| | | private Integer bindCommissionPoint; |
| | | |
| | | /** |
| | | * 门店分佣总金额 |
| | | */ |
| | | @ApiModelProperty("门店分佣总金额") |
| | | private Double totalCommissionMoney; |
| | | |
| | | /** |
| | | * 门店分佣金额 |
| | | */ |
| | | @ApiModelProperty("门店分佣金额") |
| | | private Double commissionMoney; |
| | | |
| | | /** |
| | | * 绑定下级分佣金额 |
| | | */ |
| | | @ApiModelProperty("绑定下级分佣金额") |
| | | private Double bindCommissionMoney; |
| | | |
| | | /** |
| | | * 门店服务分佣金额 |
| | | */ |
| | | @ApiModelProperty("门店服务分佣金额") |
| | | private Double serviceCommissionMoney; |
| | | |
| | | /** |
| | | * 门店订单总数 |
| | | */ |
| | | @ApiModelProperty("门店订单总数") |
| | | private Integer totalOrder; |
| | | |
| | | /** |
| | | * 服务订单数 |
| | | */ |
| | | @ApiModelProperty("服务订单数") |
| | | private Integer serviceOrder; |
| | | |
| | | /** |
| | | * 单品-上门自提订单数 |
| | | */ |
| | | @ApiModelProperty("单品-上门自提订单数") |
| | | private Integer goodsOrder; |
| | | |
| | | /** |
| | | * 可提现金额 |
| | | */ |
| | | @ApiModelProperty("可提现金额") |
| | | private Double canWithdrawMoney; |
| | | |
| | | /** |
| | | * 已提现金额 |
| | | */ |
| | | @ApiModelProperty("已提现金额") |
| | | private Double alreadyWithdrawMoney; |
| | | |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.ShopBalanceStatementMapper"> |
| | | |
| | | <select id="findLatestChangeByType" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement"> |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_balance, |
| | | variable_amount, |
| | | balance, |
| | | create_time, |
| | | create_user_id, |
| | | object_id |
| | | FROM |
| | | ( |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_balance, |
| | | variable_amount, |
| | | balance, |
| | | create_time, |
| | | create_user_id, |
| | | object_id, |
| | | ROW_NUMBER() OVER ( PARTITION BY type, create_user_id ORDER BY create_time DESC ) AS rn |
| | | FROM |
| | | t_shop_balance_statement |
| | | ) AS subquery |
| | | WHERE |
| | | rn = 1 |
| | | </select> |
| | | <select id="queryShopBalanceStatementPage" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement"> |
| | | <sql id="shopBalanceStatementList"> |
| | | SELECT |
| | | tsbs.*, |
| | | ts.`name` shopName, |
| | |
| | | ts.phone |
| | | FROM |
| | | t_shop_balance_statement tsbs |
| | | INNER JOIN t_shop ts ON ts.id = tsbs.shop_id AND ts.del_flag = 0 |
| | | INNER JOIN t_shop ts ON ts.id = tsbs.shop_id |
| | | <where> |
| | | <if test="bs.shopName != null and bs.shopName != ''"> |
| | | AND ts.`name` like concat('%', #{bs.shopName}, '%') |
| | |
| | | AND tsbs.create_time BETWEEN #{bs.startTime} AND #{bs.endTime} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <select id="queryShopBalanceStatementPage" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement"> |
| | | <include refid="shopBalanceStatementList"/> |
| | | </select> |
| | | <select id="selectShopBalanceStatementList" resultType="com.ruoyi.other.api.domain.ShopBalanceStatement"> |
| | | <include refid="shopBalanceStatementList"/> |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getShopStatistics" resultType="com.ruoyi.other.vo.ShopStatistics"> |
| | | SELECT |
| | | SUM(ts.shop_all_point) totalPoint, |
| | | SUM(ts.share_point) commissionPoint, |
| | | SUM(ts.server_point) servicePoint, |
| | | SUM(ts.lower_level_giveaway_money) bindCommissionPoint, |
| | | SUM(ts.giveaway_all_money) totalCommissionMoney, |
| | | SUM(ts.giveaway_money) commissionMoney, |
| | | SUM(ts.lower_level_giveaway_money) bindCommissionMoney, |
| | | SUM(ts.server_giveaway_money) serviceCommissionMoney, |
| | | SUM(ts.order_number) totalOrder, |
| | | SUM(ts.server_order_number) serviceOrder, |
| | | SUM(ts.custom_order_number) goodsOrder, |
| | | SUM(ts.can_withdraw_money) canWithdrawMoney, |
| | | SUM(ts.withdraw_money) alreadyWithdrawMoney |
| | | FROM |
| | | t_shop ts |
| | | </select> |
| | | </mapper> |