|
|
|
@ -11,6 +11,7 @@ import com.hai.model.HighAgentModel; |
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
|
import com.hai.service.HighAgentService; |
|
|
|
|
import com.hai.service.SecUserService; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
@ -45,6 +46,9 @@ public class HighAgentController { |
|
|
|
|
@Resource |
|
|
|
|
private HighAgentService highAgentService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SecUserService secUserService; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/insertAgent", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "新增代理商") |
|
|
|
@ -54,53 +58,33 @@ public class HighAgentController { |
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
if (userInfoModel.getMerchant() == null) { |
|
|
|
|
log.error("HighMerchantController -> insertMerchantStore() error!","该主角色没有权限"); |
|
|
|
|
log.error("HighMerchantController -> insertAgent() error!","该主角色没有权限"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if (
|
|
|
|
|
// StringUtils.isBlank(highAgentModel.getSecUser().getPassword())
|
|
|
|
|
// || StringUtils.isBlank(highAgentModel.getSecUser().getUserName())
|
|
|
|
|
// || StringUtils.isBlank(highAgentModel.getSecUser().getUserName())
|
|
|
|
|
//
|
|
|
|
|
// )
|
|
|
|
|
if (highAgentModel.getId() == null |
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentName()) |
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentAddress()) |
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentUser()) |
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentPhone()) |
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getSecUser().getPassword()) |
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getSecUser().getTelephone()) |
|
|
|
|
) { |
|
|
|
|
log.error("HighMerchantController -> insertAgent() error!","参数错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 校验账号手机号是否存在
|
|
|
|
|
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) { |
|
|
|
|
log.error("HighMerchantStoreController --> insertAgent() error!", "联系方式已被使用"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.TEL_EXISTED, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (highAgentService.findByAgentName(highAgentModel.getAgentName())) { |
|
|
|
|
log.error("HighMerchantStoreController --> insertAgent() error!", "代理商名称已存在"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.AGENT_NAME, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if (highAgentModel.getAgentAddress() == null
|
|
|
|
|
// || StringUtils.isBlank(highMerchantStore.getStoreKey())
|
|
|
|
|
// || StringUtils.isBlank(highMerchantStore.getSecUser().getPassword())
|
|
|
|
|
// || StringUtils.isBlank(highMerchantStore.getSecUser().getTelephone())
|
|
|
|
|
// ) {
|
|
|
|
|
// log.error("HighMerchantStoreController -> insertMerchantStore() error!","参数错误");
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 校验账户手机号
|
|
|
|
|
// if (!MemberValidateUtil.validatePhone(highMerchantStore.getSecUser().getTelephone())) {
|
|
|
|
|
// log.error("HighMerchantStoreController --> insertMerchantStore() error!", "请输入正确的电话号码");
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, "");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 校验账号手机号是否存在
|
|
|
|
|
// if (secUserService.findByPhone(highMerchantStore.getSecUser().getTelephone()) != null) {
|
|
|
|
|
// log.error("HighMerchantStoreController --> insertMerchantStore() error!", "电话号码已被使用");
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_EXISTED, "");
|
|
|
|
|
// }
|
|
|
|
|
// if (
|
|
|
|
|
// reqBody.getId() == null
|
|
|
|
|
// ) {
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// HighUser highUser = highUserService.findByUserId(reqBody.getId());
|
|
|
|
|
//
|
|
|
|
|
// if (highUser == null) {
|
|
|
|
|
// log.error("HighUserController --> updateUser() error!");
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, "");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// highUserService.updateUser(reqBody);
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("新增成功"); |
|
|
|
|
|
|
|
|
|