Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng
| | |
| | | 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("use_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime useTime; |
| | | |
| | | @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") |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Order>> byUserId(Long appUserId) { |
| | | public R<List<Order>> byUserId(Long appUserId,Integer shopId) { |
| | | return R.fail(); |
| | | } |
| | | |
| | |
| | | public R<List<Order>> byShopId(Integer shopId) { |
| | | return R.fail(); |
| | | } |
| | | @Override |
| | | public R<List<Order>> byShopIdAndUserId(Long userId,Integer shopId) { |
| | | return R.fail("通过门店和用户id查询订单失败"); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | R<List<Order>> getOrderListByIds(@RequestBody List<Long> orderIds); |
| | | |
| | | @PostMapping("/order/byUserId") |
| | | R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId); |
| | | R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId); |
| | | @PostMapping("/order/byShopId") |
| | | R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId); |
| | | @PostMapping("/order/byShopIdAndUserId") |
| | | R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId); |
| | | |
| | | |
| | | /** |
| | |
| | | @TableField("auth_time") |
| | | private LocalDateTime authTime; |
| | | |
| | | @ApiModelProperty(value = "平台收货时间") |
| | | private LocalDateTime receiveTime; |
| | | |
| | | @ApiModelProperty(value = "后台审核备注") |
| | | @TableField("pass_remark") |
| | | private String passRemark; |
| | |
| | | */ |
| | | @TableField(exist = false) |
| | | private String isAsc; |
| | | @TableField(exist = false) |
| | | private Integer pageNum; |
| | | @TableField(exist = false) |
| | | private Integer pageSize; |
| | | |
| | | |
| | | public String getIdStr() { |
| | |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.factory.StoreFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | */ |
| | | @FeignClient(contextId = "StoreClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = StoreFallbackFactory.class) |
| | | public interface StoreClient { |
| | | @PostMapping(value = "/shop/getDetailById") |
| | | @GetMapping(value = "/shop/getDetailById") |
| | | R<Shop> getStoreById(@RequestParam("id") Integer id); |
| | | |
| | | |
| | |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | </dependency> |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | |
| | | package com.ruoyi.auth.service; |
| | | |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.system.api.RemoteUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | /** |
| | | * 登录 |
| | | */ |
| | |
| | | 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("您所属门店已被冻结,请联系平台"); |
| | | throw new ServiceException("您的账号已被禁用,请联系平台"); |
| | | } |
| | | // passwordService.validate(user, password, request); |
| | | if (user.getRoleType()==2){ |
| | | Shop data = shopClient.getShopById(user.getObjectId()).getData(); |
| | | if (data==null){ |
| | | throw new ServiceException("门店不存在"); |
| | | }else{ |
| | | if (data.getStatus()==2){ |
| | | throw new ServiceException("您的账号已被禁用,请联系平台"); |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | public void setPageCurr(Integer pageCurr){ |
| | | this.pageNum = pageCurr; |
| | | } |
| | | |
| | | public Integer getPageSize() |
| | | { |
| | | return pageSize; |
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")); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | |
| | | 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("未查询到该账号"); |
| | | } |
| | | String password = user.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | |
| | | { |
| | | 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(); |
| | |
| | | public AjaxResult list() { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, 0).eq(SysRole::getStatus, 0); |
| | | LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>() |
| | | .ne(SysRole::getRoleId, 2) |
| | | .eq(SysRole::getDelFlag, 0) |
| | | .eq(SysRole::getStatus, 0); |
| | | if(sysUser.getRoleType() == 2){ |
| | | wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); |
| | | } |
| | |
| | | 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) { |
| | |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | userService.deleteUserByIds(userIds); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | |
| | | 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删除用户 |
| | |
| | | * @param userIds 需要删除的用户ID |
| | | * @return 结果 |
| | | */ |
| | | int deleteUserByIds(Long[] userIds); |
| | | void deleteUserByIds(Long[] userIds); |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户角色信息 |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteUserByIds(Long[] userIds) { |
| | | public void deleteUserByIds(Long[] userIds) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = this.getById(userid); |
| | | for (Long userId : userIds) { |
| | |
| | | userMapper.deleteUserById(user.getUserId()); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | </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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.model.AgentApplication; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | |
| | | import com.ruoyi.account.service.AgentApplicationService; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserChangeLogService; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | import com.ruoyi.other.api.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; |
| | |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | @Resource |
| | | private VipCenterService vipCenterService; |
| | | |
| | | @PostMapping("/apply") |
| | | @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) |
| | |
| | | @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; |
| | |
| | | userChangeLogService.save(userChangeLog); |
| | | //变更会员等级 |
| | | byId1.setVipId(byId.getApplicationVipId()); |
| | | appUserService.updateById(byId1); |
| | | |
| | | // 当用户为合伙人时,计算合伙人积分和培育积分 |
| | | Integer vipId = byId1.getVipId(); |
| | | if (vipId == 7){ |
| | | R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data = baseSetting.getData(); |
| | | int basePoint = Integer.parseInt(data.getContent()); |
| | | // 当前用户计算合伙人积分 |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId); |
| | | setPoint(vipSetting, byId1, byId1.getShopPoint(), byId1.getSharePoint()); |
| | | Integer point = getPoint(vipSetting, byId1, basePoint); |
| | | byId1.setPartPoint(point); |
| | | // 上级计算培育积分 |
| | | R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data2 = baseSetting2.getData(); |
| | | int basePoint2 = Integer.parseInt(data2.getContent()); |
| | | Long inviteUserId = byId1.getInviteUserId(); |
| | | AppUser byId2 = appUserService.getById(inviteUserId); |
| | | if (byId2 != null){ |
| | | setPoint(vipSetting, byId2, byId1.getShopPoint(), byId1.getSharePoint()); |
| | | Integer point1 = getPoint(vipSetting, byId2, basePoint2); |
| | | byId2.setPartGrowPoint(point1); |
| | | } |
| | | } |
| | | |
| | | appUserService.updateById(byId1); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | private void setPoint(R<VipSetting> vipSetting, AppUser appUser, Integer shopPoint, Integer sharePoint) { |
| | | private Integer getPoint(R<VipSetting> vipSetting, AppUser appUser, Integer basePoint) { |
| | | VipSetting vipSettingData = vipSetting.getData(); |
| | | Integer vipLevelUpShopRole = vipSettingData.getVipLevelUpShopRole(); |
| | | int i = 1; |
| | | if (vipLevelUpShopRole == 1){ |
| | | Integer vipLevelUpShop = vipSettingData.getVipLevelUpShop(); |
| | | Integer vipLevelUpShare = vipSettingData.getVipLevelUpShare(); |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare) { |
| | | R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data = baseSetting.getData(); |
| | | if (data != null){ |
| | | appUser.setPartPoint(Integer.parseInt(data.getContent())); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | } |
| | | i += 1; |
| | | } |
| | | Integer vipLevelUpNumRole = vipSettingData.getVipLevelUpNumRole(); |
| | | if (vipLevelUpNumRole == 1){ |
| | | i += 1; |
| | | } |
| | | |
| | | |
| | | if (vipCenterService.checkReadyToBePartner(appUser.getId())){ |
| | | return basePoint * i; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | 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> |
| | |
| | | VipSetting data = vipSetting.getData(); |
| | | DangerInfoDto dangerInfoDto = new DangerInfoDto(); |
| | | BeanUtils.copyProperties(data, dangerInfoDto); |
| | | List<UserPoint> list1 = userPointService.lambdaQuery().eq(UserPoint::getType, 1).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getType, 2).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getType, 5).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list1 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 1).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 9).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 8).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | Integer userKeepBuyPoint = 0; |
| | | for (UserPoint userPoint : list1) { |
| | | userKeepBuyPoint = userPoint.getVariablePoint() + userKeepBuyPoint; |
| | |
| | | @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(); |
| | | } |
| | | |
| | |
| | | List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); |
| | | byId.setBottomUsers(list); |
| | | //消费总金额 |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopId(sysUser.getObjectId()); |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopIdAndUserId(id,byId.getShopId()); |
| | | List<Order> orderList = orderR.getData(); |
| | | if (!CollectionUtils.isEmpty(orderList)){ |
| | | BigDecimal paymentAmount = orderList.stream().map(Order::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | |
| | | @GetMapping("/orders") |
| | | @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) |
| | | public R<List<Order>> orders(Long id) { |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | Integer shopId = sysUser.getObjectId(); |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId); |
| | | return R.ok(listR.getData()); |
| | | |
| | | } |
| | |
| | | }); |
| | | |
| | | |
| | | R<Map<String, BigDecimal>> shopStatistics = shopClient.getShopStatistics(); |
| | | Map<String, BigDecimal> data = shopStatistics.getData(); |
| | | BigDecimal totalServiceFee = BigDecimal.ZERO; |
| | | BigDecimal totalUserCommission = BigDecimal.ZERO; |
| | | if (data != null){ |
| | | totalServiceFee = data.get("serverGiveawayMoney"); |
| | | totalUserCommission = data.get("lowerLevelGiveawayMoney"); |
| | | } |
| | | |
| | | BigDecimal totalCommission = BigDecimal.ZERO; |
| | | BigDecimal totalNormalCommission = BigDecimal.ZERO; |
| | | |
| | |
| | | |
| | | BigDecimal totalPartnerCommission = BigDecimal.ZERO; |
| | | |
| | | List<AppUser> allAppUserList = appUserService.list(); |
| | | for (AppUser appUser : allAppUserList) { |
| | | BigDecimal totalDistributionAmount = appUser.getTotalDistributionAmount(); |
| | | totalCommission = totalCommission.add(totalDistributionAmount); |
| | | if (appUser.getVipId() == 1){ |
| | | totalNormalCommission = totalNormalCommission.add(totalDistributionAmount); |
| | | } |
| | | if (appUser.getVipId() == 2){ |
| | | totalGoldCommission = totalGoldCommission.add(totalDistributionAmount); |
| | | } |
| | | if (appUser.getVipId() == 3){ |
| | | totalDiamondCommission = totalDiamondCommission.add(totalDistributionAmount); |
| | | } |
| | | if (appUser.getVipId() == 4){ |
| | | totalAgentCommission = totalAgentCommission.add(totalDistributionAmount); |
| | | } |
| | | if (appUser.getVipId() == 5){ |
| | | totalSuperAgentCommission = totalSuperAgentCommission.add(totalDistributionAmount); |
| | | } |
| | | if (appUser.getVipId() == 6){ |
| | | totalTopAgentCommission = totalTopAgentCommission.add(totalDistributionAmount); |
| | | } |
| | | if (appUser.getVipId() == 7){ |
| | | totalPartnerCommission = totalPartnerCommission.add(totalDistributionAmount); |
| | | } |
| | | Set<String> keySet = dailyVipCommissions.keySet(); |
| | | List<CommissionDate> commissionDateList = new ArrayList<>(); |
| | | for (String key : keySet) { |
| | | CommissionDate commissionDate = new CommissionDate(); |
| | | commissionDate.setDate(key); |
| | | Map<Integer, BigDecimal> dailyCommissions = dailyVipCommissions.get(key); |
| | | commissionDate.setNormalCommission(dailyCommissions.getOrDefault(1, BigDecimal.ZERO)); |
| | | totalNormalCommission = totalNormalCommission.add(dailyCommissions.getOrDefault(1, BigDecimal.ZERO)); |
| | | |
| | | commissionDate.setGoldCommission(dailyCommissions.getOrDefault(2, BigDecimal.ZERO)); |
| | | totalGoldCommission = totalGoldCommission.add(dailyCommissions.getOrDefault(2, BigDecimal.ZERO)); |
| | | |
| | | commissionDate.setDiamondCommission(dailyCommissions.getOrDefault(3, BigDecimal.ZERO)); |
| | | totalDiamondCommission = totalDiamondCommission.add(dailyCommissions.getOrDefault(3, BigDecimal.ZERO)); |
| | | |
| | | commissionDate.setAgentCommission(dailyCommissions.getOrDefault(4, BigDecimal.ZERO)); |
| | | totalAgentCommission = totalAgentCommission.add(dailyCommissions.getOrDefault(4, BigDecimal.ZERO)); |
| | | |
| | | commissionDate.setSuperAgentCommission(dailyCommissions.getOrDefault(5, BigDecimal.ZERO)); |
| | | totalSuperAgentCommission = totalSuperAgentCommission.add(dailyCommissions.getOrDefault(5, BigDecimal.ZERO)); |
| | | |
| | | commissionDate.setTopAgentCommission(dailyCommissions.getOrDefault(6, BigDecimal.ZERO)); |
| | | totalTopAgentCommission = totalTopAgentCommission.add(dailyCommissions.getOrDefault(6, BigDecimal.ZERO)); |
| | | |
| | | commissionDate.setPartnerCommission(dailyCommissions.getOrDefault(7, BigDecimal.ZERO)); |
| | | totalPartnerCommission = totalPartnerCommission.add(dailyCommissions.getOrDefault(7, BigDecimal.ZERO)); |
| | | |
| | | // 用户分销总金额 |
| | | |
| | | BigDecimal add = commissionDate.getNormalCommission().add(commissionDate.getGoldCommission()).add(commissionDate.getDiamondCommission()).add(commissionDate.getAgentCommission()) |
| | | .add(commissionDate.getSuperAgentCommission()).add(commissionDate.getTopAgentCommission()).add(commissionDate.getPartnerCommission()); |
| | | commissionDate.setTotalCommission(add); |
| | | |
| | | commissionDate.setServiceChargeCommission(dailyCommissions.getOrDefault(10, BigDecimal.ZERO)); |
| | | commissionDate.setAssociatedUserCommission(dailyCommissions.getOrDefault(8, BigDecimal.ZERO)); |
| | | commissionDate.setBindLowerLevelStoresCommission(dailyCommissions.getOrDefault(9, BigDecimal.ZERO)); |
| | | commissionDateList.add(commissionDate); |
| | | } |
| | | |
| | | R<Map<String, BigDecimal>> shopStatistics = shopClient.getShopStatistics(); |
| | | Map<String, BigDecimal> data = shopStatistics.getData(); |
| | | BigDecimal totalServiceFee = BigDecimal.ZERO; |
| | | BigDecimal totalUserCommission = BigDecimal.ZERO; |
| | | if (data != null){ |
| | | totalServiceFee = data.get("serverGiveawayMoney"); |
| | | totalUserCommission = data.get("lowerLevelGiveawayMoney"); |
| | | } |
| | | |
| | | |
| | | CommissionDetail commissionDetail = new CommissionDetail(); |
| | | commissionDetail.setTotalCommission(totalCommission); |
| | | commissionDetail.setTotalServiceFee(totalServiceFee); |
| | | commissionDetail.setTotalUserCommission(totalUserCommission); |
| | | |
| | | commissionDetail.setTotalNormalCommission(totalNormalCommission); |
| | | commissionDetail.setTotalGoldCommission(totalGoldCommission); |
| | | commissionDetail.setTotalDiamondCommission(totalDiamondCommission); |
| | |
| | | commissionDetail.setTotalSuperAgentCommission(totalSuperAgentCommission); |
| | | commissionDetail.setTotalTopAgentCommission(totalTopAgentCommission); |
| | | commissionDetail.setTotalPartnerCommission(totalPartnerCommission); |
| | | |
| | | |
| | | List<CommissionDate> commissionDateList = dailyVipCommissions.entrySet().stream() |
| | | .map(entry -> { |
| | | CommissionDate commissionDate = new CommissionDate(); |
| | | commissionDate.setDate(entry.getKey()); |
| | | Map<Integer, BigDecimal> dailyCommissions = entry.getValue(); |
| | | commissionDate.setNormalCommission(dailyCommissions.getOrDefault(1, BigDecimal.ZERO)); |
| | | commissionDate.setGoldCommission(dailyCommissions.getOrDefault(2, BigDecimal.ZERO)); |
| | | commissionDate.setDiamondCommission(dailyCommissions.getOrDefault(3, BigDecimal.ZERO)); |
| | | commissionDate.setAgentCommission(dailyCommissions.getOrDefault(4, BigDecimal.ZERO)); |
| | | commissionDate.setSuperAgentCommission(dailyCommissions.getOrDefault(5, BigDecimal.ZERO)); |
| | | commissionDate.setTopAgentCommission(dailyCommissions.getOrDefault(6, BigDecimal.ZERO)); |
| | | commissionDate.setPartnerCommission(dailyCommissions.getOrDefault(7, BigDecimal.ZERO)); |
| | | BigDecimal add = commissionDate.getNormalCommission().add(commissionDate.getGoldCommission()).add(commissionDate.getDiamondCommission()).add(commissionDate.getAgentCommission()) |
| | | .add(commissionDate.getSuperAgentCommission()).add(commissionDate.getTopAgentCommission()).add(commissionDate.getPartnerCommission()); |
| | | commissionDate.setTotalCommission(add); |
| | | |
| | | commissionDate.setServiceChargeCommission(dailyCommissions.getOrDefault(10, BigDecimal.ZERO)); |
| | | commissionDate.setAssociatedUserCommission(dailyCommissions.getOrDefault(8, BigDecimal.ZERO)); |
| | | commissionDate.setBindLowerLevelStoresCommission(dailyCommissions.getOrDefault(9, BigDecimal.ZERO)); |
| | | return commissionDate; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | totalCommission = totalNormalCommission.add(totalGoldCommission).add(totalDiamondCommission).add(totalAgentCommission) |
| | | .add(totalSuperAgentCommission).add(totalTopAgentCommission).add(totalPartnerCommission); |
| | | commissionDetail.setTotalCommission(totalCommission); |
| | | commissionDetail.setCommissionDateList(commissionDateList); |
| | | |
| | | return R.ok(commissionDetail); |
| | |
| | | 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); |
| | |
| | | orderList.stream().filter(o -> o.getId().equals(bc.getOrderId())).findFirst().ifPresent(o -> { |
| | | Long appUserId = o.getAppUserId(); |
| | | AppUser appUser = appUserService.getById(appUserId); |
| | | bc.setUserName(appUser.getName()); |
| | | bc.setAmount(o.getPaymentAmount()); |
| | | if(null != appUser){ |
| | | bc.setUserName(appUser.getName()); |
| | | bc.setAmount(o.getPaymentAmount()); |
| | | } |
| | | }); |
| | | |
| | | BigDecimal beforeAmount = bc.getBeforeAmount(); |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | // 获取用户直推代理用户数量 |
| | | List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .in(AppUser::getId, userShopList) |
| | | .eq(AppUser::getVipId, 5)); |
| | | .gt(AppUser::getVipId, 4)); |
| | | |
| | | // 代理下的准代理数量 |
| | | List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | |
| | | |
| | | 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; |
| | | } |
| | |
| | | |
| | | |
| | | @PostMapping("/byUserId") |
| | | public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId){ |
| | | return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).list()); |
| | | public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){ |
| | | List<Order> list = orderService.lambdaQuery() |
| | | .eq(Order::getAppUserId, appUserId) |
| | | .eq(Order::getShopId, shopId) |
| | | .eq(Order::getDistributionMode, 1) |
| | | .ne(Order::getOrderStatus,5).list(); |
| | | return R.ok(list); |
| | | } |
| | | @PostMapping("/byShopId") |
| | | public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){ |
| | | return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).list()); |
| | | } |
| | | @PostMapping("/byShopIdAndUserId") |
| | | public R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){ |
| | | List<Order> list = orderService.lambdaQuery().isNotNull(Order::getEndTime) |
| | | .eq(Order::getShopId, shopId) |
| | | .eq(Order::getAppUserId, appUserId) |
| | | .in(Order::getOrderStatus, 4, 7, 8).list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | |
| | | 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)); |
| | |
| | | for (Order order : value) { |
| | | if (order.getOrderType().equals(1)) { |
| | | serviceTotal++; |
| | | serviceTotalMoney = serviceTotalMoney.add(order.getPaymentAmount()); |
| | | serviceTotalMoney = serviceTotalMoney.add(order.getTotalAmount()); |
| | | total++; |
| | | totalMoney = totalMoney.add(order.getPaymentAmount()); |
| | | }else if (order.getOrderType().equals(2) && 1 == order.getDistributionMode()){ |
| | | totalMoney = totalMoney.add(order.getTotalAmount()); |
| | | }else if (order.getOrderType().equals(2)){ |
| | | singleTotal++; |
| | | singleTotalMoney = singleTotalMoney.add(order.getPaymentAmount()); |
| | | singleTotalMoney = singleTotalMoney.add(order.getTotalAmount()); |
| | | total++; |
| | | totalMoney = totalMoney.add(order.getPaymentAmount()); |
| | | totalMoney = totalMoney.add(order.getTotalAmount()); |
| | | } |
| | | } |
| | | orderStatisticsDetail.setDate(key); |
| | |
| | | } 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); |
| | | |
| | |
| | | BigDecimal balance = appUser.getBalance(); |
| | | if(null != orderBalancePayment){ |
| | | appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | // appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | appUser.setBalance(balance.add(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setShopAmount(appUser.getShopAmount().subtract(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | |
| | | BigDecimal balance = appUser.getBalance(); |
| | | if(null != orderBalancePayment){ |
| | | appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | // appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | appUser.setBalance(balance.add(expressAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | //构建账户余额流水明细 |
| | |
| | | } |
| | | 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); |
| | |
| | | info.setVip(appUser.getVipId()); |
| | | GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); |
| | | //没有秒杀活动或者添加的普通商品则不使用秒杀活动价格 |
| | | if((null == goodsSeckill || (null != goodsSeckill.getCashPayment() && null != goodsSeckill.getPointPayment())) || type == 1){ |
| | | if((null == goodsSeckill || (null == goodsSeckill.getCashPayment() && null == goodsSeckill.getPointPayment())) || type == 1){ |
| | | //没有秒杀价,则判断门店特价 |
| | | GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice(); |
| | | goodsBargainPrice.setGoodsId(goodsId); |
| | |
| | | @Override |
| | | public Long addGoods(ShoppingCart shoppingCart) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid); |
| | | 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(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + shoppingCart.getNumber()) > goods.getPurchaseLimit()){ |
| | | throw new ServiceException("超出购买数量限制"); |
| | |
| | | */ |
| | | @Override |
| | | public R setGoodsNumber(SetGoodsNumber setGoodsNumber) { |
| | | |
| | | ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId()); |
| | | if(0 >= setGoodsNumber.getNumber()){ |
| | | return R.fail("修改数量不能小于等于0"); |
| | | } |
| | | ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId()); |
| | | |
| | | if(null != shoppingCart){ |
| | | |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && goods.getPurchaseLimit() < setGoodsNumber.getNumber()){ |
| | | Goods goods1 = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods1.getPurchaseLimit() && -1 != goods1.getPurchaseLimit() && goods1.getPurchaseLimit() < setGoodsNumber.getNumber()){ |
| | | return R.fail("修改数量不能大于限购数量"); |
| | | } |
| | | |
| | |
| | | totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney1); |
| | | balance = balance.subtract(paymentMoney1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = paymentMoney1; |
| | | }else{ |
| | |
| | | totalDistributionAmount = BigDecimal.ZERO; |
| | | balance = balance.subtract(paymentMoney1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = totalDistributionAmount; |
| | | } |
| | |
| | | totalDistributionAmount = totalDistributionAmount.subtract(expressFee1); |
| | | balance = balance.subtract(expressFee1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = expressFee1; |
| | | }else{ |
| | |
| | | totalDistributionAmount = BigDecimal.ZERO; |
| | | balance = balance.subtract(expressFee1); |
| | | appUser.setTotalRedPacketAmount(totalRedPacketAmount); |
| | | appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | // appUser.setTotalDistributionAmount(totalDistributionAmount); |
| | | appUser.setBalance(balance); |
| | | distributionAmount = totalDistributionAmount; |
| | | } |
| | |
| | | </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 |
| | | SUM( CASE WHEN tor.order_type = 1 and tor.order_status!=5 THEN tor.total_amount ELSE 0 END ) as serviceTotalMoney, |
| | | SUM( CASE WHEN tor.order_type = 2 and tor.order_status!=5 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 |
| | |
| | | //秒杀活动 |
| | | if(null != jumpType1 && 4 == jumpType1){ |
| | | SeckillActivityInfo activityInfo = seckillActivityInfoService.getById(banner.getContent()); |
| | | if(null == activityInfo || activityInfo.getDelFlag() == 1){ |
| | | if(null == activityInfo || activityInfo.getDelFlag() == 1 || !activityInfo.getVipIds().contains(vipId.toString())){ |
| | | banner.setJumpType(1); |
| | | } |
| | | if(!activityInfo.getVipIds().contains(vipId.toString())){ |
| | | banner.setJumpType(1); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return R.ok(list); |
| | |
| | | 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) |
| | | { |
| | | startPage(); |
| | | 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.extension.service.impl.ServiceImpl; |
| | | 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.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | |
| | | 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()); |
| | | |
| | | List<SeckillActivityVO> seckillActivityVOS = seckillActivityInfoMapper.listSeckillActivity(goods); |
| | | for (SeckillActivityVO seckillActivityVO : seckillActivityVOS) { |
| | | Integer data = orderClient.getGoodsSaleNum(seckillActivityVO.getGoodsId(), 2).getData(); |
| | |
| | | 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; |
| | | Shop shop = shopService.getById(sysUser.getObjectId()); |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | Integer serverCommissionPoint = 0; |
| | | if (sysUser.getRoleType()==1){ |
| | | if (StringUtils.isNotEmpty(shopPoint.getShopName())){ |
| | | |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | if (StringUtils.isNotEmpty(shopPoint.getShopLeaderName())){ |
| | | |
| | | } |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | 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){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | } |
| | | return shopPointStatistics; |
| | | }else{ |
| | | Shop shop = shopService.getById(sysUser.getObjectId()); |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | 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); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | } |
| | | return shopPointStatistics; |
| | | } |
| | | return shopPointStatistics; |
| | | } |
| | | } |
| | |
| | | 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> |
| | |
| | | String id = technicianSubscribeVO.getId(); |
| | | TechnicianSubscribe technicianSubscribe = this.getById(id); |
| | | AppUser appUser = appUserClient.getAppUserById(technicianSubscribe.getAppUserId()); |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | if(null != appUser){ |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | } |
| | | Integer serviceMode = technicianSubscribeVO.getServiceMode(); |
| | | if(1 == serviceMode){ |
| | | UserAddress userAddress = JSON.parseObject(technicianSubscribeVO.getUserAddress(), UserAddress.class); |
| | |
| | | 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); |
| | | } |
| | | @Override |
| | | public IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status) { |
| | | return technicianSubscribeMapper.getTechnicianSubscribeByUser(page, userId, status); |
| | | IPage<TechnicianSubscribeVO> technicianSubscribeByUser = technicianSubscribeMapper.getTechnicianSubscribeByUser(page, userId, status); |
| | | technicianSubscribeByUser.getRecords().forEach(technicianSubscribeVO -> { |
| | | UserAddress userAddress = JSON.parseObject(technicianSubscribeVO.getUserAddress(), UserAddress.class); |
| | | if (userAddress != null){ |
| | | technicianSubscribeVO.setUserAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); |
| | | } |
| | | }); |
| | | return technicianSubscribeByUser; |
| | | } |
| | | |
| | | @Override |
| | |
| | | /** |
| | | * 预约状态:0=待服务,1=已服务,2=已取消 |
| | | */ |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 4 已到期") |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 3 已到期") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | |
| | | <if test="vipId == null"> |
| | | AND tgs.vip in (0, -1) |
| | | </if> |
| | | order by tsai.create_time desc |
| | | </select> |
| | | <select id="selectDetail" resultType="com.ruoyi.other.vo.SeckillActivityDetailVO"> |
| | | SELECT |
| | |
| | | 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 |
| | |
| | | AVG( IFNULL(ttsc.score,0) ) AS score |
| | | FROM |
| | | t_technician tt |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id and tts.`status` != 0 |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id |
| | | LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id |
| | | WHERE |
| | | tt.`status` = 2 |
| | |
| | | <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 |