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/ComActEasyPhotoCountVO.java
New file @@ -0,0 +1,9 @@ package com.panzhihua.common.model.vos.community.easyPhoto; import lombok.Data; @Data public class ComActEasyPhotoCountVO { private Integer total; private Integer today; } 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
@@ -335,6 +335,24 @@ R putEasypHotoStatus(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); /** * 城管随手拍统计 */ @PostMapping("/esayPhotoCount") R esayphotoCount(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); /** * * 城管安排 */ @PostMapping("updatePageeasyphoto") R updatePageeasyphoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); /** * * 随手拍城管导出 */ @PostMapping("exportEasyPhoto") R exportEasyPhoto(@RequestBody ExportEasyPhotoDTO exportEasyPhotoDTO); /** * 新增社区 * * @param comActVO 社区信息 @@ -4267,6 +4285,7 @@ @GetMapping("/questnaire/statisticsSummary/header") R statisticsSummaryHeader(@RequestParam("questId") Long questId); /** * 运营后台-新增随手拍分类 * @param addPhotoClassify 请求参数 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; @@ -14,24 +18,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 @@ -48,6 +53,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") @@ -262,12 +282,86 @@ } @ApiOperation(value = "城管分页查询随手拍") @PostMapping("/pageeasyphoto/urban") @PostMapping("pageeasyphoto/urban") public R pageEasyPhotoUrban(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { comActEasyPhotoVO.setIsReportUrban(1); return communityService.pageEasyPhoto(comActEasyPhotoVO); } @ApiOperation(value = "城管随手拍统计") @PostMapping("pageeasyphoto/urbanCount") public R pageEasyPhotoUrbanCount(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { return communityService.esayphotoCount(comActEasyPhotoVO); } /** * 城管安排 * * @param comActEasyPhotoVO 查询参数 * @return 心愿列表 */ @ApiOperation(value = "城管安排") @PostMapping("updatePageeasyphoto") 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(){ return communityService.getCommunityLists(); } @ApiOperation(value = "随手拍详情", response = ComActEasyPhotoVO.class) @GetMapping("easyphoto") public R detailEasyPhoto(@RequestParam("id") Long id) { 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; @@ -478,6 +479,24 @@ } /** * 城管安排 * * @param comActEasyPhotoVO 查询参数 * @return 心愿列表 */ @PostMapping("updatePageeasyphoto") public R updatePageeasyphoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { return comActEasyPhotoService.updatePageeasyphoto(comActEasyPhotoVO); } /** * 城管导出 */ @PostMapping("exportEasyPhoto") public R exportEasyPhoto(@RequestBody ExportEasyPhotoDTO exportEasyPhotoDTO){ return comActEasyPhotoService.export(exportEasyPhotoDTO); } /** * 随手拍详情 * * @param id 随手拍主键 @@ -648,6 +667,14 @@ } /** * 城管随手拍统计 */ @PostMapping("/esayPhotoCount") public R esayphotoCount(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { return comActEasyPhotoService.easyPhotoCount(comActEasyPhotoVO); } /** * 新增社区 * * @param comActVO 社区信息 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java
@@ -3,13 +3,14 @@ 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.common.model.vos.screen.EasyPhotoDataVO; import com.panzhihua.common.model.vos.screen.PbWorkVO; import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -330,4 +331,7 @@ // " `status` = 1 " + // " 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/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; @@ -114,6 +115,7 @@ */ R readUserReward(Long userId,Long communityId); R easyPhotoCount(ComActEasyPhotoVO comActEasyPhotoVO); /** * 社区后台-切换随手拍公示状态 * @param comActEasyPhotoVO 请求参数 @@ -121,5 +123,7 @@ */ R easyPhotoSwitchPublicity(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; @@ -637,6 +640,37 @@ return R.ok(); } @Override public R easyPhotoCount(ComActEasyPhotoVO comActEasyPhotoVO) { return R.ok(this.comActEasyPhotoDAO.easyPhotoCount(comActEasyPhotoVO)); } @Override public R updatePageeasyphoto(ComActEasyPhotoVO comActEasyPhotoVO) { ComActEasyPhotoDO comActEasyPhotoDO=new ComActEasyPhotoDO(); BeanUtils.copyProperties(comActEasyPhotoVO,comActEasyPhotoDO); int result=this.comActEasyPhotoDAO.updateById(comActEasyPhotoDO); if(result>0){ return R.ok(); } 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("参数错误"); } /** * 社区后台-切换随手拍公示状态 * @param comActEasyPhotoVO 请求参数 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml
@@ -61,7 +61,9 @@ p.classify_id, ca.`name` as classifyName, p.examine_at, c.name communityName 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 @@ -132,4 +134,116 @@ AND del_tag = 0 </select> <select id="easyPhotoCount" resultType="com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoCountVO"> select count(*) total,(select count(*) today from com_act_easy_photo where transfer_time BETWEEN DATE_FORMAT(CURDATE(),'%Y-%m-%d %H:%i:%s') and DATE_ADD(CURRENT_DATE, INTERVAL 1 DAY) <if test="urbanStatus !=null"> and urban_status=#{urbanStatus} </if>) today from com_act_easy_photo <where> 1=1 <if test="urbanStatus !=null"> and urban_status=#{urbanStatus} </if> </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>