From 41e016f222583c2403fec1ae5889f627f17f748c Mon Sep 17 00:00:00 2001
From: tangxiaobao <303826152@qq.com>
Date: 星期一, 06 九月 2021 09:45:26 +0800
Subject: [PATCH] 活动报名

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java          |    8 ++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java                       |   12 ++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActPictureDO.java           |   21 +++++-----
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComActActPictureVO.java                       |    8 ++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java                  |    8 ++--
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java |   16 ++++++++
 springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java           |   22 ++++++++--
 7 files changed, 75 insertions(+), 20 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComActActPictureVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComActActPictureVO.java
index 5eb161c..482a449 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComActActPictureVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComActActPictureVO.java
@@ -1,5 +1,6 @@
 package com.panzhihua.common.model.vos.community;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -26,10 +27,14 @@
     @ApiModelProperty("所属活动id")
     private Long activityId;
 
+    @ApiModelProperty("类型(1.党建 2.节日 3.天气预报 4.疫情 5.灾害预警 6.志愿者)")
+    private Integer type;
+
     @ApiModelProperty("用户id, 和用户信息表的相关id关联")
     private Long userId;
 
     @ApiModelProperty("上传时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createAt;
 
     @ApiModelProperty("上传图片")
@@ -37,4 +42,7 @@
 
     @ApiModelProperty("图片名称")
     private String pictureName;
+
+    @ApiModelProperty("是否系统预置(1.是 0.否)")
+    private Integer sysFlag;
 }
\ No newline at end of file
diff --git a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
index 8ebfb9f..82ffd4d 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
@@ -409,7 +409,7 @@
     }
 
     @ApiOperation(value = "excel导出活动签到统计")
-    @GetMapping("statistics/export")
+    @PostMapping("statistics/export")
     public R activityStatisticsExport(@RequestBody ComActActRegistVO comActActRegistVO){
         String name = "活动签到统计导出数据.xlsx";
         String ftpUrl = "/mnt/data/web/excel/";
@@ -466,7 +466,7 @@
     }
 
     @ApiOperation(value = "社区活动签到二维码下载")
-    @GetMapping("qrCode/export")
+    @PostMapping("qrCode/export")
     public R activityRegistQRCodeExport(@RequestParam("activityId") Long activityId){
         try {
                 SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
@@ -486,7 +486,7 @@
                     if(!file0.isDirectory()&&!file0.exists()){
                         file0.mkdirs();
                     }
-                    sftp.download("/mnt/data/web/", "社区活动二维码.ftl", "d:/comActivity/file/社区活动二维码.ftl");
+                    sftp.download("/mnt/data/web/excel/", "社区活动二维码.ftl", "d:/comActivity/file/社区活动二维码.ftl");
                     try {
                         String text = String.valueOf(activityId);
                         String destPath = "d:/comActivity/file/";
@@ -544,11 +544,23 @@
         return communityService.getPictureList(userId);
     }
 
+    /**
+     * 获取系统预置图库  getSysPictureList
+     * @param type 图片类型
+     * @return    R   系统图库集
+     * @author txb
+     * @date 2021/8/27 13:33
+     */
+    @ApiOperation(value = "获取社区活动系统预置图库", response = ComActActPictureVO.class)
+    @GetMapping("sysPicture/getList")
+    public R getSysPictureList(@RequestParam(value = "type") Integer type){
+        return communityService.getSysPictureList(type);
+    }
+
     @ApiOperation(value = "查询当前社区标签列表")
     @GetMapping("userTags/getList")
     public R getUserTagsList() {
-        Long communityId = this.getLoginUserInfo().getCommunityId();
-        return userService.listTags(communityId);
+        return userService.listTags();
     }
 
     @ApiOperation(value = "新增社区动态")
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
index 4d21238..92cf8c7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -586,6 +586,18 @@
     }
 
     /**
+     * 获取系统预置图库  getSysPictureList
+     * @param type 图库类型
+     * @return    R   系统图库集
+     * @author txb
+     * @date 2021/8/27 13:33
+     */
+    @GetMapping("/activity/sysPicture/getList")
+    public R getSysPictureList(@RequestParam(value = "type") Integer type){
+        return comActActivityService.getSysPictureList(type);
+    }
+
+    /**
      * 新增社区动态
      *
      * @param comActDynVO
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
index 14e39f5..7484a17 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
@@ -39,7 +39,7 @@
     // " </where>" +
     // "</script>")
     @Select("<script> " + "SELECT  " + "a.id, " + "a.activity_name, " + "u.`name` sponsorName, " + "a.activity_addr, "
-        + "a.`status`, " + "a.publish_at, " + "a.begin_at, " + "a.cover, " + "a.end_at, " + "a.volunteer_max, "
+        + "a.`status`, " + "a.is_qr_code, " + "a.publish_at, " + "a.begin_at, " + "a.cover, " + "a.end_at, " + "a.volunteer_max, "
         + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, "
         + "count(if(s.is_volunteer=0,s.id,null))participant_now, " + "a.participant_max, " + "a.sign_up_begin, "
         + "a.sign_up_end, " + "ca.name as communityName  " + "FROM " + "com_act_activity a  "
@@ -67,7 +67,7 @@
     @Select("SELECT  " + "u.name sponsorName, " + "ca.name communityName, "
         + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, "
         + "count(if(s.is_volunteer=0,s.id,null))participant_now, " + "a.*  " + "FROM  " + "com_act_activity a  "
-        + "join sys_user u on a.sponsor_id=u.user_id  " + "left join com_act_act_sign s on a.id=s.activity_id  "
+        + "left join sys_user u on a.sponsor_id=u.user_id  " + "left join com_act_act_sign s on a.id=s.activity_id  "
         + "left join com_act ca on a.community_id=ca.community_id  " + "where a.id=#{id}  " + " group by a.id ")
     ComActActivityVO inforActivity(Long id);
 
@@ -106,7 +106,7 @@
     @Select("<script> " + "select t.* from ( " + "SELECT  " + "a.id, " + "a.activity_name, " + "u.`name` sponsorName, "
         + "a.activity_addr, " + "a.participant_max, " + "count(if(s.is_volunteer=1,null,s.id))participant_now, "
         + "a.volunteer_max, " + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, "
-        + "a.publish_at, " + "a.begin_at, " + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM "
+        + "a.publish_at, " + "a.is_qr_code, " + "a.begin_at, " + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM "
         + " com_act_activity a  " + " LEFT JOIN sys_user u on a.sponsor_id=u.user_id "
         + " LEFT JOIN com_act_act_sign s on a.id=s.activity_id " + "WHERE "
         + "  a.`status` = 1 and a.community_id=#{comActActivityVO.communityId} "
@@ -118,7 +118,7 @@
         + " </if> " + "group by a.id " + "  " + " union all " + "select t1.* from ( " + "  " + " SELECT  " + "a.id, "
         + "a.activity_name, " + "u.`name` sponsorName, " + "a.activity_addr, " + "a.participant_max, "
         + "count(if(s.is_volunteer=1,null,s.id))participant_now, " + "a.volunteer_max, "
-        + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, " + "a.publish_at, " + "a.begin_at, "
+        + "count(if(s.is_volunteer=1,s.id,null))volunteer_now, " + "a.`status`, " + "a.publish_at, " + "a.is_qr_code, " + "a.begin_at, "
         + "a.end_at, " + "a.sign_up_begin, " + "a.sign_up_end " + "FROM " + " com_act_activity a  "
         + " LEFT JOIN sys_user u on a.sponsor_id=u.user_id " + " LEFT JOIN com_act_act_sign s on a.id=s.activity_id "
         + "WHERE " + "  a.`status` != 1 and a.community_id=#{comActActivityVO.communityId} "
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActPictureDO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActPictureDO.java
index d77e68b..6f7c274 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActPictureDO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActPictureDO.java
@@ -33,6 +33,11 @@
     private Long activityId;
 
     /**
+     * 类型(1.党建 2.节日 3.天气预报 4.疫情 5.灾害预警 6.志愿者)
+     */
+    private Integer type;
+
+    /**
     * 用户id, 和用户信息表的相关id关联
     */
     private Long userId;
@@ -53,15 +58,9 @@
     */
     private String pictureName;
 
-@Override
-public String toString() {
-        return "ComActActPictureDO{" +
-                "id=" + id +
-                ", activityId=" + activityId +
-                ", userId=" + userId +
-                ", createAt=" + createAt +
-                ", uploadPicture=" + uploadPicture +
-                ", pictureName=" + pictureName +
-        "}";
-        }
+    /**
+     * 是否系统预置(1.是 0.否)
+     */
+    private Integer sysFlag;
+
 }
\ No newline at end of file
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java
index d413ccc..41bad0b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java
@@ -167,6 +167,14 @@
     R getPictureList(Long userId);
 
     /**
+     * 获取系统预置图库  getSysPictureList
+     * @return    R   系统图库集
+     * @author txb
+     * @date 2021/8/27 13:33
+     */
+    R getSysPictureList(Integer type);
+
+    /**
      * 分页展示我的所有活动 时间倒序排列
      * 
      * @param comActActivityVO
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
index a9cffc8..288a8d7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
@@ -114,6 +114,7 @@
         comActActPictureDO.setActivityId(activityId);
         comActActPictureDO.setUserId(comActActivityVO.getUserId());
         comActActPictureDO.setUploadPicture(comActActivityVO.getCover());
+        comActActPictureDO.setSysFlag(0);
         comActActPictureDAO.insert(comActActPictureDO);
         return R.ok(activityId);
     }
@@ -361,6 +362,21 @@
         return R.ok(comActActPictureVOS);
     }
 
+    @Override
+    public R getSysPictureList(Integer type) {
+        List<ComActActPictureVO> comActActPictureVOS = new ArrayList<>();
+        List<ComActActPictureDO> comActActPictureDOS = comActActPictureDAO.selectList(new QueryWrapper<ComActActPictureDO>().lambda().
+                eq(ComActActPictureDO::getSysFlag, 1).eq(ComActActPictureDO :: getType, type));
+        if (comActActPictureDOS != null && comActActPictureDOS.size() != 0) {
+            comActActPictureDOS.forEach(comActActPictureDO -> {
+                ComActActPictureVO comActActPictureVO = new ComActActPictureVO();
+                BeanUtils.copyProperties(comActActPictureDO, comActActPictureVO);
+                comActActPictureVOS.add(comActActPictureVO);
+            });
+        }
+        return R.ok(comActActPictureVOS);
+    }
+
     /**
      * 分页展示我的所有活动 时间倒序排列
      *

--
Gitblit v1.7.1