|
|
@ -3,15 +3,16 @@ package com.epmet.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; |
|
|
|
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.ErrorCode; |
|
|
|
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.constant.SystemMessageType; |
|
|
|
import com.epmet.dao.CustomerStaffDao; |
|
|
|
import com.epmet.dao.StaffPatrolDetailDao; |
|
|
|
import com.epmet.dao.StaffPatrolRecordDao; |
|
|
@ -23,9 +24,10 @@ import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.StaffPatrolDetailEntity; |
|
|
|
import com.epmet.entity.StaffPatrolRecordEntity; |
|
|
|
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; |
|
|
|
import com.epmet.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.feign.GovProjectOpenFeignClient; |
|
|
|
import com.epmet.send.SendMqMsgUtil; |
|
|
|
import com.epmet.service.StaffPatrolDetailService; |
|
|
|
import com.epmet.service.StaffPatrolRecordService; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
@ -40,7 +42,6 @@ import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -55,25 +56,20 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
|
|
|
|
|
@Resource |
|
|
|
private StaffPatrolDetailService staffPatrolDetailService; |
|
|
|
@Resource |
|
|
|
private GovOrgFeignClient govOrgFeignClient; |
|
|
|
// 这是是来自org-client的,以后都用这个就好了
|
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private CustomerStaffDao customerStaffDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private StaffPatrolRecordDao staffPatrolRecordDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private StaffPatrolDetailDao staffPatrolDetailDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private StatsStaffPatrolRecordDailyDao statsStaffPatrolRecordDailyDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovProjectOpenFeignClient govProjectOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -187,6 +183,9 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
|
result.setCarmDown(NumConstant.THIRTY); |
|
|
|
// 添加巡查统计表逻辑
|
|
|
|
statsPatrolUpdateStart(tokenDto.getUserId(),patrolStartTime,grid); |
|
|
|
|
|
|
|
//发送巡查消息
|
|
|
|
sendPatrolMsg(record, SystemMessageType.USER_PATROL_START); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -278,6 +277,21 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
|
staffPatrolDetailService.insert(detailEntity); |
|
|
|
// 添加巡查统计表逻辑
|
|
|
|
statsPatrolUpdateEnd(tokenDto.getUserId(),totalTime,record.getPatrolStartTime(),patrolEndTime,record.getGrid()); |
|
|
|
sendPatrolMsg(record, SystemMessageType.USER_PATROL_STOP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void sendPatrolMsg(StaffPatrolRecordEntity record, String userPatrolStop) { |
|
|
|
//发送巡查消息
|
|
|
|
StaffPatrolMQMsg staffPatrolMQMsg = new StaffPatrolMQMsg(); |
|
|
|
staffPatrolMQMsg.setCustomerId(record.getCustomerId()); |
|
|
|
staffPatrolMQMsg.setPatrolId(record.getId()); |
|
|
|
staffPatrolMQMsg.setActionType(userPatrolStop); |
|
|
|
|
|
|
|
boolean b = SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendPatrolMqMsg(staffPatrolMQMsg); |
|
|
|
if (b) { |
|
|
|
log.error( "发送{}巡查消息到mq失败,patrolId:{}", userPatrolStop, record.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -310,6 +324,8 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
|
|
|
|
|
updateBatchById(list); |
|
|
|
} |
|
|
|
list.forEach(e->sendPatrolMsg(e, SystemMessageType.USER_PATROL_STOP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|