瀏覽代碼

优化必填参数校验

shuiqilin
zhangxin 1 年之前
父節點
當前提交
68bb1de151

+ 34
- 2
src/main/java/com/qtzl/alterSales/manager/service/AflCenterUserInfoServiceImpl.java 查看文件

@@ -291,14 +291,16 @@ public class AflCenterUserInfoServiceImpl implements AflCenterUserInfoService{
return aflCenterUserInfo;
}

private void getUpdatePersonalAccountInfoVo(UpdatePersonalAccountInfoVo updatePersonalAccountInfoVo,AflCenterUserInfo aflCenterUserInfo){
private void getUpdatePersonalAccountInfoVo(UpdatePersonalAccountInfoVo updatePersonalAccountInfoVo,AflCenterUserInfo aflCenterUserInfo) throws ServiceHandleException {
isParam(aflCenterUserInfo);
updatePersonalAccountInfoVo.setOpenId(aflCenterUserInfo.getOpenId());
updatePersonalAccountInfoVo.setAccountId(aflCenterUserInfo.getAccountId());
updatePersonalAccountInfoVo.setAccessToken(aflCenterUserInfo.getAccessToken());
updatePersonalAccountInfoVo.setName(aflCenterUserInfo.getNewName());
updatePersonalAccountInfoVo.setAddress(aflCenterUserInfo.getNewAddress());
}
private void getUpdateCompanyAccountInfoVo(UpdateCompanyAccountInfoVo updateCompanyAccountInfoVo, AflCenterUserInfo aflCenterUserInfo){
private void getUpdateCompanyAccountInfoVo(UpdateCompanyAccountInfoVo updateCompanyAccountInfoVo, AflCenterUserInfo aflCenterUserInfo) throws ServiceHandleException {
isParam(aflCenterUserInfo);
updateCompanyAccountInfoVo.setOpenId(aflCenterUserInfo.getOpenId());
updateCompanyAccountInfoVo.setAccountId(aflCenterUserInfo.getAccountId());
updateCompanyAccountInfoVo.setAccessToken(aflCenterUserInfo.getAccessToken());
@@ -313,6 +315,18 @@ public class AflCenterUserInfoServiceImpl implements AflCenterUserInfoService{
public void getToken(AflCenterUserInfo aflCenterUserInfo) throws ServiceHandleException {
if (StringUtils.isEmpty(aflCenterUserInfo.getOpenId())||StringUtils.isEmpty(aflCenterUserInfo.getAccessToken())){
UserInfoAuthenticationRequestVo userInfoAuthenticationRequestVo = new UserInfoAuthenticationRequestVo();
if (StringUtils.isEmpty(aflCenterUserInfo.getIdNum())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取token失败,该用户证件号为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getMobile())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取token失败,该用户手机号为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getName())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取token失败,该用户姓名为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getIdType())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取token失败,该用户证件类型为空");
}
userInfoAuthenticationRequestVo.setId(aflCenterUserInfo.getIdNum());
userInfoAuthenticationRequestVo.setMobile(aflCenterUserInfo.getMobile());
userInfoAuthenticationRequestVo.setName(aflCenterUserInfo.getName());
@@ -397,4 +411,22 @@ public class AflCenterUserInfoServiceImpl implements AflCenterUserInfoService{
return cb.and(list.toArray(p));
}));
}

private void isParam(AflCenterUserInfo aflCenterUserInfo) throws ServiceHandleException {
if (StringUtils.isEmpty(aflCenterUserInfo.getOpenId())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改账户信息失败,错误原因:该用户用户编号不能为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getAccountId())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改账户信息失败,错误原因:该用户账户编号不能为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getAccessToken())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改账户信息失败,错误原因:该用户接口凭证不能为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getNewName())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改账户信息失败,错误原因:该用户变更姓名不能为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getNewAddress())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改账户信息失败,错误原因:该用户变更地址不能为空");
}
}
}

+ 21
- 0
src/main/java/com/qtzl/alterSales/manager/service/AflCenterVehicleInfoServiceImpl.java 查看文件

@@ -90,6 +90,27 @@ public class AflCenterVehicleInfoServiceImpl implements AflCenterVehicleInfoServ
}
aflCenterUserInfoService.getToken(aflCenterUserInfo);
UpdateVehicleInfoRequestVo updateVehicleInfoRequestVo = new UpdateVehicleInfoRequestVo();
if (StringUtils.isEmpty(aflCenterUserInfo.getOpenId())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆所属用户用户编号不能为空");
}
if (StringUtils.isEmpty(aflCenterUserInfo.getAccessToken())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆所属用户接口凭证不能为空");
}
if (StringUtils.isEmpty(aflCenterVehicleInfo.getAccountId())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆账号编号不能为空");
}
if (StringUtils.isEmpty(aflCenterVehicleInfo.getVehicleId())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆车辆编号不能为空");
}
if (StringUtils.isEmpty(aflCenterVehicleInfo.getNewEngineNo())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆变更发动机号不能为空");
}
if (StringUtils.isEmpty(aflCenterVehicleInfo.getNewIssueDate())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆变更发证日期不能为空");
}
if (StringUtils.isEmpty(aflCenterVehicleInfo.getNewRegisterDate())){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("修改车辆信息失败,错误原因:该车辆变更注册日期不能为空");
}
updateVehicleInfoRequestVo.setAccountId(aflCenterVehicleInfo.getAccountId());
updateVehicleInfoRequestVo.setOpenId(aflCenterUserInfo.getOpenId());
updateVehicleInfoRequestVo.setAccessToken(aflCenterUserInfo.getAccessToken());

+ 1
- 1
src/main/java/com/qtzl/alterSales/zt/vo/UserInfoAuthenticationRequestVo.java 查看文件

@@ -50,7 +50,7 @@ public class UserInfoAuthenticationRequestVo extends XZRequestVo{
}
public Map<String, String> getRequestParam() {
Map<String, String> map = Maps.newHashMap();
if (StringUtils.isEmpty(mobile)){
if (!StringUtils.isEmpty(mobile)){
map.put("mobile", mobile.toString());
}
if (!StringUtils.isEmpty(name)){

Loading…
取消
儲存