| | |
| | | |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | @TableField(exist = false) |
| | | private Integer vipId; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
New file |
| | |
| | | package com.ruoyi.order.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2025/1/7 14:38 |
| | | */ |
| | | public class OrderClientFallbackFactory implements FallbackFactory<OrderClient> { |
| | | @Override |
| | | public OrderClient create(Throwable cause) { |
| | | return new OrderClient(){ |
| | | |
| | | @Override |
| | | public R<Integer> getGoodsSaleNum(Integer goodsId, Integer type) { |
| | | return R.fail("获取商品销售数量失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<Integer> getShopSaleNum(Integer shopId, Integer type) { |
| | | return R.fail("获取门店销售订单数量失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.factory.OrderClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2025/1/7 14:37 |
| | | */ |
| | | @FeignClient(contextId = "OrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderClientFallbackFactory.class) |
| | | public interface OrderClient { |
| | | |
| | | |
| | | /** |
| | | * 获取商品销售数量 |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | @PostMapping("/order/getGoodsSaleNum") |
| | | R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type); |
| | | |
| | | |
| | | /** |
| | | * 获取门店销售订单数量 |
| | | * @param shopId 门店id |
| | | * @param type 1:服务订单,2:单品订单 |
| | | * @return |
| | | */ |
| | | @PostMapping("/order/getShopSaleNum") |
| | | R<Integer> getShopSaleNum(@RequestParam("shopId") Integer shopId, @RequestParam("type") Integer type); |
| | | } |
| | |
| | | @ApiModelProperty(value = "绑定门店上级门店可获得返佣积分") |
| | | @TableField("bound_shop_superiors_points") |
| | | private Integer boundShopSuperiorsPoints; |
| | | @ApiModelProperty("购买类型(1=普通商品,2=秒杀商品)") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | |
| | | } |
| | |
| | | private Integer shopId; |
| | | @ApiModelProperty(value = "商品类型(1=服务商品,2=单品商品)", required = true) |
| | | private Integer type; |
| | | @ApiModelProperty("优惠券id") |
| | | private Long couponId; |
| | | } |
| | |
| | | com.ruoyi.order.factory.RemoteOrderGoodsFallbackFactory |
| | | com.ruoyi.order.factory.RemoteOrderGoodsFallbackFactory |
| | | com.ruoyi.order.factory.OrderClientFallbackFactory |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.api.feignClient.SeckillActivityInfoClient; |
| | | import com.ruoyi.other.api.vo.GetSeckillActivityInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public R<GoodsSeckill> getSeckillActivityInfo(GetSeckillActivityInfo info) { |
| | | return R.fail("根据商品id和会员等级获取对应的秒杀活动失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<SeckillActivityInfo> getSeckillActivityInfoById(Integer id) { |
| | | return R.fail("根据id获取秒杀活动失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | public void updateShop(Shop shop) { |
| | | R.fail("编辑门店失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Shop>> getAllShop() { |
| | | return R.fail("获取所有门店失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.api.factory.SeckillActivityInfoClientFallbackFactory; |
| | | import com.ruoyi.other.api.vo.GetSeckillActivityInfo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/seckill-activity-info/getSeckillActivityInfo") |
| | | R<GoodsSeckill> getSeckillActivityInfo(@RequestBody GetSeckillActivityInfo info); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取秒杀活动 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/seckill-activity-info/getSeckillActivityInfoById") |
| | | R<SeckillActivityInfo> getSeckillActivityInfoById(@RequestParam("id") Integer id); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/shop/updateShop") |
| | | void updateShop(Shop shop); |
| | | |
| | | |
| | | /** |
| | | * 获取所有门店 |
| | | * @return |
| | | */ |
| | | @PostMapping("/shop/getAllShop") |
| | | R<List<Shop>> getAllShop(); |
| | | } |
| | |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 角色类型 1=平台 2=公司 3=门店 4=修理厂 |
| | | * 角色类型 1=平台 2=门店 |
| | | */ |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=门店") |
| | | @TableField("role_type") |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @TableField("role_id") |
| | | private Long roleId; |
| | | |
| | | /** 部门ID */ |
| | | @TableField("dept_id") |
| | | private Long deptId; |
| | | |
| | | /** 用户昵称 */ |
| | | @TableField("nick_name") |
| | | private String nickName; |
| | | |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | } |
| | | if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户已停用,请联系管理员"); |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | // throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | throw new ServiceException("您的账号已被禁用,请联系平台"); |
| | | } |
| | | passwordService.validate(user, password, request); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功"); |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | String encode = passwordEncoder.encode("49a15811ea47e8e9c6d8f3ef4d7bbc54"); |
| | | String encode = passwordEncoder.encode("31dc4a464b71db3ddaea244410af4833"); |
| | | System.err.println(encode); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | user.setUserName(user.getPhonenumber()); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser1 = userService.getById(userid); |
| | | if(sysUser1.getRoleType() == 2){ |
| | | user.setObjectId(sysUser1.getObjectId()); |
| | | } |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | | } |
| | |
| | | if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { |
| | | return error("登录账号重复"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | userRoleService.insertSysUserRole(sysUserRole); |
| | | //添加门店员工关系数据 |
| | | if(2 == user.getRoleType()){ |
| | | //门店员工添加数据,需要判断账号是否存在,共用同一个账号 |
| | | if(2 == sysUser1.getRoleType()){ |
| | | 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){ |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | user.setObjectId(sysUser1.getObjectId()); |
| | | userService.insertUser(user); |
| | | one = user; |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | userRoleService.insertSysUserRole(sysUserRole); |
| | | } |
| | | //添加门店员工关系数据 |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(user.getUserId()); |
| | | userShop.setShopId(user.getObjectId()); |
| | | userShop.setUserId(one.getUserId()); |
| | | userShop.setShopId(sysUser1.getObjectId()); |
| | | userShop.setRoleType(2); |
| | | userShop.setRoleId(user.getRoleId()); |
| | | userShop.setDeptId(user.getDeptId()); |
| | | userShop.setNickName(user.getNickName()); |
| | | userShop.setCreateTime(LocalDateTime.now()); |
| | | userShopService.save(userShop); |
| | | }else{ |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | userRoleService.insertSysUserRole(sysUserRole); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | if (StringUtils.isNotNull(userId)) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | if(sysUser.getRoleType() == 2){ |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser1 = userService.selectUserById(userid); |
| | | UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, sysUser.getUserId()).eq(UserShop::getShopId, sysUser1.getObjectId())); |
| | | sysUser.setDeptId(one.getDeptId()); |
| | | sysUser.setNickName(one.getNickName()); |
| | | SysDept sysDept = deptService.selectDeptById(one.getDeptId()); |
| | | sysUser.setDept(sysDept); |
| | | sysUser.setRoleId(one.getRoleId()); |
| | | } |
| | | |
| | | ajax.put("data", sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | |
| | | |
| | | //添加门店员工关系数据 |
| | | if(2 == user.getRoleType()){ |
| | | userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId())); |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(user.getUserId()); |
| | | userShop.setShopId(user.getObjectId()); |
| | | userShop.setRoleType(2); |
| | | userShop.setRoleId(user.getRoleId()); |
| | | userShopService.save(userShop); |
| | | UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId())); |
| | | one.setUserId(user.getUserId()); |
| | | one.setShopId(user.getObjectId()); |
| | | one.setRoleType(one.getRoleType()); |
| | | one.setRoleId(user.getRoleId()); |
| | | one.setDeptId(user.getDeptId()); |
| | | one.setNickName(user.getNickName()); |
| | | userShopService.updateById(one); |
| | | } |
| | | return success(); |
| | | } |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/switchShop") |
| | | @PutMapping("/switchShop/{shopId}") |
| | | @ApiOperation(value = "切换门店", tags = {"门店后台-首页"}) |
| | | public R<Set<String>> switchShop(@PathVariable("shopId") Integer shopId){ |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | |
| | | @Data |
| | | @ApiModel |
| | | public class GetSysUserList extends BasePage { |
| | | @ApiModelProperty(value = "人员搜索") |
| | | @ApiModelProperty(value = "账号名称") |
| | | private String search; |
| | | @ApiModelProperty(value = "充电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "角色id") |
| | | private List<Integer> roleIds; |
| | | @ApiModelProperty(value = "账户状态(0=正常,1=禁用)") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phonenumber; |
| | | @ApiModelProperty(value = "所属部门") |
| | | private Integer deptId; |
| | | private Integer objectId; |
| | | } |
| | |
| | | for (SysUser user : sysUsers) { |
| | | if(2 == user.getRoleType()){ |
| | | userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId())); |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(user.getUserId()); |
| | | userShop.setShopId(user.getObjectId()); |
| | | userShop.setRoleType(2); |
| | | userShop.setRoleId(user.getRoleId()); |
| | | userShopService.save(userShop); |
| | | } |
| | | } |
| | | return i; |
| | |
| | | } |
| | | List<SysUser> list = this.baseMapper.getList(pageInfo, getSysUserList); |
| | | for (SysUser sysUser : list) { |
| | | List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId())); |
| | | List<String> roleNames = new ArrayList<>(); |
| | | for (SysUserRole sysUserRole : list1) { |
| | | SysRole sysRole = sysRoleService.selectRoleById(sysUserRole.getRoleId()); |
| | | if(null == sysRole){ |
| | | continue; |
| | | if(sysUser.getRoleType() == 2){ |
| | | UserShop userShop = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getShopId, sysUser1.getObjectId()).eq(UserShop::getUserId, sysUser.getUserId())); |
| | | SysRole sysRole = roleMapper.selectRoleById(userShop.getRoleId()); |
| | | Long[] roleIds = new Long[]{userShop.getRoleId()}; |
| | | sysUser.setNickName(userShop.getNickName()); |
| | | sysUser.setRoleIds(roleIds); |
| | | sysUser.setRoleNames(Arrays.asList(sysRole.getRoleName())); |
| | | SysDept sysDept = deptService.selectDeptById(userShop.getDeptId()); |
| | | sysUser.setDept(sysDept); |
| | | }else{ |
| | | List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId())); |
| | | List<String> roleNames = new ArrayList<>(); |
| | | for (SysUserRole sysUserRole : list1) { |
| | | SysRole sysRole = sysRoleService.selectRoleById(sysUserRole.getRoleId()); |
| | | if(null == sysRole){ |
| | | continue; |
| | | } |
| | | roleNames.add(sysRole.getRoleName()); |
| | | } |
| | | 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); |
| | | } |
| | | 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); |
| | | } |
| | |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultMap="SysUserResult"> |
| | | select * from sys_user where 1=1 |
| | | <if test="req.search !=null and req.search !=''"> |
| | | and (phonenumber like concat("%", #{req.search},"%") or nick_name like concat("%", #{req.search},"%")) |
| | | select * from sys_user where del_flag = '0' and status = '0' |
| | | <if test="null != req.phonenumber and '' != req.phonenumber"> |
| | | and phonenumber like CONCAT('%', #{req.phonenumber}, '%') |
| | | </if> |
| | | <if test="null != req.siteId"> |
| | | and user_id in (select user_id from t_user_site where site_id = #{req.siteId}) |
| | | and user_id in (select user_id from sys_user_role where role_id in (select role_id from t_role_site where site_id = #{req.siteId})) |
| | | </if> |
| | | <if test="null != req.roleIds and req.roleIds.size() > 0"> |
| | | and user_id in (select user_id from sys_user_role where role_id in |
| | | <foreach collection="req.roleIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="null != req.status"> |
| | | and status = #{req.status} |
| | | </if> |
| | | <if test="null != req.objectId"> |
| | | and objectId = #{req.objectId} |
| | | </if> |
| | | and del_flag = '0' |
| | | <choose> |
| | | <when test="null != req.objectId"> |
| | | and user_id in (select user_id from t_user_shop where shop_id = #{req.objectId} |
| | | <if test="null != req.deptId"> |
| | | and dept_id = #{req.deptId} |
| | | </if> |
| | | <if test="req.search !=null and req.search !=''"> |
| | | and nick_name like concat("%", #{req.search},"%") |
| | | </if> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | <if test="null != req.deptId"> |
| | | and dept_id = #{req.deptId} |
| | | </if> |
| | | <if test="req.search !=null and req.search !=''"> |
| | | and nick_name like concat("%", #{req.search},"%") |
| | | </if> |
| | | </otherwise> |
| | | </choose> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "会员申请列表", tags = {"后台"}) |
| | | public R<IPage<AgentApplication>> page(@RequestBody AgentQuery agentQuery) { |
| | | |
| | | return R.ok(agentApplicationService.pageList(agentQuery)); |
| | | IPage<AgentApplication> agentApplicationIPage = agentApplicationService.pageList(agentQuery); |
| | | for (AgentApplication record : agentApplicationIPage.getRecords()) { |
| | | AppUser byId = appUserService.getById(record.getAppUserId()); |
| | | if (byId!=null){ |
| | | record.setVipId(byId.getVipId()); |
| | | } |
| | | } |
| | | return R.ok(agentApplicationIPage); |
| | | } |
| | | @Resource |
| | | private VipSettingClient vipSettingClient; |
| | |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private AppUserMapper appUserMapper; |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | userCancellationLog.setAppUserId(user.getId()); |
| | | userCancellationLog.setVipId(user.getVipId()); |
| | | userCancellationLogService.save(userCancellationLog); |
| | | |
| | | |
| | | user.setStatus(3); |
| | | appUserService.updateById(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | user.setShopName(storeById.getData().getName()); |
| | | } |
| | | } |
| | | Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).count(); |
| | | Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | user.setCount1(count1); |
| | | user.setCount2(count2); |
| | | user.setCount3(count3); |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | |
| | | |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) |
| | |
| | | |
| | | @PostMapping("/getAppUserByPhone1") |
| | | public R<AppUser> getAppUserByPhone1(@RequestParam("phone") String phone) { |
| | | AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1) |
| | | AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).ne(AppUser::getStatus, 3) |
| | | .eq(AppUser::getPhone, phone)); |
| | | return R.ok(appUser); |
| | | } |
| | |
| | | |
| | | for (AppUser appUser : appUserList) { |
| | | BigDecimal distributionAmount = Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO); |
| | | BigDecimal serviceFee = Optional.ofNullable(appUser.getShopServiceFee()).orElse(BigDecimal.ZERO); |
| | | BigDecimal userCommission = Optional.ofNullable(appUser.getShopCommission()).orElse(BigDecimal.ZERO); |
| | | |
| | | totalCommission = totalCommission.add(distributionAmount); |
| | | totalServiceFee = totalServiceFee.add(serviceFee); |
| | | totalUserCommission = totalUserCommission.add(userCommission); |
| | | |
| | | Integer vipId = appUser.getVipId(); |
| | | if (vipId != null && vipId >= 1 && vipId <= 7) { |
| | | vipCommissions.merge(vipId, distributionAmount, BigDecimal::add); |
| | |
| | | .merge(vipId, distributionAmount, BigDecimal::add); |
| | | } |
| | | } |
| | | List<Shop> data = shopClient.getAllShop().getData(); |
| | | for (Shop shop : data) { |
| | | totalServiceFee = totalServiceFee.add(shop.getServerGiveawayMoney()); |
| | | totalUserCommission = totalUserCommission.add(shop.getGiveawayMoney()); |
| | | } |
| | | |
| | | CommissionDetail commissionDetail = new CommissionDetail(); |
| | | commissionDetail.setTotalCommission(totalCommission); |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.account.api.vo.PaymentUserCoupon; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | |
| | | userPoint.setBalance(byId.getLavePoint()); |
| | | userPoint.setAppUserId(userid); |
| | | userPoint.setObjectId(Long.valueOf(data.getId())); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | //增加优惠券记录,根据时间类型设置开始结束时间 |
| | |
| | | public R<UserCoupon> getCouponInfoInfo(String id){ |
| | | UserCoupon userCoupon = userCouponService.getById(id); |
| | | CouponInfo couponInfo = couponClient.detail(userCoupon.getCouponId()).getData(); |
| | | List<Goods> goods = null; |
| | | if("-1".equals(couponInfo.getForGoodIds())){ |
| | | goods = goodsClient.getGoodsByType(2).getData(); |
| | | List<String> goodNames = new ArrayList<>(); |
| | | if(!"null".equals(couponInfo.getGoodsNameJson()) && StringUtils.isNotEmpty(couponInfo.getGoodsNameJson())){ |
| | | goodNames = JSON.parseArray(couponInfo.getGoodsNameJson(), String.class); |
| | | }else{ |
| | | goods = goodsClient.getGoodsById(couponInfo.getForGoodIds().split(",")).getData(); |
| | | List<Goods> goods = null; |
| | | if("-1".equals(couponInfo.getForGoodIds())){ |
| | | goods = goodsClient.getGoodsByType(2).getData(); |
| | | }else{ |
| | | goods = goodsClient.getGoodsById(couponInfo.getForGoodIds().split(",")).getData(); |
| | | } |
| | | goodNames = goods.stream().map(Goods::getName).collect(Collectors.toList()); |
| | | } |
| | | |
| | | CouponInfoVo couponInfoVo = new CouponInfoVo(); |
| | | BeanUtils.copyProperties(couponInfo, couponInfoVo); |
| | | couponInfoVo.setGoodNames(goods.stream().map(Goods::getName).collect(Collectors.toList())); |
| | | couponInfoVo.setGoodNames(goodNames); |
| | | userCoupon.setCouponInfoVo(couponInfoVo); |
| | | if (userCoupon.getUseTime()==null){ |
| | | userCoupon.setStatus(1); |
| | |
| | | public List<NearbyReferrerVo> getNearbyReferrer(NearbyReferrer nearbyReferrer) { |
| | | //使用地图获取省市区数据 |
| | | String citycode = TencentMapUtil.inverseGeographicalAnalysis(nearbyReferrer.getLongitude(), nearbyReferrer.getLatitude(), false); |
| | | if(StringUtils.isEmpty(citycode)){ |
| | | citycode = "510100"; |
| | | } |
| | | if(null != citycode){ |
| | | String cityCode = citycode.substring(0, 4) + "00"; |
| | | List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer); |
| | |
| | | Integer vipCancelDay = vipSetting.getVipCancelDay(); |
| | | Integer vipChangeDay = vipSetting.getVipChangeDay(); |
| | | List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).isNotNull(AppUser::getInviteUserId) |
| | | .eq(AppUser::getStatus, 1).last(" and ADDDATE(create_time,INTERVAL " + vipCancelDay + " DAY) <= now()")); |
| | | .eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(create_time) + (" + vipCancelDay + " * 86400)) <= UNIX_TIMESTAMP()")); |
| | | for (AppUser appUser : list) { |
| | | UpdateWrapper<AppUser> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("invite_user_id", null).set("shop_id", null).eq("id", appUser.getId()); |
| | |
| | | |
| | | //可更换推广人 |
| | | list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getChangePromoter, 0) |
| | | .eq(AppUser::getStatus, 1).last(" and ADDDATE(ifnull(last_shop_time, create_time),INTERVAL " + vipChangeDay + " DAY) <= now()")); |
| | | .eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(ifnull(last_shop_time, create_time)) + (" + vipChangeDay + " * 86400)) <= UNIX_TIMESTAMP()")); |
| | | for (AppUser appUser : list) { |
| | | appUser.setChangePromoter(1); |
| | | this.updateById(appUser); |
| | |
| | | and t1.status = #{agentQuery.status} |
| | | </if> |
| | | </where> |
| | | order by t1.status asc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | from t_user_cancellation_log t1 |
| | | left join t_app_user t2 on t1.app_user_id = t2.id |
| | | <where> |
| | | <if test="agentQuery.name != null and agentQuery.name != ''"> |
| | | and t2.name like concat('%',#{agentQuery.name},'%') |
| | | <if test="agentQuery.userName != null and agentQuery.userName != ''"> |
| | | and t2.name like concat('%',#{agentQuery.userName},'%') |
| | | </if> |
| | | <if test="agentQuery.phone != null and agentQuery.phone != ''"> |
| | | and t2.phone like concat('%',#{agentQuery.phone},'%') |
| | | <if test="agentQuery.userPhone != null and agentQuery.userPhone != ''"> |
| | | and t2.phone like concat('%',#{agentQuery.userPhone},'%') |
| | | </if> |
| | | <if test="agentQuery.vipId != null"> |
| | | and t1.vip_id = #{agentQuery.vipId} |
| | |
| | | and DATE(t1.create_time) between #{agentQuery.localDate1} and #{agentQuery.localDate2} |
| | | </if> |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | select t1.*,t2.name as userName,t2.phone as userPhone |
| | | from t_withdrawal_requests t1 |
| | | left join t_app_user t2 on t1.app_user_id = t2.id |
| | | |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping("/cancel/{orderId}") |
| | | public R<Void> cancel(@PathVariable("orderId") Long orderId){ |
| | | orderService.update(new LambdaUpdateWrapper<Order>() |
| | | .eq(Order::getId, orderId) |
| | | .set(Order::getOrderStatus, OrderStatus.CANCELLED.getCode())); |
| | | return R.ok(); |
| | | public R cancel(@PathVariable("orderId") Long orderId){ |
| | | return orderService.cancel(orderId); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取商品销售数量 |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getGoodsSaleNum") |
| | | public R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type){ |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type); |
| | | return R.ok(goodsSaleNum); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取门店销售订单数量 |
| | | * @param shopId 门店id |
| | | * @param type 1:服务订单,2:单品订单 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getShopSaleNum") |
| | | public R<Integer> getShopSaleNum(@RequestParam("shopId") Integer shopId, @RequestParam("type") Integer type){ |
| | | Integer shopSaleNum = orderService.getShopSaleNum(shopId, type); |
| | | return R.ok(shopSaleNum); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | OrderStatistics getOrderStatistics(@Param("startTime")String startTime, |
| | | @Param("endTime") String endTime); |
| | | |
| | | |
| | | /** |
| | | * 获取商品销售数量 |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | Integer getGoodsSaleNum(@Param("goodsId") Integer goodsId, @Param("type") Integer type); |
| | | |
| | | |
| | | /** |
| | | * 获取店铺订单数量 |
| | | * @param shopId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | Integer getShopSaleNum(@Param("shopId") Integer shopId, @Param("type") Integer type); |
| | | } |
| | |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.util.payment.model.RefundCallbackResult; |
| | | import com.ruoyi.order.vo.*; |
| | | import org.omg.CORBA.INTERNAL; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<OrderPageListVo> getOrderPageList(OrderPageList orderPageList); |
| | | |
| | | |
| | | /** |
| | | * 小程序取消订单 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | R cancel(Long orderId); |
| | | |
| | | /** |
| | | * 确认发货操作 |
| | |
| | | * @return |
| | | */ |
| | | OrderInfoVo getOrderInfo(Long orderId); |
| | | |
| | | /** |
| | | * 获取商品销售数量 |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | Integer getGoodsSaleNum(Integer goodsId, Integer type); |
| | | |
| | | |
| | | /** |
| | | * 获取店铺订单数量 |
| | | * @param shopId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | Integer getShopSaleNum(Integer shopId, Integer type); |
| | | } |
| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.BalanceChangeRecordClient; |
| | |
| | | AppUser appUser = appUserClient.getAppUserById(appUserId); |
| | | orderPageListVo.setUserName(appUser.getName()); |
| | | orderPageListVo.setPhone(appUser.getPhone()); |
| | | RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderPageListVo.getId()).eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0, 1")); |
| | | orderPageListVo.setRefundPassId(null != one ? one.getId().toString() : null); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 小程序取消订单 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R cancel(Long orderId) { |
| | | Order order = this.getById(orderId); |
| | | if(null == order){ |
| | | return R.fail("取消失败"); |
| | | } |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | if(!order.getAppUserId().equals(userid)){ |
| | | return R.fail("取消失败"); |
| | | } |
| | | if(!Arrays.asList(1, 2, 3).contains(order.getOrderStatus())){ |
| | | return R.fail("订单取消失败"); |
| | | } |
| | | if(LocalDateTime.now().isAfter(order.getAfterSaleTime())){ |
| | | return R.fail("订单取消失败"); |
| | | } |
| | | order.setOrderStatus(5); |
| | | R r = refundPayMoney(order); |
| | | if(200 == r.getCode()){ |
| | | this.updateById(order); |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 确认发货操作 |
| | | * @param orderId |
| | |
| | | Order order = this.getById(orderId); |
| | | if(Arrays.asList(5, 6, 7).contains(order.getOrderStatus())){ |
| | | return R.fail("无效的操作"); |
| | | } |
| | | if(LocalDateTime.now().isAfter(order.getAfterSaleTime())){ |
| | | return R.fail("订单取消失败"); |
| | | } |
| | | order.setOrderStatus(5); |
| | | R r = refundPayMoney(order); |
| | |
| | | return R.fail("无效的操作"); |
| | | } |
| | | order.setOrderStatus(4); |
| | | R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5); |
| | | if (R.isError(baseSettingR)) { |
| | | return R.fail("售后设置获取失败"); |
| | | } |
| | | BaseSetting baseSetting = baseSettingR.getData(); |
| | | if (baseSetting == null) { |
| | | return R.fail("售后设置获取失败"); |
| | | } |
| | | String content = baseSetting.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | Long days = jsonObject.getLong("days"); |
| | | order.setAfterSaleTime(LocalDateTime.now().plusDays(days)); |
| | | this.updateById(order); |
| | | return R.ok(); |
| | | } |
| | |
| | | orderInfo.setGoodsJson(JSON.toJSONString(goodsJson)); |
| | | return orderInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取商品销售数量 |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getGoodsSaleNum(Integer goodsId, Integer type) { |
| | | return this.baseMapper.getGoodsSaleNum(goodsId, type); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取店铺订单数量 |
| | | * @param shopId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getShopSaleNum(Integer shopId, Integer type) { |
| | | return this.baseMapper.getShopSaleNum(shopId, type); |
| | | } |
| | | } |
| | |
| | | List<OrderRefundPassList> orderRefundPassList = this.baseMapper.getOrderRefundPassList(pageInfo, refundPassListVo.getCode(), appUserIds, shopId, refundPassListVo.getRefundMethod(), refundPassListVo.getStatus()); |
| | | for (OrderRefundPassList refundPassList : orderRefundPassList) { |
| | | AppUser appUser = appUserClient.getAppUserById(refundPassList.getAppUserId()); |
| | | refundPassList.setUserName(appUser.getName()); |
| | | refundPassList.setPhone(appUser.getPhone()); |
| | | if(null != appUser){ |
| | | refundPassList.setUserName(appUser.getName()); |
| | | refundPassList.setPhone(appUser.getPhone()); |
| | | } |
| | | } |
| | | return pageInfo.setRecords(orderRefundPassList); |
| | | } |
| | |
| | | if(refundPass.getRefundMethod() == 2 && 2 == status){ |
| | | refundPass.setStatus(2); |
| | | } |
| | | if(3 == status){ |
| | | refundPass.setStatus(3); |
| | | } |
| | | refundPass.setPassRemark(passRemark); |
| | | //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分 |
| | | if(refundPass.getRefundMethod() == 2 && 2 == status){ |
| | |
| | | } |
| | | confirmOrderVo.setOrderPoint(sum); |
| | | } |
| | | //查询当前是否有订单活动 |
| | | OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData(); |
| | | |
| | | BigDecimal orderMoney = confirmOrderVo.getOrderMoney(); |
| | | BigDecimal paymentMoney = orderMoney; |
| | | //总优惠金额 |
| | | BigDecimal activityAmount = BigDecimal.ZERO; |
| | | |
| | | //减去优惠券优惠金额 |
| | | CouponInfoVo couponInfoVo = null; |
| | | if(null != confirmOrder.getCouponId() && 2 != confirmOrder.getPaymentType()){ |
| | | couponInfoVo = userCouponClient.getCouponInfo(confirmOrder.getCouponId()).getData(); |
| | | String forGoodIds = couponInfoVo.getForGoodIds(); |
| | | String[] split = forGoodIds.split(","); |
| | | List<String> parseArray = Arrays.asList(split); |
| | | //全部商品 |
| | | if("-1".equals(forGoodIds)){ |
| | | //满减 |
| | | if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(paymentMoney) <= 0){ |
| | | paymentMoney = paymentMoney.subtract(couponInfoVo.getDiscountAmount()); |
| | | activityAmount = activityAmount.add(couponInfoVo.getDiscountAmount()); |
| | | } |
| | | //代金券 |
| | | if(2 == couponInfoVo.getCouponType()){ |
| | | paymentMoney = paymentMoney.subtract(couponInfoVo.getMoneyAmount()); |
| | | activityAmount = activityAmount.add(couponInfoVo.getMoneyAmount()); |
| | | if(paymentMoney.compareTo(BigDecimal.ZERO) < 0){ |
| | | paymentMoney = BigDecimal.ZERO; |
| | | } |
| | | } |
| | | //折扣券 |
| | | if(3 == couponInfoVo.getCouponType()){ |
| | | BigDecimal paymentMoney1 = couponInfoVo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney); |
| | | BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN); |
| | | paymentMoney = paymentMoney1; |
| | | activityAmount = activityAmount.add(bigDecimal); |
| | | } |
| | | }else{ |
| | | //部分商品,需要计算参与优惠商品的支付金额,然后再对商品进行优惠券处理 |
| | | paymentMoney = BigDecimal.ZERO; |
| | | BigDecimal goodsMoney = BigDecimal.ZERO; |
| | | for (MyShoppingCartVo myShoppingCartVo : goodsList) { |
| | | String goodsId = myShoppingCartVo.getGoodsId().toString(); |
| | | BigDecimal cash = myShoppingCartVo.getCash(); |
| | | if(parseArray.contains(goodsId)){ |
| | | goodsMoney = goodsMoney.add(cash); |
| | | }else{ |
| | | paymentMoney = paymentMoney.add(cash); |
| | | } |
| | | } |
| | | |
| | | //满减 |
| | | if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(goodsMoney) <= 0){ |
| | | goodsMoney = goodsMoney.subtract(couponInfoVo.getDiscountAmount()); |
| | | activityAmount = activityAmount.add(couponInfoVo.getDiscountAmount()); |
| | | } |
| | | //代金券 |
| | | if(2 == couponInfoVo.getCouponType()){ |
| | | goodsMoney = goodsMoney.subtract(couponInfoVo.getMoneyAmount()); |
| | | activityAmount = activityAmount.add(couponInfoVo.getMoneyAmount()); |
| | | if(goodsMoney.compareTo(BigDecimal.ZERO) < 0){ |
| | | goodsMoney = BigDecimal.ZERO; |
| | | } |
| | | } |
| | | //折扣券 |
| | | if(3 == couponInfoVo.getCouponType()){ |
| | | BigDecimal paymentMoney1 = couponInfoVo.getDiscount().divide(new BigDecimal(10)).multiply(goodsMoney); |
| | | BigDecimal bigDecimal = goodsMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN); |
| | | goodsMoney = paymentMoney1; |
| | | activityAmount = activityAmount.add(bigDecimal); |
| | | } |
| | | paymentMoney = paymentMoney.add(goodsMoney); |
| | | } |
| | | } |
| | | |
| | | //查询当前是否有订单活动 |
| | | OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData(); |
| | | //满XX才打折,只有现金才能优惠 |
| | | if(null != orderActivityInfo && confirmOrder.getPaymentType() == 1 && orderActivityInfo.getConditionAmount().compareTo(orderMoney) <= 0){ |
| | | confirmOrderVo.setActivityName(orderActivityInfo.getActivityName()); |
| | | paymentMoney = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(orderMoney); |
| | | confirmOrderVo.setDiscountAmount(orderMoney.subtract(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney); |
| | | BigDecimal bigDecimal = paymentMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN); |
| | | activityAmount = activityAmount.add(bigDecimal); |
| | | } |
| | | confirmOrderVo.setDiscountAmount(activityAmount); |
| | | BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); |
| | | confirmOrderVo.setUseSimultaneously(JSON.parseObject(baseSetting.getContent()).getInteger("status") == 1); |
| | | int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum(); |
| | |
| | | for (int i = 0; i < objects.size(); i++) { |
| | | Long id = objects.getJSONObject(i).getLong("id"); |
| | | Integer num1 = objects.getJSONObject(i).getInteger("num"); |
| | | Integer type = objects.getJSONObject(i).getInteger("type"); |
| | | num += num1; |
| | | ShoppingCart shoppingCart = this.getById(id); |
| | | //判断当前数量是否已经超出限购数量(需要计算已经购买的数量) |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), type); |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit()){ |
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, appUser.getId()).eq(Order::getDelFlag, 0).notIn(Order::getOrderStatus, Arrays.asList(5, 6))); |
| | | List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList()); |
| | | int sum = 0; |
| | | if(orderIds.size() > 0){ |
| | | List<OrderGood> orderGoodList = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().in(OrderGood::getOrderId, orderIds) |
| | | .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0)); |
| | | sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum(); |
| | | } |
| | | if((num1 + sum) > goods.getPurchaseLimit()){ |
| | | if(1 == type){ |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + num1) > goods.getPurchaseLimit()){ |
| | | return R.fail(goods.getName() + "已超出购买上限"); |
| | | } |
| | | }else{ |
| | | GetSeckillActivityInfo info = new GetSeckillActivityInfo(); |
| | | info.setGoodsId(shoppingCart.getGoodsId()); |
| | | info.setVip(appUser.getVipId()); |
| | | GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); |
| | | if(null != goodsSeckill ){ |
| | | SeckillActivityInfo activityInfo = seckillActivityInfoClient.getSeckillActivityInfoById(goodsSeckill.getSeckillActivityInfoId()).getData(); |
| | | if(null != activityInfo.getMaxNum() && -1 != activityInfo.getMaxNum() && (goodsSaleNum + num1) > activityInfo.getMaxNum()){ |
| | | return R.fail(goods.getName() + "已超出秒杀活动购买上限"); |
| | | } |
| | | } |
| | | } |
| | | ids.add(id); |
| | |
| | | OrderGood orderGood = new OrderGood(); |
| | | orderGood.setGoodsId(myShoppingCartVo.getGoodsId()); |
| | | orderGood.setOrderId(order.getId()); |
| | | GetSeckillActivityInfo info = new GetSeckillActivityInfo(); |
| | | info.setGoodsId(myShoppingCartVo.getGoodsId()); |
| | | info.setVip(appUser.getVipId()); |
| | | GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); |
| | | if(null != goodsSeckill){ |
| | | orderGood.setSeckillJson(JSON.toJSONString(goodsSeckill)); |
| | | } |
| | | for (int i = 0; i < objects.size(); i++) { |
| | | Long id = objects.getJSONObject(i).getLong("id"); |
| | | if(myShoppingCartVo.getId().equals(id.toString())){ |
| | | ShoppingCart shoppingCart = this.getById(id); |
| | | Integer num1 = objects.getJSONObject(i).getInteger("num"); |
| | | Integer type = objects.getJSONObject(i).getInteger("type"); |
| | | orderGood.setNum(num1); |
| | | orderGood.setType(type); |
| | | if(2 == type){ |
| | | GetSeckillActivityInfo info = new GetSeckillActivityInfo(); |
| | | info.setGoodsId(myShoppingCartVo.getGoodsId()); |
| | | info.setVip(appUser.getVipId()); |
| | | GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); |
| | | if(null != goodsSeckill){ |
| | | orderGood.setSeckillJson(JSON.toJSONString(goodsSeckill)); |
| | | } |
| | | } |
| | | Goods goods1 = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | orderGood.setGoodJson(JSON.toJSONString(goods1)); |
| | | break; |
| | |
| | | for (String code : orderPayment) { |
| | | Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNumber, code)); |
| | | if(null == order || order.getPayStatus() != 1){ |
| | | redisTemplate.opsForZSet().remove("OrderPayment", code); |
| | | continue; |
| | | } |
| | | //开始执行关闭订单操作 |
| | |
| | | redisTemplate.opsForZSet().add("OrderPayment", code, 0); |
| | | log.error("关闭订单失败:{}---->{}", code, JSON.toJSONString(closeOrderResult)); |
| | | } |
| | | redisTemplate.opsForZSet().remove("OrderPayment", code); |
| | | } |
| | | |
| | | //快递支付 |
| | |
| | | code = code.substring(0, 23); |
| | | Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNumber, code)); |
| | | if(null == order || order.getPayStatus() != 1){ |
| | | redisTemplate.opsForZSet().remove("MaterialFlowPayment", code); |
| | | continue; |
| | | } |
| | | //开始执行关闭订单操作 |
| | |
| | | redisTemplate.opsForZSet().add("MaterialFlowPayment", code, 0); |
| | | log.error("关闭订单失败:{}---->{}", code, JSON.toJSONString(closeOrderResult)); |
| | | } |
| | | redisTemplate.opsForZSet().remove("MaterialFlowPayment", code); |
| | | } |
| | | } |
| | | } |
| | |
| | | private BigDecimal orderMoney; |
| | | @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Long appUserId; |
| | | @ApiModelProperty("售后订单id") |
| | | private String refundPassId; |
| | | } |
| | |
| | | private Integer refundMethod; |
| | | @ApiModelProperty("申请原因") |
| | | private String refundReason; |
| | | @ApiModelProperty("1待审核2已完成3已拒绝4待退货5待平台收货") |
| | | private Integer status; |
| | | @ApiModelProperty("状态(1待审核2同意3拒绝)") |
| | | private Integer passStatus; |
| | | /** |
| | |
| | | and tor.create_time between #{startTime} and #{endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="getGoodsSaleNum" resultType="int"> |
| | | select |
| | | ifnull(sum(a.num), 0) |
| | | from t_order_good a |
| | | left join t_order b on (a.order_id = b.id) |
| | | where b.del_flag = 0 and b.pay_status = 2 and b.order_status in (1, 2, 3, 4, 7, 8) and a.goods_id = #{goodsId} |
| | | <if test="null != type"> |
| | | and a.type = #{type} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="getShopSaleNum" resultType="int"> |
| | | select |
| | | ifnull(count(1), 0) |
| | | from t_order a |
| | | where del_flag = 0 and pay_status = 2 and order_status in (1, 2, 3, 4, 7, 8) |
| | | <if test="null != shopId and 0 != shopId"> |
| | | and shop_id = #{shopId} |
| | | </if> |
| | | <if test="null != type"> |
| | | and order_type = #{type} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%m:%s') as createTime, |
| | | a.refund_method as refundMethod, |
| | | a.refund_reason as refundReason, |
| | | a.pass_status as passStatus |
| | | a.pass_status as passStatus, |
| | | a.status |
| | | from t_refund_pass a |
| | | left join t_order b on (a.order_id = b.id) |
| | | where a.del_flag = 0 |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取商品秒杀活动 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getSeckillActivityInfoById") |
| | | public R<SeckillActivityInfo> getSeckillActivityInfoById(@RequestParam("id") Integer id){ |
| | | SeckillActivityInfo one = seckillActivityInfoService.getById(id); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/manageList") |
| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.vo.VerifiableShopVo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | |
| | | private GoodsService goodsService; |
| | | @Resource |
| | | private GoodsShopService goodsShopService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | |
| | | @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"}) |
| | | public R<ShopStatistics> shopStatistics(@ApiParam("门店id") Integer shopId) { |
| | | ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopId); |
| | | if(null == shopId){ |
| | | shopId = 0; |
| | | } |
| | | Integer serviceOrder = orderClient.getShopSaleNum(shopId, 1).getData(); |
| | | Integer goodsOrder = orderClient.getShopSaleNum(shopId, 2).getData(); |
| | | shopStatistics.setTotalOrder(serviceOrder + goodsOrder); |
| | | shopStatistics.setServiceOrder(serviceOrder); |
| | | shopStatistics.setGoodsOrder(goodsOrder); |
| | | return R.ok(shopStatistics); |
| | | } |
| | | |
| | |
| | | shopService.saveWithdrawalAccount(saveWithdrawalAccount); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有门店 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getAllShop") |
| | | public R<List<Shop>> getAllShop(){ |
| | | List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @PostMapping("/manage/addorupdate") |
| | | @ApiOperation(value = "添加编辑", tags = {"门店-技师列表"}) |
| | | public R<Page<Technician>> add(@RequestBody Technician technician) { |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | if (technician.getId()==null){ |
| | | if (technician.getId()==null) { |
| | | technician.setSubscribeStatus(2); |
| | | List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).list(); |
| | | if (!list.isEmpty()) { |
| | | return R.fail("当前号码已经添加"); |
| | | } |
| | | R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone()); |
| | | if (appUserByPhone1.getData()==null){ |
| | | return R.fail("当前号码暂无注册用户"); |
| | | } |
| | | }else { |
| | | Technician byId = technicianService.getById(technician.getId()); |
| | | if (byId.getPhone()!=technician.getPhone()){ |
| | | List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).list(); |
| | | if (!list.isEmpty()) { |
| | | return R.fail("当前号码已经添加"); |
| | | } |
| | | R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone()); |
| | | if (appUserByPhone1.getData()==null){ |
| | | return R.fail("当前号码暂无注册用户"); |
| | | } |
| | | } |
| | | } |
| | | technician.setShopId(objectId); |
| | | R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone()); |
| | | if (appUserByPhone1.getData()!=null){ |
| | | technician.setAppUserId(appUserByPhone1.getData().getId()); |
| | | } |
| | | technicianService.saveOrUpdate(technician); |
| | | return R.ok(); |
| | | } |
| | |
| | | @GetMapping("/cancel") |
| | | @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理,小程序-个人中心-我的预约","门店-预约管理"}) |
| | | public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id) { |
| | | |
| | | TechnicianSubscribe subscribe = technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>() |
| | | .eq(TechnicianSubscribe::getId, id) |
| | | .eq(TechnicianSubscribe::getStatus, 0)); |
| | |
| | | IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status); |
| | | |
| | | void subscribe(TechnicianSubscribe technicianSubscribe); |
| | | |
| | | |
| | | /** |
| | | * 定时修改到期状态 |
| | | */ |
| | | void taskEditStstus(); |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.vo.Price; |
| | | import com.ruoyi.other.api.domain.*; |
| | |
| | | private GoodsBargainPriceService goodsBargainPriceService; |
| | | @Resource |
| | | private GoodsBargainPriceDetailService goodsBargainPriceDetailService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | List<GoodsVO> list = this.baseMapper.goodsList(pageInfo, search.getGoodsCategoryId(), search.getName(), vipId); |
| | | for (GoodsVO goods : list) { |
| | | Price price = getPrice(vipId, goods.getGoodsId(), 1, null, provinceCode, cityCode, districtCode); |
| | | Price price = getPrice(vipId, goods.getGoodsId(), null, 1, provinceCode, cityCode, districtCode); |
| | | if(null != price){ |
| | | goods.setCashPayment(price.getCashPayment() ? 1 : 0); |
| | | goods.setPointPayment(price.getPointPayment() ? 1 : 0); |
| | | goods.setSellingPrice(price.getCash()); |
| | | goods.setIntegral(price.getPoint()); |
| | | } |
| | |
| | | goodsVO.setGoodsName(goods.getName()); |
| | | Price price = getPrice(vipId, goods.getId(), 1, null, provinceCode, cityCode, districtCode); |
| | | if(null != price){ |
| | | goodsVO.setPointPayment(price.getPointPayment() ? 1 : 0); |
| | | goodsVO.setCashPayment(price.getCashPayment() ? 1 : 0); |
| | | goodsVO.setSellingPrice(price.getCash()); |
| | | goodsVO.setIntegral(price.getPoint()); |
| | | } |
| | |
| | | .in(Shop::getDelFlag, 0)); |
| | | goodsVO.setShopList(shopList); |
| | | } |
| | | Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); |
| | | goodsVO.setSaleNum(integer); |
| | | return goodsVO; |
| | | } |
| | | |
| | |
| | | } |
| | | List<Goods> goods = goodsMapper.selectListByShopId(pageInfo, shopId, vipId); |
| | | for (Goods good : goods) { |
| | | Price price = getPrice(vipId, good.getId(), 1, shopId, provinceCode, cityCode, districtCode); |
| | | Price price = getPrice(vipId, good.getId(), shopId, 1, provinceCode, cityCode, districtCode); |
| | | if(null != price){ |
| | | good.setCashPayment(price.getCashPayment() ? 1 : 0); |
| | | good.setPointPayment(price.getPointPayment() ? 1 : 0); |
| | | good.setSellingPrice(price.getCash()); |
| | | good.setIntegral(price.getPoint()); |
| | | } |
| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.mapper.GoodsShopMapper; |
| | | import com.ruoyi.other.mapper.SeckillActivityInfoMapper; |
| | |
| | | private GoodsSeckillService goodsSeckillService; |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | @Override |
| | | public List<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | |
| | | shops = shopMapper.selectList(new LambdaUpdateWrapper<Shop>().eq(Shop::getDelFlag, 0)); |
| | | } |
| | | seckillActivityDetailVO.setShopList(shops); |
| | | Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 2).getData(); |
| | | seckillActivityDetailVO.setSaleNum(integer); |
| | | return seckillActivityDetailVO; |
| | | } |
| | | |
| | |
| | | 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.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | PageInfo<TechnicianSubscribeVO> pageInfo = new PageInfo(pageCurr, pageSize); |
| | | List<TechnicianSubscribeVO> list = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(pageInfo, shopId, status); |
| | | for (TechnicianSubscribeVO technicianSubscribeVO : list) { |
| | | Long id = technicianSubscribeVO.getId(); |
| | | String id = technicianSubscribeVO.getId(); |
| | | TechnicianSubscribe technicianSubscribe = this.getById(id); |
| | | AppUser appUser = appUserClient.getAppUserById(technicianSubscribe.getAppUserId()); |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | |
| | | Integer serviceMode, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<TechnicianSubscribeVO> pageInfo = new PageInfo(pageCurr, pageSize); |
| | | List<TechnicianSubscribeVO> technicianSubscribeByUserAndShop1 = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop1(pageInfo, shopId, status, phone, name, serviceMode); |
| | | for (TechnicianSubscribeVO technicianSubscribeVO : technicianSubscribeByUserAndShop1) { |
| | | AppUser appUser = appUserClient.getAppUserById(technicianSubscribeVO.getAppUserId()); |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | } |
| | | return pageInfo.setRecords(technicianSubscribeByUserAndShop1); |
| | | } |
| | | @Override |
| | |
| | | long deadlineTimestamp = subscribeTime.atZone(ZoneId.systemDefault()).toEpochSecond(); |
| | | redisTemplate.opsForZSet().add("delay_queue:subscribe", subscribe.getId().toString(), deadlineTimestamp); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时修改到期状态 |
| | | */ |
| | | @Override |
| | | public void taskEditStstus() { |
| | | List<TechnicianSubscribe> list = this.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getStatus, 0).eq(TechnicianSubscribe::getDelFlag, 0) |
| | | .lt(TechnicianSubscribe::getSubscribeTime, LocalDateTime.now())); |
| | | list.forEach(s->s.setStatus(3)); |
| | | if(list.size() > 0){ |
| | | this.updateBatchById(list); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | import com.ruoyi.other.service.TechnicianSubscribeService; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | |
| | | /** |
| | |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Resource |
| | | private TechnicianSubscribeService technicianSubscribeService; |
| | | |
| | | |
| | | /** |
| | | * 每分钟定时 |
| | | */ |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskMonth() { |
| | | technicianSubscribeService.taskEditStstus(); |
| | | } |
| | | |
| | | /** |
| | | * 每天的凌晨执行的任务 |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty(value = "详情图,多个逗号分隔") |
| | | private String detailPicture; |
| | | |
| | | |
| | | @ApiModelProperty(value = "现金支付(0=否,1=是)") |
| | | private Integer cashPayment; |
| | | |
| | | @ApiModelProperty(value = "积分支付(0=否,1=是)") |
| | | private Integer pointPayment; |
| | | |
| | |
| | | public class TechnicianSubscribeVO { |
| | | |
| | | @ApiModelProperty(value = "预约id") |
| | | private Long id; |
| | | private String id; |
| | | |
| | | /** |
| | | * 门店名称 |
| | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phone; |
| | | |
| | | private Long appUserId; |
| | | |
| | | |
| | | } |
| | |
| | | tg.sale_num as saleNum, |
| | | tg.home_page_picture as homePagePicture |
| | | FROM t_goods tg |
| | | left join t_goods_shop tgs ON tg.id = tgs.goods_id |
| | | where tg.del_flag = 0 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}))) |
| | | 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> |
| | |
| | | |
| | | |
| | | <select id="goodsList" resultType="com.ruoyi.other.vo.GoodsVO"> |
| | | select *, id as goodsId, name as goodsName from t_goods where status = 2 and del_flag = 0 |
| | | select *, id as goodsId, name as goodsName from t_goods where status = 2 and del_flag = 0 and `type` = 2 |
| | | <if test="null != goodsCategoryId"> |
| | | and goods_category_id = #{goodsCategoryId} |
| | | </if> |
| | |
| | | and name like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | <if test="null != vip"> |
| | | and id in (select goods_id from t_goods_vip where vip = #{vip}) |
| | | and (FIND_IN_SET(#{vip}, commodity_authority) or commodity_authority like '%-1%') |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | tg.home_page_picture as homePagePicture, |
| | | tg.original_price as originalPrice, |
| | | tgs.selling_price as sellingPrice, |
| | | tgs.integral as integral, |
| | | tg.sale_num as saleNum, |
| | | tsai.start_time as startTime, |
| | | tsai.end_time as endTime |
| | |
| | | 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 and tgs.vip = #{vipId} |
| | | WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 and now() between tsai.start_time and tsai.end_time |
| | | WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 |
| | | <if test="name != null and name != ''"> |
| | | AND tg.`name` LIKE concat('%',#{name},'%') |
| | | </if> |
| | |
| | | tsai.start_time as startTime, |
| | | tg.detail_picture as detailPicture, |
| | | tsai.end_time as endTime, |
| | | tsai.max_num as maxNum, |
| | | tg.detail |
| | | FROM |
| | | t_seckill_activity_info tsai |
| | |
| | | ts.phone, |
| | | tsp.type, |
| | | tsp.create_time, |
| | | tsp.variable_point |
| | | tsp.variable_point, |
| | | tsp.order_num |
| | | FROM |
| | | t_shop_point tsp |
| | | LEFT JOIN t_shop ts ON tsp.shop_id = ts.id |
| | |
| | | <if test="shopPoint.startTime !=null and shopPoint.endTime !=null"> |
| | | AND tsp.create_time BETWEEN #{shopPoint.startTime} AND #{shopPoint.endTime} |
| | | </if> |
| | | |
| | | <if test="shopPoint.shopId !=null"> |
| | | AND tsp.shop_id = #{shopPoint.shopId} |
| | | </if> |
| | | </where> |
| | | order by tsp.create_time desc |
| | | </sql> |
| | | |
| | | <select id="selectShopPointList" resultType="com.ruoyi.other.api.domain.ShopPoint"> |
| | |
| | | </select> |
| | | <select id="getTechnicianSubscribeByUserAndShop1" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO"> |
| | | SELECT |
| | | CAST(tts.id AS CHAR) id, |
| | | tts.id, |
| | | tts.user_address, |
| | | ts.`name` shopName, |
| | | ts.address shopAddress, |
| | |
| | | ts.latitude, |
| | | tts.subscribe_time, |
| | | tts.service_mode, |
| | | tts.status |
| | | tts.status, |
| | | tts.app_user_id as appUserId |
| | | FROM |
| | | t_technician_subscribe tts |
| | | LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0 |