linwe
2024-08-09 8b7258c9427882bb1798f1502eaa35184c6e374e
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,101 @@
   @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("/getOrgStatisticalLabels")
   @ApiOperation(value = "组织部标签统计", notes = "")
   public R<IPage<HouseholdLabelVO>> orgStatisticalLabels(HouseholdLabelVO householdLabel, Query query) {
      IPage<HouseholdLabelVO> pages = householdLabelService.orgStatisticalLabels(Condition.getPage(query), householdLabel);
      return R.data(pages);
   }
   /**
    * 统战标签统计
    * @param householdLabel
    * @param query
    * @return
    */
   @GetMapping("/getUnitedFrontStatisticalLabels")
   @ApiOperation(value = "统战标签统计", notes = "")
   public R<IPage<HouseholdLabelVO>> unitedFrontStatisticalLabels(HouseholdLabelVO householdLabel, Query query) {
      IPage<HouseholdLabelVO> pages = householdLabelService.unitedFrontStatisticalLabels(Condition.getPage(query), householdLabel);
      return R.data(pages);
   }
   /**
    * 关注人员标签统计
    * @param householdLabel
    * @param query
    * @return
    */
   @GetMapping("/getFollowStatisticalLabels")
   @ApiOperation(value = "统战标签统计", notes = "")
   public R<IPage<HouseholdLabelVO>> followStatisticalLabels(HouseholdLabelVO householdLabel, Query query) {
      IPage<HouseholdLabelVO> pages = householdLabelService.followStatisticalLabels(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);
   }
}