From 6aa6dc075078cca11be048a267911bd7f74dadcd Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期日, 16 三月 2025 03:48:00 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev-2.0' into dev-2.0 --- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java | 126 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 126 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java index 1f23d44..1d3f306 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java @@ -1,11 +1,14 @@ package com.panzhihua.sangeshenbian.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.idev.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.deepoove.poi.XWPFTemplate; import com.panzhihua.common.model.vos.LoginUserInfoVO; +import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.model.dto.ComplaintCompletionDTO; import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO; import com.panzhihua.sangeshenbian.model.entity.Complaint; @@ -18,6 +21,8 @@ import com.panzhihua.sangeshenbian.model.entity.ComplaintFlow; import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress; import com.panzhihua.sangeshenbian.model.entity.SystemUser; +import com.panzhihua.sangeshenbian.model.excel.ComplaintExcel; +import com.panzhihua.sangeshenbian.model.excel.PartyMemberExcel; import com.panzhihua.sangeshenbian.model.query.BasePage; import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; import com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO; @@ -29,16 +34,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import com.panzhihua.sangeshenbian.service.ISystemUserService; +import com.panzhihua.sangeshenbian.utils.FileUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -65,6 +79,8 @@ private final IComStreetService comStreetService; private final IComActService comActService; private final IWorkOrderItemConfigService workOrderItemConfigService; + private final IComplaintCommentService complaintCommentService; + private final HttpServletResponse response; private final IPartyMemberService partyMemberService; private final IComplaintCommentService complaintCommentService; @@ -873,6 +889,116 @@ .eq(ComplaintAuditRecord::getLatestFlag, true) .last("LIMIT 1").one(); } + + /** + * 管理后台-诉求列表 + * + * @param query + * @param loginUserInfo + * @return + */ + @Override + public Page<ComplaintVO> pageList(ComplaintQuery query, SystemUserVo loginUserInfo) { + return baseMapper.pageList(new Page<>(query.getPageNum(), query.getPageSize()), query,loginUserInfo); + } + + @Override + public ComplaintVO getDetailMgt(Long id) { + Complaint complaint = getById(id); + ComplaintVO complaintVO = BeanUtil.copyProperties(complaint, ComplaintVO.class); + //查询办理进度 + List<ComplaintProgress> complaintProgresses = complaintProgressService.lambdaQuery().eq(ComplaintProgress::getComplaintId, id).orderByAsc(ComplaintProgress::getCreateTime).list(); + complaintVO.setComplaintProgresses(complaintProgresses); + //查询诉求流转记录 + List<ComplaintFlow> complaintFlows = complaintFlowService.lambdaQuery().eq(ComplaintFlow::getComplaintId, id).orderByAsc(ComplaintFlow::getCreateTime).list(); + complaintVO.setComplaintFlows(complaintFlows); + //查询评价 + ComplaintComment comment = complaintCommentService.lambdaQuery().eq(ComplaintComment::getComplaintId, id).last("LIMIT 1").one(); + complaintVO.setComplaintComment(comment); + return complaintVO; + } + + /** + * 诉求列表导出 + * @param query + * @param loginUserInfo + */ + @Override + public void export(ComplaintQuery query, SystemUserVo loginUserInfo) throws IOException { + List<ComplaintVO> list = baseMapper.getList(query, loginUserInfo); + List<ComplaintExcel> complaintExcels = BeanUtil.copyToList(list, ComplaintExcel.class); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + String fileName = URLEncoder.encode("诉求数据", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); + EasyExcel.write(response.getOutputStream(), PartyMemberExcel.class) + .sheet("诉求数据") + .doWrite(complaintExcels); + } + + @Override + public void communityProblem(Long id) throws IOException { + //Complaint complaint = getById(id); + //TODO 查询真实数据 + Map<String, Object> map = new HashMap<>(); + map.put("community", "社区社区"); + map.put("problemType", "就业"); + map.put("descriptionContent", "描述内容"); + map.put("reportType", "党员"); + map.put("partyOrganization", "石羊党群"); + map.put("name", "张三"); + map.put("contactNumber", "1888888888"); + map.put("nickname", "李四"); + map.put("phone", "17777777777"); + // 在文本中直接使用换行符 + String content = "第一行内容\n第二行内容\n第三行内容"; + map.put("complaintProgress", content); + map.put("status", "处理中"); + response.setContentType("application/octet-stream"); + String fileName = URLEncoder.encode("社区问题单", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition","attachment;filename=\""+fileName+".docx"+"\""); + String fileTemplateName = FileUtil.getPath() + "template/社区问题单.docx"; + XWPFTemplate.compile(fileTemplateName).render(map).writeAndClose(response.getOutputStream()); + } + /** + * 问题处理单 + * @param id + */ + @Override + public void problemHandle(Long id) { + + } + /** + * 协调通知 + * @param id + */ + @Override + public void coordinationNotice(Long id) { + + } + + public static void main(String[] args) { + try { + /*文本*/ + Map<String, Object> map = new HashMap<>(); + map.put("community", "社区社区"); + map.put("problemType", "就业"); + map.put("descriptionContent", "描述内容"); + map.put("reportType", "党员"); + map.put("partyOrganization", "石羊党群"); + map.put("name", "张三"); + map.put("contactNumber", "1888888888"); + map.put("nickname", "李四"); + map.put("phone", "17777777777"); + // 在文本中直接使用换行符 + String content = "第一行内容\n第二行内容\n第三行内容"; + map.put("complaintProgress", content); + map.put("status", "处理中"); + XWPFTemplate.compile("F:\\DeskTop\\zhihuishequ\\springcloud_k8s_panzhihuazhihuishequ\\service_sangeshenbian\\src\\main\\resources\\template\\社区问题单.docx").render(map).writeToFile("F:\\DeskTop\\社区.docx"); + } catch (IOException e) { + e.printStackTrace(); + } + } /** -- Gitblit v1.7.1