Browse Source

perf 修改数字化档案后台导出接口

master
yingsl 3 years ago
parent
commit
7101d85b1c
  1. 3
      src/main/java/com/example/modular/toilet/controller/ToiletController.java
  2. 2
      src/main/java/com/example/modular/toilet/service/IToiletService.java
  3. 6
      src/main/java/com/example/modular/toilet/service/impl/ToiletServiceImpl.java

3
src/main/java/com/example/modular/toilet/controller/ToiletController.java

@ -147,11 +147,12 @@ public class ToiletController {
@GetMapping("/export")
@CrossOrigin
public void exportToilet (HttpServletRequest request,HttpServletResponse response, @RequestParam(value = "toiletName",required = false)String toiletName,
@RequestParam(value = "areaIds",required = false)String areaIds,
@RequestParam(value = "toiletCode",required = false)String toiletCode,
@RequestParam(value = "toiletType",required = false)Integer toiletType,@RequestParam(value = "toiletLevel",required = false)Integer toiletLevel,
@RequestParam(value = "thirdBathroom",required = false)Integer thirdBathroom,@RequestParam(value = "monChildRoom",required = false)Integer monChildRoom) {
String userToken = request.getHeader("token");
toiletService.exportToilet(userToken,response,toiletName,toiletCode,toiletType,toiletLevel,thirdBathroom,monChildRoom);
toiletService.exportToilet(userToken,response,toiletName,toiletCode,toiletType,toiletLevel,thirdBathroom,monChildRoom,areaIds);
}

2
src/main/java/com/example/modular/toilet/service/IToiletService.java

@ -88,7 +88,7 @@ public interface IToiletService extends IService<Toilet> {
* @param monChildRoom
* @author ysl
*/
void exportToilet(String userToken,HttpServletResponse response,String toiletName,String toiletCode,Integer toiletType,Integer toiletLevel,Integer thirdBathroom,Integer monChildRoom);
void exportToilet(String userToken,HttpServletResponse response,String toiletName,String toiletCode,Integer toiletType,Integer toiletLevel,Integer thirdBathroom,Integer monChildRoom,String areaIds);
/**
* 根据厕所id查询厕所详细信息

6
src/main/java/com/example/modular/toilet/service/impl/ToiletServiceImpl.java

@ -707,7 +707,8 @@ public class ToiletServiceImpl extends ServiceImpl<ToiletMapper, Toilet> impleme
@Override
public void exportToilet(String userToken,HttpServletResponse response, String toiletName,String toiletCode, Integer toiletType, Integer toiletLevel, Integer thirdBathroom, Integer monChildRoom) {
public void exportToilet(String userToken,HttpServletResponse response, String toiletName,String toiletCode,
Integer toiletType, Integer toiletLevel, Integer thirdBathroom, Integer monChildRoom,String areaIds) {
//根据token获取登录账户信息
UserInfoVO userInfoVO = userInfoService.getUserInfo(userToken);
if (userInfoVO == null) {
@ -717,6 +718,9 @@ public class ToiletServiceImpl extends ServiceImpl<ToiletMapper, Toilet> impleme
return;
}
List<String> areaIdList = Arrays.asList(userInfoVO.getRegionIds().split(","));
if (StringUtils.isNotBlank(areaIds)) {
areaIdList = Arrays.asList(areaIds.split(","));
}
List<ToiletVO> voList = getVoList (toiletName,toiletCode,toiletType,toiletLevel,thirdBathroom,monChildRoom,areaIdList);
// 每次写100行数据就刷新数据出缓存
SXSSFWorkbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory,

Loading…
Cancel
Save