Browse Source

模板

master
sunyuchao 4 years ago
parent
commit
7d03cd6b41
  1. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java
  2. 13
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridGovrnFormDTO.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyGovrnResultDTO.java
  4. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java
  5. 121
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

10
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java

@ -23,6 +23,16 @@ public class AgencyGovrnFormDTO implements Serializable {
* 日维度Id
*/
private String dateId;
/**
* 排序类型字段
* 问题解决总数:problem
* 党群自治占比:party
* 网格自治占比:grid
* 社区解决占比:community
* 区直部门解决占比:department
* 街道解决占比:street
*/
private String type;
public interface Agency extends CustomerClientShowGroup {}
}

13
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GridGovrnFormDTO.java

@ -14,6 +14,11 @@ import java.io.Serializable;
public class GridGovrnFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L;
/**
* 组织Id
*/
@NotBlank(message = "机关Id不能为空",groups = GridGovrnFormDTO.Agency.class)
private String agencyId;
/**
* 网格Id
*/
@ -23,6 +28,14 @@ public class GridGovrnFormDTO implements Serializable {
* 日维度Id
*/
private String dateId;
/**
* 排序类型字段
* 问题解决总数:problem
* 党群自治占比:party
* 网格自治占比:grid
*/
private String type;
public interface Agency extends CustomerClientShowGroup {}
public interface Grid extends CustomerClientShowGroup {}
}

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyGovrnResultDTO.java

@ -19,8 +19,6 @@ public class AgencyGovrnResultDTO implements Serializable {
private String agencyId;
//组织名称
private String agencyName;
//机关级别(社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province)
private String level;
//问题解决总数
private Integer a = 0;
//党群自治占比

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java

@ -196,7 +196,7 @@ public class DataStatsController {
*/
@PostMapping("subgridgovrnlist")
public Result<List<GridGovrnResultDTO>> subGridGovrnList(@RequestBody GridGovrnFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GridGovrnFormDTO.Grid.class);
ValidatorUtils.validateEntity(formDTO, GridGovrnFormDTO.Agency.class);
return new Result<List<GridGovrnResultDTO>>().ok(dataStatsService.subGridGovrnList(formDTO));
}

121
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -1017,6 +1017,20 @@ public class DataStatsServiceImpl implements DataStatsService {
*/
@Override
public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) {
AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO();
resultDTO.setAgencyId(formDTO.getAgencyId());
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.THREE);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.按日期查询当前组织事件治理指数
return null;
}
@ -1027,7 +1041,53 @@ public class DataStatsServiceImpl implements DataStatsService {
*/
@Override
public List<AgencyGovrnResultDTO> subAgencyGovrnList(AgencyGovrnFormDTO formDTO) {
return null;
List<AgencyGovrnResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.THREE);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//排序类型,默认按问题解决总数降序
if (StringUtils.isBlank(formDTO.getDateId())) {
formDTO.setType("problem");
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.按日期查询所有下级组织的事件治理指数
//3.封装数据
//4.按要求排序并返回
Collections.sort(resultList, new Comparator<AgencyGovrnResultDTO>() {
@Override
public int compare(AgencyGovrnResultDTO o1, AgencyGovrnResultDTO o2) {
if ("party".equals(formDTO.getType())) {
return o2.getB().compareTo(o1.getB());
} else if ("grid".equals(formDTO.getType())) {
return o2.getC().compareTo(o1.getC());
} else if ("community".equals(formDTO.getType())) {
return o2.getD().compareTo(o1.getD());
} else if ("department".equals(formDTO.getType())) {
return o2.getE().compareTo(o1.getE());
} else if ("street".equals(formDTO.getType())) {
return o2.getF().compareTo(o1.getF());
} else {
return o2.getA().compareTo(o1.getA());
}
}
});
return resultList;
}
/**
@ -1037,7 +1097,22 @@ public class DataStatsServiceImpl implements DataStatsService {
*/
@Override
public GridGovrnResultDTO gridGovrn(GridGovrnFormDTO formDTO) {
return null;
GridGovrnResultDTO resultDTO = new GridGovrnResultDTO();
resultDTO.setGridId(formDTO.getGridId());
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.THREE);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.按日子查询网格事件治理指数
return resultDTO;
}
/**
@ -1047,7 +1122,47 @@ public class DataStatsServiceImpl implements DataStatsService {
*/
@Override
public List<GridGovrnResultDTO> subGridGovrnList(GridGovrnFormDTO formDTO) {
return null;
List<GridGovrnResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.THREE);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//排序类型,默认按问题解决总数降序
if (StringUtils.isBlank(formDTO.getDateId())) {
formDTO.setType("problem");
}
//1.查询组织直属网格列表【网格维度】
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
if (gridList.size() < NumConstant.ONE) {
return resultList;
}
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.按日期查找组织直属网格事件治理指数列表
//3.封装数据
//4.按要求排序并返回
Collections.sort(resultList, new Comparator<GridGovrnResultDTO>() {
@Override
public int compare(GridGovrnResultDTO o1, GridGovrnResultDTO o2) {
if ("party".equals(formDTO.getType())) {
return o2.getB().compareTo(o1.getB());
} else if ("grid".equals(formDTO.getType())) {
return o2.getC().compareTo(o1.getC());
} else {
return o2.getA().compareTo(o1.getA());
}
}
});
return resultList;
}
}

Loading…
Cancel
Save