|
|
|
@ -10,6 +10,7 @@ import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.BusinessType;
|
|
|
|
|
import com.glxp.api.dao.auth.AuthAdminDao;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.auth.CustomerInfoEntity;
|
|
|
|
|
import com.glxp.api.entity.auth.UserRegisterEntity;
|
|
|
|
@ -250,12 +251,12 @@ public class RegisterController {
|
|
|
|
|
if (StrUtil.isNotBlank(company_check) && company_check.equals("1")) {
|
|
|
|
|
//新用户注册时根据往来单位字典进行企业名称校验
|
|
|
|
|
CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(userRegisterEntity.getCompanyId());
|
|
|
|
|
if (customerInfoEntity != null ) {
|
|
|
|
|
if (customerInfoEntity != null) {
|
|
|
|
|
return ResultVOUtils.error(500, "该企业已被注册!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UserRegisterEntity userRegisterEntity2 = userRegisterService.selectByCname(userRegisterEntity.getCompanyName());
|
|
|
|
|
if (userRegisterEntity2 !=null ) {
|
|
|
|
|
if (userRegisterEntity2 != null) {
|
|
|
|
|
return ResultVOUtils.error(500, "该企业已被注册!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -275,8 +276,8 @@ public class RegisterController {
|
|
|
|
|
}
|
|
|
|
|
userRegisterEntity.setUserName(userName);
|
|
|
|
|
UserRegisterEntity userRegisterEntity1 = userRegisterService.selectByMobile(userRegisterEntity.getMobile());
|
|
|
|
|
if(userRegisterEntity1!=null){
|
|
|
|
|
userRegisterService.deleteByMobile(userRegisterEntity.getMobile(),2);
|
|
|
|
|
if (userRegisterEntity1 != null) {
|
|
|
|
|
userRegisterService.deleteByMobile(userRegisterEntity.getMobile(), 2);
|
|
|
|
|
}
|
|
|
|
|
boolean b = userRegisterService.insertUserRegister(userRegisterEntity);
|
|
|
|
|
if (!b) {
|
|
|
|
@ -327,6 +328,9 @@ public class RegisterController {
|
|
|
|
|
return ResultVOUtils.success("密码修改成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
AuthAdminDao authAdminDao;
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("salewarehouse/register/check")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
|
|
@ -383,18 +387,20 @@ public class RegisterController {
|
|
|
|
|
}
|
|
|
|
|
//创建新用户
|
|
|
|
|
AuthAdmin authAdmin = new AuthAdmin();
|
|
|
|
|
authAdmin.setCustomerId(customerId+"");
|
|
|
|
|
authAdmin.setId(generateUserId());
|
|
|
|
|
authAdmin.setCustomerId(customerId + "");
|
|
|
|
|
authAdmin.setPassWord(userRegisterEntity.getPassword());
|
|
|
|
|
authAdmin.setCreateTime(DateUtil.parseDate(userRegisterEntity.getCheckTime()));
|
|
|
|
|
authAdmin.setUserName(userRegisterEntity.getUserName()); //用手机号当用户名,通过手机号登录
|
|
|
|
|
authAdmin.setEmployeeName(userRegisterEntity.getNickName());
|
|
|
|
|
authAdmin.setCustomerId(userRegisterEntity.getCompanyId());
|
|
|
|
|
//默认给部门、仓库
|
|
|
|
|
//默认给部门、仓库 默认给随机用户ID,避免数据同步时出错覆盖
|
|
|
|
|
authAdmin.setLocDeptCode("1000");
|
|
|
|
|
authAdmin.setLocInvCode("1000000");
|
|
|
|
|
authAdmin.setUserFlag(1);
|
|
|
|
|
authAdmin.setLastModifyTime(new Date());
|
|
|
|
|
authAdminService.insertAuthAdmin(authAdmin);
|
|
|
|
|
authAdminDao.insert(authAdmin);
|
|
|
|
|
// authAdminService.insertAuthAdmin(authAdmin);
|
|
|
|
|
authAdmin = authAdminService.findByUserName(authAdmin.getUserName());
|
|
|
|
|
|
|
|
|
|
//分配角色
|
|
|
|
@ -431,13 +437,13 @@ public class RegisterController {
|
|
|
|
|
customerContactEntity.setMobile(userRegisterEntity.getMobile());
|
|
|
|
|
customerContactEntity.setTel(userRegisterEntity.getTel());
|
|
|
|
|
CustomerContactEntity customerContactEntity1 = customerContactService.selectById(customerId);
|
|
|
|
|
if(customerContactEntity1==null){
|
|
|
|
|
if (customerContactEntity1 == null) {
|
|
|
|
|
customerContactService.insertCustomerContact(customerContactEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生产本企业信息
|
|
|
|
|
CompanyEntity companyEntity = new CompanyEntity();
|
|
|
|
|
companyEntity.setCustomerId(customerId+"");
|
|
|
|
|
companyEntity.setCustomerId(customerId + "");
|
|
|
|
|
companyEntity.setArea(userRegisterEntity.getArea());
|
|
|
|
|
companyEntity.setAreaCode(userRegisterEntity.getAreaCode());
|
|
|
|
|
companyEntity.setDetailAddr(userRegisterEntity.getDetailAddr());
|
|
|
|
@ -465,21 +471,18 @@ public class RegisterController {
|
|
|
|
|
CustomerInfoFilterRequest request = new CustomerInfoFilterRequest();
|
|
|
|
|
request.setCompanyName(registerCheckRequest.getCompanyName());
|
|
|
|
|
List<CustomerInfoEntity> customerInfoEntities = customerInfoService.filterCustomerInfo(request);
|
|
|
|
|
int i=0;
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (CustomerInfoEntity infoEntity : customerInfoEntities) {
|
|
|
|
|
if(registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())){
|
|
|
|
|
if (registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())) {
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(i<=0){
|
|
|
|
|
if (i <= 0) {
|
|
|
|
|
customerInfoService.insertCustomerInfo(customerInfoEntity);
|
|
|
|
|
companyService.insertCompany(companyEntity);//TODO !!!!!!!!!!!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!b) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|