加入反扫金额校验
This commit is contained in:
parent
c03ec8d1dc
commit
33950f8101
|
|
@ -413,6 +413,10 @@ public class MerchantOrderController {
|
||||||
public Result<Object> scanPay(@RequestBody MerChantOrderDTO merchantOrderDTO) {
|
public Result<Object> scanPay(@RequestBody MerChantOrderDTO merchantOrderDTO) {
|
||||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||||
merchantOrderDTO.setMerchantCode(tokenUa.getMerchantCode());
|
merchantOrderDTO.setMerchantCode(tokenUa.getMerchantCode());
|
||||||
|
//校验金额
|
||||||
|
if (!StringUtil.isMoney(String.valueOf(merchantOrderDTO.getConsumeFee()))){
|
||||||
|
MsgException.throwException("金额异常");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return merchantOrderService.toActivePay(merchantOrderDTO);
|
return merchantOrderService.toActivePay(merchantOrderDTO);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
|
|
|
||||||
|
|
@ -391,4 +391,17 @@ public class StringUtil extends StringUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额校验
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isMoney(String str) {
|
||||||
|
// 判断小数点后2位的数字的正则表达式
|
||||||
|
Pattern pattern = Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$");
|
||||||
|
Matcher match = pattern.matcher(str);
|
||||||
|
return match.matches();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ public class MerchantStaffConnServiceImpl extends ServiceImpl<MerchantStaffConnM
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public UserApp createStaff(MerchantStaffDTO staffDTO) {
|
public UserApp createStaff(MerchantStaffDTO staffDTO) {
|
||||||
String loginName = staffDTO.getLoginName().replace("@shouyin", "");
|
String loginName = staffDTO.getLoginName().replace("@chaozg", "");
|
||||||
if (loginName.contains("@")) {
|
if (loginName.contains("@")) {
|
||||||
throw new MsgException("员工账号请不要带@");
|
throw new MsgException("员工账号请不要带@");
|
||||||
}
|
}
|
||||||
staffDTO.setLoginName(loginName + "@shouyin");
|
staffDTO.setLoginName(loginName + "@chaozg");
|
||||||
UserInfo existUserInfo = new UserInfo().setLoginName(staffDTO.getLoginName());
|
UserInfo existUserInfo = new UserInfo().setLoginName(staffDTO.getLoginName());
|
||||||
existUserInfo = userInfoService.getOne(new QueryWrapper<>(existUserInfo));
|
existUserInfo = userInfoService.getOne(new QueryWrapper<>(existUserInfo));
|
||||||
if (existUserInfo != null) {
|
if (existUserInfo != null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue