57 changed files with 1552 additions and 63 deletions
@ -0,0 +1,93 @@ |
|||||
|
package com.epmet.commons.tools.redis.common; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
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.*; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/5 2:29 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
public class CustomerOrgRedis { |
||||
|
|
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
@Autowired |
||||
|
private CommonAggFeignClient commonAggFeignClient; |
||||
|
|
||||
|
private static CustomerOrgRedis customerOrgRedis; |
||||
|
private static final String ROLE_MAP_KEY = "roleMap"; |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init() { |
||||
|
customerOrgRedis = this; |
||||
|
customerOrgRedis.redisUtils = this.redisUtils; |
||||
|
customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 获取网格信息 |
||||
|
* @param gridId |
||||
|
* @author zxc |
||||
|
* @date 2021/11/5 3:12 下午 |
||||
|
*/ |
||||
|
public static GridInfoCache getGridInfo(String gridId){ |
||||
|
String key = RedisKeys.getGridInfoKey(gridId); |
||||
|
Map<String, Object> grid = customerOrgRedis.redisUtils.hGetAll(key); |
||||
|
if (!CollectionUtils.isEmpty(grid)) { |
||||
|
return ConvertUtils.mapToEntity(grid, GridInfoCache.class); |
||||
|
} |
||||
|
Result<GridInfoCache> gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId); |
||||
|
if (!gridInfoResult.success()){ |
||||
|
throw new RenException("查询网格信息失败..."); |
||||
|
} |
||||
|
if (null == gridInfoResult.getData()){ |
||||
|
throw new RenException("没有此网格信息..."); |
||||
|
} |
||||
|
Map<String, Object> map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true); |
||||
|
customerOrgRedis.redisUtils.hMSet(key, map); |
||||
|
return gridInfoResult.getData(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 获取组织信息 |
||||
|
* @param agencyId |
||||
|
* @author zxc |
||||
|
* @date 2021/11/5 3:12 下午 |
||||
|
*/ |
||||
|
public static AgencyInfoCache getAgencyInfo(String agencyId){ |
||||
|
String key = RedisKeys.getAgencyByIdKey(agencyId); |
||||
|
Map<String, Object> agency = customerOrgRedis.redisUtils.hGetAll(key); |
||||
|
if (!CollectionUtils.isEmpty(agency)) { |
||||
|
return ConvertUtils.mapToEntity(agency, AgencyInfoCache.class); |
||||
|
} |
||||
|
Result<AgencyInfoCache> agencyInfoResult = customerOrgRedis.commonAggFeignClient.getAgencyInfo(agencyId); |
||||
|
if (!agencyInfoResult.success()){ |
||||
|
throw new RenException("查询组织信息失败..."); |
||||
|
} |
||||
|
if (null == agencyInfoResult.getData()){ |
||||
|
throw new RenException("没有此组织信息..."); |
||||
|
} |
||||
|
Map<String, Object> map = BeanUtil.beanToMap(agencyInfoResult.getData(), false, true); |
||||
|
customerOrgRedis.redisUtils.hMSet(key, map); |
||||
|
return agencyInfoResult.getData(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,142 @@ |
|||||
|
package com.epmet.commons.tools.redis.common.bean; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/5 2:45 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AgencyInfoCache implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -1332373159954084159L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 上级组织机构ID |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织机构ID(以英文:隔开) |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级名称,以-连接 |
||||
|
*/ |
||||
|
private String allParentName; |
||||
|
|
||||
|
/** |
||||
|
* 组织名称 |
||||
|
*/ |
||||
|
private String organizationName; |
||||
|
|
||||
|
/** |
||||
|
* 机关级别(社区级:community, |
||||
|
乡(镇、街道)级:street, |
||||
|
区县级: district, |
||||
|
市级: city |
||||
|
省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) |
||||
|
*/ |
||||
|
private String level; |
||||
|
|
||||
|
/** |
||||
|
* 地区编码 |
||||
|
*/ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 总人数 |
||||
|
*/ |
||||
|
private Integer totalUser; |
||||
|
|
||||
|
/** |
||||
|
* 省 |
||||
|
*/ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 市 |
||||
|
*/ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 区县 |
||||
|
*/ |
||||
|
private String district; |
||||
|
|
||||
|
/** |
||||
|
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 |
||||
|
*/ |
||||
|
private String parentAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 街道 |
||||
|
*/ |
||||
|
private String street; |
||||
|
|
||||
|
/** |
||||
|
* 社区 |
||||
|
*/ |
||||
|
private String community; |
||||
|
|
||||
|
/** |
||||
|
* 坐标区域 |
||||
|
*/ |
||||
|
private String coordinates; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 中心位置经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
} |
@ -0,0 +1,116 @@ |
|||||
|
package com.epmet.commons.tools.redis.common.bean; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/5 2:24 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GridInfoCache implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -6159429894486235267L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* ID 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** 组织-网格 */ |
||||
|
private String gridNamePath; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 所属地区码(所属组织地区码) |
||||
|
*/ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 管辖区域 |
||||
|
*/ |
||||
|
private String manageDistrict; |
||||
|
|
||||
|
/** |
||||
|
* 当前网格总人数 |
||||
|
*/ |
||||
|
private Integer totalUser; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构ID(customer_organization.id) |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织ID |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构名 |
||||
|
*/ |
||||
|
private String agencyName; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织名 |
||||
|
*/ |
||||
|
private String allParentName; |
||||
|
|
||||
|
/** |
||||
|
* 坐标区域 |
||||
|
*/ |
||||
|
private String coordinates; |
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
package com.epmet.project.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 3:23 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CategoryProjectListFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -5448734274886241594L; |
||||
|
|
||||
|
public interface CategoryProjectListForm{} |
||||
|
|
||||
|
@NotNull(message = "pageSize不能为空",groups = CategoryProjectListForm.class) |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
@NotNull(message = "pageNo不能为空",groups = CategoryProjectListForm.class) |
||||
|
private Integer pageNo; |
||||
|
|
||||
|
/** |
||||
|
* 项目状态:closed:已结案,all:全部 |
||||
|
*/ |
||||
|
@NotNull(message = "status不能为空",groups = CategoryProjectListForm.class) |
||||
|
private String status; |
||||
|
|
||||
|
@NotNull(message = "categoryCode不能为空",groups = CategoryProjectListForm.class) |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 组织类型:agency:组织,grid:网格 |
||||
|
*/ |
||||
|
private String orgType; |
||||
|
|
||||
|
/** |
||||
|
* 是否分页,默认true,false的时候 给导出用 |
||||
|
*/ |
||||
|
private Boolean isPage = true; |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.epmet.project.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 3:18 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProjectCategoryFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 5047143743629810527L; |
||||
|
|
||||
|
public interface ProjectCategoryForm{} |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 组织类型 组织:agency,网格:grid |
||||
|
*/ |
||||
|
private String orgType; |
||||
|
|
||||
|
@NotBlank(message = "结束时间不能为空",groups = ProjectCategoryForm.class) |
||||
|
private String endTime; |
||||
|
|
||||
|
/** |
||||
|
* 开始时间 |
||||
|
*/ |
||||
|
private String startTime; |
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 3:31 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CategoryProjectListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8820354423099062062L; |
||||
|
|
||||
|
/** |
||||
|
* 分类 |
||||
|
*/ |
||||
|
private String category; |
||||
|
|
||||
|
/** |
||||
|
* 项目状态:待处理 pending,结案closed |
||||
|
*/ |
||||
|
private String projectStatus; |
||||
|
|
||||
|
/** |
||||
|
* 项目标题 |
||||
|
*/ |
||||
|
private String projectTitle; |
||||
|
|
||||
|
/** |
||||
|
* 网格 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** |
||||
|
* 项目创建时间 |
||||
|
*/ |
||||
|
private String createTime; |
||||
|
|
||||
|
/** |
||||
|
* 项目ID |
||||
|
*/ |
||||
|
private String projectId; |
||||
|
|
||||
|
@JsonIgnore |
||||
|
private String orgId; |
||||
|
|
||||
|
@JsonIgnore |
||||
|
private String orgType; |
||||
|
|
||||
|
public CategoryProjectListResultDTO() { |
||||
|
this.category = ""; |
||||
|
this.projectStatus = ""; |
||||
|
this.projectTitle = ""; |
||||
|
this.gridName = ""; |
||||
|
this.createTime = ""; |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/5 1:51 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PageCategoryProjectListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8822993169364931502L; |
||||
|
|
||||
|
private Integer total; |
||||
|
|
||||
|
private List<CategoryProjectListResultDTO> list; |
||||
|
|
||||
|
public PageCategoryProjectListResultDTO() { |
||||
|
this.total = NumConstant.ZERO; |
||||
|
this.list = new ArrayList<>(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 3:13 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProjectCategoryResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -2662970383306349424L; |
||||
|
|
||||
|
/** |
||||
|
* 分类CODE |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 分类名字 |
||||
|
*/ |
||||
|
private String categoryName; |
||||
|
|
||||
|
/** |
||||
|
* 项目总数 |
||||
|
*/ |
||||
|
private Integer projectTotal; |
||||
|
|
||||
|
/** |
||||
|
* 结案项目数 |
||||
|
*/ |
||||
|
private Integer closedProjectTotal; |
||||
|
|
||||
|
/** |
||||
|
* 总数占比 |
||||
|
*/ |
||||
|
private String totalRatio; |
||||
|
|
||||
|
/** |
||||
|
* 结案率 |
||||
|
*/ |
||||
|
private String closedRatio; |
||||
|
|
||||
|
private List<ProjectCategoryResultDTO> children; |
||||
|
@JsonIgnore |
||||
|
private int index; |
||||
|
|
||||
|
public ProjectCategoryResultDTO() { |
||||
|
this.categoryCode = ""; |
||||
|
this.categoryName = ""; |
||||
|
this.projectTotal = NumConstant.ZERO; |
||||
|
this.closedProjectTotal = NumConstant.ZERO; |
||||
|
this.totalRatio = ""; |
||||
|
this.closedRatio = ""; |
||||
|
this.children = new ArrayList<>(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 3:13 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProjectCategorySonResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -2662970383306349424L; |
||||
|
|
||||
|
/** |
||||
|
* 分类CODE |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 分类名字 |
||||
|
*/ |
||||
|
private String categoryName; |
||||
|
|
||||
|
/** |
||||
|
* 项目总数 |
||||
|
*/ |
||||
|
private Integer projectTotal; |
||||
|
|
||||
|
/** |
||||
|
* 结案项目数 |
||||
|
*/ |
||||
|
private Integer closedProjectTotal; |
||||
|
|
||||
|
/** |
||||
|
* 总数占比 |
||||
|
*/ |
||||
|
private String totalRatio; |
||||
|
|
||||
|
/** |
||||
|
* 结案率 |
||||
|
*/ |
||||
|
private String closedRatio; |
||||
|
|
||||
|
public ProjectCategorySonResultDTO() { |
||||
|
this.categoryCode = ""; |
||||
|
this.categoryName = ""; |
||||
|
this.projectTotal = NumConstant.ZERO; |
||||
|
this.closedProjectTotal = NumConstant.ZERO; |
||||
|
this.totalRatio = ""; |
||||
|
this.closedRatio = ""; |
||||
|
} |
||||
|
} |
Binary file not shown.
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.dto.project.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 9:12 上午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ClosedProjectTotalResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -3683494871244065806L; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 分类code |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 结案的项目数 |
||||
|
*/ |
||||
|
private Integer closedProjectTotal = 0; |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
alter table screen_project_category_grid_daily add COLUMN CLOSED_PROJECT_TOTAL int(11) NOT NULL DEFAULT 0 comment '该分类下所有结案的项目数' AFTER PROJECT_TOTAL; |
||||
|
alter table screen_project_category_org_daily add COLUMN CLOSED_PROJECT_TOTAL int(11) NOT NULL DEFAULT 0 comment '该分类下所有结案的项目数' AFTER PROJECT_TOTAL; |
Loading…
Reference in new issue