| | |
| | | public R editUserCoupon(UserCoupon userCoupon) { |
| | | return R.fail("编辑用户优惠券失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R editReturnUse(UserCoupon userCoupon) { |
| | | return R.fail("编辑用户优惠券使用时间失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/user-coupon/editUserCoupon") |
| | | R editUserCoupon(@RequestBody UserCoupon userCoupon); |
| | | |
| | | |
| | | /** |
| | | * 编辑用户优惠券使用时间 |
| | | * @param userCoupon |
| | | * @return |
| | | */ |
| | | @PostMapping("/user-coupon/editReturnUse") |
| | | R editReturnUse(@RequestBody UserCoupon userCoupon); |
| | | } |
| | |
| | | } |
| | | //门店员工添加数据,需要判断账号是否存在,共用同一个账号 |
| | | if(2 == sysUser1.getRoleType()){ |
| | | AppUser appUser = appUserClient.getAppUserByPhone1(user.getPhonenumber()).getData(); |
| | | if(null == appUser){ |
| | | return error("请先注册小程序账号"); |
| | | } |
| | | SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, user.getPhonenumber()) |
| | | .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2)); |
| | | if(null == one){ |
| | | AppUser appUser = appUserClient.getAppUserByPhone1(user.getPhonenumber()).getData(); |
| | | if(null == appUser){ |
| | | return error("请先注册小程序账号"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | userRoleService.insertSysUserRole(sysUserRole); |
| | | //添加小程序店员关系数据 |
| | | if(null != appUser){ |
| | | |
| | | } |
| | | //添加小程序店员关系数据 |
| | | if(null != appUser){ |
| | | List<AppUserShop> data = appUserShopClient.getAppUserShop(appUser.getId()).getData(); |
| | | Optional<AppUserShop> first = data.stream().filter(s -> s.getShopId().equals(sysUser1.getObjectId())).findFirst(); |
| | | if(!first.isPresent()){ |
| | | AppUserShop appUserShop = new AppUserShop(); |
| | | appUserShop.setAppUserId(appUser.getId()); |
| | | appUserShop.setShopId(sysUser1.getObjectId()); |
| | |
| | | appUserClient.editAppUserById(appUser); |
| | | } |
| | | } |
| | | |
| | | //添加门店员工关系数据 |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(one.getUserId()); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserShopClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.AppUserShop; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.SpringUtils; |
| | |
| | | |
| | | @Resource |
| | | private UserShopService userShopService; |
| | | |
| | | @Resource |
| | | private AppUserShopClient appUserShopClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | /** |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteUserByIds(Long[] userIds) { |
| | | for (Long userId : userIds) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = this.getById(userid); |
| | | for (Long userId : userIds) { |
| | | checkUserAllowed(new SysUser(userId)); |
| | | // checkUserDataScope(userId); |
| | | } |
| | |
| | | // userRoleMapper.deleteUserRole(userIds); |
| | | // // 删除用户与岗位关联 |
| | | // userPostMapper.deleteUserPost(userIds); |
| | | int i = userMapper.deleteUserByIds(userIds); |
| | | // int i = userMapper.deleteUserByIds(userIds); |
| | | List<SysUser> sysUsers = this.listByIds(Arrays.asList(userIds)); |
| | | for (SysUser user : sysUsers) { |
| | | if(2 == user.getRoleType()){ |
| | | userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId())); |
| | | } |
| | | userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, sysUser.getObjectId())); |
| | | AppUser appUser = appUserClient.getAppUserByPhone1(user.getPhonenumber()).getData(); |
| | | if(null != appUser){ |
| | | AppUserShop appUserShop = new AppUserShop(); |
| | | appUserShop.setAppUserId(appUser.getId()); |
| | | appUserShop.setShopId(sysUser.getObjectId()); |
| | | appUserShopClient.delAppUserShop(appUserShop); |
| | | int size = appUserShopClient.getAppUserShop(appUser.getId()).getData().size(); |
| | | if(size == 0){ |
| | | appUser.setUserType(1); |
| | | appUserClient.editAppUserById(appUser); |
| | | } |
| | | } |
| | | long count = userShopService.count(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId())); |
| | | if(0 == count){ |
| | | user.setDelFlag("2"); |
| | | this.updateById(user); |
| | | } |
| | | }else{ |
| | | user.setDelFlag("2"); |
| | | this.updateById(user); |
| | | } |
| | | } |
| | | return i; |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private UserCancellationLogService userCancellationLogService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | return R.ok(user); |
| | | } |
| | | |
| | | @Resource |
| | | private UserCancellationLogService userCancellationLogService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/unregis") |
| | |
| | | if (user.getShopId() != null) { |
| | | R<Shop> storeById = shopClient.getShopById(user.getShopId()); |
| | | if (storeById.getData() != null) { |
| | | user.setShopName(storeById.getData().getName()); |
| | | Shop shop = storeById.getData(); |
| | | user.setShopName(shop.getName()); |
| | | } |
| | | } |
| | | Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | |
| | | goodNames.add(datum.getName()); |
| | | } |
| | | } |
| | | vo.setGoodNames(goodNames); |
| | | } |
| | | vo.setGoodNames(goodNames); |
| | | } |
| | | |
| | | record.setCouponInfoVo(vo); |
| | |
| | | userCouponService.updateById(userCoupon); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑用户优惠券使用时间 |
| | | * @param userCoupon |
| | | * @return |
| | | */ |
| | | @PostMapping("/editReturnUse") |
| | | public R editReturnUse(@RequestBody UserCoupon userCoupon){ |
| | | userCouponService.update(new LambdaUpdateWrapper<UserCoupon>().eq(UserCoupon::getId, userCoupon.getId()) |
| | | .set(UserCoupon::getUseTime, userCoupon.getUseTime())); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |
| | | private Map<Integer, R<GoodsVip>> getGoodsVips(List<Integer> vipIds) { |
| | | Map<Integer, R<GoodsVip>> result = new HashMap<>(); |
| | | for (Integer vipId : vipIds) { |
| | | R<GoodsVip> goodsVipR = goodsVipClient.getGoodsVip(null, vipId); |
| | | result.put(vipId, goodsVipR); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private Map<Integer, R<List<VipGood>>> getVipGoods(List<Integer> vipIds) { |
| | | Map<Integer, R<List<VipGood>>> result = new HashMap<>(); |
| | | for (Integer vipId : vipIds) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | private boolean isValidJson(String json) { |
| | | try { |
| | | JSONObject.parseObject(json); |
| | | return true; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | public void apply(AgentApplication agentApplication) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); |
| | | |
| | | Long aLong = agentApplicationMapper.selectCount(new QueryWrapper<AgentApplication>().eq("app_user_id", appUser.getId()) |
| | | .eq("application_vip_id", agentApplication.getApplicationVipId()).eq("status", 1).eq("del_flag", 0)); |
| | | if(0 != aLong){ |
| | | throw new RuntimeException("已发起申请,请等待平台工作人员与您联系"); |
| | | } |
| | | agentApplication.setAppUserId(loginUserApplet.getUserid()); |
| | | agentApplication.setStatus(1); |
| | | agentApplication.setApplicationTime(LocalDateTime.now()); |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | @Override |
| | | public List<PaymentUserCouponVo> getUserCoupon(Long userId, Integer type) { |
| | | List<UserCoupon> list = this.list(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getAppUserId, userId).eq(UserCoupon::getDelFlag, 0) |
| | | .last(" and now() between start_time and end_time")); |
| | | .isNull(UserCoupon::getUseTime).gt(UserCoupon::getEndTime, LocalDateTime.now()).last(" and now() between start_time and end_time")); |
| | | List<Integer> couponIds = list.stream().map(UserCoupon::getCouponId).collect(Collectors.toList()); |
| | | if(couponIds.size() == 0){ |
| | | return null; |
| | | } |
| | | List<CouponInfo> couponInfoList = couponInfoClient.getCouponInfoList(couponIds).getData(); |
| | | //构建返回数据 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | List<PaymentUserCouponVo> infoVoList = new ArrayList<>(); |
| | | for (UserCoupon userCoupon : list) { |
| | | CouponInfo couponInfo = couponInfoList.stream().filter(s -> s.getId().equals(userCoupon.getCouponId())).findFirst().get(); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.BalanceChangeRecordClient; |
| | | import com.ruoyi.account.api.feignClient.UserCouponClient; |
| | | import com.ruoyi.account.api.feignClient.UserPointClient; |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | |
| | | @Resource |
| | | private SystemConfigClient systemConfigClient; |
| | | |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | |
| | | |
| | | |
| | |
| | | userPoint.setObjectId(order.getId()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | appUserClient.editAppUserById(appUser); |
| | | //回退优惠券状态 |
| | | if(null != order.getUserCouponId()){ |
| | | UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); |
| | | userCoupon.setUseTime(null); |
| | | userCouponClient.editReturnUse(userCoupon); |
| | | } |
| | | } |
| | | if(3 == payMethod){ |
| | | //开始运费退款,积分支付,运费是单独进行支付的,所以需要单独退款 |
| | |
| | | userPoint.setObjectId(order.getId()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | appUserClient.editAppUserById(appUser); |
| | | |
| | | //回退优惠券状态 |
| | | if(null != order.getUserCouponId()){ |
| | | UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); |
| | | userCoupon.setUseTime(null); |
| | | userCouponClient.editReturnUse(userCoupon); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | private BigDecimal point; |
| | | @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)") |
| | | private Integer status; |
| | | @ApiModelProperty("物流类型(1=自提,2=快递)") |
| | | private Integer expressType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | |
| | | pay_method as paymentType, |
| | | total_amount as orderMoney, |
| | | point, |
| | | order_status as status |
| | | order_status as status, |
| | | if(express_json is not null and express_json != 'NULL' and express_json != '', 2, 1) as expressType |
| | | from t_order where del_flag = 0 and pay_status = 2 |
| | | <if test="null != item.code and '' != item.code"> |
| | | and order_number like CONCAT('%', #{item.code}, '%') |
| | |
| | | item.setUserName(appUser.getName()); |
| | | } |
| | | Goods goods = goodsService.getById(item.getGoodsId()); |
| | | item.setGoodsName(goods.getName()); |
| | | if(null != goods){ |
| | | item.setGoodsName(goods.getName()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false); |
| | | if(!StringUtils.hasLength(city)){ |
| | | city = "510100"; |
| | | } |
| | | shop.setProvinceCode(city.substring(0, 2) + "0000"); |
| | | shop.setCityCode(city.substring(0, 4) + "00"); |
| | | shop.setDistrictCode(city); |
| | |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<Integer> shopIds = appUserShopList.stream().map(AppUserShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0)); |
| | | long count = shopList.stream().filter(s -> s.getStatus() == 1).count(); |
| | | if(shopList.size() > 0 && count == 0){ |
| | | return R.fail("操作失败,当前门店已冻结"); |
| | | } |
| | | shopList = shopList.stream().filter(s -> s.getStatus() == 1).collect(Collectors.toList()); |
| | | if(null != appUser.getShopId()){ |
| | | Optional<Shop> first = shopList.stream().filter(s -> s.getId().equals(appUser.getShopId())).findFirst(); |
| | | if(first.isPresent()){ |
| | |
| | | if(first.isPresent()){ |
| | | item.setShopName(first.get().getName()); |
| | | } |
| | | item.setIdStr(item.getId().toString()); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | |
| | | tg.original_price as originalPrice, |
| | | tg.integral as integral, |
| | | tg.sale_num as saleNum, |
| | | tg.home_page_picture as homePagePicture |
| | | tg.home_page_picture as homePagePicture, |
| | | tg.sort |
| | | FROM t_goods tg |
| | | where tg.del_flag = 0 and tg.status = 2 and (tg.appoint_store = 2 or (tg.appoint_store = 1 and tg.id in (select goods_id from t_goods_shop where shop_id = #{shopId}))) |
| | | and tg.type = 1 |
| | | <if test="vip != null"> |
| | | and (tg.commodity_authority like '%-1%' or tg.commodity_authority like CONCAT('%', #{vip}, '%')) |
| | | </if> |
| | | ORDER BY tg.sale_num DESC |
| | | ORDER BY ifnull(tg.sort, -1) DESC |
| | | </select> |
| | | <select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods"> |
| | | SELECT |