aix
2024-06-26 e4e86008908006370600fe2c95f33cfd3415ab90
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/AttResBaseController.java
@@ -3,9 +3,13 @@
import cn.gistack.sm.exam.vo.ExamPlanVO;
import cn.gistack.sm.sjztmd.entity.AttAdBase;
import cn.gistack.sm.sjztmd.entity.AttResBase;
import cn.gistack.sm.sjztmd.entity.AttResStagChar;
import cn.gistack.sm.sjztmd.excel.AttResBaseUserExcel;
import cn.gistack.sm.sjztmd.service.IAttAdBaseService;
import cn.gistack.sm.sjztmd.service.IAttResBaseService;
import cn.gistack.sm.sjztmd.vo.AttAdBaseVO;
import cn.gistack.sm.sjztmd.vo.AttResBaseVO;
import cn.gistack.sm.sjztmd.vo.AttResWithRainfall;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -14,16 +18,19 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import io.swagger.annotations.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@@ -54,14 +61,7 @@
   @ApiOperation(value = "中台水库-查询该行政区下的水库", notes = "中台水库-查询该行政区下的水库")
   @GetMapping(value = "/getListByRegion")
   public R getListByRegion(@ApiIgnore @RequestParam Map<String, Object> obj,Query query) {
      String code = obj.get("code").toString();
      if (code.substring(0,4).indexOf("00") > -1) {
         obj.put("code",code.substring(0,2));
      } else if (code.substring(0,6).indexOf("00") > -1) {
         obj.put("code",code.substring(0,4));
      }
//      List<AttResBase> list = attResBaseService.getListByRegion(obj);
      IPage<AttResBase> pageList = attResBaseService.getListByRegion(Condition.getPage(query),obj);
      IPage<AttResBaseVO> pageList = attResBaseService.getListByRegion(Condition.getPage(query),obj);
      return R.data(pageList);
   }
@@ -71,4 +71,122 @@
      AttResBase attResBase = attResBaseService.getDetailByCode(code);
      return R.data(attResBase);
   }
   /**
    * 获取水库对应责任人分页数据
    * @param params 条件查询参数对象
    * @param query 分页查询参数对象
    * @return
    */
   @ApiOperation(value = "中台水库-获取水库对应责任人分页数据", notes = "中台水库-获取水库对应责任人分页数据")
   @GetMapping(value = "/getAttResBaseUserPage")
   public R getAttResBaseUserPage(@RequestParam Map<String, Object> params,Query query) {
      return R.data(attResBaseService.getAttResBaseUserPage(Condition.getPage(query),params));
   }
   /**
    * 导出责任人数据
    * @param params 条件查询参数对象
    * @return
    */
   @ApiOperation(value = "中台水库-导出责任人数据", notes = "中台水库-导出责任人数据")
   @GetMapping(value = "/exportAttResBaseUser")
   public void exportAttResBaseUser(@RequestParam Map<String, Object> params, HttpServletResponse response) {
      List<AttResBaseUserExcel> list = attResBaseService.exportAttResBaseUser(params);
      /**
       * 如果不是超级管理员数据需要处理 处理逻辑如下
       * (1)大中型水库的行政责任人电话都不显示。
       * (2)省直管且是大中型的6座水库(漳河、高关、富水、王英、吴岭、蔡贤水库)的主管部门负责人手机号不显示。
       * (3)三峡、葛洲坝、隔河岩、高坝州、丹江口(以后可以手动加)除了巡查责任人外的责任人的手机号码不显示。
       */
      if (!AuthUtil.isAdministrator()) {
         for (AttResBaseUserExcel excel:list) {
            if (excel.getEngScal().equals("大(1)型") || excel.getEngScal().equals("大(2)型") || excel.getEngScal().equals("中型")) {
               excel.setAreaPhone("");
            }
            if (excel.getName().equals("漳河水库") || excel.getName().equals("高关水库") || excel.getName().equals("富水漳河水库")
               || excel.getName().equals("王英水库") || excel.getName().equals("吴岭水库") || excel.getName().equals("蔡贤水库")) {
               excel.setCustomsPhone("");
            }
            if (excel.getName().equals("三峡") || excel.getName().equals("葛洲坝") || excel.getName().equals("隔河岩")
               || excel.getName().equals("高坝州") || excel.getName().equals("丹江口")) {
               excel.setAreaPhone("");//行政
               excel.setCustomsPhone("");//主管
               excel.setManageUnitPhone("");//管理单位
               excel.setTechnologyPhone("");//技术
            }
         }
      }
      ExcelUtil.export(response, "水库责任人数据数据" + DateUtil.time(), "水库责任人数据表", list, AttResBaseUserExcel.class);
   }
   /**
    * 编辑
    *
    * @param attResBase
    * @return
    */
   @ApiOperation(value = "水库信息-编辑", notes = "水库信息-编辑")
   @PostMapping(value = "/edit")
   public R edit(@RequestBody AttResBase attResBase) {
      if (StringUtil.isBlank(attResBase.getGuid())) {
         return R.fail("参数不正确");
      }
      return R.data(attResBaseService.updateResBaseByGuid(attResBase));
   }
   /**
    * 根据水库编码获取行政区数据
    * @param guid
    * @return
    */
   @GetMapping(value = "/getWaterRegionInfoByResGuid")
   public R getWaterRegionInfoByResGuid(String guid) {
      return R.data(attResBaseService.getWaterRegionInfoByResGuid(guid));
   }
   /**
    * 更新报汛状态
    * @param ids
    * @param status
    * @return
    */
   @PostMapping(value = "/updateIsShowStatus")
   public R updateIsShowStatus(String ids,Integer status){
      return R.status(attResBaseService.updateIsShowStatus(ids,status));
   }
   /**
    * 根据预报降雨等值面图,识别出雨量范围内的水库清单
    * @param minRainfall 最小降雨量
    * @param maxRainfall 最大降雨量
    * @param dayIndex 预报的时段,0-2代表未来3天
    * @return 水库对象列表
    */
   @ApiOperation(value = "根据预报降雨等值面图,识别出雨量范围内的水库清单", notes = "根据预报降雨等值面图,识别出雨量范围内的水库清单")
   @PostMapping(value = "/getAttResByRainfall")
   public R<List<AttResWithRainfall>> getAttResByRainfall(
         @ApiParam(value = "最小降雨量") @RequestParam String minRainfall,
         @ApiParam(value = "最大降雨量") @RequestParam String maxRainfall,
         @ApiParam(value = "预报的时段,0-2代表未来3天") @RequestParam String dayIndex) {
      return R.data(attResBaseService.getAttResByRainfall(minRainfall, maxRainfall, dayIndex));
   }
   /**
    * 统计不同日降水量范围下的站点个数
    * @param dayIndex 预报的时段,0-2代表未来3天
    * @return 站点个数列表
    */
   @ApiOperation(value = "统计不同日降水量范围的站点个数", notes = "统计不同日降水量范围的站点个数")
   @PostMapping(value = "/getAttResNumByRainfall")
   public R<int[]> getAttResNumByRainfall(@ApiParam(value = "预报的时段,0-2代表未来3天") @RequestParam String dayIndex) {
      return R.data(attResBaseService.getAttResNumByRainfall(dayIndex));
   }
}