|
|
@ -2,12 +2,17 @@ package com.epmet.controller; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.dto.form.CollectListFormDTO; |
|
|
|
import com.epmet.dto.form.IcResiCollectFormDTO; |
|
|
|
import com.epmet.dto.result.CollectListExcelResultDTO; |
|
|
|
import com.epmet.dto.result.CollectListMemberExcelResultDTO; |
|
|
|
import com.epmet.dto.result.CollectListResultDTO; |
|
|
|
import com.epmet.service.IcResiCollectService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -16,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
@ -68,4 +75,37 @@ public class IcResiCollectController { |
|
|
|
return new Result<PageData<CollectListResultDTO>>().ok(icResiCollectService.getCollectList(formDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 查询采集居民信息 |
|
|
|
* @param formDTO |
|
|
|
* @param tokenDto |
|
|
|
* @author zxc |
|
|
|
* @date 2022/3/18 19:23 |
|
|
|
*/ |
|
|
|
@PostMapping("export") |
|
|
|
public void export(@RequestBody CollectListFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws Exception { |
|
|
|
//ValidatorUtils.validateEntity(formDTO,CollectListFormDTO.CollectListForm.class);
|
|
|
|
//tokenDto.setUserId("73ae6280e46a6653a5605d51d5462725");
|
|
|
|
//tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc");
|
|
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
formDTO.setPage(false); |
|
|
|
PageData<CollectListResultDTO> collectList = icResiCollectService.getCollectList(formDTO); |
|
|
|
List<CollectListExcelResultDTO> list = ConvertUtils.sourceToTarget(collectList.getList(),CollectListExcelResultDTO.class); |
|
|
|
|
|
|
|
collectList.getList().forEach(o->{ |
|
|
|
List<CollectListMemberExcelResultDTO> children = new ArrayList<>(); |
|
|
|
o.getList().forEach(item->{ |
|
|
|
CollectListMemberExcelResultDTO resultDTO = ConvertUtils.sourceToTarget(item, CollectListMemberExcelResultDTO.class); |
|
|
|
resultDTO.setYmjz(item.getYmjz() == null? StrConstant.EPMETY_STR:String.valueOf(item.getYmjz())); |
|
|
|
children.add(resultDTO); |
|
|
|
}); |
|
|
|
CollectListExcelResultDTO resultDTO = ConvertUtils.sourceToTarget(o, CollectListExcelResultDTO.class); |
|
|
|
resultDTO.setListP(children); |
|
|
|
list.add(resultDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, CollectListExcelResultDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|