| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.1.0</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | private String nickName; |
| | | @ApiModelProperty("身份") |
| | | private String identity; |
| | | @ApiModelProperty("人群标签") |
| | | private String tags; |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("报名时间") |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * title: ComActActRegistExcelVO 社区活动签到表 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 记录和展示社区活动签到内容 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | |
| | | @Data |
| | | @ApiModel("社区活动签到表") |
| | | public class ComActActRegistExcelVO { |
| | | |
| | | @ExcelProperty(value = "姓名", index = 1) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "身份", index = 2) |
| | | private String identity; |
| | | |
| | | @ExcelProperty(value = "电话", index = 4) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = "签到时间", index = 0) |
| | | private Date createAt; |
| | | |
| | | @ExcelProperty(value = "人群标签", index = 3) |
| | | private String tags; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * title: ComActActSignExcelVO 社区活动报名名单 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 记录和展示社区活动报名名单 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | |
| | | @Data |
| | | @ApiModel("社区活动签到表") |
| | | public class ComActActSignExcelVO { |
| | | |
| | | @ExcelProperty(value = "姓名", index = 1) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "身份", index = 2) |
| | | private String identity; |
| | | |
| | | @ExcelProperty(value = "电话", index = 4) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = "报名时间", index = 0) |
| | | private Date createAt; |
| | | |
| | | @ExcelProperty(value = "人群标签", index = 3) |
| | | private String tags; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 社区活动数据统计返回参数 |
| | | */ |
| | | @Data |
| | | @ApiModel("社区活动数据统计返回参数") |
| | | public class ComActActivityStatisticsVO { |
| | | |
| | | /** |
| | | * 应报名总人数 |
| | | */ |
| | | @ApiModelProperty("应报名总人数") |
| | | private Integer signTotal; |
| | | /** |
| | | * 应报名总人数Str |
| | | */ |
| | | @ApiModelProperty("应报名总人数Str") |
| | | private String signTotalStr; |
| | | /** |
| | | * 实际报名总人数 |
| | | */ |
| | | @ApiModelProperty("实际报名总人数") |
| | | private Integer reallySignTotal; |
| | | /** |
| | | * 未报名报名总人数 |
| | | */ |
| | | @ApiModelProperty("未报名报名总人数") |
| | | private Integer noSignTotal; |
| | | /** |
| | | * 未报名报名总人数Str |
| | | */ |
| | | @ApiModelProperty("未报名报名总人数Str") |
| | | private String noSignTotalStr; |
| | | /** |
| | | * 报名总人数百分比 |
| | | */ |
| | | @ApiModelProperty("报名总人数百分比") |
| | | private String signPersent; |
| | | /** |
| | | * 应签到总人数 |
| | | */ |
| | | @ApiModelProperty("应签到总人数") |
| | | private Integer registTotal; |
| | | |
| | | /** |
| | | * 实际签到总人数 |
| | | */ |
| | | @ApiModelProperty("实际签到总人数") |
| | | private Integer reallyRegistTotal; |
| | | |
| | | /** |
| | | * 未签到总人数 |
| | | */ |
| | | @ApiModelProperty("未签到总人数") |
| | | private Integer noRegistTotal; |
| | | |
| | | /** |
| | | * 签到总人数百分比 |
| | | */ |
| | | @ApiModelProperty("签到总人数百分比") |
| | | private String registPersent; |
| | | |
| | | /** |
| | | * 应评价总人数 |
| | | */ |
| | | @ApiModelProperty("应评价总人数") |
| | | private Integer evaluateTotal; |
| | | |
| | | /** |
| | | * 实际评价总人数 |
| | | */ |
| | | @ApiModelProperty("实际评价总人数") |
| | | private Integer reallyEvaluateTotal; |
| | | |
| | | /** |
| | | * 未评价总人数 |
| | | */ |
| | | @ApiModelProperty("未评价总人数") |
| | | private Integer noEvaluateTotal; |
| | | |
| | | /** |
| | | * 评价人数百分比 |
| | | */ |
| | | @ApiModelProperty("评价人数百分比") |
| | | private String evaluatePersent; |
| | | } |
| | |
| | | R listActivitySign(@RequestBody ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * description getSignLists 查询活动报名名单 |
| | | * @param activitySignVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("/activity/sign/getList") |
| | | R getSignLists(@RequestBody ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | |
| | | R pageActivityEvaluates(@RequestBody ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | /** |
| | | * description getEvaluateListsByIds 批量查询活动评价 |
| | | * @param ids ids |
| | | * description getEvaluateLists 查询活动评价 |
| | | * @param comActActEvaluateVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("/activity/evaluate/getList") |
| | | R getEvaluateListsByIds(@RequestBody List<Long> ids); |
| | | R getEvaluateLists(@RequestBody ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | /** |
| | | * description pageActivityRegists 分页查询活动签到 |
| | | * @param comActActRegistVO 活动签到vo |
| | | * @return R 分页查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("/activity/regist/page") |
| | | R pageActivityRegists(@RequestBody ComActActRegistVO comActActRegistVO); |
| | | |
| | | /** |
| | | * description getRegistLists 查询活动签到 |
| | | * @param comActActRegistVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/25 9:33 |
| | | */ |
| | | @PostMapping("/activity/regist/getList") |
| | | R getRegistLists(@RequestBody ComActActRegistVO comActActRegistVO); |
| | | |
| | | /** |
| | | * description activityStagistics 活动数据统计 |
| | | * @param activityId 活动id |
| | | * @return R 统计结果 |
| | | * @author txb |
| | | * @date 2021/8/25 13:33 |
| | | */ |
| | | @GetMapping("/activity/statistics") |
| | | R activityStatistics(@RequestParam("activityId") Long activityId); |
| | | |
| | | /** |
| | | * 活动报名名单 |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.awt.BasicStroke; |
| | | import java.awt.Graphics; |
| | | import java.awt.Graphics2D; |
| | | import java.awt.Image; |
| | | import java.awt.Shape; |
| | | import java.awt.geom.RoundRectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.OutputStream; |
| | | import java.util.Hashtable; |
| | | import java.util.Random; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.BinaryBitmap; |
| | | import com.google.zxing.DecodeHintType; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.MultiFormatReader; |
| | | import com.google.zxing.MultiFormatWriter; |
| | | import com.google.zxing.Result; |
| | | import com.google.zxing.client.j2se.BufferedImageLuminanceSource; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.common.HybridBinarizer; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | |
| | | public class QRCodeUtils { |
| | | private static final String CHARSET = "utf-8"; |
| | | private static final String FORMAT_NAME = "JPG"; |
| | | // 二维码尺寸 |
| | | private static final int QRCODE_SIZE = 300; |
| | | // LOGO宽度 |
| | | private static final int WIDTH = 60; |
| | | // LOGO高度 |
| | | private static final int HEIGHT = 60; |
| | | |
| | | private static BufferedImage createImage(String content, String imgPath, |
| | | boolean needCompress) throws Exception { |
| | | Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>(); |
| | | hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
| | | hints.put(EncodeHintType.CHARACTER_SET, CHARSET); |
| | | hints.put(EncodeHintType.MARGIN, 1); |
| | | BitMatrix bitMatrix = new MultiFormatWriter().encode(content, |
| | | BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints); |
| | | int width = bitMatrix.getWidth(); |
| | | int height = bitMatrix.getHeight(); |
| | | BufferedImage image = new BufferedImage(width, height, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | for (int x = 0; x < width; x++) { |
| | | for (int y = 0; y < height; y++) { |
| | | image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 |
| | | : 0xFFFFFFFF); |
| | | } |
| | | } |
| | | if (imgPath == null || "".equals(imgPath)) { |
| | | return image; |
| | | } |
| | | // 插入图片 |
| | | QRCodeUtils.insertImage(image, imgPath, needCompress); |
| | | return image; |
| | | } |
| | | |
| | | /** |
| | | * 插入LOGO |
| | | * |
| | | * @param source |
| | | * 二维码图片 |
| | | * @param imgPath |
| | | * LOGO图片地址 |
| | | * @param needCompress |
| | | * 是否压缩 |
| | | * @throws Exception |
| | | */ |
| | | private static void insertImage(BufferedImage source, String imgPath, |
| | | boolean needCompress) throws Exception { |
| | | File file = new File(imgPath); |
| | | if (!file.exists()) { |
| | | System.err.println(""+imgPath+" 该文件不存在!"); |
| | | return; |
| | | } |
| | | Image src = ImageIO.read(new File(imgPath)); |
| | | int width = src.getWidth(null); |
| | | int height = src.getHeight(null); |
| | | if (needCompress) { // 压缩LOGO |
| | | if (width > WIDTH) { |
| | | width = WIDTH; |
| | | } |
| | | if (height > HEIGHT) { |
| | | height = HEIGHT; |
| | | } |
| | | Image image = src.getScaledInstance(width, height, |
| | | Image.SCALE_SMOOTH); |
| | | BufferedImage tag = new BufferedImage(width, height, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | Graphics g = tag.getGraphics(); |
| | | g.drawImage(image, 0, 0, null); // 绘制缩小后的图 |
| | | g.dispose(); |
| | | src = image; |
| | | } |
| | | // 插入LOGO |
| | | Graphics2D graph = source.createGraphics(); |
| | | int x = (QRCODE_SIZE - width) / 2; |
| | | int y = (QRCODE_SIZE - height) / 2; |
| | | graph.drawImage(src, x, y, width, height, null); |
| | | Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6); |
| | | graph.setStroke(new BasicStroke(3f)); |
| | | graph.draw(shape); |
| | | graph.dispose(); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param destPath |
| | | * 存放目录 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static String encode(String content, String imgPath, String destPath, |
| | | boolean needCompress) throws Exception { |
| | | BufferedImage image = QRCodeUtils.createImage(content, imgPath, |
| | | needCompress); |
| | | mkdirs(destPath); |
| | | String file = Snowflake.getId() + ".jpg"; |
| | | ImageIO.write(image, FORMAT_NAME, new File(destPath+"/"+file)); |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | | * 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常) |
| | | * @date 2013-12-11 上午10:16:36 |
| | | * @param destPath 存放目录 |
| | | */ |
| | | public static void mkdirs(String destPath) { |
| | | File file =new File(destPath); |
| | | //当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常) |
| | | if (!file.exists() && !file.isDirectory()) { |
| | | file.mkdirs(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String imgPath, String destPath) |
| | | throws Exception { |
| | | QRCodeUtils.encode(content, imgPath, destPath, false); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String destPath, |
| | | boolean needCompress) throws Exception { |
| | | QRCodeUtils.encode(content, null, destPath, needCompress); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param destPath |
| | | * 存储地址 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String destPath) throws Exception { |
| | | QRCodeUtils.encode(content, null, destPath, false); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码(内嵌LOGO) |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param imgPath |
| | | * LOGO地址 |
| | | * @param output |
| | | * 输出流 |
| | | * @param needCompress |
| | | * 是否压缩LOGO |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, String imgPath, |
| | | OutputStream output, boolean needCompress) throws Exception { |
| | | BufferedImage image = QRCodeUtils.createImage(content, imgPath, |
| | | needCompress); |
| | | ImageIO.write(image, FORMAT_NAME, output); |
| | | } |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | * |
| | | * @param content |
| | | * 内容 |
| | | * @param output |
| | | * 输出流 |
| | | * @throws Exception |
| | | */ |
| | | public static void encode(String content, OutputStream output) |
| | | throws Exception { |
| | | QRCodeUtils.encode(content, null, output, false); |
| | | } |
| | | |
| | | /** |
| | | * 解析二维码 |
| | | * |
| | | * @param file |
| | | * 二维码图片 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decode(File file) throws Exception { |
| | | BufferedImage image; |
| | | image = ImageIO.read(file); |
| | | if (image == null) { |
| | | return null; |
| | | } |
| | | BufferedImageLuminanceSource source = new BufferedImageLuminanceSource( |
| | | image); |
| | | BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); |
| | | Result result; |
| | | Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(); |
| | | hints.put(DecodeHintType.CHARACTER_SET, CHARSET); |
| | | result = new MultiFormatReader().decode(bitmap, hints); |
| | | String resultStr = result.getText(); |
| | | return resultStr; |
| | | } |
| | | |
| | | /** |
| | | * 解析二维码 |
| | | * |
| | | * @param path |
| | | * 二维码图片地址 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decode(String path) throws Exception { |
| | | return QRCodeUtils.decode(new File(path)); |
| | | } |
| | | } |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.model.vos.LiveVO; |
| | | import com.panzhihua.common.model.vos.WeatherVO; |
| | | import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler; |
| | | import freemarker.template.Configuration; |
| | | import freemarker.template.Template; |
| | | import freemarker.template.Version; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import sun.misc.BASE64Encoder; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | return communityService.listActivitySign(activitySignVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询活动评价") |
| | | @ApiOperation(value = "excel导出-活动报名名单") |
| | | @PostMapping("sign/export") |
| | | public R activityExportSign(@RequestBody ActivitySignVO activitySignVO) { |
| | | String name = "活动报名名单导出数据.xlsx"; |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | R r = communityService.getSignLists(activitySignVO); |
| | | if (R.isOk(r)) { |
| | | List<ComActActSignExcelVO> excelVOS = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComActActSignExcelVO.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, ComActActSignExcelVO.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("活动报名名单导出数据").build(); |
| | | excelWriter.write(excelVOS, 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(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询活动评价记录", response = ComActActEvaluateVO.class) |
| | | @PostMapping("evaluate/page") |
| | | public R pageActivityEvaluates(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | if (ObjectUtils.isEmpty(comActActEvaluateVO.getActivityId())) { |
| | |
| | | |
| | | @ApiOperation(value = "excel导出-活动评价") |
| | | @PostMapping("evaluate/export") |
| | | public R activityExportEvaluate(@RequestBody List<Long> Ids) { |
| | | public R activityExportEvaluate(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | String name = "活动评价导出数据.xlsx"; |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | R r = communityService.getEvaluateListsByIds(Ids); |
| | | R r = communityService.getEvaluateLists(comActActEvaluateVO); |
| | | if (R.isOk(r)) { |
| | | List<ComActActEvaluateExcelVO> excelVOS = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComActActEvaluateExcelVO.class); |
| | |
| | | } |
| | | } |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询活动签到记录", response = ComActActRegistVO.class) |
| | | @PostMapping("regist/page") |
| | | public R pageActivityRegists(@RequestBody ComActActRegistVO comActActRegistVO) { |
| | | if (ObjectUtils.isEmpty(comActActRegistVO.getActivityId())) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | return communityService.pageActivityRegists(comActActRegistVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "excel导出-活动签到") |
| | | @PostMapping("regist/export") |
| | | public R activityExportRegist(@RequestBody ComActActRegistVO comActActRegistVO) { |
| | | String name = "活动签到导出数据.xlsx"; |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | R r = communityService.getRegistLists(comActActRegistVO); |
| | | if (R.isOk(r)) { |
| | | List<ComActActRegistExcelVO> excelVOS = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComActActRegistExcelVO.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, ComActActRegistExcelVO.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("活动签到导出数据").build(); |
| | | excelWriter.write(excelVOS, 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(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区活动数据统计", response = ComActActivityStatisticsVO.class) |
| | | @GetMapping("statistics") |
| | | public R activityStatistics(@RequestParam("activityId") Long activityId){ |
| | | return communityService.activityStatistics(activityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区活动签到二维码下载") |
| | | @GetMapping("qrCode/export") |
| | | public R activityRegistQRCodeExport(@RequestParam("activityId") Long activityId){ |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | Map<String, Object> dataMap = new HashMap<String, Object>(); |
| | | // 生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | String name = "社区活动签到二维码_" + activityId + ".doc"; |
| | | 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; |
| | | File file0=new File("d:/comActivity/file"); |
| | | if(!file0.isDirectory()&&!file0.exists()){ |
| | | file0.mkdirs(); |
| | | } |
| | | sftp.download("/mnt/data/web/", "社区活动二维码.ftl", "d:/comActivity/file/社区活动二维码.ftl"); |
| | | try { |
| | | String text = String.valueOf(activityId); |
| | | String destPath = "d:/comActivity/file/"; |
| | | String downFile = QRCodeUtils.encode(text, null, destPath, false); |
| | | dataMap.put("imgStr", getImageStr("d:/comActivity/file/" + downFile)); |
| | | Configuration configuration = new Configuration(new Version("2.3.0")); |
| | | |
| | | configuration.setDefaultEncoding("utf-8"); |
| | | /** |
| | | * 以下是两种指定ftl文件所在目录路径的方式,注意这两种方式都是 指定ftl文件所在目录的路径,而不是ftl文件的路径 |
| | | */ |
| | | // 指定路径的第一种方式(根据某个类的相对路径指定) |
| | | // configuration.setClassForTemplateLoading(this.getClass(), ""); |
| | | |
| | | // 指定路径的第二种方式,我的路径是C:/a.ftl |
| | | configuration.setDirectoryForTemplateLoading(new File("d:/comActivity/file/")); |
| | | |
| | | // 输出文档路径及名称 |
| | | // File outFile = new File("mnt/data/web/excel/安全工作记录_" + comSwSafetyWorkRecordVO.getId() + |
| | | // ".doc"); |
| | | File file = new File(fileName); |
| | | |
| | | // 以utf-8的编码读取ftl文件 |
| | | Template template = configuration.getTemplate("社区活动二维码.ftl", "utf-8"); |
| | | Writer out = new BufferedWriter( |
| | | new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8), 10240); |
| | | template.process(dataMap, out); |
| | | out.close(); |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "新增社区动态") |
| | |
| | | } |
| | | return communityService.easyPhotoNoHandleList(loginUserInfo.getCommunityId()); |
| | | } |
| | | |
| | | public String getImageStr(String fileName) { |
| | | String imgFile = fileName; |
| | | InputStream in = null; |
| | | byte[] data = null; |
| | | try { |
| | | in = new FileInputStream(imgFile); |
| | | data = new byte[in.available()]; |
| | | in.read(data); |
| | | in.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | BASE64Encoder encoder = new BASE64Encoder(); |
| | | return encoder.encode(data); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * description getSignLists 查询活动报名名单 |
| | | * @param activitySignVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/sign/getList") |
| | | public R getSignLists(@RequestBody ActivitySignVO activitySignVO){ |
| | | return comActActivityService.getSignLists(activitySignVO); |
| | | } |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | |
| | | @PostMapping("activity/evaluate/page") |
| | | public R pageActivityEvaluates(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | return comActActivityService.pageActivityEvaluates(comActActEvaluateVO); |
| | | } |
| | | |
| | | /** |
| | | * description getEvaluateLists 查询活动评价 |
| | | * @param comActActEvaluateVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/evaluate/getList") |
| | | public R getEvaluateLists(@RequestBody ComActActEvaluateVO comActActEvaluateVO){ |
| | | return comActActivityService.getEvaluateLists(comActActEvaluateVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * description getEvaluateListsByIds 批量查询活动评价 |
| | | * @param ids ids |
| | | * description getRegistLists 查询活动签到 |
| | | * @param comActActRegistVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | * @date 2021/8/25 9:33 |
| | | */ |
| | | @PostMapping("/activity/evaluate/getList") |
| | | public R getEvaluateListsByIds(@RequestBody List<Long> ids){ |
| | | return comActActivityService.getEvaluateListsByIds(ids); |
| | | @PostMapping("activity/regist/getList") |
| | | public R getRegistLists(@RequestBody ComActActRegistVO comActActRegistVO){ |
| | | return comActActivityService.getRegistLists(comActActRegistVO); |
| | | } |
| | | |
| | | /** |
| | | * description activityStagistics 活动数据统计 |
| | | * @param activityId 活动id |
| | | * @return R 统计结果 |
| | | * @author txb |
| | | * @date 2021/8/25 13:33 |
| | | */ |
| | | @GetMapping("activity/statistics") |
| | | public R activityStatistics(@RequestParam("activityId") Long activityId){ |
| | | return comActActivityService.activityStatistics(activityId); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | IPage<ComActActEvaluateVO> pageActivityEvaluates(Page page, @Param("comActActEvaluateVO") ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | List<ComActActEvaluateExcelVO> getEvaluateListsByIds(@Param("ids") List<Long> ids); |
| | | List<ComActActEvaluateExcelVO> getEvaluateLists(@Param("comActActEvaluateVO") ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | } |
| | |
| | | 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.vos.community.ComActActEvaluateExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActRegistExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActRegistVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActRegistDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * title: ComActActRegistDAO 社区》活动》活动签到表mapper类 |
| | |
| | | |
| | | |
| | | IPage<ComActActRegistVO> pageActivityRegists(Page page, @Param("comActActRegistVO") ComActActRegistVO comActActRegistVO); |
| | | |
| | | List<ComActActRegistExcelVO> getRegistLists(@Param("comActActRegistVO") ComActActRegistVO comActActRegistVO); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.panzhihua.common.model.vos.community.ComActActSignExcelVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | |
| | | // 居民 党员 志愿者 1 2 3 |
| | | @Select("<script> " + "SELECT " + "u.user_id id, " + "u.image_url, " + "u.name, " + "u.nick_name, " |
| | | + "case WHEN u.is_partymember = 1 THEN '党员' WHEN a.is_volunteer = 1 THEN '志愿者' ELSE '居民' END identity, " |
| | | + "u.phone, " + "a.create_at, " + "a.is_volunteer " + "FROM " + "com_act_act_sign a " |
| | | + "u.phone, " + "u.tags, " + "a.create_at, " + "a.is_volunteer " + "FROM " + "com_act_act_sign a " |
| | | + "JOIN sys_user u ON a.user_id = u.user_id " + "WHERE " + "a.activity_id = #{activitySignVO.activityId} " |
| | | + "<if test='activitySignVO.phone != null and activitySignVO.phone != ""'>" |
| | | + "AND u.phone = #{activitySignVO.phone} " + " </if> " |
| | | + "<if test='activitySignVO.tags != null and activitySignVO.tags != ""'>" |
| | | + "AND u.tags like concat('%',#{activitySignVO.tags},'%') " + " </if> " |
| | | + "<if test='activitySignVO.name != null and activitySignVO.name != ""'>" |
| | | + "AND u.`name` = #{activitySignVO.name} " + " </if> " |
| | | + "<if test='activitySignVO.identity != null and activitySignVO.identity != "" and activitySignVO.identity==1'>" |
| | |
| | | + "AND a.is_volunteer=#{activitySignVO.type}-1 " + " </if> " + " order by a.create_at desc " + "</script>") |
| | | List<ActivitySignVO> listActivitySigns(@Param("activitySignVO") ActivitySignVO activitySignVO); |
| | | |
| | | List<ComActActSignExcelVO> getSignLists (@Param("activitySignVO") ActivitySignVO activitySignVO); |
| | | |
| | | @Select("<script> " + "SELECT " + " caas.user_id, " + " su.NAME, " + "CASE " + " WHEN su.is_volunteer = 1 THEN " |
| | | + " '志愿者' ELSE '居民' " + " END identity, " + " su.phone, " + " caas.create_at " + "FROM " |
| | | + " com_act_act_sign AS caas " |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.panzhihua.common.model.vos.community.ComActActivityStatisticsVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | |
| | | + "FROM " + " com_act_act_sign AS caas " + " LEFT JOIN sys_user AS su ON su.user_id = caas.user_id " + "WHERE " |
| | | + " su.is_volunteer = 1 " + " AND activity_id = #{activityId} ") |
| | | ActActivityListVO getScreenActActivityPeopleCount(@Param("activityId") Long activityId); |
| | | |
| | | ComActActivityStatisticsVO activityStatistics (@Param("activityId") Long activityId); |
| | | } |
| | |
| | | import com.panzhihua.service_community.model.dos.ComActActivityDO; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | R listActivitySigns(ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * description getSignLists 查询活动报名名单 |
| | | * @param activitySignVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | R getSignLists(ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | R pageActivityEvaluates(ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | /** |
| | | * description getEvaluateLists 查询活动评价 |
| | | * @param comActActEvaluateVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | R getEvaluateLists(ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | /** |
| | | * description pageActivityRegists 分页查询活动签到 |
| | |
| | | R pageActivityRegists(ComActActRegistVO comActActRegistVO); |
| | | |
| | | /** |
| | | * description getEvaluateListsByIds 批量查询活动评价 |
| | | * @param ids ids |
| | | * description getRegistLists 查询活动签到 |
| | | * @param comActActRegistVO 查询参数 |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | * @date 2021/8/25 9:33 |
| | | */ |
| | | R getEvaluateListsByIds(List<Long> ids); |
| | | R getRegistLists(ComActActRegistVO comActActRegistVO); |
| | | |
| | | /** |
| | | * description activityStagistics 活动数据统计 |
| | | * @param activityId 活动id |
| | | * @return R 统计结果 |
| | | * @author txb |
| | | * @date 2021/8/25 13:33 |
| | | */ |
| | | R activityStatistics(Long activityId); |
| | | |
| | | /** |
| | | * 分页展示我的所有活动 时间倒序排列 |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R getSignLists(ActivitySignVO activitySignVO) { |
| | | return R.ok(comActActSignDAO.getSignLists(activitySignVO)); |
| | | } |
| | | |
| | | @Override |
| | | public R pageActivityEvaluates(ComActActEvaluateVO comActActEvaluateVO) { |
| | | IPage<ComActActEvaluateVO> comActActEvaluateVOIPage = comActActEvaluateDAO |
| | | .pageActivityEvaluates(new Page(comActActEvaluateVO.getPageNum(), comActActEvaluateVO.getPageSize()), comActActEvaluateVO); |
| | | return R.ok(comActActEvaluateVOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R getEvaluateLists(ComActActEvaluateVO comActActEvaluateVO) { |
| | | return R.ok(comActActEvaluateDAO.getEvaluateLists(comActActEvaluateVO)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R getEvaluateListsByIds(List<Long> ids) { |
| | | return R.ok(comActActEvaluateDAO.getEvaluateListsByIds(ids)); |
| | | public R getRegistLists(ComActActRegistVO comActActRegistVO) { |
| | | return R.ok(comActActRegistDAO.getRegistLists(comActActRegistVO)); |
| | | } |
| | | |
| | | @Override |
| | | public R activityStatistics(Long activityId) { |
| | | ComActActivityStatisticsVO comActActivityStatisticsVO = comActActivityDAO.activityStatistics(activityId); |
| | | if (comActActivityStatisticsVO != null) { |
| | | if (comActActivityStatisticsVO.getSignTotal().equals(0)){ |
| | | comActActivityStatisticsVO.setSignTotalStr("不限"); |
| | | comActActivityStatisticsVO.setNoSignTotalStr(""); |
| | | comActActivityStatisticsVO.setSignPersent(""); |
| | | }else { |
| | | comActActivityStatisticsVO.setSignTotalStr(String.valueOf(comActActivityStatisticsVO.getSignTotal())); |
| | | comActActivityStatisticsVO.setNoSignTotalStr(String.valueOf(Integer.valueOf(comActActivityStatisticsVO.getSignTotalStr()) - comActActivityStatisticsVO.getReallySignTotal())); |
| | | comActActivityStatisticsVO.setSignPersent(getPersent(comActActivityStatisticsVO.getReallySignTotal(),comActActivityStatisticsVO.getSignTotal())); |
| | | } |
| | | comActActivityStatisticsVO.setRegistPersent(getPersent(comActActivityStatisticsVO.getReallyRegistTotal(),comActActivityStatisticsVO.getRegistTotal())); |
| | | comActActivityStatisticsVO.setEvaluatePersent(getPersent(comActActivityStatisticsVO.getReallyEvaluateTotal(),comActActivityStatisticsVO.getEvaluateTotal())); |
| | | } |
| | | return R.ok(comActActivityStatisticsVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | private String getPersent(int x, int y){ |
| | | if (y == 0) { |
| | | return ""; |
| | | } |
| | | if (x == 0) { |
| | | return "0.00%"; |
| | | } |
| | | double d1 = x * 1.0; |
| | | double d2 = y * 1.0; |
| | | DecimalFormat decimalFormat = new DecimalFormat("##.00%"); |
| | | return decimalFormat.format(d1 / d2); |
| | | } |
| | | |
| | | } |
| | |
| | | order by caae.create_at desc |
| | | </select> |
| | | |
| | | <select id="getEvaluateListsByIds" resultType="com.panzhihua.common.model.vos.community.ComActActEvaluateExcelVO"> |
| | | <select id="getEvaluateLists" resultType="com.panzhihua.common.model.vos.community.ComActActEvaluateExcelVO"> |
| | | SELECT |
| | | caae.create_at, |
| | | caae.star_level, |
| | |
| | | com_act_act_evaluate caae |
| | | LEFT JOIN com_act_act_sign caas ON caae.activity_id = caas.activity_id |
| | | LEFT JOIN sys_user su ON caae.user_id = su.user_id |
| | | where caae.id in |
| | | <foreach collection="ids" item="id" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | where caae.activity_id = #{comActActEvaluateVO.activityId} |
| | | <if test="comActActEvaluateVO.phone != null and comActActEvaluateVO.phone !=''"> |
| | | AND su.phone = #{comActActEvaluateVO.phone} |
| | | </if> |
| | | <if test="comActActEvaluateVO.name != null and comActActEvaluateVO.name !=''"> |
| | | AND su.`name` = #{comActActEvaluateVO.name} |
| | | </if> |
| | | <if test="comActActEvaluateVO.starLevel != null"> |
| | | AND caae.star_level = #{comActActEvaluateVO.starLevel} |
| | | </if> |
| | | <if test="comActActEvaluateVO.createAt != null"> |
| | | AND caae.create_at = #{comActActEvaluateVO.createAt} |
| | | </if> |
| | | order by caae.create_at desc |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="pageActivityRegists" resultType="com.panzhihua.common.model.vos.community.ComActActRegistVO"> |
| | | SELECT |
| | | caae.id, |
| | | caae.activity_id, |
| | | caae.create_at, |
| | | caae.photo, |
| | | caae.star_level, |
| | | caae.evaluate_content, |
| | | caar.id, |
| | | caar.activity_id, |
| | | caar.create_at, |
| | | su.user_id, |
| | | su.`name`, |
| | | su.nick_name, |
| | | su.phone, |
| | | su.image_url, |
| | | su.tags, |
| | | caae.is_volunteer, |
| | | caar.is_volunteer, |
| | | CASE |
| | | |
| | | WHEN su.is_partymember = 1 THEN |
| | |
| | | END identity |
| | | |
| | | FROM |
| | | com_act_act_evaluate caae |
| | | LEFT JOIN com_act_act_sign caas ON caae.activity_id = caas.activity_id |
| | | LEFT JOIN sys_user su ON caae.user_id = su.user_id |
| | | where caae.activity_id = #{comActActEvaluateVO.activityId} |
| | | <if test="comActActEvaluateVO.phone != null and comActActEvaluateVO.phone !=''"> |
| | | AND su.phone = #{comActActEvaluateVO.phone} |
| | | com_act_act_regist caar |
| | | LEFT JOIN com_act_act_sign caas ON caar.activity_id = caas.activity_id |
| | | LEFT JOIN sys_user su ON caar.user_id = su.user_id |
| | | where caar.activity_id = #{comActActRegistVO.activityId} |
| | | <if test="comActActRegistVO.phone != null and comActActRegistVO.phone !=''"> |
| | | AND su.phone = #{comActActRegistVO.phone} |
| | | </if> |
| | | <if test="comActActEvaluateVO.name != null and comActActEvaluateVO.name !=''"> |
| | | AND su.`name` = #{comActActEvaluateVO.name} |
| | | <if test="comActActRegistVO.name != null and comActActRegistVO.name !=''"> |
| | | AND su.`name` = #{comActActRegistVO.name} |
| | | </if> |
| | | <if test="comActActEvaluateVO.starLevel != null"> |
| | | AND caae.star_level = #{comActActEvaluateVO.starLevel} |
| | | <if test="comActActRegistVO.createAt != null"> |
| | | AND caar.create_at = #{comActActRegistVO.createAt} |
| | | </if> |
| | | <if test="comActActEvaluateVO.createAt != null"> |
| | | AND caae.create_at = #{comActActEvaluateVO.createAt} |
| | | order by caar.create_at desc |
| | | </select> |
| | | |
| | | <select id="getRegistLists" resultType="com.panzhihua.common.model.vos.community.ComActActRegistExcelVO"> |
| | | SELECT |
| | | caar.create_at, |
| | | su.`name`, |
| | | su.phone, |
| | | su.tags, |
| | | CASE |
| | | |
| | | WHEN su.is_partymember = 1 THEN |
| | | '党员' |
| | | WHEN caas.is_volunteer = 1 THEN |
| | | '志愿者' ELSE '居民' |
| | | END identity |
| | | |
| | | FROM |
| | | com_act_act_regist caar |
| | | LEFT JOIN com_act_act_sign caas ON caar.activity_id = caas.activity_id |
| | | LEFT JOIN sys_user su ON caar.user_id = su.user_id |
| | | where caar.activity_id = #{comActActRegistVO.activityId} |
| | | <if test="comActActRegistVO.phone != null and comActActRegistVO.phone !=''"> |
| | | AND su.phone = #{comActActRegistVO.phone} |
| | | </if> |
| | | order by caae.create_at desc |
| | | <if test="comActActRegistVO.name != null and comActActRegistVO.name !=''"> |
| | | AND su.`name` = #{comActActRegistVO.name} |
| | | </if> |
| | | <if test="comActActRegistVO.createAt != null"> |
| | | AND caar.create_at = #{comActActRegistVO.createAt} |
| | | </if> |
| | | order by caar.create_at desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.service_community.dao.ComActActSignDAO"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActActSignDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="activity_id" property="activityId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="create_at" property="createAt" /> |
| | | <result column="is_volunteer" property="isVolunteer" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, activity_id, user_id, create_at, is_volunteer |
| | | </sql> |
| | | |
| | | <select id="getSignLists" resultType="com.panzhihua.common.model.vos.community.ComActActSignExcelVO"> |
| | | SELECT |
| | | caas.create_at, |
| | | su.`name`, |
| | | su.phone, |
| | | su.tags, |
| | | CASE |
| | | |
| | | WHEN su.is_partymember = 1 THEN |
| | | '党员' |
| | | WHEN caas.is_volunteer = 1 THEN |
| | | '志愿者' ELSE '居民' |
| | | END identity |
| | | |
| | | FROM |
| | | com_act_act_sign caas |
| | | LEFT JOIN sys_user su ON caas.user_id = su.user_id |
| | | where caas.activity_id = #{activitySignVO.activityId} |
| | | <if test="activitySignVO.phone != null and activitySignVO.phone !=''"> |
| | | AND su.phone = #{activitySignVO.phone} |
| | | </if> |
| | | <if test="activitySignVO.name != null and activitySignVO.name !=''"> |
| | | AND su.`name` = #{activitySignVO.name} |
| | | </if> |
| | | <if test="activitySignVO.createAt != null and activitySignVO.createAt !=''"> |
| | | AND caas.create_at = #{activitySignVO.createAt} |
| | | </if> |
| | | <if test="activitySignVO.tags != null and activitySignVO.tags !=''"> |
| | | AND su.tags like concat('%', #{activitySignVO.tags}, '%') |
| | | </if> |
| | | order by caas.create_at desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.service_community.dao.ComActActivityDAO"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActActivityDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="activity_name" property="activityName" /> |
| | | <result column="sponsor_id" property="sponsorId" /> |
| | | <result column="activity_addr" property="activityAddr" /> |
| | | <result column="lat" property="lat" /> |
| | | <result column="lng" property="lng" /> |
| | | <result column="status" property="status" /> |
| | | <result column="publish_at" property="publishAt" /> |
| | | <result column="end_at" property="endAt" /> |
| | | <result column="begin_at" property="beginAt" /> |
| | | <result column="sign_up_begin" property="signUpBegin" /> |
| | | <result column="sign_up_end" property="signUpEnd" /> |
| | | <result column="aattend_people" property="aattendPeople" /> |
| | | <result column="volunteer_min" property="volunteerMin" /> |
| | | <result column="volunteer_max" property="volunteerMax" /> |
| | | <result column="participant_min" property="participantMin" /> |
| | | <result column="participant_max" property="participantMax" /> |
| | | <result column="cover" property="cover" /> |
| | | <result column="has_prize" property="hasPrize" /> |
| | | <result column="is_qr_code" property="isQrCode" /> |
| | | <result column="contact_name" property="contactName" /> |
| | | <result column="contact_phone" property="contactPhone" /> |
| | | <result column="is_regist" property="isRegist" /> |
| | | <result column="is_top" property="isTop" /> |
| | | <result column="prize_remark" property="prizeRemark" /> |
| | | <result column="reward_desc" property="rewardDesc" /> |
| | | <result column="content" property="content" /> |
| | | <result column="community_id" property="communityId" /> |
| | | <result column="create_at" property="createAt" /> |
| | | <result column="cancel_reason" property="cancelReason" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, activity_name, sponsor_id, activity_addr, lat, lng, status, publish_at, end_at, begin_at, sign_up_begin, sign_up_end, aattend_people, volunteer_min, volunteer_max, participant_min, participant_max, cover, has_prize, is_qr_code, contact_name, contact_phone, is_regist, is_top, prize_remark, reward_desc, content, community_id, create_at, cancel_reason |
| | | </sql> |
| | | |
| | | <select id="activityStatistics" resultType="com.panzhihua.common.model.vos.community.ComActActivityStatisticsVO"> |
| | | SELECT IFNULL(volunteer_max,0) + IFNULL(participant_max,0) as signTotal |
| | | ,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) as reallySignTotal |
| | | ,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) as registTotal |
| | | ,(SELECT count(id) FROM com_act_act_regist WHERE activity_id = #{activityId}) as reallyRegistTotal |
| | | ,((SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) - (SELECT count(id) FROM com_act_act_regist WHERE activity_id = #{activityId})) as noRegistTotal |
| | | ,(SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) as evaluateTotal |
| | | ,(SELECT count(id) FROM com_act_act_evaluate WHERE activity_id = #{activityId}) as reallyEvaluateTotal |
| | | ,((SELECT count(id) FROM com_act_act_sign WHERE activity_id = #{activityId}) - (SELECT count(id) FROM com_act_act_evaluate WHERE activity_id = #{activityId})) as noEvaluateTotal |
| | | FROM com_act_activity where id = #{activityId} |
| | | </select> |
| | | </mapper> |