Browse Source

是否手动结束巡查添加

master
zxc 4 years ago
parent
commit
e7d56433e5
  1. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java
  2. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.java
  3. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java
  4. 1
      epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml

3
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java

@ -62,7 +62,8 @@ public interface StatsStaffPatrolRecordDailyDao extends BaseDao<StatsStaffPatrol
* @date 2021/7/1 10:36 上午 * @date 2021/7/1 10:36 上午
*/ */
void updateStatsRecordEnd(@Param("userId")String userId,@Param("totalTime") Integer totalTime, void updateStatsRecordEnd(@Param("userId")String userId,@Param("totalTime") Integer totalTime,
@Param("projectCount")Integer projectCount,@Param("dateId")String dateId,@Param("gridId")String gridId); @Param("projectCount")Integer projectCount,@Param("dateId")String dateId,
@Param("gridId")String gridId, @Param("isHandEnd")Integer isHandEnd);
/** /**
* @Description 查询巡查人数 * @Description 查询巡查人数

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.java

@ -88,4 +88,9 @@ public class StaffPatrolRecordEntity extends BaseEpmetEntity {
*/ */
private String status; private String status;
/**
* 是否手动结束 手动:1定时任务传参:0
*/
private Integer isHandEnd;
} }

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

@ -264,6 +264,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
Integer totalTime = DateUtils.calculateSecond(record.getPatrolStartTime(), record.getPatrolEndTime()) + 59; Integer totalTime = DateUtils.calculateSecond(record.getPatrolStartTime(), record.getPatrolEndTime()) + 59;
record.setTotalTime(totalTime); record.setTotalTime(totalTime);
record.setStatus(PatrolConstant.END); record.setStatus(PatrolConstant.END);
record.setIsHandEnd(NumConstant.ONE);
baseDao.updateById(record); baseDao.updateById(record);
//保存记录明细 //保存记录明细
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity(); StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity();
@ -276,7 +277,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
detailEntity.setSpeed(formDTO.getSpeed()); detailEntity.setSpeed(formDTO.getSpeed());
staffPatrolDetailService.insert(detailEntity); staffPatrolDetailService.insert(detailEntity);
// 添加巡查统计表逻辑 // 添加巡查统计表逻辑
statsPatrolUpdateEnd(tokenDto.getUserId(),totalTime,record.getPatrolStartTime(),patrolEndTime,record.getGrid()); statsPatrolUpdateEnd(tokenDto.getUserId(),totalTime,record.getPatrolStartTime(),patrolEndTime,record.getGrid(),NumConstant.ONE);
sendPatrolMsg(record, SystemMessageType.USER_PATROL_STOP); sendPatrolMsg(record, SystemMessageType.USER_PATROL_STOP);
} }
@ -318,7 +319,8 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
Integer totalTime = DateUtils.calculateSecond(item.getPatrolStartTime(), endTime) + 59; Integer totalTime = DateUtils.calculateSecond(item.getPatrolStartTime(), endTime) + 59;
item.setTotalTime(totalTime); item.setTotalTime(totalTime);
item.setUpdatedTime(null); item.setUpdatedTime(null);
statsPatrolUpdateEnd(item.getStaffId(),totalTime, item.getPatrolStartTime(), endTime, item.getGrid()); item.setIsHandEnd(NumConstant.ZERO);
statsPatrolUpdateEnd(item.getStaffId(),totalTime, item.getPatrolStartTime(), endTime, item.getGrid(), NumConstant.ZERO);
}); });
updateBatchById(list); updateBatchById(list);
@ -333,11 +335,12 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
* @Param totalTime * @Param totalTime
* @Param patrolStartTime * @Param patrolStartTime
* @Param patrolEndTime * @Param patrolEndTime
* @Param isHandEnd
* @author zxc * @author zxc
* @date 2021/7/1 10:50 上午 * @date 2021/7/1 10:50 上午
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void statsPatrolUpdateEnd(String userId, Integer totalTime, Date patrolStartTime, Date patrolEndTime,String gridId){ public void statsPatrolUpdateEnd(String userId, Integer totalTime, Date patrolStartTime, Date patrolEndTime,String gridId, Integer isHandEnd){
String dateId = DateUtils.getBeforeNDay(NumConstant.ZERO); String dateId = DateUtils.getBeforeNDay(NumConstant.ZERO);
PatrolProjectFormDTO formDTO = new PatrolProjectFormDTO(); PatrolProjectFormDTO formDTO = new PatrolProjectFormDTO();
formDTO.setUserId(userId); formDTO.setUserId(userId);
@ -348,7 +351,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
throw new RenException("查询巡查期间立项数失败【"+patrolProject.getInternalMsg()+"】"); throw new RenException("查询巡查期间立项数失败【"+patrolProject.getInternalMsg()+"】");
} }
Integer data = patrolProject.getData(); Integer data = patrolProject.getData();
statsStaffPatrolRecordDailyDao.updateStatsRecordEnd(userId,totalTime,data,dateId,gridId); statsStaffPatrolRecordDailyDao.updateStatsRecordEnd(userId,totalTime,data,dateId,gridId,isHandEnd);
} }
/** /**

1
epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml

@ -20,6 +20,7 @@
PATROL_TOTAL = (PATROL_TOTAL + 1), PATROL_TOTAL = (PATROL_TOTAL + 1),
REPORT_PROJECT_COUNT = (REPORT_PROJECT_COUNT + #{projectCount}), REPORT_PROJECT_COUNT = (REPORT_PROJECT_COUNT + #{projectCount}),
LATEST_PATROL_STATUS = 'end', LATEST_PATROL_STATUS = 'end',
IS_HAND_END = #{isHandEnd},
UPDATED_TIME = NOW() UPDATED_TIME = NOW()
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND STAFF_ID = #{userId} AND STAFF_ID = #{userId}

Loading…
Cancel
Save