weiximei 6 年前
父节点
当前提交
c553b188e0

+ 19
- 16
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpAnnouncementServiceImpl.java 查看文件

74
             AnnouncementTable announcementTable = new AnnouncementTable();
74
             AnnouncementTable announcementTable = new AnnouncementTable();
75
             BeanUtils.copyProperties(e, announcementTable);
75
             BeanUtils.copyProperties(e, announcementTable);
76
             //创建人
76
             //创建人
77
-            String createUserName = userMapper.selectByIdUserName(e.getUpdateUser());
77
+            String  updateDateName= userMapper.selectByIdUserName(e.getUpdateUser());
78
             //修改人
78
             //修改人
79
-            String updateDateName = userMapper.selectByIdUserName(e.getCreateUser());
79
+            String  createUserName= userMapper.selectByIdUserName(e.getCreateUser());
80
             announcementTable.setCreateUserName(createUserName);
80
             announcementTable.setCreateUserName(createUserName);
81
             announcementTable.setUpdateDateName(updateDateName);
81
             announcementTable.setUpdateDateName(updateDateName);
82
             return announcementTable;
82
             return announcementTable;
150
     public ResponseBean updateAnnouncement(String paramets,Integer communityId,Integer userId) {
150
     public ResponseBean updateAnnouncement(String paramets,Integer communityId,Integer userId) {
151
                   ResponseBean response= new ResponseBean();
151
                   ResponseBean response= new ResponseBean();
152
          TpAnnouncement tpAnnouncement = JSONObject.parseObject(paramets, TpAnnouncement.class);
152
          TpAnnouncement tpAnnouncement = JSONObject.parseObject(paramets, TpAnnouncement.class);
153
+         int Status= Integer.parseInt(tpAnnouncement.getStatus());
154
+         if (0!=Status){
153
 //                        String announcementimg=tpAnnouncement.getAnnouncementCarouselImg();
155
 //                        String announcementimg=tpAnnouncement.getAnnouncementCarouselImg();
154
 //                        tpAnnouncement.setAnnouncementCarouselImg( "".equals(announcementimg)?null:announcementimg);
156
 //                        tpAnnouncement.setAnnouncementCarouselImg( "".equals(announcementimg)?null:announcementimg);
155
                         tpAnnouncement.setCommunityId(communityId);
157
                         tpAnnouncement.setCommunityId(communityId);
164
         Integer tdImagesUuid = parseObject.getInteger("id");
166
         Integer tdImagesUuid = parseObject.getInteger("id");
165
         String[] contentImgArray = contentImg.toArray(new String[]{});
167
         String[] contentImgArray = contentImg.toArray(new String[]{});
166
         //修改图片时删除原来图片
168
         //修改图片时删除原来图片
167
-        if (contentImg.size()!=0){
168
-        QueryWrapper<TdImages> queryWrapper = new QueryWrapper<>();
169
-        queryWrapper.lambda().eq(TdImages::getUuid,tdImagesUuid);
170
-        queryWrapper.lambda().eq(TdImages::getType,"announcement");
171
-        imagesMapper.delete(queryWrapper);
172
-
173
-        for (String img:contentImgArray){
174
-            TdImages tdImages = new TdImages();
175
-            tdImages.setImageUrl(img);
176
-            tdImages.setType("announcement");
177
-            tdImages.setUuid(tpAnnouncement.getId());
178
-            tdImages.setCreateTime(LocalDateTime.now());
179
-            tdImages.setCreateUser(userId);
180
-            imagesMapper.insert(tdImages);
169
+        if (contentImg.size()!=0) {
170
+            QueryWrapper<TdImages> queryWrapper = new QueryWrapper<>();
171
+            queryWrapper.lambda().eq(TdImages::getUuid, tdImagesUuid);
172
+            queryWrapper.lambda().eq(TdImages::getType, "announcement");
173
+            imagesMapper.delete(queryWrapper);
174
+
175
+            for (String img : contentImgArray) {
176
+                TdImages tdImages = new TdImages();
177
+                tdImages.setImageUrl(img);
178
+                tdImages.setType("announcement");
179
+                tdImages.setUuid(tpAnnouncement.getId());
180
+                tdImages.setCreateTime(LocalDateTime.now());
181
+                tdImages.setCreateUser(userId);
182
+                imagesMapper.insert(tdImages);
181
             }
183
             }
182
         }
184
         }
185
+        }
183
         return response;
186
         return response;
184
     }
187
     }
185
 
188
 

+ 1
- 1
CODE/smart-community/property-api/src/main/resources/mapper/TpAnnouncementMapper.xml 查看文件

15
       tp_announcement
15
       tp_announcement
16
       <where>
16
       <where>
17
         <if test="record.id != null and record.id != ''" >
17
         <if test="record.id != null and record.id != ''" >
18
-          AND id =  #{record.id,jdbcType=INTEGER}
18
+          AND id like concat('%',#{record.id,jdbcType=INTEGER},'%')
19
         </if>
19
         </if>
20
         <if test="record.announcementTitle != null and record.announcementTitle != ''" >
20
         <if test="record.announcementTitle != null and record.announcementTitle != ''" >
21
           AND announcement_title like concat('%',#{record.announcementTitle,jdbcType=VARCHAR},'%')
21
           AND announcement_title like concat('%',#{record.announcementTitle,jdbcType=VARCHAR},'%')

+ 5
- 0
VUECODE/smart-property-manage/src/views/social/activity/add/index.vue 查看文件

167
         spinner: 'el-icon-loading',
167
         spinner: 'el-icon-loading',
168
         background: 'rgba(0, 0, 0, 0.7)'
168
         background: 'rgba(0, 0, 0, 0.7)'
169
       })
169
       })
170
+      if(this.ruleForm.activityCarouselImg<=0){
171
+            this.$message.error('轮播图未上传')
172
+            loading.close()
173
+            return    
174
+          }
170
       if (this.ruleForm.activityContent.length <= 0 && this.ruleForm.contentImg.length <= 0) {
175
       if (this.ruleForm.activityContent.length <= 0 && this.ruleForm.contentImg.length <= 0) {
171
         this.$message.error('活动内容描述 和 活动配图至少要存在一个!')
176
         this.$message.error('活动内容描述 和 活动配图至少要存在一个!')
172
         loading.close()
177
         loading.close()

+ 4
- 0
VUECODE/smart-property-manage/src/views/social/announcement/add.vue 查看文件

86
       })
86
       })
87
       this.$refs[formName].validate((valid) => {
87
       this.$refs[formName].validate((valid) => {
88
         if (valid) {
88
         if (valid) {
89
+          if(this.ruleForm.announcementCarouselImg<=0){
90
+            this.$message.error('轮播图未上传')
91
+            return    
92
+          }
89
           if (this.ruleForm.announcementContent.length <= 0 && this.ruleForm.contentImg.length <= 0) {
93
           if (this.ruleForm.announcementContent.length <= 0 && this.ruleForm.contentImg.length <= 0) {
90
             this.$message.error('公告内容描述 和 公告配图至少要存在一个!')
94
             this.$message.error('公告内容描述 和 公告配图至少要存在一个!')
91
             return
95
             return

+ 0
- 1
VUECODE/smart-property-manage/src/views/social/announcement/details.vue 查看文件

52
         for (let i = 0; i < imgList.length; i++) {
52
         for (let i = 0; i < imgList.length; i++) {
53
           this.ruleForm.contentImg.push({ url: imgList[i].imageUrl })
53
           this.ruleForm.contentImg.push({ url: imgList[i].imageUrl })
54
         }
54
         }
55
-        console.log('详情', resData)
56
         if (this.ruleForm.status === '0') {
55
         if (this.ruleForm.status === '0') {
57
           this.isEdi = false
56
           this.isEdi = false
58
         }
57
         }

+ 1
- 3
VUECODE/smart-property-manage/src/views/social/announcement/edit.vue 查看文件

81
   },
81
   },
82
   methods: {
82
   methods: {
83
     submitForm(formName,status) {
83
     submitForm(formName,status) {
84
-      console.log(status)
85
       // 加载框
84
       // 加载框
86
       const loading = this.$loading({
85
       const loading = this.$loading({
87
         lock: true,
86
         lock: true,
156
     },
155
     },
157
     sortHandleChange(value) { // 权重值
156
     sortHandleChange(value) { // 权重值
158
       this.ruleForm.sort = value
157
       this.ruleForm.sort = value
159
-      console.log(value)
160
     },
158
     },
161
-    getById(id) { // 页面初始化后调用此方法根据ID获取活动信息
159
+    getById(id) { // 页面初始化后调用此方法根据ID获取公告信息
162
       this.ruleForm.id=this.$route.params.id
160
       this.ruleForm.id=this.$route.params.id
163
       this.$store.dispatch('AnnouncementById', this.ruleForm).then((res) => {
161
       this.$store.dispatch('AnnouncementById', this.ruleForm).then((res) => {
164
       const resData = res.data
162
       const resData = res.data

+ 14
- 1
VUECODE/smart-property-manage/src/views/social/announcement/index.vue 查看文件

179
         this.$message.error('请选择一行数据进行修改!')
179
         this.$message.error('请选择一行数据进行修改!')
180
         return
180
         return
181
       }
181
       }
182
-      this.$router.push({ name: 'announcement-edit', params: { id: ids[0] }})
182
+       let ide= this.deleteIds[0]
183
+       this.listQuery.id = ide 
184
+      this.$store.dispatch('AnnouncementById', this.listQuery).then((res) => {
185
+        const resData = res.data
186
+        const announcement = resData.tpAnnouncement
187
+        const imgList = resData.studentList
188
+        this.listQuery = announcement
189
+        console.log("1",this.listQuery.status)
190
+        if(this.listQuery.status == 0){
191
+          this.$message.error('已作废不可以修改')
192
+          return
193
+        }
194
+          this.$router.push({ name: 'announcement-edit', params: { id: ids[0] }})
195
+      })
183
       },
196
       },
184
     deleteAnnouncement(){
197
     deleteAnnouncement(){
185
       const ids = this.deleteIds
198
       const ids = this.deleteIds