weiximei 6 年之前
父節點
當前提交
39929adabf

+ 27
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java 查看文件

@@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
18 18
 import javax.servlet.http.HttpSession;
19 19
 import java.io.IOException;
20 20
 import java.util.List;
21
+import java.util.Map;
21 22
 
22 23
 /**
23 24
  * @author weichaochao
@@ -304,6 +305,23 @@ public class SocialController extends BaseController {
304 305
         ResponseBean response = socialServiceI.addAllTransaction(userId, paramets);
305 306
         return response;
306 307
     }
308
+    
309
+    @ApiOperation(value = "举报二手交易帖子", notes = "举报二手交易帖子")
310
+    @ApiImplicitParams({
311
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
312
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="transactionId:二手交易帖子id, reportReasonId:举报原因id"),
313
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
314
+    })
315
+    @RequestMapping(value = "/transaction/report/{communityId}", method = RequestMethod.POST)
316
+    @ResponseBody
317
+    public ResponseBean reportTransaction(@PathVariable("communityId") Integer communityId,@RequestBody String paramets, HttpSession session)throws IOException{
318
+        
319
+        ResponseBean responseBean = new ResponseBean();
320
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
321
+        Integer userId = userElement.getId();
322
+        ResponseBean response = socialServiceI.reportTransaction(userId, communityId,paramets);
323
+        return response;
324
+    }
307 325
 
308 326
     @ApiOperation(value = "获取我发布所有二手租赁帖子", notes = "获取我发布所有二手租赁帖子")
309 327
     @ApiImplicitParams({
@@ -374,4 +392,13 @@ public class SocialController extends BaseController {
374 392
         socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
375 393
         return responseBean;
376 394
     }
395
+    
396
+    @ApiOperation(value = "获取举报原因列表", notes = "获取举报原因列表")
397
+    @RequestMapping(value = "/reports", method = RequestMethod.GET)
398
+    public ResponseBean getReportReasons() {
399
+        ResponseBean responseBean = new ResponseBean();
400
+        List<Map<String,Object>> reportList = socialServiceI.getReportReasons();
401
+        responseBean.addSuccess(reportList);
402
+        return responseBean;
403
+    }
377 404
 }

+ 5
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java 查看文件

@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;
8
+import java.util.Map;
8 9
 
9 10
 @Mapper
10 11
 public interface TpTransactionMapper {
@@ -27,4 +28,8 @@ public interface TpTransactionMapper {
27 28
     void updateTransaction(@Param("id")Integer id, @Param("transactionTitle")String transactionTitle, @Param("transactionContent")String transactionContent, @Param("userId")Integer userId);
28 29
 
29 30
     TpTransaction getById(@Param("id")Integer id);
31
+	
32
+	List<Map<String, Object>> getReportReasons();
33
+    
34
+    int saveReportReason(@Param("userId") Integer userId,@Param("communityId") Integer communityId,@Param("transactionId") Integer transactionId,@Param("reportReasonId") String reportReasonId);
30 35
 }

+ 13
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java 查看文件

@@ -29,6 +29,11 @@ public class TpTransaction {
29 29
     private Date updateDate;
30 30
 
31 31
     private List<String> imgList;
32
+    
33
+    /**
34
+     * 是否被举报 1是被举报 0或null是没被举报
35
+     */
36
+    private String isReported;
32 37
 
33 38
     private  Integer roleId;
34 39
 
@@ -150,4 +155,12 @@ public class TpTransaction {
150 155
     public void setImgList(List<String> imgList) {
151 156
         this.imgList = imgList;
152 157
     }
158
+    
159
+    public String getIsReported() {
160
+        return isReported;
161
+    }
162
+    
163
+    public void setIsReported(String isReported) {
164
+        this.isReported = isReported;
165
+    }
153 166
 }

+ 16
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java 查看文件

@@ -5,6 +5,7 @@ import com.community.huiju.model.*;
5 5
 
6 6
 import java.io.IOException;
7 7
 import java.util.List;
8
+import java.util.Map;
8 9
 
9 10
 /**
10 11
  * @author weichaochao
@@ -151,4 +152,19 @@ public interface SocialServiceI {
151 152
 	 * @return
152 153
 	 */
153 154
 	ResponseBean deleteransaction(Integer id,Integer userid);
155
+	
156
+	/**
157
+	 * 获取举报原因列表
158
+	 * @return
159
+	 */
160
+	List<Map<String, Object>> getReportReasons();
161
+	
162
+	/**
163
+	 * 举报二手交易帖子
164
+	 * @param userId
165
+	 * @param communityId
166
+	 * @param paramets
167
+	 * @return
168
+	 */
169
+	ResponseBean reportTransaction(Integer userId,Integer communityId, String paramets);
154 170
 }

+ 48
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 查看文件

@@ -11,6 +11,7 @@ import com.github.pagehelper.Page;
11 11
 import com.github.pagehelper.PageHelper;
12 12
 import com.google.common.collect.Maps;
13 13
 import com.sun.org.apache.bcel.internal.generic.NEW;
14
+import io.swagger.models.auth.In;
14 15
 import org.springframework.beans.BeanUtils;
15 16
 import org.springframework.beans.factory.annotation.Autowired;
16 17
 import org.springframework.stereotype.Service;
@@ -26,6 +27,7 @@ import java.util.stream.Collectors;
26 27
  * @date 2018/10/23
27 28
  */
28 29
 @Service("SocialService")
30
+@Transactional
29 31
 public class SocialServiceImpl implements SocialServiceI {
30 32
 
31 33
     @Autowired
@@ -445,8 +447,52 @@ public class SocialServiceImpl implements SocialServiceI {
445 447
         }
446 448
         return responseBean;
447 449
         }
448
-
449
-
450
+    
451
+    /**
452
+     * 获取举报原因列表
453
+     *
454
+     * @return
455
+     */
456
+    @Override
457
+    public List<Map<String, Object>> getReportReasons() {
458
+        return tpTransactionMapper.getReportReasons();
459
+    }
460
+    
461
+    /**
462
+     * 举报二手交易帖子
463
+     *
464
+     * @param userId
465
+     * @param paramets
466
+     * @return
467
+     */
468
+    @Override
469
+    public ResponseBean reportTransaction(Integer userId, Integer communityId, String paramets) {
470
+        ResponseBean responseBean = new ResponseBean();
471
+        JSONObject jsonObject = JSONObject.parseObject(paramets);
472
+        Integer transactionId = jsonObject.getInteger("transactionId");
473
+        String reportReasonId = jsonObject.getString("reportReasonId");
474
+        //校验举报的帖子存不存在
475
+        TpTransaction tpTransaction = tpTransactionMapper.selectByPrimaryKey(transactionId,communityId);
476
+        if (null == tpTransaction){
477
+            responseBean.addError("举报的交易不存在");
478
+            return responseBean;
479
+        }
480
+        //插入举报表
481
+        tpTransactionMapper.saveReportReason(userId,communityId,transactionId,reportReasonId);
482
+        //更新交易表的举报状态为被举报
483
+        TpTransaction record = new TpTransaction();
484
+        record.setId(transactionId);
485
+        record.setIsReported("1");
486
+        Integer size = tpTransactionMapper.updateByPrimaryKeySelective(record);
487
+        if (size > 0){
488
+            responseBean.addSuccess(size);
489
+            return responseBean;
490
+        }
491
+        responseBean.addError("举报出错");
492
+        return responseBean;
493
+    }
494
+    
495
+    
450 496
     @Override
451 497
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
452 498
         //修改工单内容和评分

+ 14
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml 查看文件

@@ -156,6 +156,9 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
156 156
       <if test="viewCount != null" >
157 157
         view_count = #{viewCount,jdbcType=INTEGER},
158 158
       </if>
159
+      <if test="isReported != null and isReported !=''" >
160
+        is_reported = #{isReported,jdbcType=CHAR},
161
+      </if>
159 162
       <if test="status != null" >
160 163
         status = #{status,jdbcType=CHAR},
161 164
       </if>
@@ -238,4 +241,15 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
238 241
     from tp_transaction
239 242
     where id = #{id,jdbcType=INTEGER} and status = 1
240 243
   </select>
244
+
245
+  <select id="getReportReasons" resultType="java.util.Map">
246
+    SELECT id,reason FROM sys_report_reason ORDER BY sort
247
+  </select>
248
+
249
+  <insert id="saveReportReason">
250
+    insert into tp_transaction_report (community_id, transaction_id,
251
+      report_reason_id, reporter_id)
252
+    values (#{communityId,jdbcType=INTEGER}, #{transactionId,jdbcType=INTEGER},
253
+      #{reportReasonId,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER})
254
+  </insert>
241 255
 </mapper>

+ 14
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpAnnouncementController.java 查看文件

@@ -36,6 +36,7 @@ public class TpAnnouncementController extends BaseController {
36 36
         ResponseBean tpAnnouncementList=tpAnnouncementService.tpAnnouncemenList(paramets,userElement.getCommunityId());
37 37
         return tpAnnouncementList;
38 38
     }
39
+
39 40
     @ApiOperation(value = "添加公告",nickname ="添加公告")
40 41
     @ApiImplicitParams({
41 42
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="announcementTitle:公告标题," +
@@ -47,6 +48,7 @@ public class TpAnnouncementController extends BaseController {
47 48
         ResponseBean  addAnnouncement= tpAnnouncementService.addAnnouncement(paramets,userElement.getCommunityId(),userElement.getId());
48 49
         return addAnnouncement;
49 50
     }
51
+
50 52
     @ApiOperation(value = "查询公告详情",nickname ="查询公告详情")
51 53
     @ApiImplicitParams({
52 54
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="id:公告id")})
@@ -56,4 +58,16 @@ public class TpAnnouncementController extends BaseController {
56 58
         return tpAnnouncement;
57 59
     }
58 60
 
61
+    @ApiOperation(value = "查询公告详情",nickname ="查询公告详情")
62
+    @ApiImplicitParams({
63
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="id:公告id,announcementTitle:公告标题," +
64
+                    "announcementCarouselImg:轮播图,announcementContent:内容,contentImg:内容图片,sort:权重值,status:'0 是已作废 1 是已发布   2 是草稿 3 是已修改',")})
65
+    @RequestMapping(value="/updateAnnouncement",method = RequestMethod.POST)
66
+    public ResponseBean updateAnnouncement(@RequestBody String paramets,HttpSession session){
67
+        UserElement userElement = getUserElement(session);
68
+        ResponseBean tpAnnouncement= tpAnnouncementService.updateAnnouncement(paramets,userElement.getCommunityId(),userElement.getId());
69
+        return tpAnnouncement;
70
+    }
71
+
72
+
59 73
 }

+ 7
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/TpAnnouncementService.java 查看文件

@@ -32,4 +32,11 @@ public interface TpAnnouncementService extends IService<TpAnnouncement> {
32 32
      * @return
33 33
      */
34 34
     ResponseBean announcementById(String paramets);
35
+
36
+    /**
37
+     * 添加公告
38
+      * @param paramets
39
+     * @return
40
+     */
41
+    ResponseBean updateAnnouncement(String paramets,Integer communityId,Integer userId);
35 42
 }

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

@@ -124,7 +124,6 @@ private  TpAnnouncementMapper tpAnnouncementMapper;
124 124
             tdImages.setCreateUser(userId);
125 125
             imagesMapper.insert(tdImages);
126 126
         }
127
-            //添加内容图片
128 127
             return response;
129 128
     }
130 129
         @Override
@@ -148,4 +147,42 @@ private  TpAnnouncementMapper tpAnnouncementMapper;
148 147
             response.addSuccess(map);
149 148
             return response;
150 149
         }
150
+
151
+    @Override
152
+    public ResponseBean updateAnnouncement(String paramets,Integer communityId,Integer userId) {
153
+                  ResponseBean response= new ResponseBean();
154
+         TpAnnouncement tpAnnouncement = JSONObject.parseObject(paramets, TpAnnouncement.class);
155
+//                        String announcementimg=tpAnnouncement.getAnnouncementCarouselImg();
156
+//                        tpAnnouncement.setAnnouncementCarouselImg( "".equals(announcementimg)?null:announcementimg);
157
+                        tpAnnouncement.setCommunityId(communityId);
158
+                        tpAnnouncement.setCreateDate(new Date());
159
+                        tpAnnouncement.setUpdateUser(userId);
160
+                        tpAnnouncement.setCreateUser(userId);
161
+                        tpAnnouncement.setUpdateDate(new Date());
162
+                        tpAnnouncementMapper.updateTpAnnouncement(tpAnnouncement);
163
+
164
+        JSONObject parseObject = JSONObject.parseObject(paramets);
165
+        //内容包含多个图转数组
166
+        JSONArray contentImg = parseObject.getJSONArray("contentImg");
167
+        Integer tdImagesUuid = parseObject.getInteger("id");
168
+        String[] contentImgArray = contentImg.toArray(new String[]{});
169
+        //修改图片时删除原来图片
170
+        if (contentImg.size()!=0){
171
+        QueryWrapper<TdImages> queryWrapper = new QueryWrapper<>();
172
+        queryWrapper.lambda().eq(TdImages::getUuid,tdImagesUuid);
173
+        queryWrapper.lambda().eq(TdImages::getType,"announcement");
174
+        imagesMapper.delete(queryWrapper);
175
+
176
+        for (String img:contentImgArray){
177
+            TdImages tdImages = new TdImages();
178
+            tdImages.setImageUrl(img);
179
+            tdImages.setType("announcement");
180
+            tdImages.setUuid(tpAnnouncement.getId());
181
+            tdImages.setCreateTime(LocalDateTime.now());
182
+            tdImages.setCreateUser(userId);
183
+            imagesMapper.insert(tdImages);
184
+            }
185
+        }
186
+        return response;
187
+    }
151 188
 }

+ 16
- 0
VUECODE/smart-property-manage/src/api/announcement.js 查看文件

@@ -38,3 +38,19 @@ export function announcementById(data) {
38 38
     }
39 39
   })
40 40
 }
41
+// 修改公告
42
+export function updateannouncement(data) {
43
+  return request({
44
+    url: '/updateAnnouncement',
45
+    method: 'post',
46
+    data: {
47
+      id: data.id,
48
+      announcementTitle: data.announcementTitle,
49
+      announcementCarouselImg: data.announcementCarouselImg,
50
+      contentImg: data.contentImg,
51
+      announcementContent: data.announcementContent,
52
+      sort: data.sort,
53
+      status: data.status
54
+    }
55
+  })
56
+}

+ 13
- 1
VUECODE/smart-property-manage/src/store/modules/announcement.js 查看文件

@@ -1,4 +1,4 @@
1
-import { listAnnouncement, addAnnouncement, announcementById } from '@/api/announcement'
1
+import { listAnnouncement, addAnnouncement, announcementById, updateannouncement } from '@/api/announcement'
2 2
 
3 3
 const announcement = {
4 4
   actions: {
@@ -37,6 +37,18 @@ const announcement = {
37 37
           reject(error)
38 38
         })
39 39
       })
40
+    },
41
+    /**
42
+     * 根据id查询公告
43
+     */
44
+    Updateannouncement({ commit }, data) {
45
+      return new Promise((resolve, reject) => {
46
+        updateannouncement(data).then(response => {
47
+          resolve(response)
48
+        }).catch(error => {
49
+          reject(error)
50
+        })
51
+      })
40 52
     }
41 53
   }
42 54
 }

+ 1
- 1
VUECODE/smart-property-manage/src/views/building/batch/batchImport.vue 查看文件

@@ -4,7 +4,7 @@
4 4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
5 5
       <el-form-item>
6 6
         <el-upload :on-preview="handlePreview" :on-change="handleChange" :before-upload="beforeUpload" :limit="1" :on-exceed="handleExceed" class="upload-demo" action="" multiple>
7
-          <el-button style="margin-left: 10px;" size="large" type="primary"><a href="http://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/%E6%A5%BC%E6%A0%8B%E5%BA%93%E6%A8%A1%E6%9D%BF.xlsx?Expires=1548327771">下载模板</a></el-button>
7
+          <a href="http://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/%E6%A5%BC%E6%A0%8B%E5%BA%93%E6%A8%A1%E6%9D%BF.xlsx?Expires=1548327771"><el-button style="margin-left: 10px;" size="large" type="primary">下载模板</el-button></a>
8 8
           <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
9 9
           <el-button style="margin-left: 10px;" size="large" type="success" @click="submitUpload">提交</el-button>
10 10
           <el-button style="margin-left: 10px;" size="large" type="success" @click="dialogBuildingIndex">取消</el-button>

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

@@ -38,7 +38,6 @@
38 38
         <el-input-number v-model="ruleForm.sort" :min="1" :max="10" label="权重值" @change="sortHandleChange"/>
39 39
       </el-form-item>
40 40
       <el-form-item>
41
-        <el-button @click="resetForm('ruleForm','2')">存为草稿</el-button>
42 41
         <el-button type="primary" @click="submitForm('ruleForm','1')">发布</el-button>
43 42
       </el-form-item>
44 43
     </el-form>
@@ -78,7 +77,6 @@ export default {
78 77
     }
79 78
   },
80 79
     mounted() {
81
-      console.log("123")
82 80
     this.getById(this.$route.params.id)
83 81
   },
84 82
   methods: {
@@ -95,10 +93,11 @@ export default {
95 93
         if (valid) {
96 94
           if (this.ruleForm.announcementContent.length <= 0 && this.ruleForm.contentImg.length <= 0) {
97 95
             this.$message.error('活动内容描述 和 活动配图至少要存在一个!')
96
+            loading.close()
98 97
             return 
99 98
           }
100 99
           this.ruleForm.status = status // 发布状态
101
-          this.$store.dispatch('AddAnnouncement', this.ruleForm).then((res) => {
100
+          this.$store.dispatch('Updateannouncement', this.ruleForm).then((res) => {
102 101
             if (res.code === '0') {
103 102
               this.$message({
104 103
                 message: res.message,
@@ -119,10 +118,8 @@ export default {
119 118
           return false
120 119
         }
121 120
       })
122
-    },
123
-    resetForm(formName,status) {
124
-      console.log(status)
125
-      this.submitForm(formName,status)
121
+       // 关闭加载框
122
+      loading.close()
126 123
     },
127 124
     handleAvatarSuccess(res, file) { // 轮播图上传回调
128 125
       this.ruleForm.announcementCarouselImg = res.data[0]
@@ -161,34 +158,17 @@ export default {
161 158
       console.log(value)
162 159
     },
163 160
     getById(id) { // 页面初始化后调用此方法根据ID获取活动信息
164
-     console.log("id:",id)
165 161
       this.ruleForm.id=this.$route.params.id
166
-      console.log("123id:",this.ruleForm.id)
167 162
       this.$store.dispatch('AnnouncementById', this.ruleForm).then((res) => {
168
-        const resData = res.data
169
-        this.ruleForm.announcementTitle=resData.tpAnnouncement.announcementTitle// 标题
170
-        this.ruleForm.announcementContent=resData.tpAnnouncement.announcementContent// 内容
171
-        this.Urlimage=resData.tpAnnouncement.announcementCarouselImg // 轮播图
172
-        this.ruleForm.sort=resData.tpAnnouncement.sort// 权重
163
+      const resData = res.data
164
+      this.ruleForm.announcementTitle=resData.tpAnnouncement.announcementTitle// 标题
165
+      this.ruleForm.announcementContent=resData.tpAnnouncement.announcementContent// 内容
166
+      this.Urlimage=resData.tpAnnouncement.announcementCarouselImg // 轮播图
167
+      this.ruleForm.sort=resData.tpAnnouncement.sort// 权重
173 168
         //多张图片进行遍历
174
-        const imgArr=resData.studentList
175
-        console.log("imgArr:",imgArr)
176
-        this.ruleForm.contentImg=imgArr// 内容图片
177
-        for (let i = 0; i < imgArr.length; i++) {
178
-          // this.contentImgList=resData.studentList[i].imageUrl
179
-          console.log("imgArr2.:",imgArr)
169
+        for (let i = 0; i < resData.studentList.length; i++) {
170
+          this.contentImgList.push({ url: resData.studentList[i].imageUrl })
180 171
         }
181
-        // console.log("this.ruleForm.contentImg",imgArr)
182
-        // const resData = res.data
183
-        // this.imageUrl = resData.info.activityCarouselImg
184
-        // this.ruleForm = resData.info
185
-
186
-        // const imgArr = resData.contentImg
187
-        // this.ruleForm.contentImg = imgArr
188
-        //多张图片进行遍历
189
-        // for (let i = 0; i < imgArr.length; i++) {
190
-        //   this.activityContentList.push({ url: imgArr[i] })
191
-        // }
192 172
       })
193 173
     }
194 174
   }

+ 1112
- 963
文档/MYSQL/smartCommunity.pdb
文件差異過大導致無法顯示
查看文件


+ 1112
- 963
文档/MYSQL/smartCommunity.pdm
文件差異過大導致無法顯示
查看文件