密码校验修改

This commit is contained in:
yijiegong 2024-08-30 11:16:36 +08:00
parent 32590bb35a
commit 187a757575
2 changed files with 33 additions and 13 deletions

View File

@ -99,8 +99,9 @@ public class MemberController {
@RequestHeader("clientType") String clientType,
@RequestParam("flowId") String flowId,
@RequestParam("remark") String remark,
@RequestParam("amount") String amount
@RequestParam("amount") String amount,
@RequestParam("pwd") String pwd
){
return memberService.returnAccount(flowId,remark,amount);
return memberService.returnAccount(token, flowId,remark,amount, pwd);
}
}

View File

@ -573,11 +573,10 @@ public class MemberService {
@Transactional(rollbackFor = Exception.class)
public Result memberAccountPay(Map<String, Object> map, String token) throws Exception {
if (ObjectUtil.isEmpty(map) || map.size() <= 0
if (ObjectUtil.isEmpty(map) || map.isEmpty()
|| !map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))
|| !map.containsKey("memberId") || ObjectUtil.isEmpty(map.get("memberId"))
|| !map.containsKey("amount") || ObjectUtil.isEmpty(map.get("amount"))
|| !map.containsKey("pwd") || ObjectUtil.isEmpty(map.get("pwd"))
) {
return Result.fail(CodeEnum.PARAM);
}
@ -595,6 +594,9 @@ public class MemberService {
if ("1".equals(shopInfo.getIsMemberIn())) {
if (!map.containsKey("pwd") || ObjectUtil.isEmpty(map.get("pwd"))) {
return Result.fail(CodeEnum.PARAM);
}
String accountId = TokenUtil.parseParamFromToken(token).getString("accountId");
TbmerchantAccount account = tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
@ -724,7 +726,7 @@ public class MemberService {
}
public Result returnAccount(String flowId, String remark, String amount) {
public Result returnAccount(String token, String flowId, String remark, String amount, String pwd) {
if (ObjectUtil.isEmpty(flowId) || ObjectUtil.isNull(flowId) || ObjectUtil.isNull(amount) || ObjectUtil.isEmpty(amount)) {
return Result.fail(CodeEnum.PARAM);
}
@ -741,24 +743,41 @@ public class MemberService {
return Result.fail(CodeEnum.INPURAMOUNTERROR);
}
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(flow.getShopUserId());
if (ObjectUtil.isEmpty(user) || ObjectUtil.isNull(user)) {
return Result.fail(CodeEnum.ACCOUNTEIXST);
}
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getShopId()));
if (ObjectUtil.isEmpty(shopInfo) || shopInfo == null) {
return Result.fail(CodeEnum.SHOPINFONOEXIST);
}
if ("1".equals(shopInfo.getIsMemberReturn())) {
if (ObjectUtil.isEmpty(pwd)) {
return Result.fail(CodeEnum.PARAM);
}
String accountId = TokenUtil.parseParamFromToken(token).getString("accountId");
TbmerchantAccount account = tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
if (Objects.isNull(account)) {
return Result.fail(CodeEnum.ACCOUNTEIXST);
}
if (Objects.isNull(account.getPwd()) || ObjectUtil.isEmpty(account.getPwd())) {
return Result.fail(CodeEnum.PWDNOSET);
}
if (!account.getPwd().equals(MD5Util.encrypt(pwd.concat(account.getAccount()).concat(account.getId().toString())))) {
return Result.fail(CodeEnum.PWDERROE);
}
}
if (N.gt(new BigDecimal(amount), user.getAmount())) {
return Result.fail(CodeEnum.ACCOUNTBALANCEERROR);
}
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getShopId()));
if (ObjectUtil.isEmpty(shopInfo) || ObjectUtil.isNull(shopInfo)) {
return Result.fail(CodeEnum.MERCHANTEIXST);
}
if ("scanMemberIn".equals(flow.getBizCode())) {
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {