dingxin 6 years ago
parent
commit
b628190850

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java View File

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

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/SysReportReasonMapper.java View File

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

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpMessageMapper.java View File

46
      * 查询工单id是否为空
46
      * 查询工单id是否为空
47
      */
47
      */
48
     Integer selectTicket(@Param(value = "communityId") Integer ticketId);
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 View File

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

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java View File

1
 package com.community.huiju.service;
1
 package com.community.huiju.service;
2
 
2
 
3
 import com.community.commom.mode.ResponseBean;
3
 import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.session.UserElement;
4
 import com.community.huiju.model.*;
5
 import com.community.huiju.model.*;
5
 
6
 
6
 import java.io.IOException;
7
 import java.io.IOException;
151
  	 * @param id
152
  	 * @param id
152
 	 * @return
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 View File

3
 import com.alibaba.fastjson.JSONObject;
3
 import com.alibaba.fastjson.JSONObject;
4
 import com.community.commom.constant.Constant;
4
 import com.community.commom.constant.Constant;
5
 import com.community.commom.mode.ResponseBean;
5
 import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
6
 import com.community.huiju.dao.*;
7
 import com.community.huiju.dao.*;
7
 import com.community.huiju.model.*;
8
 import com.community.huiju.model.*;
8
 import com.community.huiju.service.ImageServiceI;
9
 import com.community.huiju.service.ImageServiceI;
454
     }
455
     }
455
 
456
 
456
     @Override
457
     @Override
457
-    public ResponseBean deleteransaction(Integer id,Integer userId) {
458
+    public ResponseBean deleteransaction(Integer id, UserElement userElement) {
458
         ResponseBean responseBean= new ResponseBean();
459
         ResponseBean responseBean= new ResponseBean();
459
         TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
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
             tpTransaction.setStatus("0");
462
             tpTransaction.setStatus("0");
462
             tpTransaction.setUpdateDate(new Date());
463
             tpTransaction.setUpdateDate(new Date());
463
             tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
464
             tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
464
             responseBean.addSuccess("删除成功");
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
         }else {
487
         }else {
466
             responseBean.addSuccess("当前ID不存在");
488
             responseBean.addSuccess("当前ID不存在");
467
         }
489
         }
524
             message.setModelType("2");
546
             message.setModelType("2");
525
             //超级管理员
547
             //超级管理员
526
             message.setUuid(toCommunitiesMapper.selectAndmin(communityId));
548
             message.setUuid(toCommunitiesMapper.selectAndmin(communityId));
549
+            message.setModelType("1");
550
+            message.setUuid(userId);
527
             message.setUuidType("2");
551
             message.setUuidType("2");
528
             message.setSource("1");
552
             message.setSource("1");
529
             message.setMessageContent("{" + taUser.getUserName() + "}举报了{" + createUser.getUserName() + "}发布的帖子:{" + tpTransaction.getTransactionTitle() +  "},举报原因:{" + sysReportReason.getReason() + "},点击责令发布人修改或直接作废帖子");
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 View File

314
         message.setUuidType("2");
314
         message.setUuidType("2");
315
         message.setSource("2");
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
          String userName = null;
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
         response.addSuccess(tpTicketReco);
333
         response.addSuccess(tpTicketReco);
331
         return response;
334
         return response;
332
     }
335
     }

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaSysUserRoleMapper.xml View File

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

+ 33
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml View File

390
     tp_message
390
     tp_message
391
     when ticket_id=#{ticketId}
391
     when ticket_id=#{ticketId}
392
   </select>
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
 </mapper>
426
 </mapper>