springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/pom.xml
@@ -76,6 +76,16 @@ <dependency> <groupId>com.panzhihua</groupId> <artifactId>common</artifactId> <exclusions> <exclusion> <artifactId>easypoi-base</artifactId> <groupId>cn.afterturn</groupId> </exclusion> <exclusion> <artifactId>easyexcel</artifactId> <groupId>com.alibaba</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.data</groupId> @@ -133,7 +143,50 @@ <groupId>cn.idev.excel</groupId> <artifactId>fastexcel</artifactId> <version>1.0.0</version> <exclusions> <exclusion> <artifactId>poi</artifactId> <groupId>org.apache.poi</groupId> </exclusion> <exclusion> <artifactId>poi-ooxml</artifactId> <groupId>org.apache.poi</groupId> </exclusion> </exclusions> </dependency> <!--<!– Poi-tl Word 模板引擎–>--> <dependency> <groupId>com.deepoove</groupId> <artifactId>poi-tl</artifactId> <version>1.10.0</version> <exclusions> <exclusion> <artifactId>poi</artifactId> <groupId>org.apache.poi</groupId> </exclusion> <exclusion> <artifactId>poi-ooxml</artifactId> <groupId>org.apache.poi</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId> <version>4.1.2</version> </dependency> </dependencies> springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/MgtComplaintController.java
@@ -1,9 +1,25 @@ package com.panzhihua.sangeshenbian.api; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import com.panzhihua.sangeshenbian.service.IComplaintService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; 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 java.io.IOException; /** * @author mitao @@ -11,7 +27,49 @@ */ @Api(tags = {"三个身边后台-诉求管理"}) @RequestMapping("/complaint") @RestController @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class MgtComplaintController { public class MgtComplaintController extends BaseController { private final IComplaintService complaintService; @ApiOperation("诉求列表") @PostMapping("/page") public R<Page<ComplaintVO>> pageList(@RequestBody ComplaintQuery query) { SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); return R.ok(complaintService.pageList(query,loginUserInfo)); } @ApiOperation("诉求详情") @GetMapping("/detail/{id}") public R<ComplaintVO> detail(@ApiParam(name = "id", value = "诉求id", required = true) @PathVariable("id") Long id) { return R.ok(complaintService.getDetailMgt(id)); } @ApiOperation("诉求列表") @PostMapping("/export") public void export(@RequestBody ComplaintQuery query) { SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); try { complaintService.export(query,loginUserInfo); } catch (IOException e) { throw new RuntimeException(e); } } @ApiOperation("社区问题单") @GetMapping("/community-problem/{id}") public void communityProblem(@ApiParam(name = "id", value = "诉求id", required = true) @PathVariable("id") Long id) { try { complaintService.communityProblem(id); } catch (IOException e) { throw new RuntimeException(e); } } @ApiOperation("问题处理单") @GetMapping("/problem-handle/{id}") public void problemHandle(@ApiParam(name = "id", value = "诉求id", required = true) @PathVariable("id") Long id) { complaintService.problemHandle(id); } @ApiOperation("协调通知单") @GetMapping("/coordination-notice/{id}") public void coordinationNotice(@ApiParam(name = "id", value = "诉求id", required = true) @PathVariable("id") Long id) { complaintService.coordinationNotice(id); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/PartyMemberController.java
@@ -6,11 +6,11 @@ import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.model.entity.PartyMember; import com.panzhihua.sangeshenbian.warpper.PartyMemberImportFailedVO; import com.panzhihua.sangeshenbian.service.IPartyMemberService; import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; @@ -29,6 +29,7 @@ import javax.validation.Valid; import java.io.IOException; import java.util.List; /** * <p> @@ -97,10 +98,13 @@ } @ApiOperation("导入") @PostMapping("/import") public R<?> importExcel(@RequestPart("file") MultipartFile file) { public R<List<PartyMemberImportFailedVO> > importExcel(@RequestPart("file") MultipartFile file) { SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); partyMemberService.importExcel(loginUserInfo); return R.ok(); try { return R.ok(partyMemberService.importExcel(file,loginUserInfo)); } catch (IOException e) { throw new RuntimeException(e); } } @ApiOperation("审核") @GetMapping("/audit/{id}") springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java
@@ -333,4 +333,11 @@ log.info("获取行政区划层级联动数据:{}", list); return R.ok(list); } @GetMapping("/regionTree") @ApiOperation(value = "获取区县-街道-社区树",tags = {"三个身边后台-人员管理"}) public R<List<RegionVO>> regionTree(){ SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); List<RegionVO> list = systemUserService.getRegionTree(loginUserInfo); return R.ok(list); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/dao/ComplaintMapper.java
@@ -1,9 +1,9 @@ package com.panzhihua.sangeshenbian.dao; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.model.entity.Complaint; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.sangeshenbian.model.query.BasePage; import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; import com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO; import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; @@ -64,4 +64,20 @@ * @return */ List<Complaint> getTimeoutAndNotComment(); /** * 诉求分页列表 * @param page * @param query * @param loginUserInfo * @return */ Page<ComplaintVO> pageList(Page<ComplaintVO> page, @Param("query") ComplaintQuery query, @Param("loginUserInfo") SystemUserVo loginUserInfo); /** * 诉求列表 * @param query * @param loginUserInfo */ List<ComplaintVO> getList(ComplaintQuery query, SystemUserVo loginUserInfo); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java
@@ -10,7 +10,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.apache.xalan.templates.VarNameCollector; import java.time.LocalDateTime; springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/excel/ComplaintExcel.java
New file @@ -0,0 +1,45 @@ package com.panzhihua.sangeshenbian.model.excel; import cn.idev.excel.annotation.ExcelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.Date; /** * @author mitao * @date 2025/3/15 */ @Data public class ComplaintExcel { @ExcelProperty(value = "录入人") private String nickname; @ExcelProperty(value = "录入人联系方式") private String phone; @ExcelProperty(value = "群众姓名") private String name; @ExcelProperty(value = "联系电话") private String contactNumber; @ExcelProperty(value = "问题发生时间") private Date time; @ExcelProperty(value = "问题类型") private String problemType; @ExcelProperty(value = "问题描述内容") private String descriptionContent; @ExcelProperty(value = "问题发生地点") private String location; @ExcelProperty(value = "详细地址描述") private String detailedAddress; @ExcelProperty(value = "流转状态:0-正在办理 1-延期办理 2-超时办理 3-已办结 4-群众撤销 5-上报待审核 6-上级驳回 7-延期待审核") private Integer status; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/excel/PartyMemberExcel.java
@@ -2,6 +2,7 @@ import cn.idev.excel.annotation.ExcelProperty; import com.panzhihua.sangeshenbian.annotation.FastExcel; import com.panzhihua.sangeshenbian.annotation.TargetEnum; import com.panzhihua.sangeshenbian.conveter.EConverter; import com.panzhihua.sangeshenbian.enums.FreezeStatusEnum; import com.panzhihua.sangeshenbian.enums.GenderEnum; @@ -18,7 +19,7 @@ private String name; @ExcelProperty(value = {"性别"}, index = 1,converter = EConverter.class) @FastExcel(type = GenderEnum.class) @TargetEnum(type = GenderEnum.class) private Integer gender; @ExcelProperty(value = {"所在社区"}, index = 2) @@ -31,7 +32,7 @@ private String partyOrganization; @ExcelProperty(value = {"审核状态"}, index = 5,converter = EConverter.class) @FastExcel(type = FreezeStatusEnum.class) @TargetEnum(type = FreezeStatusEnum.class) private Integer freezeStatus; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/excel/PartyMemberTemplate.java
@@ -1,10 +1,7 @@ package com.panzhihua.sangeshenbian.model.excel; import cn.idev.excel.annotation.ExcelProperty; import com.panzhihua.sangeshenbian.annotation.FastExcel; import com.panzhihua.sangeshenbian.conveter.EConverter; import com.panzhihua.sangeshenbian.enums.FreezeStatusEnum; import com.panzhihua.sangeshenbian.enums.GenderEnum; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -14,21 +11,27 @@ @Data public class PartyMemberTemplate { @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","姓名"}) @ApiModelProperty(value = "姓名") private String name; @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","联系电话"}) @ApiModelProperty(value = "联系电话") private String phone; @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","身份证号"}) @ApiModelProperty(value = "身份证号") private String idNumber; @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","所在社区"}) @ApiModelProperty(value = "所在社区") private String community; @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","服务对象"}) @ApiModelProperty(value = "服务对象") private String serviceTarget; @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","所在党组织"}) @ApiModelProperty(value = "所在党组织") private String partyOrganization; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java
@@ -1,7 +1,9 @@ package com.panzhihua.sangeshenbian.model.vo; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.panzhihua.sangeshenbian.model.entity.Complaint; import com.panzhihua.sangeshenbian.model.entity.ComplaintComment; import com.panzhihua.sangeshenbian.model.entity.ComplaintFlow; import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress; import io.swagger.annotations.ApiModel; @@ -58,6 +60,9 @@ @ApiModelProperty(value = "审核按钮状态(0=显示,1=隐藏)") private Integer auditButtonStatus; @ApiModelProperty(value = "办结评价") private ComplaintComment complaintComment; @ApiModelProperty(value = "列表操作按钮状态(0=显示,1=隐藏)") private Integer listControlsButtonStatus; springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/RegionVO.java
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; /** * @author mitao * @date 2025/2/28 @@ -15,4 +17,6 @@ private String id; @ApiModelProperty("名称") private String name; @ApiModelProperty("子节点") private List<RegionVO> children; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IBcRegionService.java
@@ -12,5 +12,10 @@ * @since 2025-02-23 */ public interface IBcRegionService extends IService<BcRegion> { /** * 根据名称查询区县信息 * @param districtName * @return */ BcRegion getDistrictByName(String districtName); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComActService.java
@@ -12,5 +12,11 @@ * @since 2025-02-23 */ public interface IComActService extends IService<ComAct> { /** * 根据社区名称和街道id查询社区 * @param communityName * @param streetId * @return */ ComAct getCommunityByNameAndStreet(String communityName, String streetId); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComStreetService.java
@@ -12,5 +12,11 @@ * @since 2025-02-23 */ public interface IComStreetService extends IService<ComStreet> { /** * 根据街道名称和区县编码查询街道信息 * @param streetName * @param regionCode * @return */ ComStreet getStreetByNameAndDistrict(String streetName, String regionCode); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintService.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.dto.*; @@ -15,6 +16,7 @@ import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; import com.panzhihua.sangeshenbian.model.vo.DispatchVO; import java.io.IOException; import java.util.List; /** @@ -109,6 +111,47 @@ */ ComplaintAuditRecord delayDetail(Long complaintId); /** * 管理后台-诉求列表 * * @param query * @param loginUserInfo * @return */ Page<ComplaintVO> pageList(ComplaintQuery query, SystemUserVo loginUserInfo); /** * 管理后台-诉求详情 * @param id * @return */ ComplaintVO getDetailMgt(Long id); /** * 诉求列表导出 * @param query * @param loginUserInfo */ void export(ComplaintQuery query, SystemUserVo loginUserInfo) throws IOException; /** * 社区问题单 * @param id */ void communityProblem(Long id) throws IOException; /** * 问题处理单 * @param id */ void problemHandle(Long id); /** * 协调通知 * @param id */ void coordinationNotice(Long id); /** * 获取超时未评价的数据 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IPartyMemberService.java
@@ -4,10 +4,13 @@ import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.model.entity.PartyMember; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.sangeshenbian.warpper.PartyMemberImportFailedVO; import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.util.List; /** * <p> @@ -56,9 +59,12 @@ /** *导入 * * @param file * @param loginUserInfo * @return */ void importExcel(SystemUserVo loginUserInfo); List<PartyMemberImportFailedVO> importExcel(MultipartFile file, SystemUserVo loginUserInfo) throws IOException; /** * 审核 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/ISystemUserService.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.model.entity.SystemUser; import com.panzhihua.sangeshenbian.model.vo.RegionVO; import com.panzhihua.sangeshenbian.warpper.SystemUserList; @@ -57,4 +58,11 @@ * @return */ List<RegionVO> getCommunity(String streetId); /** * 获取区县-街道-社区树 * @param loginUserInfo * @return */ List<RegionVO> getRegionTree(SystemUserVo loginUserInfo); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/BcRegionServiceImpl.java
@@ -16,5 +16,16 @@ */ @Service public class BcRegionServiceImpl extends ServiceImpl<BcRegionMapper, BcRegion> implements IBcRegionService { /** * 判断区县是否存在 * @param districtName * @return */ @Override public BcRegion getDistrictByName(String districtName) { return this.lambdaQuery() .eq(BcRegion::getRegionName, districtName) .eq(BcRegion::getDeleteFlag, 0) .eq(BcRegion::getHierarchyOrder, 2).last("LIMIT 1").one(); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComActServiceImpl.java
@@ -16,5 +16,14 @@ */ @Service public class ComActServiceImpl extends ServiceImpl<ComActMapper, ComAct> implements IComActService { /** * 根据社区名字和街道id查询社区信息 * @param communityName * @param streetId * @return */ @Override public ComAct getCommunityByNameAndStreet(String communityName, String streetId) { return this.lambdaQuery().eq(ComAct::getName, communityName).eq(ComAct::getStreetId, streetId).last("LIMIT 1").one(); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComStreetServiceImpl.java
@@ -16,5 +16,14 @@ */ @Service public class ComStreetServiceImpl extends ServiceImpl<ComStreetMapper, ComStreet> implements IComStreetService { /** * 根据街道名称和区县编码查询街道信息 * @param streetName * @param regionCode * @return */ @Override public ComStreet getStreetByNameAndDistrict(String streetName, String regionCode) { return this.lambdaQuery().eq(ComStreet::getName, streetName).eq(ComStreet::getAreaCode, regionCode).last("LIMIT 1").one(); } } 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; @@ -874,6 +890,116 @@ .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(); } } /** * 获取超时未评价的数据 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/PartyMemberServiceImpl.java
@@ -1,14 +1,27 @@ package com.panzhihua.sangeshenbian.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.idev.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import cn.idev.excel.FastExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.sangeshenbian.enums.AuditStatusEnum; import com.panzhihua.sangeshenbian.model.entity.BcRegion; import com.panzhihua.sangeshenbian.model.entity.ComAct; import com.panzhihua.sangeshenbian.model.entity.ComStreet; import com.panzhihua.sangeshenbian.model.entity.PartyMember; import com.panzhihua.sangeshenbian.dao.PartyMemberMapper; import com.panzhihua.sangeshenbian.model.excel.PartyMemberExcel; import com.panzhihua.sangeshenbian.warpper.PartyMemberImportFailedVO; import com.panzhihua.sangeshenbian.model.excel.PartyMemberTemplate; import com.panzhihua.sangeshenbian.service.IBcRegionService; import com.panzhihua.sangeshenbian.service.IComActService; import com.panzhihua.sangeshenbian.service.IComStreetService; import com.panzhihua.sangeshenbian.service.IPartyMemberService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; @@ -16,10 +29,13 @@ import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -36,6 +52,9 @@ @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class PartyMemberServiceImpl extends ServiceImpl<PartyMemberMapper, PartyMember> implements IPartyMemberService { private final HttpServletResponse response; private final IBcRegionService bcRegionService; private final IComStreetService comStreetService; private final IComActService comActService; /** * 党员分页查询列表 * @@ -60,6 +79,8 @@ if (Objects.isNull(dto.getId())) { //添加 partyMember.setCreateBy(Long.parseLong(loginUserInfo.getId().toString())); partyMember.setAuditStatus(AuditStatusEnum.APPROVED.getCode()); partyMember.setSource(1); save(partyMember); } else { partyMember.setUpdateBy(Long.parseLong(loginUserInfo.getId().toString())); @@ -85,7 +106,7 @@ response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode("党员导入模板", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); FastExcel.write(response.getOutputStream(), PartyMemberTemplate.class) EasyExcel.write(response.getOutputStream(), PartyMemberTemplate.class) .sheet("党员导入模板") .doWrite(Collections.emptyList()); } @@ -103,18 +124,158 @@ response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode("党员数据", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); FastExcel.write(response.getOutputStream(), PartyMemberExcel.class) EasyExcel.write(response.getOutputStream(), PartyMemberExcel.class) .sheet("党员数据") .doWrite(partyMemberExcels); } /** * * @param file * @param loginUserInfo */ @Override public void importExcel(SystemUserVo loginUserInfo) { @Transactional(rollbackFor = Exception.class) public List<PartyMemberImportFailedVO> importExcel(MultipartFile file, SystemUserVo loginUserInfo) throws IOException { // 使用 FastExcel 同步读取 Excel 数据为对象列表 List<PartyMemberTemplate> list = EasyExcel.read(file.getInputStream()).head(PartyMemberTemplate.class).headRowNumber(2).sheet().doReadSync(); if (CollUtil.isEmpty(list)) { throw new ServiceException("导入数据为空"); } // 存储验证失败的记录 List<PartyMemberImportFailedVO> failedList = new ArrayList<>(); // 存储验证成功的记录 List<PartyMember> validPartyMembers = new ArrayList<>(); // 手机号正则表达式 String phoneRegex = "^1[3-9]\\d{9}$"; // 身份证号正则表达式 String idCardRegex = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)"; // 批量验证数据 for (PartyMemberTemplate template : list) { PartyMemberImportFailedVO failedVO = new PartyMemberImportFailedVO(); boolean isValid = true; StringBuilder errorMsg = new StringBuilder(); // 复制数据到失败记录对象 BeanUtil.copyProperties(template, failedVO); // 1. 验证手机号 if (StrUtil.isBlank(template.getPhone()) || !template.getPhone().matches(phoneRegex)) { isValid = false; errorMsg.append("手机号格式不正确; "); } // 2. 验证身份证号 if (StrUtil.isBlank(template.getIdNumber()) || !template.getIdNumber().matches(idCardRegex)) { isValid = false; errorMsg.append("身份证号格式不正确; "); } // 3. 验证账号是否已存在 if (StrUtil.isNotBlank(template.getPhone())) { LambdaQueryWrapper<PartyMember> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(PartyMember::getPhone, template.getPhone()); long count = count(queryWrapper); if (count > 0) { isValid = false; errorMsg.append("账号已存在"); } } // 4. 验证所在社区 String districtName = null; String streetName = null; String communityName = null; String districtCode = ""; String streetId = ""; Long communityId = null; if (StrUtil.isNotBlank(template.getCommunity())) { String[] addressParts = template.getCommunity().split("-"); if (addressParts.length != 3) { isValid = false; errorMsg.append("社区格式不正确,应为'区县-街道-社区'; "); } else { districtName = addressParts[0]; streetName = addressParts[1]; communityName = addressParts[2]; // 验证区县、街道、社区信息 // 验证区县是否存在 BcRegion district = bcRegionService.getDistrictByName(districtName); if (Objects.isNull(district)) { isValid = false; errorMsg.append("区县不存在; "); } else { // 验证街道是否存在且属于该区县 ComStreet comStreet = comStreetService.getStreetByNameAndDistrict(streetName, district.getRegionCode()); districtCode = district.getRegionCode(); if (Objects.isNull(comStreet)) { isValid = false; errorMsg.append("街道不存在或不属于所选区县; "); } else { // 验证社区是否存在且属于该街道 // 实际代码应该是调用相应的Service查询社区信息 ComAct comAct = comActService.getCommunityByNameAndStreet(communityName, comStreet.getStreetId()); streetId = comStreet.getStreetId(); communityId = comAct.getCommunityId(); if (Objects.isNull(comAct)) { isValid = false; errorMsg.append("社区不存在或不属于所选街道; "); } } } } } else { isValid = false; errorMsg.append("社区信息不能为空; "); } // 如果验证失败,添加到失败列表,否则添加到成功列表 if (!isValid) { failedVO.setFailReason(errorMsg.toString()); failedList.add(failedVO); } else { PartyMember partyMember = new PartyMember(); BeanUtil.copyProperties(template, partyMember); // 设置创建人和更新人 partyMember.setCreateBy(Long.parseLong(loginUserInfo.getId().toString())); partyMember.setUpdateBy(Long.parseLong(loginUserInfo.getId().toString())); //导入党员默认审核通过 partyMember.setAuditStatus(AuditStatusEnum.APPROVED.getCode()); partyMember.setSource(1);//管理后台录入 //默认头像 TODO 默认头像 partyMember.setAvatar(""); // 根据身份证号设置性别 if (StrUtil.isNotBlank(template.getIdNumber())) { partyMember.setGender(getGender(template.getIdNumber())); } // 然后设置到partyMember对象中 partyMember.setDistricts(districtName); partyMember.setDistrictsCode(districtCode); partyMember.setStreet(streetName); partyMember.setStreetId(streetId); partyMember.setCommunity(communityName); partyMember.setCommunityId(communityId); validPartyMembers.add(partyMember); } } // 处理验证成功的数据 if (!validPartyMembers.isEmpty()) { // 批量保存 saveBatch(validPartyMembers); } // 返回验证失败的数据 return failedList; } /** springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java
@@ -3,25 +3,36 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.beust.jcommander.internal.Lists; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.sangeshenbian.dao.SystemUserMapper; import com.panzhihua.sangeshenbian.model.entity.ComAct; import com.panzhihua.sangeshenbian.model.entity.SystemUser; import com.panzhihua.sangeshenbian.model.vo.RegionVO; import com.panzhihua.sangeshenbian.service.IBcRegionService; import com.panzhihua.sangeshenbian.service.IComActService; import com.panzhihua.sangeshenbian.service.IComStreetService; import com.panzhihua.sangeshenbian.service.ISystemUserService; import com.panzhihua.sangeshenbian.warpper.SystemUserList; import com.panzhihua.sangeshenbian.warpper.SystemUserListVo; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; /** * @author zhibing.pu * @Date 2025/2/18 22:30 */ @Service @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser> implements ISystemUserService { private final IComActService comActService; /** * 获取列表数据 * @param query @@ -94,4 +105,47 @@ public List<RegionVO> getCommunity(String streetId) { return this.baseMapper.getCommunity(streetId); } /** * 获取区县-街道-社区树 * @return */ @Override public List<RegionVO> getRegionTree(SystemUserVo loginUserInfo) { Integer accountLevel = loginUserInfo.getAccountLevel(); List<RegionVO> regionTree = new ArrayList<>(); switch (accountLevel) { case 1: regionTree = baseMapper.getRegion("510400"); baseMapper.getStreet("510400"); regionTree.forEach(district -> { List<RegionVO> streets = baseMapper.getStreet(district.getId()); district.setChildren(streets); streets.forEach(street -> { List<RegionVO> communities = baseMapper.getCommunity(street.getId()); street.setChildren(communities); }); }); break; case 2: regionTree = baseMapper.getStreet(loginUserInfo.getDistrictsCode()); regionTree.forEach(regionVO->{ List<RegionVO> communities = baseMapper.getCommunity(regionVO.getId()); regionVO.setChildren(communities); }); break; case 3: regionTree = baseMapper.getCommunity(loginUserInfo.getStreetId()); break; case 4: ComAct byId = comActService.getById(loginUserInfo.getCommunityId()); RegionVO regionVO = new RegionVO(); regionVO.setId(byId.getCommunityId().toString()); regionVO.setName(byId.getName()); regionTree = Lists.newArrayList(regionVO); break; } return regionTree; } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/utils/FileUtil.java
New file @@ -0,0 +1,34 @@ package com.panzhihua.sangeshenbian.utils; import java.io.File; import java.io.InputStream; public class FileUtil { public static InputStream getResourcesFileInputStream(String fileName) { return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName); } public static String getPath() { return FileUtil.class.getResource("/").getPath(); } public static File createNewFile(String pathName) { File file = new File(getPath() + pathName); if (file.exists()) { file.delete(); } else { if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } } return file; } public static File readFile(String pathName) { return new File(getPath() + pathName); } public static File readUserHomeFile(String pathName) { return new File(System.getProperty("user.home") + File.separator + pathName); } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/MgtComplaintQuery.java
New file @@ -0,0 +1,43 @@ package com.panzhihua.sangeshenbian.warpper; import com.baomidou.mybatisplus.annotation.TableField; import com.panzhihua.sangeshenbian.model.query.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.Date; /** * @author mitao * @date 2025/3/15 */ @Data @ApiModel("管理后台诉求管理查询数据传输对象") public class MgtComplaintQuery extends BasePage { @ApiModelProperty(value = "录入人") private String nickname; @ApiModelProperty(value = "联系方式") private String phone; @ApiModelProperty(value = "群众姓名") private String name; @ApiModelProperty(value = "发生时间-开始") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; @ApiModelProperty(value = "发生时间-结束") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; @ApiModelProperty(value = "问题类型") private String problemType; @ApiModelProperty(value = "流转状态:0-正在办理 1-延期办理 2-超时办理 3-已办结 4-群众撤销 5-上报待审核 6-上级驳回 7-延期待审核") private Integer status; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/PartyMemberImportFailedVO.java
New file @@ -0,0 +1,19 @@ package com.panzhihua.sangeshenbian.warpper; import com.panzhihua.sangeshenbian.model.excel.PartyMemberTemplate; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; /** * @author mitao * @date 2025/3/15 */ @Data @EqualsAndHashCode(callSuper = true) @ApiModel("党员导入失败信息视图对象") public class PartyMemberImportFailedVO extends PartyMemberTemplate { @ApiModelProperty(value = "失败原因") private String failReason; } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -233,6 +233,12 @@ </where> ORDER BY sc.create_time DESC </select> <select id="pageList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> </select> <select id="getList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> </select> <select id="getTimeoutAndNotComment" resultType="com.panzhihua.sangeshenbian.model.entity.Complaint"> springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/PartyMemberMapper.xml
@@ -37,7 +37,7 @@ and street_id = #{loginUserInfo.streetId} </if> <if test="loginUserInfo.accountLevel==4"> and street_id = #{loginUserInfo.streetId} and community_id = #{loginUserInfo.communityId} </if> <if test="query.name != null and query.name != ''"> and name like concat('%',#{query.name},'%') springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/template/社区问题单.docxBinary files differ