From c6656f8a3ef6bcbe25872db0c490312b9a5bc650 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 22 Jun 2021 17:47:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B7=A1=E6=9F=A5=E4=B8=AD=E5=92=8C?= =?UTF-8?q?=E6=9C=AA=E5=B7=A1=E6=9F=A5=E4=B8=AD=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datareport/constant/PatrolConstant.java | 5 +++ .../user/StaffPatrolDetailController.java | 14 ++++++++ .../user/StaffPatrolDetailService.java | 10 ++++++ .../impl/StaffPatrolDetailServiceImpl.java | 34 ++++++++++++++++--- .../epmet/dto/form/PatrolCountFormDTO.java | 30 ++++++++++++++++ .../dto/result/PatrolCountResultDTO.java | 32 +++++++++++++++++ 6 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java index eff0bdd451..e4956db0fb 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java @@ -17,4 +17,9 @@ public interface PatrolConstant { */ String LATITUDE = "latitude"; + /** + * 巡查中 + */ + String PATROLLING = "patrolling"; + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java index 72329ea1a1..68d57fa810 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java @@ -3,6 +3,8 @@ package com.epmet.datareport.controller.user; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.user.StaffPatrolDetailService; +import com.epmet.dto.form.PatrolCountFormDTO; +import com.epmet.dto.result.PatrolCountResultDTO; import com.epmet.user.form.GridManagerListFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.RecordListFormDTO; @@ -63,4 +65,16 @@ public class StaffPatrolDetailController { return new Result>().ok(staffPatrolService.patrolTrack(formDTO)); } + /** + * @Description 004、网格员巡查中和未巡查中的人数 + * @Param formDTO + * @author zxc + * @date 2021/6/22 2:01 下午 + */ + @PostMapping("patrolcount") + public Result patrolCount(@RequestBody PatrolCountFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PatrolCountFormDTO.PatrolCountForm.class); + return new Result().ok(staffPatrolService.patrolCount(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java index 98260990a3..d2e94ce385 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java @@ -1,5 +1,7 @@ package com.epmet.datareport.service.user; +import com.epmet.dto.form.PatrolCountFormDTO; +import com.epmet.dto.result.PatrolCountResultDTO; import com.epmet.user.form.GridManagerListFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.RecordListFormDTO; @@ -41,4 +43,12 @@ public interface StaffPatrolDetailService{ */ List patrolTrack(PatrolTrackFormDTO formDTO); + /** + * @Description 004、网格员巡查中和未巡查中的人数 + * @Param formDTO + * @author zxc + * @date 2021/6/22 2:01 下午 + */ + PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java index 8daf720ea1..5590d127b8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java @@ -9,16 +9,14 @@ import com.epmet.datareport.dao.user.StaffPatrolDetailDao; import com.epmet.datareport.dao.user.StaffPatrolRecordDao; import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService; import com.epmet.datareport.service.user.StaffPatrolDetailService; -import com.epmet.dto.result.GridStaffResultDTO; -import com.epmet.dto.result.UserNameAndLLResultDTO; +import com.epmet.dto.form.PatrolCountFormDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.user.form.GridManagerListFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.RecordListFormDTO; import com.epmet.user.result.GridManagerListResultDTO; -import com.epmet.dto.result.PatrolTrackResultDTO; -import com.epmet.dto.result.RecordListResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -27,6 +25,7 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -192,5 +191,32 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService { return new ArrayList<>(); } + /** + * @Description 004、网格员巡查中和未巡查中的人数 + * @Param formDTO + * @author zxc + * @date 2021/6/22 2:01 下午 + */ + @Override + public PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO) { + PatrolCountResultDTO result = new PatrolCountResultDTO(); + GridManagerListFormDTO gridManagerListFormDTO = ConvertUtils.sourceToTarget(formDTO, GridManagerListFormDTO.class); + List resultDTOS = gridManagerList(gridManagerListFormDTO); + // 结果为空就是没网格员 + if (CollectionUtils.isEmpty(resultDTOS)){ + return result; + } + // 根据状态分组,只取巡查中的网格员;巡查中的为0,剩下的都是未巡查,巡查中不为0,总数 - 巡查中 = 未巡查 + Map> groupByStatus = resultDTOS.stream().collect(Collectors.groupingBy(GridManagerListResultDTO::getStatus)); + List patrolling = groupByStatus.get(PatrolConstant.PATROLLING); + if (CollectionUtils.isEmpty(patrolling)){ + result.setElseCount(resultDTOS.size()); + return result; + } + result.setPatrollingCount(patrolling.size()); + result.setElseCount(resultDTOS.size() - patrolling.size()); + return result; + } + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java new file mode 100644 index 0000000000..86505b98e2 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/22 1:54 下午 + * @DESC + */ +@Data +public class PatrolCountFormDTO implements Serializable { + + private static final long serialVersionUID = -4365871122000986115L; + + public interface PatrolCountForm{} + + /** + * 组织ID + */ + @NotBlank(message = "组织ID不能为空",groups = PatrolCountForm.class) + private String agencyId; + + /** + * 行政地区编码 + */ + private String areaCode; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java new file mode 100644 index 0000000000..aeb9032734 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/22 1:50 下午 + * @DESC + */ +@Data +public class PatrolCountResultDTO implements Serializable { + + private static final long serialVersionUID = -5686401629775910576L; + + /** + * 当前巡查中人数 + */ + private Integer patrollingCount; + + /** + * 当前未巡查中人数 + */ + private Integer elseCount; + + public PatrolCountResultDTO() { + this.patrollingCount = NumConstant.ZERO; + this.elseCount = NumConstant.ZERO; + } +} From 0738a81aee67a562d1a8140e3f34365c2fe3155f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 23 Jun 2021 09:33:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?dto=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/user}/form/PatrolCountFormDTO.java | 2 +- .../java/com/epmet/user}/result/PatrolCountResultDTO.java | 2 +- .../controller/user/StaffPatrolDetailController.java | 4 ++-- .../datareport/service/user/StaffPatrolDetailService.java | 4 ++-- .../service/user/impl/StaffPatrolDetailServiceImpl.java | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) rename {epmet-user/epmet-user-client/src/main/java/com/epmet/dto => epmet-module/data-report/data-report-client/src/main/java/com/epmet/user}/form/PatrolCountFormDTO.java (95%) rename {epmet-user/epmet-user-client/src/main/java/com/epmet/dto => epmet-module/data-report/data-report-client/src/main/java/com/epmet/user}/result/PatrolCountResultDTO.java (95%) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/PatrolCountFormDTO.java similarity index 95% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java rename to epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/PatrolCountFormDTO.java index 86505b98e2..6f48bc75f3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/PatrolCountFormDTO.java @@ -1,4 +1,4 @@ -package com.epmet.dto.form; +package com.epmet.user.form; import lombok.Data; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/PatrolCountResultDTO.java similarity index 95% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java rename to epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/PatrolCountResultDTO.java index aeb9032734..4c11895d3d 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/PatrolCountResultDTO.java @@ -1,4 +1,4 @@ -package com.epmet.dto.result; +package com.epmet.user.result; import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java index 68d57fa810..3778182520 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java @@ -3,14 +3,14 @@ package com.epmet.datareport.controller.user; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.user.StaffPatrolDetailService; -import com.epmet.dto.form.PatrolCountFormDTO; -import com.epmet.dto.result.PatrolCountResultDTO; import com.epmet.user.form.GridManagerListFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.form.PatrolCountFormDTO; import com.epmet.user.result.GridManagerListResultDTO; import com.epmet.dto.result.PatrolTrackResultDTO; import com.epmet.dto.result.RecordListResultDTO; +import com.epmet.user.result.PatrolCountResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java index d2e94ce385..20573e51a7 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java @@ -1,13 +1,13 @@ package com.epmet.datareport.service.user; -import com.epmet.dto.form.PatrolCountFormDTO; -import com.epmet.dto.result.PatrolCountResultDTO; import com.epmet.user.form.GridManagerListFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.form.PatrolCountFormDTO; import com.epmet.user.result.GridManagerListResultDTO; import com.epmet.dto.result.PatrolTrackResultDTO; import com.epmet.dto.result.RecordListResultDTO; +import com.epmet.user.result.PatrolCountResultDTO; import java.util.List; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java index 5590d127b8..4f36820709 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java @@ -9,14 +9,15 @@ import com.epmet.datareport.dao.user.StaffPatrolDetailDao; import com.epmet.datareport.dao.user.StaffPatrolRecordDao; import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService; import com.epmet.datareport.service.user.StaffPatrolDetailService; -import com.epmet.dto.form.PatrolCountFormDTO; import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.user.form.GridManagerListFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.form.PatrolCountFormDTO; import com.epmet.user.result.GridManagerListResultDTO; +import com.epmet.user.result.PatrolCountResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired;