From fbc377c9221d70dd9021b9e6a3321dec6250769d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 10 Dec 2021 11:09:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=8E=AA=E6=96=BD=EF=BC=8C?= =?UTF-8?q?=E5=88=97=E8=A1=A8-=E5=AF=BC=E5=87=BA=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/demand/PageListAnalysisFormDTO.java | 2 + .../demand/DemandRecExcelResultDTO.java | 52 +++++++++++++++++++ .../controller/IcUserDemandRecController.java | 28 ++++++++-- .../impl/IcUserDemandRecServiceImpl.java | 16 ++++-- .../resources/mapper/IcUserDemandRecDao.xml | 2 +- 5 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecExcelResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java index c98dad4730..9add161aca 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java @@ -47,4 +47,6 @@ public class PageListAnalysisFormDTO implements Serializable { * orgType=agency时pid拼接上orgId */ private String gridPids; + + private Boolean pageFlag; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecExcelResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecExcelResultDTO.java new file mode 100644 index 0000000000..eaf3bdee36 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecExcelResultDTO.java @@ -0,0 +1,52 @@ +package com.epmet.dto.result.demand; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class DemandRecExcelResultDTO implements Serializable { + + private static final long serialVersionUID = -1110606022410166621L; + + @Excel(name = "状态", width = 15) + private String statusName; + + @Excel(name = "所属网格", width = 40) + private String gridName; + + @Excel(name = "需求类型", width = 40) + private String categoryName; + + @Excel(name = "需求内容", width = 40) + private String content; + + @Excel(name = "上报类型", width = 40) + private String reportTypeName; + + @Excel(name = "上报人", width = 20) + private String reportUserName; + + @Excel(name = "上报时间", width = 25) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date reportTime; + + @Excel(name = "需求人", width = 20) + private String demandUserName; + + /** + * 尹作梅(志愿者) + * XXX(社会组织) + * XXX(社区自组织) + * XXX(区域化党建单位) + */ + @Excel(name = "服务方", width = 15) + private String serviceShowName; + + @Excel(name = "服务时间", width = 25) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date wantServiceTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 6666d90311..666243eee0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java @@ -20,22 +20,22 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.UserDemandConstant; import com.epmet.dto.form.demand.*; -import com.epmet.dto.result.demand.DemandRecResultDTO; -import com.epmet.dto.result.demand.DemandResearchAnalysisResultDTO; -import com.epmet.dto.result.demand.IcResiUserReportDemandRes; -import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.demand.*; import com.epmet.service.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; 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.List; @@ -233,8 +233,28 @@ public class IcUserDemandRecController { */ @PostMapping("pagelist-analysis") public Result> pageListAnalysis(@LoginUser TokenDto tokenDto,@RequestBody PageListAnalysisFormDTO formDTO){ + formDTO.setPageFlag(true); formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO,PageListAnalysisFormDTO.AddUserShowGroup.class,PageListAnalysisFormDTO.AddUserInternalGroup.class); return new Result>().ok(icUserDemandRecService.pageListAnalysis(formDTO)); } + + /** + * 数据分析-服务措施分析-导出 + * @param response + * @param tokenDto + * @param formDTO + * @throws Exception + */ + @PostMapping("analysis-export") + public Result analysisExport(HttpServletResponse response,@LoginUser TokenDto tokenDto, @RequestBody PageListAnalysisFormDTO formDTO)throws Exception { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setPageFlag(false); + PageData res=icUserDemandRecService.pageListAnalysis(formDTO); + if (!CollectionUtils.isEmpty(res.getList())) { + ExcelUtils.exportExcelToTarget(response, null, res.getList(), DemandRecExcelResultDTO.class); + return new Result(); + } + return new Result(); + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java index 6da6c4e93e..51bc5fc35c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java @@ -629,9 +629,16 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl pageInfo= PageHelper.startPage(formDTO.getPageNo(), - formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageListAnalysis(formDTO)); - List list=pageInfo.getList(); + long total=NumConstant.ZERO; + List list=new ArrayList<>(); + if(formDTO.getPageFlag()){ + PageInfo pageInfo= PageHelper.startPage(formDTO.getPageNo(), + formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageListAnalysis(formDTO)); + list=pageInfo.getList(); + total=pageInfo.getTotal(); + }else{ + list=baseDao.pageListAnalysis(formDTO); + } if(CollectionUtils.isNotEmpty(list)){ //1、查询网格信息 List gridIds=list.stream().map(DemandRecResultDTO::getGridId).collect(Collectors.toList()); @@ -686,8 +693,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl(list, pageInfo.getTotal()); + return new PageData<>(list, total); } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml index 2bd535800a..804ddac6d6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml @@ -246,7 +246,7 @@ and r.GRID_ID=#{orgId} - + AND r.GRID_PIDS LIKE concat(#{gridPids},'%')