From 9fde9f917552f659d41fcfce5094f429a29b8ead Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 16 一月 2025 16:26:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java | 39 +++- ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java | 65 +++++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 14 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java | 3 ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java | 9 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java | 10 + ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java | 12 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java | 22 ++ ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java | 1 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java | 3 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java | 26 +- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java | 19 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java | 41 ++++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java | 3 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 4 ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java | 23 +- ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml | 5 ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java | 32 +++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java | 26 ++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 1 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 12 + ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java | 2 ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/PageUtils.java | 7 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/SeckillActivityInfoService.java | 3 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java | 18 + ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java | 1 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 45 +--- ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml | 4 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml | 9 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 4 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml | 10 37 files changed, 366 insertions(+), 124 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java index f493dbb..93c1763 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserCoupon.java @@ -4,6 +4,7 @@ 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; @@ -53,10 +54,12 @@ @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") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java index 0ef8657..ad16c18 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java @@ -63,6 +63,9 @@ @TableField("auth_time") private LocalDateTime authTime; + @ApiModelProperty(value = "平台收货时间") + private LocalDateTime receiveTime; + @ApiModelProperty(value = "后台审核备注") @TableField("pass_remark") private String passRemark; diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java index f2fc1f3..b41500b 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java @@ -93,7 +93,7 @@ // 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; } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/PageUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/PageUtils.java index 95ee25b..3ad88f4 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/PageUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/PageUtils.java @@ -25,6 +25,13 @@ 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); + } + /** * 清理分页的线程变量 */ diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java index 2f3df05..0c3c2b2 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java @@ -38,6 +38,8 @@ return pageNum; } + + public void setPageNum(Integer pageNum) { this.pageNum = pageNum; diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java new file mode 100644 index 0000000..a7de5d6 --- /dev/null +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/MD5Generator.java @@ -0,0 +1,32 @@ +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)); + } +} \ No newline at end of file diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java index e1ab22b..9ff04a5 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java @@ -117,8 +117,11 @@ 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")); } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java index 76e191a..6397d3e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java @@ -107,7 +107,12 @@ 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("未查询到该账号"); @@ -121,8 +126,15 @@ { 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(); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index 9bdfae7..502eb1f 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -16,6 +16,7 @@ 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; @@ -148,7 +149,8 @@ .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){ @@ -192,7 +194,8 @@ } }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(); @@ -290,6 +293,8 @@ 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) { @@ -486,7 +491,8 @@ 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)); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java index acb3306..04dcba3 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java @@ -13,4 +13,6 @@ private String newPassword; private String oldPassword; + // 1平台 2门店 + private Integer type; } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index 1e31dc7..e773b0e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -91,6 +91,7 @@ * @return 结果 */ int resetUserPwd(@Param("userName") String userName, @Param("password") String password); + int resetUserShopPwd(@Param("userName") String userName, @Param("password") String password); /** * 通过用户ID删除用户 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index 5e980b4..f69a56a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -184,6 +184,7 @@ * @return 结果 */ int resetUserPwd(String userName, String password); + int resetUserShopPwd(String userName, String password); /** * 通过用户ID删除用户 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index c1a051d..0d15ced 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -372,6 +372,10 @@ 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); + } /** * 新增用户角色信息 diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml index 8aa82dc..fc40357 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml @@ -268,7 +268,10 @@ </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"> diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java index 8483e72..f50b3e3 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java @@ -1,5 +1,6 @@ package com.ruoyi.account.controller; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -24,6 +25,7 @@ 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; @@ -73,12 +75,36 @@ @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; diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index d181d19..1d148ba 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -3,27 +3,19 @@ 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; @@ -31,7 +23,6 @@ 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; @@ -39,13 +30,9 @@ 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; @@ -57,12 +44,6 @@ 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> @@ -574,9 +555,17 @@ @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(); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java index 33f4f12..491ed1a 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java @@ -18,6 +18,8 @@ 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; @@ -130,6 +132,8 @@ 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 = "后台") @@ -140,6 +144,12 @@ .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); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java index 7567718..899ca9e 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java @@ -247,8 +247,8 @@ redisService.setCacheObject(smsCode.getPhone(), code, 300L, TimeUnit.SECONDS); return R.ok(); } - - + + /** * 注册账号 * @param registerAccount diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java index 0198cd8..0baa978 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java @@ -103,6 +103,7 @@ return walletStatistics; } + Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream() .collect(Collectors.groupingBy( WalletStatisticsDetail::getChangeType, @@ -118,16 +119,21 @@ 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; } - } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java index 94ee314..5dc7b75 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java @@ -59,20 +59,24 @@ 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); @@ -98,7 +102,6 @@ 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)); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java index b319a8a..5a9932c 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java @@ -43,6 +43,11 @@ * 变更数量 */ @ApiModelProperty(value = "变更数量") - @Excel(name = "变更数量") private BigDecimal changeAmount; + /** + * 变更数量 + */ + @ApiModelProperty(value = "变更数量--带金额符号") + @Excel(name = "变更数量") + private String changeAmountString; } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java index 349856a..a1e1094 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java @@ -302,6 +302,7 @@ 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)); @@ -360,7 +361,7 @@ } catch (ParseException e) { throw new RuntimeException(e); } - }).reversed()) + })) .collect(Collectors.toList()); orderStatistics.setOrderStatisticsDetailList(sortedDetails); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java index 47acb4f..6733ad4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java @@ -27,7 +27,7 @@ * @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); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java index a5b2e91..f831e2c 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java @@ -131,17 +131,24 @@ } 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) { @@ -212,6 +219,7 @@ return R.fail("操作失败"); } refundPass.setStatus(2); + refundPass.setReceiveTime(LocalDateTime.now()); //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分 Order order = orderService.getById(refundPass.getOrderId()); order.setOrderStatus(6); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index 5d23be9..aeee681 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -333,6 +333,7 @@ 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(); diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml index 34fa450..8038696 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml @@ -92,20 +92,18 @@ </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> diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml index cdb63ef..6dcca50 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml @@ -16,8 +16,8 @@ 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 diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java index c845839..d85091e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java @@ -26,6 +26,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; import java.util.List; /** @@ -63,7 +64,7 @@ @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) public R<TableDataInfo> list(Goods goods) { - return R.ok(getDataTable(seckillActivityInfoService.listSeckillActivity(goods))); + return R.ok(seckillActivityInfoService.listSeckillActivity(goods)); } /** @@ -89,11 +90,47 @@ } 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")); + } + + /** * 获取商品秒杀活动 diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java index e8d1e6e..209e599 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java @@ -69,6 +69,17 @@ 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, @@ -171,17 +182,7 @@ } - /** - * 导出门店分佣统计 - */ - @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(), "用户积分统计"); - } + diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index 8d7dd62..0e81641 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -12,6 +12,7 @@ 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; @@ -173,7 +174,8 @@ 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(); @@ -206,8 +208,11 @@ @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") @@ -498,7 +503,8 @@ 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(); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/SeckillActivityInfoService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/SeckillActivityInfoService.java index e99a6fa..fc4106a 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/SeckillActivityInfoService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/SeckillActivityInfoService.java @@ -1,5 +1,6 @@ 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; @@ -18,7 +19,7 @@ */ public interface SeckillActivityInfoService extends IService<SeckillActivityInfo> { - List<SeckillActivityVO> listSeckillActivity(Goods goods); + TableDataInfo<SeckillActivityVO> listSeckillActivity(Goods goods); SeckillActivityDetailVO detail(Integer seckillActivityId, String latitude, String longitude); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java index bd6853a..6155d24 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java @@ -2,16 +2,13 @@ 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; @@ -36,8 +33,6 @@ import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; - -import static com.ruoyi.common.core.utils.PageUtils.startPage; /** * <p> @@ -69,15 +64,10 @@ 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) { @@ -94,7 +84,54 @@ 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 diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java index 85e2d86..18b4501 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java @@ -4,6 +4,7 @@ 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; @@ -53,21 +54,41 @@ 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){ diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java index 93a1013..3b4d4f5 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java @@ -30,9 +30,11 @@ 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> @@ -106,10 +108,26 @@ 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); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java index 8fa55b7..931bfdd 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java @@ -52,7 +52,7 @@ /** * 预约状态:0=待服务,1=已服务,2=已取消 */ - @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 4 已到期") + @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 3 已到期") private Integer status; @ApiModelProperty(value = "经度") diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml index 38909de..dede2fd 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml @@ -50,7 +50,7 @@ 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 diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml index f94d1c9..b331c08 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml @@ -53,12 +53,7 @@ <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> @@ -79,7 +74,7 @@ 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 -- Gitblit v1.7.1