修改了添加火点数据,时间工具类的代码模块
This commit is contained in:
parent
206f44705a
commit
3f78152a37
@ -52,6 +52,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers(HttpMethod.GET,"/selectCityName").permitAll()
|
.antMatchers(HttpMethod.GET,"/selectCityName").permitAll()
|
||||||
.antMatchers(HttpMethod.GET,"/weather/cityName").permitAll()
|
.antMatchers(HttpMethod.GET,"/weather/cityName").permitAll()
|
||||||
.antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll()
|
.antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll()
|
||||||
|
.antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll()
|
||||||
// 所有其它请求需要身份认证
|
// 所有其它请求需要身份认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
|
@ -126,7 +126,6 @@ public class FirePointController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateTypeByFireCode")
|
@PostMapping("/updateTypeByFireCode")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_general_user')")
|
|
||||||
public String updateTypeByFireCode(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
|
public String updateTypeByFireCode(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
|
||||||
String fireCode = (String) map.get("fireCode");
|
String fireCode = (String) map.get("fireCode");
|
||||||
String fireType = (String) map.get("fireType");
|
String fireType = (String) map.get("fireType");
|
||||||
|
@ -86,7 +86,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
|
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
|
||||||
firePointEntity.setFireType("0");
|
firePointEntity.setFireType("0");
|
||||||
log.info("-------发现新火点");
|
log.info("-------发现新火点");
|
||||||
/*log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
|
log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
|
||||||
Map map = new HashMap(3);
|
Map map = new HashMap(3);
|
||||||
map.put("countyCode",firePointQo.getCountyCode());
|
map.put("countyCode",firePointQo.getCountyCode());
|
||||||
map.put("countyName",firePointQo.getCountyName());
|
map.put("countyName",firePointQo.getCountyName());
|
||||||
@ -101,7 +101,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
map1.put("fire",map);
|
map1.put("fire",map);
|
||||||
String websocket = JSON.toJSONString(map1);
|
String websocket = JSON.toJSONString(map1);
|
||||||
// 将监测到的火点信息返给前端
|
// 将监测到的火点信息返给前端
|
||||||
WebSocketServer.broadInfo(websocket);*/
|
WebSocketServer.broadInfo(websocket);
|
||||||
return firePointDao.save(firePointEntity);
|
return firePointDao.save(firePointEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,7 @@ public class DateTimeUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String timeMillisToString(long timeMillis){
|
public static String timeMillisToString(long timeMillis){
|
||||||
Instant instant = Instant.ofEpochMilli(timeMillis);
|
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis, 0, ZoneOffset.ofHours(8));
|
||||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, DEFAULT_ZONE_OFFSET);
|
|
||||||
return COMMON_FORMATTER_DATETIME.format(localDateTime);
|
return COMMON_FORMATTER_DATETIME.format(localDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,20 +210,11 @@ public class DateTimeUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
//long l = dateToTimeMillis(LocalDateTime.now());
|
long l = dateToTimeMillis(LocalDateTime.now());
|
||||||
//timeMillisToString(1626082306233)
|
System.out.println(l);
|
||||||
//System.out.println(l);
|
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(1627616812, 0, ZoneOffset.ofHours(8));
|
||||||
/*LocalDateTime date3 = LocalDateTime.now();
|
String s = timeMillisToString(1627616812);
|
||||||
LocalDateTime date4 = LocalDateTime.of(2021, 7, 16, 22, 30, 10);
|
System.out.println(s);
|
||||||
Duration duration = Duration.between(date3, date4);
|
|
||||||
long l = duration.toDays();
|
|
||||||
long i = 60*60*l;
|
|
||||||
System.out.println(i);*/
|
|
||||||
String s = "3600";
|
|
||||||
String[] split = s.split("0");
|
|
||||||
for (int i = 0; i < split.length; i++) {
|
|
||||||
System.out.println(split[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public class PhotoUtil {
|
|||||||
}
|
}
|
||||||
//String path = "/home/web/wf-fire-service/forestTaskImage/" + newName;
|
//String path = "/home/web/wf-fire-service/forestTaskImage/" + newName;
|
||||||
String path = "E:/file/work/image/" + newName;
|
String path = "E:/file/work/image/" + newName;
|
||||||
String uploadPaths = uploadPath + newName;
|
String uploadPaths = "/" + newName;
|
||||||
//实现上传
|
//实现上传
|
||||||
file.transferTo(new File(path));
|
file.transferTo(new File(path));
|
||||||
FireTaskPhoto fireTaskPhoto = new FireTaskPhoto();
|
FireTaskPhoto fireTaskPhoto = new FireTaskPhoto();
|
||||||
|
Loading…
Reference in New Issue
Block a user