From c4fb77c78f0617abdf117ca135dfee519f0bca51 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 03 Jan 2024 18:13:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/main/java/org/springblade/modules/house/controller/HouseholdController.java | 59 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/springblade/modules/house/controller/HouseholdController.java b/src/main/java/org/springblade/modules/house/controller/HouseholdController.java
index d8e7e7e..1c5c1ff 100644
--- a/src/main/java/org/springblade/modules/house/controller/HouseholdController.java
+++ b/src/main/java/org/springblade/modules/house/controller/HouseholdController.java
@@ -16,15 +16,14 @@
*/
package org.springblade.modules.house.controller;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-
+import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@@ -32,17 +31,20 @@
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.house.entity.HouseholdEntity;
+import org.springblade.modules.house.entity.UserHouseLabelEntity;
import org.springblade.modules.house.excel.HouseHoldExcel;
import org.springblade.modules.house.excel.HouseHoldImporter;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.modules.house.entity.HouseholdEntity;
+import org.springblade.modules.house.service.IHouseholdService;
+import org.springblade.modules.house.service.IUserHouseLabelService;
import org.springblade.modules.house.vo.HouseholdVO;
import org.springblade.modules.house.wrapper.HouseholdWrapper;
-import org.springblade.modules.house.service.IHouseholdService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
import java.util.List;
/**
@@ -58,6 +60,7 @@
public class HouseholdController extends BladeController {
private final IHouseholdService householdService;
+ private final IUserHouseLabelService userHouseLabelService;
/**
* 住户 详情
@@ -139,7 +142,7 @@
*/
@PostMapping("/saveOrUpdateHousehold")
@ApiOperation(value = "自定义新增或修改", notes = "传入household")
- public R saveOrUpdateHousehold(@Valid @RequestBody HouseholdEntity household) {
+ public R saveOrUpdateHousehold(@Valid @RequestBody HouseholdVO household) {
return R.status(householdService.saveOrUpdateHousehold(household));
}
@@ -149,8 +152,26 @@
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
+ @Transactional(rollbackFor = Exception.class)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
- return R.status(householdService.removeByIds(Func.toLongList(ids)));
+ List<Long> idList = Func.toLongList(ids);
+ boolean removeByIds = householdService.removeByIds(idList);
+ // 同时删除当前住户对应的标签
+ removeHouseholdLabel(idList);
+ // 返回
+ return R.status(removeByIds);
+ }
+
+ /**
+ * 删除住户标签信息
+ * @param idList
+ */
+ public void removeHouseholdLabel(List<Long> idList) {
+ for (Long id : idList) {
+ QueryWrapper<UserHouseLabelEntity> wrapper = new QueryWrapper<>();
+ wrapper.eq("household_id",id);
+ userHouseLabelService.remove(wrapper);
+ }
}
/**
@@ -159,8 +180,8 @@
@PostMapping("/statistics")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "住户审核统计", notes = "网格员调用")
- public R remove( ) {
- return R.data(householdService.statistics(AuthUtil.getUserId()));
+ public R getStatistics() {
+ return R.data(householdService.statistics(AuthUtil.getUserId(), ""));
}
/**
@@ -213,4 +234,14 @@
}
+ /**
+ * 住户业主信息处理,将业主人员插入到用户表
+ * @return
+ */
+ @GetMapping("/userHandle")
+ public R userHandle() {
+ return R.data(householdService.userHandle());
+ }
+
+
}
--
Gitblit v1.9.3