傅行帆 6 年之前
父節點
當前提交
7242191191

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

@@ -87,6 +87,19 @@ public class TpRentalHouseController extends BaseController {
87 87
 		return responseBean;
88 88
 	}
89 89
 	
90
+	@ApiOperation(value = "更新公寓", notes = "更新公寓")
91
+	@ApiImplicitParams({
92
+			@ApiImplicitParam(paramType = "body", dataType = "TpRentalHouse", name = "rentalHouse", value = "公寓"),
93
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
94
+	})
95
+	@RequestMapping(value = "/rental/update",method = RequestMethod.POST)
96
+	public ResponseBean updateRental(@RequestBody TpRentalHouse rentalHouse, HttpSession session){
97
+		ResponseBean responseBean = new ResponseBean();
98
+		UserElement userElement = getUserElement(session);
99
+		responseBean = tpRentalHouseService.updateRental(rentalHouse,userElement);
100
+		return responseBean;
101
+	}
102
+	
90 103
 	@ApiOperation(value = "获取公寓信息", notes = "获取公寓信息")
91 104
 	@ApiImplicitParams({
92 105
 			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "id", value = "公寓Id"),

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

@@ -45,4 +45,12 @@ public interface ITpRentalHouseService extends IService<TpRentalHouse> {
45 45
 	 * @return
46 46
 	 */
47 47
 	TpRentalHouse getRentalById(Integer id);
48
+	
49
+	/**
50
+	 * 更新公寓
51
+	 * @param rentalHouse
52
+	 * @param userElement
53
+	 * @return
54
+	 */
55
+	ResponseBean updateRental(TpRentalHouse rentalHouse, UserElement userElement);
48 56
 }

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

@@ -145,4 +145,48 @@ public class TpRentalHouseServiceImpl extends ServiceImpl<TpRentalHouseMapper, T
145 145
 		tpRentalHouse.setAppCarouselImg(imgList);
146 146
 		return tpRentalHouse;
147 147
 	}
148
+	
149
+	/**
150
+	 * 更新公寓
151
+	 *
152
+	 * @param rentalHouse
153
+	 * @param userElement
154
+	 * @return
155
+	 */
156
+	@Override
157
+	public ResponseBean updateRental(TpRentalHouse rentalHouse, UserElement userElement) {
158
+		ResponseBean responseBean = new ResponseBean();
159
+		rentalHouse.setUpdateDate(LocalDateTime.now());
160
+		rentalHouse.setUpdateUser(userElement.getId());
161
+		tpRentalHouseMapper.updateById(rentalHouse);
162
+		//更新首页图片
163
+		QueryWrapper<TpRentalHouseImg> tpRentalHouseImgQueryWrapper = new QueryWrapper<>();
164
+		tpRentalHouseImgQueryWrapper.eq("community_id", rentalHouse.getCommunityId());
165
+		tpRentalHouseImgQueryWrapper.eq("rental_house_id",rentalHouse.getId());
166
+		tpRentalHouseImgQueryWrapper.eq("img_type","1");
167
+		TpRentalHouseImg tpRentalHouseImg = new TpRentalHouseImg();
168
+		tpRentalHouseImg.setImgUrl(rentalHouse.getAppListImg());
169
+		tpRentalHouseImgMapper.update(tpRentalHouseImg,tpRentalHouseImgQueryWrapper);
170
+		//更新轮播图,先删除在添加
171
+		QueryWrapper<TpRentalHouseImg> deleteQueryWrapper = new QueryWrapper<>();
172
+		deleteQueryWrapper.eq("community_id", rentalHouse.getCommunityId());
173
+		deleteQueryWrapper.eq("rental_house_id",rentalHouse.getId());
174
+		deleteQueryWrapper.eq("img_type","2");
175
+		tpRentalHouseImgMapper.delete(deleteQueryWrapper);
176
+		//插入公寓轮播图信息
177
+		List<String> imgList = rentalHouse.getAppCarouselImg();
178
+		List<TpRentalHouseImg> rentalHouseImgList = new ArrayList<>();
179
+		imgList.stream().forEach(e -> {
180
+			TpRentalHouseImg rentalHouseImg = new TpRentalHouseImg();
181
+			rentalHouseImg.setCommunityId(rentalHouse.getCommunityId());
182
+			rentalHouseImg.setCreateDate(LocalDateTime.now());
183
+			rentalHouseImg.setRentalHouseId(rentalHouse.getId());
184
+			rentalHouseImg.setImgType("2");
185
+			rentalHouseImg.setImgUrl(e);
186
+			rentalHouseImgList.add(rentalHouseImg);
187
+		});
188
+		tpRentalHouseImgMapper.batchInsert(rentalHouseImgList);
189
+		responseBean.addSuccess("更新成功");
190
+		return responseBean;
191
+	}
148 192
 }

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

@@ -36,6 +36,14 @@ export function addRental(listQuery) {
36 36
   })
37 37
 }
38 38
 
39
+export function updateRental(listQuery) {
40
+  return request({
41
+    url: '/rental/update',
42
+    method: 'post',
43
+    data: listQuery
44
+  })
45
+}
46
+
39 47
 export function getRental(id) {
40 48
   return request({
41 49
     url: '/rental/get/' + id,

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

@@ -1,4 +1,4 @@
1
-import { fetchRentalList, shelfRental, obtainedRental, addRental, getRental } from '@/api/rental'
1
+import { fetchRentalList, shelfRental, obtainedRental, addRental, getRental, updateRental } from '@/api/rental'
2 2
 
3 3
 const transaction = {
4 4
   namespaced: true,
@@ -28,6 +28,15 @@ const transaction = {
28 28
         })
29 29
       })
30 30
     },
31
+    UpdateRental({ commit }, listQuery) {
32
+      return new Promise((resolve, reject) => {
33
+        updateRental(listQuery).then(response => {
34
+          resolve(response)
35
+        }).catch(error => {
36
+          reject(error)
37
+        })
38
+      })
39
+    },
31 40
     GetRental({ commit }, id) {
32 41
       return new Promise((resolve, reject) => {
33 42
         getRental(id).then(response => {

+ 7
- 7
VUECODE/smart-property-manage/src/views/rental/rentalEdit.vue 查看文件

@@ -81,12 +81,12 @@
81 81
         <el-checkbox v-model="listData.washingMachine" true-label="1" false-label="0">洗衣机</el-checkbox>
82 82
         <el-checkbox v-model="listData.airConditioning" true-label="1" false-label="0">空调</el-checkbox>
83 83
         <el-checkbox v-model="listData.fridge" true-label="1" false-label="0">冰箱</el-checkbox>
84
-        <el-checkbox v-model="listData.TV" true-label="1" false-label="0">电视</el-checkbox>
84
+        <el-checkbox v-model="listData.tv" true-label="1" false-label="0">电视</el-checkbox>
85 85
         <el-checkbox v-model="listData.smartLock" true-label="1" false-label="0">智能锁</el-checkbox>
86 86
         <el-checkbox v-model="listData.waterHeater" true-label="1" false-label="0">热水器</el-checkbox>
87 87
         <el-checkbox v-model="listData.desk" true-label="1" false-label="0">桌子</el-checkbox>
88 88
         <el-checkbox v-model="listData.chair" true-label="1" false-label="0">椅子</el-checkbox>
89
-        <el-checkbox v-model="listData.WiFi" true-label="1" false-label="0">网络</el-checkbox>
89
+        <el-checkbox v-model="listData.wiFi" true-label="1" false-label="0">网络</el-checkbox>
90 90
         <el-checkbox v-model="listData.kitchen" true-label="1" false-label="0">厨房</el-checkbox>
91 91
         <el-checkbox v-model="listData.bathroom" true-label="1" false-label="0">独卫</el-checkbox>
92 92
         <el-checkbox v-model="listData.balcony" true-label="1" false-label="0">阳台</el-checkbox>
@@ -156,12 +156,12 @@ export default {
156 156
         washingMachine: '',
157 157
         airConditioning: '',
158 158
         fridge: '',
159
-        TV: '',
159
+        tv: '',
160 160
         smartLock: '',
161 161
         waterHeater: '',
162 162
         desk: '',
163 163
         chair: '',
164
-        WiFi: '',
164
+        wiFi: '',
165 165
         kitchen: '',
166 166
         bathroom: '',
167 167
         balcony: ''
@@ -262,7 +262,7 @@ export default {
262 262
     submitForm(formName) { // 提交
263 263
       this.$refs[formName].validate((valid) => {
264 264
         if (valid) {
265
-          this.addRental()
265
+          this.updateRental()
266 266
         } else {
267 267
           console.log('error submit!!')
268 268
           return false
@@ -278,7 +278,7 @@ export default {
278 278
       console.log(this.isRegistered)
279 279
       this.$refs[formName].resetFields()
280 280
     },
281
-    addRental() {
281
+    updateRental() {
282 282
       // 加载框
283 283
       const loading = this.$loading({
284 284
         lock: true,
@@ -286,7 +286,7 @@ export default {
286 286
         spinner: 'el-icon-loading',
287 287
         background: 'rgba(0, 0, 0, 0.7)'
288 288
       })
289
-      this.$store.dispatch('rental/AddRental', this.listData).then((res) => {
289
+      this.$store.dispatch('rental/UpdateRental', this.listData).then((res) => {
290 290
         if (res.code === '0') {
291 291
           this.$message({
292 292
             message: res.message,