springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/easyPhoto/ExportEasyPhotoDTO.java
New file @@ -0,0 +1,31 @@ package com.panzhihua.common.model.dtos.community.easyPhoto; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; @Data public class ExportEasyPhotoDTO { @ApiModelProperty(value = "批量勾选时传参数组") private List<Integer> ids; @ApiModelProperty(value = "关键词") private String keyWord; @ApiModelProperty("社区id") private Long communityId; private Integer type; @ApiModelProperty("处理人名字") private String handlerName; @ApiModelProperty("查询-创建开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createBegin; @ApiModelProperty("查询-创建结束时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createEnd; @ApiModelProperty("城管安排状态") private Integer urbanStatus; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/easyPhoto/ExportEasyPhotoVO.java
New file @@ -0,0 +1,26 @@ package com.panzhihua.common.model.vos.community.easyPhoto; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; import java.util.Date; @Data public class ExportEasyPhotoVO { @ExcelProperty("所属社区") private String communityName; @ExcelProperty("发起人") private String sponsorName; @ExcelProperty("事件详情") private String detail; @ExcelProperty("发生地点") private String happenAddr; @ExcelProperty("事件类型") private String photoType="其他"; @ExcelProperty("联系电话") private String phone; @ExcelProperty("处理人名字") private String handlerName; @ExcelProperty("创建时间") private Date createAt; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -10,10 +10,7 @@ import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenActActivityPeopleListDTO; import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenDiscussListDTO; import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenMicroListDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.AddEasyPhotoActivityDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.EditEasyPhotoActivityDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.PageEasyPhotoActivityDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.PageEasyPhotoActivityUserDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.*; import com.panzhihua.common.model.dtos.community.integral.ComActIntegralCommunityRankDTO; import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO; import com.panzhihua.common.model.dtos.community.integral.admin.EditComActIntegralRuleDTO; @@ -342,8 +339,19 @@ */ @PostMapping("/esayPhotoCount") R esayphotoCount(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); /** * * 城管安排 */ @PostMapping("updatePageeasyphoto") R updatePageeasyphoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); /** * * 随手拍城管导出 */ @PostMapping("exportEasyPhoto") R exportEasyPhoto(@RequestBody ExportEasyPhotoDTO exportEasyPhotoDTO); /** * 新增社区 * @@ -4256,4 +4264,5 @@ */ @GetMapping("/questnaire/statisticsSummary/header") R statisticsSummaryHeader(@RequestParam("questId") Long questId); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
@@ -1,9 +1,13 @@ package com.panzhihua.community_backstage.api; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.GrantRewardDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; @@ -13,24 +17,25 @@ import com.panzhihua.common.model.vos.user.SysUserNoticeVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.common.utlis.WxUtil; import com.panzhihua.common.utlis.WxXCXTempSend; import com.panzhihua.common.utlis.*; import com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.stream.Collectors; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -47,6 +52,21 @@ private UserService userService; @Resource private CommunityService communityService; @Value("${excel.userurl}") private String excelUrl; // FTP 登录用户名 @Value("${ftp.username}") private String userName; // FTP 登录密码 @Value("${ftp.password}") private String password; // FTP 服务器地址IP地址 @Value("${ftp.host}") private String host; // FTP 端口 @Value("${ftp.port}") private int port; @ApiOperation(value = "活动负责人下拉选择", response = ActivityManagerVO.class) @GetMapping("listactivitymanager") @@ -284,6 +304,57 @@ public R updatePageeasyphoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { return communityService.updatePageeasyphoto(comActEasyPhotoVO); } @ApiOperation(value = "城管随手拍导出") @PostMapping("exportEasyPhoto") public R exportEasyPhoto(@RequestBody ExportEasyPhotoDTO exportEasyPhotoDTO){ String url = excelUrl; String name = "随手拍.xlsx"; String ftpUrl = "/mnt/data/web/excel/"; R r=communityService.exportEasyPhoto(exportEasyPhotoDTO); if(R.isOk(r)){ List<ExportEasyPhotoVO> comActEasyPhotoVOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ExportEasyPhotoVO.class); try { SFTPUtil sftp = new SFTPUtil(userName, password, host, port); sftp.login(); boolean existDir = sftp.isExistDir(ftpUrl + name); if (!existDir) { String property = System.getProperty("user.dir"); String fileName = property + File.separator + name; // 这里 需要指定写用哪个class去写 ExcelWriter excelWriter = null; InputStream inputStream = null; try { excelWriter = EasyExcel.write(fileName, ExportEasyPhotoVO.class).build(); WriteSheet writeSheet = EasyExcel.writerSheet("随手拍导出").build(); excelWriter.write(comActEasyPhotoVOS, 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(url + name); } catch (Exception e) { e.printStackTrace(); log.error("文件传输失败【{}】", e.getMessage()); return R.fail(); } } return R.fail("未查询到数据"); } @ApiOperation(value = "查询所有社区列表") @GetMapping("community/list") public R getCommunityLists(){ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.dtos.community.*; import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; import com.panzhihua.common.model.dtos.community.questnaire.StatisticsSummaryDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.SystemmanagementConfigVO; @@ -487,6 +488,13 @@ public R updatePageeasyphoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { return comActEasyPhotoService.updatePageeasyphoto(comActEasyPhotoVO); } /** * 城管导出 */ @PostMapping("exportEasyPhoto") public R exportEasyPhoto(@RequestBody ExportEasyPhotoDTO exportEasyPhotoDTO){ return comActEasyPhotoService.export(exportEasyPhotoDTO); } /** * 随手拍详情 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java
@@ -3,10 +3,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; import com.panzhihua.common.model.vos.community.TodoEventsVO; import com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoCountVO; import com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoStatisticsVO; import com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO; import com.panzhihua.common.model.vos.screen.EastPhotoTypeVO; import com.panzhihua.common.model.vos.screen.EastPhotoVO; import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO; @@ -323,4 +325,6 @@ // " AND community_id = #{communityId} and del_tag = 0") ComActEasyPhotoStatisticsVO getEasyPhotoStatistics(@Param("communityId")Long communityId); ComActEasyPhotoCountVO easyPhotoCount(ComActEasyPhotoVO comActEasyPhotoVO); List<ExportEasyPhotoVO> export(ExportEasyPhotoDTO exportEasyPhotoDTO); List<ExportEasyPhotoVO> exportByIds(List<Integer> ids); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActEasyPhotoDO.java
@@ -145,6 +145,14 @@ * 完成人id */ private Long completeId; /** * 安排状态 */ private Integer urbanStatus; /** * 是否安排 */ private Integer isReportUrban; /** * 参加活动标签(1.优质 2.精良 3.普通 4.一般) springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActEasyPhotoService.java
@@ -5,6 +5,7 @@ import com.panzhihua.common.model.dtos.community.GrantRewardDTO; import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO; import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; import com.panzhihua.common.model.dtos.partybuilding.ComPbServiceTeamDTO; import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO; import com.panzhihua.common.model.vos.R; @@ -117,4 +118,6 @@ R easyPhotoCount(ComActEasyPhotoVO comActEasyPhotoVO); R updatePageeasyphoto(ComActEasyPhotoVO comActEasyPhotoVO); R export(ExportEasyPhotoDTO exportEasyPhotoDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
@@ -8,8 +8,10 @@ import com.panzhihua.common.model.dtos.community.GrantRewardDTO; import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO; import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.*; import com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO; import com.panzhihua.common.utlis.*; import com.panzhihua.service_community.dao.*; import com.panzhihua.service_community.model.dos.*; @@ -18,6 +20,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import javax.annotation.Resource; @@ -644,5 +647,20 @@ return R.fail(); } @Override public R export(ExportEasyPhotoDTO exportEasyPhotoDTO) { if(exportEasyPhotoDTO!=null){ List<ExportEasyPhotoVO> list; if(!CollectionUtils.isEmpty(exportEasyPhotoDTO.getIds())){ list=this.comActEasyPhotoDAO.exportByIds(exportEasyPhotoDTO.getIds()); } else { list=this.comActEasyPhotoDAO.export(exportEasyPhotoDTO); } return R.ok(list); } return R.fail("参数错误"); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml
@@ -141,4 +141,102 @@ </where> </select> <select id="export" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO"> SELECT p.id, u.`name` sponsor_name, u.phone phone, count( pu.id ) giveThumbsUpNum, u.image_url, p.happen_addr, su.`name` handler_name, p.`status`, p.`detail`, p.`is_need_feed_back`, p.`photo_path_list`, p.create_at, p.feedback_at, p.is_report, p.is_publicity, p.activity_type, p.activity_amount, p.activity_id, p.examine_at, c.name communityName, p.is_report_urban, p.urban_status FROM com_act_easy_photo p LEFT JOIN sys_user u ON p.sponsor_id = u.user_id LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id LEFT JOIN sys_user su ON p.handler_id = su.user_id left join com_act c on p.community_id =c.community_id WHERE p.del_tag = 0 and p.`is_report_urban` =1 <if test='communityId != null and communityId != 0'> and p.community_id=#{communityId} </if> <if test='urbanStatus != null ' > AND p.`urban_status` = #{urbanStatus} </if> <if test='createBegin != null '> AND p.create_at BETWEEN #{createBegin} AND #{createEnd} </if> <if test='keyWord != null and keyWord != ""'> AND (u.`name` like concat(#{keyWord},'%') or p.happen_addr like concat(#{keyWord},'%') or su.`name` like concat(#{keyWord},'%') or p.detail like concat(#{keyWord},'%') ) </if> GROUP BY p.id ORDER BY p.create_at DESC </select> <select id="exportByIds" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ExportEasyPhotoVO"> SELECT p.id, u.`name` sponsor_name, u.phone phone, count( pu.id ) giveThumbsUpNum, u.image_url, p.happen_addr, su.`name` handler_name, p.`status`, p.`detail`, p.`is_need_feed_back`, p.`photo_path_list`, p.create_at, p.feedback_at, p.is_report, p.is_publicity, p.activity_type, p.activity_amount, p.activity_id, p.examine_at, c.name communityName, p.is_report_urban, p.urban_status FROM com_act_easy_photo p LEFT JOIN sys_user u ON p.sponsor_id = u.user_id LEFT JOIN com_act_easy_photo_user pu ON p.id = pu.easy_photo_id LEFT JOIN sys_user su ON p.handler_id = su.user_id left join com_act c on p.community_id =c.community_id WHERE p.id in <foreach collection="list" item="ids" index="index" open="(" close=")" separator=","> #{ids} </foreach> GROUP BY p.id ORDER BY p.create_at DESC </select> </mapper>