forked from rongchao/epmet-cloud-rizhao
19 changed files with 371 additions and 4 deletions
@ -0,0 +1,65 @@ |
|||
package com.epmet.commons.tools.redis.common; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.feign.CommonAggFeignClient; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.MapUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 楼栋 |
|||
* 房屋 |
|||
* 小区这三个的缓存放这吧 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public class CustomerIcHouseRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
@Autowired |
|||
private CommonAggFeignClient commonAggFeignClient; |
|||
private static CustomerIcHouseRedis customerIcHouseRedis; |
|||
|
|||
@PostConstruct |
|||
public void init() { |
|||
customerIcHouseRedis = this; |
|||
customerIcHouseRedis.redisUtils = this.redisUtils; |
|||
customerIcHouseRedis.commonAggFeignClient = this.commonAggFeignClient; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @Description 获取楼栋信息 |
|||
* @param buildingId |
|||
* @author yinzuomei |
|||
* @date 2022/03/09 |
|||
*/ |
|||
public static BuildingInfoCache getBuildingInfo(String buildingId){ |
|||
String key = RedisKeys.getBuildingInfoKey(buildingId); |
|||
Map<String, Object> build = customerIcHouseRedis.redisUtils.hGetAll(key); |
|||
if (!MapUtils.isEmpty(build)) { |
|||
return ConvertUtils.mapToEntity(build, BuildingInfoCache.class); |
|||
} |
|||
Result<BuildingInfoCache> buildInfoResult = customerIcHouseRedis.commonAggFeignClient.queryBuildingInfo(buildingId); |
|||
if (!buildInfoResult.success()){ |
|||
throw new RenException("查询楼栋信息失败..."); |
|||
} |
|||
if (null == buildInfoResult.getData()){ |
|||
return null; |
|||
} |
|||
Map<String, Object> map = BeanUtil.beanToMap(buildInfoResult.getData(), false, true); |
|||
customerIcHouseRedis.redisUtils.hMSet(key, map); |
|||
return buildInfoResult.getData(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.epmet.commons.tools.redis.common.bean; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 楼栋信息缓存 |
|||
*/ |
|||
@Data |
|||
public class BuildingInfoCache implements Serializable { |
|||
/** |
|||
* !!!!!楼栋id |
|||
*/ |
|||
private String buildingId; |
|||
|
|||
/** |
|||
* 楼栋名称 |
|||
*/ |
|||
private String buildingName; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* XXX组织-网格名 |
|||
*/ |
|||
private String gridName; |
|||
|
|||
/** |
|||
* 小区id |
|||
*/ |
|||
private String neighborHoodId; |
|||
|
|||
/** |
|||
* 小区名称 |
|||
*/ |
|||
private String neighborHoodName; |
|||
private String agencyId; |
|||
|
|||
// 后续用到啥再加吧........
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.dataaggre.dao.govorg; |
|||
|
|||
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface IcBuildingDao { |
|||
|
|||
/** |
|||
* 查询楼栋信息,返回楼栋明,小区名....简要信息 |
|||
* @param buildingId |
|||
* @return |
|||
*/ |
|||
BuildingInfoCache selectBuildInfo(String buildingId); |
|||
} |
@ -0,0 +1,24 @@ |
|||
<?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.dataaggre.dao.govorg.IcBuildingDao"> |
|||
|
|||
<select id="selectBuildInfo" parameterType="java.lang.String" resultType="com.epmet.commons.tools.redis.common.bean.BuildingInfoCache"> |
|||
SELECT |
|||
ib.id as buildingId, |
|||
ib.BUILDING_NAME as buildingName, |
|||
ib.NEIGHBOR_HOOD_ID as neighborHoodId, |
|||
ih.NEIGHBOR_HOOD_NAME as neighborHoodName, |
|||
ih.GRID_ID as gridId, |
|||
ih.AGENCY_ID as agencyId |
|||
FROM |
|||
ic_building ib |
|||
INNER JOIN ic_neighbor_hood ih ON ( ib.NEIGHBOR_HOOD_ID = ih.id ) |
|||
WHERE |
|||
ib.id = #{buildingId} |
|||
AND ib.DEL_FLAG = '0' |
|||
AND ih.DEL_FLAG = '0' |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 人员预警通知入参 |
|||
*/ |
|||
@Data |
|||
public class IcUserWarnNoticeFormDTO implements Serializable { |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@NotBlank(message = "组织id不能为空",groups = AddGroup.class) |
|||
private String agencyId; |
|||
/** |
|||
* |
|||
*/ |
|||
@NotBlank(message = "客户id不能为空",groups = AddGroup.class) |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 人员预警通知返参 |
|||
*/ |
|||
@Data |
|||
public class IcUserWarnNoticeResultDTO implements Serializable { |
|||
|
|||
/** |
|||
* 预警配置id |
|||
*/ |
|||
private String configId; |
|||
/** |
|||
* 预警内容:南宁路社区第二网格亿联小区2号楼失业人员超出预警! |
|||
*/ |
|||
private String noticeContent; |
|||
// @JsonIgnore
|
|||
private String buildingId; |
|||
} |
Loading…
Reference in new issue