From c10d6358b9f014375a13821465bc978d0c0da22e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Wed, 29 May 2024 17:17:08 +0800
Subject: [PATCH] 通过E呼即办数据统计

---
 src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java |   86 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java b/src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java
index 8a9e906..0970bf2 100644
--- a/src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java
+++ b/src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java
@@ -17,24 +17,31 @@
 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.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;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.modules.house.entity.UserHouseLabelEntity;
+import org.springblade.modules.house.excel.UserHouseLabelExcel;
+import org.springblade.modules.house.excel.UserHouseLabelImporter;
+import org.springblade.modules.house.service.IUserHouseLabelService;
 import org.springblade.modules.house.vo.HouseholdLabelVO;
 import org.springblade.modules.house.wrapper.HouseholdLabelWrapper;
-import org.springblade.modules.house.service.IUserHouseLabelService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 住户-标签 控制器
@@ -124,6 +131,17 @@
 	}
 
 	/**
+	 * 房屋-标签 房屋自定义新增或修改
+	 * @param householdLabel
+	 * @return
+	 */
+	@PostMapping("/saveOrUpdateHouseLabel")
+	@ApiOperation(value = "自定义新增或修改", notes = "传入householdLabel")
+	public R saveOrUpdateHouseLabel(@Valid @RequestBody UserHouseLabelEntity householdLabel) {
+		return R.status(householdLabelService.saveOrUpdateHouseLabel(householdLabel));
+	}
+
+	/**
 	 * 住户-标签 删除
 	 */
 	@PostMapping("/remove")
@@ -140,11 +158,61 @@
 	@PostMapping("/removeHouseholdLabel")
 	public R removeHouseholdLabel(@RequestBody UserHouseLabelEntity householdLabel) {
 		QueryWrapper<UserHouseLabelEntity> wrapper = new QueryWrapper<>();
-		wrapper.eq("household_id",householdLabel.getHouseholdId())
-			.eq("label_id",householdLabel.getLabelId());
+		wrapper.eq("household_id", householdLabel.getHouseholdId())
+			.eq("label_id", householdLabel.getLabelId());
 		// 返回
 		return R.status(householdLabelService.remove(wrapper));
 	}
 
+	/**
+	 * 导入用户
+	 */
+	@PostMapping("import-userHouseLabel")
+	@ApiOperationSupport(order = 12)
+	@ApiOperation(value = "标签住户导入", notes = "传入excel")
+	public R importUser(MultipartFile file, @RequestParam(value = "isCovered", defaultValue = "0") Integer isCovered) {
+		UserHouseLabelImporter userHouseLabelImporter = new UserHouseLabelImporter(householdLabelService, isCovered == 1);
+		ExcelUtil.save(file, userHouseLabelImporter, UserHouseLabelExcel.class);
+		return R.success("操作成功");
+	}
+
+	/**
+	 * 导出模板
+	 */
+	@GetMapping("export-userHouseLabel")
+	@ApiOperationSupport(order = 14)
+	@ApiOperation(value = "导出标签住户模板")
+	public void exportUser(HttpServletResponse response) {
+		List<UserHouseLabelExcel> list = new ArrayList<>();
+		ExcelUtil.export(response, "标签住户数据模板", "标签住户数据表", list, UserHouseLabelExcel.class);
+	}
+
+
+	/**
+	 * 街道重点人员标签统计
+	 * @param householdLabel
+	 * @param query
+	 * @return
+	 */
+	@GetMapping("/getRegionStatisticalLabels")
+	@ApiOperation(value = "街道重点人员标签统计", notes = "")
+	public R<IPage<HouseholdLabelVO>> statisticalLabels(HouseholdLabelVO householdLabel, Query query) {
+		IPage<HouseholdLabelVO> pages = householdLabelService.statisticalLabels(Condition.getPage(query), householdLabel);
+		return R.data(pages);
+	}
+
+	/**
+	 * 社区重点人员标签统计
+	 * @param householdLabel
+	 * @param query
+	 * @return
+	 */
+	@GetMapping("/getCommunityStatisticalLabels")
+	@ApiOperation(value = "社区重点人员标签统计", notes = "")
+	public R<IPage<HouseholdLabelVO>> getCommunityStatisticalLabels(HouseholdLabelVO householdLabel, Query query) {
+		IPage<HouseholdLabelVO> pages = householdLabelService.getCommunityStatisticalLabels(Condition.getPage(query), householdLabel);
+		return R.data(pages);
+	}
+
 
 }

--
Gitblit v1.9.3