diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
index c601d2fd71..fd4a97d11e 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
@@ -44,6 +44,11 @@ public interface StrConstant {
*/
String COLON = ":";
+ /**
+ * 英文分号
+ */
+ String SEMICOLON = ";";
+
/**
* 中文顿号
*/
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java
index 134124f512..4820f4d50b 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java
@@ -20,8 +20,17 @@ public class PageFormDTO {
}
@NotNull(message = "页码不能为空", groups = AddUserInternalGroup.class)
- private Integer pageNo;
+ private Integer pageNo = 1;
@NotNull(message = "每页数量不能为空", groups = AddUserInternalGroup.class)
- private Integer pageSize;
+ private Integer pageSize = 20;
+
+ /**
+ * 偏移量 从多少条开始
+ */
+ private Integer offset;
+
+ public Integer getOffset() {
+ return (pageNo-1)*pageSize;
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/param/MidPatrolFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/param/MidPatrolFormDTO.java
new file mode 100644
index 0000000000..b0810e54cc
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/param/MidPatrolFormDTO.java
@@ -0,0 +1,29 @@
+package com.epmet.dto.user.param;
+
+import com.epmet.commons.tools.dto.form.PageFormDTO;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * desc:查询巡查 参数
+ *
+ * @author zhaoqifeng
+ * @dscription
+ * @date 2021/6/7 16:23
+ */
+@NoArgsConstructor
+@Data
+public class MidPatrolFormDTO extends PageFormDTO implements Serializable {
+ private static final long serialVersionUID = 4411051728689886810L;
+ /**
+ * 客户Id
+ */
+ private String customerId;
+ /**
+ * 巡查记录id 没有则查询全部
+ */
+ private String patrolId;
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolDetailResult.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolDetailResult.java
new file mode 100644
index 0000000000..434d2c8740
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolDetailResult.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto.user.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 工作人员巡查明细记录
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-06-07
+ */
+@Data
+public class MidPatrolDetailResult implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ private String id;
+
+ /**
+ * 客户Id
+ */
+ private String customerId;
+
+ /**
+ * 维度
+ */
+ private String latitude;
+
+ /**
+ * 经度
+ */
+ private String longitude;
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolRecordResult.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolRecordResult.java
new file mode 100644
index 0000000000..a08d7cba17
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/MidPatrolRecordResult.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto.user.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 工作人员巡查主记录
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-06-07
+ */
+@Data
+public class MidPatrolRecordResult implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ private String id;
+
+ /**
+ * 客户Id
+ */
+ private String customerId;
+
+ /**
+ * 网格id
+ */
+ private String grid;
+
+ /**
+ * 网格所有上级id
+ */
+ private String gridPids;
+
+ /**
+ * 工作人员用户id
+ */
+ private String staffId;
+
+ /**
+ * 工作人员所属组织id=网格所属的组织id
+ */
+ private String agencyId;
+
+ /**
+ * 巡查开始时间
+ */
+ private Date patrolStartTime;
+
+ /**
+ * 巡查结束时间,前端传入
+ */
+ private Date patrolEndTime;
+
+ /**
+ * 实际结束时间=操作结束巡查的时间
+ */
+ private Date actrualEndTime;
+
+ /**
+ * 本次巡查总耗时,单位秒;结束巡查时写入
+ */
+ private Integer totalTime;
+
+ /**
+ * 正在巡查中:patrolling;结束:end
+ */
+ private String status;
+
+ /**
+ * 删除标识 0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+ /**
+ * 维度
+ */
+ private String latitude;
+
+ /**
+ * 精度
+ */
+ private String longitude;
+
+}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
index c74dcff61c..e2856a9af7 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
@@ -16,9 +16,13 @@ import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.CustomerStaffDTO;
+import com.epmet.dto.user.result.MidPatrolDetailResult;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -305,4 +309,26 @@ public interface DataStatisticalOpenFeignClient {
*/
@PostMapping("/data/stats/datareporting/staffbaseinfo")
Result> getStaffBaseInfo(@RequestBody StaffBaseInfoFormDTO formDTO);
+
+ /**
+ * 根据巡查记录id 获取巡查主记录信息
+ *
+ * @param midPatrolFormDTO
+ * @return
+ * @author yinzuomei
+ * @date 2021/9/10 8:56 上午
+ */
+ @GetMapping(value = "/data/stats/datareporting/getPatrolRecordList")
+ Result> getPatrolRecordList(@RequestBody MidPatrolFormDTO midPatrolFormDTO);
+
+ /**
+ * 根据巡查记录id 获取巡查轨迹(明细)信息
+ *
+ * @param midPatrolFormDTO
+ * @return
+ * @author yinzuomei
+ * @date 2021/9/10 8:56 上午
+ */
+ @GetMapping(value = "/data/stats/datarng/getPatrolDetailList")
+ Result> getPatrolDetailList(@RequestBody MidPatrolFormDTO midPatrolFormDTO);
}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
index dd8e5ada80..069de2e0ad 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
@@ -4,7 +4,10 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
-import com.epmet.dto.extract.form.*;
+import com.epmet.dto.extract.form.BizDataFormDTO;
+import com.epmet.dto.extract.form.ExtractIndexFormDTO;
+import com.epmet.dto.extract.form.ExtractOriginFormDTO;
+import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.org.AgencyBaseInfoFormDTO;
@@ -14,9 +17,11 @@ import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.CustomerStaffDTO;
+import com.epmet.dto.user.result.MidPatrolDetailResult;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.feign.DataStatisticalOpenFeignClient;
-import org.springframework.stereotype.Component;
import java.util.List;
@@ -288,4 +293,30 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getStaffBaseInfo", formDTO);
}
+
+ /**
+ * 根据巡查记录id 获取巡查主记录信息
+ *
+ * @param midPatrolFormDTO
+ * @return
+ * @author yinzuomei
+ * @date 2021/9/10 8:56 上午
+ */
+ @Override
+ public Result> getPatrolRecordList(MidPatrolFormDTO midPatrolFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getPatrolRecordList", midPatrolFormDTO);
+ }
+
+ /**
+ * 根据巡查记录id 获取巡查轨迹(明细)信息
+ *
+ * @param midPatrolFormDTO
+ * @return
+ * @author yinzuomei
+ * @date 2021/9/10 8:56 上午
+ */
+ @Override
+ public Result> getPatrolDetailList(MidPatrolFormDTO midPatrolFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getPatrolDetailList", midPatrolFormDTO);
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java
index 5775a22a2a..8314f6e390 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java
@@ -7,7 +7,10 @@ import com.epmet.dto.org.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.CustomerStaffDTO;
+import com.epmet.dto.user.result.MidPatrolDetailResult;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.service.DataReportingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -57,4 +60,32 @@ public class DataReportingController {
return new Result>().ok(dataReportingService.getStaffBaseInfo(formDTO));
}
+ /**
+ * desc: 条件获取巡查主表信息
+ *
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @author LiuJanJun
+ * @date 2021/10/15 12:01 下午
+ */
+ @PostMapping("getPatrolRecordList")
+ public Result> getPatrolRecordList(@RequestBody(required = false) MidPatrolFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class);
+ return new Result>().ok(dataReportingService.getPatrolRecordList(formDTO));
+ }
+
+ /**
+ * desc: 条件获取巡查明细信息
+ *
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @author LiuJanJun
+ * @date 2021/10/15 12:01 下午
+ */
+ @PostMapping("getPatrolDetailList")
+ public Result> getPatrolDetailList(@RequestBody(required = false) MidPatrolFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class);
+ return new Result>().ok(dataReportingService.getPatrolDetailList(formDTO));
+ }
+
}
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 dac88a5fbf..5f2d700755 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
@@ -6,6 +6,7 @@ import com.epmet.dto.extract.result.UserPartyResultDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.*;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import org.apache.ibatis.annotations.Mapper;
@@ -259,5 +260,9 @@ public interface UserDao {
* @Description 批量查询客户网格员基础信息
**/
List getStaffBaseInfo(StaffBaseInfoFormDTO formDTO);
+
+ List getPatrolRecordList(MidPatrolFormDTO formDTO);
+
+ List getPatrolDetailList(MidPatrolFormDTO formDTO);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java
index 5d0c7538c5..3164c5fc35 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DataReportingService.java
@@ -5,7 +5,10 @@ import com.epmet.dto.org.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.CustomerStaffDTO;
+import com.epmet.dto.user.result.MidPatrolDetailResult;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
import java.util.List;
@@ -35,4 +38,24 @@ public interface DataReportingService {
* @return*/
List getStaffBaseInfo(StaffBaseInfoFormDTO formDTO);
+ /**
+ * desc: 获取巡查记录列表
+ *
+ * @param formDTO
+ * @return java.util.List
+ * @author LiuJanJun
+ * @date 2021/10/15 1:21 下午
+ */
+ List getPatrolRecordList(MidPatrolFormDTO formDTO);
+
+ /**
+ * desc: 获取巡查明细列表
+ *
+ * @param formDTO
+ * @return java.util.List
+ * @author LiuJanJun
+ * @date 2021/10/15 1:22 下午
+ */
+ List getPatrolDetailList(MidPatrolFormDTO formDTO);
+
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
index 211c4b5a7b..f3d1215173 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
@@ -5,10 +5,14 @@ import com.epmet.dto.org.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.CustomerStaffDTO;
+import com.epmet.dto.user.result.MidPatrolDetailResult;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.service.DataReportingService;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.org.CustomerGridService;
+import com.epmet.service.user.StatsStaffPatrolService;
import com.epmet.service.user.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +33,8 @@ public class DataReportingServiceImpl implements DataReportingService {
private CustomerGridService customerGridService;
@Autowired
private UserService userService;
+ @Autowired
+ private StatsStaffPatrolService statsStaffPatrolService;
/**
* @Author sun
@@ -63,4 +69,14 @@ public class DataReportingServiceImpl implements DataReportingService {
return resultList;
}
+ @Override
+ public List getPatrolRecordList(MidPatrolFormDTO formDTO) {
+ return userService.getPatrolRecordList(formDTO);
+ }
+
+ @Override
+ public List getPatrolDetailList(MidPatrolFormDTO formDTO) {
+ return userService.getPatrolDetailList(formDTO);
+ }
+
}
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 cc75f43258..729623f10e 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
@@ -8,10 +8,8 @@ import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
-import com.epmet.dto.user.result.StaffRoleInfoDTO;
-import com.epmet.dto.user.result.CustomerStaffDTO;
-import com.epmet.dto.user.result.StaffPatrolRecordResult;
-import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
+import com.epmet.dto.user.result.*;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.util.DimIdGenerator;
@@ -144,4 +142,8 @@ public interface UserService {
* @Description 批量查询客户网格员基础信息
**/
List getStaffBaseInfo(StaffBaseInfoFormDTO formDTO);
+
+ List getPatrolRecordList(MidPatrolFormDTO formDTO);
+
+ List getPatrolDetailList(MidPatrolFormDTO formDTO);
}
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 2c5e72333f..cabe064d84 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
@@ -18,6 +18,7 @@ import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.dto.stats.user.*;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.dto.user.StaffBaseInfoFormDTO;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.*;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.service.user.UserService;
@@ -1098,4 +1099,14 @@ public class UserServiceImpl implements UserService {
return userDao.getStaffBaseInfo(formDTO);
}
+ @Override
+ public List getPatrolRecordList(MidPatrolFormDTO formDTO) {
+ return userDao.getPatrolRecordList(formDTO);
+ }
+
+ @Override
+ public List getPatrolDetailList(MidPatrolFormDTO formDTO) {
+ return userDao.getPatrolDetailList(formDTO);
+ }
+
}
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 e048aadd1d..b2cb63b899 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
@@ -1011,5 +1011,32 @@
+
+ SELECT
+ id, customer_id, grid, grid_pids, staff_id, agency_id, patrol_start_time, patrol_end_time,
+ actrual_end_time, total_time, status, del_flag, revision, created_by, created_time, updated_by, updated_time
+ FROM staff_patrol_record
+ WHERE
+ 1=1
+
+ AND ID = #{patrolId}
+
+ and CUSTOMER_ID = #{customerId}
+ AND DEL_FLAG = '0'
+ LIMIT #{offset},#{pageSize}
+
+
+ select
+ id, customer_id, staff_patrol_rec_id,latitude, longitude, del_flag, revision, created_by, created_time, updated_by, updated_time
+ from staff_patrol_detail
+ WHERE
+ 1=1
+
+ AND staff_patrol_rec_id = #{patrolId}
+
+ and CUSTOMER_ID = #{customerId}
+ AND DEL_FLAG = '0'
+ LIMIT #{offset},#{pageSize}
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/service/user/impl/UserServiceImplTest.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/service/user/impl/UserServiceImplTest.java
new file mode 100644
index 0000000000..682f71efd1
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/service/user/impl/UserServiceImplTest.java
@@ -0,0 +1,46 @@
+package com.epmet.service.user.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
+import com.epmet.service.user.UserService;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+@RunWith(Arquillian.class)
+public class UserServiceImplTest {
+ @Deployment
+ public static JavaArchive createDeployment() {
+ return ShrinkWrap.create(JavaArchive.class)
+ .addClass(UserServiceImpl.class)
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+ @Autowired
+ private UserService userService;
+
+ @Test
+ public void getPatrolRecordList() {
+ MidPatrolFormDTO midPatrolFormDTO = new MidPatrolFormDTO();
+ midPatrolFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
+ midPatrolFormDTO.setPatrolId("");
+ midPatrolFormDTO.setPageNo(1);
+ midPatrolFormDTO.setPageSize(110);
+
+ List patrolRecordList = userService.getPatrolRecordList(midPatrolFormDTO);
+ System.out.println(JSON.toJSONString(patrolRecordList));
+ }
+
+ @Test
+ public void getPatrolDetailList() {
+ }
+}
diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/UpsertPatrolRecordForm.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/UpsertPatrolRecordForm.java
index ecd3fee58d..23d412318b 100644
--- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/UpsertPatrolRecordForm.java
+++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/UpsertPatrolRecordForm.java
@@ -2,6 +2,8 @@ package com.epmet.opendata.dto.form;
import lombok.Data;
+import javax.validation.constraints.NotEmpty;
+
/**
* 插入或更新巡查记录主表
* @author liujianjun
@@ -11,11 +13,13 @@ public class UpsertPatrolRecordForm {
/**
* 客户Id
*/
+ @NotEmpty(message = "customerId不能为空")
private String customerId;
/**
* 巡查记录id
*/
+ @NotEmpty(message = "customerId不能为空")
private String patrolId;
/**
@@ -23,6 +27,7 @@ public class UpsertPatrolRecordForm {
* SystemMessageType.USER_PATROL_START
* SystemMessageTypSTOP
*/
+ @NotEmpty(message = "actionType不能为空")
private String actionType;
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/pom.xml b/epmet-module/open-data-worker/open-data-worker-server/pom.xml
index 1c0da40f63..6466dc8a2a 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/pom.xml
+++ b/epmet-module/open-data-worker/open-data-worker-server/pom.xml
@@ -72,6 +72,18 @@
2.0.0
compile
+
+ com.epmet
+ epmet-user-client
+ 2.0.0
+ compile
+
+
+ com.epmet
+ data-statistical-client
+ 2.0.0
+ compile
+
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/StaffPatrolDetailDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/UserPatrolDetailDao.java
similarity index 92%
rename from epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/StaffPatrolDetailDao.java
rename to epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/UserPatrolDetailDao.java
index ecae380d72..57fb4edc6d 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/StaffPatrolDetailDao.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/UserPatrolDetailDao.java
@@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper;
* @since v1.0.0 2021-10-14
*/
@Mapper
-public interface StaffPatrolDetailDao extends BaseDao {
+public interface UserPatrolDetailDao extends BaseDao {
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolDetailServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolDetailServiceImpl.java
index 508c8f7859..e5b0956b16 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolDetailServiceImpl.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolDetailServiceImpl.java
@@ -18,7 +18,7 @@
package com.epmet.opendata.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
-import com.epmet.opendata.dao.StaffPatrolDetailDao;
+import com.epmet.opendata.dao.UserPatrolDetailDao;
import com.epmet.opendata.entity.UserPatrolDetailEntity;
import com.epmet.opendata.service.UserPatrolDetailService;
import org.springframework.stereotype.Service;
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Service;
* @since v1.0.0 2021-10-14
*/
@Service
-public class UserPatrolDetailServiceImpl extends BaseServiceImpl implements UserPatrolDetailService {
+public class UserPatrolDetailServiceImpl extends BaseServiceImpl implements UserPatrolDetailService {
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
index ee6ebed979..ad2d5f04f7 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/UserPatrolRecordServiceImpl.java
@@ -17,12 +17,30 @@
package com.epmet.opendata.service.impl;
+import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.constant.StrConstant;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.constant.SystemMessageType;
+import com.epmet.dto.user.param.MidPatrolFormDTO;
+import com.epmet.dto.user.result.MidPatrolDetailResult;
+import com.epmet.dto.user.result.MidPatrolRecordResult;
+import com.epmet.feign.DataStatisticalOpenFeignClient;
+import com.epmet.opendata.dao.UserPatrolDetailDao;
import com.epmet.opendata.dao.UserPatrolRecordDao;
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm;
+import com.epmet.opendata.entity.UserPatrolDetailEntity;
import com.epmet.opendata.entity.UserPatrolRecordEntity;
import com.epmet.opendata.service.UserPatrolRecordService;
+import lombok.extern.slf4j.Slf4j;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
/**
@@ -31,12 +49,115 @@ import org.springframework.stereotype.Service;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-14
*/
+@Slf4j
@Service
public class UserPatrolRecordServiceImpl extends BaseServiceImpl implements UserPatrolRecordService {
+ @Autowired
+ private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
+ @Autowired
+ private UserPatrolDetailDao userPatrolDetailDao;
@Override
public Boolean upsertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm) {
- return null;
+ ValidatorUtils.validateEntity(patrolRecordForm);
+ boolean delFlag = false;
+ MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm);
+ Result> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO);
+ if (record == null || !record.success()){
+ log.error("获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
+ return false;
+ }
+ List data = record.getData();
+ if (CollectionUtils.isEmpty(data)){
+ //数据已被删除了
+ delFlag = true;
+ //暂时设置error 用于排错
+ log.error("获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO));
+ int effectRow = baseDao.deleteById(patrolRecordForm.getPatrolId());
+ log.warn("del effectRow:{}",effectRow);
+ return true;
+ }
+ MidPatrolRecordResult recordResult = data.get(NumConstant.ZERO);
+ switch (patrolRecordForm.getActionType()){
+ case SystemMessageType.USER_PATROL_START:
+ //insert
+ baseDao.insert(buildEntity(recordResult));
+ break;
+ case SystemMessageType.USER_PATROL_STOP:
+ //update
+ baseDao.updateById(buildEntity(recordResult));
+ Result> detailResult = dataStatisticalOpenFeignClient.getPatrolDetailList(midPatrolFormDTO);
+ if (detailResult == null || !detailResult.success()){
+ log.error("获取巡查记录明细失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
+ return false;
+ }
+ UserPatrolDetailEntity detailEntity = buildDetailEntity(recordResult, detailResult);
+
+ userPatrolDetailDao.insert(detailEntity);
+ break;
+ default:
+ log.info("======");
+
+ }
+ return true;
+ }
+
+ @NotNull
+ private UserPatrolDetailEntity buildDetailEntity(MidPatrolRecordResult recordResult, Result> detailResult) {
+ UserPatrolDetailEntity detailEntity = new UserPatrolDetailEntity();
+ detailEntity.setCustomerId(recordResult.getCustomerId());
+ detailEntity.setStaffPatrolRecId(recordResult.getId());
+ StringBuilder sb =new StringBuilder();
+ detailResult.getData().forEach(o->{
+ sb.append(o.getLongitude())
+ .append(StrConstant.COMMA)
+ .append(o.getLatitude())
+ .append(StrConstant.SEMICOLON);
+ });
+ detailEntity.setRoute(sb.toString());
+ detailEntity.setId(recordResult.getId());
+ detailEntity.setRevision(recordResult.getRevision());
+ detailEntity.setCreatedBy(recordResult.getCreatedBy());
+ detailEntity.setCreatedTime(recordResult.getCreatedTime());
+ detailEntity.setUpdatedBy(recordResult.getUpdatedBy());
+ detailEntity.setUpdatedTime(recordResult.getUpdatedTime());
+ detailEntity.setDelFlag(String.valueOf(recordResult.getDelFlag()));
+ return detailEntity;
+ }
+
+ private UserPatrolRecordEntity buildEntity(MidPatrolRecordResult recordResult) {
+ UserPatrolRecordEntity entity = new UserPatrolRecordEntity();
+ entity.setCustomerId(recordResult.getCustomerId());
+ entity.setGrid(recordResult.getGrid());
+ entity.setGridPids(recordResult.getGridPids());
+ entity.setStaffId(recordResult.getStaffId());
+ entity.setAgencyId(recordResult.getAgencyId());
+ entity.setPatrolStartTime(recordResult.getPatrolStartTime());
+ entity.setPatrolEndTime(recordResult.getPatrolEndTime());
+ entity.setActrualEndTime(recordResult.getActrualEndTime());
+ entity.setStartLocation("");
+ entity.setEndLocation("");
+ entity.setTotalTime(recordResult.getTotalTime());
+ entity.setDistance(0);
+ entity.setStatus(recordResult.getStatus());
+ entity.setId(recordResult.getId());
+ entity.setRevision(recordResult.getRevision());
+ entity.setCreatedBy(recordResult.getCreatedBy());
+ entity.setCreatedTime(recordResult.getCreatedTime());
+ entity.setUpdatedBy(recordResult.getUpdatedBy());
+ entity.setUpdatedTime(recordResult.getUpdatedTime());
+ entity.setDelFlag(String.valueOf(recordResult.getDelFlag()));
+ return entity;
+ }
+
+ @NotNull
+ private MidPatrolFormDTO buildParam(UpsertPatrolRecordForm patrolRecordForm) {
+ MidPatrolFormDTO midPatrolFormDTO = new MidPatrolFormDTO();
+ midPatrolFormDTO.setCustomerId(patrolRecordForm.getCustomerId());
+ midPatrolFormDTO.setPatrolId(patrolRecordForm.getPatrolId());
+ midPatrolFormDTO.setPageNo(0);
+ midPatrolFormDTO.setPageSize(1);
+ return midPatrolFormDTO;
}
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/StaffPatrolDetailDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/UserPatrolDetailDao.xml
similarity index 92%
rename from epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/StaffPatrolDetailDao.xml
rename to epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/UserPatrolDetailDao.xml
index bc66036982..bd61a74027 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/StaffPatrolDetailDao.xml
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/UserPatrolDetailDao.xml
@@ -1,7 +1,7 @@
-
+