puhanshu
2021-11-18 c978d5355ae21d983dbd9129e4889938e9ea05f5
居家隔离修改
7个文件已修改
1个文件已添加
570 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/reserve/HomeQuarantineRegisterStatisticsVO.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActReserveApi.java 390 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActReserveApi.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActReserveAnswerContentMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActReserveAnswerContentService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveAnswerContentServiceImpl.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveAnswerContentMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/reserve/HomeQuarantineRegisterStatisticsVO.java
New file
@@ -0,0 +1,40 @@
package com.panzhihua.common.model.vos.community.reserve;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: HomeQuarantineRegisterStatisticsVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 居家隔离统计信息
 * @author: hans
 * @date: 2021/11/17 15:25
 */
@Data
@ApiModel("居家隔离统计信息")
public class HomeQuarantineRegisterStatisticsVO {
    @ApiModelProperty("记录id")
    private Long id;
    @ApiModelProperty("用户id")
    private Long userId;
    @ApiModelProperty("提交时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ApiModelProperty("用户昵称")
    private String reserveSubContent;
    @ApiModelProperty("用户昵称")
    private String answerContent;
    @ApiModelProperty("题目id")
    private Long reserveSubId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -7192,4 +7192,12 @@
     */
    @GetMapping("/activity/my-evaluate")
    R listMyActivityEvaluate(@RequestParam("userId") Long userId, @RequestParam("activityId") Long activityId);
    /**
     * 分页查询居家隔离统计
     * @param detailedAdminDTO
     * @return
     */
    @PostMapping("/reserve/admin/register/homeQuarantine/page")
    R pageRegisterHomeQuarantine(PageReserveRegisterDetailedAdminDTO detailedAdminDTO);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActReserveApi.java
@@ -1,5 +1,23 @@
package com.panzhihua.community_backstage.api;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
@@ -12,38 +30,47 @@
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.enums.ReserveRecordStatusEnum;
import com.panzhihua.common.model.dtos.community.QuestnaireAnswersDTO;
import com.panzhihua.common.model.dtos.community.reserve.*;
import com.panzhihua.common.model.dtos.community.reserve.AddReserveAdminDTO;
import com.panzhihua.common.model.dtos.community.reserve.CancelReserveRecordDTO;
import com.panzhihua.common.model.dtos.community.reserve.ComActReserveMakeStatisticsDTO;
import com.panzhihua.common.model.dtos.community.reserve.ComActReserveRegisterStatisticsDTO;
import com.panzhihua.common.model.dtos.community.reserve.EditComActReserveInfoDTO;
import com.panzhihua.common.model.dtos.community.reserve.EditComActReserveStatusDTO;
import com.panzhihua.common.model.dtos.community.reserve.EditReserveAdminDTO;
import com.panzhihua.common.model.dtos.community.reserve.MakeHandleAdminDTO;
import com.panzhihua.common.model.dtos.community.reserve.PageReserveAdminDTO;
import com.panzhihua.common.model.dtos.community.reserve.PageReserveMakeAdminDTO;
import com.panzhihua.common.model.dtos.community.reserve.PageReserveMakeHandleAdminDTO;
import com.panzhihua.common.model.dtos.community.reserve.PageReserveRegisterDetailedAdminDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActQuestnaireAnswerContentVO;
import com.panzhihua.common.model.vos.community.ComActQuestnaireSubVO;
import com.panzhihua.common.model.vos.community.ComCvtBusinessVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationExcelVo;
import com.panzhihua.common.model.vos.community.questnaire.QuestnaireStatisticsSummaryExcelAdminVO;
import com.panzhihua.common.model.vos.community.reserve.*;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveListAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeDetailAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeDetailedExcelAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeHandleExcelAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeHandleListAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeListAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeRightExcelAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeRightStatisticsAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveMakeStatisticsAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterDetailedVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterExcelAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterStatisticsAdminVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveSubListVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.*;
import com.panzhihua.common.utlis.AssemblyUtils;
import com.panzhihua.common.utlis.HomeQuarantineUtil;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.community_backstage.config.SFTPConfig;
import com.panzhihua.community_backstage.excel.CustemSecondhandler;
import com.panzhihua.community_backstage.excel.Custemhandler;
import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @description: 预约登记接口
@@ -467,198 +494,6 @@
    @ApiOperation(value = "导出登记明细")
    @PostMapping("/register/list/export")
    public R exportRegister(@RequestBody PageReserveRegisterDetailedAdminDTO pageReserveRegisterDetailedAdminDTO) {
        String name="";
        R r=communityService.detailReserveAdmin(pageReserveRegisterDetailedAdminDTO.getReserveId());
        ComActReserveDetailAdminVO comActReserveDetailAdminVO=JSON.parseObject(JSON.toJSONString(r.getData()),ComActReserveDetailAdminVO.class);
        if(comActReserveDetailAdminVO.getTitle().contains("居家隔离")){
            name = "居家隔离导出数据.xlsx";
        }
        else {
            name = "登记明细导出数据.xlsx";
        }
        String ftpUrl = "/mnt/data/web/excel/";
        String noHaed = "承诺";
        List<List<Object>> datalist=new ArrayList<>();
        try {
            SFTPUtil sftp = new SFTPUtil(sftpConfig.getUserName(), sftpConfig.getPassword(), sftpConfig.getHost(), sftpConfig.getPort());
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    /**
                     * 组合导出数据
                     * 用户问卷答案
                     */
                    R QuestnaireAnswersDTOR = communityService.exportRegisterAdmin(pageReserveRegisterDetailedAdminDTO);
                    QuestnaireAnswersDTO questnaireAnswersDTOS = JSON.parseObject(JSON.toJSONString(QuestnaireAnswersDTOR.getData()), QuestnaireAnswersDTO.class);
                    List<ComActQuestnaireSubVO> subVOList = questnaireAnswersDTOS.getSubs();
                    //构造表头
                    List<List<String>> headList = new ArrayList<List<String>>();
                    if(comActReserveDetailAdminVO.getTitle().contains("居家隔离")){
                        String firstRowContent = "重点地区或高风险地区来攀返攀人员信息统计表(居家隔离表)";
                        List<String> head0 = new ArrayList<>();
                        head0.add(firstRowContent);
                        head0.add("登记人昵称");
                        headList.add(head0);
                        List<String> head1 = new ArrayList<>();
                        head1.add(firstRowContent);
                        head1.add("登记时间");
                        headList.add(head1);
                        subVOList.forEach(sub -> {
                            if (sub.getType() != 5 && sub.getType() != 11&&!sub.getContent().contains("今日上午")&&!sub.getContent().contains("今日下午")&&!sub.getContent().contains("今日隔离情况")) {
                                List<String> headn = new ArrayList<>();
                                headn.add(firstRowContent);
                                if(!sub.getContent().equals(noHaed)){
                                    if(sub.getType() == 11){
                                        headn.add(sub.getContent().substring(0, sub.getContent().indexOf("(")));
                                    }else{
                                        headn.add(sub.getContent());
                                    }
                                    headList.add(headn);
                                }
                            }
                        });
                        List<String> head2 = new ArrayList<>();
                        head2.add(firstRowContent);
                        head2.add("隔离体温情况");
                        headList.add(head2);
                        //数据转换
                        datalist = HomeQuarantineUtil.ReserveData(questnaireAnswersDTOS.getAnswers());
                        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
                        //设置头居中
                        headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
                        //设置头字体
                        WriteFont headWriteFont = new WriteFont();
                        headWriteFont.setFontHeightInPoints((short)6);
                        headWriteFont.setBold(true);
                        headWriteCellStyle.setWriteFont(headWriteFont);
                        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
                        //设置表格内容字体
                        WriteFont writeFont = new WriteFont();
                        writeFont.setFontHeightInPoints((short)6);
                        //设置 水平居中
                        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
                        //设置 垂直居中
                        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
                        contentWriteCellStyle.setWriteFont(writeFont);
                        contentWriteCellStyle.setWrapped(true);
                        HorizontalCellStyleStrategy horizontalCellStyleStrategy =
                                new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
                        excelWriter = EasyExcel.write(fileName)
                                .registerWriteHandler(horizontalCellStyleStrategy).registerWriteHandler(new CustemSecondhandler())
                                .build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("登记明细导出数据").head(headList).build();
                        excelWriter.write(datalist, writeSheet);
                        excelWriter.finish();
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    }
                    else {
                        String firstRowContent = "登记明细";
                        List<String> head0 = new ArrayList<>();
                        head0.add(firstRowContent);
                        head0.add("登记人昵称");
                        headList.add(head0);
                        List<String> head1 = new ArrayList<>();
                        head1.add(firstRowContent);
                        head1.add("登记时间");
                        headList.add(head1);
                        subVOList.forEach(sub -> {
                            if (sub.getType() != 5 && sub.getType() != 11) {
                                List<String> headn = new ArrayList<>();
                                headn.add(firstRowContent);
                                if(!sub.getContent().equals(noHaed)){
                                    if(sub.getType() == 11){
                                        headn.add(sub.getContent().substring(0, sub.getContent().indexOf("(")));
                                    }else{
                                        headn.add(sub.getContent());
                                    }
                                    headList.add(headn);
                                }
                            }
                        });
                        //数据转换
                        datalist = AssemblyUtils.ReserveData(questnaireAnswersDTOS.getAnswers());
                        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
                        //设置头居中
                        headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
                        //设置头字体
                        WriteFont headWriteFont = new WriteFont();
                        headWriteFont.setFontHeightInPoints((short)6);
                        headWriteFont.setBold(true);
                        headWriteCellStyle.setWriteFont(headWriteFont);
                        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
                        //设置表格内容字体
                        WriteFont writeFont = new WriteFont();
                        writeFont.setFontHeightInPoints((short)6);
                        //设置 水平居中
                        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
                        //设置 垂直居中
                        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
                        contentWriteCellStyle.setWriteFont(writeFont);
                        contentWriteCellStyle.setWrapped(true);
                        HorizontalCellStyleStrategy horizontalCellStyleStrategy =
                                new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
                        excelWriter = EasyExcel.write(fileName)
                                .registerWriteHandler(horizontalCellStyleStrategy).registerWriteHandler(new Custemhandler())
                                .build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("登记明细导出数据").head(headList).build();
                        excelWriter.write(datalist, writeSheet);
                        excelWriter.finish();
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    }
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (excelWriter != null) {
                        excelWriter.finish();
                    }
                }
            }
            return R.ok(sftpConfig.getExcelUrl() + name);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "导出登记明细")
    @PostMapping("/register/list/export/homeQuarantine")
    public R exportRegisterHomeQuarantine(@RequestBody PageReserveRegisterDetailedAdminDTO pageReserveRegisterDetailedAdminDTO) {
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "登记明细导出数据.xlsx";
        String noHaed = "承诺";
@@ -682,7 +517,7 @@
                    List<ComActQuestnaireSubVO> subVOList = questnaireAnswersDTOS.getSubs();
                    //构造表头
                    List<List<String>> headList = new ArrayList<List<String>>();
                    String firstRowContent = "重点地区或高风险地区来攀返攀人员信息统计表(居家隔离表)";
                    String firstRowContent = "登记明细";
                    List<String> head0 = new ArrayList<>();
                    head0.add(firstRowContent);
                    head0.add("登记人昵称");
@@ -692,7 +527,7 @@
                    head1.add("登记时间");
                    headList.add(head1);
                    subVOList.forEach(sub -> {
                        if (sub.getType() != 5 && sub.getType() != 11&&!sub.getContent().contains("今日上午")&&!sub.getContent().contains("今日下午")&&!sub.getContent().contains("今日隔离情况")) {
                        if (sub.getType() != 5 && sub.getType() != 11) {
                            List<String> headn = new ArrayList<>();
                            headn.add(firstRowContent);
                            if(!sub.getContent().equals(noHaed)){
@@ -705,12 +540,8 @@
                            }
                        }
                    });
                    List<String> head2 = new ArrayList<>();
                    head2.add(firstRowContent);
                    head2.add("隔离体温情况");
                    headList.add(head2);
                    //数据转换
                    List<List<Object>> datalist = HomeQuarantineUtil.ReserveData(questnaireAnswersDTOS.getAnswers());
                    List<List<Object>> datalist = AssemblyUtils.ReserveData(questnaireAnswersDTOS.getAnswers());
                    WriteCellStyle headWriteCellStyle = new WriteCellStyle();
                    //设置头居中
@@ -739,7 +570,7 @@
                    excelWriter = EasyExcel.write(fileName)
                            .registerWriteHandler(horizontalCellStyleStrategy).registerWriteHandler(new Custemhandler())
                            .build();
                            .registerWriteHandler(new CustomSheetWriteHandler()).build();
                    WriteSheet writeSheet = EasyExcel.writerSheet("登记明细导出数据").head(headList).build();
                    excelWriter.write(datalist, writeSheet);
                    excelWriter.finish();
@@ -769,6 +600,125 @@
        }
    }
    @ApiOperation(value = "导出居家隔离统计")
    @PostMapping("/register/list/export/homeQuarantine")
    public R exportRegisterHomeQuarantineStatistics(@RequestBody PageReserveRegisterDetailedAdminDTO pageReserveRegisterDetailedAdminDTO) {
        String name= "居家隔离统计表.xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
        String noHaed = "承诺";
        List<List<Object>> datalist = new ArrayList<>();
        try {
            SFTPUtil sftp = new SFTPUtil(sftpConfig.getUserName(), sftpConfig.getPassword(), sftpConfig.getHost(), sftpConfig.getPort());
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    /**
                     * 组合导出数据
                     * 用户问卷答案
                     */
                    R questnaireAnswersDTOR = communityService.exportRegisterAdmin(pageReserveRegisterDetailedAdminDTO);
                    QuestnaireAnswersDTO questnaireAnswersDTOS = JSON.parseObject(JSON.toJSONString(questnaireAnswersDTOR.getData()), QuestnaireAnswersDTO.class);
                    List<ComActQuestnaireSubVO> subVOList = questnaireAnswersDTOS.getSubs();
                    //构造表头
                    List<List<String>> headList = new ArrayList<List<String>>();
                    String firstRowContent = "重点地区或高风险地区来攀返攀人员信息统计表(居家隔离表)";
                    List<String> head0 = new ArrayList<>();
                    head0.add(firstRowContent);
                    head0.add("登记人昵称");
                    headList.add(head0);
                    List<String> head1 = new ArrayList<>();
                    head1.add(firstRowContent);
                    head1.add("登记时间");
                    headList.add(head1);
                    subVOList.forEach(sub -> {
                        if (sub.getType() != 5 && sub.getType() != 11 && !sub.getContent().contains("今日上午") &&
                                !sub.getContent().contains("今日下午") && !sub.getContent().contains("今日隔离情况")) {
                            List<String> headn = new ArrayList<>();
                            headn.add(firstRowContent);
                            if(!sub.getContent().equals(noHaed)){
                                if(sub.getType() == 11){
                                    headn.add(sub.getContent().substring(0, sub.getContent().indexOf("(")));
                                }else{
                                    headn.add(sub.getContent());
                                }
                                headList.add(headn);
                            }
                        }
                    });
                    List<String> head2 = new ArrayList<>();
                    head2.add(firstRowContent);
                    head2.add("隔离体温情况");
                    headList.add(head2);
                    //数据转换
                    datalist = HomeQuarantineUtil.ReserveData(questnaireAnswersDTOS.getAnswers());
                    WriteCellStyle headWriteCellStyle = new WriteCellStyle();
                    //设置头居中
                    headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
                    //设置头字体
                    WriteFont headWriteFont = new WriteFont();
                    headWriteFont.setFontHeightInPoints((short)6);
                    headWriteFont.setBold(true);
                    headWriteCellStyle.setWriteFont(headWriteFont);
                    WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
                    //设置表格内容字体
                    WriteFont writeFont = new WriteFont();
                    writeFont.setFontHeightInPoints((short)6);
                    //设置 水平居中
                    contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
                    //设置 垂直居中
                    contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
                    contentWriteCellStyle.setWriteFont(writeFont);
                    contentWriteCellStyle.setWrapped(true);
                    HorizontalCellStyleStrategy horizontalCellStyleStrategy =
                            new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
                    excelWriter = EasyExcel.write(fileName)
                            .registerWriteHandler(horizontalCellStyleStrategy).registerWriteHandler(new CustemSecondhandler())
                            .build();
                    WriteSheet writeSheet = EasyExcel.writerSheet("居家隔离统计表").head(headList).build();
                    excelWriter.write(datalist, writeSheet);
                    excelWriter.finish();
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (excelWriter != null) {
                        excelWriter.finish();
                    }
                }
            }
            return R.ok(sftpConfig.getExcelUrl() + name);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "分页查询居家隔离统计", response = ComActReserveRegisterDetailedVO.class)
    @PostMapping("/register/homeQuarantine/page")
    public R pageRegisterHomeQuarantine(@RequestBody PageReserveRegisterDetailedAdminDTO detailedAdminDTO) {
        return communityService.pageRegisterHomeQuarantine(detailedAdminDTO);
    }
    @ApiOperation(value = "查询题目列表", response = ComActReserveSubListVO.class)
    @GetMapping("/subject/list")
    public R subjectList(@RequestParam("reserveId") Long reserveId) {
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActReserveApi.java
@@ -322,4 +322,14 @@
    public R list(@RequestParam("communityId") Long communityId){
        return comActReserveService.reserveListApplets(communityId);
    }
    /**
     * 分页查询居家隔离统计
     * @param detailedAdminDTO
     * @return
     */
    @PostMapping("/admin/register/homeQuarantine/page")
    public R pageRegisterHomeQuarantine(@RequestBody PageReserveRegisterDetailedAdminDTO detailedAdminDTO) {
        return comActReserveAnswerContentService.pageRegisterHomeQuarantine(detailedAdminDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActReserveAnswerContentMapper.java
@@ -7,6 +7,7 @@
import com.panzhihua.common.model.vos.community.ComActQuestnaireAnswerContentVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterDetailedAnswerVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterDetailedVO;
import com.panzhihua.common.model.vos.community.reserve.HomeQuarantineRegisterStatisticsVO;
import com.panzhihua.service_community.model.dos.ComActReserveAnswerContentDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -50,4 +51,7 @@
    ComActReserveRegisterDetailedVO getRegisterDetailedById(@Param("reserveRecordId") Long reserveRecordId);
    IPage<String> pageRegisterHomeQuarantine(@Param("page") Page page, @Param("detailedAdminDTO") PageReserveRegisterDetailedAdminDTO detailedAdminDTO);
    List<HomeQuarantineRegisterStatisticsVO> selectStatistics(@Param("reserveId") Long reserveId, @Param("record") String record);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActReserveAnswerContentService.java
@@ -26,4 +26,10 @@
     */
    R registerDetailedListAdmin(PageReserveRegisterDetailedAdminDTO detailedAdminDTO);
    /**
     * 分页查询居家隔离统计
     * @param detailedAdminDTO
     * @return
     */
    R pageRegisterHomeQuarantine(PageReserveRegisterDetailedAdminDTO detailedAdminDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveAnswerContentServiceImpl.java
@@ -1,5 +1,15 @@
package com.panzhihua.service_community.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -9,25 +19,18 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActQuestnaireAnswerContentVO;
import com.panzhihua.common.model.vos.community.ComActQuestnaireSubVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRecordListVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterDetailedAnswerVO;
import com.panzhihua.common.model.vos.community.reserve.ComActReserveRegisterDetailedVO;
import com.panzhihua.common.model.vos.community.reserve.HomeQuarantineRegisterStatisticsVO;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.ComActReserveAnswerContentMapper;
import com.panzhihua.service_community.dao.ComActReserveSubMapper;
import com.panzhihua.service_community.model.dos.ComActQuestnaireAnswerContentDO;
import com.panzhihua.service_community.model.dos.ComActQuestnaireSubDO;
import com.panzhihua.service_community.model.dos.ComActReserveAnswerContentDO;
import com.panzhihua.service_community.model.dos.ComActReserveSubDO;
import com.panzhihua.service_community.service.ComActReserveAnswerContentService;
import com.panzhihua.service_community.service.ComActReserveSubService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
/**
 * @auther lyq
@@ -125,4 +128,63 @@
        resultPage.setRecords(resultMapList);
        return R.ok(resultPage);
    }
    /**
     * 分页查询居家隔离统计
     * @param detailedAdminDTO
     * @return
     */
    @Override
    public R pageRegisterHomeQuarantine(PageReserveRegisterDetailedAdminDTO detailedAdminDTO) {
        IPage<HashMap<String,String>> resultPage = new Page<>();
        Page page = new Page(detailedAdminDTO.getPageNum(), detailedAdminDTO.getPageSize());
        IPage<String> statisticsVOIPage = this.baseMapper.pageRegisterHomeQuarantine(page, detailedAdminDTO);
        resultPage.setCurrent(statisticsVOIPage.getCurrent());
        resultPage.setTotal(statisticsVOIPage.getTotal());
        resultPage.setSize(statisticsVOIPage.getSize());
        resultPage.setPages(statisticsVOIPage.getPages());
        List<String> records = statisticsVOIPage.getRecords();
        List<HashMap<String,String>> resultMapList = new ArrayList<>();
        if (!records.isEmpty()) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            int nub = 1;
            for (String record : records) {
                //渲染序号
                HashMap<String,String> map = new HashMap<>();
                map.put("nub", nub + "");
                List<HomeQuarantineRegisterStatisticsVO> statisticsList = this.baseMapper.selectStatistics(detailedAdminDTO.getReserveId(), record);
                StringBuffer conditions = new StringBuffer();
                statisticsList.forEach(e -> {
                    //渲染登记时间
                    map.put("time", DateUtils.format(e.getCreateAt(), DateUtils.ymdhms_format));
                    String reserveSubContent = e.getReserveSubContent();
                    String dateString = dateFormat.format(e.getCreateAt());
                    if (reserveSubContent.contains("上午体温")) {
                        if (conditions.indexOf(dateString + " " + "上午体温") == -1) {
                            conditions.append(dateString + " " + "上午体温:" + e.getAnswerContent() + "℃" + "\n");
                        }
                    } else if (reserveSubContent.contains("下午体温")) {
                        if (conditions.indexOf(dateString + " " + "下午体温") == -1) {
                            conditions.append(dateString + " " + "下午体温:" + e.getAnswerContent() + "℃" + "\n");
                        }
                    } else if (reserveSubContent.contains("隔离情况")) {
                        if (conditions.indexOf(dateString + " " + "当日隔离情况") == -1) {
                            conditions.append(dateString + " " + "当日隔离情况:" + e.getAnswerContent() + "\n");
                            conditions.append("————————" + "\n");
                        }
                    } else {
                        map.put(e.getReserveSubId() + "", e.getAnswerContent());
                    }
                });
                map.put("isolation", conditions.toString());
                resultMapList.add(map);
                nub++;
            }
        }
        resultPage.setRecords(resultMapList);
        return R.ok(resultPage);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveAnswerContentMapper.xml
@@ -138,4 +138,36 @@
        GROUP BY ac.id ) ac left join sys_user t on ac.user_id = t.user_id
        order by ac.reserve_record_id desc,ac.id asc
    </select>
    <select id="pageRegisterHomeQuarantine" resultType="java.lang.String">
        SELECT answer_content FROM (
        SELECT carr.id, carac.answer_content
        FROM com_act_reserve_record AS carr
        LEFT JOIN com_act_reserve_answer_content carac ON carr.id=carac.reserve_record_id
        LEFT JOIN com_act_reserve_sub t ON carac.reserve_sub_id = t.id
        WHERE carr.reserve_id = #{detailedAdminDTO.reserveId} AND t.content LIKE '身份证%'
        <if test='detailedAdminDTO.startTime != null and detailedAdminDTO.startTime != &quot;&quot;'>
            AND carr.create_at <![CDATA[ >= ]]> #{detailedAdminDTO.startTime}
        </if>
        <if test='detailedAdminDTO.endTime != null and detailedAdminDTO.endTime != &quot;&quot;'>
            AND carr.create_at <![CDATA[ <= ]]> #{detailedAdminDTO.endTime}
        </if>
        <if test="detailedAdminDTO.keyword!=null and detailedAdminDTO.keyword != &quot;&quot;">
            AND carac.answer_content LIKE CONCAT (#{detailedAdminDTO.keyword},'%')
        </if>
        ORDER BY carr.id DESC LIMIT 9999999
        ) temp GROUP BY answer_content ORDER BY id DESC
    </select>
    <select id="selectStatistics"
            resultType="com.panzhihua.common.model.vos.community.reserve.HomeQuarantineRegisterStatisticsVO">
        SELECT carr.id, carr.create_at, carac.reserve_record_id, car.content AS reserveSubContent,
        carac.answer_content AS answerContent, carac.reserve_sub_id AS reserveSubId, car.`type`
        FROM com_act_reserve_record AS carr
        LEFT JOIN com_act_reserve_answer_content carac ON carr.id=carac.reserve_record_id
        LEFT JOIN com_act_reserve_sub AS car ON carac.reserve_sub_id = car.id
        WHERE carr.id IN (
            SELECT t1.reserve_record_id FROM com_act_reserve_answer_content t1
            LEFT JOIN com_act_reserve_record t2 ON t1.reserve_record_id = t2.id
            WHERE t2.reserve_id = #{reserveId} AND t1.answer_content = #{record}
        ) ORDER BY carr.id ASC
    </select>
</mapper>