Browse Source

大屏巡查

dev_shibei_match
zxc 4 years ago
parent
commit
0f6a9e12a7
  1. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java
  2. 24
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java
  3. 20
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java
  4. 8
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java
  5. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  6. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java
  7. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java
  8. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java
  9. 44
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java
  10. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java
  11. 131
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java
  12. 20
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  13. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml
  14. 24
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml
  15. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStaffResultDTO.java
  16. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  17. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  18. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java
  19. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java
  20. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java
  21. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java
  22. 14
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  23. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolTrackFormDTO.java
  24. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RecordListFormDTO.java
  25. 65
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridManagerUserListResultDTO.java
  26. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUserResultDTO.java
  27. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolTrackResultDTO.java
  28. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RecordListResultDTO.java
  29. 33
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameAndLLResultDTO.java
  30. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameResultDTO.java
  31. 36
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  32. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  33. 68
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java
  34. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  35. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  36. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java
  37. 24
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java
  38. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  39. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java
  40. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  41. 90
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java
  42. 24
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  43. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  44. 34
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolDetailDao.xml
  45. 53
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml
  46. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java

@ -20,6 +20,8 @@ public class GridManagerListFormDTO implements Serializable {
@NotBlank(message = "组织ID不能为空",groups = GridManagerListForm.class)
private String agencyId;
@NotBlank(message = "行政区域编码不能为空",groups = GridManagerListForm.class)
/**
* 行政区域编码 平阴传
*/
private String areaCode;
}

24
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.user.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -49,4 +50,27 @@ public class GridManagerListResultDTO implements Serializable {
*/
private String staffName;
/**
* 中心点位
*/
@JsonIgnore
private String centerMark;
/**
* 经纬度赋值状态
*/
@JsonIgnore
private Boolean llStatus;
public GridManagerListResultDTO() {
this.staffId = "";
this.longitude = "";
this.latitude = "";
this.gridId = "";
this.status = "";
this.gridName = "";
this.staffName = "";
this.centerMark = "";
this.llStatus = false;
}
}

20
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java

@ -0,0 +1,20 @@
package com.epmet.datareport.constant;
/**
* @Author zxc
* @DateTime 2021/6/9 1:49 下午
* @DESC
*/
public interface PatrolConstant {
/**
* 经度
*/
String LONGITUDE = "longitude";
/**
* 纬度
*/
String LATITUDE = "latitude";
}

8
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java

@ -4,11 +4,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.user.StaffPatrolDetailService;
import com.epmet.user.form.GridManagerListFormDTO;
import com.epmet.user.form.PatrolTrackFormDTO;
import com.epmet.user.form.RecordListFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.user.result.PatrolTrackResultDTO;
import com.epmet.user.result.RecordListResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -22,6 +22,7 @@ import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.dto.result.plugins.DeptNodeDTO;
import com.epmet.dto.result.plugins.GridNodeDTO;
import com.epmet.evaluationindex.screen.dto.result.*;
import com.epmet.user.result.GridManagerListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -161,4 +162,12 @@ public interface ScreenCustomerAgencyDao {
List<String> getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId);
List<String> selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId);
/**
* @Description 根据agencyId查询网格
* @Param agencyId
* @author zxc
* @date 2021/6/8 1:27 下午
*/
List<GridManagerListResultDTO> selectGrid(@Param("agencyId")String agencyId,@Param("areaCode")String areaCode);
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java

@ -19,7 +19,7 @@ package com.epmet.datareport.dao.user;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.user.StaffPatrolDetailEntity;
import com.epmet.user.result.PatrolTrackResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

14
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java

@ -19,9 +19,11 @@ package com.epmet.datareport.dao.user;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.user.StaffPatrolRecordEntity;
import com.epmet.user.form.RecordListFormDTO;
import com.epmet.user.result.RecordListResultDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -41,5 +43,13 @@ public interface StaffPatrolRecordDao extends BaseDao<StaffPatrolRecordEntity> {
* @date 2021/6/7 5:29 下午
*/
List<RecordListResultDTO> recordList(RecordListFormDTO formDTO);
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:24 上午
*/
List<GridManagerListResultDTO> selectLL(@Param("userIds")List<String> userIds);
}

23
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java

@ -0,0 +1,23 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.user.result.GridManagerListResultDTO;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/6/8 10:45 上午
* @DESC
*/
public interface ScreenOrgService {
/**
* @Description 查询组织下的所有网格
* @Param agencyId
* @Param areaCode
* @author zxc
* @date 2021/6/8 10:46 上午
*/
List<GridManagerListResultDTO> selectAllGrid(String agencyId,String areaCode);
}

44
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java

@ -0,0 +1,44 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService;
import com.epmet.user.result.GridManagerListResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/6/8 10:45 上午
* @DESC
*/
@Service
@Slf4j
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenOrgServiceImpl implements ScreenOrgService {
@Autowired
private ScreenCustomerAgencyDao agencyDao;
/**
* @Description 查询组织下的所有网格
* @Param agencyId
* @Param areaCode
* @author zxc
* @date 2021/6/8 10:46 上午
*/
@Override
public List<GridManagerListResultDTO> selectAllGrid(String agencyId,String areaCode) {
List<GridManagerListResultDTO> result = agencyDao.selectGrid(agencyId, areaCode);
if (!CollectionUtils.isEmpty(result)){
return result;
}
return new ArrayList<>();
}
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java

@ -1,13 +1,11 @@
package com.epmet.datareport.service.user;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.datareport.entity.user.StaffPatrolDetailEntity;
import com.epmet.user.form.GridManagerListFormDTO;
import com.epmet.user.form.PatrolTrackFormDTO;
import com.epmet.user.form.RecordListFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.user.result.PatrolTrackResultDTO;
import com.epmet.user.result.RecordListResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import java.util.List;

131
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java

@ -1,21 +1,33 @@
package com.epmet.datareport.service.user.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.constant.PatrolConstant;
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.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.user.form.GridManagerListFormDTO;
import com.epmet.user.form.PatrolTrackFormDTO;
import com.epmet.user.form.RecordListFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.user.result.PatrolTrackResultDTO;
import com.epmet.user.result.RecordListResultDTO;
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;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 工作人员巡查记录明细
@ -33,16 +45,111 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
@Autowired
private StaffPatrolRecordDao staffPatrolRecordDao;
@Autowired
private ScreenOrgService screenOrgService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* @Description 001网格员分布
* 1.根据agencyId或者areaCode查询出网格
* 2.根据查出来的网格ID去查网格下边的人人只要网格员
* 3.根据userId查询巡查记录表
* 4.数据补全
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:06 下午
*/
@Override
public List<GridManagerListResultDTO> gridManagerList(GridManagerListFormDTO formDTO) {
List<GridManagerListResultDTO> grids = new ArrayList<>();
if (StringUtils.isEmpty(formDTO.getAreaCode())){
// 根据agencyId查询网格
grids = screenOrgService.selectAllGrid(formDTO.getAgencyId(), null);
}else {
// 根据areaCode查询网格
grids = screenOrgService.selectAllGrid(null, formDTO.getAreaCode());
}
if (CollectionUtils.isEmpty(grids)){
return new ArrayList<>();
}
List<String> gridIds = grids.stream().map(m -> m.getGridId()).collect(Collectors.toList());
// 查询网格下的网格员
Result<List<GridStaffResultDTO>> resultData = govOrgOpenFeignClient.selectGridStaffByGridIds(gridIds);
if(!resultData.success()){
throw new RenException("查询网格下的网格员失败【"+resultData.getMsg()+"】");
}
List<GridStaffResultDTO> data = resultData.getData();
if (CollectionUtils.isEmpty(data)){
return new ArrayList<>();
}
List<GridManagerListResultDTO> result = ConvertUtils.sourceToTarget(data, GridManagerListResultDTO.class);
// 查询经纬度
Result<UserNameAndLLResultDTO> selectll = epmetUserOpenFeignClient.selectll(result.stream().map(m -> m.getStaffId()).collect(Collectors.toList()));
if (!selectll.success()){
throw new RenException("查询经纬度和姓名失败【"+selectll.getMsg()+"】");
}
UserNameAndLLResultDTO llAndNameData = selectll.getData();
List<GridManagerListResultDTO> finalGrids = grids;
result.forEach(r -> {
// 经纬度赋值 巡查状态赋值
if (!CollectionUtils.isEmpty(llAndNameData.getLl())) {
llAndNameData.getLl().forEach(l -> {
if (r.getStaffId().equals(l.getStaffId()) && r.getGridId().equals(l.getGridId())) {
r.setLatitude(l.getLatitude());
r.setLongitude(l.getLongitude());
r.setStatus(l.getStatus());
r.setLlStatus(true);
}
});
}
// 姓名赋值
if (!CollectionUtils.isEmpty(llAndNameData.getUserNames())){
llAndNameData.getUserNames().forEach(n -> {
if (r.getStaffId().equals(n.getUserId())){
r.setStaffName(n.getUserName());
}
});
}
finalGrids.forEach(g -> {
if (r.getGridId().equals(g.getGridId())){
r.setGridName(g.getGridName());
}
});
});
result.forEach(r -> {
if (!r.getLlStatus()){
finalGrids.forEach(g -> {
if (StringUtils.isNotBlank(g.getCenterMark())){
r.setLongitude(getLL(g.getCenterMark(),PatrolConstant.LONGITUDE));
r.setLatitude(getLL(g.getCenterMark(),PatrolConstant.LATITUDE));
}
});
}
});
return result;
}
return null;
/**
* @Description 根据中心点位截取经纬度
* @Param centMark
* @Param ll
* @author zxc
* @date 2021/6/9 2:08 下午
*/
public String getLL(String centMark,String ll){
if (ll.equals(PatrolConstant.LONGITUDE)){
String longitude = centMark.substring(NumConstant.TWO, centMark.indexOf(","));
return longitude;
}else {
String s = centMark.substring(NumConstant.ZERO, centMark.indexOf(","));
String latitude = centMark.substring(s.length() + NumConstant.ONE, centMark.length() - NumConstant.TWO);
return latitude;
}
}
/**
@ -53,7 +160,11 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
*/
@Override
public List<RecordListResultDTO> recordList(RecordListFormDTO formDTO) {
List<RecordListResultDTO> result = staffPatrolRecordDao.recordList(formDTO);
Result<List<RecordListResultDTO>> listResult = epmetUserOpenFeignClient.recordList(formDTO);
if (!listResult.success()){
throw new RenException("查询巡查记录失败【"+listResult.getMsg()+"】");
}
List<RecordListResultDTO> result = listResult.getData();
if (!CollectionUtils.isEmpty(result)){
return result;
}
@ -68,10 +179,16 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
*/
@Override
public List<PatrolTrackResultDTO> patrolTrack(PatrolTrackFormDTO formDTO) {
List<PatrolTrackResultDTO> results = staffPatrolDetailDao.selectPatrolTrack(formDTO.getStaffPatrolRecId());
Result<List<PatrolTrackResultDTO>> result = epmetUserOpenFeignClient.patrolTrack(formDTO);
if (!result.success()){
throw new RenException("查询 巡查轨迹失败【"+result.getMsg()+"】");
}
List<PatrolTrackResultDTO> results = result.getData();
if (!CollectionUtils.isEmpty(results)){
return results;
}
return new ArrayList<>();
}
}

20
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -320,4 +320,24 @@
</otherwise>
</choose>
</select>
<!-- 根据agencyId查询网格 -->
<select id="selectGrid" resultType="com.epmet.user.result.GridManagerListResultDTO">
SELECT
CONCAT(IF(ISNULL(ca2.AGENCY_NAME),'',CONCAT(ca2.AGENCY_NAME,'-')),
IF(ISNULL(ca.AGENCY_NAME),'',CONCAT(ca.AGENCY_NAME,'-')),
IF(ISNULL(cg.GRID_NAME),'',cg.GRID_NAME)) AS gridName,
cg.GRID_ID,
IFNULL(cg.CENTER_MARK,'') AS centerMark
FROM epmet_evaluation_index.screen_customer_grid cg
LEFT JOIN epmet_evaluation_index.screen_customer_agency ca ON ca.AGENCY_ID = cg.PARENT_AGENCY_ID AND ca.DEL_FLAG = 0
LEFT JOIN epmet_evaluation_index.screen_customer_agency ca2 ON ca2.AGENCY_ID = ca.PID AND ca2.DEL_FLAG = 0
WHERE cg.DEL_FLAG = 0
<if test="agencyId == null">
AND cg.AREA_CODE LIKE CONCAT(#{areaCode},'%')
</if>
<if test="areaCode == null">
AND cg.PARENT_AGENCY_ID = #{agencyId}
</if>
</select>
</mapper>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml

@ -4,7 +4,7 @@
<mapper namespace="com.epmet.datareport.dao.user.StaffPatrolDetailDao">
<!-- 查询巡查轨迹 -->
<select id="selectPatrolTrack" resultType="com.epmet.user.result.PatrolTrackResultDTO">
<select id="selectPatrolTrack" resultType="com.epmet.dto.result.PatrolTrackResultDTO">
SELECT
LATITUDE,
LONGITUDE

24
epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml

@ -4,7 +4,7 @@
<mapper namespace="com.epmet.datareport.dao.user.StaffPatrolRecordDao">
<!-- 巡查记录查询 -->
<select id="recordList" resultType="com.epmet.user.result.RecordListResultDTO">
<select id="recordList" resultType="com.epmet.dto.result.RecordListResultDTO">
SELECT
ID AS staffPatrolRecId,
DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d %H:%i:%s') AS patrolStartTime,
@ -16,4 +16,26 @@
AND STAFF_ID = #{staffId}
ORDER BY CREATED_TIME DESC
</select>
<!-- 查询经纬度 -->
<select id="selectLL" resultType="com.epmet.user.result.GridManagerListResultDTO">
SELECT t.* FROM
(SELECT
distinct(pr.ID) AS ID,
pr.GRID AS gridId,
pr.STAFF_ID,
pr.`STATUS`,
pd.LATITUDE,
pd.LONGITUDE,
pd.SERIAL_NUM
FROM staff_patrol_record pr
LEFT JOIN staff_patrol_detail pd ON pd.STAFF_PATROL_REC_ID = pr.ID AND pd.DEL_FLAG = 0
WHERE pr.DEL_FLAG = 0
AND (
<foreach collection="userIds" item="userId" separator=" OR ">
pr.STAFF_ID = #{userId}
</foreach>
)
ORDER BY pd.SERIAL_NUM DESC)t GROUP BY ID
</select>
</mapper>

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStaffResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/8 3:23 下午
* @DESC
*/
@Data
public class GridStaffResultDTO implements Serializable {
private static final long serialVersionUID = -5910427385795368242L;
private String gridId;
private String staffId;
}

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -333,4 +333,13 @@ public interface GovOrgOpenFeignClient {
**/
@PostMapping(value = "/gov/org/customeragency/getprocessorlist/{agencyId}")
Result<ProcessorListResultDTO> getProcessorList(@PathVariable("agencyId") String agencyId);
/**
* @Description 查询网格下的网格员
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
@PostMapping("/gov/org/customerstaffgrid/gridstaff")
Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(@RequestBody List<String> gridIds);
}

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -192,4 +192,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<ProcessorListResultDTO> getProcessorList(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getProcessorList", agencyId);
}
@Override
public Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(List<String> gridIds) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds);
}
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java

@ -29,6 +29,7 @@ import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.GridStaffResultDTO;
import com.epmet.excel.CustomerStaffGridExcel;
import com.epmet.service.CustomerStaffGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -119,4 +120,15 @@ public class CustomerStaffGridController {
ValidatorUtils.validateEntity(gridIdFormDTO);
return customerStaffGridService.getAllGridStaffs(gridIdFormDTO);
}
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
@PostMapping("gridstaff")
public Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(@RequestBody List<String> gridIds){
return new Result<List<GridStaffResultDTO>>().ok(customerStaffGridService.selectGridStaffByGridIds(gridIds));
}
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java

@ -22,6 +22,7 @@ import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffDepartmentDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.GridStaffResultDTO;
import com.epmet.entity.CustomerStaffGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -97,4 +98,12 @@ public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> {
* @Description 查询人员在客户下参与的网格列表
*/
List<CustomerStaffGridDTO> selectStaffGridList(CustomerStaffGridDTO staffGridDTO);
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(@Param("gridIds") List<String> gridIds);
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java

@ -26,6 +26,7 @@ import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CommonStaffInfoResultDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.GridStaffResultDTO;
import com.epmet.entity.CustomerStaffGridEntity;
import java.util.List;
@ -117,4 +118,12 @@ public interface CustomerStaffGridService extends BaseService<CustomerStaffGridE
* @date 2020.04.29 22:59
**/
Result<List<String>> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO);
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds);
}

35
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -30,13 +31,16 @@ import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.LatestGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.GridStaffResultDTO;
import com.epmet.entity.CustomerStaffGridEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.CustomerStaffGridRedis;
import com.epmet.service.CustomerStaffGridService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
@ -56,6 +60,9 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
@Autowired
private CustomerStaffGridRedis customerStaffGridRedis;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<CustomerStaffGridDTO> page(Map<String, Object> params) {
@ -146,4 +153,32 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
)
);
}
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
@Override
public List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds) {
if (CollectionUtils.isEmpty(gridIds)){
return new ArrayList<>();
}
// 查询网格下所有的人
List<GridStaffResultDTO> gridStaff = baseDao.selectGridStaffByGridIds(gridIds);
if (CollectionUtils.isEmpty(gridStaff)){
return new ArrayList<>();
}
// 拿着网格下所有人去筛选网格员
Result<List<GridStaffResultDTO>> result = epmetUserOpenFeignClient.staffGridRole(gridStaff);
if (!result.success()){
throw new RenException("查询网格下的网格员失败【"+result.getMsg()+"】");
}
List<GridStaffResultDTO> data = result.getData();
if (CollectionUtils.isEmpty(data)){
return new ArrayList<>();
}
return data;
}
}

14
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -88,6 +88,20 @@
AND customer_id = #{customerId}
</select>
<!-- 查询网格下的人 -->
<select id="selectGridStaffByGridIds" resultType="com.epmet.dto.result.GridStaffResultDTO">
SELECT
USER_ID AS staffId,
GRID_ID
FROM customer_staff_grid
WHERE DEL_FLAG = '0'
AND (
<foreach collection="gridIds" item="gridId" separator=" OR ">
GRID_ID = #{gridId}
</foreach>
)
</select>
<!-- 批量插入网格工作人员 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into customer_staff_grid

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/PatrolTrackFormDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolTrackFormDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.form;
package com.epmet.dto.form;
import lombok.Data;

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/RecordListFormDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RecordListFormDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.form;
package com.epmet.dto.form;
import lombok.Data;

65
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridManagerUserListResultDTO.java

@ -0,0 +1,65 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/7 2:57 下午
* @DESC
*/
@Data
public class GridManagerUserListResultDTO implements Serializable {
private static final long serialVersionUID = 3606766812822179356L;
/**
* 工作人员id
*/
private String staffId;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 网格ID
*/
private String gridId;
/**
* 正在巡查patrolling否则返回空字符串
*/
private String status;
/**
* 网格名称最多显示上两级
*/
private String gridName;
/**
* 姓名
*/
private String staffName;
/**
* 中心点位
*/
@JsonIgnore
private String centerMark;
/**
* 经纬度赋值状态
*/
@JsonIgnore
private Boolean llStatus;
}

20
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUserResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/8 4:30 下午
* @DESC
*/
@Data
public class GridStaffUserResultDTO implements Serializable {
private static final long serialVersionUID = 7715622585539953368L;
private String gridId;
private String staffId;
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/PatrolTrackResultDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolTrackResultDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.result;
package com.epmet.dto.result;
import lombok.Data;

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/RecordListResultDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RecordListResultDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.result;
package com.epmet.dto.result;
import lombok.Data;

33
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameAndLLResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/6/9 11:12 上午
* @DESC
*/
@Data
public class UserNameAndLLResultDTO implements Serializable {
private static final long serialVersionUID = 8997436689118596889L;
/**
* 用户名字
*/
private List<UserNameResultDTO> userNames;
/**
* 经纬度
*/
private List<GridManagerUserListResultDTO> ll;
public UserNameAndLLResultDTO() {
this.userNames = new ArrayList<>();
this.ll = new ArrayList<>();
}
}

19
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/9 11:12 上午
* @DESC
*/
@Data
public class UserNameResultDTO implements Serializable {
private static final long serialVersionUID = 5383959788021394553L;
private String userId;
private String userName;
}

36
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -530,4 +530,40 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/badge/userbadges")
Result<List<UserBadgesResultDTO>> userBadges(@RequestBody UserBadgesFormDTO formDTO);
/**
* @Description 查询网格员角色
* @Param forms
* @author zxc
* @date 2021/6/8 4:42 下午
*/
@PostMapping("/epmetuser/staffrole/staffgridrole")
Result<List<GridStaffResultDTO>> staffGridRole(@RequestBody List<GridStaffResultDTO> forms);
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:40 上午
*/
@PostMapping("/epmetuser/staffpatrol/getll")
Result<UserNameAndLLResultDTO> selectll(@RequestBody List<String> userIds);
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
@PostMapping("/epmetuser/staffpatrol/recordlist")
Result<List<RecordListResultDTO>> recordList(@RequestBody RecordListFormDTO formDTO);
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
@PostMapping("/epmetuser/staffpatrol/patroltrack")
Result<List<PatrolTrackResultDTO>> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO);
}

21
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -373,4 +373,25 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<List<UserBadgesResultDTO>> userBadges(UserBadgesFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "userBadges", formDTO);
}
@Override
public Result<List<GridStaffResultDTO>> staffGridRole(List<GridStaffResultDTO> forms) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffGridRole", forms);
}
@Override
public Result<UserNameAndLLResultDTO> selectll(List<String> userIds) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectll", userIds);
}
@Override
public Result<List<RecordListResultDTO>> recordList(RecordListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "recordList", formDTO);
}
@Override
public Result<List<PatrolTrackResultDTO>> patrolTrack(PatrolTrackFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolTrack", formDTO);
}
}

68
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java

@ -0,0 +1,68 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.dto.result.GridManagerUserListResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import com.epmet.dto.result.UserNameAndLLResultDTO;
import com.epmet.service.StaffPatrolRecordService;
import com.epmet.user.result.GridManagerListResultDTO;
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;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/6/9 10:32 上午
* @DESC
*/
@RestController
@RequestMapping("staffpatrol")
public class StaffPatrolController {
@Autowired
private StaffPatrolRecordService staffPatrolRecordService;
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:40 上午
*/
@PostMapping("getll")
public Result<UserNameAndLLResultDTO> selectll(@RequestBody List<String> userIds){
return new Result<UserNameAndLLResultDTO>().ok(staffPatrolRecordService.selectLL(userIds));
}
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
@PostMapping("recordlist")
public Result<List<RecordListResultDTO>> recordList(@RequestBody RecordListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, RecordListFormDTO.RecordListForm.class);
return new Result<List<RecordListResultDTO>>().ok(staffPatrolRecordService.recordList(formDTO));
}
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
@PostMapping("patroltrack")
public Result<List<PatrolTrackResultDTO>> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, PatrolTrackFormDTO.PatrolTrackForm.class);
return new Result<List<PatrolTrackResultDTO>>().ok(staffPatrolRecordService.patrolTrack(formDTO));
}
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java

@ -10,11 +10,8 @@ import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerRoleFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService;
import com.epmet.service.StaffRoleService;
@ -181,4 +178,15 @@ public class StaffRoleController {
staffRoleService.changeRoleOrg(formDTO);
return new Result();
}
/**
* @Description 查询网格员角色
* @Param forms
* @author zxc
* @date 2021/6/8 4:42 下午
*/
@PostMapping("staffgridrole")
public Result<List<GridStaffResultDTO>> staffGridRole(@RequestBody List<GridStaffResultDTO> forms){
return new Result<List<GridStaffResultDTO>>().ok(staffRoleService.staffGridRole(forms));
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -197,4 +197,12 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @return
*/
BasicInfoResultDTO getStaffBasicInfo(StaffBasicInfoFromDTO fromDTO);
/**
* @Description 查询用户名字
* @Param userIds
* @author zxc
* @date 2021/6/9 1:36 下午
*/
List<UserNameResultDTO> selectUserName(@Param("userIds")List<String> userIds);
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.entity.StaffPatrolDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工作人员巡查记录明细
@ -29,5 +33,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface StaffPatrolDetailDao extends BaseDao<StaffPatrolDetailEntity> {
/**
* @Description 查询巡查轨迹
* @Param staffPatrolRecId
* @author zxc
* @date 2021/6/7 5:13 下午
*/
List<PatrolTrackResultDTO> selectPatrolTrack(@Param("staffPatrolRecId") String staffPatrolRecId);
}

24
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java

@ -18,8 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.dto.result.GridManagerUserListResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import com.epmet.entity.StaffPatrolRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工作人员巡查主记录
@ -29,5 +35,21 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface StaffPatrolRecordDao extends BaseDao<StaffPatrolRecordEntity> {
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:24 上午
*/
List<GridManagerUserListResultDTO> selectLL(@Param("userIds")List<String> userIds);
/**
* @Description 巡查记录查询
* @Param formDTO
* @author zxc
* @date 2021/6/7 5:29 下午
*/
List<RecordListResultDTO> recordList(RecordListFormDTO formDTO);
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -24,10 +24,7 @@ import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.GetRoleKeyListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.StaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -131,4 +128,12 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
* @Description 工作端-查询用户角色key列表
**/
List<String> selectStaffRoleKeyList(GetRoleKeyListFormDTO formDTO);
/**
* @Description 查询是网格员的人
* @Param forms
* @author zxc
* @date 2021/6/8 4:53 下午
*/
List<GridStaffResultDTO> staffGridRole(@Param("forms") List<GridStaffResultDTO> forms);
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java

@ -18,8 +18,15 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import com.epmet.dto.result.UserNameAndLLResultDTO;
import com.epmet.entity.StaffPatrolRecordEntity;
import java.util.List;
/**
* 工作人员巡查主记录
@ -29,5 +36,28 @@ import com.epmet.entity.StaffPatrolRecordEntity;
*/
public interface StaffPatrolRecordService extends BaseService<StaffPatrolRecordEntity> {
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:40 上午
*/
UserNameAndLLResultDTO selectLL(List<String> userIds);
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
List<RecordListResultDTO> recordList(RecordListFormDTO formDTO);
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
List<PatrolTrackResultDTO> patrolTrack(PatrolTrackFormDTO formDTO);
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java

@ -25,10 +25,7 @@ import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.StaffRoleEntity;
import java.util.List;
@ -159,4 +156,12 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @return void
*/
void changeRoleOrg(StaffRoleDTO formDTO);
/**
* @Description 查询网格员角色
* @Param forms
* @author zxc
* @date 2021/6/8 4:42 下午
*/
List<GridStaffResultDTO> staffGridRole(List<GridStaffResultDTO> forms);
}

90
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java

@ -1,27 +1,21 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dao.StaffPatrolDetailDao;
import com.epmet.dao.StaffPatrolRecordDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.StaffPatrolRecordEntity;
import com.epmet.service.StaffPatrolRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 工作人员巡查主记录
@ -32,5 +26,67 @@ import org.springframework.stereotype.Service;
@Service
public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRecordDao, StaffPatrolRecordEntity> implements StaffPatrolRecordService {
@Autowired
private CustomerStaffDao customerStaffDao;
@Autowired
private StaffPatrolRecordDao staffPatrolRecordDao;
@Autowired
private StaffPatrolDetailDao staffPatrolDetailDao;
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:40 上午
*/
@Override
public UserNameAndLLResultDTO selectLL(List<String> userIds) {
UserNameAndLLResultDTO result = new UserNameAndLLResultDTO();
if (CollectionUtils.isEmpty(userIds)){
return result;
}
// 经纬度查询
List<GridManagerUserListResultDTO> llResult = baseDao.selectLL(userIds);
if (!CollectionUtils.isEmpty(llResult)){
result.setLl(llResult);
}
// 姓名查询
List<UserNameResultDTO> nameResult = customerStaffDao.selectUserName(userIds);
if (!CollectionUtils.isEmpty(nameResult)){
result.setUserNames(nameResult);
}
return result;
}
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
@Override
public List<RecordListResultDTO> recordList(RecordListFormDTO formDTO) {
List<RecordListResultDTO> result = staffPatrolRecordDao.recordList(formDTO);
if (!CollectionUtils.isEmpty(result)){
return result;
}
return new ArrayList<>();
}
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
@Override
public List<PatrolTrackResultDTO> patrolTrack(PatrolTrackFormDTO formDTO) {
List<PatrolTrackResultDTO> results = staffPatrolDetailDao.selectPatrolTrack(formDTO.getStaffPatrolRecId());
if (!CollectionUtils.isEmpty(results)){
return results;
}
return new ArrayList<>();
}
}

24
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -32,10 +32,7 @@ import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.RolesUsersListFormDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.StaffRolesResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.StaffRoleEntity;
import com.epmet.redis.StaffRoleRedis;
import com.epmet.service.StaffRoleService;
@ -43,6 +40,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
@ -188,4 +186,22 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
baseDao.updateStaffRoleOrgId(formDTO);
}
/**
* @Description 查询网格员角色
* @Param forms
* @author zxc
* @date 2021/6/8 4:42 下午
*/
@Override
public List<GridStaffResultDTO> staffGridRole(List<GridStaffResultDTO> forms) {
if (CollectionUtils.isEmpty(forms)){
return new ArrayList<>();
}
List<GridStaffResultDTO> result = baseDao.staffGridRole(forms);
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
return result;
}
}

17
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -357,4 +357,21 @@
AND user_id = #{staffId}
LIMIT 1
</select>
<!-- 查询用户名字 -->
<select id="selectUserName" resultType="com.epmet.dto.result.UserNameResultDTO">
SELECT
USER_ID,
IFNULL( REAL_NAME, '' ) AS userName
FROM
customer_staff
WHERE
DEL_FLAG = '0'
AND (
<foreach collection="userIds" item="userId" separator=" OR ">
USER_ID = #{userId}
</foreach>
)
</select>
</mapper>

34
epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolDetailDao.xml

@ -3,27 +3,17 @@
<mapper namespace="com.epmet.dao.StaffPatrolDetailDao">
<resultMap type="com.epmet.entity.StaffPatrolDetailEntity" id="staffPatrolDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="staffPatrolRecId" column="STAFF_PATROL_REC_ID"/>
<result property="serialNum" column="SERIAL_NUM"/>
<result property="uploadTime" column="UPLOAD_TIME"/>
<result property="latitude" column="LATITUDE"/>
<result property="longitude" column="LONGITUDE"/>
<result property="speed" column="SPEED"/>
<result property="accuracy" column="ACCURACY"/>
<result property="altitude" column="ALTITUDE"/>
<result property="verticalaccuracy" column="VERTICALACCURACY"/>
<result property="horizontalaccuracy" column="HORIZONTALACCURACY"/>
<result property="address" column="ADDRESS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 查询巡查轨迹 -->
<select id="selectPatrolTrack" resultType="com.epmet.dto.result.PatrolTrackResultDTO">
SELECT
LATITUDE,
LONGITUDE
FROM
staff_patrol_detail
WHERE
STAFF_PATROL_REC_ID = #{staffPatrolRecId}
AND DEL_FLAG = 0
ORDER BY SERIAL_NUM
</select>
</mapper>

53
epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml

@ -3,25 +3,40 @@
<mapper namespace="com.epmet.dao.StaffPatrolRecordDao">
<resultMap type="com.epmet.entity.StaffPatrolRecordEntity" id="staffPatrolRecordMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="grid" column="GRID"/>
<result property="gridPids" column="GRID_PIDS"/>
<result property="staffId" column="STAFF_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="patrolStartTime" column="PATROL_START_TIME"/>
<result property="patrolEndTime" column="PATROL_END_TIME"/>
<result property="actrualEndTime" column="ACTRUAL_END_TIME"/>
<result property="totalTime" column="TOTAL_TIME"/>
<result property="status" column="STATUS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 查询经纬度 -->
<select id="selectLL" resultType="com.epmet.dto.result.GridManagerUserListResultDTO">
SELECT t.* FROM
(SELECT
distinct(pr.ID) AS ID,
pr.GRID AS gridId,
pr.STAFF_ID,
pr.`STATUS`,
pd.LATITUDE,
pd.LONGITUDE,
pd.SERIAL_NUM
FROM staff_patrol_record pr
LEFT JOIN staff_patrol_detail pd ON pd.STAFF_PATROL_REC_ID = pr.ID AND pd.DEL_FLAG = 0
WHERE pr.DEL_FLAG = 0
AND (
<foreach collection="userIds" item="userId" separator=" OR ">
pr.STAFF_ID = #{userId}
</foreach>
)
ORDER BY pd.SERIAL_NUM DESC)t GROUP BY ID
</select>
<!-- 巡查记录查询 -->
<select id="recordList" resultType="com.epmet.dto.result.RecordListResultDTO">
SELECT
ID AS staffPatrolRecId,
DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d %H:%i:%s') AS patrolStartTime,
DATE_FORMAT(PATROL_END_TIME,'%Y-%m-%d %H:%i:%s') AS patrolEndTime,
`STATUS`
FROM staff_patrol_record
WHERE DEL_FLAG = 0
AND GRID = #{gridId}
AND STAFF_ID = #{staffId}
ORDER BY CREATED_TIME DESC
</select>
</mapper>

14
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -193,4 +193,18 @@
AND gsr.del_flag = '0'
AND sr.staff_id = #{userId}
</select>
<!-- 查询是网格员的人 -->
<select id="staffGridRole" resultType="com.epmet.dto.result.GridStaffResultDTO">
<foreach collection="forms" item="s" separator=" UNION ALL ">
SELECT
#{s.gridId} as gridId,
sr.STAFF_ID
FROM staff_role sr
LEFT JOIN gov_staff_role gsr ON gsr.ID = sr.ROLE_ID AND gsr.DEL_FLAG = 0
WHERE sr.DEL_FLAG = 0
AND gsr.ROLE_KEY = 'grid_member'
AND sr.STAFF_ID = #{s.staffId}
</foreach>
</select>
</mapper>

Loading…
Cancel
Save