Browse Source

灵山项目:增加通过staffID获取事件

master
luyan 2 years ago
parent
commit
20db6168ab
  1. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java
  2. 17
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java
  3. 1
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java
  4. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventRsultCountDTO.java
  5. 29
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  6. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java
  7. 3
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  8. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  9. 20
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml
  10. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

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

@ -20,6 +20,11 @@ public class GridManagerListResultDTO implements Serializable {
*/ */
private String staffId; private String staffId;
private Integer gender;
private Integer age;
private String headPhoto;
/** /**
* 工作人员手机号 * 工作人员手机号
*/ */

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

@ -1,14 +1,18 @@
package com.epmet.datareport.service.user.impl; package com.epmet.datareport.service.user.impl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.constant.PatrolConstant; import com.epmet.datareport.constant.PatrolConstant;
import com.epmet.datareport.dao.user.StaffPatrolDetailDao; import com.epmet.datareport.dao.user.StaffPatrolDetailDao;
import com.epmet.datareport.dao.user.StaffPatrolRecordDao; import com.epmet.datareport.dao.user.StaffPatrolRecordDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService; import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService;
import com.epmet.datareport.service.user.StaffPatrolDetailService; import com.epmet.datareport.service.user.StaffPatrolDetailService;
import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.PatrolCountFormDTO; import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO; import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO; import com.epmet.dto.form.RecordListFormDTO;
@ -76,7 +80,7 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
if (CollectionUtils.isEmpty(grids)) { if (CollectionUtils.isEmpty(grids)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<String> gridIds = grids.stream().map(m -> m.getGridId()).collect(Collectors.toList()); List<String> gridIds = grids.stream().map(GridManagerListResultDTO::getGridId).collect(Collectors.toList());
// 查询网格下的网格员 // 查询网格下的网格员
Result<List<GridStaffResultDTO>> resultData = govOrgOpenFeignClient.selectGridStaffByGridIds(gridIds); Result<List<GridStaffResultDTO>> resultData = govOrgOpenFeignClient.selectGridStaffByGridIds(gridIds);
if (!resultData.success()) { if (!resultData.success()) {
@ -87,8 +91,17 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
return new ArrayList<>(); return new ArrayList<>();
} }
List<GridManagerListResultDTO> result = ConvertUtils.sourceToTarget(data, GridManagerListResultDTO.class); List<GridManagerListResultDTO> result = ConvertUtils.sourceToTarget(data, GridManagerListResultDTO.class);
result.forEach(staff -> {//获取头像
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), staff.getStaffId());
if (null != staffInfo) {
staff.setHeadPhoto(staffInfo.getHeadPhoto());
}
});
//统计事件
List<IcEventDTO> events = null;
// 查询经纬度 // 查询经纬度
Result<UserNameAndLLResultDTO> selectll = epmetUserOpenFeignClient.selectll(result.stream().map(m -> m.getStaffId()).collect(Collectors.toList())); Result<UserNameAndLLResultDTO> selectll = epmetUserOpenFeignClient.selectll(result.stream().map(GridManagerListResultDTO::getStaffId).collect(Collectors.toList()));
if (!selectll.success()) { if (!selectll.success()) {
throw new RenException("查询经纬度和姓名失败【" + selectll.getMsg() + "】"); throw new RenException("查询经纬度和姓名失败【" + selectll.getMsg() + "】");
} }

1
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java

@ -9,6 +9,7 @@ public class IcEventResultDTO {
private String gridId; private String gridId;
private String sourceType; private String sourceType;
private String eventType; private String eventType;
private int repayStatus;
private String manageStatus; private String manageStatus;
private String categoryCode; private String categoryCode;
private String latitude; private String latitude;

35
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventRsultCountDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.result;
import lombok.Data;
import java.util.List;
/**
* @author yan Lu
* @description 描述
* @create 2023/6/2 16:10
*/
@Data
public class IcEventRsultCountDTO {
/**
* 总量
*/
private Integer eventTotal;
/**
* 已完成
*/
private Integer completeTotal;
/**
* 未完成
*/
private Integer unCompleteTotal;
/**
* 事件列表
*/
private List<IcEventResultDTO> eventList;
}

29
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java

@ -40,9 +40,11 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 事件管理表 * 事件管理表
@ -640,7 +642,7 @@ public class IcEventController {
* @param orgId * @param orgId
* @param orgType * @param orgType
* @param sourceType 事件来源 * @param sourceType 事件来源
* @param eventType 响应几杯 * @param eventType 响应级别
* @return * @return
*/ */
@GetMapping("getListBySourceTypeOrEventType") @GetMapping("getListBySourceTypeOrEventType")
@ -671,5 +673,28 @@ public class IcEventController {
return new Result<List<IcEventResultDTO>>().ok(icEventService.getListByStatus(orgId, orgType, eventType, sourceType, status, categoryCode)); return new Result<List<IcEventResultDTO>>().ok(icEventService.getListByStatus(orgId, orgType, eventType, sourceType, status, categoryCode));
} }
/**
* @description 根据网格员ID获取统计事件处理情况和事件列表
* @author yan Lu
* @date 2023/6/2 16:13
*/
@GetMapping("getEventsByStaffId")
public Result<IcEventRsultCountDTO> getEventsByStaffId(@RequestParam("staffId") String staffId, @RequestParam("status") String status) {
IcEventRsultCountDTO data = new IcEventRsultCountDTO();
List<IcEventResultDTO> eventList = icEventService.getEventsByStaffId(staffId, status);
if (null != eventList && eventList.size() > 0) {
data.setEventTotal(eventList.size());
Long complateTotal = eventList.stream().filter(e -> e.getRepayStatus() >= 2).collect(Collectors.counting());
Long unComplateTotal = eventList.stream().filter(e -> e.getRepayStatus() < 2).collect(Collectors.counting());
data.setCompleteTotal(Math.toIntExact(complateTotal));
data.setUnCompleteTotal(Math.toIntExact(unComplateTotal));
data.setEventList(eventList);
} else {
data.setEventList(new ArrayList<>());
data.setEventTotal(0);
data.setCompleteTotal(0);
data.setUnCompleteTotal(0);
}
return new Result<IcEventRsultCountDTO>().ok(data);
}
} }

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java

@ -219,4 +219,6 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
@Param("sourceType") String sourceType, @Param("eventType") String eventType); @Param("sourceType") String sourceType, @Param("eventType") String eventType);
GridOrVillageEventRateResultDTO getEventRateByGridIds(@Param("orgId") String orgId, @Param("orgType") String orgType); GridOrVillageEventRateResultDTO getEventRateByGridIds(@Param("orgId") String orgId, @Param("orgType") String orgType);
List<IcEventResultDTO> getEventsByStaffId(@Param("staffId") String staffId, @Param("replyStatus") String status);
} }

3
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java

@ -278,6 +278,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 根据事件处理状态查询列表 * 根据事件处理状态查询列表
*
* @param sourceType 事件来源 * @param sourceType 事件来源
* @param status 事件处理状态 * @param status 事件处理状态
* @return * @return
@ -285,4 +286,6 @@ public interface IcEventService extends BaseService<IcEventEntity> {
List<IcEventResultDTO> getListByStatus(String orgId, String orgType, String eventType, String sourceType, String status, String categoryCode); List<IcEventResultDTO> getListByStatus(String orgId, String orgType, String eventType, String sourceType, String status, String categoryCode);
List<IcEventResultDTO> getListBySourceTypeOrEventType(String orgId, String orgType, String sourceType, String eventType); List<IcEventResultDTO> getListBySourceTypeOrEventType(String orgId, String orgType, String sourceType, String eventType);
List<IcEventResultDTO> getEventsByStaffId(String staffId, String status);
} }

5
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -2070,6 +2070,11 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
return baseDao.getListBySourceTypeOrEventType(getOrgPath(orgId, orgType), sourceType, eventType); return baseDao.getListBySourceTypeOrEventType(getOrgPath(orgId, orgType), sourceType, eventType);
} }
@Override
public List<IcEventResultDTO> getEventsByStaffId(String staffId,String status) {
return baseDao.getEventsByStaffId(staffId,status);
}
/** /**
* @deprecationg 获取orgPath * @deprecationg 获取orgPath
*/ */

20
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

@ -606,6 +606,7 @@
e.GRID_ID AS gridId, e.GRID_ID AS gridId,
e.SOURCE_TYPE AS sourceType, e.SOURCE_TYPE AS sourceType,
e.EVENT_TYPE AS eventType, e.EVENT_TYPE AS eventType,
e.REPLY_STATUS AS repayStatus,
e.LATITUDE, e.LATITUDE,
e.LONGITUDE, e.LONGITUDE,
e.EVENT_CONTENT AS eventContent, e.EVENT_CONTENT AS eventContent,
@ -681,4 +682,23 @@
</where> </where>
</select> </select>
<select id="getEventsByStaffId" resultType="com.epmet.dto.result.IcEventResultDTO">
SELECT
<include refid="eventArguments"/>
FROM ic_event e
LEFT JOIN ic_event_reply r ON r.IC_EVENT_ID = e.ID AND r.FROM_USER_ID = #{staffId}
LEFT JOIN ic_event_category c ON c.IC_EVENT_ID = e.ID
<where>
e.DEL_FLAG = 0
<if test="replyStatus == '0'">
AND (e.REPLY_STATUS = 0 OR e.REPLY_STATUS = 1 OR e.REPLY_STATUS IS NULL)
</if>
<if test="replyStatus == '1'">
AND (e.REPLY_STATUS = 2 OR e.REPLY_STATUS = 3 OR e.REPLY_STATUS = 4 OR e.REPLY_STATUS = 5)
</if>
</where>
GROUP BY e.ID,c.ic_event_id,r.ic_event_id
ORDER BY r.MANAGE_TIME DESC,e.CREATED_TIME DESC
</select>
</mapper> </mapper>

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

@ -53,8 +53,10 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
@Autowired @Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
/** /**
* 查询具有某角色的staff列表 * 查询具有某角色的staff列表
*
* @param roleKey * @param roleKey
* @param orgId * @param orgId
* @return * @return
@ -71,9 +73,9 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
} }
/** /**
* @return Result<StaffRolesResultDTO>
* @Description 得到某一个员工在一个客户下的所有角色 * @Description 得到某一个员工在一个客户下的所有角色
* @Param CommonUserFormDTO :: getUserId :: getCustomerId * @Param CommonUserFormDTO :: getUserId :: getCustomerId
* @return Result<StaffRolesResultDTO>
* @Author wangc * @Author wangc
* @Date 2020.04.26 10:59 * @Date 2020.04.26 10:59
**/ **/
@ -83,9 +85,9 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
} }
/** /**
* @Description 查找具有特定角色的人员Id(可用)
* @param rolesUsersListFormDTO * @param rolesUsersListFormDTO
* @return Result<String> * @return Result<String>
* @Description 查找具有特定角色的人员Id(可用)
* @author wangc * @author wangc
* @date 2020.04.29 23:44 * @date 2020.04.29 23:44
**/ **/
@ -136,7 +138,8 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
if (CollectionUtils.isEmpty(forms)) { if (CollectionUtils.isEmpty(forms)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<String> userIds = forms.stream().map(m -> m.getStaffId()).distinct().collect(Collectors.toList()); //不用为什么要下面这一句?
// List<String> userIds = forms.stream().map(m -> m.getStaffId()).distinct().collect(Collectors.toList());
// List<GridStaffResultDTO> result = baseDao.staffGridRoleByIds(userIds); // List<GridStaffResultDTO> result = baseDao.staffGridRoleByIds(userIds);
List<GridStaffResultDTO> result = baseDao.staffGridRole(forms); List<GridStaffResultDTO> result = baseDao.staffGridRole(forms);
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
@ -206,6 +209,7 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
/** /**
* Desc: 查询是否是超级管理员 * Desc: 查询是否是超级管理员
*
* @param userId * @param userId
* @author zxc * @author zxc
* @date 2022/7/13 11:03 * @date 2022/7/13 11:03

Loading…
Cancel
Save