Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java
# ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
2 文件已重命名
44个文件已修改
3个文件已删除
8个文件已添加
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty("类型:1充值2提现3红包4分佣5商城购物6订单取消回退") |
| | | @Excel(name = "变更类型", readConverterExp = "1=充值,2=提现,3=红包,4=分佣,5=商城购物,6=订单取消回退") |
| | | private Integer changeType; |
| | | |
| | | @ApiModelProperty("变更前金额") |
| | | private BigDecimal beforeAmount; |
| | | |
| | | @ApiModelProperty("变更金额") |
| | | @Excel(name = "变更数量") |
| | | private BigDecimal changeAmount; |
| | | |
| | | @ApiModelProperty("变更后金额") |
| | |
| | | private Integer delFlag; |
| | | |
| | | @ApiModelProperty("添加时间") |
| | | @Excel(name = "变更时间",dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("消费用户名称") |
| | | @Excel(name = "用户名称") |
| | | private String userName; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("消费用户手机号") |
| | | @Excel(name = "联系电话") |
| | | private String userPhone; |
| | | |
| | | @TableField(exist = false) |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | @TableField(exist = false) |
| | | private String shopName; |
| | | |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "变动类型(1-消费,2-返佣,3-拉新,4-每日分享,5-每日签到,6-使用时长, 7-注册积分, 8-门店业绩," + |
| | | "9-门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人)") |
| | | "9-门店返佣,14-下级门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人)") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | |
| | | @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("server_point") |
| | | private Integer serverPoint; |
| | | |
| | | @ApiModelProperty(value = "下级门店返佣积分") |
| | | @TableField("lower_level_rebate_points") |
| | | private Integer lowerLevelRebatePoints; |
| | | |
| | | @ApiModelProperty(value = "门店已用积分") |
| | | @TableField("use_point") |
| | | private Integer usePoint; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @ApiModelProperty(value = "变动类型(1=门店业绩,2=门店返佣,3=下级门店返佣)") |
| | | @TableField("type") |
| | | @Excel(name = "变动类型", readConverterExp = "1=门店业绩,2=门店返佣,3=下级门店返佣") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "历史余额") |
| | |
| | | |
| | | @ApiModelProperty(value = "变动金额") |
| | | @TableField("variable_point") |
| | | @Excel(name = "变动金额") |
| | | private Integer variablePoint; |
| | | |
| | | @ApiModelProperty(value = "变动时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "变动时间") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "变动用户id") |
| | |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | @TableField(exist = false) |
| | | @Excel(name = "门店名称") |
| | | private String shopName; |
| | | |
| | | @ApiModelProperty(value = "店长姓名") |
| | | @TableField(exist = false) |
| | | @Excel(name = "店长姓名") |
| | | private String shopLeaderName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField(exist = false) |
| | | @Excel(name = "联系电话") |
| | | private String phone; |
| | | |
| | | @TableField(exist = false) |
File was renamed from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/enums/PointChangeType.java |
| | |
| | | package com.ruoyi.account.enums; |
| | | package com.ruoyi.other.api.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | |
| | | REGISTER(7, "注册积分"), |
| | | SHOP_ACHIEVEMENT(8, "门店业绩"), |
| | | SHOP_REBATE(9, "门店返佣"), |
| | | JUNIOR_SHOP_REBATE(14, "下级门店返佣"), |
| | | TECHNICIAN_ACHIEVEMENT(10, "技师业绩"), |
| | | EXCHANGE_GOODS(11, "兑换商品"), |
| | | OTHER_GIFT(12, "他人赠送"), |
File was renamed from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/enums/WithdrawalAuditStatus.java |
| | |
| | | package com.ruoyi.account.enums; |
| | | package com.ruoyi.other.api.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.feignClient.ShopBalanceStatementClient; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class ShopBalanceStatementClientFallbackFactory implements FallbackFactory<ShopBalanceStatementClient> { |
| | | @Override |
| | | public ShopBalanceStatementClient create(Throwable cause) { |
| | | return new ShopBalanceStatementClient(){ |
| | | |
| | | @Override |
| | | public R<List<ShopBalanceStatement>> getList(ShopBalanceStatement shopBalanceStatement) { |
| | | return R.fail("获取门店余额流水失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.factory.ShopBalanceStatementClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(contextId = "ShopBalanceStatementClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = ShopBalanceStatementClientFallbackFactory.class) |
| | | public interface ShopBalanceStatementClient { |
| | | |
| | | @PostMapping("/shop-balance-statement/getList") |
| | | R<List<ShopBalanceStatement>> getList(@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> |
| | |
| | | @ApiOperation(value = "个人信息-修改密码") |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) |
| | | public AjaxResult updatePwd(String username,String oldPassword, String newPassword) |
| | | { |
| | | System.err.println(oldPassword); |
| | | System.err.println(newPassword); |
| | | String username = SecurityUtils.getUsername(); |
| | | // String username = SecurityUtils.getUsername(); |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | String password = user.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | |
| | | |
| | | /** 菜单图标 */ |
| | | private String icon; |
| | | @TableField("role_type") |
| | | private String roleType; |
| | | |
| | | /** 子菜单 */ |
| | | @TableField(exist = false) |
| | |
| | | this.children = children; |
| | | } |
| | | |
| | | public String getRoleType() { |
| | | return roleType; |
| | | } |
| | | |
| | | public void setRoleType(String roleType) { |
| | | this.roleType = roleType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | |
| | | List<SysMenus> getAllInIds(@Param("menusId") List<Long> menusId); |
| | | |
| | | List<SysMenus> getAllOne(); |
| | | List<SysMenus> getAllOne(@Param("roleType") Integer roleType); |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysMenu; |
| | | import com.ruoyi.system.domain.SysMenus; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | |
| | | @Override |
| | | public List<SysMenus> getAllMenu() { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserMapper.selectById(userid); |
| | | SysUserRole sysUserRole = sysUserRoleMapper.selectSysUserRoleByUserId(userid); |
| | | Long roleId = sysUserRole.getRoleId(); |
| | | List<SysMenus> list=null; |
| | | if(roleId!=1){ |
| | | list = menuMapper.getAllOne(); |
| | | list = menuMapper.getAllOne(sysUser.getRoleType()); |
| | | }else { |
| | | list = menuMapper.getAll(); |
| | | } |
| | |
| | | update_by updateBy, |
| | | update_time updateTime, |
| | | remark |
| | | from sys_menu |
| | | from sys_menu where role_type = 1 |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getAllInIds" resultType="com.ruoyi.system.domain.SysMenus"> |
| | |
| | | update_by updateBy, |
| | | update_time updateTime, |
| | | remark |
| | | from sys_menu where menu_id !=1074 and menu_id !=1075 and menu_id !=1193 and menu_id !=1194 |
| | | from sys_menu where role_type = #{roleType} |
| | | order by create_time desc |
| | | </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.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; |
| | |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private AppUserMapper appUserMapper; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | 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(String userName) { |
| | | UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(userName); |
| | | return R.ok(userStatisticsDetail); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.dto.BalanceQuery; |
| | | import com.ruoyi.account.excel.BalanceChangeRecordEX; |
| | | import com.ruoyi.account.service.BalanceChangeRecordService; |
| | | import com.ruoyi.account.vo.CommissionStatistics; |
| | | import com.ruoyi.account.vo.WalletStatistics; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/balanceChangeRecord") |
| | | public class BalanceChangeRecordController { |
| | | |
| | | @Resource |
| | | private BalanceChangeRecordService balanceChangeRecordService; |
| | | |
| | | |
| | | /** |
| | | * 保存账户流水记录 |
| | | * @param balanceChangeRecord |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveBalanceChangeRecord") |
| | | public R saveBalanceChangeRecord(@RequestBody BalanceChangeRecord balanceChangeRecord){ |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "余额变更明细", tags = {"后台"}) |
| | | public R<IPage<BalanceChangeRecord>> page(@RequestBody BalanceQuery agentQuery) { |
| | | @Resource |
| | | private BalanceChangeRecordService balanceChangeRecordService; |
| | | |
| | | return R.ok(balanceChangeRecordService.pageList(agentQuery)); |
| | | } |
| | | |
| | | /** |
| | | * 用户分佣统计 |
| | | */ |
| | | @GetMapping("/commissionStatistics") |
| | | @ApiOperation(value = "用户分佣统计", tags = "管理后台-财务统计-用户分佣统计") |
| | | public R<CommissionStatistics> commissionStatistics(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | BalanceChangeRecord balanceChangeRecord) { |
| | | CommissionStatistics commissionStatistics1 = balanceChangeRecordService.commissionStatistics(Page.of(pageNum, pageSize), balanceChangeRecord); |
| | | return R.ok(commissionStatistics1); |
| | | } |
| | | // |
| | | /** |
| | | * 保存账户流水记录 |
| | | * |
| | | * @param balanceChangeRecord |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveBalanceChangeRecord") |
| | | public R saveBalanceChangeRecord(@RequestBody BalanceChangeRecord balanceChangeRecord) { |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "余额变更明细", tags = {"后台"}) |
| | | public R<IPage<BalanceChangeRecord>> page(@RequestBody BalanceQuery agentQuery) { |
| | | |
| | | return R.ok(balanceChangeRecordService.pageList(agentQuery)); |
| | | } |
| | | |
| | | /** |
| | | * 用户分佣统计 |
| | | */ |
| | | @GetMapping("/commissionStatistics") |
| | | @ApiOperation(value = "用户分佣统计", tags = "管理后台-财务统计-用户分佣统计") |
| | | public R<CommissionStatistics> commissionStatistics(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | BalanceChangeRecord balanceChangeRecord) { |
| | | CommissionStatistics commissionStatistics1 = balanceChangeRecordService.commissionStatistics(Page.of(pageNum, pageSize), balanceChangeRecord); |
| | | return R.ok(commissionStatistics1); |
| | | } |
| | | |
| | | // |
| | | // /** |
| | | // * 导出用户分佣统计 |
| | | // */ |
| | | @GetMapping("/commissionExport") |
| | | @ApiOperation(value = "用户分佣统计导出", tags = "管理后台-财务统计-用户分佣统计") |
| | | public void commissionExport(HttpServletResponse response, BalanceChangeRecord balanceChangeRecord) { |
| | | CommissionStatistics commissionStatistics1 = balanceChangeRecordService.commissionStatistics(Page.of(1, Integer.MAX_VALUE), balanceChangeRecord); |
| | | IPage<BalanceChangeRecord> userPointPage = commissionStatistics1.getUserPointPage(); |
| | | List<BalanceChangeRecord> userPointList = userPointPage.getRecords(); |
| | | List<BalanceChangeRecordEX> userPointExList = new ArrayList<>(); |
| | | for (BalanceChangeRecord balanceChangeRecord1 : userPointList) { |
| | | BalanceChangeRecordEX balanceChangeRecordEX = new BalanceChangeRecordEX(); |
| | | balanceChangeRecordEX.setUserName(balanceChangeRecord1.getUserName()); |
| | | balanceChangeRecordEX.setPhone(balanceChangeRecord1.getUserPhone()); |
| | | balanceChangeRecordEX.setChangeTime(balanceChangeRecord1.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | balanceChangeRecordEX.setChangeNum(balanceChangeRecord1.getAfterAmount().toString()); |
| | | Integer type = balanceChangeRecord1.getChangeType(); |
| | | // 类型:1充值2提现3红包4分佣5商城购物6订单取消回退 |
| | | switch (type) { |
| | | case 1: |
| | | balanceChangeRecordEX.setType("充值"); |
| | | break; |
| | | case 2: |
| | | balanceChangeRecordEX.setType("提现"); |
| | | break; |
| | | case 3: |
| | | balanceChangeRecordEX.setType("红包"); |
| | | break; |
| | | case 4: |
| | | balanceChangeRecordEX.setType("分佣"); |
| | | break; |
| | | case 5: |
| | | balanceChangeRecordEX.setType("商城购物"); |
| | | break; |
| | | case 6: |
| | | balanceChangeRecordEX.setType("订单取消回退"); |
| | | break; |
| | | default: |
| | | balanceChangeRecordEX.setType("未知积分"); |
| | | } |
| | | userPointExList.add(balanceChangeRecordEX); |
| | | } |
| | | ExcelUtil<BalanceChangeRecordEX> util = new ExcelUtil<>(BalanceChangeRecordEX.class); |
| | | util.exportExcel(response, userPointExList, "用户分佣统计"); |
| | | } |
| | | @GetMapping("/commissionExport") |
| | | @ApiOperation(value = "用户分佣统计导出", tags = "管理后台-财务统计-用户分佣统计") |
| | | public void commissionExport(HttpServletResponse response, BalanceChangeRecord balanceChangeRecord) { |
| | | CommissionStatistics commissionStatistics1 = balanceChangeRecordService.commissionStatistics(Page.of(1, Integer.MAX_VALUE), balanceChangeRecord); |
| | | IPage<BalanceChangeRecord> userPointPage = commissionStatistics1.getUserPointPage(); |
| | | List<BalanceChangeRecord> userPointList = userPointPage.getRecords(); |
| | | ExcelUtil<BalanceChangeRecord> util = new ExcelUtil<>(BalanceChangeRecord.class); |
| | | util.exportExcel(response, userPointList, "用户分佣统计"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 钱包统计 |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @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(String userName); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public interface BalanceChangeRecordMapper extends BaseMapper<BalanceChangeRecord> { |
| | | IPage<BalanceChangeRecord> pageList(@Param("page") Page<BalanceChangeRecord> page,@Param("agentQuery") BalanceQuery agentQuery); |
| | | |
| | | |
| | | List<BalanceChangeRecord> selectBalanceChangeRecordList(@Param("changeRecord") BalanceChangeRecord balanceChangeRecord); |
| | | |
| | | IPage<BalanceChangeRecord> queryCommissionStatistics(@Param("page") Page<BalanceChangeRecord> page, |
| | | @Param("changeRecord") BalanceChangeRecord changeRecord); |
| | | |
| | | List<UserPoint> findLatestChangeByType(BalanceChangeRecord balanceChangeRecord); |
| | | } |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | // 直推用户已成为代理数量 |
| | | 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()); |
| | | |
| | | // 已绑定门店数量 |
| | |
| | | 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.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.ShopBalanceStatementClient; |
| | | 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 ShopBalanceStatementClient shopBalanceStatementClient; |
| | | |
| | | @Override |
| | | public IPage<BalanceChangeRecord> pageList(BalanceQuery agentQuery) { |
| | |
| | | |
| | | @Override |
| | | public CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) { |
| | | List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord); |
| | | BigDecimal totalCommission = balanceChangeRecordList.stream() |
| | | .filter(item -> !(item.getChangeType().equals(2) && item.getChangeType().equals(5))) |
| | | .map(BalanceChangeRecord::getChangeAmount) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); |
| | | // return new CommissionStatistics(totalCommission, changeRecordPage); |
| | | return null; |
| | | 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 = shopBalanceStatementClient.getList(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(); |
| | | int fromIndex = (int) (current - 1); |
| | | int toIndex = (int) Math.min(fromIndex + size, walletStatisticsDetailList.size()); |
| | | |
| | | if (fromIndex < 0 || toIndex > 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; |
| | | } |
| | | |
| | | } |
| | |
| | | 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.account.enums.PointChangeType; |
| | | 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.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.PhoneNumberValidator; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.enums.WithdrawalAuditStatus; |
| | | import com.ruoyi.other.api.enums.WithdrawalAuditStatus; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | import com.ruoyi.account.service.AppUserService; |
| | |
| | | |
| | | public CommissionStatistics() { |
| | | } |
| | | public CommissionStatistics(BigDecimal totalCommission, Page<BalanceChangeRecord> changeRecordPage) { |
| | | public CommissionStatistics(BigDecimal totalCommission, IPage<BalanceChangeRecord> changeRecordPage) { |
| | | this.totalCommission = totalCommission; |
| | | this.userPointPage = changeRecordPage; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserStatistics { |
| | | /** |
| | | * 用户总数 |
| | | */ |
| | | private Integer totalUser; |
| | | |
| | | /** |
| | | * 拥有门店用户数 |
| | | */ |
| | | private Integer shopUser; |
| | | |
| | | /** |
| | | * 消费者用户数 |
| | | */ |
| | | private Integer consumerUser; |
| | | |
| | | /** |
| | | * 普通会员数 |
| | | */ |
| | | private Integer commonUser; |
| | | |
| | | /** |
| | | * 黄金会员数 |
| | | */ |
| | | private Integer goldUser; |
| | | |
| | | /** |
| | | * 钻石会员数 |
| | | */ |
| | | private Integer diamondUser; |
| | | |
| | | /** |
| | | * 创业者总数 |
| | | */ |
| | | private Integer entrepreneurUser; |
| | | |
| | | /** |
| | | * 准代理数 |
| | | */ |
| | | private Integer proxyUser; |
| | | |
| | | /** |
| | | * 代理数 |
| | | */ |
| | | private Integer agentUser; |
| | | |
| | | /** |
| | | * 总代数 |
| | | */ |
| | | private Integer totalAgentUser; |
| | | |
| | | /** |
| | | * 合伙人数 |
| | | */ |
| | | 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 = "门店名称") |
| | | private String shopName; |
| | | |
| | | /** |
| | | * 用户姓名 |
| | | */ |
| | | @ApiModelProperty(value = "用户姓名") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | 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") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 变更数量 |
| | | */ |
| | | @ApiModelProperty(value = "变更数量") |
| | | 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.name like CONCAT('%',#{userName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="queryCommissionStatistics" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> |
| | | |
| | | <sql id="balanceChangeRecordList"> |
| | | SELECT |
| | | tcr.*, |
| | | tau.`name` userName, |
| | | tau.phone userPhone |
| | | tau.phone userPhone, |
| | | tbcr.change_type, |
| | | tbcr.create_time, |
| | | tbcr.change_amount |
| | | FROM |
| | | t_balance_change_record tcr |
| | | LEFT JOIN t_app_user tau ON tcr.app_user_id = tau.id |
| | | t_balance_change_record tbcr |
| | | LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id |
| | | <where> |
| | | <if test="changeRecord.userName != null and changeRecord.userName != ''"> |
| | | and tau.name like concat('%',#{changeRecord.userName},'%') |
| | |
| | | <if test="changeRecord.userPhone != null and changeRecord.userPhone != ''"> |
| | | and tau.phone like concat('%',#{changeRecord.userPhone},'%') |
| | | </if> |
| | | <if test="changeRecord.changeType != null"> |
| | | and tcr.change_type = #{changeRecord.changeType} |
| | | </if> |
| | | <if test="changeRecord.startTime != null and changeRecord.endTime != null"> |
| | | and DATE(tcr.create_time) between #{changeRecord.startTime} and #{changeRecord.endTime} |
| | | and DATE(tbcr.create_time) between #{changeRecord.startTime} and #{changeRecord.endTime} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <select id="selectBalanceChangeRecordList" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> |
| | | <include refid="balanceChangeRecordList"/> |
| | | </select> |
| | | <select id="findLatestChangeByType" resultType="com.ruoyi.account.api.model.UserPoint"> |
| | | SELECT |
| | | id, |
| | | app_user_id, |
| | | order_id, |
| | | change_type, |
| | | before_amount, |
| | | change_amount, |
| | | after_amount, |
| | | del_flag, |
| | | create_time |
| | | FROM |
| | | ( |
| | | SELECT |
| | | id, |
| | | app_user_id, |
| | | order_id, |
| | | change_type, |
| | | before_amount, |
| | | change_amount, |
| | | after_amount, |
| | | del_flag, |
| | | create_time, |
| | | ROW_NUMBER() OVER ( PARTITION BY change_type, app_user_id ORDER BY create_time DESC ) rn |
| | | FROM |
| | | t_balance_change_record |
| | | <where> |
| | | <if test="changeRecord.userName != null and changeRecord.userName != ''"> |
| | | and tau.name like concat('%',#{changeRecord.userName},'%') |
| | | </if> |
| | | <if test="changeRecord.userPhone != null and changeRecord.userPhone != ''"> |
| | | and tau.phone like concat('%',#{changeRecord.userPhone},'%') |
| | | </if> |
| | | <if test="changeRecord.changeType != null"> |
| | | and tcr.change_type = #{changeRecord.changeType} |
| | | </if> |
| | | <if test="changeRecord.startTime != null and changeRecord.endTime != null"> |
| | | and DATE(tcr.create_time) between #{changeRecord.startTime} and #{changeRecord.endTime} |
| | | </if> |
| | | </where> |
| | | ) AS subquery |
| | | WHERE |
| | | rn = 1 |
| | | <select id="queryCommissionStatistics" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> |
| | | <include refid="balanceChangeRecordList"/> |
| | | </select> |
| | | </mapper> |
| | |
| | | <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; |
| | |
| | | private CommissionService commissionService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | @Resource |
| | | private OrderMapper orderMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | 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){ |
| | | OrderStatistics orderStatistics = orderMapper.getOrderStatistics(LocalDateTime.parse(startTime), LocalDateTime.parse(endTime)); |
| | | return R.ok(orderStatistics); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | 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)){ |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @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; |
| | | } |
| | |
| | | </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> |
| | |
| | | } |
| | | @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 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; |
| | | |
| | | /** |
| | |
| | | private ShopBalanceStatementService shopBalanceStatementService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private ShopBalanceStatementMapper shopBalanceStatementMapper; |
| | | |
| | | /** |
| | | * 门店分佣统计 |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.excel.ShopPointEX; |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import com.ruoyi.other.vo.ShopPointStatistics; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | ShopPointStatistics statistics = shopPointService.statistics(Page.of(1, Integer.MAX_VALUE), shopPoint); |
| | | if (statistics!=null){ |
| | | IPage<ShopPoint> shopPointIPage = statistics.getShopPointIPage(); |
| | | List<ShopPointEX> shopPointEXList = new ArrayList<>(); |
| | | if (shopPointIPage!=null){ |
| | | List<ShopPoint> records = shopPointIPage.getRecords(); |
| | | if (records!=null){ |
| | | for (ShopPoint record : records) { |
| | | ShopPointEX shopPointEX = new ShopPointEX(); |
| | | BeanUtils.copyBeanProp(shopPointEX, record); |
| | | Integer type = record.getType(); |
| | | switch (type) { |
| | | case 1: |
| | | shopPointEX.setType("门店业绩"); |
| | | break; |
| | | case 2: |
| | | shopPointEX.setType("门店返佣"); |
| | | break; |
| | | default: |
| | | shopPointEX.setType("下级门店返佣"); |
| | | break; |
| | | } |
| | | shopPointEXList.add(shopPointEX); |
| | | } |
| | | } |
| | | |
| | | ExcelUtil<ShopPointEX> util = new ExcelUtil<>(ShopPointEX.class); |
| | | util.exportExcel(response, shopPointEXList, "用户积分统计"); |
| | | } |
| | | ExcelUtil<ShopPoint> util = new ExcelUtil<>(ShopPoint.class); |
| | | util.exportExcel(response, shopPointIPage.getRecords(), "用户积分统计"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | * @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.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface ShopPointMapper extends BaseMapper<ShopPoint> { |
| | | |
| | | List<ShopPoint> findLatestChangeByType(ShopPoint shopPoint); |
| | | List<ShopPoint> selectShopPointList(@Param("shopPoint") ShopPoint shopPoint); |
| | | |
| | | IPage<ShopPoint> queryShpointPage(@Param("page") IPage<ShopPoint> page,@Param("shopPoint") ShopPoint shopPoint); |
| | | |
| | | |
| | | } |
| | |
| | | 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.get(1); |
| | | BigDecimal totalSubordinateCommission = shopCommissionMap.get(2); |
| | | BigDecimal totalServiceCharge = shopCommissionMap.get(3); |
| | | |
| | | BigDecimal totalAmount = totalCommission.add(totalSubordinateCommission).add(totalServiceCharge); |
| | | shopCommissionStatisticsVO.setTotalAmount(totalAmount); |
| | | |
| | | IPage<ShopBalanceStatement> statementIPage = this.baseMapper.queryShopBalanceStatementPage(page, shopBalanceStatement); |
| | | shopCommissionStatisticsVO.setStatementIPage(statementIPage); |
| | |
| | | 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.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.mapper.ShopPointMapper; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.api.enums.PointChangeType; |
| | | import com.ruoyi.other.mapper.ShopPointMapper; |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.ShopPointStatistics; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class ShopPointServiceImpl extends ServiceImpl<ShopPointMapper, ShopPoint> implements ShopPointService { |
| | | @Resource |
| | | private ShopPointMapper shopPointMapper; |
| | | @Resource |
| | | private ShopService shopService; |
| | | |
| | | @Override |
| | | public ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint) { |
| | | |
| | | String shopName = shopPoint.getShopName(); |
| | | String phone = shopPoint.getPhone(); |
| | | String shopLeaderName = shopPoint.getShopLeaderName(); |
| | | Integer shopId = shopPoint.getShopId(); |
| | | List<Integer> shopIds = shopService.listObjs(new LambdaQueryWrapper<Shop>() |
| | | .select(Shop::getId) |
| | | .eq(shopId!=null,Shop::getId,shopId) |
| | | .like(StringUtils.isNotEmpty(shopName), Shop::getName, shopName) |
| | | .like(StringUtils.isNotEmpty(phone), Shop::getPhone, phone) |
| | | .like(StringUtils.isNotEmpty(shopLeaderName), Shop::getShopManager, shopLeaderName)) |
| | | .stream().map(o -> (Integer) o).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(shopIds)) { |
| | | return new ShopPointStatistics(); |
| | | } |
| | | |
| | | shopPoint.setShopIds(shopIds); |
| | | |
| | | List<ShopPoint> shopPoints = this.baseMapper.selectShopPointList(shopPoint); |
| | | Map<Integer, Integer> shopPointMap = shopPoints.stream() |
| | | .collect(Collectors.groupingBy( |
| | | ShopPoint::getType, |
| | | Collectors.summingInt(ShopPoint::getVariablePoint) |
| | | )); |
| | | |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | List<ShopPoint> latestChangeByType = shopPointMapper.findLatestChangeByType(shopPoint); |
| | | for (ShopPoint sp : latestChangeByType) { |
| | | switch (sp.getType()) { |
| | | case 1: |
| | | shopPointStatistics.setShopPoint(sp.getVariablePoint()); |
| | | break; |
| | | case 2: |
| | | shopPointStatistics.setShopCommissionPoint(sp.getVariablePoint()); |
| | | break; |
| | | case 3: |
| | | shopPointStatistics.setSubShopCommissionPoint(sp.getVariablePoint()); |
| | | break; |
| | | } |
| | | } |
| | | shopPointStatistics.setTotalPoint(shopPointStatistics.getShopPoint() + shopPointStatistics.getShopCommissionPoint() + shopPointStatistics.getSubShopCommissionPoint()); |
| | | int sPoint = shopPointMap.getOrDefault(PointChangeType.SHOP_ACHIEVEMENT.getCode(), 0); |
| | | int shopCommissionPoint = shopPointMap.getOrDefault(PointChangeType.SHOP_REBATE.getCode(), 0); |
| | | int subShopCommissionPoint = shopPointMap.getOrDefault(PointChangeType.JUNIOR_SHOP_REBATE.getCode(), 0); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | |
| | | |
| | | boolean condition = shopPoint.getStartTime() != null && shopPoint.getEndTime() != null; |
| | | IPage<ShopPoint> shopPointIPage = page(page, new LambdaQueryWrapper<ShopPoint>() |
| | | .in(!CollectionUtils.isEmpty(shopPoint.getShopIds()), ShopPoint::getShopId, shopPoint.getShopIds()) |
| | | .eq(shopPoint.getType() != null, ShopPoint::getType, shopPoint.getType()) |
| | | .between(condition, ShopPoint::getCreateTime, shopPoint.getStartTime(), shopPoint.getEndTime()) |
| | | .orderByDesc(ShopPoint::getCreateTime)); |
| | | List<ShopPoint> shopPoints = shopPointIPage.getRecords(); |
| | | for (ShopPoint sp : shopPoints) { |
| | | Shop shop = shopService.getById(sp.getShopId()); |
| | | sp.setShopName(shop.getName()); |
| | | sp.setShopLeaderName(shop.getShopManager()); |
| | | sp.setPhone(shop.getPhone()); |
| | | } |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | return shopPointStatistics; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ShopStatistics { |
| | | |
| | | /** |
| | | * 门店积分总数 |
| | | */ |
| | | private Integer totalPoint; |
| | | |
| | | /** |
| | | * 门店返佣积分总数 |
| | | */ |
| | | private Integer commissionPoint; |
| | | |
| | | /** |
| | | * 门店服务积分总数 |
| | | */ |
| | | private Integer servicePoint; |
| | | |
| | | /** |
| | | * 绑定下级门店返佣积分总数 |
| | | */ |
| | | private Integer bindCommissionPoint; |
| | | |
| | | /** |
| | | * 门店分佣总金额 |
| | | */ |
| | | private Double totalCommissionMoney; |
| | | |
| | | /** |
| | | * 门店分佣金额 |
| | | */ |
| | | private Double commissionMoney; |
| | | |
| | | /** |
| | | * 绑定下级分佣金额 |
| | | */ |
| | | private Double bindCommissionMoney; |
| | | |
| | | /** |
| | | * 门店服务分佣金额 |
| | | */ |
| | | private Double serviceCommissionMoney; |
| | | |
| | | /** |
| | | * 门店订单总数 |
| | | */ |
| | | private Integer totalOrder; |
| | | |
| | | /** |
| | | * 服务订单数 |
| | | */ |
| | | private Integer serviceOrder; |
| | | |
| | | /** |
| | | * 单品-上门自提订单数 |
| | | */ |
| | | private Integer goodsOrder; |
| | | |
| | | /** |
| | | * 可提现金额 |
| | | */ |
| | | private Double canWithdrawMoney; |
| | | |
| | | /** |
| | | * 已提现金额 |
| | | */ |
| | | 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"> |
| | | <sql id="shopBalanceStatementList"> |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_balance, |
| | | variable_amount, |
| | | balance, |
| | | create_time, |
| | | create_user_id, |
| | | object_id |
| | | tsbs.*, |
| | | ts.`name` shopName, |
| | | ts.shop_manager shopManagerName, |
| | | ts.phone |
| | | 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"> |
| | | SELECT |
| | | tsbs.*, |
| | | ts.`name` shopName, |
| | | ts.shop_manager shopManagerName, |
| | | ts.phone |
| | | FROM |
| | | t_shop_balance_statement tsbs |
| | | INNER JOIN t_shop ts ON ts.id = tsbs.shop_id AND ts.del_flag = 0 |
| | | t_shop_balance_statement tsbs |
| | | INNER JOIN t_shop ts ON ts.id = tsbs.shop_id AND ts.del_flag = 0 |
| | | <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> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.ShopPointMapper"> |
| | | |
| | | <select id="findLatestChangeByType" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | | <sql id="ShopPointList"> |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_point, |
| | | variable_point, |
| | | create_time, |
| | | create_user_id, |
| | | object_id |
| | | ts.`name` shopName, |
| | | ts.shop_manager shopLeaderName, |
| | | ts.phone, |
| | | tsp.type, |
| | | tsp.create_time, |
| | | tsp.variable_point |
| | | FROM |
| | | ( |
| | | SELECT |
| | | id, |
| | | shop_id, |
| | | type, |
| | | historical_point, |
| | | variable_point, |
| | | 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_point |
| | | t_shop_point tsp |
| | | LEFT JOIN t_shop ts ON tsp.shop_id = ts.id |
| | | <where> |
| | | <if test="shopPoint.shopName != null and shopPoint.shopName != ''"> |
| | | AND ts.`name` LIKE concat('%',#{shopPoint.shopName},'%') |
| | | </if> |
| | | <if test="shopPoint.shopLeaderName != null and shopPoint.shopLeaderName != ''"> |
| | | AND ts.shop_manager LIKE concat('%',#{shopPoint.shopLeaderName},'%') |
| | | </if> |
| | | <if test="shopPoint.phone != null and shopPoint.phone != ''"> |
| | | AND ts.phone LIKE concat('%',#{shopPoint.phone},'%') |
| | | </if> |
| | | <if test="shopPoint.type != null"> |
| | | AND tsp.type = #{shopPoint.type} |
| | | </if> |
| | | <if test="shopPoint.startTime !=null and shopPoint.endTime !=null"> |
| | | AND tsp.create_time BETWEEN #{shopPoint.startTime} AND #{shopPoint.endTime} |
| | | </if> |
| | | |
| | | <where> |
| | | <if test="shopIds != null and shopIds.size() > 0"> |
| | | AND shop_id IN |
| | | <foreach collection="shopIds" item="shopId" open="(" close=")" separator=","> |
| | | #{shopId} |
| | | </foreach> |
| | | </if> |
| | | <if test="type != null"> |
| | | AND `type` = #{type} |
| | | </if> |
| | | <if test="startTime != null and endTime != null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </where> |
| | | ) AS subquery |
| | | WHERE |
| | | rn = 1 |
| | | </where> |
| | | </sql> |
| | | |
| | | <select id="selectShopPointList" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | | <include refid="ShopPointList"/> |
| | | </select> |
| | | <select id="queryShpointPage" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | | <include refid="ShopPointList"/> |
| | | </select> |
| | | </mapper> |