From a6b49b471f22e9a28537b82c28457ccacef14800 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 5 Jul 2021 14:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF-=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=AD=E5=BF=83-=E7=BD=91=E6=A0=BC=E5=91=98=E5=B7=A1?= =?UTF-8?q?=E6=9F=A5=E8=AE=B0=E5=BD=95=E6=B1=87=E6=80=BB=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/PersonalPatrolListResultDTO.java | 20 ++++++++++ .../controller/EpmetUserController.java | 10 +++++ .../dao/epmetuser/StaffPatrolRecordDao.java | 7 ++++ .../service/epmetuser/EpmetUserService.java | 10 +++-- .../epmetuser/impl/EpmetUserServiceImpl.java | 38 +++++++++++++++++-- .../mapper/epmetuser/StaffPatrolRecordDao.xml | 12 ++++++ 6 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java new file mode 100644 index 0000000000..8e99eec996 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 个人中心-网格员巡查记录-接口入参 + * @Auth sun + */ +@Data +public class PersonalPatrolListResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //巡查总次数;巡查总时长;立项事件数 + private String key; + //key对应值 + private String value; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index 779fa37fe3..c8a34d86e8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -12,6 +12,7 @@ import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PersonalPatrolListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -99,4 +100,13 @@ public class EpmetUserController { return new Result>().ok(epmetUserService.staffPatrolList(formDTO)); } + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + @PostMapping("personalpatrollist") + public Result> personalPatrolList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(epmetUserService.personalPatrolList(tokenDto.getUserId())); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java index f6a607f801..36385a7cbd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java @@ -23,6 +23,7 @@ import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -46,4 +47,10 @@ public interface StaffPatrolRecordDao extends BaseDao { * @author sun */ List selectStaffPatrolList(StaffListFormDTO formDTO); + + /** + * @Description 汇总查询当前工作人员所有巡查记录数据 + * @author sun + */ + StaffListResultDTO selectPersonalPatrolList(@Param("staffId") String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 03fc33dbc9..f548e47d4e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -3,10 +3,7 @@ package com.epmet.dataaggre.service.epmetuser; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import java.util.List; @@ -71,4 +68,9 @@ public interface EpmetUserService { */ List staffPatrolList(StaffListFormDTO formDTO); + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + List personalPatrolList(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index b9965774c7..69815ed254 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -272,8 +272,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { //3.封装数据并返回 resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); - NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.ONE); + //NumberFormat numberFormat = NumberFormat.getInstance(); + //numberFormat.setMaximumFractionDigits(NumConstant.ZERO); resultList.forEach(re -> { /*String totalTime = "0分钟"; if (re.getTimeNum() > NumConstant.ZERO) { @@ -282,11 +282,43 @@ public class EpmetUserServiceImpl implements EpmetUserService { totalTime = (hour < 1 ? "" : hour + "小时") + (minute < 1 ? "" : minute + "分钟"); } re.setTotalTime(totalTime == "" ? "0分钟" : totalTime);*/ - re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h"); + //re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h"); + re.setTotalTime(re.getTimeNum() / 60 + "分钟"); list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); }); return resultList; } + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + @Override + public List personalPatrolList(String staffId) { + LinkedList resultList = new LinkedList<>(); + //1.汇总查询当前工作人员所有巡查记录数据 + StaffListResultDTO resultDTO = staffPatrolRecordDao.selectPersonalPatrolList(staffId); + if (null == resultDTO) { + return resultList; + } + //2.封装数据并返回 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.ZERO); + PersonalPatrolListResultDTO personal1 = new PersonalPatrolListResultDTO(); + personal1.setKey("总次数"); + personal1.setValue(resultDTO.getPatrolTotal().toString()); + resultList.add(personal1); + PersonalPatrolListResultDTO personal2 = new PersonalPatrolListResultDTO(); + personal2.setKey("总时长"); + personal2.setValue(resultDTO.getTimeNum() / 60 + "分钟"); + resultList.add(personal2); + PersonalPatrolListResultDTO personal3 = new PersonalPatrolListResultDTO(); + personal3.setKey("事件数"); + personal3.setValue(resultDTO.getReportProjectCount().toString()); + resultList.add(personal3); + + return resultList; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml index 5748609036..08a1699368 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml @@ -97,4 +97,16 @@ #{pageNo}, #{pageSize} + +