|
|
@ -5,6 +5,7 @@ import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.security.SessionObject; |
|
|
|
import com.hai.common.security.SessionObject; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
import com.hai.common.utils.MemberValidateUtil; |
|
|
|
import com.hai.common.utils.MemberValidateUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.model.HighAgentModel; |
|
|
|
import com.hai.model.HighAgentModel; |
|
|
@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @Auther: 袁野 |
|
|
|
* @Auther: 袁野 |
|
|
@ -62,8 +64,7 @@ public class HighAgentController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (highAgentModel.getId() == null |
|
|
|
if (StringUtils.isBlank(highAgentModel.getAgentName()) |
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentName()) |
|
|
|
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentAddress()) |
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentAddress()) |
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentUser()) |
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentUser()) |
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentPhone()) |
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentPhone()) |
|
|
@ -85,6 +86,23 @@ public class HighAgentController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.AGENT_NAME, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.AGENT_NAME, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 校验账户手机号
|
|
|
|
|
|
|
|
if (!MemberValidateUtil.validatePhone(highAgentModel.getSecUser().getTelephone())) { |
|
|
|
|
|
|
|
log.error("BsStudentController --> insertMerchant() error!", "请输入正确的电话号码"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 校验账号手机号是否存在
|
|
|
|
|
|
|
|
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) { |
|
|
|
|
|
|
|
log.error("BsStudentController --> insertMerchant() error!", "电话号码已被使用"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_EXISTED, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highAgentModel.setStatus(1); // 状态:0:不可用,1:可用
|
|
|
|
|
|
|
|
highAgentModel.setCreateTime(new Date()); |
|
|
|
|
|
|
|
highAgentModel.setOperatorId(userInfoModel.getSecUser().getId()); |
|
|
|
|
|
|
|
highAgentModel.setOperatorName(userInfoModel.getSecUser().getUserName()); |
|
|
|
|
|
|
|
highAgentService.insertAgentMsg(highAgentModel); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("新增成功"); |
|
|
|
return ResponseMsgUtil.success("新增成功"); |
|
|
|
|
|
|
|
|
|
|
@ -97,23 +115,60 @@ public class HighAgentController { |
|
|
|
@RequestMapping(value = "/updateAgent", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/updateAgent", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "修改代理商") |
|
|
|
@ApiOperation(value = "修改代理商") |
|
|
|
public ResponseData updateAgentMsg(@RequestBody HighAgentModel highAgentMsgModel, HttpServletRequest request) { |
|
|
|
public ResponseData updateAgentMsg(@RequestBody HighAgentModel highAgentModel, HttpServletRequest request) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
// if (
|
|
|
|
//发布人员
|
|
|
|
// reqBody.getId() == null
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
// ) {
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
|
|
|
|
if (userInfoModel.getMerchant() == null) { |
|
|
|
// }
|
|
|
|
log.error("HighMerchantController -> insertAgent() error!","该主角色没有权限"); |
|
|
|
//
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
// HighUser highUser = highUserService.findByUserId(reqBody.getId());
|
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// if (highUser == null) {
|
|
|
|
if (highAgentModel.getId() == null |
|
|
|
// log.error("HighUserController --> updateUser() error!");
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentName()) |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, "");
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentAddress()) |
|
|
|
// }
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentUser()) |
|
|
|
//
|
|
|
|
|| StringUtils.isBlank(highAgentModel.getAgentPhone()) |
|
|
|
// highUserService.updateUser(reqBody);
|
|
|
|
|| 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 (!MemberValidateUtil.validatePhone(highAgentModel.getSecUser().getTelephone())) { |
|
|
|
|
|
|
|
log.error("BsStudentController --> insertMerchant() error!", "请输入正确的电话号码"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_IS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 校验账号手机号是否存在
|
|
|
|
|
|
|
|
if (secUserService.findByPhone(highAgentModel.getSecUser().getTelephone()) != null) { |
|
|
|
|
|
|
|
log.error("BsStudentController --> insertMerchant() error!", "电话号码已被使用"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.PHONE_NUM_EXISTED, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highAgentModel.setStatus(1); // 状态:0:不可用,1:可用
|
|
|
|
|
|
|
|
highAgentModel.setCreateTime(new Date()); |
|
|
|
|
|
|
|
highAgentModel.setOperatorId(userInfoModel.getSecUser().getId()); |
|
|
|
|
|
|
|
highAgentModel.setOperatorName(userInfoModel.getSecUser().getUserName()); |
|
|
|
|
|
|
|
highAgentService.insertAgentMsg(highAgentModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("修改成功"); |
|
|
|
return ResponseMsgUtil.success("修改成功"); |
|
|
|
|
|
|
|
|
|
|
|