Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
| | |
| | | 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 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; |
| | |
| | | @ApiModelProperty("消费金额") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "地区价格") |
| | | private List<GoodsArea> goodsAreaList; |
| | | |
| | | public String getIdStr() { |
| | | return String.valueOf(id); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String userName; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String phone; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "会员等级") |
| | | private String vipName; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "会员id") |
| | | private Integer vipId; |
| | | |
| | | |
| | | public String getIdStr() { |
| | | return String.valueOf(id); |
| | | } |
| | | |
| | | } |
| | |
| | | @TableField("bound_shop_superiors_points") |
| | | private Integer boundShopSuperiorsPoints; |
| | | |
| | | @ApiModelProperty(value = "vip名子") |
| | | @TableField(exist = false) |
| | | private String vipName; |
| | | |
| | | @TableField(exist = false) |
| | | private List<GoodsArea> goodsAreaList; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)") |
| | | @TableField("superior_type") |
| | | private Integer superiorType; |
| | | private String superiorType; |
| | | |
| | | @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)") |
| | | @TableField("superior_price_type") |
| | | private String superiorPriceType; |
| | | |
| | | @ApiModelProperty(value = "核销门店可获得服务费") |
| | | @TableField("servuce_shop_charges") |
| | |
| | | @TableField("shop_id") |
| | | private Integer shopId; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | @TableField(exist = false) |
| | | private String shopName; |
| | | |
| | | @ApiModelProperty(value = "店长名称") |
| | | @TableField(exist = false) |
| | | private String ownerName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField(exist = false) |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "门店地址") |
| | | @TableField(exist = false) |
| | | private String address; |
| | | |
| | | public String getIdStr(){ |
| | | return String.valueOf(id); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("bound_shop_superiors_points") |
| | | private Integer boundShopSuperiorsPoints; |
| | | |
| | | @ApiModelProperty(value = "vip名子") |
| | | @TableField(exist = false) |
| | | private String vipName; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | 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.time.LocalDateTime; |
| | |
| | | |
| | | @ApiModelProperty(value = "活动开始日期") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "活动结束日期") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "是否上架:0否 1是") |
| | |
| | | * 角色类型 1=平台 2=公司 3=门店 4=修理厂 |
| | | */ |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=门店") |
| | | @TableField("role_type") |
| | | private Integer roleType; |
| | | |
| | | @Excel(name = "密码修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | | private Date passWordUpdate; |
| | | |
| | | @ApiModelProperty(value = "对象ID") |
| | | @TableField("objectId") |
| | | private Integer objectId; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | |
| | | this.forbiddenRemark = forbiddenRemark; |
| | | } |
| | | |
| | | public List<String> getRoleNames() { |
| | | return roleNames; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | if (loginUser == null) { |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | } |
| | | if(null == loginUser.getUserid()){ |
| | | loginUser.setUserid(loginUser.getSysUser().getUserId()); |
| | | } |
| | | return loginUser; |
| | | } |
| | | |
| | |
| | | { |
| | | SysDept info = deptMapper.selectDeptById(dept.getParentId()); |
| | | // 如果父节点不为正常状态,则不允许新增子节点 |
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) |
| | | if (null != info && !UserConstants.DEPT_NORMAL.equals(info.getStatus())) |
| | | { |
| | | throw new ServiceException("部门停用,不允许新增"); |
| | | } |
| | |
| | | Iterator<SysDept> it = list.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | SysDept n = (SysDept) it.next(); |
| | | SysDept n = it.next(); |
| | | if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) |
| | | { |
| | | tlist.add(n); |
| | |
| | | */ |
| | | private boolean hasChild(List<SysDept> list, SysDept t) |
| | | { |
| | | return getChildList(list, t).size() > 0 ? true : false; |
| | | return getChildList(list, t).size() > 0; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.datascope.annotation.DataScope; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.query.ChangeUserQuery; |
| | |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private ISysDeptService deptService; |
| | | |
| | | |
| | | /** |
| | |
| | | List<String> roleNames = new ArrayList<>(); |
| | | for (SysUserRole sysUserRole : list1) { |
| | | SysRole sysRole = sysRoleService.selectRoleById(sysUserRole.getRoleId()); |
| | | if(null == sysRole){ |
| | | continue; |
| | | } |
| | | roleNames.add(sysRole.getRoleName()); |
| | | } |
| | | Long[] roleIds = new Long[]{}; |
| | | sysUser.setRoleIds(list1.stream().map(SysUserRole::getRoleId).collect(Collectors.toList()).toArray(roleIds)); |
| | | sysUser.setRoleNames(roleNames); |
| | | SysDept sysDept = deptService.selectDeptById(sysUser.getDeptId()); |
| | | sysUser.setDept(sysDept); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.api.model.UserClickLog; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.dto.BalanceQuery; |
| | | import com.ruoyi.account.dto.UserCancelQuery; |
| | | import com.ruoyi.account.excel.UserPointEx; |
| | | import com.ruoyi.account.service.BalanceChangeRecordService; |
| | | import com.ruoyi.account.vo.CommissionStatistics; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | return R.ok(balanceChangeRecordService.pageList(agentQuery)); |
| | | } |
| | | |
| | | // /** |
| | | // * 用户分佣统计 |
| | | // */ |
| | | // @GetMapping("/commissionStatistics") |
| | | // @ApiOperation(value = "用户分佣统计", tags = "管理后台-财务统计-用户分佣统计") |
| | | // public R<CommissionStatistics> commissionStatistics(UserPoint userPoint) { |
| | | // userPoint.setType(2); |
| | | // IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(userPoint.getPageNum(), userPoint.getPageSize()), userPoint); |
| | | // UserPointStatistics statistics = userPointService.getStatistics(userPoint); |
| | | // CommissionStatistics commissionStatistics = new CommissionStatistics(); |
| | | // commissionStatistics.setStatistics(statistics); |
| | | // commissionStatistics.setUserPointPage(userPointPage); |
| | | // return R.ok(commissionStatistics); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 导出用户分佣统计 |
| | | // */ |
| | | // @GetMapping("/commissionExport") |
| | | // @ApiOperation(value = "用户分佣统计导出", tags = "管理后台-财务统计-用户分佣统计") |
| | | // public void commissionExport(HttpServletResponse response, UserPoint userPoint) { |
| | | // userPoint.setType(2); |
| | | // IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(1, Integer.MAX_VALUE), userPoint); |
| | | // List<UserPoint> userPointList = userPointPage.getRecords(); |
| | | // List<UserPointEx> userPointExList = new ArrayList<>(); |
| | | // for (UserPoint point : userPointList) { |
| | | // UserPointEx userPointEx = new UserPointEx(); |
| | | // userPointEx.setUserName(point.getUserName()); |
| | | // userPointEx.setPhone(point.getPhone()); |
| | | // userPointEx.setChangeTime(point.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // userPointEx.setChangeNum(point.getVariablePoint().toString()); |
| | | // Integer type = point.getType(); |
| | | // switch (type) { |
| | | // case 1: |
| | | // userPointEx.setType("消费积分"); |
| | | // break; |
| | | // case 2: |
| | | // userPointEx.setType("返佣积分"); |
| | | // break; |
| | | // case 3: |
| | | // userPointEx.setType("拉新人积分"); |
| | | // break; |
| | | // case 4: |
| | | // userPointEx.setType("兑换商品"); |
| | | // break; |
| | | // case 5: |
| | | // userPointEx.setType("门店业绩"); |
| | | // break; |
| | | // case 6: |
| | | // userPointEx.setType("门店返佣"); |
| | | // break; |
| | | // case 7: |
| | | // userPointEx.setType("技师业绩"); |
| | | // break; |
| | | // case 8: |
| | | // userPointEx.setType("转赠积分"); |
| | | // break; |
| | | // case 9: |
| | | // userPointEx.setType("做工积分"); |
| | | // break; |
| | | // case 10: |
| | | // userPointEx.setType("注册积分"); |
| | | // break; |
| | | // default: |
| | | // userPointEx.setType("未知积分"); |
| | | // } |
| | | // userPointExList.add(userPointEx); |
| | | // } |
| | | // ExcelUtil<UserPointEx> util = new ExcelUtil<>(UserPointEx.class); |
| | | // util.exportExcel(response, userPointExList, "用户分佣统计"); |
| | | // } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | 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.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserPointService; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
New file |
| | |
| | | package com.ruoyi.account.excel; |
| | | |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserPointEx { |
| | | |
| | | /** |
| | | * 用户名称 |
| | | */ |
| | | @Excel(name = "用户名称") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @Excel(name = "联系电话") |
| | | private String phone; |
| | | |
| | | /** |
| | | * 变更类型 |
| | | */ |
| | | @Excel(name = "变更类型") |
| | | private String type; |
| | | |
| | | /** |
| | | * 变更时间 |
| | | */ |
| | | @Excel(name = "变更时间") |
| | | private String changeTime; |
| | | |
| | | /** |
| | | * 变更数量 |
| | | */ |
| | | @Excel(name = "变更数量") |
| | | private String changeNum; |
| | | } |
| | |
| | | package com.ruoyi.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.dto.BalanceQuery; |
| | | import com.ruoyi.account.vo.CommissionStatistics; |
| | | |
| | | public interface BalanceChangeRecordService extends IService<BalanceChangeRecord> { |
| | | IPage<BalanceChangeRecord> pageList(BalanceQuery agentQuery); |
| | | |
| | | CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord); |
| | | } |
| | |
| | | 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 org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class BalanceChangeRecordServiceImpl extends ServiceImpl<BalanceChangeRecordMapper, BalanceChangeRecord> implements BalanceChangeRecordService { |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | @Override |
| | | public IPage<BalanceChangeRecord> pageList(BalanceQuery agentQuery) { |
| | | Page<BalanceChangeRecord> page = new Page<>(); |
| | |
| | | IPage<BalanceChangeRecord> shopIPage = this.baseMapper.pageList(page, agentQuery); |
| | | return shopIPage; |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public UserPointStatistics getStatistics(UserPoint userPoint) { |
| | | |
| | | if (StringUtils.isNotEmpty(userPoint.getUserName()) || StringUtils.isNotEmpty(userPoint.getPhone())) { |
| | | try { |
| | | if (StringUtils.isNotEmpty(userPoint.getUserName()) && StringUtils.isNotEmpty(userPoint.getPhone())) { |
| | | List<Long> userIds = appUserService.listObjs(new LambdaQueryWrapper<AppUser>() |
| | | .select(AppUser::getId) |
| | | .like(StringUtils.isNotEmpty(userPoint.getUserName()),AppUser::getName, userPoint.getUserName()) |
| | | .like(StringUtils.isNotEmpty(userPoint.getPhone()),AppUser::getPhone, userPoint.getPhone())) |
| | | .like(AppUser::getName, userPoint.getUserName()) |
| | | .like(AppUser::getPhone, userPoint.getPhone())) |
| | | .stream() |
| | | .map(appUserId -> (Long) appUserId) |
| | | .collect(Collectors.toList()); |
| | |
| | | } |
| | | |
| | | List<UserPoint> userPointList = userPointMapper.findLatestChangeByType(userPoint); |
| | | |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | .collect(Collectors.groupingBy( |
| | | UserPoint::getType, |
| | | Collectors.summingInt(UserPoint::getBalance) |
| | | )); |
| | | |
| | | |
| | | Integer consumePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.CONSUME.getCode())).orElse(0); |
| | | Integer sharePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode())).orElse(0); |
| | | Integer pullNewPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode())).orElse(0); |
| | | Integer registerPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.REGISTRATION.getCode())).orElse(0); |
| | | Integer workPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.WORK_PERFORMANCE.getCode())).orElse(0); |
| | | Integer shopAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TECHNICIAN_PERFORMANCE.getCode())).orElse(0); |
| | | Integer exchangeGoodsPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.EXCHANGE_GOODS.getCode())).orElse(0); |
| | | Integer storeAchievementPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode())).orElse(0); |
| | | Integer storeCommissionPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode())).orElse(0); |
| | | Integer transferPoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.TRANSFER_POINTS.getCode())).orElse(0); |
| | | Integer totalPoint = consumePoint + sharePoint + pullNewPoint + registerPoint + workPoint + shopAchievementPoint + exchangeGoodsPoint + storeAchievementPoint + storeCommissionPoint + transferPoint; |
| | | |
| | | int consumePoint = userBalanceMap.getOrDefault(PointChangeType.CONSUME.getCode(), 0); |
| | | int sharePoint = userBalanceMap.getOrDefault(PointChangeType.COMMISSION_RETURN.getCode(), 0); |
| | | int pullNewPoint = userBalanceMap.getOrDefault(PointChangeType.NEW_USER_REFERRAL.getCode(), 0); |
| | | int registerPoint = userBalanceMap.getOrDefault(PointChangeType.REGISTRATION.getCode(), 0); |
| | | int workPoint = userBalanceMap.getOrDefault(PointChangeType.WORK_PERFORMANCE.getCode(), 0); |
| | | int shopAchievementPoint = userBalanceMap.getOrDefault(PointChangeType.TECHNICIAN_PERFORMANCE.getCode(), 0); |
| | | int exchangeGoodsPoint = userBalanceMap.getOrDefault(PointChangeType.EXCHANGE_GOODS.getCode(), 0); |
| | | int storeAchievementPoint = userBalanceMap.getOrDefault(PointChangeType.STORE_PERFORMANCE.getCode(), 0); |
| | | int storeCommissionPoint = userBalanceMap.getOrDefault(PointChangeType.STORE_COMMISSION_RETURN.getCode(), 0); |
| | | int transferPoint = userBalanceMap.getOrDefault(PointChangeType.TRANSFER_POINTS.getCode(), 0); |
| | | int totalPoint = consumePoint + sharePoint + pullNewPoint + registerPoint + workPoint + shopAchievementPoint + exchangeGoodsPoint + storeAchievementPoint + storeCommissionPoint + transferPoint; |
| | | |
| | | UserPointStatistics userPointStatistics = new UserPointStatistics(); |
| | | userPointStatistics.setTotalPoint(totalPoint); |
| | |
| | | userPointStatistics.setRegisterPoint(registerPoint); |
| | | userPointStatistics.setWorkPoint(workPoint); |
| | | userPointStatistics.setShopAchievementPoint(shopAchievementPoint); |
| | | |
| | | return userPointStatistics; |
| | | } catch (Exception e) { |
| | | // 记录异常日志 |
| | | log.error("获取用户点统计信息时出错", e); |
| | | throw new RuntimeException("获取用户点统计信息时出错", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<UserPoint> getUserPointPage(Page<UserPoint> page, UserPoint userPoint) { |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getPhone, userPoint.getPhone()) |
| | | .like(AppUser::getName, userPoint.getUserName())); |
| | | if (appUserList.isEmpty()){ |
| | | return page; |
| | | } |
| | | |
| | | List<Long> userIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | |
| | | Page<UserPoint> userPointPage = page(page, new LambdaQueryWrapper<UserPoint>() |
| | | .in(!CollectionUtils.isEmpty(userIds), UserPoint::getAppUserId, userIds) |
| | | .in(UserPoint::getAppUserId, userIds) |
| | | .eq(userPoint.getType() != null, UserPoint::getType, userPoint.getType()) |
| | | .between( userPoint.getStartTime()!= null && userPoint.getEndTime() !=null,UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime()) |
| | | .orderByDesc(UserPoint::getCreateTime)); |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @ApiModel(description = "用户分佣统计响应") |
| | | @Data |
| | | public class CommissionStatistics { |
| | | |
| | | @ApiModelProperty(value = "分佣总计") |
| | | private Integer totalCommission; |
| | | |
| | | @ApiModelProperty(value = "分页数据", required = true) |
| | | private IPage<BalanceChangeRecord> userPointPage; |
| | | |
| | | public CommissionStatistics() { |
| | | } |
| | | public CommissionStatistics(BigDecimal totalCommission, Page<BalanceChangeRecord> changeRecordPage) { |
| | | |
| | | } |
| | | } |
| | |
| | | create_time, |
| | | app_user_id, |
| | | object_id, |
| | | ROW_NUMBER() OVER (PARTITION BY type ORDER BY create_time DESC) AS rn |
| | | ROW_NUMBER() OVER (PARTITION BY `type`,app_user_id ORDER BY create_time DESC) AS rn |
| | | FROM |
| | | t_user_point |
| | | <where> |
| | |
| | | create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | <if test="type != null"> |
| | | AND type = #{type} |
| | | AND `type` = #{type} |
| | | </if> |
| | | <if test="userIds != null and userIds.size !=0"> |
| | | AND app_user_id IN |
| | |
| | | String content = baseSetting.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | Long days = jsonObject.getLong("days"); |
| | | if (days != null && days > 0){ |
| | | commissionService.addToCommissionDelayQueue(order.getId(), LocalDateTime.now().plusDays(days)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 更新上/下架状态 |
| | | */ |
| | | @PutMapping("/manageGoodsStatus/{goodsId}/{status}") |
| | | @ApiOperation(value = "商品上/下架", tags = {"管理后台-商品管理"}) |
| | | public R<Void> manageGoodsStatus(@PathVariable("goodsId") Long goodsId, |
| | | @PathVariable("status") Integer status){ |
| | | goodsService.lambdaUpdate().eq(Goods::getId, goodsId).set(Goods::getStatus, status).update(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 后台商品删除 |
| | | */ |
| | | @DeleteMapping("/manageGoodsDelete/{goodsId}") |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | 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.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.api.vo.GetSeckillActivityInfo; |
| | | import com.ruoyi.other.mapper.SeckillActivityInfoMapper; |
| | | import com.ruoyi.other.service.GoodsSeckillService; |
| | | import com.ruoyi.other.service.SeckillActivityInfoService; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private GoodsSeckillService goodsSeckillService; |
| | | |
| | | @Resource |
| | | private SeckillActivityInfoMapper seckillActivityInfoMapper; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/manageList") |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | public R<IPage<SeckillActivityVO>> manageList(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | Goods goods) |
| | | { |
| | | IPage<SeckillActivityVO> IPage = seckillActivityInfoMapper.querySeckillActivity(Page.of(pageNum, pageSize), goods); |
| | | return R.ok(IPage); |
| | | } |
| | | |
| | | /** |
| | | * 新增秒杀活动 |
| | | */ |
| | | @PostMapping("/save") |
New file |
| | |
| | | package com.ruoyi.other.dto; |
| | | |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2024/12/16 17:06 |
| | | */ |
| | | @Data |
| | | public class SetDto { |
| | | private List<VipSetting> vipSettingList; |
| | | } |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | List<SeckillActivityVO> listSeckillActivity(Goods goods); |
| | | |
| | | IPage<SeckillActivityVO> querySeckillActivity(@Param("page") Page<SeckillActivityVO> page,@Param("goods") Goods goods); |
| | | |
| | | SeckillActivityDetailVO selectDetail(Integer seckillActivityId); |
| | | } |
| | |
| | | import com.ruoyi.other.service.*; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | area.setProvinceCode(goodsArea.getProvinceCode()); |
| | | area.setCityCode(goodsArea.getCityCode()); |
| | | area.setDistrictsCode(goodsArea.getDistrictsCode()); |
| | | goodsAreaList1.add(area); |
| | | } |
| | | goodsAreaService.saveBatch(goodsAreaList1); |
| | | } |
| | |
| | | area.setProvinceCode(goodsArea.getProvinceCode()); |
| | | area.setCityCode(goodsArea.getCityCode()); |
| | | area.setDistrictsCode(goodsArea.getDistrictsCode()); |
| | | goodsAreaList1.add(area); |
| | | } |
| | | goodsAreaService.updateBatchById(goodsAreaList1); |
| | | } |
| | |
| | | @Override |
| | | public Goods getManageGoodsDetail(Long goodsId) { |
| | | Goods goods = getById(goodsId); |
| | | if (goods == null){ |
| | | return null; |
| | | } |
| | | // 指定门店 |
| | | List<GoodsShop> goodsShops = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>() |
| | | .eq(GoodsShop::getGoodsId, goodsId)); |
| | | |
| | | for (GoodsShop goodsShop : goodsShops) { |
| | | Shop shop = shopMapper.selectById(goodsShop.getShopId()); |
| | | goodsShop.setShopName(shop.getName()); |
| | | goodsShop.setOwnerName(shop.getShopManager()); |
| | | goodsShop.setPhone(shop.getPhone()); |
| | | goodsShop.setAddress(shop.getAddress()); |
| | | } |
| | | goods.setGoodsShopList(goodsShops); |
| | | |
| | | // 指定用户 |
| | | List<GoodsAppUser> goodsAppUserList = goodsAppUserService.list(new LambdaQueryWrapper<GoodsAppUser>() |
| | | .eq(GoodsAppUser::getGoodsId, goodsId)); |
| | | List<Long> userIds = goodsAppUserList.stream().map(GoodsAppUser::getAppUserId).collect(Collectors.toList()); |
| | | List<AppUser> appUsers = appUserClient.listByIds(userIds); |
| | | for (GoodsAppUser goodsAppUser : goodsAppUserList) { |
| | | appUsers.stream().filter(u -> u.getId().equals(goodsAppUser.getAppUserId())).findFirst().ifPresent( u -> { |
| | | goodsAppUser.setUserName(u.getName()); |
| | | goodsAppUser.setPhone(u.getPhone()); |
| | | VipSetting vipSetting = vipSettingService.getById(u.getVipId()); |
| | | if (vipSetting != null){ |
| | | goodsAppUser.setVipName(vipSetting.getVipName()); |
| | | goodsAppUser.setVipId(u.getVipId()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | goods.setGoodsAppUserList(goodsAppUserList); |
| | | |
| | | // 会员价格 |
| | | List<GoodsVip> goodsVipList = goodsVipService.list(new LambdaQueryWrapper<GoodsVip>() |
| | | .eq(GoodsVip::getGoodsId, goodsId)); |
| | | List<VipSetting> vipSettings = getVipSettings(goodsVipList.stream().map(GoodsVip::getVip)); |
| | | goodsVipList.forEach(goodsArea -> vipSettings.stream() |
| | | .filter(vipSetting -> vipSetting.getId().equals(goodsArea.getVip())) |
| | | .findFirst().ifPresent( vipSetting -> goodsArea.setVipName(vipSetting.getVipName()))); |
| | | |
| | | goods.setGoodsVipList(goodsVipList); |
| | | |
| | | // 特殊地区售价设置 |
| | |
| | | |
| | | List<GoodsArea> goodsAreaList1 = new ArrayList<>(); |
| | | listMap.forEach((s, goodsAreas) -> { |
| | | GoodsArea goodsArea = goodsAreas.get(0); |
| | | goodsArea.setGoodsAreaList(goodsAreas); |
| | | goodsAreaList1.add(goodsArea); |
| | | |
| | | List<VipSetting> vipSettings1 = getVipSettings(goodsAreas.stream().map(GoodsArea::getVip)); |
| | | goodsAreas.forEach(goodsArea -> vipSettings1.stream() |
| | | .filter(vipSetting -> vipSetting.getId().equals(goodsArea.getVip())) |
| | | .findFirst().ifPresent( vipSetting -> goodsArea.setVipName(vipSetting.getVipName()))); |
| | | |
| | | GoodsArea goodsArea1 = getGoodsArea(goodsAreas); |
| | | goodsAreaList1.add(goodsArea1); |
| | | }); |
| | | |
| | | goods.setGoodsAreaList(goodsAreaList1); |
| | | return goods; |
| | | } |
| | | |
| | | private List<VipSetting> getVipSettings(Stream<Integer> goodsVipList) { |
| | | List<Integer> vipIds = goodsVipList.collect(Collectors.toList()); |
| | | return vipSettingService.listByIds(vipIds); |
| | | } |
| | | |
| | | @NotNull |
| | | private static GoodsArea getGoodsArea(List<GoodsArea> goodsAreas) { |
| | | GoodsArea goodsArea = goodsAreas.get(0); |
| | | GoodsArea goodsArea1 = new GoodsArea(); |
| | | goodsArea1.setProvinceCode(goodsArea.getProvinceCode()); |
| | | goodsArea1.setCityCode(goodsArea.getCityCode()); |
| | | goodsArea1.setDistrictsCode(goodsArea.getDistrictsCode()); |
| | | goodsArea1.setProvince(goodsArea.getProvince()); |
| | | goodsArea1.setCity(goodsArea.getCity()); |
| | | goodsArea1.setDistricts(goodsArea.getDistricts()); |
| | | goodsArea1.setGoodsAreaList(goodsAreas); |
| | | return goodsArea1; |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | LoginUser loginUserApplet = tokenService.getLoginUser(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | goods.setVipId(appUser.getVipId()); |
| | | return seckillActivityInfoMapper.listSeckillActivity(goods); |
| | |
| | | String shopName = shopPoint.getShopName(); |
| | | String phone = shopPoint.getPhone(); |
| | | String shopLeaderName = shopPoint.getShopLeaderName(); |
| | | if (StringUtils.isNotEmpty(shopName) || StringUtils.isNotEmpty(phone) || StringUtils.isNotEmpty(shopLeaderName)) { |
| | | List<Integer> shopIds = shopService.listObjs(new LambdaQueryWrapper<Shop>() |
| | | .select(Shop::getId) |
| | | .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); |
| | | } |
| | | |
| | | |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | |
| | | tg.shop_cost, |
| | | tg.`status`, |
| | | tg.purchase_limit, |
| | | tg.sale_num |
| | | tg.sale_num, |
| | | tg.cash_payment, |
| | | tg.point_payment |
| | | FROM |
| | | t_goods tg |
| | | LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id |
| | |
| | | LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id |
| | | WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0 |
| | | </select> |
| | | <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO"> |
| | | SELECT |
| | | tsai.id, |
| | | tg.`name`, |
| | | tg.introduction, |
| | | tg.home_page_picture, |
| | | tg.original_price, |
| | | tgs.selling_price, |
| | | tg.sale_num, |
| | | tsai.start_time |
| | | FROM |
| | | t_seckill_activity_info tsai |
| | | LEFT JOIN t_goods tg ON tsai.good_id = tg.id |
| | | LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id |
| | | WHERE tsai.end_time >= NOW() AND tsai.del_flag = 0 |
| | | <if test="goods.name != null and goods.name != ''"> |
| | | AND tg.`name` LIKE concat('%',#{goods.name},'%') |
| | | </if> |
| | | <if test="goods.goodsCategoryId != null"> |
| | | AND tg.goods_category_id = #{goods.goodsCategoryId} |
| | | </if> |
| | | <if test="goods.vipId != null"> |
| | | AND find_in_set(#{goods.vipId},tgs.vip) > 0 |
| | | </if> |
| | | </select> |
| | | </mapper> |