32 changed files with 1553 additions and 3 deletions
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/10/25 15:03 |
|||
*/ |
|||
@Data |
|||
public class BuildingResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -2129418426919785999L; |
|||
private String buildingId; |
|||
|
|||
private String gridName; |
|||
|
|||
private String neighborhoodName; |
|||
|
|||
private String buildingName; |
|||
|
|||
} |
@ -0,0 +1,111 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class IcStatsResiWarnDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 预警配置ID |
|||
*/ |
|||
private String configId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织的所有上级组织id |
|||
*/ |
|||
private String agencyPids; |
|||
|
|||
/** |
|||
* 小区id |
|||
*/ |
|||
private String neighborHoodId; |
|||
|
|||
/** |
|||
* 楼宇id |
|||
*/ |
|||
private String buildingId; |
|||
|
|||
/** |
|||
* 该分类的居民数量 |
|||
*/ |
|||
private Integer count; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private String revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class StatsResiListFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
@NotBlank(message = "id不能为空") |
|||
private String id; |
|||
|
|||
@NotBlank(message = "level不能为空") |
|||
private String level; |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class StatsResiWarnFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public interface ListSelectedBuilding {}; |
|||
public interface ListSelectedUser {}; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
@NotBlank(message = "组织id不能为空",groups = {ListSelectedBuilding.class}) |
|||
private String agencyId; |
|||
|
|||
@NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class}) |
|||
private String configId; |
|||
@NotNull(message = "楼宇不能为空",groups = {ListSelectedUser.class}) |
|||
private List<String> buildingIdList; |
|||
|
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class IcStatsResiResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
private String id; |
|||
private String label; |
|||
private Integer count; |
|||
private String managementIcon; |
|||
private String dataIcon; |
|||
private String houseShowIcon; |
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class IcStatsResiWarnBuildingResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 预警配置ID |
|||
*/ |
|||
private String configId; |
|||
|
|||
private String label; |
|||
|
|||
private Integer sort; |
|||
private Integer level1; |
|||
private Integer levelCount1; |
|||
private Integer level2; |
|||
private Integer levelCount2; |
|||
private Integer level3; |
|||
private Integer levelCount3; |
|||
|
|||
private List<String> buildingIdList1; |
|||
private List<String> buildingIdList2; |
|||
private List<String> buildingIdList3; |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class IcStatsResiWarnUserResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 预警配置ID |
|||
*/ |
|||
private String configId; |
|||
private String buildingId; |
|||
private String gridName; |
|||
private String neighborhoodName; |
|||
private String buildingName; |
|||
private String residentNames; |
|||
|
|||
} |
@ -0,0 +1,8 @@ |
|||
package com.epmet.constant; |
|||
|
|||
public interface LevelConstant { |
|||
String AGENCY = "agency"; |
|||
String GRID = "grid"; |
|||
String NEIGHBORHOOD = "neighborHood"; |
|||
String BUILDING = "building"; |
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.dto.IcStatsResiWarnDTO; |
|||
import com.epmet.excel.IcStatsResiWarnExcel; |
|||
import com.epmet.service.IcStatsResiWarnService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("icstatsresiwarn") |
|||
public class IcStatsResiWarnController { |
|||
|
|||
@Autowired |
|||
private IcStatsResiWarnService icStatsResiWarnService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<IcStatsResiWarnDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<IcStatsResiWarnDTO> page = icStatsResiWarnService.page(params); |
|||
return new Result<PageData<IcStatsResiWarnDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<IcStatsResiWarnDTO> get(@PathVariable("id") String id){ |
|||
IcStatsResiWarnDTO data = icStatsResiWarnService.get(id); |
|||
return new Result<IcStatsResiWarnDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody IcStatsResiWarnDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
icStatsResiWarnService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody IcStatsResiWarnDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
icStatsResiWarnService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
icStatsResiWarnService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<IcStatsResiWarnDTO> list = icStatsResiWarnService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, IcStatsResiWarnExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.common.token.annotation.Login; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.StatsResiListFormDTO; |
|||
import com.epmet.dto.form.StatsResiWarnFormDTO; |
|||
import com.epmet.dto.result.IcStatsResiResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; |
|||
import com.epmet.service.IcStatsResiWarnService; |
|||
import com.epmet.service.StatsResiWarnService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.util.CollectionUtils; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("statsresiwarn") |
|||
public class StatsResiWarnController { |
|||
|
|||
@Autowired |
|||
private IcStatsResiWarnService icStatsResiWarnService; |
|||
|
|||
@Autowired |
|||
private StatsResiWarnService statsResiWarnService; |
|||
|
|||
@PostMapping("list") |
|||
public Result list(@RequestBody StatsResiListFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel()); |
|||
return new Result().ok(icStatsResiResultDTOList); |
|||
|
|||
} |
|||
|
|||
@PostMapping("buildingwarnlist") |
|||
public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class); |
|||
String agencyID = formDTO.getAgencyId(); |
|||
List<IcStatsResiWarnBuildingResultDTO> icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID); |
|||
return new Result().ok(icStatsResiWarnBuildingResultDTOS); |
|||
|
|||
} |
|||
@PostMapping("userwarnlist") |
|||
public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class); |
|||
List<String> buildingIdList = formDTO.getBuildingIdList(); |
|||
if(CollectionUtils.isEmpty(buildingIdList)){ |
|||
return new Result(); |
|||
} |
|||
List<IcStatsResiWarnUserResultDTO> icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList()); |
|||
return new Result().ok(icStatsResiWarnUserResultDTOS); |
|||
} |
|||
|
|||
/** |
|||
* 统计 |
|||
* @return |
|||
*/ |
|||
@PostMapping("resiwarn") |
|||
public Result resiWarn(@LoginUser TokenDto tokenDto){ |
|||
statsResiWarnService.resiWarn(tokenDto.getCustomerId()); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.IcResiCategoryStatsConfigDTO; |
|||
import com.epmet.entity.IcStatsResiWarnEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Mapper |
|||
public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> { |
|||
|
|||
List<IcStatsResiWarnEntity> selectResiWarnByAgencyId(@Param("agencyId") String agencyId); |
|||
|
|||
List<Map<String,String>> userWarnList(@Param("buildingIdList") List<String> buildingIdList, @Param("tableName") String tableName, @Param("columnName") String columnName); |
|||
|
|||
Integer countListByLevelAndCol( |
|||
@Param("tableName") String tableName, |
|||
@Param("columnName") String columnName, |
|||
@Param("id")String id, |
|||
@Param("level")String level); |
|||
|
|||
List<IcStatsResiWarnEntity> resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName); |
|||
} |
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_stats_resi_warn") |
|||
public class IcStatsResiWarnEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 预警配置ID |
|||
*/ |
|||
private String configId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织的所有上级组织id |
|||
*/ |
|||
private String agencyPids; |
|||
|
|||
/** |
|||
* 小区id |
|||
*/ |
|||
private String neighborHoodId; |
|||
|
|||
/** |
|||
* 楼宇id |
|||
*/ |
|||
private String buildingId; |
|||
|
|||
/** |
|||
* 该分类的居民数量 |
|||
*/ |
|||
private Integer count; |
|||
|
|||
} |
@ -0,0 +1,80 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Data |
|||
public class IcStatsResiWarnExcel { |
|||
|
|||
@Excel(name = "id") |
|||
private String id; |
|||
|
|||
@Excel(name = "客户id") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "预警配置ID") |
|||
private String configId; |
|||
|
|||
@Excel(name = "网格id") |
|||
private String gridId; |
|||
|
|||
@Excel(name = "组织id") |
|||
private String agencyId; |
|||
|
|||
@Excel(name = "组织的所有上级组织id") |
|||
private String agencyPids; |
|||
|
|||
@Excel(name = "小区id") |
|||
private String neighborHoodId; |
|||
|
|||
@Excel(name = "楼宇id") |
|||
private String buildingId; |
|||
|
|||
@Excel(name = "该分类的居民数量") |
|||
private Integer count; |
|||
|
|||
@Excel(name = "删除标识:0.未删除 1.已删除") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private String revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private String createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Component |
|||
public class IcStatsResiWarnRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.IcStatsResiWarnDTO; |
|||
import com.epmet.entity.IcStatsResiWarnEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
public interface IcStatsResiWarnService extends BaseService<IcStatsResiWarnEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<IcStatsResiWarnDTO> |
|||
* @author generator |
|||
* @date 2021-11-04 |
|||
*/ |
|||
PageData<IcStatsResiWarnDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<IcStatsResiWarnDTO> |
|||
* @author generator |
|||
* @date 2021-11-04 |
|||
*/ |
|||
List<IcStatsResiWarnDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcStatsResiWarnDTO |
|||
* @author generator |
|||
* @date 2021-11-04 |
|||
*/ |
|||
IcStatsResiWarnDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-11-04 |
|||
*/ |
|||
void save(IcStatsResiWarnDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-11-04 |
|||
*/ |
|||
void update(IcStatsResiWarnDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-11-04 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,41 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.result.IcStatsResiResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
public interface StatsResiWarnService{ |
|||
|
|||
List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID); |
|||
|
|||
List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList); |
|||
|
|||
List<IcStatsResiResultDTO> list(String id, String level); |
|||
|
|||
void resiWarn(String customerId); |
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.dao.IcStatsResiWarnDao; |
|||
import com.epmet.dto.IcStatsResiWarnDTO; |
|||
import com.epmet.entity.IcStatsResiWarnEntity; |
|||
import com.epmet.redis.IcStatsResiWarnRedis; |
|||
import com.epmet.service.IcStatsResiWarnService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 预警统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-11-04 |
|||
*/ |
|||
@Service |
|||
public class IcStatsResiWarnServiceImpl extends BaseServiceImpl<IcStatsResiWarnDao, IcStatsResiWarnEntity> implements IcStatsResiWarnService { |
|||
|
|||
@Autowired |
|||
private IcStatsResiWarnRedis icStatsResiWarnRedis; |
|||
|
|||
@Override |
|||
public PageData<IcStatsResiWarnDTO> page(Map<String, Object> params) { |
|||
IPage<IcStatsResiWarnEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, IcStatsResiWarnDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<IcStatsResiWarnDTO> list(Map<String, Object> params) { |
|||
List<IcStatsResiWarnEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, IcStatsResiWarnDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<IcStatsResiWarnEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<IcStatsResiWarnEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public IcStatsResiWarnDTO get(String id) { |
|||
IcStatsResiWarnEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcStatsResiWarnDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(IcStatsResiWarnDTO dto) { |
|||
IcStatsResiWarnEntity entity = ConvertUtils.sourceToTarget(dto, IcStatsResiWarnEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(IcStatsResiWarnDTO dto) { |
|||
IcStatsResiWarnEntity entity = ConvertUtils.sourceToTarget(dto, IcStatsResiWarnEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,210 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.IcStatsResiWarnDao; |
|||
import com.epmet.dto.IcResiCategoryStatsConfigDTO; |
|||
import com.epmet.dto.IcResiCategoryWarnConfigDTO; |
|||
import com.epmet.dto.result.BuildingResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; |
|||
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; |
|||
import com.epmet.entity.IcStatsResiWarnEntity; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|||
import com.epmet.service.IcStatsResiWarnService; |
|||
import com.epmet.service.StatsResiWarnService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Optional; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|||
@Resource |
|||
private IcStatsResiWarnDao icStatsResiWarnDao; |
|||
|
|||
@Autowired |
|||
private IcStatsResiWarnService icStatsResiWarnService; |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; |
|||
|
|||
@Override |
|||
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID) { |
|||
List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>(); |
|||
//feign获取当前需要预警的配置信息以及阈值
|
|||
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); |
|||
if (!warnResult.success() || null == warnResult.getData()) { |
|||
throw new RenException("预警配置查询失败:"+ warnResult.getMsg()); |
|||
} |
|||
List<IcResiCategoryWarnConfigDTO> icResiCategoryWarnConfigDTOList = warnResult.getData(); |
|||
|
|||
if(CollectionUtils.isEmpty(icResiCategoryWarnConfigDTOList )){ |
|||
return result; |
|||
} |
|||
result = icResiCategoryWarnConfigDTOList.stream().map(item -> { |
|||
IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = new IcStatsResiWarnBuildingResultDTO(); |
|||
resiWarnBuildingResultDTO.setConfigId(item.getId()); |
|||
resiWarnBuildingResultDTO.setLabel(item.getLabel()); |
|||
resiWarnBuildingResultDTO.setLevel1(item.getLevel1()); |
|||
resiWarnBuildingResultDTO.setLevel2(item.getLevel2()); |
|||
resiWarnBuildingResultDTO.setLevel3(item.getLevel3()); |
|||
resiWarnBuildingResultDTO.setSort(item.getSort()); |
|||
resiWarnBuildingResultDTO.setLevelCount1(0); |
|||
resiWarnBuildingResultDTO.setLevelCount2(0); |
|||
resiWarnBuildingResultDTO.setLevelCount3(0); |
|||
resiWarnBuildingResultDTO.setBuildingIdList1(new ArrayList<>()); |
|||
resiWarnBuildingResultDTO.setBuildingIdList2(new ArrayList<>()); |
|||
resiWarnBuildingResultDTO.setBuildingIdList3(new ArrayList<>()); |
|||
return resiWarnBuildingResultDTO; |
|||
}).collect(Collectors.toList()); |
|||
//统计数量
|
|||
List<IcStatsResiWarnEntity> icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID); |
|||
if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){ |
|||
return result; |
|||
} |
|||
Map<String,IcStatsResiWarnBuildingResultDTO> warnResultMap = result.stream().collect(Collectors.toMap(IcStatsResiWarnBuildingResultDTO::getConfigId, Function.identity(),(k1, k2)->k1)); |
|||
for (IcStatsResiWarnEntity item : icStatsResiWarnEntityList) { |
|||
//每栋楼的数量
|
|||
Integer count = Optional.ofNullable(item.getCount()).orElse(0); |
|||
IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = warnResultMap.get(item.getConfigId()); |
|||
//判断数量
|
|||
Integer levle1= resiWarnBuildingResultDTO.getLevel1(); |
|||
Integer levle2= resiWarnBuildingResultDTO.getLevel2(); |
|||
Integer levle3= resiWarnBuildingResultDTO.getLevel3(); |
|||
if(0 == count){ |
|||
continue; |
|||
} |
|||
if(null!=levle1 && count>levle1){ |
|||
resiWarnBuildingResultDTO.setLevelCount1(resiWarnBuildingResultDTO.getLevelCount1()+1); |
|||
resiWarnBuildingResultDTO.getBuildingIdList1().add(item.getBuildingId()); |
|||
} |
|||
if(null!=levle1 && null!=levle2 && count<=levle1 && count>=levle2){ |
|||
resiWarnBuildingResultDTO.setLevelCount2(resiWarnBuildingResultDTO.getLevelCount2()+1); |
|||
resiWarnBuildingResultDTO.getBuildingIdList2().add(item.getBuildingId()); |
|||
} |
|||
if(null!=levle2 && null!=levle3 && count<=levle2 && count>=levle3){ |
|||
resiWarnBuildingResultDTO.setLevelCount3(resiWarnBuildingResultDTO.getLevelCount3()+1); |
|||
resiWarnBuildingResultDTO.getBuildingIdList3().add(item.getBuildingId()); |
|||
} |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList) { |
|||
//feign根据buildingIdList 获取网格,小区,楼宇 信息
|
|||
Result<List<BuildingResultDTO>> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList); |
|||
if (!buildingList.success() || null == buildingList.getData()) { |
|||
throw new RenException("楼宇信息查询失败,buildingList="+ JSON.toJSONString(buildingIdList)); |
|||
} |
|||
List<BuildingResultDTO> buildingResultDTOList = buildingList.getData(); |
|||
|
|||
List<IcStatsResiWarnUserResultDTO> result = ConvertUtils.sourceToTarget(buildingResultDTOList,IcStatsResiWarnUserResultDTO.class); |
|||
if(CollectionUtils.isEmpty(result)){ |
|||
return new ArrayList<>(); |
|||
} |
|||
//获取configId预警配置信息
|
|||
IcResiCategoryWarnConfigDTO formDto = new IcResiCategoryWarnConfigDTO(); |
|||
formDto.setId(configId); |
|||
Result<IcResiCategoryWarnConfigDTO> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnInfoById(formDto); |
|||
if (!warnResult.success() || null == warnResult.getData()) { |
|||
throw new RenException("获取预警配置信息失败,configId="+ configId); |
|||
} |
|||
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); |
|||
|
|||
//根据buildingID,tableName he columnName获取名字
|
|||
List<Map<String, String>> maps = icStatsResiWarnDao.userWarnList(buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); |
|||
result.forEach(item->{ |
|||
item.setConfigId(configId); |
|||
List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); |
|||
item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames")); |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public List<IcStatsResiResultDTO> list(String id, String level) { |
|||
//获取所有配置类项 getshow
|
|||
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(); |
|||
if (!statsResult.success() || null == statsResult.getData()) { |
|||
throw new RenException("获取配置类项失败"); |
|||
} |
|||
List<IcResiCategoryStatsConfigDTO> icResiCategoryStatsConfigDTOList = statsResult.getData(); |
|||
//获取tableName 和columnName
|
|||
List<IcStatsResiResultDTO> result = new ArrayList<>(); |
|||
icResiCategoryStatsConfigDTOList.forEach(item->{ |
|||
IcStatsResiResultDTO resultDTO = new IcStatsResiResultDTO(); |
|||
resultDTO.setId(item.getId()); |
|||
resultDTO.setLabel(item.getLabel()); |
|||
resultDTO.setDataIcon(item.getDataIcon()); |
|||
resultDTO.setHouseShowIcon(item.getHouseShowIcon()); |
|||
resultDTO.setManagementIcon(item.getManagementIcon()); |
|||
//根据id ,level 获取count
|
|||
Integer count = icStatsResiWarnDao.countListByLevelAndCol(item.getTableName(),item.getColumnName(),id,level); |
|||
resultDTO.setCount(count); |
|||
result.add(resultDTO); |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 统计 |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void resiWarn(String customerId) { |
|||
// 获取预警配置项
|
|||
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); |
|||
if (!warnResult.success() || null == warnResult.getData()) { |
|||
throw new RenException("预警配置查询失败:"+ warnResult.getMsg()); |
|||
} |
|||
List<IcResiCategoryWarnConfigDTO> icResiCategoryWarnConfigDTOList = warnResult.getData(); |
|||
|
|||
//保存数据
|
|||
List<IcStatsResiWarnEntity> icStatsResiWarnEntities = new ArrayList<>(); |
|||
for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { |
|||
icStatsResiWarnDao.delete(new QueryWrapper<IcStatsResiWarnEntity>().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId())); |
|||
List<IcStatsResiWarnEntity> maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName()); |
|||
|
|||
|
|||
if(CollectionUtils.isEmpty(maps)){ |
|||
continue; |
|||
} |
|||
|
|||
maps.forEach(map->{ |
|||
IcStatsResiWarnEntity icStatsResiWarnEntity = new IcStatsResiWarnEntity(); |
|||
icStatsResiWarnEntity.setAgencyId(map.getAgencyId()); |
|||
icStatsResiWarnEntity.setAgencyPids(map.getAgencyPids()); |
|||
icStatsResiWarnEntity.setBuildingId(map.getBuildingId()); |
|||
icStatsResiWarnEntity.setConfigId(item.getId()); |
|||
icStatsResiWarnEntity.setCount(map.getCount()); |
|||
icStatsResiWarnEntity.setCustomerId(customerId); |
|||
icStatsResiWarnEntity.setGridId(map.getGridId()); |
|||
icStatsResiWarnEntity.setNeighborHoodId(map.getNeighborHoodId()); |
|||
icStatsResiWarnEntities.add(icStatsResiWarnEntity); |
|||
}); |
|||
|
|||
} |
|||
icStatsResiWarnService.insertBatch(icStatsResiWarnEntities,500); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,106 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.IcStatsResiWarnDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcStatsResiWarnEntity" id="icStatsResiWarnMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="configId" column="CONFIG_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="agencyPids" column="AGENCY_PIDS"/> |
|||
<result property="neighborHoodId" column="NEIGHBOR_HOOD_ID"/> |
|||
<result property="buildingId" column="BUILDING_ID"/> |
|||
<result property="count" column="COUNT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
<select id="selectResiWarnByAgencyId" resultType="com.epmet.entity.IcStatsResiWarnEntity"> |
|||
select * from ic_stats_resi_warn |
|||
where |
|||
DEL_FLAG='0' |
|||
<if test="agencyId != null and agencyId.trim() != ''"> |
|||
AND (AGENCY_ID = #{agencyId} or CONCAT(':',AGENCY_PIDS, ':') like CONCAT('%:',#{agencyId},':%')) |
|||
</if> |
|||
</select> |
|||
|
|||
<select id="userWarnList" resultType="map"> |
|||
select |
|||
BUILD_ID as buildingId, |
|||
GROUP_CONCAT(name) as residentNames |
|||
from ic_resi_user |
|||
where |
|||
BUILD_ID in |
|||
<foreach collection="buildingIdList" item="buildingId" open="(" separator="," close=" )"> |
|||
#{buildingId} |
|||
</foreach> |
|||
<if test="tableName=='ic_resi_user'"> |
|||
and ${columnName} = '1' |
|||
</if> |
|||
<if test="tableName!='ic_resi_user'"> |
|||
and ID in ( |
|||
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' |
|||
) |
|||
</if> |
|||
and DEL_FLAG = '0' |
|||
group by BUILD_ID |
|||
</select> |
|||
|
|||
|
|||
<select id="countListByLevelAndCol" resultType="int"> |
|||
select count(*) |
|||
from ic_resi_user |
|||
where 1=1 |
|||
<if test="tableName=='ic_resi_user'"> |
|||
and ${columnName} = '1' |
|||
</if> |
|||
<if test="tableName!='ic_resi_user'"> |
|||
and ID in ( |
|||
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' |
|||
) |
|||
</if> |
|||
<if test="level=='agency'"> |
|||
AND (AGENCY_ID = #{id} or CONCAT(':',PIDS, ':') like CONCAT('%:',#{id},':%')) |
|||
</if> |
|||
<if test="level=='grid'"> |
|||
AND GRID_ID = #{id} |
|||
</if> |
|||
<if test="level=='neighborHood'"> |
|||
AND VILLAGE_ID = #{id} |
|||
</if> |
|||
<if test="level=='building'"> |
|||
AND BUILD_ID = #{id} |
|||
</if> |
|||
and DEL_FLAG = '0' |
|||
|
|||
</select> |
|||
|
|||
<select id="resiWarn" resultType="com.epmet.entity.IcStatsResiWarnEntity"> |
|||
SELECT |
|||
AGENCY_ID as agencyId, |
|||
PIDS as agencyPids, |
|||
GRID_ID as gridId, |
|||
VILLAGE_ID as neighborHoodId, |
|||
BUILD_ID as buildingId, |
|||
count(*) as count |
|||
from ic_resi_user |
|||
where 1=1 |
|||
<if test="tableName=='ic_resi_user'"> |
|||
and ${columnName} = '1' |
|||
</if> |
|||
<if test="tableName!='ic_resi_user'"> |
|||
and ID in ( |
|||
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' |
|||
) |
|||
</if> |
|||
and DEL_FLAG = '0' |
|||
group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue