3 changed files with 78 additions and 0 deletions
@ -0,0 +1,61 @@ |
|||
package com.elink.esua.epdc.modules.epidemic.service.impl; |
|||
|
|||
import cn.afterturn.easypoi.handler.inter.IExcelExportServer; |
|||
import cn.hutool.core.collection.CollUtil; |
|||
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|||
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; |
|||
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|||
import com.elink.esua.epdc.dto.PersonTestingPageDTO; |
|||
import com.elink.esua.epdc.modules.epidemic.dao.PersonTestingDao; |
|||
import com.elink.esua.epdc.modules.epidemic.excel.PersonTestingExcel; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 人员信息数据导出 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @date 2021/6/17 14:04 |
|||
*/ |
|||
@Service |
|||
public class PersonTestingExportServer implements IExcelExportServer { |
|||
|
|||
@Autowired |
|||
private PersonTestingDao personTestingDao; |
|||
|
|||
@Override |
|||
public List<Object> selectListForExcelExport(Object queryParams, int page) { |
|||
Map<String, Object> params = (Map<String, Object>) queryParams; |
|||
params.put("excelBigDataPageSize", 30000); |
|||
params.put("excelBigDataPageIndex", (page - 1) * 30000); |
|||
|
|||
UserDetail user = SecurityUser.getUser(); |
|||
if (user == null) { |
|||
throw new RenException("用户未登录"); |
|||
} |
|||
// 街道和超管有权查看所有数据
|
|||
if (NumConstant.ZERO == user.getSuperAdmin() && user.getDeptId() != 1258587398679126017L) { |
|||
params.put("deptIdList", user.getDeptIdList()); |
|||
params.put("creatorId", user.getId()); |
|||
} |
|||
|
|||
List<PersonTestingPageDTO> recordList = personTestingDao.getTestingPage(params); |
|||
List<Object> targetList = new ArrayList<>(); |
|||
if (CollUtil.isNotEmpty(recordList)) { |
|||
Object target; |
|||
for (int i = 0; i < recordList.size(); i++) { |
|||
target = new PersonTestingExcel(); |
|||
BeanUtils.copyProperties(recordList.get(i), target); |
|||
targetList.add(target); |
|||
} |
|||
} |
|||
return targetList; |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue