Przeglądaj źródła

优化必填参数校验

shuiqilin
zhangxin 1 rok temu
rodzic
commit
68bb1de151

+ 34
- 2
src/main/java/com/qtzl/alterSales/manager/service/AflCenterUserInfoServiceImpl.java Wyświetl plik

return aflCenterUserInfo; 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.setOpenId(aflCenterUserInfo.getOpenId());
updatePersonalAccountInfoVo.setAccountId(aflCenterUserInfo.getAccountId()); updatePersonalAccountInfoVo.setAccountId(aflCenterUserInfo.getAccountId());
updatePersonalAccountInfoVo.setAccessToken(aflCenterUserInfo.getAccessToken()); updatePersonalAccountInfoVo.setAccessToken(aflCenterUserInfo.getAccessToken());
updatePersonalAccountInfoVo.setName(aflCenterUserInfo.getNewName()); updatePersonalAccountInfoVo.setName(aflCenterUserInfo.getNewName());
updatePersonalAccountInfoVo.setAddress(aflCenterUserInfo.getNewAddress()); 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.setOpenId(aflCenterUserInfo.getOpenId());
updateCompanyAccountInfoVo.setAccountId(aflCenterUserInfo.getAccountId()); updateCompanyAccountInfoVo.setAccountId(aflCenterUserInfo.getAccountId());
updateCompanyAccountInfoVo.setAccessToken(aflCenterUserInfo.getAccessToken()); updateCompanyAccountInfoVo.setAccessToken(aflCenterUserInfo.getAccessToken());
public void getToken(AflCenterUserInfo aflCenterUserInfo) throws ServiceHandleException { public void getToken(AflCenterUserInfo aflCenterUserInfo) throws ServiceHandleException {
if (StringUtils.isEmpty(aflCenterUserInfo.getOpenId())||StringUtils.isEmpty(aflCenterUserInfo.getAccessToken())){ if (StringUtils.isEmpty(aflCenterUserInfo.getOpenId())||StringUtils.isEmpty(aflCenterUserInfo.getAccessToken())){
UserInfoAuthenticationRequestVo userInfoAuthenticationRequestVo = new UserInfoAuthenticationRequestVo(); 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.setId(aflCenterUserInfo.getIdNum());
userInfoAuthenticationRequestVo.setMobile(aflCenterUserInfo.getMobile()); userInfoAuthenticationRequestVo.setMobile(aflCenterUserInfo.getMobile());
userInfoAuthenticationRequestVo.setName(aflCenterUserInfo.getName()); userInfoAuthenticationRequestVo.setName(aflCenterUserInfo.getName());
return cb.and(list.toArray(p)); 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 Wyświetl plik

} }
aflCenterUserInfoService.getToken(aflCenterUserInfo); aflCenterUserInfoService.getToken(aflCenterUserInfo);
UpdateVehicleInfoRequestVo updateVehicleInfoRequestVo = new UpdateVehicleInfoRequestVo(); 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.setAccountId(aflCenterVehicleInfo.getAccountId());
updateVehicleInfoRequestVo.setOpenId(aflCenterUserInfo.getOpenId()); updateVehicleInfoRequestVo.setOpenId(aflCenterUserInfo.getOpenId());
updateVehicleInfoRequestVo.setAccessToken(aflCenterUserInfo.getAccessToken()); updateVehicleInfoRequestVo.setAccessToken(aflCenterUserInfo.getAccessToken());

+ 1
- 1
src/main/java/com/qtzl/alterSales/zt/vo/UserInfoAuthenticationRequestVo.java Wyświetl plik

} }
public Map<String, String> getRequestParam() { public Map<String, String> getRequestParam() {
Map<String, String> map = Maps.newHashMap(); Map<String, String> map = Maps.newHashMap();
if (StringUtils.isEmpty(mobile)){
if (!StringUtils.isEmpty(mobile)){
map.put("mobile", mobile.toString()); map.put("mobile", mobile.toString());
} }
if (!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)){

Ładowanie…
Anuluj
Zapisz