@ -1,7 +1,6 @@
package com.epmet.service.impl ;
package com.epmet.service.impl ;
import com.alibaba.excel.EasyExcel ;
import com.alibaba.excel.EasyExcel ;
import com.epmet.commons.tools.constant.AppClientConstant ;
import com.epmet.commons.tools.constant.NumConstant ;
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 ;
@ -13,7 +12,9 @@ import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils ;
import com.epmet.commons.tools.redis.RedisUtils ;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis ;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis ;
import com.epmet.commons.tools.security.dto.TokenDto ;
import com.epmet.commons.tools.security.dto.TokenDto ;
import com.epmet.commons.tools.utils.* ;
import com.epmet.commons.tools.utils.ConvertUtils ;
import com.epmet.commons.tools.utils.FileUtils ;
import com.epmet.commons.tools.utils.Result ;
import com.epmet.constant.OrgInfoConstant ;
import com.epmet.constant.OrgInfoConstant ;
import com.epmet.constants.ImportTaskConstants ;
import com.epmet.constants.ImportTaskConstants ;
import com.epmet.dao.CustomerStaffAgencyDao ;
import com.epmet.dao.CustomerStaffAgencyDao ;
@ -151,13 +152,14 @@ public class StaffServiceImpl implements StaffService {
/ * *
/ * *
* 人员添加页面初始化
* 人员添加页面初始化
* 备注 : 2022 . 10 . 18运营端 - 统一认证也会调用此接口 , 入参会给customerId
* 备注 : 2022 . 10 . 18运营端 - 统一认证也会调用此接口 , 入参会给customerId
*
* @param fromDTO 参数
* @param fromDTO 参数
* @return
* @return
* /
* /
@Override
@Override
public Result < List < RoleInfoResultDTO > > addStaffInit ( StaffInfoFromDTO fromDTO ) {
public Result < List < RoleInfoResultDTO > > addStaffInit ( StaffInfoFromDTO fromDTO ) {
if ( StringUtils . isBlank ( fromDTO . getCustomerId ( ) ) ) {
if ( StringUtils . isBlank ( fromDTO . getCustomerId ( ) ) ) {
if ( StringUtils . isNotBlank ( fromDTO . getAgencyId ( ) ) ) {
if ( StringUtils . isNotBlank ( fromDTO . getAgencyId ( ) ) ) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService . selectById ( fromDTO . getAgencyId ( ) ) ;
CustomerAgencyEntity customerAgencyEntity = customerAgencyService . selectById ( fromDTO . getAgencyId ( ) ) ;
fromDTO . setCustomerId ( customerAgencyEntity . getCustomerId ( ) ) ;
fromDTO . setCustomerId ( customerAgencyEntity . getCustomerId ( ) ) ;
}
}
@ -168,19 +170,19 @@ public class StaffServiceImpl implements StaffService {
@Override
@Override
public Result < StaffInitResultDTO > editStaffInit ( StaffInfoFromDTO fromDTO ) {
public Result < StaffInitResultDTO > editStaffInit ( StaffInfoFromDTO fromDTO ) {
//运营端-统一认证调用此接口时,客户id传值了。
//运营端-统一认证调用此接口时,客户id传值了。
if ( StringUtils . isBlank ( fromDTO . getCustomerId ( ) ) ) {
if ( StringUtils . isBlank ( fromDTO . getCustomerId ( ) ) ) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService . selectById ( fromDTO . getAgencyId ( ) ) ;
CustomerAgencyEntity customerAgencyEntity = customerAgencyService . selectById ( fromDTO . getAgencyId ( ) ) ;
fromDTO . setCustomerId ( customerAgencyEntity . getCustomerId ( ) ) ;
fromDTO . setCustomerId ( customerAgencyEntity . getCustomerId ( ) ) ;
}
}
CustomerStaffAgencyDTO customerStaffAgencyDTO = customerStaffAgencyService . getInfoByUserId ( fromDTO . getStaffId ( ) ) ;
CustomerStaffAgencyDTO customerStaffAgencyDTO = customerStaffAgencyService . getInfoByUserId ( fromDTO . getStaffId ( ) ) ;
if ( null = = customerStaffAgencyDTO ) {
if ( null = = customerStaffAgencyDTO ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "customer_staff_agency is null user_id :" + fromDTO . getStaffId ( ) , "查询用户所属组织为空" ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "customer_staff_agency is null user_id :" + fromDTO . getStaffId ( ) , "查询用户所属组织为空" ) ;
}
}
//运营端-统一认证那调用的时候, agencyId为空,这里重新赋值下
//运营端-统一认证那调用的时候, agencyId为空,这里重新赋值下
if ( StringUtils . isBlank ( fromDTO . getAgencyId ( ) ) ) {
if ( StringUtils . isBlank ( fromDTO . getAgencyId ( ) ) ) {
fromDTO . setAgencyId ( customerStaffAgencyDTO . getAgencyId ( ) ) ;
fromDTO . setAgencyId ( customerStaffAgencyDTO . getAgencyId ( ) ) ;
}
}
Result < StaffInitResultDTO > res = epmetUserFeignClient . editStaffInit ( fromDTO ) ;
Result < StaffInitResultDTO > res = epmetUserFeignClient . editStaffInit ( fromDTO ) ;
if ( res . success ( ) & & null ! = res . getData ( ) ) {
if ( res . success ( ) & & null ! = res . getData ( ) ) {
res . getData ( ) . setAgencyId ( customerStaffAgencyDTO . getAgencyId ( ) ) ;
res . getData ( ) . setAgencyId ( customerStaffAgencyDTO . getAgencyId ( ) ) ;
res . getData ( ) . setAgencyName ( customerAgencyService . getAgencyName ( customerStaffAgencyDTO . getAgencyId ( ) ) ) ;
res . getData ( ) . setAgencyName ( customerAgencyService . getAgencyName ( customerStaffAgencyDTO . getAgencyId ( ) ) ) ;
@ -227,14 +229,13 @@ public class StaffServiceImpl implements StaffService {
}
}
/ * *
/ * *
*
* @param tokenDto TokenDto tokenDto ,
* @param tokenDto TokenDto tokenDto ,
* @param fromDTO
* @param fromDTO
* @return
* @return
* /
* /
@Override
@Override
public Result editStaff ( StaffSubmitFromDTO fromDTO ) {
public Result editStaff ( StaffSubmitFromDTO fromDTO ) {
if ( StringUtils . isBlank ( fromDTO . getCustomerId ( ) ) ) {
if ( StringUtils . isBlank ( fromDTO . getCustomerId ( ) ) ) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService . selectById ( fromDTO . getAgencyId ( ) ) ;
CustomerAgencyEntity customerAgencyEntity = customerAgencyService . selectById ( fromDTO . getAgencyId ( ) ) ;
fromDTO . setCustomerId ( customerAgencyEntity . getCustomerId ( ) ) ;
fromDTO . setCustomerId ( customerAgencyEntity . getCustomerId ( ) ) ;
}
}
@ -243,12 +244,12 @@ public class StaffServiceImpl implements StaffService {
// fromDTO.setClient(tokenDto.getClient());
// fromDTO.setClient(tokenDto.getClient());
Result result = epmetUserFeignClient . editStaff ( fromDTO ) ;
Result result = epmetUserFeignClient . editStaff ( fromDTO ) ;
if ( ! result . success ( ) ) {
if ( ! result . success ( ) ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , result . getInternalMsg ( ) , result . getMsg ( ) ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , result . getInternalMsg ( ) , result . getMsg ( ) ) ;
}
}
// if (tokenDto.getClient().equals("web")){
// if (tokenDto.getClient().equals("web")){
if ( CollectionUtils . isNotEmpty ( fromDTO . getNewRoles ( ) ) ) {
if ( CollectionUtils . isNotEmpty ( fromDTO . getNewRoles ( ) ) ) {
Result roleUserAccess = govAccessFeignClient . roleUser ( new RoleUserFormDTO ( fromDTO . getNewRoles ( ) , fromDTO . getStaffId ( ) , fromDTO . getCustomerId ( ) ) ) ;
Result roleUserAccess = govAccessFeignClient . roleUser ( new RoleUserFormDTO ( fromDTO . getNewRoles ( ) , fromDTO . getStaffId ( ) , fromDTO . getCustomerId ( ) ) ) ;
if ( ! roleUserAccess . success ( ) ) {
if ( ! roleUserAccess . success ( ) ) {
throw new EpmetException ( "save data to gov-role-user failure" ) ;
throw new EpmetException ( "save data to gov-role-user failure" ) ;
}
}
}
}
@ -310,8 +311,8 @@ public class StaffServiceImpl implements StaffService {
result . setAgencyName ( agencyName ) ;
result . setAgencyName ( agencyName ) ;
//新增返参: 用户所属机关id
//新增返参: 用户所属机关id
result . setAgencyId ( customerStaffAgency . getAgencyId ( ) ) ;
result . setAgencyId ( customerStaffAgency . getAgencyId ( ) ) ;
CustomerAgencyDTO customerAgencyDTO = customerAgencyService . get ( customerStaffAgency . getAgencyId ( ) ) ;
CustomerAgencyDTO customerAgencyDTO = customerAgencyService . get ( customerStaffAgency . getAgencyId ( ) ) ;
if ( null ! = customerAgencyDTO ) {
if ( null ! = customerAgencyDTO ) {
//用户所属机关名称
//用户所属机关名称
result . setMyAgencyName ( customerAgencyDTO . getOrganizationName ( ) ) ;
result . setMyAgencyName ( customerAgencyDTO . getOrganizationName ( ) ) ;
}
}
@ -332,8 +333,8 @@ public class StaffServiceImpl implements StaffService {
List < String > staffIdList = new ArrayList < > ( ) ;
List < String > staffIdList = new ArrayList < > ( ) ;
staffIdList . add ( result . getStaffId ( ) ) ;
staffIdList . add ( result . getStaffId ( ) ) ;
List < StaffOrgNameResultDTO > list = staffOrgRelationDao . selelctStaffOrg ( staffIdList ) ;
List < StaffOrgNameResultDTO > list = staffOrgRelationDao . selelctStaffOrg ( staffIdList ) ;
list . forEach ( l - > {
list . forEach ( l - > {
if ( l . getStaffId ( ) . equals ( result . getStaffId ( ) ) ) {
if ( l . getStaffId ( ) . equals ( result . getStaffId ( ) ) ) {
result . setOrgId ( l . getOrgId ( ) ) ;
result . setOrgId ( l . getOrgId ( ) ) ;
result . setOrgName ( l . getOrgName ( ) ) ;
result . setOrgName ( l . getOrgName ( ) ) ;
result . setOrgType ( l . getOrgType ( ) ) ;
result . setOrgType ( l . getOrgType ( ) ) ;
@ -555,6 +556,7 @@ public class StaffServiceImpl implements StaffService {
/ * *
/ * *
* 根据staffId查询用户基本信息
* 根据staffId查询用户基本信息
*
* @author sun
* @author sun
* /
* /
@Override
@Override
@ -572,13 +574,13 @@ public class StaffServiceImpl implements StaffService {
public String staffName ( String userId ) {
public String staffName ( String userId ) {
// 查询所属组织名字
// 查询所属组织名字
String agencyName = customerStaffAgencyDao . selectStaffBelongAgency ( userId ) ;
String agencyName = customerStaffAgencyDao . selectStaffBelongAgency ( userId ) ;
if ( StringUtils . isEmpty ( agencyName ) ) {
if ( StringUtils . isEmpty ( agencyName ) ) {
throw new RenException ( "查询工作人员所属组织名称为空" ) ;
throw new RenException ( "查询工作人员所属组织名称为空" ) ;
}
}
StaffBasicInfoFromDTO formDTO = new StaffBasicInfoFromDTO ( ) ;
StaffBasicInfoFromDTO formDTO = new StaffBasicInfoFromDTO ( ) ;
formDTO . setStaffId ( userId ) ;
formDTO . setStaffId ( userId ) ;
Result < BasicInfoResultDTO > staffBasicInfo = epmetUserOpenFeignClient . getStaffBasicInfo ( formDTO ) ;
Result < BasicInfoResultDTO > staffBasicInfo = epmetUserOpenFeignClient . getStaffBasicInfo ( formDTO ) ;
if ( ! staffBasicInfo . success ( ) ) {
if ( ! staffBasicInfo . success ( ) ) {
throw new RenException ( "查询工作人员姓名失败" ) ;
throw new RenException ( "查询工作人员姓名失败" ) ;
}
}
String result = agencyName . concat ( staffBasicInfo . getData ( ) . getRealName ( ) ) ;
String result = agencyName . concat ( staffBasicInfo . getData ( ) . getRealName ( ) ) ;
@ -587,6 +589,7 @@ public class StaffServiceImpl implements StaffService {
/ * *
/ * *
* 【 通讯录 】 人员添加v2
* 【 通讯录 】 人员添加v2
*
* @author sun
* @author sun
* /
* /
@Override
@Override
@ -596,7 +599,7 @@ public class StaffServiceImpl implements StaffService {
OrgResultDTO orgDTO = customerAgencyDao . selectAgencyDetail ( fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ;
OrgResultDTO orgDTO = customerAgencyDao . selectAgencyDetail ( fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ;
if ( null = = orgDTO ) {
if ( null = = orgDTO ) {
logger . warn ( String . format ( "工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s" , fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ) ;
logger . warn ( String . format ( "工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s" , fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "根据新增人员组织类型未查询到相关组织信息" , "组织不存在" ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "根据新增人员组织类型未查询到相关组织信息" , "组织不存在" ) ;
}
}
//2.调用user服务,新增用户信息
//2.调用user服务,新增用户信息
@ -604,7 +607,7 @@ public class StaffServiceImpl implements StaffService {
submitDTO . setAgencyId ( orgDTO . getAgencyId ( ) ) ;
submitDTO . setAgencyId ( orgDTO . getAgencyId ( ) ) ;
Result < CustomerStaffDTO > result = epmetUserFeignClient . addStaff ( submitDTO ) ;
Result < CustomerStaffDTO > result = epmetUserFeignClient . addStaff ( submitDTO ) ;
if ( ! result . success ( ) ) {
if ( ! result . success ( ) ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , result . getInternalMsg ( ) , result . getMsg ( ) ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , result . getInternalMsg ( ) , result . getMsg ( ) ) ;
}
}
//3.人员机关表总人数加一、关系表新增关系数据
//3.人员机关表总人数加一、关系表新增关系数据
@ -647,9 +650,9 @@ public class StaffServiceImpl implements StaffService {
//5.工作人员注册组织关系表新增数据
//5.工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity ( ) ;
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity ( ) ;
staffOrgRelationEntity . setCustomerId ( fromDTO . getCustomerId ( ) ) ;
staffOrgRelationEntity . setCustomerId ( fromDTO . getCustomerId ( ) ) ;
if ( "agency" . equals ( fromDTO . getOrgType ( ) ) ) {
if ( "agency" . equals ( fromDTO . getOrgType ( ) ) ) {
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) ) ) ;
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) ) ) ;
} else {
} else {
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) + ":" ) + orgDTO . getAgencyId ( ) ) ;
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) + ":" ) + orgDTO . getAgencyId ( ) ) ;
}
}
staffOrgRelationEntity . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
staffOrgRelationEntity . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
@ -657,9 +660,9 @@ public class StaffServiceImpl implements StaffService {
staffOrgRelationEntity . setOrgType ( fromDTO . getOrgType ( ) ) ;
staffOrgRelationEntity . setOrgType ( fromDTO . getOrgType ( ) ) ;
staffOrgRelationService . insert ( staffOrgRelationEntity ) ;
staffOrgRelationService . insert ( staffOrgRelationEntity ) ;
if ( CollectionUtils . isNotEmpty ( fromDTO . getNewRoles ( ) ) ) {
if ( CollectionUtils . isNotEmpty ( fromDTO . getNewRoles ( ) ) ) {
Result roleUserAccess = govAccessFeignClient . roleUser ( new RoleUserFormDTO ( fromDTO . getNewRoles ( ) , customerStaffAgencyEntity . getUserId ( ) , fromDTO . getCustomerId ( ) ) ) ;
Result roleUserAccess = govAccessFeignClient . roleUser ( new RoleUserFormDTO ( fromDTO . getNewRoles ( ) , customerStaffAgencyEntity . getUserId ( ) , fromDTO . getCustomerId ( ) ) ) ;
if ( ! roleUserAccess . success ( ) ) {
if ( ! roleUserAccess . success ( ) ) {
throw new EpmetException ( "save data to gov-role-user failure" ) ;
throw new EpmetException ( "save data to gov-role-user failure" ) ;
}
}
}
}
@ -670,13 +673,13 @@ public class StaffServiceImpl implements StaffService {
if ( "1535072605621841922" . equals ( fromDTO . getCustomerId ( ) )
if ( "1535072605621841922" . equals ( fromDTO . getCustomerId ( ) )
| | "45687aa479955f9d06204d415238f7cc" . equals ( fromDTO . getCustomerId ( ) )
| | "45687aa479955f9d06204d415238f7cc" . equals ( fromDTO . getCustomerId ( ) )
| | "0c41b272ee9ee95ac6f184ad548a30eb" . equals ( fromDTO . getCustomerId ( ) ) ) {
| | "0c41b272ee9ee95ac6f184ad548a30eb" . equals ( fromDTO . getCustomerId ( ) ) ) {
YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils . sourceToTarget ( fromDTO , YtSyncStaffIdFormDTO . class ) ;
YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils . sourceToTarget ( fromDTO , YtSyncStaffIdFormDTO . class ) ;
ytSyncStaffIdFormDTO . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
ytSyncStaffIdFormDTO . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
ytSyncStaffIdFormDTO . setOperUserId ( fromDTO . getCurrentUserId ( ) ) ;
ytSyncStaffIdFormDTO . setOperUserId ( fromDTO . getCurrentUserId ( ) ) ;
epmetThirdOpenFeignClient . dataSyncUpdateStaff ( ytSyncStaffIdFormDTO ) ;
epmetThirdOpenFeignClient . dataSyncUpdateStaff ( ytSyncStaffIdFormDTO ) ;
}
}
//2022.10.18加个返参,借用下StaffDetailResultDTO不再新建dto了
//2022.10.18加个返参,借用下StaffDetailResultDTO不再新建dto了
StaffDetailResultDTO resultDTO = new StaffDetailResultDTO ( ) ;
StaffDetailResultDTO resultDTO = new StaffDetailResultDTO ( ) ;
resultDTO . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
resultDTO . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
return new Result < StaffDetailResultDTO > ( ) . ok ( resultDTO ) ;
return new Result < StaffDetailResultDTO > ( ) . ok ( resultDTO ) ;
}
}
@ -743,7 +746,7 @@ public class StaffServiceImpl implements StaffService {
agency . setOrgType ( OrgInfoConstant . AGENCY ) ;
agency . setOrgType ( OrgInfoConstant . AGENCY ) ;
list . add ( agency ) ;
list . add ( agency ) ;
//工作人员所在部门
//工作人员所在部门
if ( CollectionUtils . isNotEmpty ( staffInfoCache . getDeptList ( ) ) ) {
if ( CollectionUtils . isNotEmpty ( staffInfoCache . getDeptList ( ) ) ) {
List < StaffOrgListResultDTO > deptList = staffInfoCache . getDeptList ( ) . stream ( ) . map ( item - > {
List < StaffOrgListResultDTO > deptList = staffInfoCache . getDeptList ( ) . stream ( ) . map ( item - > {
StaffOrgListResultDTO dto = new StaffOrgListResultDTO ( ) ;
StaffOrgListResultDTO dto = new StaffOrgListResultDTO ( ) ;
dto . setOrgId ( item . getId ( ) ) ;
dto . setOrgId ( item . getId ( ) ) ;
@ -754,7 +757,7 @@ public class StaffServiceImpl implements StaffService {
list . addAll ( deptList ) ;
list . addAll ( deptList ) ;
}
}
//工作人员所在网格
//工作人员所在网格
if ( CollectionUtils . isNotEmpty ( staffInfoCache . getGridList ( ) ) ) {
if ( CollectionUtils . isNotEmpty ( staffInfoCache . getGridList ( ) ) ) {
List < StaffOrgListResultDTO > gridList = staffInfoCache . getGridList ( ) . stream ( ) . map ( item - > {
List < StaffOrgListResultDTO > gridList = staffInfoCache . getGridList ( ) . stream ( ) . map ( item - > {
StaffOrgListResultDTO dto = new StaffOrgListResultDTO ( ) ;
StaffOrgListResultDTO dto = new StaffOrgListResultDTO ( ) ;
dto . setOrgId ( item . getId ( ) ) ;
dto . setOrgId ( item . getId ( ) ) ;
@ -768,11 +771,11 @@ public class StaffServiceImpl implements StaffService {
}
}
@Override
@Override
public void execAsyncExcelImport ( Path filePath , String importTaskId , String orgType , String orgId ) {
public void execAsyncExcelImport ( Path filePath , String importTaskId , String orgType , String orgId ) {
try {
try {
CustomerStaffImportListener listener = new CustomerStaffImportListener ( userRemoteService . getLoginUserDetails ( ) . getUserId ( ) , userRemoteService . getLoginUserDetails ( ) . getCustomerId ( ) , orgType , orgId , this ) ;
CustomerStaffImportListener listener = new CustomerStaffImportListener ( userRemoteService . getLoginUserDetails ( ) . getUserId ( ) , userRemoteService . getLoginUserDetails ( ) . getCustomerId ( ) , orgType , orgId , this ) ;
EasyExcel . read ( filePath . toFile ( ) , CustomerStaffImportExcelData . class , listener ) . headRowNumber ( 1 ) . sheet ( 0 ) . doRead ( ) ;
EasyExcel . read ( filePath . toFile ( ) , CustomerStaffImportExcelData . class , listener ) . headRowNumber ( 1 ) . sheet ( 0 ) . doRead ( ) ;
@ -811,7 +814,7 @@ public class StaffServiceImpl implements StaffService {
IOUtils . closeQuietly ( os ) ;
IOUtils . closeQuietly ( os ) ;
try {
try {
fileItem . delete ( ) ;
fileItem . delete ( ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
log . error ( "【客户信息导入】删除临时描述文件失败:{}" , ExceptionUtils . getErrorStackTrace ( e ) ) ;
log . error ( "【客户信息导入】删除临时描述文件失败:{}" , ExceptionUtils . getErrorStackTrace ( e ) ) ;
}
}
}
}
@ -849,6 +852,7 @@ public class StaffServiceImpl implements StaffService {
/ * *
/ * *
* 批量持久化
* 批量持久化
*
* @param addStaffV2FromDTOList
* @param addStaffV2FromDTOList
* /
* /
public void exportAdd ( List < AddStaffV2FromDTO > addStaffV2FromDTOList , CustomerStaffImportListener listener ) {
public void exportAdd ( List < AddStaffV2FromDTO > addStaffV2FromDTOList , CustomerStaffImportListener listener ) {
@ -859,7 +863,7 @@ public class StaffServiceImpl implements StaffService {
OrgResultDTO orgDTO = customerAgencyDao . selectAgencyDetail ( fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ;
OrgResultDTO orgDTO = customerAgencyDao . selectAgencyDetail ( fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ;
if ( null = = orgDTO ) {
if ( null = = orgDTO ) {
logger . warn ( String . format ( "工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s" , fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ) ;
logger . warn ( String . format ( "工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s" , fromDTO . getOrgId ( ) , fromDTO . getOrgType ( ) ) ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "根据新增人员组织类型未查询到相关组织信息" , "组织不存在" ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , "根据新增人员组织类型未查询到相关组织信息" , "组织不存在" ) ;
}
}
//2.调用user服务,新增用户信息
//2.调用user服务,新增用户信息
@ -867,7 +871,7 @@ public class StaffServiceImpl implements StaffService {
submitDTO . setAgencyId ( orgDTO . getAgencyId ( ) ) ;
submitDTO . setAgencyId ( orgDTO . getAgencyId ( ) ) ;
Result < CustomerStaffDTO > result = epmetUserFeignClient . addStaff ( submitDTO ) ;
Result < CustomerStaffDTO > result = epmetUserFeignClient . addStaff ( submitDTO ) ;
if ( ! result . success ( ) ) {
if ( ! result . success ( ) ) {
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , result . getInternalMsg ( ) , result . getMsg ( ) ) ;
throw new EpmetException ( EpmetErrorCode . EPMET_COMMON_OPERATION_FAIL . getCode ( ) , result . getInternalMsg ( ) , result . getMsg ( ) ) ;
}
}
//3.人员机关表总人数加一、关系表新增关系数据
//3.人员机关表总人数加一、关系表新增关系数据
@ -910,9 +914,9 @@ public class StaffServiceImpl implements StaffService {
//5.工作人员注册组织关系表新增数据
//5.工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity ( ) ;
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity ( ) ;
staffOrgRelationEntity . setCustomerId ( fromDTO . getCustomerId ( ) ) ;
staffOrgRelationEntity . setCustomerId ( fromDTO . getCustomerId ( ) ) ;
if ( "agency" . equals ( fromDTO . getOrgType ( ) ) ) {
if ( "agency" . equals ( fromDTO . getOrgType ( ) ) ) {
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) ) ) ;
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) ) ) ;
} else {
} else {
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) + ":" ) + orgDTO . getAgencyId ( ) ) ;
staffOrgRelationEntity . setPids ( ( "" . equals ( orgDTO . getPids ( ) ) ? "" : orgDTO . getPids ( ) + ":" ) + orgDTO . getAgencyId ( ) ) ;
}
}
staffOrgRelationEntity . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
staffOrgRelationEntity . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
@ -920,9 +924,9 @@ public class StaffServiceImpl implements StaffService {
staffOrgRelationEntity . setOrgType ( fromDTO . getOrgType ( ) ) ;
staffOrgRelationEntity . setOrgType ( fromDTO . getOrgType ( ) ) ;
staffOrgRelationService . insert ( staffOrgRelationEntity ) ;
staffOrgRelationService . insert ( staffOrgRelationEntity ) ;
if ( CollectionUtils . isNotEmpty ( fromDTO . getNewRoles ( ) ) ) {
if ( CollectionUtils . isNotEmpty ( fromDTO . getNewRoles ( ) ) ) {
Result roleUserAccess = govAccessFeignClient . roleUser ( new RoleUserFormDTO ( fromDTO . getNewRoles ( ) , customerStaffAgencyEntity . getUserId ( ) , fromDTO . getCustomerId ( ) ) ) ;
Result roleUserAccess = govAccessFeignClient . roleUser ( new RoleUserFormDTO ( fromDTO . getNewRoles ( ) , customerStaffAgencyEntity . getUserId ( ) , fromDTO . getCustomerId ( ) ) ) ;
if ( ! roleUserAccess . success ( ) ) {
if ( ! roleUserAccess . success ( ) ) {
throw new EpmetException ( "save data to gov-role-user failure" ) ;
throw new EpmetException ( "save data to gov-role-user failure" ) ;
}
}
}
}
@ -933,7 +937,7 @@ public class StaffServiceImpl implements StaffService {
if ( "1535072605621841922" . equals ( fromDTO . getCustomerId ( ) )
if ( "1535072605621841922" . equals ( fromDTO . getCustomerId ( ) )
| | "45687aa479955f9d06204d415238f7cc" . equals ( fromDTO . getCustomerId ( ) )
| | "45687aa479955f9d06204d415238f7cc" . equals ( fromDTO . getCustomerId ( ) )
| | "0c41b272ee9ee95ac6f184ad548a30eb" . equals ( fromDTO . getCustomerId ( ) ) ) {
| | "0c41b272ee9ee95ac6f184ad548a30eb" . equals ( fromDTO . getCustomerId ( ) ) ) {
YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils . sourceToTarget ( fromDTO , YtSyncStaffIdFormDTO . class ) ;
YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils . sourceToTarget ( fromDTO , YtSyncStaffIdFormDTO . class ) ;
ytSyncStaffIdFormDTO . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
ytSyncStaffIdFormDTO . setStaffId ( result . getData ( ) . getUserId ( ) ) ;
ytSyncStaffIdFormDTO . setOperUserId ( fromDTO . getCurrentUserId ( ) ) ;
ytSyncStaffIdFormDTO . setOperUserId ( fromDTO . getCurrentUserId ( ) ) ;
epmetThirdOpenFeignClient . dataSyncUpdateStaff ( ytSyncStaffIdFormDTO ) ;
epmetThirdOpenFeignClient . dataSyncUpdateStaff ( ytSyncStaffIdFormDTO ) ;