|
@ -11,6 +11,7 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
@ -20,6 +21,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.ExcelPoiUtils; |
|
|
import com.epmet.commons.tools.utils.ExcelPoiUtils; |
|
|
|
|
|
import com.epmet.commons.tools.validator.PhoneValidatorUtils; |
|
|
import com.epmet.constant.IcCommunitySelfOrganizationConstant; |
|
|
import com.epmet.constant.IcCommunitySelfOrganizationConstant; |
|
|
import com.epmet.dao.IcCommunitySelfOrganizationDao; |
|
|
import com.epmet.dao.IcCommunitySelfOrganizationDao; |
|
|
import com.epmet.dto.IcCommunitySelfOrganizationDTO; |
|
|
import com.epmet.dto.IcCommunitySelfOrganizationDTO; |
|
@ -131,6 +133,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
@Override |
|
|
@Override |
|
|
public void addCommunitySelfOrganization(TokenDto tokenDto, AddCommunitySelfOrganizationFormDTO formDTO) { |
|
|
public void addCommunitySelfOrganization(TokenDto tokenDto, AddCommunitySelfOrganizationFormDTO formDTO) { |
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
|
|
|
boolean mobile = PhoneValidatorUtils.isMobile(formDTO.getPrincipalPhone()); |
|
|
|
|
|
boolean tel = PhoneValidatorUtils.isTel(formDTO.getPrincipalPhone()); |
|
|
|
|
|
if (!mobile && !tel){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>(); |
|
|
l.eq(IcCommunitySelfOrganizationEntity::getOrganizationName,formDTO.getOrganizationName()) |
|
|
l.eq(IcCommunitySelfOrganizationEntity::getOrganizationName,formDTO.getOrganizationName()) |
|
|
.eq(IcCommunitySelfOrganizationEntity::getCustomerId,customerId) |
|
|
.eq(IcCommunitySelfOrganizationEntity::getCustomerId,customerId) |
|
@ -163,6 +170,14 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
} |
|
|
} |
|
|
baseDao.insert(orgEntity); |
|
|
baseDao.insert(orgEntity); |
|
|
if(CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ |
|
|
if(CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ |
|
|
|
|
|
// 号码校验
|
|
|
|
|
|
formDTO.getOrganizationPersonnel().forEach(p -> { |
|
|
|
|
|
boolean m = PhoneValidatorUtils.isMobile(p.getPersonPhone()); |
|
|
|
|
|
boolean t = PhoneValidatorUtils.isTel(p.getPersonPhone()); |
|
|
|
|
|
if (!m && !t){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); |
|
|
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); |
|
|
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); |
|
|
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); |
|
|
List<String> phones = new ArrayList<>(); |
|
|
List<String> phones = new ArrayList<>(); |
|
@ -199,6 +214,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Override |
|
|
@Override |
|
|
public void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO) { |
|
|
public void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO) { |
|
|
|
|
|
boolean m = PhoneValidatorUtils.isMobile(formDTO.getPrincipalPhone()); |
|
|
|
|
|
boolean t = PhoneValidatorUtils.isTel(formDTO.getPrincipalPhone()); |
|
|
|
|
|
if (!m && !t){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>(); |
|
|
l.eq(IcCommunitySelfOrganizationEntity::getOrganizationName,formDTO.getOrganizationName()) |
|
|
l.eq(IcCommunitySelfOrganizationEntity::getOrganizationName,formDTO.getOrganizationName()) |
|
|
.eq(IcCommunitySelfOrganizationEntity::getCustomerId,tokenDto.getCustomerId()) |
|
|
.eq(IcCommunitySelfOrganizationEntity::getCustomerId,tokenDto.getCustomerId()) |
|
@ -214,6 +234,13 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
baseDao.updateCommunitySelfOrganization(e); |
|
|
baseDao.updateCommunitySelfOrganization(e); |
|
|
personnelService.deleteByOrgId(formDTO.getOrgId()); |
|
|
personnelService.deleteByOrgId(formDTO.getOrgId()); |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ |
|
|
|
|
|
formDTO.getOrganizationPersonnel().forEach(p -> { |
|
|
|
|
|
boolean mobile = PhoneValidatorUtils.isMobile(p.getPersonPhone()); |
|
|
|
|
|
boolean tel = PhoneValidatorUtils.isTel(p.getPersonPhone()); |
|
|
|
|
|
if (!mobile && !tel){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); |
|
|
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); |
|
|
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); |
|
|
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); |
|
|
List<String> phones = new ArrayList<>(); |
|
|
List<String> phones = new ArrayList<>(); |
|
@ -335,7 +362,16 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file) throws IOException { |
|
|
public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file) throws IOException { |
|
|
ExcelImportResult<ImportCommunitySelfOrganization> testExcelImportResult = ExcelPoiUtils.importExcelMore(file, 0, 2, ImportCommunitySelfOrganization.class); |
|
|
ExcelImportResult<ImportCommunitySelfOrganization> testExcelImportResult = ExcelPoiUtils.importExcelMore(file, 0, 2, ImportCommunitySelfOrganization.class); |
|
|
List<ImportCommunitySelfOrganization> list = testExcelImportResult.getList(); |
|
|
List<ImportCommunitySelfOrganization> list = testExcelImportResult.getList(); |
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)){ |
|
|
if (CollectionUtils.isNotEmpty(list)){ |
|
|
|
|
|
// 号码校验
|
|
|
|
|
|
list.forEach(p -> { |
|
|
|
|
|
boolean m = PhoneValidatorUtils.isMobile(p.getPrincipalPhone()); |
|
|
|
|
|
boolean t = PhoneValidatorUtils.isTel(p.getPrincipalPhone()); |
|
|
|
|
|
if (!m && !t){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
List<String> existsNames = baseDao.selectOrgByOrgName(list.stream().map(ImportCommunitySelfOrganization::getOrganizationName).collect(Collectors.toList()), customerId); |
|
|
List<String> existsNames = baseDao.selectOrgByOrgName(list.stream().map(ImportCommunitySelfOrganization::getOrganizationName).collect(Collectors.toList()), customerId); |
|
|
Map<String, List<ImportCommunitySelfOrganization>> groupByName = list.stream().collect(Collectors.groupingBy(ImportCommunitySelfOrganization::getOrganizationName)); |
|
|
Map<String, List<ImportCommunitySelfOrganization>> groupByName = list.stream().collect(Collectors.groupingBy(ImportCommunitySelfOrganization::getOrganizationName)); |
|
@ -372,6 +408,13 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo |
|
|
e.setOrganizationCreatedTime(l.getOrganizationCreatedTime()); |
|
|
e.setOrganizationCreatedTime(l.getOrganizationCreatedTime()); |
|
|
baseDao.insert(e); |
|
|
baseDao.insert(e); |
|
|
if (CollectionUtils.isNotEmpty(l.getPersons())){ |
|
|
if (CollectionUtils.isNotEmpty(l.getPersons())){ |
|
|
|
|
|
l.getPersons().forEach(p -> { |
|
|
|
|
|
boolean m = PhoneValidatorUtils.isMobile(p.getPersonPhone()); |
|
|
|
|
|
boolean t = PhoneValidatorUtils.isTel(p.getPersonPhone()); |
|
|
|
|
|
if (!m && !t){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(l.getPersons(), IcCommunitySelfOrganizationPersonnelEntity.class); |
|
|
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(l.getPersons(), IcCommunitySelfOrganizationPersonnelEntity.class); |
|
|
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupByPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); |
|
|
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupByPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); |
|
|
List<String> phones = new ArrayList<>(); |
|
|
List<String> phones = new ArrayList<>(); |
|
|