报表分享支持次账号

This commit is contained in:
Harryxzy 2024-06-26 11:33:12 +08:00
parent 63c7477966
commit 933fc8ae65
6 changed files with 75 additions and 4 deletions

View File

@ -61,6 +61,23 @@ public class EmployBiz extends BaseBean {
}
}
public List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<DataCollectionEmployee> dataList = new ArrayList<>();
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<List<Long>> partition = Lists.partition(list, 1000);
for (List<Long> longs : partition) {
dataList.addAll(mapper.getEmployeeByIdsIncludeAccountType(longs));
}
return dataList;
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> getEmployeeByIdsAll(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {

View File

@ -35,6 +35,13 @@ public interface EmployMapper {
*/
List<DataCollectionEmployee> getEmployeeByIds(@Param("collection") List<Long> ids);
/**
* 单表查询 包括次账号
* @param ids
* @return
*/
List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(@Param("collection") List<Long> ids);
/**
* 多表联查
* @param ids

View File

@ -36,6 +36,25 @@
</if>
</select>
<select id="getEmployeeByIdsIncludeAccountType" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.certificatenum as idNo,
e.status as status,
e.workcode as workcode,
e.companystartdate as companystartdate,
e.mobile as mobile,
e.workyear as workYear
from hrmresource e
where e.status not in (7)
<if test="collection != null and collection.size()>0">
AND e.id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="getEmployeeByIdsAll" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,

View File

@ -200,7 +200,7 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
public void sendMsg(SalaryStatisticsPushParam param) {
// 获取被分享人
List<DataCollectionEmployee> receivers = getSalaryEmployeeService(user).getEmployeeByIds(param.getSharedBy());
List<DataCollectionEmployee> receivers = getSalaryEmployeeService(user).getEmployeeByIdsIncludeAccountType(param.getSharedBy());
// 发送消息
receivers.forEach(receiver -> {
// 发送消息...
@ -679,8 +679,8 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
.effectiveTime(StringUtils.isEmpty(po.getStartTime()) ? "" : po.getStartTime()
+ "——" + (StringUtils.isEmpty(po.getEndTime()) ? "" : po.getEndTime()))
.id(po.getId())
.successPush(buildSuccessPush(groupByBatchId.get(po.getId())))
.sharedView(buildSharedView(groupByBatchId.get(po.getId())))
.successPush(buildSuccessPush(groupByBatchId.getOrDefault(po.getId(), Collections.emptyList())))
.sharedView(buildSharedView(groupByBatchId.getOrDefault(po.getId(), Collections.emptyList())))
.build();
}).collect(Collectors.toList());
dtoPageInfo.setList(dtoList);
@ -699,7 +699,10 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
}
public String buildSuccessPush(List<SalaryStatisticsPushDetailPO> list) {
List<DataCollectionEmployee> employeeByIds = getSalaryEmployeeService(user).getEmployeeByIds(list.stream().filter(po -> Objects.equals(po.getPushStatus(), "true") && !(Objects.equals(po.getRebackStatus(), "true"))).map(SalaryStatisticsPushDetailPO::getEmployeeId).collect(Collectors.toList()));
List<Long> employeeIds = list.stream()
.filter(po -> Objects.equals(po.getPushStatus(), "true") && !(Objects.equals(po.getRebackStatus(), "true")))
.map(SalaryStatisticsPushDetailPO::getEmployeeId).collect(Collectors.toList());
List<DataCollectionEmployee> employeeByIds = getSalaryEmployeeService(user).getEmployeeByIdsIncludeAccountType(employeeIds);
Set<String> employeeName = employeeByIds.stream().map(DataCollectionEmployee::getUsername).collect(Collectors.toSet());
return String.join("", employeeName);
}

View File

@ -69,6 +69,14 @@ public interface SalaryEmployeeService {
*/
List<DataCollectionEmployee> getEmployeeByIds(List<Long> simpleEmployeeIds);
/**
* 获取人员信息 包括次账号
*
* @param simpleEmployeeIds
* @return 简单
*/
List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(List<Long> simpleEmployeeIds);
/**
* 获取当前登录人的信息
* @param employeeId

View File

@ -213,6 +213,23 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
}
@Override
public List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(List<Long> simpleEmployeeIds) {
if (CollectionUtils.isEmpty(simpleEmployeeIds)) {
return new ArrayList<>();
}
List<DataCollectionEmployee> employeeList = new ArrayList<>();
List<List<Long>> partition = Lists.partition(simpleEmployeeIds, 1000);
for (List<Long> longs : partition) {
employeeList.addAll(employBiz.getEmployeeByIdsIncludeAccountType(longs));
if (openExtEmp) {
employeeList.addAll(getExtEmpService(user).getEmployeeByIds(longs));
}
}
return SalaryI18nUtil.i18nList(employeeList);
}
public List<DataCollectionEmployee> filterEmployees(List<DataCollectionEmployee> employees, String userName, String deparmentName, String mobile) {
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))