Commit 7f205cc6 authored by 廖旭伟's avatar 廖旭伟

修复测试bug

parent 16bbdfad
......@@ -196,8 +196,8 @@ public class H5LoginController extends BaseCRUDJsonBodyMappingController<UserSer
userEntity.setMobile(req.getPhone());
userEntity.setLoginPwd(SecurityUtil.md5DoubleEncoding("123"));
userEntity.setUserType(2);
CompanyEntity companyEntity = companyService.getCompanyByH5(req);
userEntity.setCompanyId(companyEntity.getId());
// CompanyEntity companyEntity = companyService.getCompanyByH5(req);
// userEntity.setCompanyId(companyEntity.getId());
userEntity.setRoleIds("2");
userEntity = userService.save(userEntity);
}else {
......@@ -213,7 +213,7 @@ public class H5LoginController extends BaseCRUDJsonBodyMappingController<UserSer
&& ObjectUtils.isEmpty(userEntity.getCompanyId())) {
//todo 当前用户存在 但是未绑定公司 可绑定
CompanyEntity companyEntity = companyService.getCompanyByH5(req);
userEntity.setCompanyId(companyEntity.getId());
userEntity.setCompanyId(companyEntity==null?null:companyEntity.getId());
userEntity.setRoleIds("2");
userService.update(userEntity);
}
......
package com.mortals.xhx.module.company.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.busiz.req.H5Req;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.company.model.CompanyQuery;
......@@ -30,16 +31,20 @@ public class CompanyServiceImpl extends AbstractCRUDServiceImpl<CompanyDao, Comp
@Override
public CompanyEntity getCompanyByH5(H5Req req) {
if(req.getParkId()!=null && StringUtils.isNotEmpty(req.getApplyName()) && StringUtils.isNotEmpty(req.getPhone())) {
CompanyEntity companyEntity = this.selectOne(new CompanyQuery().parkId(req.getParkId()).applyName(req.getApplyName()).phone(req.getPhone()));
if(ObjectUtils.isEmpty(companyEntity)){
if (ObjectUtils.isEmpty(companyEntity)) {
companyEntity = new CompanyEntity();
companyEntity.initAttrValue();
BeanUtils.copyProperties(req, companyEntity, BeanUtil.getNullPropertyNames(req));
companyEntity.setCreateTime(new Date());
companyEntity.setCreateUserId(1L);
return this.save(companyEntity);
}else {
} else {
return companyEntity;
}
}else {
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