dingxin 6 gadus atpakaļ
vecāks
revīzija
b628190850

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Parādīt failu

@@ -367,7 +367,7 @@ public class SocialController extends BaseController {
367 367
     public ResponseBean deleteTransaction(HttpSession session, @PathVariable("id") String id) {
368 368
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
369 369
         Integer userId = userElement.getId();
370
-        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userId);
370
+        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userElement);
371 371
         return response;
372 372
     }
373 373
 

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/SysReportReasonMapper.java Parādīt failu

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.SysReportReason;
4
+import org.apache.ibatis.annotations.Mapper;
4 5
 
6
+@Mapper
5 7
 public interface SysReportReasonMapper {
6 8
     int deleteByPrimaryKey(Integer id);
7 9
 

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpMessageMapper.java Parādīt failu

@@ -46,4 +46,11 @@ public interface TpMessageMapper {
46 46
      * 查询工单id是否为空
47 47
      */
48 48
     Integer selectTicket(@Param(value = "communityId") Integer ticketId);
49
+
50
+    /**
51
+     * 根据条件查询消息
52
+     * @param map
53
+     * @return
54
+     */
55
+    TpMessage selectConditionsTpMessage(Map<String, Object> map);
49 56
 }

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionReportMapper.java Parādīt failu

@@ -1,8 +1,10 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTransactionReport;
4
+import org.apache.ibatis.annotations.Mapper;
4 5
 import org.apache.ibatis.annotations.Param;
5 6
 
7
+@Mapper
6 8
 public interface TpTransactionReportMapper {
7 9
     int deleteByPrimaryKey(Integer id);
8 10
 

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Parādīt failu

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.service;
2 2
 
3 3
 import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
4 5
 import com.community.huiju.model.*;
5 6
 
6 7
 import java.io.IOException;
@@ -151,7 +152,7 @@ public interface SocialServiceI {
151 152
  	 * @param id
152 153
 	 * @return
153 154
 	 */
154
-	ResponseBean deleteransaction(Integer id,Integer userid);
155
+	ResponseBean deleteransaction(Integer id, UserElement userElement);
155 156
 	
156 157
 	/**
157 158
 	 * 获取举报原因列表

+ 26
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Parādīt failu

@@ -3,6 +3,7 @@ package com.community.huiju.service.impl;
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.community.commom.constant.Constant;
5 5
 import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
6 7
 import com.community.huiju.dao.*;
7 8
 import com.community.huiju.model.*;
8 9
 import com.community.huiju.service.ImageServiceI;
@@ -454,14 +455,35 @@ public class SocialServiceImpl implements SocialServiceI {
454 455
     }
455 456
 
456 457
     @Override
457
-    public ResponseBean deleteransaction(Integer id,Integer userId) {
458
+    public ResponseBean deleteransaction(Integer id, UserElement userElement) {
458 459
         ResponseBean responseBean= new ResponseBean();
459 460
         TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
460
-        if(null!= tpTransaction && userId.equals(tpTransaction.getTaUserId())) {
461
+        if(null!= tpTransaction && userElement.getId().equals(tpTransaction.getTaUserId())) {
461 462
             tpTransaction.setStatus("0");
462 463
             tpTransaction.setUpdateDate(new Date());
463 464
             tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
464 465
             responseBean.addSuccess("删除成功");
466
+
467
+
468
+
469
+            // 把消息变为无效
470
+            Map<String, Object> map = new HashMap<>();
471
+            map.put("communityId", userElement.getCommunityId());
472
+            map.put("messageType", "9");
473
+            map.put("adviceType", "4");
474
+            map.put("uuidType", "2");
475
+            map.put("source", "1");
476
+            map.put("status", "1");
477
+            map.put("modelType", "1");
478
+            map.put("transactionId", tpTransaction.getId());
479
+            TpMessage tpMessage = tpMessageMapper.selectConditionsTpMessage(map);
480
+            if (null != tpMessage) {
481
+                tpMessage.setStatus("0");
482
+                tpMessageMapper.updateByPrimaryKeySelective(tpMessage);
483
+            }
484
+
485
+
486
+
465 487
         }else {
466 488
             responseBean.addSuccess("当前ID不存在");
467 489
         }
@@ -524,6 +546,8 @@ public class SocialServiceImpl implements SocialServiceI {
524 546
             message.setModelType("2");
525 547
             //超级管理员
526 548
             message.setUuid(toCommunitiesMapper.selectAndmin(communityId));
549
+            message.setModelType("1");
550
+            message.setUuid(userId);
527 551
             message.setUuidType("2");
528 552
             message.setSource("1");
529 553
             message.setMessageContent("{" + taUser.getUserName() + "}举报了{" + createUser.getUserName() + "}发布的帖子:{" + tpTransaction.getTransactionTitle() +  "},举报原因:{" + sysReportReason.getReason() + "},点击责令发布人修改或直接作废帖子");

+ 15
- 12
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Parādīt failu

@@ -314,19 +314,22 @@ public class TicketServiceImpl implements ITicketService {
314 314
         message.setUuidType("2");
315 315
         message.setSource("2");
316 316
         //当前插入为超级管理员
317
-        Integer uuserID= toCommunitiesMapper.selectAndmin(user.getCommunityId());
318
-        message.setUuid(uuserID);
319
-         TaSysUserRole taSysUserRole= taSysUserRoleMapper.selectRole(userId,user.getCommunityId());
317
+         Integer uuserID= toCommunitiesMapper.selectAndmin(user.getCommunityId());
318
+         message.setUuid(uuserID);
319
+         TaSysUserRole taSysUserRole= taSysUserRoleMapper.selectRole(user.getCommunityId(), userId);
320 320
          String userName = null;
321
-        if("1".equals(taSysUserRole.getRoleId())){userName="业主"; }
322
-        if("2".equals(taSysUserRole.getRoleId())){userName="家属" ;}
323
-        if("3".equals(taSysUserRole.getRoleId())){userName="租客" ;}
324
-        message.setMessageContent(userName+user.getUserName()+"发起了一个工单“"+tpTicket.getTicketTitle()+"”,点击受理分配给合适的人处理");
325
-        message.setStatus("1");
326
-        message.setReadStatus("0");
327
-        message.setCreateUser(userId);
328
-        message.setCreateDate(new Date());
329
-        tpMessageMapper.insert(message);
321
+         if (null != taSysUserRole) {
322
+             if(1 == taSysUserRole.getRoleId().intValue()){userName="业主"; }
323
+             if(2 == taSysUserRole.getRoleId().intValue()){userName="家属" ;}
324
+             if(3 == taSysUserRole.getRoleId().intValue()){userName="租客" ;}
325
+             message.setMessageContent(userName+user.getUserName()+"发起了一个工单“"+tpTicket.getTicketTitle()+"”,点击受理分配给合适的人处理");
326
+             message.setStatus("1");
327
+             message.setReadStatus("0");
328
+             message.setCreateUser(userId);
329
+             message.setCreateDate(new Date());
330
+             tpMessageMapper.insert(message);
331
+         }
332
+
330 333
         response.addSuccess(tpTicketReco);
331 334
         return response;
332 335
     }

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaSysUserRoleMapper.xml Parādīt failu

@@ -94,7 +94,7 @@
94 94
     where community_id = #{communityId,jdbcType=INTEGER} and user_id = #{userId,jdbcType=INTEGER}
95 95
   </select>
96 96
 
97
-  <select id="selectRole">
97
+  <select id="selectRole" resultMap="BaseResultMap">
98 98
     select
99 99
     <include refid="Base_Column_List" />
100 100
     from ta_sys_user_role

+ 33
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Parādīt failu

@@ -390,4 +390,37 @@
390 390
     tp_message
391 391
     when ticket_id=#{ticketId}
392 392
   </select>
393
+  <select id="selectConditionsTpMessage" resultMap="BaseResultMap" parameterType="map">
394
+    SELECT
395
+        *
396
+    FROM
397
+        tp_message
398
+    WHERE
399
+    <trim prefixOverrides="and | or">
400
+      <if test="map.communityId != null">
401
+        and community_id = #{map.communityId}
402
+      </if>
403
+      <if test="map.messageType != null">
404
+        and message_type = #{map.messageType}
405
+      </if>
406
+      <if test="map.adviceType != null">
407
+        and advice_type = #{map.adviceType}
408
+      </if>
409
+      <if test="map.uuidType != null">
410
+        and uuid_type = #{map.uuidType}
411
+      </if>
412
+      <if test="map.source != null">
413
+        and source = #{map.source}
414
+      </if>
415
+      <if test="map.status != null">
416
+        and status = #{map.status}
417
+      </if>
418
+      <if test="map.transactionId != null">
419
+        and transaction_id = #{map.transactionId}
420
+      </if>
421
+      <if test="map.modelType != null">
422
+        and model_type = #{map.modelType}
423
+      </if>
424
+    </trim>
425
+  </select>
393 426
 </mapper>