Merge remote-tracking branch 'origin/master'
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.other.api.feignClient.VipSettingClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | private AgentApplicationService agentApplicationService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | |
| | | @PostMapping("/apply") |
| | | @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) |
| | |
| | | //变更会员等级 |
| | | byId1.setVipId(byId.getApplicationVipId()); |
| | | appUserService.updateById(byId1); |
| | | |
| | | // 当用户为合伙人时,计算合伙人积分和培育积分 |
| | | Integer vipId = byId1.getVipId(); |
| | | if (vipId == 7){ |
| | | // 当前用户计算合伙人积分 |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId); |
| | | setPoint(vipSetting, byId1, byId1.getShopPoint(), byId1.getSharePoint()); |
| | | // 上级计算培育积分 |
| | | Long inviteUserId = byId1.getInviteUserId(); |
| | | AppUser byId2 = appUserService.getById(inviteUserId); |
| | | if (byId2 != null){ |
| | | setPoint(vipSetting, byId2, byId1.getShopPoint(), byId1.getSharePoint()); |
| | | } |
| | | } |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | private void setPoint(R<VipSetting> vipSetting, AppUser appUser, Integer shopPoint, Integer sharePoint) { |
| | | VipSetting vipSettingData = vipSetting.getData(); |
| | | Integer vipLevelUpShopRole = vipSettingData.getVipLevelUpShopRole(); |
| | | if (vipLevelUpShopRole == 1){ |
| | | Integer vipLevelUpShop = vipSettingData.getVipLevelUpShop(); |
| | | Integer vipLevelUpShare = vipSettingData.getVipLevelUpShare(); |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare) { |
| | | R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data = baseSetting.getData(); |
| | | if (data != null){ |
| | | appUser.setPartPoint(Integer.parseInt(data.getContent())); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | AppUser byId = appUserService.lambdaQuery() |
| | | .eq(AppUser::getPhone, phone) |
| | | .eq(AppUser::getDelFlag,0) |
| | | .eq(AppUser::getStatus,1) |
| | | .one(); |
| | | if (byId == null) { |
| | | return R.fail("搜索失败,手机号错误。"); |
| | |
| | | @ApiOperation(value = "已领取列表", tags = {"管理后台-优惠劵"}) |
| | | public R<Page<UserCoupon>> list1(@RequestParam Integer pageNum, |
| | | @RequestParam Integer pageSize, |
| | | String userName, |
| | | @ApiParam("1未使用2已使用3已过期") Integer status, |
| | | String phone, |
| | | Integer id) { |
| | | |
| | | List<Long> appUserIds = null; |
| | | if (!StringUtils.isEmpty(phone)){ |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .like(AppUser::getPhone, phone)); |
| | | if (!CollectionUtils.isEmpty(appUserList)){ |
| | | appUserIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | }else { |
| | | return R.ok(Page.of(pageNum, pageSize)); |
| | | } |
| | | LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | if (!StringUtils.isEmpty(phone)) { |
| | | queryWrapper.like(AppUser::getPhone, phone); |
| | | } |
| | | if (!StringUtils.isEmpty(userName)) { |
| | | queryWrapper.like(AppUser::getName, userName); |
| | | } |
| | | |
| | | List<AppUser> appUserList = appUserService.list(queryWrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(appUserList)) { |
| | | return R.ok(Page.of(pageNum, pageSize)); |
| | | } |
| | | |
| | | List<Long> appUserIds = appUserList.stream().map(AppUser::getId).distinct().collect(Collectors.toList()); |
| | | |
| | | |
| | | Page<UserCoupon> page = userCouponService.lambdaQuery() |
| | | .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime) |
| | | .isNotNull(status!=null&&status==2,UserCoupon::getUseTime) |
| | | .eq(UserCoupon::getCouponId, id) |
| | | .in(appUserIds != null,UserCoupon::getAppUserId, appUserIds) |
| | | .in(!CollectionUtils.isEmpty(appUserIds),UserCoupon::getAppUserId, appUserIds) |
| | | .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()).page(Page.of(pageNum-1, pageSize)); |
| | | for (UserCoupon record : page.getRecords()) { |
| | | record.setIdStr(record.getId().toString()); |
| | |
| | | // 过滤商城购物 |
| | | List<BalanceChangeRecord> collect = balanceChangeRecordIPage.getRecords().stream().filter(e -> e.getChangeType() != 5).collect(Collectors.toList()); |
| | | for (BalanceChangeRecord changeRecord : collect) { |
| | | BigDecimal subtract = changeRecord.getBeforeAmount().subtract(changeRecord.getAfterAmount()); |
| | | if (subtract.compareTo(BigDecimal.ZERO)>0){ |
| | | // 减少 |
| | | changeRecord.setChangeAmountString("-¥"+changeRecord.getChangeAmount()); |
| | | }else if (subtract.compareTo(BigDecimal.ZERO)<0){ |
| | | changeRecord.setChangeAmountString("+¥"+changeRecord.getChangeAmount()); |
| | | }else{ |
| | | changeRecord.setChangeAmountString("¥"+changeRecord.getChangeAmount()); |
| | | if (changeRecord.getBeforeAmount()!=null && changeRecord.getAfterAmount()!=null){ |
| | | BigDecimal subtract = changeRecord.getBeforeAmount().subtract(changeRecord.getAfterAmount()); |
| | | if (subtract.compareTo(BigDecimal.ZERO)>0){ |
| | | // 减少 |
| | | changeRecord.setChangeAmountString("-¥"+changeRecord.getChangeAmount()); |
| | | }else if (subtract.compareTo(BigDecimal.ZERO)<0){ |
| | | changeRecord.setChangeAmountString("+¥"+changeRecord.getChangeAmount()); |
| | | }else{ |
| | | changeRecord.setChangeAmountString("¥"+changeRecord.getChangeAmount()); |
| | | } |
| | | } |
| | | } |
| | | balanceChangeRecordIPage.setRecords(collect); |
| | |
| | | tau.phone userPhone, |
| | | tbcr.change_type, |
| | | tbcr.create_time, |
| | | tbcr.change_amount |
| | | tbcr.change_amount, |
| | | tbcr.beforeAmount, |
| | | tbcr.afterAmount |
| | | FROM |
| | | t_balance_change_record tbcr |
| | | LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id |
| | |
| | | orderDetailVO.setShopId(shop.getId()); |
| | | orderDetailVO.setTechnicianName(technician.getName()); |
| | | orderDetailVO.setTechnicianId(technician.getId()); |
| | | if(order.getOrderType() == 1){ |
| | | List<TechnicianSubscribe> data = technicianSubscribeClient.getTechnicianSubscribeList(order.getId()).getData(); |
| | | if(data.size() > 0){ |
| | | Long id = data.get(0).getId(); |
| | | orderDetailVO.setTechnicianSubscribeId(id.toString()); |
| | | } |
| | | } |
| | | return orderDetailVO; |
| | | } |
| | | |
| | |
| | | //添加明细 |
| | | List<GoodsBargainPriceDetail> list = vo.getList(); |
| | | for (GoodsBargainPriceDetail goodsBargainPriceDetail : list) { |
| | | goodsBargainPriceDetail.setId(null); |
| | | goodsBargainPriceDetail.setGoodsBargainPriceId(bargainPrice.getId()); |
| | | } |
| | | goodsBargainPriceDetailService.saveBatch(list); |
| | |
| | | |
| | | @Override |
| | | public void switchingTechnician(TechnicianSubscribe technicianSubscribe) { |
| | | TechnicianSubscribe subscribe = this.getById(technicianSubscribe.getId()); |
| | | if(subscribe.getTechnicianId().equals(technicianSubscribe.getTechnicianId())){ |
| | | throw new RuntimeException("不能切换相同的技师"); |
| | | List<TechnicianSubscribe> list = this.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getOrderId, technicianSubscribe.getOrderId()) |
| | | .eq(TechnicianSubscribe::getDelFlag, 0).eq(TechnicianSubscribe::getStatus, 0)); |
| | | for (TechnicianSubscribe subscribe : list) { |
| | | if(subscribe.getTechnicianId().equals(technicianSubscribe.getTechnicianId())){ |
| | | throw new RuntimeException("不能切换相同的技师"); |
| | | } |
| | | subscribe.setTechnicianId(technicianSubscribe.getTechnicianId()); |
| | | this.updateById(subscribe); |
| | | } |
| | | subscribe.setTechnicianId(technicianSubscribe.getTechnicianId()); |
| | | this.updateById(subscribe); |
| | | |
| | | } |
| | | |
| | | /** |