Browse Source

Merge branch 'dev_grid_patrol' into develop

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
0620ba6d57
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  3. 25
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolDateListFormDTO.java
  4. 35
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolRecordListFormDTO.java
  5. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDateListResultDTO.java
  6. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java
  7. 48
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java
  8. 33
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  9. 22
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  10. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java
  11. 23
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java
  12. 86
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  13. 30
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java
  14. 51
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java
  15. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java
  16. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java
  17. 67
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  18. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  19. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  20. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java
  21. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  22. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  23. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/PatrolConstant.java
  24. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolRecordDetailFormDTO.java
  25. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java
  26. 55
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java
  27. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffPatrolInitFormDTO.java
  28. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java
  29. 39
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRecordDetailResultDTO.java
  30. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolUploadResultDTO.java
  31. 30
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffPatrolInitResultDTO.java
  32. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StartPatrolResultDTO.java
  33. 96
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java
  34. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolDetailService.java
  35. 61
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java
  36. 38
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolDetailServiceImpl.java
  37. 291
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java
  38. 46
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.12__add_user_patrol.sql

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -87,6 +87,7 @@ public enum EpmetErrorCode {
EXIT_PEND_PROJECT(8408,"该工作人员有项目尚在处理,处理完毕方可操作"),
EXIT_PUBLISHED_ACTIVITY(8409,"该工作人员有活动尚在进行,等活动完成方可操作"),
CAN_NOT_SELF(8410,"无法对自己进行操作"),
PATROL_IS_NOT_OVER(8520,"巡查尚未结束"),
ALREADY_EVALUATE(8501,"您已评价"),
ALREADY_VOTE(8502,"您已表态"),

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -608,6 +608,24 @@ public class DateUtils {
return minutes;
}
/**
* @return java.lang.Integer
* @param startDate
* @param endDate
* @author yinzuomei
* @description 计算两个时间点之间相隔秒数
* @Date 2020/7/29 13:38
**/
public static Integer calculateSecond(Date startDate,Date endDate){
long start=startDate.getTime();
long end=endDate.getTime();
// 计算差多少分钟
int second = (int) ((end - start) / 1000);
System.out.println("两个时间之间的分钟差为:" + second);
return second;
}
/**
* @return java.lang.String
* @param dateOne

25
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolDateListFormDTO.java

@ -0,0 +1,25 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/10 14:31
*/
@NoArgsConstructor
@Data
public class PatrolDateListFormDTO implements Serializable {
private static final long serialVersionUID = -3120791500214908595L;
public interface PatrolDateListGroup {}
@NotBlank(message = "网格Id不能为空",groups = PatrolDateListGroup.class)
private String gridId;
@NotBlank(message = "工作人员ID不能为空",groups = PatrolDateListGroup.class)
private String staffId;
}

35
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolRecordListFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:23
*/
@Data
@NoArgsConstructor
public class PatrolRecordListFormDTO implements Serializable {
private static final long serialVersionUID = 7496587490046732883L;
public interface PatrolRecordListGroup {}
/**
* 巡查日期,格式yyyy-MM-dd
*/
@NotBlank(message = "巡查日期不能为空",groups = PatrolRecordListGroup.class)
private String patrolDate;
/**
* 网格Id
*/
@NotBlank(message = "网格Id不能为空",groups = PatrolRecordListGroup.class)
private String gridId;
/**
* 用户ID
*/
@NotBlank(message = "用户ID不能为空",groups = PatrolRecordListGroup.class)
private String userId;
}

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDateListResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/10 14:32
*/
@NoArgsConstructor
@Data
public class PatrolDateListResultDTO implements Serializable {
private static final long serialVersionUID = -1516170049255588336L;
private String startDate;
private List<String> list;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/9 14:38
*/
@NoArgsConstructor
@Data
public class PatrolRecordDetailDTO implements Serializable {
private static final long serialVersionUID = 757994412954699222L;
/**
* 上传时间yyyy-MM-dd HH:mm
*/
private String uploadTime;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 速度单位m/s
*/
private String speed;
/**
* 后端返回开始巡查结束巡查此列只有集合第一条和最后一条有值
*/
private String flag;
}

48
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java

@ -0,0 +1,48 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:24
*/
@NoArgsConstructor
@Data
public class PatrolRecordListResultDTO implements Serializable {
private static final long serialVersionUID = -8808482239766626564L;
/**
* 巡查记录id
*/
private String staffPatrolRecId;
/**
* 总时长描述后端返回格式XX小时XX分前端直接展示
*/
private String totalTimeDesc;
/**
* 开始时间yyyy-MM-dd HH:mm
*/
private String patrolStartTime;
/**
* 结束时间yyyy-MM-dd HH:mm
*/
private String patrolEndTime;
/**
* 巡查中patrolling已结束end如果是巡查中界面不展示结束时间这一行
*/
private String status;
/**
* 后端返回巡查员最近地址变动是XX分钟前
*/
private String latestChangeDesc;
/**
* 巡查记录详情
*/
private List<PatrolRecordDetailDTO> details;
}

33
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -5,11 +5,12 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.result.SubAgencyUserResultDTO;
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.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -49,5 +50,31 @@ public class EpmetUserController {
return new Result<List<StaffListResultDTO>>().ok(epmetUserService.staffList(formDTO));
}
/**
* 巡查记录列表查询
* @author zhaoqifeng
* @date 2021/6/9 14:48
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO>>
*/
@PostMapping("recordlist")
public Result<List<PatrolRecordListResultDTO>> recordList(@RequestBody PatrolRecordListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<PatrolRecordListResultDTO>>().ok(epmetUserService.recordList(formDTO));
}
/**
* 历史巡查日期查询
* @author zhaoqifeng
* @date 2021/6/10 14:36
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO>
*/
@PostMapping("patrolleddatelist")
public Result<PatrolDateListResultDTO> patrolDateList(@RequestBody PatrolDateListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<PatrolDateListResultDTO>().ok(epmetUserService.patrolDateList(formDTO));
}
}

22
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -1,6 +1,10 @@
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;
@ -34,4 +38,22 @@ public interface EpmetUserService {
* @author sun
*/
List<StaffListResultDTO> staffList(StaffListFormDTO formDTO);
/**
* 巡查记录列表查询
* @author zhaoqifeng
* @date 2021/6/9 14:49
* @param formDTO
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO>
*/
List<PatrolRecordListResultDTO> recordList(PatrolRecordListFormDTO formDTO);
/**
* 历史巡查日期查询
* @author zhaoqifeng
* @date 2021/6/10 14:36
* @param formDTO
* @return com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO
*/
PatrolDateListResultDTO patrolDateList(PatrolDateListFormDTO formDTO);
}

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java

@ -19,8 +19,12 @@ package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity;
import java.util.List;
import java.util.Map;
/**
* 工作人员巡查记录明细
*
@ -29,5 +33,12 @@ import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity;
*/
public interface StaffPatrolDetailService extends BaseService<StaffPatrolDetailEntity> {
/**
* 获取记录明细
* @author zhaoqifeng
* @date 2021/6/9 15:09
* @param recordIds
* @return java.util.Map<java.lang.String,java.util.List<com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO>>
*/
Map<String, List<StaffPatrolDetailDTO>> getDetailByRecordIds(List<String> recordIds);
}

23
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java

@ -18,8 +18,11 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity;
import java.util.List;
/**
* 工作人员巡查主记录
*
@ -28,5 +31,25 @@ import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity;
*/
public interface StaffPatrolRecordService extends BaseService<StaffPatrolRecordEntity> {
/**
* 获取巡查记录列表
*
* @param gridId
* @param userId
* @param patrolDate
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO>
* @author zhaoqifeng
* @date 2021/6/9 14:55
*/
List<StaffPatrolRecordDTO> getRecordList(String gridId, String userId, String patrolDate);
/**
* 获取日期列表
* @author zhaoqifeng
* @date 2021/6/10 14:49
* @param gridId
* @param staffId
* @return java.util.List<java.lang.String>
*/
List<String> getDateList(String gridId, String staffId);
}

86
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -6,11 +6,16 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao;
import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO;
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.StaffListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -18,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -36,6 +42,10 @@ public class EpmetUserServiceImpl implements EpmetUserService {
private GovOrgService govOrgService;
@Autowired
private StaffPatrolRecordDao staffPatrolRecordDao;
@Resource
private StaffPatrolDetailService staffPatrolDetailService;
@Resource
private StaffPatrolRecordService staffPatrolRecordService;
/**
* @Description 根据UserIds查询
@ -93,5 +103,77 @@ public class EpmetUserServiceImpl implements EpmetUserService {
return resultList;
}
/**
* 巡查记录列表查询
*
* @param formDTO
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO>
* @author zhaoqifeng
* @date 2021/6/9 14:49
*/
@Override
public List<PatrolRecordListResultDTO> recordList(PatrolRecordListFormDTO formDTO) {
List<StaffPatrolRecordDTO> recordList = staffPatrolRecordService.getRecordList(formDTO.getGridId(), formDTO.getUserId(), formDTO.getPatrolDate());
if (CollectionUtils.isEmpty(recordList)) {
return Collections.emptyList();
}
List<String> recordIds = recordList.stream().map(StaffPatrolRecordDTO :: getId).collect(Collectors.toList());
Map<String, List<StaffPatrolDetailDTO>> details = staffPatrolDetailService.getDetailByRecordIds(recordIds);
List<PatrolRecordListResultDTO> result = recordList.stream().map(record -> {
PatrolRecordListResultDTO dto = new PatrolRecordListResultDTO();
dto.setStaffPatrolRecId(record.getId());
dto.setStatus(record.getStatus());
dto.setPatrolStartTime(DateUtils.format(record.getPatrolStartTime(), DateUtils.DATE_TIME_PATTERN));
dto.setPatrolEndTime(DateUtils.format(record.getPatrolEndTime(), DateUtils.DATE_TIME_PATTERN));
Integer minutes;
if (("patrolling").equals(record.getStatus())) {
minutes = DateUtils.calculateMin(record.getPatrolStartTime(), new Date());
String latestChangeDesc = "后端返回:巡查员最近地址变动是" + minutes + "分钟前";
dto.setLatestChangeDesc(latestChangeDesc);
} else {
minutes = record.getTotalTime() / 60;
}
String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分";
dto.setTotalTimeDesc(totalTimeDesc);
List<StaffPatrolDetailDTO> detailList = details.get(record.getId());
List<PatrolRecordDetailDTO> recordDetails =
detailList.stream().sorted(Comparator.comparing(StaffPatrolDetailDTO::getSerialNum).reversed()).collect(Collectors.toList()).stream().map( detail -> {
PatrolRecordDetailDTO detailDTO = new PatrolRecordDetailDTO();
detailDTO.setLatitude(detail.getLatitude());
detailDTO.setLongitude(detail.getLongitude());
detailDTO.setSpeed(detail.getSpeed());
detailDTO.setUploadTime(DateUtils.format(detail.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
return detailDTO;
}).collect(Collectors.toList());
if (("end").equals(record.getStatus())) {
recordDetails.get(NumConstant.ZERO).setFlag("结束巡查");
}
recordDetails.get(recordDetails.size() - 1).setFlag("开始巡查");
dto.setDetails(recordDetails);
return dto;
}).collect(Collectors.toList());
return result;
}
/**
* 历史巡查日期查询
*
* @param formDTO
* @return com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO
* @author zhaoqifeng
* @date 2021/6/10 14:36
*/
@Override
public PatrolDateListResultDTO patrolDateList(PatrolDateListFormDTO formDTO) {
List<String> list = staffPatrolRecordService.getDateList(formDTO.getGridId(), formDTO.getStaffId());
PatrolDateListResultDTO dto = new PatrolDateListResultDTO();
if (CollectionUtils.isNotEmpty(list)) {
dto.setStartDate(list.get(NumConstant.ZERO));
}
dto.setList(list);
return dto;
}
}

30
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java

@ -17,15 +17,22 @@
package com.epmet.dataaggre.service.epmetuser.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolDetailDao;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 工作人员巡查记录明细
*
@ -38,4 +45,27 @@ import org.springframework.stereotype.Service;
public class StaffPatrolDetailServiceImpl extends BaseServiceImpl<StaffPatrolDetailDao, StaffPatrolDetailEntity> implements StaffPatrolDetailService {
/**
* 获取记录明细
*
* @param recordIds
* @return java.util.Map<java.lang.String, java.util.List < com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO>>
* @author zhaoqifeng
* @date 2021/6/9 15:09
*/
@Override
public Map<String, List<StaffPatrolDetailDTO>> getDetailByRecordIds(List<String> recordIds) {
if (CollectionUtils.isEmpty(recordIds)) {
return Collections.emptyMap();
}
StringBuilder sql = new StringBuilder("( STAFF_PATROL_REC_ID = '' ");
for (String id : recordIds) {
sql.append("OR STAFF_PATROL_REC_ID = '").append(id).append("' ");
}
sql.append(")");
QueryWrapper<StaffPatrolDetailEntity> wrapper = new QueryWrapper<>();
wrapper.apply(sql.toString());
List<StaffPatrolDetailDTO> list = ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), StaffPatrolDetailDTO.class);
return list.stream().collect(Collectors.groupingBy(StaffPatrolDetailDTO::getStaffPatrolRecId));
}
}

51
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java

@ -17,15 +17,23 @@
package com.epmet.dataaggre.service.epmetuser.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 工作人员巡查主记录
*
@ -38,5 +46,48 @@ import org.springframework.stereotype.Service;
public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRecordDao, StaffPatrolRecordEntity> implements StaffPatrolRecordService {
/**
* 获取巡查记录列表
*
* @param gridId
* @param userId
* @param patrolDate
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO>
* @author zhaoqifeng
* @date 2021/6/9 14:55
*/
@Override
public List<StaffPatrolRecordDTO> getRecordList(String gridId, String userId, String patrolDate) {
QueryWrapper<StaffPatrolRecordEntity> wrapper = new QueryWrapper<>();
wrapper.eq("GRID", gridId)
.eq("STAFF_ID", userId)
.eq("DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d') ", patrolDate)
.orderByDesc("PATROL_START_TIME");
return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), StaffPatrolRecordDTO.class);
}
/**
* 获取日期列表
*
* @param gridId
* @param staffId
* @return java.util.List<java.lang.String>
* @author zhaoqifeng
* @date 2021/6/10 14:49
*/
@Override
public List<String> getDateList(String gridId, String staffId) {
QueryWrapper<StaffPatrolRecordEntity> wrapper = new QueryWrapper<>();
wrapper.select("DISTINCT DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d') AS ID")
.eq("GRID", gridId)
.eq("STAFF_ID", staffId)
.orderByAsc("PATROL_START_TIME");
List<StaffPatrolRecordEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(StaffPatrolRecordEntity::getId).collect(Collectors.toList());
}
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java

@ -70,6 +70,11 @@ public class ScreenProjectGridDailyDTO implements Serializable {
*/
private String pids;
/**
* 网格所有的父级id,以英文:或者英文,隔开
*/
private String centerMark;
/**
* 截止到当前日期网格内项目总数
*/

1
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java

@ -16,6 +16,7 @@ public class GridCenterPointForm implements Serializable {
private static final long serialVersionUID = -6988009829971668860L;
private String customerId;
private String pids;
private List<CenterPointForm> centerDataList = new ArrayList<>();

67
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -40,8 +40,8 @@ import java.util.List;
@Mapper
public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity> {
/**
*15网格信息上传
* 1) 根据CUSTOMER_ID 进行查询如果有数据则先进行物理删除, 一次删除1000条
* 15网格信息上传
* 1) 根据CUSTOMER_ID 进行查询如果有数据则先进行物理删除, 一次删除1000条
*
* @param customerId
* @return java.util.Integer
@ -52,18 +52,18 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
/**
* 15网格信息上传
* 2) 在批量新增
* 2) 在批量新增
*
* @param list
* @param customerId
* @Author zhangyong
* @Date 10:52 2020-08-18
**/
void batchInsertCustomerGrid(@Param("list") List<CustomerGridFormDTO> list, @Param("customerId")String customerId);
void batchInsertCustomerGrid(@Param("list") List<CustomerGridFormDTO> list, @Param("customerId") String customerId);
/**
* @return java.lang.Integer
* @param customerId
* @return java.lang.Integer
* @author yinzuomei
* @description 查询客户下网格总数
* @Date 2020/8/26 15:33
@ -71,17 +71,17 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
Integer selectCountByCustomerId(@Param("customerId") String customerId);
/**
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @param customerId
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @author yinzuomei
* @description 查询客户下网格信息
* @Date 2020/8/26 15:33
**/
List<ScreenCustomerGridDTO> selectListByCustomerId(@Param("customerId")String customerId);
List<ScreenCustomerGridDTO> selectListByCustomerId(@Param("customerId") String customerId);
/**
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @param formDTO
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @author yinzuomei
* @description 分页查询网格列表
* @Date 2020/8/27 14:42
@ -89,7 +89,7 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
List<ScreenCustomerGridDTO> pageListByCustomerId(PageQueryGridFormDTO formDTO);
/**
* @param gridId 网格id
* @param gridId 网格id
* @return java.lang.String
* @author yinzuomei
* @description 查询网格所属的组织id
@ -107,28 +107,29 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @Date 10:45 2020-09-04
**/
List<ScreenCustomerGridDTO> selectListMismatchGridInfo(@Param("customerId") String customerId,
@Param("gridIds") String[] gridIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
@Param("gridIds") String[] gridIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds") List<String> subCustomerIds);
/**
* 根据客户id 查询网格(党支部)详细信息
*
* @param customerId
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId,
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId") String customerId,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
@Param("subCustomerIds") List<String> subCustomerIds);
/**
* @Description 根据agencyId查询网格ID
* @param agencyId
* @Description 根据agencyId查询网格ID
* @author zxc
* @date 2020/9/22 2:16 下午
*/
List<String> selectGridIdByAgencyId(@Param("agencyId")String agencyId);
List<String> selectGridIdByAgencyId(@Param("agencyId") String agencyId);
ScreenCustomerGridEntity getLastAddGrid();
@ -137,58 +138,59 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
ScreenCustomerGridEntity getByGridId(String gridId);
/**
* @Description 查询客户下所有网格ID
* @param customerId
* @param dateId
* @Description 查询客户下所有网格ID
* @author zxc
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllGridIdToParty(String customerId, String dateId);
/**
* @Description 查询客户下所有网格ID
* @Description 查询客户下所有网格ID
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 10:43 上午
*/
List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* @Description 查询org名称
* @param gridIds
* @Description 查询org名称
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgName(@Param("gridIds") List<String> gridIds);
/**
* @Description 查询机关的直属网格
* @param agencyIds
* @Description 查询机关的直属网格
* @author zxc
* @date 2020/9/24 2:33 下午
*/
List<GridInfoResultDTO> selectDirectGrid(@Param("agencyIds") List<String> agencyIds);
/**
* @Description 查询全部网格信息
* @param customerId
* @Description 查询全部网格信息
* @author zxc
* @date 2020/9/19 10:50 上午
*/
List<PartyAbilityGridMonthlyFormDTO> selectAllGridInfoToParty(String customerId);
/**
* @Description 查询全部网格信息
* @param customerId
* @Description 查询全部网格信息
* @author zxc
* @date 2020/9/18 10:47 上午
*/
List<GovernAbilityGridMonthlyFormDTO> selectAllGridInfo(@Param("customerId") String customerId);
/**
* @Description 查询客户下的网格信息
* @Description 查询客户下的网格信息
* @Param customerId
* @author zxc
* @date 2021/1/28 下午3:18
@ -196,11 +198,22 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询直属网格信息
* @Description 查询直属网格信息
* @Param customerId
* @Param level
* @author zxc
* @date 2021/3/23 下午4:03
*/
List<ScreenCustomerGridDTO> selectBelongGridInfo(@Param("customerId") String customerId,@Param("level") String level);
List<ScreenCustomerGridDTO> selectBelongGridInfo(@Param("customerId") String customerId, @Param("level") String level);
/**
* desc: 根据客户Id 和pids 获取该客户下及该组织下的网格列表
*
* @param customerId
* @param pids
* @return java.util.List<com.epmet.dto.screen.ScreenProjectGridDailyDTO>
* @author LiuJanJun
* @date 2021/6/10 10:45 上午
*/
List<ScreenProjectGridDailyDTO> selectGridInfoList(@Param("customerId") String customerId, @Param("pids") String pids);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java

@ -107,4 +107,6 @@ public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGri
Integer updateCenterPointByName(String customerId, String title, List<Double> center);
List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(String customerId);
List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -206,4 +206,9 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(String customerId) {
return baseDao.selectGridInfoByCustomerId(customerId);
}
@Override
public List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids) {
return baseDao.selectGridInfoList(customerId,pids);
}
}

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java

@ -15,6 +15,7 @@ import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.org.CustomerDepartmentService;
import com.epmet.service.org.CustomerGridService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -136,21 +137,23 @@ public class EIDimServiceImpl implements EIDimService {
@Override
public Map<String, Integer> updateCenterPointByName(GridCenterPointForm param) {
List<ScreenProjectGridDailyDTO> gridInfos = screenCustomerGridService.selectGridInfoByCustomerId(param.getCustomerId());
List<ScreenProjectGridDailyDTO> gridInfos = screenCustomerGridService.selectGridInfoList(param.getCustomerId(),param.getPids());
Map<String, Integer> result = new HashMap<>();
gridInfos.forEach(grid -> {
//客户id 和组织id 都相等 且 名字 包含关系时才修改
if (grid.getCustomerId().equals(param.getCustomerId())) {
AtomicInteger integer = new AtomicInteger(0);
param.getCenterDataList().forEach(o -> {
String title = o.getTitle().replace("委会","");
if (grid.getGridName().contains(title)) {
Integer effectRow = screenCustomerGridService.updateCenterPointByName(param.getCustomerId(), title, o.getCenter());
integer.addAndGet(effectRow);
}
result.put(grid.getGridId(), integer.intValue());
});
if ("[]".equals(grid.getCenterMark()) || StringUtils.isBlank(grid.getCenterMark())){
param.getCenterDataList().forEach(o -> {
String title = o.getTitle().replace("委会","");
if (grid.getGridName().startsWith(title)) {
Integer effectRow = screenCustomerGridService.updateCenterPointByName(param.getCustomerId(), title, o.getCenter());
integer.addAndGet(effectRow);
}
result.put(grid.getGridId(), integer.intValue());
});
}
}
});
return result;

14
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

@ -352,6 +352,7 @@
cg.GRID_NAME,
cg.PARENT_AGENCY_ID AS pid,
cg.AREA_CODE,
cg.CENTER_MARK,
ca.pids
FROM screen_customer_grid cg
LEFT JOIN screen_customer_agency ca ON ca.AGENCY_ID = cg.PARENT_AGENCY_ID
@ -371,5 +372,18 @@
AND scg.DEL_FLAG = 0
AND scg.CUSTOMER_ID = #{customerId}
</select>
<select id="selectGridInfoList" resultType="com.epmet.dto.screen.ScreenProjectGridDailyDTO">
SELECT
cg.CUSTOMER_ID,
cg.GRID_ID,
cg.GRID_NAME,
cg.PARENT_AGENCY_ID AS pid,
cg.AREA_CODE,
cg.CENTER_MARK
FROM screen_customer_grid cg
WHERE cg.DEL_FLAG = 0
AND cg.CUSTOMER_ID = #{customerId}
AND cg.ALL_PARENT_IDS like concat(#{pids},'%')
</select>
</mapper>

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -705,6 +705,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Override
public Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO) {
return new Result<CustomerGridDTO>().ok(baseDao.getGridBaseInfoById(customerGridFormDTO.getGridId()));
return new Result<CustomerGridDTO>().ok(ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class));
}
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/PatrolConstant.java

@ -0,0 +1,13 @@
package com.epmet.constant;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/8 15:28
*/
public interface PatrolConstant {
String PATROLLING = "patrolling";
String END = "end";
String NOT_END_MSG = "%s巡查尚未结束,请切换至%s查看。";
}

21
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolRecordDetailFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:23
*/
@NoArgsConstructor
@Data
public class PatrolRecordDetailFormDTO implements Serializable {
private static final long serialVersionUID = 7496587490046732883L;
/**
* 巡查记录id
*/
private String staffPatrolRecId;
}

21
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/9 16:31
*/
@Data
public class PatrolUploadDetailFormDTO implements Serializable {
private static final long serialVersionUID = 1527344810917196996L;
/**
* 巡查主记录id, 开始巡查反参
*/
private String staffPatrolRecId;
private List<PatrolUploadFormDTO> details;
}

55
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:05
*/
@NoArgsConstructor
@Data
public class PatrolUploadFormDTO implements Serializable {
private static final long serialVersionUID = 4665110896043941317L;
/**
* 巡查主记录id, 开始巡查反参
*/
private String staffPatrolRecId;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 速度
*/
private String speed;
/**
* 位置的精确度
*/
private String accuracy;
/**
* 高度单位m
*/
private String altitude;
/**
* 垂直经度单位m
*/
private String verticalAccuracy;
/**
* 水平经度单位m
*/
private String horizontalAccuracy;
/**
* 序号,前端生成后端记录
*/
private Integer serialNum;
}

19
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffPatrolInitFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:16
*/
@NoArgsConstructor
@Data
public class StaffPatrolInitFormDTO {
/**
* 当前工作人员基层治理所在网格id可为空
*/
private String gridId;
}

42
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:32
*/
@NoArgsConstructor
@Data
public class StartPatrolFormDTO implements Serializable {
private static final long serialVersionUID = -2765639550834711582L;
/**
* 网格id
*/
private String gridId;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 速度如果拿不到默认0
*/
private String speed;
/**
* 序号前端生成后端负责记录开始巡查赋值0
*/
private Integer serialNum;
private String staffPatrolRecId;
private String patrolEndTime;
}

39
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRecordDetailResultDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:24
*/
@NoArgsConstructor
@Data
public class PatrolRecordDetailResultDTO implements Serializable {
private static final long serialVersionUID = -1812674284508241468L;
/**
* 上传时间yyyy-MM-dd HH:mm
*/
private String uploadTime;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 速度单位m/s
*/
private String speed;
/**
* 后端返回开始巡查结束巡查此列只有集合第一条和最后一条有值
*/
private String flag;
}

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

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:14
*/
@Data
public class PatrolUploadResultDTO implements Serializable {
private static final long serialVersionUID = -1750373142795803118L;
/**
* 巡查主记录id
*/
private String staffPatrolRecId;
}

30
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffPatrolInitResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:17
*/
@NoArgsConstructor
@Data
public class StaffPatrolInitResultDTO implements Serializable {
private static final long serialVersionUID = -1752690564468072256L;
/**
* 存在正在巡查中记录返回patrolling不存在end
*/
private String status;
/**
* 巡查记录idstatus=patrolling时此列有值
*/
private String staffPatrolRecId;
/**
* patrolling返回最大的序号status=end时此列返回-1
*/
private Integer latestSerialNum;
}

26
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StartPatrolResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 16:34
*/
@NoArgsConstructor
@Data
public class StartPatrolResultDTO implements Serializable {
private static final long serialVersionUID = -8064467225255970920L;
/**
* 巡查记录id
*/
private String staffPatrolRecId;
/**
* 最小时间间隔单位s默认30后面可以做成客户可配置参数
*/
private Integer carmDown;
}

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

@ -1,21 +1,25 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
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.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.StaffPatrolDetailService;
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 javax.annotation.Resource;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/6/7 15:49
import java.util.List;
/**
@ -26,9 +30,81 @@ import java.util.List;
@RestController
@RequestMapping("staffpatrol")
public class StaffPatrolController {
@Resource
private StaffPatrolDetailService staffPatrolDetailService;
@Resource
private StaffPatrolRecordService staffPatrolRecordService;
/**
* 巡查界面初始化
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.StaffPatrolInitResultDTO>
* @author zhaoqifeng
* @date 2021/6/7 16:40
*/
@PostMapping("init")
public Result<StaffPatrolInitResultDTO> init(@LoginUser TokenDto tokenDto, @RequestBody StaffPatrolInitFormDTO formDTO) {
StaffPatrolInitResultDTO result = staffPatrolRecordService.init(tokenDto, formDTO);
return new Result<StaffPatrolInitResultDTO>().ok(result);
}
/**
* 开始巡查
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.StartPatrolResultDTO>
* @author zhaoqifeng
* @date 2021/6/7 16:46
*/
@PostMapping("startpatrol")
public Result<StartPatrolResultDTO> startPatrol(@LoginUser TokenDto tokenDto, @RequestBody StartPatrolFormDTO formDTO) {
StartPatrolResultDTO result = staffPatrolRecordService.startPatrol(tokenDto, formDTO);
return new Result<StartPatrolResultDTO>().ok(result);
}
/**
* 结束巡查
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/6/7 16:46
*/
@PostMapping("endpatrol")
public Result endPatrol(@LoginUser TokenDto tokenDto, @RequestBody StartPatrolFormDTO formDTO) {
staffPatrolRecordService.endPatrol(tokenDto, formDTO);
return new Result();
}
/**
* 上传巡查记录
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.PatrolUploadResultDTO>
* @author zhaoqifeng
* @date 2021/6/7 16:46
*/
@PostMapping("uploaddetail")
public Result<PatrolUploadResultDTO> uploadDetail(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadFormDTO formDTO) {
PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetail(tokenDto, formDTO);
return new Result<PatrolUploadResultDTO>().ok(result);
}
@PostMapping("uploaddetails")
public Result<PatrolUploadResultDTO> uploadDetails(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadDetailFormDTO formDTO) {
PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetails(tokenDto, formDTO);
return new Result<PatrolUploadResultDTO>().ok(result);
@Autowired
private StaffPatrolRecordService staffPatrolRecordService;
}
/**
* @Description 查询经纬度

21
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolDetailService.java

@ -18,8 +18,11 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.StaffPatrolDetailDTO;
import com.epmet.entity.StaffPatrolDetailEntity;
import java.util.List;
/**
* 工作人员巡查记录明细
*
@ -28,5 +31,23 @@ import com.epmet.entity.StaffPatrolDetailEntity;
*/
public interface StaffPatrolDetailService extends BaseService<StaffPatrolDetailEntity> {
/**
* 获取最后一次记录明细
* @author zhaoqifeng
* @date 2021/6/8 15:13
* @param staffPatrolRecId
* @return com.epmet.dto.StaffPatrolDetailDTO
*/
StaffPatrolDetailDTO getLastDetail(String staffPatrolRecId);
/**
* 获取所以记录明细
* @author zhaoqifeng
* @date 2021/6/8 15:13
* @param staffPatrolRecId
* @return java.util.List<com.epmet.dto.StaffPatrolDetailDTO>
*/
List<StaffPatrolDetailDTO> getDetailList(String staffPatrolRecId);
}

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

@ -18,8 +18,11 @@
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.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.*;
import com.epmet.dto.result.PatrolUploadResultDTO;
import com.epmet.dto.result.StaffPatrolInitResultDTO;
import com.epmet.dto.result.StartPatrolResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import com.epmet.dto.result.UserNameAndLLResultDTO;
@ -36,6 +39,60 @@ import java.util.List;
*/
public interface StaffPatrolRecordService extends BaseService<StaffPatrolRecordEntity> {
/**
* 巡查界面初始化
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.StaffPatrolInitResultDTO
* @author zhaoqifeng
* @date 2021/6/7 16:47
*/
StaffPatrolInitResultDTO init(TokenDto tokenDto, StaffPatrolInitFormDTO formDTO);
/**
* 开始巡查
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.StartPatrolResultDTO
* @author zhaoqifeng
* @date 2021/6/7 16:49
*/
StartPatrolResultDTO startPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO);
/**
* 结束巡查
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/6/7 16:49
*/
void endPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO);
/**
* 上传巡查记录
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.PatrolUploadResultDTO
* @author zhaoqifeng
* @date 2021/6/7 16:49
*/
PatrolUploadResultDTO uploadDetail(TokenDto tokenDto, PatrolUploadFormDTO formDTO);
/**
* 上传巡查记录
* @author zhaoqifeng
* @date 2021/6/9 16:32
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.PatrolUploadResultDTO
*/
PatrolUploadResultDTO uploadDetails(TokenDto tokenDto, PatrolUploadDetailFormDTO formDTO);
/**
* @Description 查询经纬度
* @Param userIds

38
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolDetailServiceImpl.java

@ -17,12 +17,17 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.StaffPatrolDetailDao;
import com.epmet.dto.StaffPatrolDetailDTO;
import com.epmet.entity.StaffPatrolDetailEntity;
import com.epmet.service.StaffPatrolDetailService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 工作人员巡查记录明细
*
@ -33,5 +38,38 @@ import org.springframework.stereotype.Service;
public class StaffPatrolDetailServiceImpl extends BaseServiceImpl<StaffPatrolDetailDao, StaffPatrolDetailEntity> implements StaffPatrolDetailService {
/**
* 获取最后一次记录明细
*
* @param staffPatrolRecId
* @return com.epmet.dto.StaffPatrolDetailDTO
* @author zhaoqifeng
* @date 2021/6/8 15:13
*/
@Override
public StaffPatrolDetailDTO getLastDetail(String staffPatrolRecId) {
QueryWrapper<StaffPatrolDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("STAFF_PATROL_REC_ID", staffPatrolRecId);
wrapper.orderByDesc("SERIAL_NUM");
wrapper.last("limit 1");
StaffPatrolDetailEntity entity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(entity, StaffPatrolDetailDTO.class);
}
/**
* 获取所以记录明细
*
* @param staffPatrolRecId
* @return java.util.List<com.epmet.dto.StaffPatrolDetailDTO>
* @author zhaoqifeng
* @date 2021/6/8 15:13
*/
@Override
public List<StaffPatrolDetailDTO> getDetailList(String staffPatrolRecId) {
QueryWrapper<StaffPatrolDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("STAFF_PATROL_REC_ID", staffPatrolRecId);
wrapper.orderByDesc("SERIAL_NUM");
List<StaffPatrolDetailEntity> entity = baseDao.selectList(wrapper);
return ConvertUtils.sourceToTarget(entity, StaffPatrolDetailDTO.class);
}
}

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

@ -1,21 +1,39 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.PatrolConstant;
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.CustomerGridDTO;
import com.epmet.dto.StaffPatrolDetailDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.StaffPatrolDetailEntity;
import com.epmet.entity.StaffPatrolRecordEntity;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.StaffPatrolDetailService;
import com.epmet.service.StaffPatrolRecordService;
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 org.springframework.transaction.annotation.Transactional;
import org.apache.commons.collections4.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 工作人员巡查主记录
@ -24,41 +42,246 @@ import java.util.List;
* @since v1.0.0 2021-06-07
*/
@Service
@Slf4j
public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRecordDao, StaffPatrolRecordEntity> implements StaffPatrolRecordService {
@Autowired
private CustomerStaffDao customerStaffDao;
@Resource
private StaffPatrolDetailService staffPatrolDetailService;
@Resource
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private CustomerStaffDao customerStaffDao;
@Autowired
private StaffPatrolRecordDao staffPatrolRecordDao;
@Autowired
private StaffPatrolRecordDao staffPatrolRecordDao;
@Autowired
private StaffPatrolDetailDao staffPatrolDetailDao;
@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;
}
/**
* 巡查界面初始化
*
* @param tokenDto token
* @param formDTO 入参
* @return com.epmet.dto.result.StaffPatrolInitResultDTO
* @author zhaoqifeng
* @date 2021/6/7 16:47
*/
@Override
public StaffPatrolInitResultDTO init(TokenDto tokenDto, StaffPatrolInitFormDTO formDTO) {
StaffPatrolInitResultDTO result = new StaffPatrolInitResultDTO();
QueryWrapper<StaffPatrolRecordEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(formDTO.getGridId()), "GRID", formDTO.getGridId())
.eq("STAFF_ID", tokenDto.getUserId())
.orderByDesc("PATROL_START_TIME")
.last("limit 1");
StaffPatrolRecordEntity entity = baseDao.selectOne(wrapper);
if (null == entity) {
result.setLatestSerialNum(NumConstant.ONE_NEG);
result.setStatus(PatrolConstant.END);
result.setStaffPatrolRecId(StrConstant.EPMETY_STR);
return result;
}
StaffPatrolDetailDTO detail = staffPatrolDetailService.getLastDetail(entity.getId());
result.setStaffPatrolRecId(entity.getId());
result.setStatus(entity.getStatus());
result.setLatestSerialNum(PatrolConstant.END.equals(entity.getStatus()) ? NumConstant.ONE_NEG : detail.getSerialNum());
return result;
}
/**
* 开始巡查
*
* @param tokenDto token
* @param formDTO 入参
* @return com.epmet.dto.result.StartPatrolResultDTO
* @author zhaoqifeng
* @date 2021/6/7 16:49
*/
@Override
@Transactional(rollbackFor = Exception.class)
public StartPatrolResultDTO startPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO) {
//获取最新的巡查记录
QueryWrapper<StaffPatrolRecordEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(formDTO.getGridId()), "GRID", formDTO.getGridId())
.eq("STAFF_ID", tokenDto.getUserId())
.orderByDesc("PATROL_START_TIME")
.last("limit 1");
StaffPatrolRecordEntity entity = baseDao.selectOne(wrapper);
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(formDTO.getGridId());
Result<CustomerGridDTO> gridResult = govOrgFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success() || null == gridResult.getData()) {
//查询网格名称失败
log.error(String.format("查找网格信息失败,网格Id:【%s】", formDTO.getGridId()));
throw new RenException(gridResult.getCode(), gridResult.getMsg());
}
CustomerGridDTO grid = gridResult.getData();
//判断巡查是否结束,如果未结束,返回消息提示
if (null != entity && PatrolConstant.PATROLLING.equals(entity.getStatus())) {
throw new RenException(EpmetErrorCode.PATROL_IS_NOT_OVER.getCode(), String.format(PatrolConstant.NOT_END_MSG, grid.getGridName(),
grid.getGridName()));
}
//创建巡查记录
StaffPatrolRecordEntity record = new StaffPatrolRecordEntity();
record.setCustomerId(grid.getCustomerId());
record.setAgencyId(grid.getPid());
record.setGridPids(grid.getPids());
record.setGrid(formDTO.getGridId());
record.setStaffId(tokenDto.getUserId());
record.setPatrolStartTime(new Date());
record.setStatus(PatrolConstant.PATROLLING);
insert(record);
//保存记录明细
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity();
detailEntity.setStaffPatrolRecId(record.getId());
detailEntity.setCustomerId(grid.getCustomerId());
detailEntity.setSerialNum(formDTO.getSerialNum());
detailEntity.setUploadTime(new Date());
detailEntity.setLatitude(formDTO.getLatitude());
detailEntity.setLongitude(formDTO.getLongitude());
detailEntity.setSpeed(formDTO.getSpeed());
staffPatrolDetailService.insert(detailEntity);
StartPatrolResultDTO result = new StartPatrolResultDTO();
result.setStaffPatrolRecId(record.getId());
result.setCarmDown(NumConstant.THIRTY);
return result;
}
/**
* 结束巡查
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/6/7 16:49
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void endPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO) {
StaffPatrolRecordEntity record = baseDao.selectById(formDTO.getStaffPatrolRecId());
if (null == record) {
throw new RenException("巡查记录不存在");
}
if (PatrolConstant.END.equals(record.getStatus())) {
throw new RenException("巡查已结束,请勿重复提交");
}
record.setActrualEndTime(new Date());
record.setUpdatedTime(null);
record.setPatrolEndTime(DateUtils.parse(formDTO.getPatrolEndTime(), DateUtils.DATE_TIME_PATTERN));
record.setTotalTime(DateUtils.calculateSecond(record.getPatrolStartTime(), record.getPatrolEndTime()));
record.setStatus(PatrolConstant.END);
baseDao.updateById(record);
//保存记录明细
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity();
detailEntity.setStaffPatrolRecId(record.getId());
detailEntity.setCustomerId(record.getCustomerId());
detailEntity.setSerialNum(formDTO.getSerialNum());
detailEntity.setUploadTime(new Date());
detailEntity.setLatitude(formDTO.getLatitude());
detailEntity.setLongitude(formDTO.getLongitude());
detailEntity.setSpeed(formDTO.getSpeed());
staffPatrolDetailService.insert(detailEntity);
}
/**
* 上传巡查记录
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.PatrolUploadResultDTO
* @author zhaoqifeng
* @date 2021/6/7 16:49
*/
@Override
@Transactional(rollbackFor = Exception.class)
public PatrolUploadResultDTO uploadDetail(TokenDto tokenDto, PatrolUploadFormDTO formDTO) {
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity();
detailEntity.setStaffPatrolRecId(formDTO.getStaffPatrolRecId());
detailEntity.setCustomerId(tokenDto.getCustomerId());
detailEntity.setSerialNum(formDTO.getSerialNum());
detailEntity.setUploadTime(new Date());
detailEntity.setLatitude(formDTO.getLatitude());
detailEntity.setLongitude(formDTO.getLongitude());
detailEntity.setSpeed(formDTO.getSpeed());
detailEntity.setAccuracy(formDTO.getAccuracy());
detailEntity.setAltitude(formDTO.getAltitude());
detailEntity.setVerticalaccuracy(formDTO.getVerticalAccuracy());
detailEntity.setHorizontalaccuracy(formDTO.getHorizontalAccuracy());
staffPatrolDetailService.insert(detailEntity);
PatrolUploadResultDTO dto = new PatrolUploadResultDTO();
dto.setStaffPatrolRecId(formDTO.getStaffPatrolRecId());
return dto;
}
/**
* 上传巡查记录
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.PatrolUploadResultDTO
* @author zhaoqifeng
* @date 2021/6/9 16:32
*/
@Override
public PatrolUploadResultDTO uploadDetails(TokenDto tokenDto, PatrolUploadDetailFormDTO formDTO) {
if (CollectionUtils.isNotEmpty(formDTO.getDetails())) {
List<StaffPatrolDetailEntity> list = formDTO.getDetails().stream().map(detail -> {
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity();
detailEntity.setStaffPatrolRecId(formDTO.getStaffPatrolRecId());
detailEntity.setCustomerId(tokenDto.getCustomerId());
detailEntity.setSerialNum(detail.getSerialNum());
detailEntity.setUploadTime(new Date());
detailEntity.setLatitude(detail.getLatitude());
detailEntity.setLongitude(detail.getLongitude());
detailEntity.setSpeed(detail.getSpeed());
detailEntity.setAccuracy(detail.getAccuracy());
detailEntity.setAltitude(detail.getAltitude());
detailEntity.setVerticalaccuracy(detail.getVerticalAccuracy());
detailEntity.setHorizontalaccuracy(detail.getHorizontalAccuracy());
return detailEntity;
}).collect(Collectors.toList());
staffPatrolDetailService.insertBatch(list);
}
PatrolUploadResultDTO dto = new PatrolUploadResultDTO();
dto.setStaffPatrolRecId(formDTO.getStaffPatrolRecId());
return dto;
}
/**
* @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查看巡查记录

46
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.12__add_user_patrol.sql

@ -0,0 +1,46 @@
CREATE TABLE `staff_patrol_detail` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id',
`STAFF_PATROL_REC_ID` varchar(64) NOT NULL COMMENT 'staff_patrol_record.ID',
`SERIAL_NUM` int(11) NOT NULL COMMENT '前端给的序号',
`UPLOAD_TIME` datetime NOT NULL COMMENT '上传时间,后台自动插入该时间',
`LATITUDE` varchar(64) NOT NULL COMMENT '纬度',
`LONGITUDE` varchar(64) NOT NULL COMMENT '经度',
`SPEED` varchar(64) NOT NULL DEFAULT '0' COMMENT '速度,单位m/s;开始和结束时默认0',
`ACCURACY` varchar(64) DEFAULT NULL COMMENT '位置的精确度',
`ALTITUDE` varchar(64) DEFAULT NULL COMMENT '高度,单位米',
`VERTICALACCURACY` varchar(64) DEFAULT NULL COMMENT '垂直经度,单位m',
`HORIZONTALACCURACY` varchar(64) DEFAULT NULL COMMENT '水平经度,单位m',
`ADDRESS` varchar(255) DEFAULT NULL COMMENT '地址;暂时不用',
`DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作人员巡查记录明细';
-- ----------------------------
-- Table structure for staff_patrol_record
-- ----------------------------
CREATE TABLE `staff_patrol_record` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id',
`GRID` varchar(64) NOT NULL COMMENT '网格id',
`GRID_PIDS` varchar(512) NOT NULL COMMENT '网格所有上级id',
`STAFF_ID` varchar(64) NOT NULL COMMENT '工作人员用户id',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '工作人员所属组织id=网格所属的组织id',
`PATROL_START_TIME` datetime NOT NULL COMMENT '巡查开始时间',
`PATROL_END_TIME` datetime DEFAULT NULL COMMENT '巡查结束时间,前端传入',
`ACTRUAL_END_TIME` datetime DEFAULT NULL COMMENT '实际结束时间=操作结束巡查的时间',
`TOTAL_TIME` int(11) DEFAULT NULL COMMENT '本次巡查总耗时,单位秒;结束巡查时写入',
`STATUS` varchar(10) NOT NULL DEFAULT 'patrolling' COMMENT '正在巡查中:patrolling;结束:end',
`DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作人员巡查主记录';
Loading…
Cancel
Save