diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ColorProjectTotalFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ColorProjectTotalFormDTO.java new file mode 100644 index 0000000000..e115815e44 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ColorProjectTotalFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form.screen; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/1 3:11 下午 + * @DESC + */ +@Data +public class ColorProjectTotalFormDTO implements Serializable { + + private static final long serialVersionUID = -6991770717583778665L; + + public interface ColorProjectTotalForm{} + + /** + * 组织id + */ + @NotBlank(message = "组织ID不能为空",groups = ColorProjectTotalForm.class) + private String agencyId; + + /** + * 行政区域码【平阴必填】 + */ + private String areaCode; + + /** + * 绿灯事件查询几个月的数据 + */ + private Integer monthCount = NumConstant.ONE; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/StreetDetailPYFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/StreetDetailPYFormDTO.java new file mode 100644 index 0000000000..328510615b --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/StreetDetailPYFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form.screen; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/2 9:42 上午 + * @DESC + */ +@Data +public class StreetDetailPYFormDTO implements Serializable { + + private static final long serialVersionUID = -4821168326488796711L; + + public interface StreetDetailPYForm{} + + @NotBlank(message = "组织ID不能为空",groups = StreetDetailPYForm.class) + private String agencyId; + + /** + * 行政区域编码 平阴必填 + */ + private String areaCode; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ColorProjectTotalResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ColorProjectTotalResultDTO.java new file mode 100644 index 0000000000..ed477cc951 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ColorProjectTotalResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.result.screen; + +import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/1 3:15 下午 + * @DESC + */ +@Data +public class ColorProjectTotalResultDTO implements Serializable { + + private static final long serialVersionUID = -8211214262766797296L; + + /** + * 事件总数 + */ + private Integer projectTotal; + + /** + * 红灯事件总数 + */ + private Integer redTotal; + + /** + * 黄灯事件总数 + */ + private Integer yellowTotal; + + /** + * 绿灯事件总数 + */ + private Integer greenTotal; + + @JsonIgnore + private Integer projectLevel; + + public ColorProjectTotalResultDTO() { + this.projectTotal = NumConstant.ZERO; + this.redTotal = NumConstant.ZERO; + this.yellowTotal = NumConstant.ZERO; + this.greenTotal = NumConstant.ZERO; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/StreetDetailPYResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/StreetDetailPYResultDTO.java new file mode 100644 index 0000000000..e81aabc23e --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/StreetDetailPYResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result.screen; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/2 9:43 上午 + * @DESC + */ +@Data +public class StreetDetailPYResultDTO implements Serializable { + + private static final long serialVersionUID = 663001974527694466L; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织名称 + */ + private String agencyName; + + /** + * 注册党员数 + */ + private Integer partyMemberTotal; + + /** + * 网格总数 + */ + private Integer gridTotal; + + /** + * 网格员数 + */ + private Integer gridMemberTotal; + + public StreetDetailPYResultDTO() { + this.partyMemberTotal = NumConstant.ZERO; + this.gridTotal = NumConstant.ZERO; + this.gridMemberTotal = NumConstant.ZERO; + this.agencyId = ""; + this.agencyName = ""; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PyController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PyController.java new file mode 100644 index 0000000000..6835571eb2 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PyController.java @@ -0,0 +1,38 @@ +package com.epmet.datareport.controller.screen; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.evaluationindex.screen.PyService; +import com.epmet.dto.form.screen.StreetDetailPYFormDTO; +import com.epmet.dto.result.screen.StreetDetailPYResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +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; + +/** + * @Author zxc + * @DateTime 2021/6/2 9:40 上午 + * @DESC + */ +@RestController +@RequestMapping("pyscreen") +public class PyController { + + @Autowired + private PyService pyService; + + /** + * @Description 街道:注册党员数、网格数、网格员数 + * @Param formDTO + * @author zxc + * @date 2021/6/2 10:07 上午 + */ + @PostMapping("streetdetail-py") + public Result streetDetail(@RequestBody StreetDetailPYFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StreetDetailPYFormDTO.StreetDetailPYForm.class); + return new Result().ok(pyService.streetDetail(formDTO)); + } + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index e63eb501f8..c41380b282 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java @@ -5,14 +5,8 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService; -import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; -import com.epmet.dto.form.screen.EfficiencyAnalysisFormDTO; -import com.epmet.dto.form.screen.QueryQuantityMonthlyFormDTO; -import com.epmet.dto.form.screen.ScreenCommonFormDTO; -import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; -import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO; -import com.epmet.dto.result.screen.ProjectQuantityResultDTO; -import com.epmet.dto.result.screen.QueryQuantityMonthlyResultDTO; +import com.epmet.dto.form.screen.*; +import com.epmet.dto.result.screen.*; import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO; @@ -132,4 +126,17 @@ public class ScreenProjectController { ValidatorUtils.validateEntity(formDTO, CategoryAnalysisFormDTO.CategoryAnalysis.class); return new Result>().ok(screenProjectService.categoryAnalysis(customerId, formDTO)); } + + /** + * @Description 红黄绿事件总数 + * @Param formDTO + * @author zxc + * @date 2021/6/1 3:20 下午 + */ + @PostMapping("colorprojectotal") + public Result colorProjectTotal(@RequestBody ColorProjectTotalFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ColorProjectTotalFormDTO.ColorProjectTotalForm.class); + return new Result().ok(screenProjectService.colorProjectTotal(formDTO)); + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java index 061d0b81f1..49797b9cb2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -1,5 +1,6 @@ package com.epmet.datareport.dao.evaluationindex.screen; +import com.epmet.dto.result.screen.ColorProjectTotalResultDTO; import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO; import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO; import org.apache.ibatis.annotations.Mapper; @@ -28,4 +29,20 @@ public interface ScreenProjectDataDao { List selectProjectProcessAttachments(@Param("processId") String processId, @Param("projectId") String projectId, @Param("customerId") String customerId); + + /** + * @Description 根据agencyId查询事件 + * @Param agencyId + * @author zxc + * @date 2021/6/1 3:48 下午 + */ + List selectColorProjectByAgencyId(@Param("agencyId") String agencyId,@Param("monthCount")Integer monthCount); + + /** + * @Description 根据areaCode查询事件 + * @Param agencyId + * @author zxc + * @date 2021/6/1 3:48 下午 + */ + List selectColorProjectByAreaCode(@Param("areaCode") String areaCode,@Param("monthCount")Integer monthCount); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java index 8de5eaadfc..2e3436f807 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screen; +import com.epmet.dto.result.screen.StreetDetailPYResultDTO; import com.epmet.evaluationindex.screen.dto.result.PartymemberPercentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TopProfileResultDTO; import org.apache.ibatis.annotations.Mapper; @@ -60,4 +61,20 @@ public interface ScreenUserTotalDataDao { int selectAvgIssue(@Param("agencyId")String agencyId); PartymemberPercentResultDTO selectAgencyPartymemberPercentByIds(@Param("orgIds") List orgIds); + + /** + * @Description 根据组织ID查询街道详情 + * @Param agencyId + * @author zxc + * @date 2021/6/2 10:38 上午 + */ + StreetDetailPYResultDTO selectStreetDetailByAgencyId(@Param("agencyId")String agencyId); + + /** + * @Description 根据组织编码查询街道详情 + * @Param agencyId + * @author zxc + * @date 2021/6/2 10:38 上午 + */ + StreetDetailPYResultDTO selectStreetDetailByAreaCode(@Param("areaCode")String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/PyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/PyService.java new file mode 100644 index 0000000000..65c54e13ca --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/PyService.java @@ -0,0 +1,21 @@ +package com.epmet.datareport.service.evaluationindex.screen; + +import com.epmet.dto.form.screen.StreetDetailPYFormDTO; +import com.epmet.dto.result.screen.StreetDetailPYResultDTO; + +/** + * @Author zxc + * @DateTime 2021/6/2 10:05 上午 + * @DESC + */ +public interface PyService { + + /** + * @Description 街道:注册党员数、网格数、网格员数 + * @Param formDTO + * @author zxc + * @date 2021/6/2 10:07 上午 + */ + StreetDetailPYResultDTO streetDetail(StreetDetailPYFormDTO formDTO); + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java index b4154a790a..7e708c3abe 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java @@ -2,7 +2,9 @@ package com.epmet.datareport.service.evaluationindex.screen; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; +import com.epmet.dto.form.screen.ColorProjectTotalFormDTO; import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; +import com.epmet.dto.result.screen.ColorProjectTotalResultDTO; import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO; @@ -40,4 +42,12 @@ public interface ScreenProjectService { List projectDistribution(ScreenProjectDistributionFormDTO formDTO); Result projectDistributionDetail(ScreenProjectDetailFormDTO formDTO); + + /** + * @Description 红黄绿事件总数 + * @Param formDTO + * @author zxc + * @date 2021/6/1 3:20 下午 + */ + ColorProjectTotalResultDTO colorProjectTotal(ColorProjectTotalFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PyServiceImpl.java new file mode 100644 index 0000000000..9b3bed927d --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PyServiceImpl.java @@ -0,0 +1,51 @@ +package com.epmet.datareport.service.evaluationindex.screen.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenUserTotalDataDao; +import com.epmet.datareport.service.evaluationindex.screen.PyService; +import com.epmet.dto.form.screen.StreetDetailPYFormDTO; +import com.epmet.dto.result.screen.StreetDetailPYResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Author zxc + * @DateTime 2021/6/2 10:05 上午 + * @DESC + */ +@Slf4j +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class PyServiceImpl implements PyService { + + @Autowired + private ScreenUserTotalDataDao screenUserTotalDataDao; + + /** + * @Description 街道:注册党员数、网格数、网格员数 + * @Param formDTO + * @author zxc + * @date 2021/6/2 10:07 上午 + */ + @Override + public StreetDetailPYResultDTO streetDetail(StreetDetailPYFormDTO formDTO) { + StreetDetailPYResultDTO result = new StreetDetailPYResultDTO(); + if (StringUtils.isEmpty(formDTO.getAreaCode())){ + result = screenUserTotalDataDao.selectStreetDetailByAgencyId(formDTO.getAgencyId()); + }else { + StreetDetailPYResultDTO eightStreet = screenUserTotalDataDao.selectStreetDetailByAreaCode(formDTO.getAreaCode()); + result = screenUserTotalDataDao.selectStreetDetailByAgencyId(formDTO.getAgencyId()); + if (null == result){ + throw new RenException("组织ID【"+formDTO.getAgencyId()+"】不存在于screen_customer_agency"); + } + result.setGridMemberTotal(result.getGridMemberTotal() + eightStreet.getGridMemberTotal()); + result.setPartyMemberTotal(result.getPartyMemberTotal() + eightStreet.getPartyMemberTotal()); + result.setGridTotal(result.getGridTotal() + eightStreet.getGridTotal()); + } + return result; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index c2728396d0..4bf518855a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -11,7 +11,9 @@ import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgD import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService; import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; +import com.epmet.dto.form.screen.ColorProjectTotalFormDTO; import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; +import com.epmet.dto.result.screen.ColorProjectTotalResultDTO; import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO; @@ -28,6 +30,8 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 项目 @@ -73,6 +77,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { /** * @Description 中央区事件分析-项目分布 + * 【2021-06-03 修改查询红黄绿事件事件范围为一个月】 * @param formDTO * @return com.epmet.commons.tools.utils.Result * @Author liushaowen @@ -149,4 +154,35 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { } return resultList; } + + /** + * @Description 红黄绿事件总数 + * 红黄绿事件均查询1个月以内的 + * 可以添加传参 monthCount,查询几个月的绿色事件 + * @Param formDTO + * @author zxc + * @date 2021/6/1 3:20 下午 + */ + @Override + public ColorProjectTotalResultDTO colorProjectTotal(ColorProjectTotalFormDTO formDTO) { + ColorProjectTotalResultDTO result = new ColorProjectTotalResultDTO(); + List list = new ArrayList<>(); + if (StringUtils.isEmpty(formDTO.getAreaCode())){ + list = screenProjectDataDao.selectColorProjectByAgencyId(formDTO.getAgencyId(), formDTO.getMonthCount()); + }else { + List colorProjectTotal = screenProjectDataDao.selectColorProjectByAreaCode(formDTO.getAreaCode(), formDTO.getMonthCount()); + if (!CollectionUtils.isEmpty(colorProjectTotal)){ + list.addAll(colorProjectTotal); + } + } + // 事件级别 红色1级:已超期;黄色2级:即将超期;绿色3级:未超期 + if (!CollectionUtils.isEmpty(list)){ + Map> groupByLevel = list.stream().collect(Collectors.groupingBy(ColorProjectTotalResultDTO::getProjectLevel)); + result.setRedTotal(CollectionUtils.isEmpty(groupByLevel.get(NumConstant.ONE)) ? NumConstant.ZERO : groupByLevel.get(NumConstant.ONE).size()); + result.setYellowTotal(CollectionUtils.isEmpty(groupByLevel.get(NumConstant.TWO)) ? NumConstant.ZERO : groupByLevel.get(NumConstant.TWO).size()); + result.setGreenTotal(CollectionUtils.isEmpty(groupByLevel.get(NumConstant.THREE)) ? NumConstant.ZERO : groupByLevel.get(NumConstant.THREE).size()); + result.setProjectTotal(list.size()); + } + return result; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index 2f173078a0..3ed76af34c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -17,6 +17,7 @@ screen_project_data WHERE del_flag = '0' + AND UNIX_TIMESTAMP(CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL 1 MONTH)) and project_level = #{level} @@ -112,4 +113,48 @@ and CUSTOMER_ID= #{customerId} order by sort asc + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml index d2040d3e13..af7f1bfc34 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml @@ -82,4 +82,32 @@ ISSUE_TOTAL desc, PROJECT_TOTAL desc + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java new file mode 100644 index 0000000000..bfaea6a0fd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.org.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 返回每个网格、每个组织下,工作人员的userId + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/3 9:49 + */ +@Data +public class OrgStaffDTO implements Serializable { + + /** + * 组织id或者网格id + */ + private String orgId; + /** + * agency or grid + */ + private String orgType; + /** + * 当前组织或者当前网格下的: + */ + private List staffIds; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java index 3111d5136d..bc8a2b53b8 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java @@ -64,8 +64,14 @@ public class UserTotalDataFormDTO implements Serializable { */ private Integer projectTotal; + /** + * 06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + */ + private Integer gridMemberTotal; + /** * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) */ private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index b47d3cc8ef..794b1b707d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -109,6 +109,8 @@ public class DemoController { private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService; @Autowired private FactOriginProjectCategoryDailyService originProjectCategoryDailyService; + @Autowired + private ScreenCentralZoneDataAbsorptionService screenCentralZoneDataAbsorptionService; @GetMapping("testAlarm") public void testAlarm() { @@ -870,4 +872,9 @@ public class DemoController { return new Result().ok(ndddYhjfService.difficultyDataExtract(param)); } + @PostMapping("centralZoneDataHub") + public Result Test(@RequestBody ScreenCentralZoneDataFormDTO param){ + screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index 05a85d3d7c..210882908f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -3,6 +3,7 @@ package com.epmet.dao.org; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.org.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -33,4 +34,12 @@ public interface StatsCustomerAgencyDao extends BaseDao { List selectCustomerAreaCodeById(@Param("customerIds") List customerIds); CustomerAgencyEntity getRootAgencyInfo(String customerId); + + /** + * 获取每个组织、每个网格下工作人员userId集合 + * + * @param customerId + * @return com.epmet.dto.org.result.OrgStaffResultDTO + */ + List selectOrgStaffIds(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index 411452caeb..e48dc81ab3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -141,5 +141,13 @@ public interface UserDao { * @date 2021.03.08 17:16 */ List selectScreenProjectData(@Param("list") List list); + + /** + * 根据工作员用户id, 返回这些人当中多少个网格员 + * + * @param staffIds + * @return int + */ + int selectGridManagerTotal(@Param("customerId")String customerId,@Param("staffIds")List staffIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java index c41ef72cc3..4843a44a24 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java @@ -95,4 +95,8 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity { */ private Integer projectTotal; + /** + * 06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + */ + private Integer gridMemberTotal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java index b3aa943ada..92516e516b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -1,6 +1,7 @@ package com.epmet.service.org; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.org.CustomerAgencyEntity; import java.util.Date; @@ -20,4 +21,12 @@ public interface CustomerAgencyService { List selectCustomerAreaCodeById(List customerIds); CustomerAgencyEntity getRootAgencyInfo(String customerId); + + /** + * 获取每个组织、每个网格下工作人员userId集合 + * + * @param customerId + * @return com.epmet.dto.org.result.OrgStaffResultDTO + */ + List queryOrgStaffIds(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index 8a8fae83b8..5bcfd88550 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -4,6 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.StatsCustomerAgencyDao; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.org.CustomerAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -50,4 +51,16 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { public CustomerAgencyEntity getRootAgencyInfo(String customerId) { return customerAgencyDao.getRootAgencyInfo(customerId); } + + /** + * 获取每个组织、每个网格下工作人员userId集合 + * + * @param customerId + * @return com.epmet.dto.org.result.OrgStaffResultDTO + */ + @Override + public List queryOrgStaffIds(String customerId) { + List resultList=customerAgencyDao.selectOrgStaffIds(customerId); + return resultList; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index feceadf83d..d096430868 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -4,14 +4,16 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; -import com.epmet.dao.stats.*; +import com.epmet.dao.stats.FactAgencyProjectDailyDao; +import com.epmet.dao.stats.FactGroupGridDailyDao; +import com.epmet.dao.stats.FactIssueGridDailyDao; import com.epmet.dao.stats.topic.FactTopicTotalGridDailyDao; - - - import com.epmet.dao.stats.user.FactRegUserGridDailyDao; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; +import com.epmet.service.org.CustomerAgencyService; import com.epmet.service.stats.ScreenCentralZoneDataExtractService; +import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,7 +45,10 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon private FactIssueGridDailyDao factIssueGridDailyDao; @Autowired private FactAgencyProjectDailyDao factAgencyProjectDailyDao; - + @Autowired + private CustomerAgencyService customerAgencyService; + @Autowired + private UserService userService; private final String ORG_LEVEL_AGENCY = "agency"; private final String ORG_LEVEL_GRID = "grid"; @@ -155,6 +160,10 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon Map projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal)); projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal))); + //For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + List orgStaffDTOList=customerAgencyService.queryOrgStaffIds(customerId); + Map gridManagerMap=userService.queryOrgGridManager(customerId,orgStaffDTOList); + result.forEach(o -> { String orgId = o.getOrgId(); Integer count = groupMap.get(orgId); @@ -169,10 +178,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon count = projectMap.get(orgId); o.setProjectTotal(null == count ? NumConstant.ZERO : count); o.setDataEndTime(dimId); - }); - - + //For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + if(gridManagerMap.containsKey(orgId)){ + o.setGridMemberTotal(gridManagerMap.get(orgId)); + }else{ + o.setGridMemberTotal(NumConstant.ZERO); + } + }); return result; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 36229bfbb2..b7cab26df1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -2,6 +2,7 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; @@ -84,4 +85,13 @@ public interface UserService { * @date 2021.03.08 17:16 */ List fillScreenProjectData(List list); + + /** + * 返回每个组织或者每个网格下的网格员数量 + * + * @param customerId + * @param orgStaffDTOList + * @return com.epmet.dto.user.OrgGridManagerTotalDTO + */ + Map queryOrgGridManager(String customerId,List orgStaffDTOList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index b5594541a6..fc40a2e5fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -8,6 +8,7 @@ import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; @@ -755,4 +756,22 @@ public class UserServiceImpl implements UserService { return collection; } + /** + * 返回每个组织或者每个网格下的网格员数量 + * + * @param customerId + * @param orgStaffDTOList + * @return com.epmet.dto.user.OrgGridManagerTotalDTO + */ + @Override + public Map queryOrgGridManager(String customerId,List orgStaffDTOList) { + Map resultMap=new HashMap<>(); + for (OrgStaffDTO orgStaffDTO : orgStaffDTOList) { + if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(orgStaffDTO.getStaffIds())){ + resultMap.put(orgStaffDTO.getOrgId(),userDao.selectGridManagerTotal(customerId,orgStaffDTO.getStaffIds())); + } + } + return resultMap; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.19__add_gridMemberToalColumn.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.19__add_gridMemberToalColumn.sql new file mode 100644 index 0000000000..5d470eaec9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.19__add_gridMemberToalColumn.sql @@ -0,0 +1,4 @@ +-- 为了平阴大屏,显示网格员数,screen_user_total_data 新增GRID_MEMBER_TOTAL + +-- epmet_evaluation_index 、 epmet_data_statistical_display 库执行以下: +ALTER TABLE screen_user_total_data ADD COLUMN `GRID_MEMBER_TOTAL` INT ( 11 ) NOT NULL DEFAULT '0' COMMENT '06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数' AFTER PROJECT_TOTAL; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml index c3b3ef7de7..8b205de7ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml @@ -25,6 +25,7 @@ TOPIC_TOTAL, ISSUE_TOTAL, PROJECT_TOTAL, + GRID_MEMBER_TOTAL, DEL_FLAG, REVISION, CREATED_BY, @@ -47,6 +48,7 @@ #{item.topicTotal}, #{item.issueTotal}, #{item.projectTotal}, + #{item.gridMemberTotal}, 0, 0, 'APP_USER', @@ -73,6 +75,7 @@ TOPIC_TOTAL, ISSUE_TOTAL, PROJECT_TOTAL, + GRID_MEMBER_TOTAL, DEL_FLAG, REVISION, CREATED_BY, @@ -95,6 +98,7 @@ #{item.topicTotal}, #{item.issueTotal}, #{item.projectTotal}, + #{item.gridMemberTotal}, 0, 0, 'CRAWLER_ROBOT', diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index d5ead92c47..5dc44f074c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -125,4 +125,36 @@ and ca.pid='0' and ca.CUSTOMER_ID=#{customerId} + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index f30740e0ee..51db8980fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -532,4 +532,29 @@ user_id = #{project.linkName} + + +