Commit 364c35b6 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 8618b0c3 75dcf840
...@@ -205,8 +205,8 @@ public class H5LoginController extends BaseCRUDJsonBodyMappingController<UserSer ...@@ -205,8 +205,8 @@ public class H5LoginController extends BaseCRUDJsonBodyMappingController<UserSer
userEntity.setMobile(req.getPhone()); userEntity.setMobile(req.getPhone());
userEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding("123")); userEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding("123"));
userEntity.setUserType(2); userEntity.setUserType(2);
CompanyEntity companyEntity = companyService.getCompanyByH5(req); // CompanyEntity companyEntity = companyService.getCompanyByH5(req);
userEntity.setCompanyId(companyEntity.getId()); // userEntity.setCompanyId(companyEntity.getId());
userEntity.setRoleIds("2"); userEntity.setRoleIds("2");
userEntity = userService.save(userEntity); userEntity = userService.save(userEntity);
...@@ -229,7 +229,7 @@ public class H5LoginController extends BaseCRUDJsonBodyMappingController<UserSer ...@@ -229,7 +229,7 @@ public class H5LoginController extends BaseCRUDJsonBodyMappingController<UserSer
&& ObjectUtils.isEmpty(userEntity.getCompanyId())) { && ObjectUtils.isEmpty(userEntity.getCompanyId())) {
//todo 当前用户存在 但是未绑定公司 可绑定 //todo 当前用户存在 但是未绑定公司 可绑定
CompanyEntity companyEntity = companyService.getCompanyByH5(req); CompanyEntity companyEntity = companyService.getCompanyByH5(req);
userEntity.setCompanyId(companyEntity.getId()); userEntity.setCompanyId(companyEntity==null?null:companyEntity.getId());
userEntity.setRoleIds("2"); userEntity.setRoleIds("2");
userService.update(userEntity); userService.update(userEntity);
} }
......
package com.mortals.xhx.module.company.service.impl; package com.mortals.xhx.module.company.service.impl;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.busiz.req.H5Req; import com.mortals.xhx.busiz.req.H5Req;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.company.model.CompanyQuery; import com.mortals.xhx.module.company.model.CompanyQuery;
...@@ -30,16 +31,20 @@ public class CompanyServiceImpl extends AbstractCRUDServiceImpl<CompanyDao, Comp ...@@ -30,16 +31,20 @@ public class CompanyServiceImpl extends AbstractCRUDServiceImpl<CompanyDao, Comp
@Override @Override
public CompanyEntity getCompanyByH5(H5Req req) { public CompanyEntity getCompanyByH5(H5Req req) {
CompanyEntity companyEntity = this.selectOne(new CompanyQuery().parkId(req.getParkId()).applyName(req.getApplyName()).phone(req.getPhone())); if(req.getParkId()!=null && StringUtils.isNotEmpty(req.getApplyName()) && StringUtils.isNotEmpty(req.getPhone())) {
if(ObjectUtils.isEmpty(companyEntity)){ CompanyEntity companyEntity = this.selectOne(new CompanyQuery().parkId(req.getParkId()).applyName(req.getApplyName()).phone(req.getPhone()));
companyEntity = new CompanyEntity(); if (ObjectUtils.isEmpty(companyEntity)) {
companyEntity.initAttrValue(); companyEntity = new CompanyEntity();
BeanUtils.copyProperties(req, companyEntity, BeanUtil.getNullPropertyNames(req)); companyEntity.initAttrValue();
companyEntity.setCreateTime(new Date()); BeanUtils.copyProperties(req, companyEntity, BeanUtil.getNullPropertyNames(req));
companyEntity.setCreateUserId(1L); companyEntity.setCreateTime(new Date());
return this.save(companyEntity); companyEntity.setCreateUserId(1L);
return this.save(companyEntity);
} else {
return companyEntity;
}
}else { }else {
return companyEntity; return null;
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment