傅行帆 6 лет назад
Родитель
Сommit
d4a339219c

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Просмотреть файл

@@ -304,6 +304,7 @@ public class SocialServiceImpl implements SocialServiceI {
304 304
         tpTransaction.setCreateDate(new Date());
305 305
         tpTransaction.setUpdateUser(userId);
306 306
         tpTransaction.setUpdateDate(new Date());
307
+        tpTransaction.setIsReported("0");
307 308
 
308 309
         //判断身份是否为业主且状态为已停用
309 310
         TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userId);

+ 6
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Просмотреть файл

@@ -86,6 +86,9 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
86 86
       <if test="type != null" >
87 87
         type,
88 88
       </if>
89
+      <if test="isReported != null" >
90
+        is_reported,
91
+      </if>
89 92
       <if test="createUser != null" >
90 93
         create_user,
91 94
       </if>
@@ -124,6 +127,9 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
124 127
       <if test="type != null" >
125 128
         #{type,jdbcType=CHAR},
126 129
       </if>
130
+      <if test="isReported != null" >
131
+        #{isReported,jdbcType=CHAR},
132
+      </if>
127 133
       <if test="createUser != null" >
128 134
         #{createUser,jdbcType=INTEGER},
129 135
       </if>

+ 14
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TransactionController.java Просмотреть файл

@@ -79,4 +79,18 @@ public class TransactionController extends BaseController {
79 79
 		responseBean = transactionService.getTransactionInfo(id);
80 80
 		return responseBean;
81 81
 	}
82
+	
83
+	@ApiOperation(value = "作废二手租赁", notes = "作废二手租赁")
84
+	@ApiImplicitParams({
85
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
86
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "Login-Type", value = "值为 web"),
87
+			@ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "id", value = "交易id")
88
+	})
89
+	@RequestMapping(value = "/transaction/update/{id}",method = RequestMethod.POST)
90
+	public ResponseBean updateTransaction(@PathVariable(value = "id") Integer id, HttpSession session){
91
+		ResponseBean responseBean = new ResponseBean();
92
+		UserElement userElement = getUserElement(session);
93
+		responseBean = transactionService.updateTransactionById(id,userElement.getId());
94
+		return responseBean;
95
+	}
82 96
 }

+ 7
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITransactionService.java Просмотреть файл

@@ -23,4 +23,11 @@ public interface ITransactionService extends IService<TpTransaction> {
23 23
 	 * @return
24 24
 	 */
25 25
 	ResponseBean getTransactionInfo(Integer id);
26
+	
27
+	/**
28
+	 * 作废二手交易
29
+	 * @param id
30
+	 * @return
31
+	 */
32
+	ResponseBean updateTransactionById(Integer id,Integer userId);
26 33
 }

+ 26
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TransactionServiceImpl.java Просмотреть файл

@@ -17,6 +17,9 @@ import com.google.common.collect.Maps;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.stereotype.Service;
19 19
 
20
+import javax.xml.crypto.Data;
21
+import java.time.LocalDateTime;
22
+import java.util.Date;
20 23
 import java.util.List;
21 24
 import java.util.Map;
22 25
 import java.util.stream.Collectors;
@@ -73,4 +76,27 @@ public class TransactionServiceImpl extends ServiceImpl<TpTransactionMapper, TpT
73 76
 		responseBean.addSuccess(map);
74 77
 		return responseBean;
75 78
 	}
79
+	
80
+	/**
81
+	 * 作废二手交易
82
+	 *
83
+	 * @param id
84
+	 * @return
85
+	 */
86
+	@Override
87
+	public ResponseBean updateTransactionById(Integer id,Integer userId) {
88
+		ResponseBean responseBean = new ResponseBean();
89
+		TpTransaction tpTransaction = new TpTransaction();
90
+		tpTransaction.setId(id);
91
+		tpTransaction.setStatus("0");
92
+		tpTransaction.setUpdateUser(userId);
93
+		tpTransaction.setUpdateDate(LocalDateTime.now());
94
+		int count = tpTransactionMapper.updateById(tpTransaction);
95
+		if (count > 0){
96
+			responseBean.addSuccess(count);
97
+			return responseBean;
98
+		}
99
+		responseBean.addError("作废出错");
100
+		return responseBean;
101
+	}
76 102
 }

+ 1
- 1
CODE/smart-community/property-api/src/main/resources/mapper/TpTransactionMapper.xml Просмотреть файл

@@ -20,7 +20,7 @@
20 20
             1 = 1
21 21
             AND t.community_id = #{tpTransaction.communityId}
22 22
         <if test="tpTransaction.id != null and tpTransaction.id != ''">
23
-            and t.id = #{tpTransaction.id}
23
+            and t.id like concat('%',#{tpTransaction.id},'%')
24 24
         </if>
25 25
         <if test="tpTransaction.transactionTitle != null and tpTransaction.transactionTitle != ''">
26 26
             and t.transaction_title like concat('%',#{tpTransaction.transactionTitle,jdbcType=VARCHAR},'%')

+ 8
- 0
VUECODE/smart-property-manage/src/api/transaction.js Просмотреть файл

@@ -15,3 +15,11 @@ export function transactionById(id) {
15 15
     method: 'get'
16 16
   })
17 17
 }
18
+
19
+// 作废 活动详情
20
+export function updateTransactionById(id) {
21
+  return request({
22
+    url: '/transaction/update/' + id,
23
+    method: 'post'
24
+  })
25
+}

+ 10
- 1
VUECODE/smart-property-manage/src/store/modules/transaction.js Просмотреть файл

@@ -1,4 +1,4 @@
1
-import { fetchList, transactionById } from '@/api/transaction'
1
+import { fetchList, transactionById, updateTransactionById } from '@/api/transaction'
2 2
 
3 3
 const transaction = {
4 4
   namespaced: true,
@@ -38,6 +38,15 @@ const transaction = {
38 38
           reject(error)
39 39
         })
40 40
       })
41
+    },
42
+    UpdateTransactionById({ commit, state }, id) {
43
+      return new Promise((resolve, reject) => {
44
+        updateTransactionById(id).then(response => {
45
+          resolve(response)
46
+        }).catch(error => {
47
+          reject(error)
48
+        })
49
+      })
41 50
     }
42 51
   }
43 52
 }

+ 0
- 5
VUECODE/smart-property-manage/src/views/social/transaction/index.vue Просмотреть файл

@@ -24,11 +24,6 @@
24 24
       highlight-current-row
25 25
       style="width: 100%; margin-top: 20px;"
26 26
       @sort-change="sortChange">
27
-      <el-table-column
28
-        label="序号"
29
-        align="center"
30
-        type="index"
31
-        width="50"/>
32 27
       <el-table-column label="编号" align="center">
33 28
         <template slot-scope="scope">
34 29
           <span>{{ scope.row.id }}</span>

+ 29
- 1
VUECODE/smart-property-manage/src/views/social/transaction/info/transactionInfo.vue Просмотреть файл

@@ -7,6 +7,7 @@
7 7
     <div class="activityContextImg">
8 8
       <img v-for="item in ruleForm.contentImg" :src="item" width="700" height="500" >
9 9
     </div>
10
+    <el-button v-if="ruleForm.status === '1'" type="primary" style="width: 130px;margin-left: 250px;" @click="invalid">作废</el-button>
10 11
   </div>
11 12
 </template>
12 13
 
@@ -19,6 +20,7 @@ export default {
19 20
       asOfdate: '2018/10/10 23:59:59',
20 21
       ruleForm: {
21 22
         id: '',
23
+        status: '',
22 24
         transactionTitle: '',
23 25
         transactionContent: '', // 交易内容详细
24 26
         contentImg: [] // 活动内容配图
@@ -30,17 +32,43 @@ export default {
30 32
   },
31 33
   methods: {
32 34
     ...mapActions('transaction', [
33
-      'TransactionById'
35
+      'TransactionById',
36
+      'UpdateTransactionById'
34 37
     ]),
35 38
     getById(id) { // 根据ID获取活动信息
36 39
       this.TransactionById(id).then((res) => {
37 40
         const resData = res.data.tpTransaction
38 41
         this.ruleForm.transactionTitle = resData.transactionTitle
39 42
         this.ruleForm.transactionContent = resData.transactionContent
43
+        this.ruleForm.status = resData.status
40 44
         this.ruleForm.contentImg = res.data.list
41 45
       }).catch(() => {
42 46
         console.log('get list error')
43 47
       })
48
+    },
49
+    invalid(){
50
+      this.$confirm('确定要作废此帖吗?作废相当于删除帖子, 是否继续?', '作废确认提示', {
51
+        confirmButtonText: '确定作废',
52
+        cancelButtonText: '取消',
53
+        type: 'warning'
54
+      }).then(() => {
55
+        this.UpdateTransactionById(this.$route.params.id).then((res) => {
56
+          if (res.code === '0') {
57
+          this.$message({
58
+            message: "作废成功",
59
+            type: 'success'
60
+          })
61
+          // 切换路由
62
+          this.$router.push({ name: 'transaction-import' })
63
+          return
64
+        }
65
+        this.$message.error(res.message)
66
+        }).catch(() => {
67
+          console.log('update error')
68
+        })
69
+      }).catch(() => {
70
+        console.log("cancel")        
71
+      });
44 72
     }
45 73
   }
46 74
 }