Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai 2025-03-19 16:42:00 +08:00
commit 5a1335b0a7
9 changed files with 53 additions and 18 deletions

View File

@ -72,10 +72,9 @@ public class SysController {
* @param sysUserEditPwdDTO 修改西悉尼 * @param sysUserEditPwdDTO 修改西悉尼
* @return 是否成功 * @return 是否成功
*/ */
@SaAdminCheckRole("admin")
@PutMapping("/pwd") @PutMapping("/pwd")
public CzgResult<Boolean> editPwd(@RequestBody @Validated SysUserEditPwdDTO sysUserEditPwdDTO) { public CzgResult<Boolean> editPwd(@RequestBody @Validated SysUserEditPwdDTO sysUserEditPwdDTO) {
return CzgResult.success(sysUserService.editPwd(StpKit.USER.getLoginIdAsLong(), sysUserEditPwdDTO)); return CzgResult.success(sysUserService.editPwd(sysUserEditPwdDTO));
} }
/** /**

View File

@ -15,13 +15,12 @@ public class SysUserEditPwdDTO {
/** /**
* ID * ID
*/ */
@NotNull(message = "ID不能为空")
private Long id; private Long id;
/** /**
* 原密码 * 原密码
*/ */
@NotBlank(message = "原密码不为空") // @NotBlank(message = "原密码不为空")
private String originalPassword; private String originalPassword;
/** /**

View File

@ -37,6 +37,6 @@ public interface SysUserService extends IService<SysUser> {
SysUserDetailVO detail(Integer id); SysUserDetailVO detail(Integer id);
Boolean editPwd(long sysUserId, SysUserEditPwdDTO sysUserEditPwdDTO); Boolean editPwd(SysUserEditPwdDTO sysUserEditPwdDTO);
} }

View File

@ -51,6 +51,8 @@ public class OrderInfoRefundDTO implements Serializable {
private String refundReason; private String refundReason;
private String pwd;
/** /**
* 退单明细 * 退单明细
* id: orderDetailId * id: orderDetailId

View File

@ -1,7 +1,6 @@
package com.czg.service.account.service.impl; package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@ -13,10 +12,7 @@ import com.czg.account.entity.ShopActivate;
import com.czg.account.entity.ShopActivateCouponRecord; import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.entity.ShopCoupon; import com.czg.account.entity.ShopCoupon;
import com.czg.account.entity.ShopUser; import com.czg.account.entity.ShopUser;
import com.czg.account.service.ShopActivateCouponRecordService; import com.czg.account.service.*;
import com.czg.account.service.ShopActivateService;
import com.czg.account.service.ShopCouponService;
import com.czg.account.service.ShopUserService;
import com.czg.enums.ShopUserFlowBizEnum; import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.sa.StpKit; import com.czg.sa.StpKit;
import com.czg.service.account.mapper.ShopActivateMapper; import com.czg.service.account.mapper.ShopActivateMapper;
@ -50,6 +46,8 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
private ShopActivateCouponRecordService inRecordService; private ShopActivateCouponRecordService inRecordService;
@Resource @Resource
private ShopUserService shopUserService; private ShopUserService shopUserService;
@Resource
private MemberPointsService pointsService;
@Override @Override
public List<ShopActivateDTO> getList(Long shopId) { public List<ShopActivateDTO> getList(Long shopId) {
@ -156,6 +154,9 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
//更新会员余额 并生成流水 //更新会员余额 并生成流水
shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO); shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
} }
if (activate.getGiftPoints() != null && activate.getGiftPoints() > 0) {
pointsService.addPoints(shopUser.getId(), activate.getGiftPoints(), "储值赠送积分", null);
}
} }
/** /**

View File

@ -206,9 +206,24 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
} }
@Override @Override
public Boolean editPwd(long sysUserId, SysUserEditPwdDTO sysUserEditPwdDTO) { public Boolean editPwd(SysUserEditPwdDTO sysUserEditPwdDTO) {
SysUser sysUser = getById(sysUserId); SysUser sysUser;
if (!sysUserEditPwdDTO.getPassword().equals(SecureUtil.md5(sysUser.getId() + sysUserEditPwdDTO.getOriginalPassword()))) { if (sysUserEditPwdDTO.getId() == null) {
sysUserEditPwdDTO.setId(StpKit.USER.getLoginIdAsLong());
sysUser = getById(sysUserEditPwdDTO.getId());
} else {
sysUser = getById(sysUserEditPwdDTO.getId());
if (sysUser.getAccount().contains("@")) {
if (!sysUser.getAccount().split("@")[0].equals(StpKit.USER.getShopId().toString())) {
throw new CzgException("修改失败");
}
} else {
throw new CzgException("修改失败");
}
}
if (StrUtil.isNotBlank(sysUserEditPwdDTO.getOriginalPassword()) &&
!sysUser.getPassword().equals(SecureUtil.md5(sysUser.getId() + sysUserEditPwdDTO.getOriginalPassword()))) {
throw new ApiNotPrintException("原密码不正确"); throw new ApiNotPrintException("原密码不正确");
} }

View File

@ -45,4 +45,5 @@ public class VipRefundDTO implements Serializable {
private String platformType; private String platformType;
private String pwd;
} }

View File

@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.exceptions.ValidateException; import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO; import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
@ -43,6 +44,7 @@ import com.czg.utils.AssertUtil;
import com.czg.utils.MD5Util; import com.czg.utils.MD5Util;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain; import com.mybatisflex.core.update.UpdateChain;
import io.seata.spring.annotation.GlobalTransactional;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import lombok.NonNull; import lombok.NonNull;
@ -346,7 +348,8 @@ public class PayServiceImpl implements PayService {
AssertUtil.isNull(shopInfo, "店铺不存在"); AssertUtil.isNull(shopInfo, "店铺不存在");
if (shopInfo.getIsMemberInPwd().equals(1)) { if (shopInfo.getIsMemberInPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用"); AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!shopInfo.getOperationPwd().equals(MD5Util.md5AsHex(payParam.getPwd()))) { AssertUtil.isBlank(payParam.getPwd(), "请输入操作密码后充值");
if (!shopInfo.getOperationPwd().equals(SecureUtil.md5(payParam.getPwd()))) {
return CzgResult.failure("支付密码错误"); return CzgResult.failure("支付密码错误");
} }
} }
@ -465,7 +468,15 @@ public class PayServiceImpl implements PayService {
} }
@Override @Override
@GlobalTransactional
public CzgResult<Object> refundVip(VipRefundDTO refPayParam) { public CzgResult<Object> refundVip(VipRefundDTO refPayParam) {
ShopInfo shopInfo = shopInfoService.getById(refPayParam.getShopId());
if (shopInfo.getIsReturnPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!SecureUtil.md5(refPayParam.getPwd()).equals(shopInfo.getOperationPwd())) {
throw new CzgException("操作密码错误");
}
}
ShopUser shopUser = shopUserService.getShopUserInfo(refPayParam.getShopId(), refPayParam.getUserId()); ShopUser shopUser = shopUserService.getShopUserInfo(refPayParam.getShopId(), refPayParam.getUserId());
ShopUserFlow inFlow = userFlowService.getById(refPayParam.getFlowId()); ShopUserFlow inFlow = userFlowService.getById(refPayParam.getFlowId());
AssertUtil.isNull(inFlow, "充值记录不存在"); AssertUtil.isNull(inFlow, "充值记录不存在");
@ -546,9 +557,10 @@ public class PayServiceImpl implements PayService {
} }
@Override @Override
@Transactional @GlobalTransactional
public CzgResult<Object> refundOrderBefore(OrderInfoRefundDTO param) { public CzgResult<Object> refundOrderBefore(OrderInfoRefundDTO param) {
OrderInfo orderInfo = orderInfoService.getById(param.getOrderId()); OrderInfo orderInfo = orderInfoService.getById(param.getOrderId());
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
Map<String, BigDecimal> returnProMap = new HashMap<>(); Map<String, BigDecimal> returnProMap = new HashMap<>();
boolean isPay = true; boolean isPay = true;
String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId(); String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId();
@ -556,7 +568,13 @@ public class PayServiceImpl implements PayService {
isPay = false; isPay = false;
refPayOrderNo = ""; refPayOrderNo = "";
} }
if (isPay) { if(isPay){
if (shopInfo.getIsReturnPwd().equals(1)) {
AssertUtil.isBlank(shopInfo.getOperationPwd(), "请设置操作密码后使用");
if (!SecureUtil.md5(param.getPwd()).equals(shopInfo.getOperationPwd())) {
throw new CzgException("操作密码错误");
}
}
orderInfo.setRefundAmount(orderInfo.getRefundAmount().add(param.getRefundAmount())); orderInfo.setRefundAmount(orderInfo.getRefundAmount().add(param.getRefundAmount()));
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) > 0) { if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) > 0) {
throw new ValidateException("退单失败,可退金额不足"); throw new ValidateException("退单失败,可退金额不足");

View File

@ -166,7 +166,7 @@
select ROUND( select ROUND(
ST_Distance_Sphere(POINT(b.lng, b.lat), POINT(#{lng}, #{lat})) / 1000, 2) AS distance, ST_Distance_Sphere(POINT(b.lng, b.lat), POINT(#{lng}, #{lat})) / 1000, 2) AS distance,
c.name, a.origin_price, a.sale_price, b.shop_name, b.districts, c.cover_img, b.logo, c.id, c.name, a.origin_price, a.sale_price, b.shop_name, b.districts, c.cover_img, b.logo, c.id,
a.real_sales_number saleNum, round(a.sale_price / a.origin_price, 2) * 10 discount, a.real_sales_number saleNum, (round(a.sale_price / a.origin_price, 2) * 10) AS discount,
c.id productId, a.id skuId, b.id shopId c.id productId, a.id skuId, b.id shopId
from tb_prod_sku as a from tb_prod_sku as a
left join tb_product c on c.id=a.product_id left join tb_product c on c.id=a.product_id