Merge remote-tracking branch 'origin/master'
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | |
| | | @TableField(exist = false) |
| | | @Excel(name = "联系电话") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private String endTime; |
| | | } |
| | |
| | | /** |
| | | * 包邮会员等级要求:1普通会员,2黄金会员,3钻石会员,4准代理,5代理,6总代,7合伙人 |
| | | */ |
| | | @ApiModelProperty(value = "包邮会员等级要求:1普通会员,2黄金会员,3钻石会员,4准代理,5代理,6总代,7合伙人") |
| | | private Integer freeVip; |
| | | @ApiModelProperty(value = "包邮会员等级要求:0全部 1普通会员,2黄金会员,3钻石会员,4准代理,5代理,6总代,7合伙人") |
| | | private String freeVip; |
| | | } |
| | |
| | | |
| | | public interface BalanceChangeRecordMapper extends BaseMapper<BalanceChangeRecord> { |
| | | IPage<BalanceChangeRecord> pageList(@Param("page") Page<BalanceChangeRecord> page,@Param("agentQuery") BalanceQuery agentQuery); |
| | | |
| | | IPage<BalanceChangeRecord> queryCommissionStatistics(@Param("page") Page<BalanceChangeRecord> page, |
| | | @Param("changeRecord") BalanceChangeRecord changeRecord); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) { |
| | | |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .like(StringUtils.isNotEmpty(balanceChangeRecord.getUserName()), AppUser::getName, balanceChangeRecord.getUserName()) |
| | | .like(StringUtils.isNotEmpty(balanceChangeRecord.getUserPhone()), AppUser::getPhone, balanceChangeRecord.getUserPhone())); |
| | | if (CollectionUtils.isEmpty(appUserList)){ |
| | | return new CommissionStatistics(); |
| | | } |
| | | |
| | | List<Long> appUserIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | |
| | | BigDecimal totalCommission = appUserList.stream() |
| | | .map(AppUser::getTotalDistributionAmount) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | |
| | | Page<BalanceChangeRecord> changeRecordPage = page(page, new LambdaQueryWrapper<BalanceChangeRecord>() |
| | | .in(BalanceChangeRecord::getAppUserId, appUserIds) |
| | | .between(balanceChangeRecord.getStartTime() != null && balanceChangeRecord.getEndTime() != null, |
| | | BalanceChangeRecord::getCreateTime, balanceChangeRecord.getStartTime(), balanceChangeRecord.getEndTime())); |
| | | return new CommissionStatistics(totalCommission, changeRecordPage); |
| | | IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); |
| | | // return new CommissionStatistics(totalCommission, changeRecordPage); |
| | | return null; |
| | | } |
| | | } |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="queryCommissionStatistics" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> |
| | | SELECT |
| | | tcr.*, |
| | | tau.`name` userName, |
| | | tau.phone userPhone |
| | | FROM |
| | | t_balance_change_record tcr |
| | | LEFT JOIN t_app_user tau ON tcr.app_user_id = tau.id |
| | | <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> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import com.ruoyi.other.vo.ShopPointStatistics; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | * 门店积分统计 |
| | | */ |
| | | @GetMapping("/statistics") |
| | | @ApiModelProperty("门店积分统计") |
| | | @ApiOperation(value = "门店积分统计") |
| | | public R<ShopPointStatistics> statistics(ShopPoint shopPoint) { |
| | | ShopPointStatistics statistics = shopPointService.statistics(Page.of(shopPoint.getPageNum(), shopPoint.getPageSize()), shopPoint); |
| | | return R.ok(statistics); |
| | |
| | | * 导出门店积分统计 |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiModelProperty("导出门店积分统计") |
| | | @ApiOperation(value = "导出门店积分统计") |
| | | public void export(HttpServletResponse response , ShopPoint shopPoint) { |
| | | ShopPointStatistics statistics = shopPointService.statistics(Page.of(1, Integer.MAX_VALUE), shopPoint); |
| | | if (statistics!=null){ |
| | |
| | | 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 java.time.LocalDateTime; |
| | |
| | | /** |
| | | * 审核 |
| | | */ |
| | | @RequestMapping("/audit") |
| | | @PostMapping("/audit") |
| | | @ApiOperation("审核") |
| | | public R<Void> audit(ShopWithdraw shopWithdraw) { |
| | | public R<Void> audit(@RequestBody ShopWithdraw shopWithdraw) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | ShopWithdraw shopWithdraw1 = shopWithdrawService.getById(shopWithdraw.getId()); |
| | | shopWithdraw1.setAuditStatus(shopWithdraw.getAuditStatus()); |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | |
| | | */ |
| | | public interface ShopBalanceStatementMapper extends BaseMapper<ShopBalanceStatement> { |
| | | List<ShopBalanceStatement> findLatestChangeByType(ShopBalanceStatement shopBalanceStatement); |
| | | |
| | | IPage<ShopBalanceStatement> queryShopBalanceStatementPage(@Param("page") IPage<ShopBalanceStatement> page, |
| | | @Param("bs") ShopBalanceStatement shopBalanceStatement); |
| | | } |
| | |
| | | .add(shopCommissionStatisticsVO.getTotalSubordinateCommission()) |
| | | .add(shopCommissionStatisticsVO.getTotalServiceCharge())); |
| | | |
| | | IPage<ShopBalanceStatement> statementIPage = page(page, new LambdaQueryWrapper<ShopBalanceStatement>()); |
| | | List<ShopBalanceStatement> records = statementIPage.getRecords(); |
| | | List<Integer> shopIds = records.stream().map(ShopBalanceStatement::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shopList = shopService.listByIds(shopIds); |
| | | records.forEach(st -> { |
| | | shopList.stream().filter(shop -> shop.getId().equals(st.getShopId())).findFirst().ifPresent(shop -> { |
| | | st.setShopName(shop.getName()); |
| | | st.setShopManagerName(shop.getShopManager()); |
| | | st.setPhone(shop.getPhone()); |
| | | }); |
| | | }); |
| | | IPage<ShopBalanceStatement> statementIPage = this.baseMapper.queryShopBalanceStatementPage(page, shopBalanceStatement); |
| | | shopCommissionStatisticsVO.setStatementIPage(statementIPage); |
| | | return shopCommissionStatisticsVO; |
| | | } |
| | |
| | | t_shop_balance_statement |
| | | ) AS subquery |
| | | </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 |
| | | <where> |
| | | <if test="bs.shopName != null and bs.shopName != ''"> |
| | | AND ts.`name` like concat('%', #{bs.shopName}, '%') |
| | | </if> |
| | | <if test="bs.shopManagerName != null and bs.shopManagerName != ''"> |
| | | AND ts.shop_manager like concat('%', #{bs.shopManagerName}, '%') |
| | | </if> |
| | | <if test="bs.phone != null and bs.phone != ''"> |
| | | AND ts.phone like concat('%', #{bs.phone}, '%') |
| | | </if> |
| | | <if test="bs.type != null"> |
| | | AND tsbs.type = #{bs.type} |
| | | </if> |
| | | <if test="bs.startTime != null and bs.endTime != null"> |
| | | AND tsbs.create_time BETWEEN #{bs.startTime} AND #{bs.endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |