Merge remote-tracking branch 'origin/master'
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "优惠劵id") |
| | |
| | | @TableField("auth_time") |
| | | private LocalDateTime authTime; |
| | | |
| | | @ApiModelProperty(value = "平台收货时间") |
| | | private LocalDateTime receiveTime; |
| | | |
| | | @ApiModelProperty(value = "后台审核备注") |
| | | @TableField("pass_remark") |
| | | private String passRemark; |
| | |
| | | // throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | throw new ServiceException("您的账号已被禁用,请联系平台"); |
| | | } |
| | | // passwordService.validate(user, password, request); |
| | | passwordService.validate(user, password, request); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功"); |
| | | return userInfo; |
| | | } |
| | |
| | | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); |
| | | } |
| | | |
| | | public static void startPage(Integer pageNum,Integer pageSize){ |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); |
| | | Boolean reasonable = pageDomain.getReasonable(); |
| | | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); |
| | | } |
| | | |
| | | /** |
| | | * 清理分页的线程变量 |
| | | */ |
| | |
| | | return pageNum; |
| | | } |
| | | |
| | | |
| | | |
| | | public void setPageNum(Integer pageNum) |
| | | { |
| | | this.pageNum = pageNum; |
New file |
| | |
| | | package com.ruoyi.common.security.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | public class MD5Generator { |
| | | public static String generateMD5(String input) { |
| | | try { |
| | | // Create MD5 Hash |
| | | MessageDigest digest = MessageDigest.getInstance("MD5"); |
| | | digest.update(input.getBytes()); |
| | | byte messageDigest[] = digest.digest(); |
| | | |
| | | // Create Hex String |
| | | StringBuilder hexString = new StringBuilder(); |
| | | for (byte aMessageDigest : messageDigest) { |
| | | String h = Integer.toHexString(0xFF & aMessageDigest); |
| | | while (h.length() < 2) h = "0" + h; |
| | | hexString.append(h); |
| | | } |
| | | return hexString.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String myString = "968484"; |
| | | System.err.println("MD5 of '" + myString + "' is: " + generateMD5(myString)); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | String encode = passwordEncoder.encode("123456"); |
| | | System.err.println(encode); |
| | | String s = encryptPassword("ad23a8ac3c902145ffe05df05812b1f0"); |
| | | System.err.println(s); |
| | | // System.err.println(s); |
| | | |
| | | System.err.println(matchesPassword("6ac9d3a5c7639060425fadd6db3d305e","$2a$10$M.L9orN4p8y6aLvBhOm9hevAmi0YXAPuWIHZrAyEAKGW3x8B4/0d.")); |
| | | System.err.println(matchesPassword("ad23a8ac3c902145ffe05df05812b1f0","$2a$10$Rw0A4NjcdqnNrImdOn4EI.z.Ib.XfpY01NPPs9kSsF42JxGrMrJBy")); |
| | | } |
| | | } |
| | |
| | | System.err.println(oldPassword); |
| | | System.err.println(newPassword); |
| | | // String username = SecurityUtils.getUsername(); |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | SysUser user =null; |
| | | if (updatePassword.getType()==1){ |
| | | user = userService.selectUserByUserName(username); |
| | | }else{ |
| | | user = userService.selectUserShopByUserName(username); |
| | | } |
| | | if (Objects.isNull(user)) |
| | | { |
| | | return error("未查询到该账号"); |
| | |
| | | { |
| | | return error("新密码不能与旧密码相同"); |
| | | } |
| | | if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) |
| | | { |
| | | if (updatePassword.getType()==1&&userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) { |
| | | // 更新缓存用户密码 |
| | | // LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | // SysUser sysUser = loginUser.getSysUser(); |
| | | // loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword)); |
| | | // tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | if (updatePassword.getType()==2&&userService.resetUserShopPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) { |
| | | // 更新缓存用户密码 |
| | | // LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | // SysUser sysUser = loginUser.getSysUser(); |
| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.MD5Generator; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | |
| | | .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.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | user.setObjectId(sysUser1.getObjectId()); |
| | | if(null != appUser){ |
| | |
| | | } |
| | | }else{ |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | |
| | | user.setRoleType(sysUser1.getRoleType()); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | if (user.getPassword() != null && !"".equals(user.getPassword())) { |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | |
| | | user.setPassWordUpdate(new Date()); |
| | | } |
| | | if (user.getPhonenumber() != null) { |
| | |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | |
| | | user.setPassword(SecurityUtils.encryptPassword(MD5Generator.generateMD5("a123456"))); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
| | |
| | | private String newPassword; |
| | | |
| | | private String oldPassword; |
| | | // 1平台 2门店 |
| | | private Integer type; |
| | | } |
| | |
| | | * @return 结果 |
| | | */ |
| | | int resetUserPwd(@Param("userName") String userName, @Param("password") String password); |
| | | int resetUserShopPwd(@Param("userName") String userName, @Param("password") String password); |
| | | |
| | | /** |
| | | * 通过用户ID删除用户 |
| | |
| | | * @return 结果 |
| | | */ |
| | | int resetUserPwd(String userName, String password); |
| | | int resetUserShopPwd(String userName, String password); |
| | | |
| | | /** |
| | | * 通过用户ID删除用户 |
| | |
| | | public int resetUserPwd(String userName, String password) { |
| | | return userMapper.resetUserPwd(userName, password); |
| | | } |
| | | @Override |
| | | public int resetUserShopPwd(String userName, String password) { |
| | | return userMapper.resetUserShopPwd(userName, password); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户角色信息 |
| | |
| | | </update> |
| | | |
| | | <update id="resetUserPwd" parameterType="com.ruoyi.system.api.domain.SysUser"> |
| | | update sys_user set password = #{password} where user_name = #{userName} |
| | | update sys_user set password = #{password} where user_name = #{userName} and role_type =1 |
| | | </update> |
| | | <update id="resetUserShopPwd" parameterType="com.ruoyi.system.api.domain.SysUser"> |
| | | update sys_user set password = #{password} where user_name = #{userName} and role_type =2 |
| | | </update> |
| | | |
| | | <update id="deleteUserById" parameterType="Long"> |
| | |
| | | package com.ruoyi.account.controller; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | import com.ruoyi.other.api.feignClient.VipSettingClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @ApiOperation(value = "会员申请详情", tags = {"会员中心-小程序"}) |
| | | public R<AgentApplication> detail(@RequestParam Long id) { |
| | | AgentApplication agentApplication = agentApplicationService.getById(id); |
| | | AppUser appUser = appUserService.getById(agentApplication.getAppUserId()); |
| | | agentApplication.setShopPoint(appUser.getShopPoint()); |
| | | agentApplication.setSharePoint(appUser.getSharePoint()); |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(agentApplication.getApplicationVipId()); |
| | | VipSettingDto vipSettingDto = new VipSettingDto(); |
| | | BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto); |
| | | agentApplication.setVipSettingDto(vipSettingDto); |
| | | // List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | // .ne(AppUser::getStatus, 3) |
| | | // .eq(AppUser::getDelFlag, 0)); |
| | | // ArrayList<Long> userIds = new ArrayList<>(); |
| | | // userIds.add(appUser.getId()); |
| | | // getUserAncestorList(appUser,userIds,new ArrayList<>(),appUserList); |
| | | agentApplication.setVipId(agentApplication.getApplicationVipId()); |
| | | return R.ok(agentApplication); |
| | | } |
| | | public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) { |
| | | children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(children)){ |
| | | user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count()); |
| | | user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count()); |
| | | user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); |
| | | user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); |
| | | user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); |
| | | user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count()); |
| | | user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count()); |
| | | List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | getUserAncestorList(user,userIdList, children,list); |
| | | } |
| | | } |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | import com.ruoyi.account.mapper.AppUserMapper; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.account.service.UserSignRecordService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.dto.DangerInfoDto; |
| | | import com.ruoyi.account.mapper.AppUserMapper; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.account.util.ObsUploadUtil; |
| | | import com.ruoyi.account.vo.*; |
| | | 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.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.annotation.DistributedLock; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.factory.ShopBalanceStatementClientFallbackFactory; |
| | | import com.ruoyi.other.api.feignClient.ShopBalanceStatementClient; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.feignClient.StoreClient; |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.util.CollectionUtils; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @GetMapping("/danger/down") |
| | | @ApiOperation(value = "用户列表-保级条件降级", tags = {"管理后台"}) |
| | | public R down(Long id) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setVipId(byId.getVipId() - 1); |
| | | appUserService.updateById(byId); |
| | | AppUser appUser = appUserService.getById(id); |
| | | UserChangeLog userChangeLog = new UserChangeLog(); |
| | | userChangeLog.setDelFlag(0); |
| | | userChangeLog.setCreateTime(LocalDateTime.now()); |
| | | userChangeLog.setAppUserId(id); |
| | | userChangeLog.setBeforeVipId(appUser.getVipId()); |
| | | userChangeLog.setAfterVipId(appUser.getVipId() - 1); |
| | | userChangeLog.setChangeType(0); |
| | | userChangeLogService.save(userChangeLog); |
| | | appUser.setVipId(appUser.getVipId() - 1); |
| | | appUserService.updateById(appUser); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(userPoint.getPageNum(), userPoint.getPageSize()), userPoint); |
| | | return R.ok(userPointPage); |
| | | } |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | @GetMapping("/user/list") |
| | | @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台") |
| | |
| | | .orderByDesc(UserPoint::getCreateTime) |
| | | .page(Page.of(userPoint.getPageNum(), userPoint.getPageSize())); |
| | | for (UserPoint record : page.getRecords()) { |
| | | if (record.getType()==1 || record.getType()==11){ |
| | | Order data = orderClient.getOrderById(record.getObjectId()).getData(); |
| | | if (data!=null){ |
| | | record.setExtention(data.getOrderNumber()); |
| | | } |
| | | } |
| | | int i = record.getHistoricalPoint() - record.getBalance(); |
| | | if (i>0){ |
| | | record.setVariableType(2); |
| | |
| | | redisService.setCacheObject(smsCode.getPhone(), code, 300L, TimeUnit.SECONDS); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 注册账号 |
| | | * @param registerAccount |
| | |
| | | return walletStatistics; |
| | | } |
| | | |
| | | |
| | | Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | WalletStatisticsDetail::getChangeType, |
| | |
| | | BigDecimal totalShopWithdraw = shopCommissionMap.get(7); |
| | | |
| | | List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex); |
| | | |
| | | walletStatisticsDetailPage.setCurrent(current); |
| | | walletStatisticsDetailPage.setSize(size); |
| | | walletStatisticsDetailPage.setTotal(walletStatisticsDetailList.size()); |
| | | walletStatisticsDetailPage.setRecords(walletStatisticsDetailList2); |
| | | walletStatistics.setPage(walletStatisticsDetailPage); |
| | | walletStatistics.setTotalRecharge(totalRecharge); |
| | | walletStatistics.setTotalWithdraw(totalWithdraw); |
| | | walletStatistics.setTotalShopWithdraw(totalShopWithdraw); |
| | | for (WalletStatisticsDetail changeRecord : walletStatisticsDetailList2) { |
| | | if (changeRecord.getChangeType().equals(1) || changeRecord.getChangeType().equals(3) || changeRecord.getChangeType().equals(4) || changeRecord.getChangeType().equals(6)) { |
| | | changeRecord.setChangeAmountString("+¥" + changeRecord.getChangeAmount()); |
| | | } else { |
| | | changeRecord.setChangeAmountString("-¥" + changeRecord.getChangeAmount()); |
| | | } |
| | | walletStatisticsDetailPage.setCurrent(current); |
| | | walletStatisticsDetailPage.setSize(size); |
| | | walletStatisticsDetailPage.setTotal(walletStatisticsDetailList.size()); |
| | | walletStatisticsDetailPage.setRecords(walletStatisticsDetailList2); |
| | | walletStatistics.setPage(walletStatisticsDetailPage); |
| | | walletStatistics.setTotalRecharge(totalRecharge); |
| | | walletStatistics.setTotalWithdraw(totalWithdraw); |
| | | walletStatistics.setTotalShopWithdraw(totalShopWithdraw); |
| | | } |
| | | return walletStatistics; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); |
| | | Integer vipId = appUser.getVipId(); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(vipId); |
| | | BigDecimal withdrawableAmount = appUser.getWithdrawableAmount(); |
| | | |
| | | BigDecimal vipWithdrawalMinAmount = vipSetting.getVipWithdrawalMinAmount(); |
| | | if (vipWithdrawalMinAmount.compareTo(withdrawableAmount) > 0) { |
| | | throw new ServiceException("提现失败,提现门槛为:"+vipWithdrawalMinAmount+"元!"); |
| | | } |
| | | |
| | | if (appUser.getWithdrawableAmount().compareTo(withdrawalAmount) < 0) { |
| | | throw new ServiceException("提现失败,可提现金额不足!"); |
| | | } |
| | | |
| | | Integer vipId = appUser.getVipId(); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(vipId); |
| | | |
| | | if (vipSetting.getVipWithdrawalRole() == 0) { |
| | | throw new ServiceException("提现失败,当前会员等级不允许提现!"); |
| | | } |
| | | BigDecimal vipWithdrawalMinAmount = vipSetting.getVipWithdrawalMinAmount(); |
| | | if (withdrawalAmount.compareTo(vipWithdrawalMinAmount) < 0) { |
| | | throw new ServiceException("提现失败,提现金额不能小于" + vipWithdrawalMinAmount + "元!"); |
| | | } |
| | | |
| | | |
| | | // 提现手续费 |
| | | BigDecimal vipWithdrawalFee = vipSetting.getVipWithdrawalFee() |
| | | .divide(VIP_WITHDRAWAL_FEE_DENOMINATOR, 2, RoundingMode.HALF_UP); |
| | |
| | | withdrawalRequests.setAuditStatus(1); |
| | | save(withdrawalRequests); |
| | | //修改用户的可提现金额 |
| | | BigDecimal withdrawableAmount = appUser.getWithdrawableAmount(); |
| | | BigDecimal withdrawnAmount = appUser.getWithdrawnAmount(); |
| | | BigDecimal balance = appUser.getBalance(); |
| | | appUser.setWithdrawableAmount(withdrawableAmount.subtract(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | |
| | | * 变更数量 |
| | | */ |
| | | @ApiModelProperty(value = "变更数量") |
| | | @Excel(name = "变更数量") |
| | | private BigDecimal changeAmount; |
| | | /** |
| | | * 变更数量 |
| | | */ |
| | | @ApiModelProperty(value = "变更数量--带金额符号") |
| | | @Excel(name = "变更数量") |
| | | private String changeAmountString; |
| | | } |
| | |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>() |
| | | .ne(Order::getOrderStatus,5) |
| | | .eq(sysUser.getRoleType() == 2, Order::getShopId, sysUser.getObjectId()) |
| | | .between(Order::getCreateTime, LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))) |
| | | .orderByAsc(Order::getCreateTime)); |
| | |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }).reversed()) |
| | | })) |
| | | .collect(Collectors.toList()); |
| | | orderStatistics.setOrderStatisticsDetailList(sortedDetails); |
| | | } |
| | |
| | | * @param status 售后状态 |
| | | * @return |
| | | */ |
| | | List<OrderRefundPassList> getOrderRefundPassList(PageInfo<OrderRefundPassList> pageInfo, @Param("code") String code, @Param("appUserIds") List<Long> appUserIds, |
| | | List<OrderRefundPassList> getOrderRefundPassList(PageInfo<OrderRefundPassList> pageInfo, @Param("orderNumber") String orderNumber, @Param("appUserIds") List<Long> appUserIds, |
| | | @Param("shopId") Integer shopId, @Param("refundMethod") Integer refundMethod, |
| | | @Param("status") Integer status); |
| | | |
| | |
| | | } |
| | | List<Long> appUserIds = new ArrayList<>(); |
| | | //搜索条件,用户姓名 |
| | | if(StringUtils.isNotEmpty(refundPassListVo.getName())){ |
| | | List<AppUser> data = appUserClient.getAppUserByName(refundPassListVo.getName()).getData(); |
| | | if(StringUtils.isNotEmpty(refundPassListVo.getUserName())){ |
| | | List<AppUser> data = appUserClient.getAppUserByName(refundPassListVo.getUserName()).getData(); |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | appUserIds.add(-1L); |
| | | } |
| | | appUserIds.addAll(collect); |
| | | } |
| | | //搜索条件,用户电话 |
| | | if(StringUtils.isNotEmpty(refundPassListVo.getPhone())){ |
| | | List<AppUser> data = appUserClient.getAppUserByPhone(refundPassListVo.getPhone()).getData(); |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | appUserIds.add(-1L); |
| | | } |
| | | appUserIds.addAll(collect); |
| | | } |
| | | |
| | | PageInfo<OrderRefundPassList> pageInfo = new PageInfo(refundPassListVo.getPageCurr(), refundPassListVo.getPageSize()); |
| | | List<OrderRefundPassList> orderRefundPassList = this.baseMapper.getOrderRefundPassList(pageInfo, refundPassListVo.getCode(), appUserIds, shopId, refundPassListVo.getRefundMethod(), refundPassListVo.getStatus()); |
| | | for (OrderRefundPassList refundPassList : orderRefundPassList) { |
| | |
| | | return R.fail("操作失败"); |
| | | } |
| | | refundPass.setStatus(2); |
| | | refundPass.setReceiveTime(LocalDateTime.now()); |
| | | //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分 |
| | | Order order = orderService.getById(refundPass.getOrderId()); |
| | | order.setOrderStatus(6); |
| | |
| | | long goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid); |
| | | long count = count(new LambdaQueryWrapper<ShoppingCart>() |
| | | .eq(ShoppingCart::getGoodsId, shoppingCart.getGoodsId()) |
| | | .eq(ShoppingCart::getStatus,1) |
| | | .eq(ShoppingCart::getAppUserId, userid)); |
| | | goodsSaleNum += count; |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | |
| | | </select> |
| | | <select id="getOrderStatistics" resultType="com.ruoyi.order.vo.OrderStatistics"> |
| | | SELECT |
| | | SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 2 THEN 0 ELSE 1 END ) as total, |
| | | SUM( CASE WHEN tor.order_type = 1 THEN 1 ELSE 0 END ) as serviceTotal, |
| | | SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 1 THEN 1 ELSE 0 END ) as singleTotal, |
| | | SUM( CASE WHEN tor.order_status!=5 THEN 1 ELSE 0 END ) as total, |
| | | SUM( CASE WHEN tor.order_type = 1 and tor.order_status!=5 THEN 1 ELSE 0 END ) as serviceTotal, |
| | | SUM( CASE WHEN tor.order_type = 2 and tor.order_status!=5 THEN 1 ELSE 0 END ) as singleTotal, |
| | | SUM( tor.total_amount ) as totalMoney, |
| | | SUM( CASE WHEN tor.order_type = 1 THEN tor.total_amount ELSE 0 END ) as serviceTotalMoney, |
| | | SUM( CASE WHEN tor.order_type = 2 THEN tor.total_amount ELSE 0 END ) as singleTotalMoney |
| | | FROM |
| | | t_order tor where 1 = 1 |
| | | <if test="startTime != null and '' != startTime and endTime != null and '' != endTime"> |
| | | and tor.create_time between #{startTime} and #{endTime} |
| | | </if> |
| | | <if test="null != shopId"> |
| | | and tor.shop_id = #{shopId} |
| | | </if> |
| | | and tor.order_status!=5 |
| | | </select> |
| | | |
| | | |
| | |
| | | from t_refund_pass a |
| | | left join t_order b on (a.order_id = b.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != code and '' != code"> |
| | | and b.order_number like CONCAT('%', #{code}, '%') |
| | | <if test="null != orderNumber and '' != orderNumber"> |
| | | and b.order_number like CONCAT('%', #{orderNumber}, '%') |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and b.app_user_id in |
| | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | public R<TableDataInfo> list(Goods goods) |
| | | { |
| | | return R.ok(getDataTable(seckillActivityInfoService.listSeckillActivity(goods))); |
| | | return R.ok(seckillActivityInfoService.listSeckillActivity(goods)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | GoodsSeckill goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, one.getId()).eq(GoodsSeckill::getVip, info.getVip())); |
| | | if(null != goodsSeckill){ |
| | | goodsSeckill.setEndTime(one.getEndTime().toEpochSecond(ZoneOffset.UTC) * 1000); |
| | | LocalDateTime endTime = one.getEndTime(); |
| | | // 转时间戳 |
| | | long timeStamp = endTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); |
| | | goodsSeckill.setEndTime(timeStamp); |
| | | } |
| | | return R.ok(goodsSeckill); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // 创建 LocalDateTime 对象 |
| | | LocalDateTime localDateTime = LocalDateTime.of(2025, 1, 16, 9, 34, 55); |
| | | |
| | | // 转换为 UTC 时间戳(毫秒) |
| | | long l = localDateTime.toEpochSecond(ZoneOffset.UTC) * 1000; |
| | | System.out.println("UTC 时间戳: " + l); |
| | | |
| | | // 转换为 UTC+8 时间戳(毫秒) |
| | | long l2 = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); |
| | | System.out.println("UTC+8 时间戳: " + l2); |
| | | |
| | | // 将时间戳转换为 yyyy-MM-dd HH:mm:ss 格式的字符串 |
| | | String utcTime = formatTimestamp(l, ZoneOffset.UTC); |
| | | String utcPlus8Time = formatTimestamp(l2, ZoneOffset.of("+8")); |
| | | |
| | | System.out.println("UTC 时间: " + utcTime); |
| | | System.out.println("UTC+8 时间: " + utcPlus8Time); |
| | | } |
| | | |
| | | /** |
| | | * 将时间戳转换为指定时区的 yyyy-MM-dd HH:mm:ss 格式字符串 |
| | | * |
| | | * @param timestamp 时间戳(毫秒) |
| | | * @param zoneOffset 时区偏移量 |
| | | * @return 格式化后的时间字符串 |
| | | */ |
| | | private static String formatTimestamp(long timestamp, ZoneOffset zoneOffset) { |
| | | return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, zoneOffset) |
| | | .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取商品秒杀活动 |
| | |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(pageNum, pageSize), shopBalanceStatement); |
| | | return R.ok(shopCommissionStatisticsVO); |
| | | } |
| | | /** |
| | | * 导出门店分佣统计 |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiOperation("导出门店分佣统计") |
| | | public void export(HttpServletResponse response , ShopBalanceStatement shopBalanceStatement){ |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(1, Integer.MAX_VALUE), shopBalanceStatement); |
| | | IPage<ShopBalanceStatement> statementIPage = shopCommissionStatisticsVO.getStatementIPage(); |
| | | ExcelUtil<ShopBalanceStatement> util = new ExcelUtil<>(ShopBalanceStatement.class); |
| | | util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); |
| | | } |
| | | @GetMapping("/commissionStatistics/list") |
| | | @ApiOperation(value = "门店余额明细", notes = "门店余额明细", tags = {"门店后台"}) |
| | | public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出门店分佣统计 |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiOperation("导出门店分佣统计") |
| | | public void export(HttpServletResponse response , ShopBalanceStatement shopBalanceStatement){ |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(1, Integer.MAX_VALUE), shopBalanceStatement); |
| | | IPage<ShopBalanceStatement> statementIPage = shopCommissionStatisticsVO.getStatementIPage(); |
| | | ExcelUtil<ShopBalanceStatement> util = new ExcelUtil<>(ShopBalanceStatement.class); |
| | | util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.MD5Generator; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.vo.VerifiableShopVo; |
| | |
| | | user.setRoleType(2); |
| | | user.setObjectId(shopId); |
| | | user.setAppUserId(appUser.getId()); |
| | | user.setPassword(phone.substring(5)); |
| | | String s = MD5Generator.generateMD5(phone.substring(5)); |
| | | user.setPassword(s); |
| | | user.setCreateTime(new Date()); |
| | | Long userId = sysUserClient.saveShopUser(user).getData(); |
| | | |
| | |
| | | @GetMapping("/getDetailById") |
| | | @ApiOperation(value = "门店详情", tags = {"管理后台-门店管理"}) |
| | | public R<Shop> getDetailById(@RequestParam("id") Integer id){ |
| | | Shop byId = shopService.getById(id); |
| | | return R.ok(byId); |
| | | Shop shop = shopService.getById(id); |
| | | if (null != shop.getPid() && shop.getPid()==0){ |
| | | shop.setPid(null); |
| | | } |
| | | return R.ok(shop); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteShop") |
| | |
| | | userShop.setRoleType(1); |
| | | List<UserShop> data = userShopClient.getUserShop(userShop).getData(); |
| | | SysUser userData = sysUserClient.getSysUser(data.get(0).getUserId()).getData(); |
| | | userData.setPassword(userData.getPhonenumber().substring(5)); |
| | | String s = MD5Generator.generateMD5(userData.getPhonenumber().substring(5)); |
| | | userData.setPassword(s); |
| | | sysUserClient.resetPassword(userData); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | |
| | | */ |
| | | public interface SeckillActivityInfoService extends IService<SeckillActivityInfo> { |
| | | |
| | | List<SeckillActivityVO> listSeckillActivity(Goods goods); |
| | | TableDataInfo<SeckillActivityVO> listSeckillActivity(Goods goods); |
| | | |
| | | SeckillActivityDetailVO detail(Integer seckillActivityId, String latitude, String longitude); |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.utils.PageUtils; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.sql.SqlUtil; |
| | | import com.ruoyi.common.core.web.page.PageDomain; |
| | | import com.ruoyi.common.core.web.page.TableSupport; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.core.utils.PageUtils.startPage; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private GoodsEvaluateService goodsEvaluateService; |
| | | |
| | | @Override |
| | | public List<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | | public TableDataInfo<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | goods.setVipId(appUser.getVipId()); |
| | | |
| | | |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | Boolean reasonable = pageDomain.getReasonable(); |
| | | PageHelper.startPage(goods.getPageCurr(), goods.getPageSize(), goods.getOrderByColumn()).setReasonable(reasonable); |
| | | |
| | | List<SeckillActivityVO> seckillActivityVOS = seckillActivityInfoMapper.listSeckillActivity(goods); |
| | | for (SeckillActivityVO seckillActivityVO : seckillActivityVOS) { |
| | |
| | | seckillActivityVO.setStatus(1); // 未开始 |
| | | } |
| | | } |
| | | return seckillActivityVOS; |
| | | |
| | | Integer pageCurr = goods.getPageCurr(); |
| | | Integer pageSize = goods.getPageSize(); |
| | | String orderByColumn = goods.getOrderByColumn(); |
| | | String isAsc = goods.getIsAsc(); |
| | | // 排序 |
| | | Comparator<SeckillActivityVO> comparator = getComparator(orderByColumn, isAsc); |
| | | List<SeckillActivityVO> sortedList = seckillActivityVOS.stream() |
| | | .sorted(comparator) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 分页 |
| | | int startIndex = (pageCurr - 1) * pageSize; |
| | | int endIndex = Math.min(startIndex + pageSize, sortedList.size()); |
| | | |
| | | if (startIndex >= sortedList.size()) { |
| | | return new TableDataInfo(); |
| | | } |
| | | TableDataInfo tableDataInfo = new TableDataInfo(); |
| | | tableDataInfo.setRows(sortedList.subList(startIndex, endIndex)); |
| | | tableDataInfo.setTotal(sortedList.size()); |
| | | tableDataInfo.setCode(200); |
| | | return tableDataInfo; |
| | | } |
| | | |
| | | private Comparator<SeckillActivityVO> getComparator(String orderByColumn, String isAsc) { |
| | | Comparator<SeckillActivityVO> comparator; |
| | | |
| | | switch (orderByColumn) { |
| | | case "tgs.selling_price": |
| | | comparator = Comparator.comparing(SeckillActivityVO::getSellingPrice); |
| | | break; |
| | | case "integral": |
| | | comparator = Comparator.comparing(SeckillActivityVO::getIntegral); |
| | | break; |
| | | case "sale_num": |
| | | comparator = Comparator.comparing(SeckillActivityVO::getSaleNum); |
| | | break; |
| | | // 添加其他排序字段 |
| | | default: |
| | | comparator = Comparator.comparing(SeckillActivityVO::getId); // 默认按ID排序 |
| | | break; |
| | | } |
| | | |
| | | if ("desc".equalsIgnoreCase(isAsc)) { |
| | | comparator = comparator.reversed(); |
| | | } |
| | | return comparator; |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | |
| | | Integer sPoint = 0; |
| | | Integer shopCommissionPoint = 0; |
| | | Integer subShopCommissionPoint = 0; |
| | | Integer serverCommissionPoint = 0; |
| | | if (sysUser.getRoleType()==1){ |
| | | List<Shop> shopIds = shopService.lambdaQuery().eq(Shop::getDelFlag, 0).list(); |
| | | for (Shop shop : shopIds) { |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | if (StringUtils.isNotEmpty(shopPoint.getShopName())){ |
| | | |
| | | } |
| | | if (StringUtils.isNotEmpty(shopPoint.getShopLeaderName())){ |
| | | |
| | | } |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | for (ShopPoint record : shopPointIPage.getRecords()) { |
| | | switch (record.getType()){ |
| | | case 1: |
| | | sPoint += record.getVariablePoint(); |
| | | |
| | | break; |
| | | case 2: |
| | | shopCommissionPoint += record.getVariablePoint(); |
| | | |
| | | break; |
| | | case 3: |
| | | subShopCommissionPoint += record.getVariablePoint(); |
| | | |
| | | break; |
| | | case 4: |
| | | serverCommissionPoint+= record.getVariablePoint(); |
| | | break; |
| | | } |
| | | } |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint+serverCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | Integer serviceMode, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<TechnicianSubscribeVO> pageInfo = new PageInfo(pageCurr, pageSize); |
| | | List<TechnicianSubscribeVO> technicianSubscribeByUserAndShop1 = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop1(pageInfo, shopId, status, phone, name, serviceMode); |
| | | if (StringUtils.isNotEmpty(name)){ |
| | | List<AppUser> nameIds = appUserClient.getAppUserByName(name).getData(); |
| | | List<Long> collect = nameIds.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty())collect.add(-1L); |
| | | technicianSubscribeByUserAndShop1 = technicianSubscribeByUserAndShop1.stream().filter(e -> collect.contains(e.getAppUserId())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (StringUtils.isNotEmpty(phone)){ |
| | | List<AppUser> phoneIds = appUserClient.getAppUserByPhone(phone).getData(); |
| | | List<Long> collect = phoneIds.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty())collect.add(-1L); |
| | | technicianSubscribeByUserAndShop1 = technicianSubscribeByUserAndShop1.stream().filter(e -> collect.contains(e.getAppUserId())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | for (TechnicianSubscribeVO technicianSubscribeVO : technicianSubscribeByUserAndShop1) { |
| | | AppUser appUser = appUserClient.getAppUserById(technicianSubscribeVO.getAppUserId()); |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | if(appUser!=null){ |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | } |
| | | } |
| | | return pageInfo.setRecords(technicianSubscribeByUserAndShop1); |
| | | } |
| | |
| | | /** |
| | | * 预约状态:0=待服务,1=已服务,2=已取消 |
| | | */ |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 4 已到期") |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 3 已到期") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | |
| | | and ts.status = #{shop.status} |
| | | </if> |
| | | </where> |
| | | order by ts.create_time desc |
| | | order by ts.id desc |
| | | </select> |
| | | <select id="getShopStatistics" resultType="com.ruoyi.other.vo.ShopStatistics"> |
| | | SELECT |
| | |
| | | <if test="status != null"> |
| | | AND tts.status = #{status} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | AND tt.`name` LIKE concat('%', #{name}, '%') |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | AND tt.`phone` LIKE concat('%', #{phone}, '%') |
| | | </if> |
| | | |
| | | <if test="serviceMode != null"> |
| | | AND tts.service_mode = #{serviceMode} |
| | | </if> |
| | |
| | | tts.subscribe_time, |
| | | tts.service_mode, |
| | | CASE |
| | | WHEN tts.subscribe_time <![CDATA[<]]> NOW() THEN 4 |
| | | WHEN tts.subscribe_time <![CDATA[<]]> NOW() THEN 3 |
| | | ELSE tts.status |
| | | END AS status |
| | | FROM |