package com.xkrs.service.impl; import com.xkrs.dao.FirePointDao; import com.xkrs.model.entity.FirePointEntity; import com.xkrs.model.qo.FirePointQo; import com.xkrs.service.FirePointService; import com.xkrs.utils.AddressUtils; import com.xkrs.utils.DateTimeUtil; import com.xkrs.utils.Query; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; /** * @author XinYi Song */ @Service public class FirePointServiceImpl implements FirePointService { public static Logger log = LoggerFactory.getLogger(FirePointServiceImpl.class); @Resource private FirePointDao firePointDao; @Resource private Query query; /** * 添加火点信息 * @param firePointQo * @return */ @Override public FirePointEntity insertFirePoint(FirePointQo firePointQo) { FirePointEntity firePointEntity = new FirePointEntity(); firePointEntity.setFireCode(firePointQo.getFireCode()); firePointEntity.setCountyCode(firePointQo.getCountyCode().toString()); firePointEntity.setCountyName(firePointQo.getCountyName()); firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue())); firePointEntity.setLongitude(firePointQo.getLongitude()); firePointEntity.setLatitude(firePointQo.getLatitude()); firePointEntity.setFirePointAddress(AddressUtils.getLatAndLng(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString())); firePointEntity.setSatelliteType(firePointQo.getSatelliteType()); firePointEntity.setLandType(firePointQo.getLandType()); firePointEntity.setConfidence(firePointQo.getConfidence()); firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); firePointEntity.setFireType("0"); log.info("-------发现新火点"); return firePointDao.save(firePointEntity); } /** * 查询今天的火点信息 * @param * @return */ @Override public List selectTodayFirePoint() { String addTime = DateTimeUtil.dateToString(LocalDate.now()); return firePointDao.selectTodayFirePoint(addTime); } /** * 动态多条件查询火点信息 * @param cityCode * @param satelliteType * @param landType * @param startTime * @param endTime * @return */ @Override public List selectFirePoint(String cityCode, String satelliteType, String landType, String startTime, String endTime) { return query.selectFirePoint(cityCode, satelliteType, landType, startTime, endTime); } }