|
@@ -9,10 +9,10 @@ import com.keao.edu.common.tenant.TenantContextHolder;
|
|
|
import com.keao.edu.im.api.client.ImFeignService;
|
|
|
import com.keao.edu.im.api.entity.ImResult;
|
|
|
import com.keao.edu.im.api.entity.ImUserModel;
|
|
|
-import com.keao.edu.user.dao.AgencyDao;
|
|
|
+import com.keao.edu.user.dao.OrganizationDao;
|
|
|
import com.keao.edu.user.dao.SysUserDao;
|
|
|
-import com.keao.edu.user.entity.Agency;
|
|
|
-import com.keao.edu.user.service.AgencyService;
|
|
|
+import com.keao.edu.user.entity.Organization;
|
|
|
+import com.keao.edu.user.service.OrganizationService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
@@ -20,31 +20,31 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@Service
|
|
|
-public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implements AgencyService {
|
|
|
+public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organization> implements OrganizationService {
|
|
|
|
|
|
@Autowired
|
|
|
- private AgencyDao agencyDao;
|
|
|
+ private OrganizationDao agencyDao;
|
|
|
@Autowired
|
|
|
private ImFeignService imFeignService;
|
|
|
@Autowired
|
|
|
private SysUserDao sysUserDao;
|
|
|
|
|
|
@Override
|
|
|
- public BaseDAO<Integer, Agency> getDAO() {
|
|
|
+ public BaseDAO<Integer, Organization> getDAO() {
|
|
|
return agencyDao;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void add(Agency agency) {
|
|
|
+ public void add(Organization agency) {
|
|
|
SysUser sysUser = agency.getSysUser();
|
|
|
String tenantId = TenantContextHolder.getTenantId().toString();
|
|
|
agency.setTenantId(tenantId);
|
|
|
sysUser.setTenantId(tenantId);
|
|
|
SysUser user = sysUserDao.queryByPhone(sysUser.getPhone());
|
|
|
if(user != null && user.getId() != null){
|
|
|
- Agency agency1 = agencyDao.get(user.getId());
|
|
|
- if(agency1 == null){
|
|
|
+ Organization organization = agencyDao.get(user.getId());
|
|
|
+ if(organization == null){
|
|
|
if(StringUtils.isEmpty(user.getPassword())){
|
|
|
sysUser.setPassword(new BCryptPasswordEncoder().encode("123456"));
|
|
|
}
|
|
@@ -81,21 +81,21 @@ public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implemen
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateAgency(Agency agency) {
|
|
|
- SysUser sysUser = agency.getSysUser();
|
|
|
+ public void updateOrganization(Organization organization) {
|
|
|
+ SysUser sysUser = organization.getSysUser();
|
|
|
if(null == agencyDao.get(sysUser.getId())){
|
|
|
- throw new BizException("代理商信息不存在");
|
|
|
+ throw new BizException("合作商信息不存在");
|
|
|
}
|
|
|
- agency.setId(sysUser.getId());
|
|
|
+ organization.setId(sysUser.getId());
|
|
|
if(StringUtils.isNotEmpty(sysUser.getPhone())){
|
|
|
SysUser queryByPhone = sysUserDao.queryByPhone(sysUser.getPhone());
|
|
|
if(queryByPhone != null && !sysUser.getId().equals(queryByPhone.getId())){
|
|
|
throw new BizException("手机号已存在");
|
|
|
}
|
|
|
}
|
|
|
- sysUser.setRealName(agency.getName());
|
|
|
- sysUser.setPhone(agency.getContactPhone());
|
|
|
- agencyDao.update(agency);
|
|
|
+ sysUser.setRealName(organization.getName());
|
|
|
+ sysUser.setPhone(organization.getContactPhone());
|
|
|
+ agencyDao.update(organization);
|
|
|
//删除当前用户角色
|
|
|
sysUserDao.delEmployeeRole(sysUser.getId());
|
|
|
//新增用户角色
|
|
@@ -103,4 +103,4 @@ public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implemen
|
|
|
sysUserDao.update(sysUser);
|
|
|
imFeignService.update(new ImUserModel(sysUser.getId().toString(),sysUser.getRealName(),sysUser.getAvatar()));
|
|
|
}
|
|
|
-}
|
|
|
+}
|