pull/1121/head
parent
70b1afb56d
commit
7bb2132f8c
|
|
@ -21,8 +21,8 @@ import java.util.List;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
//@RestController
|
||||
//@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController {
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
|
|
|||
|
|
@ -203,6 +203,20 @@ public class SysLoginController {
|
|||
return R.fail();
|
||||
}
|
||||
|
||||
@Log(title = "修改手机号", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation(value = "修改手机号")
|
||||
@PostMapping("/changePhoneNumber")
|
||||
public R changePhoneNumber(@Validated @RequestBody LoginBySmsCodeVO vo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String old = loginUser.getUser().getPhonenumber();
|
||||
String now = vo.getPhoneNumber();
|
||||
Assert.isFalse(StrUtil.equals(old, now), "新手机号不能与原手机号相同");
|
||||
loginService.validateSmsVerificationCode(vo.getPhoneNumber(), vo.getCode());
|
||||
userService.updateUserPhoneNumber(loginUser.getUserId(), vo.getPhoneNumber());
|
||||
tokenService.deleteCacheUser(loginUser.getUserId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -72,6 +72,22 @@ public class AssetController extends XktBaseController {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')||@ss.hasSupplierSubRole()")
|
||||
@ApiOperation(value = "获取档口支付绑定手机号")
|
||||
@GetMapping(value = "store/phonenumber")
|
||||
public R<PhoneNumberVO> getStorePhoneNumber() {
|
||||
String pn = assetService.getStorePhoneNumber(SecurityUtils.getStoreId());
|
||||
return R.ok(new PhoneNumberVO(pn));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller')")
|
||||
@ApiOperation(value = "获取卖家支付绑定手机号")
|
||||
@GetMapping(value = "user/phonenumber")
|
||||
public R<PhoneNumberVO> getUserPhoneNumber() {
|
||||
String pn = assetService.getUserPhoneNumber(SecurityUtils.getUserId());
|
||||
return R.ok(new PhoneNumberVO(pn));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')||@ss.hasSupplierSubRole()")
|
||||
@ApiOperation(value = "档口绑定支付宝")
|
||||
@PostMapping(value = "store/alipay/bind")
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.XktBaseController;
|
|||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProd.*;
|
||||
import com.ruoyi.xkt.domain.StoreProduct;
|
||||
|
|
@ -155,5 +156,21 @@ public class StoreProductController extends XktBaseController {
|
|||
util.exportExcel(response, list, "档口商品数据");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商品图包列表", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/pic-pack/{storeProdId}")
|
||||
public R<List<PicPackSimpleVO>> listPickPack(@PathVariable("storeProdId") Long storeProdId) {
|
||||
List<PicPackSimpleDTO> dtoList = storeProdService.prepareGetPicPackDownloadUrl(storeProdId);
|
||||
return success(BeanUtil.copyToList(dtoList, PicPackSimpleVO.class));
|
||||
}
|
||||
|
||||
@Log(title = "获取商品图包下载链接", businessType = BusinessType.OTHER)
|
||||
@ApiOperation(value = "获取商品图包下载链接", httpMethod = "POST", response = R.class)
|
||||
@PostMapping(value = "/pic-pack/url")
|
||||
public R<PicPackInfoVO> getPicPackInfo(@Validated @RequestBody PicPackReqVO vo) {
|
||||
PicPackReqDTO reqDTO = BeanUtil.toBean(vo, PicPackReqDTO.class);
|
||||
reqDTO.setUserId(SecurityUtils.getUserId());
|
||||
PicPackInfoDTO infoDTO = storeProdService.getPicPackDownloadUrl(reqDTO);
|
||||
return success(BeanUtil.toBean(infoDTO, PicPackInfoVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.ruoyi.web.controller.xkt.vo;
|
|||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
|
@ -13,6 +15,8 @@ import javax.validation.constraints.Pattern;
|
|||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PhoneNumberVO {
|
||||
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProd;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class PicPackInfoVO {
|
||||
/**
|
||||
* 系统文件ID
|
||||
*/
|
||||
@ApiModelProperty(value = "系统文件ID")
|
||||
private Long fileId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
private String fileUrl;
|
||||
/**
|
||||
* 文件大小(M)
|
||||
*/
|
||||
@ApiModelProperty(value = "文件大小(M)")
|
||||
private BigDecimal fileSize;
|
||||
/**
|
||||
* 完整下载路径
|
||||
*/
|
||||
@ApiModelProperty(value = "完整下载路径")
|
||||
private String downloadUrl;
|
||||
/**
|
||||
* 是否需要验证才能获取下载地址
|
||||
*/
|
||||
@ApiModelProperty(value = "是否需要验证才能获取下载地址")
|
||||
private Boolean needVerify;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProd;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class PicPackReqVO {
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
@NotNull(message = "文件ID不能为空")
|
||||
@ApiModelProperty(value = "文件ID")
|
||||
private Long fileId;
|
||||
/**
|
||||
* 图片验证码UUID
|
||||
*/
|
||||
@ApiModelProperty(value = "图片验证码UUID")
|
||||
private String uuid;
|
||||
/**
|
||||
* 图片验证码CODE
|
||||
*/
|
||||
@ApiModelProperty(value = "图片验证码CODE")
|
||||
private String code;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProd;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class PicPackSimpleVO {
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
@ApiModelProperty(value = "文件ID")
|
||||
private Long fileId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件大小(M)
|
||||
*/
|
||||
@ApiModelProperty(value = "文件大小(M)")
|
||||
private BigDecimal fileSize;
|
||||
}
|
||||
|
|
@ -153,6 +153,14 @@ public interface ISysUserService {
|
|||
*/
|
||||
public boolean updateUserAvatar(String userName, String avatar);
|
||||
|
||||
/**
|
||||
* 修改用户手机号
|
||||
*
|
||||
* @param userId
|
||||
* @param phoneNumber
|
||||
*/
|
||||
void updateUserPhoneNumber(Long userId, String phoneNumber);
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -300,6 +300,21 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateUserPhoneNumber(Long userId, String phoneNumber) {
|
||||
SysUser user = userMapper.selectById(userId);
|
||||
Assert.notNull(user);
|
||||
if (StrUtil.equals(user.getUserName(), user.getPhonenumber())) {
|
||||
user.setUserName(phoneNumber);
|
||||
}
|
||||
if (StrUtil.equals(user.getNickName(), user.getPhonenumber())) {
|
||||
user.setNickName(phoneNumber);
|
||||
}
|
||||
user.setPhonenumber(phoneNumber);
|
||||
updateUserBase(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -154,4 +154,20 @@ public interface IAssetService {
|
|||
* @param phoneNumber
|
||||
*/
|
||||
void sendSmsVerificationCode(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 获取档口支付绑定手机号
|
||||
*
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
String getStorePhoneNumber(Long storeId);
|
||||
|
||||
/**
|
||||
* 获取卖家支付绑定手机号
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
String getUserPhoneNumber(Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class AssetServiceImpl implements IAssetService {
|
|||
EPayChannel payChannel) {
|
||||
Assert.notNull(storeId);
|
||||
Assert.notEmpty(transactionPassword);
|
||||
Assert.isTrue(NumberUtil.isLessOrEqual(amount, BigDecimal.ZERO), "提现金额异常");
|
||||
Assert.isTrue(NumberUtil.isGreaterOrEqual(amount, Constants.ZERO_POINT_ONE), "提现金额不能低于0.1元");
|
||||
InternalAccount internalAccount = internalAccountService.getAccountAndCheck(storeId, EAccountOwnerType.STORE);
|
||||
ExternalAccount externalAccount = externalAccountService.getAccountAndCheck(storeId, EAccountOwnerType.STORE,
|
||||
EAccountType.getByChannel(payChannel));
|
||||
|
|
@ -146,11 +146,8 @@ public class AssetServiceImpl implements IAssetService {
|
|||
Assert.notEmpty(transactionPasswordSet.getVerifyCode());
|
||||
Assert.notEmpty(transactionPasswordSet.getTransactionPassword());
|
||||
//必须是档口注册人的手机号
|
||||
Store store = storeMapper.selectById(transactionPasswordSet.getStoreId());
|
||||
Assert.notNull(store);
|
||||
SysUser user = userMapper.selectById(store.getUserId());
|
||||
Assert.notNull(user);
|
||||
if (!StrUtil.equals(transactionPasswordSet.getPhoneNumber(), user.getPhonenumber())) {
|
||||
if (!StrUtil.equals(transactionPasswordSet.getPhoneNumber(),
|
||||
getStorePhoneNumber(transactionPasswordSet.getStoreId()))) {
|
||||
throw new ServiceException("请输入档口供应商注册账号绑定的手机号");
|
||||
}
|
||||
validateSmsVerificationCode(transactionPasswordSet.getPhoneNumber(), transactionPasswordSet.getVerifyCode());
|
||||
|
|
@ -166,8 +163,19 @@ public class AssetServiceImpl implements IAssetService {
|
|||
public AssetInfoDTO bindAlipay(AlipayBindDTO alipayBind) {
|
||||
Assert.notNull(alipayBind.getOwnerId());
|
||||
EAccountOwnerType ownerType = EAccountOwnerType.of(alipayBind.getOwnerType());
|
||||
if (EAccountOwnerType.STORE != ownerType
|
||||
&& EAccountOwnerType.USER != ownerType) {
|
||||
if (EAccountOwnerType.STORE == ownerType) {
|
||||
//必须是档口注册人的手机号
|
||||
if (!StrUtil.equals(alipayBind.getAccountOwnerPhoneNumber(),
|
||||
getStorePhoneNumber(alipayBind.getOwnerId()))) {
|
||||
throw new ServiceException("请输入档口供应商注册账号绑定的手机号");
|
||||
}
|
||||
} else if (EAccountOwnerType.USER == ownerType) {
|
||||
//必须是登录用户的手机号
|
||||
if (!StrUtil.equals(alipayBind.getAccountOwnerPhoneNumber(),
|
||||
getUserPhoneNumber(alipayBind.getOwnerId()))) {
|
||||
throw new ServiceException("请输入当前用户绑定的手机号");
|
||||
}
|
||||
} else {
|
||||
throw new ServiceException("账户归属异常");
|
||||
}
|
||||
Assert.notEmpty(alipayBind.getAccountOwnerName());
|
||||
|
|
@ -339,6 +347,22 @@ public class AssetServiceImpl implements IAssetService {
|
|||
redisCache.setCacheObject(k, "1", 60, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStorePhoneNumber(Long storeId) {
|
||||
Store store = storeMapper.selectById(storeId);
|
||||
Assert.notNull(store);
|
||||
SysUser user = userMapper.selectById(store.getUserId());
|
||||
Assert.notNull(user);
|
||||
return user.getPhonenumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserPhoneNumber(Long userId) {
|
||||
SysUser user = userMapper.selectById(userId);
|
||||
Assert.notNull(user);
|
||||
return user.getPhonenumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信验证码验证
|
||||
*
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ public class FinanceBillServiceImpl implements IFinanceBillService {
|
|||
@Override
|
||||
public FinanceBillExt createWithdrawPaymentBill(Long storeId, BigDecimal amount, EPayChannel payChannel) {
|
||||
Assert.notNull(storeId);
|
||||
Assert.isTrue(NumberUtil.isLessOrEqual(amount, BigDecimal.ZERO), "提现金额异常");
|
||||
Assert.isTrue(NumberUtil.isGreater(amount, BigDecimal.ZERO), "提现金额异常");
|
||||
Assert.notNull(payChannel);
|
||||
FinanceBill bill = new FinanceBill();
|
||||
bill.setBillNo(generateBillNo(EFinBillType.PAYMENT));
|
||||
|
|
|
|||
Loading…
Reference in New Issue