| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.location.entity.LiveLocation; |
| | | import org.springblade.modules.location.entity.Locus; |
| | | import org.springblade.modules.location.service.LiveLocationService; |
| | |
| | | import org.springblade.modules.location.vo.LocusVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | * 自定义分页 |
| | | * @param query page,size |
| | | * @param liveLocation 实时位置信息对象 |
| | | * |
| | | */ |
| | | @GetMapping("/page") |
| | | public R<IPage<LiveLocationVo>> page(LiveLocationVo liveLocation, Query query) { |
| | |
| | | //新增 |
| | | liveLocation.setRecordTime(new Date()); |
| | | status = liveLocationService.save(liveLocation); |
| | | //数据推送 |
| | | String s1 = |
| | | "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time,location) " + |
| | | "values(" + "'" + liveLocation.getId() + "'" + "," + |
| | | "'" + liveLocation.getType() + "'" + "," + |
| | | "'" + liveLocation.getWorkerId() + "'" + "," + |
| | | "'" + liveLocation.getLongitude() + "'" + "," + |
| | | "'" + liveLocation.getLatitude() + "'" + "," + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + "," + |
| | | "'" +liveLocation.getLocation() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }else { |
| | | //更新 |
| | | liveLocationInfo.setRecordTime(new Date()); |
| | | liveLocationInfo.setLongitude(liveLocation.getLongitude()); |
| | | liveLocationInfo.setLatitude(liveLocation.getLatitude()); |
| | | status = liveLocationService.updateById(liveLocationInfo); |
| | | |
| | | //内网同步 |
| | | String s1 = |
| | | "update sys_live_location set type = " + "'" + liveLocation.getType() + "'" + |
| | | ",worker_id = " + "'" + liveLocation.getWorkerId() + "'" + |
| | | ",longitude = " + "'" + liveLocation.getLongitude() + "'" + |
| | | ",latitude = " + "'" + liveLocation.getLatitude() + "'" + |
| | | ",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + |
| | | ",location = " + "'" + liveLocation.getLocation() + "'" + |
| | | " " +"where id = " + "'" + liveLocation.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | } |
| | | |
| | | if (status){ |
| | |
| | | locus.setRecordTime(new Date()); |
| | | //新增轨迹 |
| | | boolean save1 = locusService.save(locus); |
| | | //数据推送 |
| | | String s2 = |
| | | "insert into sys_locus(id,live_location_id,record_time,longitude,latitude) " + |
| | | "values(" + "'" + locus.getId() + "'" + "," + |
| | | "'" + locus.getLiveLocationId() + "'" + "," + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(locus.getRecordTime()) + "'" + "," + |
| | | "'" + locus.getLongitude() + "'" + "," + |
| | | "'" +locus.getLatitude() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s2); |
| | | |
| | | if (save1){ |
| | | //返回数据 |
| | | return R.status(true); |