修改了添加火点数据,时间工具类的代码模块

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-07-30 16:00:34 +08:00
parent 206f44705a
commit 3f78152a37
5 changed files with 10 additions and 20 deletions

View File

@ -52,6 +52,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET,"/selectCityName").permitAll()
.antMatchers(HttpMethod.GET,"/weather/cityName").permitAll()
.antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll()
.antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll()
// 所有其它请求需要身份认证
.anyRequest().authenticated()
.and()

View File

@ -126,7 +126,6 @@ public class FirePointController {
* @return
*/
@PostMapping("/updateTypeByFireCode")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String updateTypeByFireCode(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
String fireCode = (String) map.get("fireCode");
String fireType = (String) map.get("fireType");

View File

@ -86,7 +86,7 @@ public class FirePointServiceImpl implements FirePointService {
firePointEntity.setAddTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
firePointEntity.setFireType("0");
log.info("-------发现新火点");
/*log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
log.info("---------------开始进行实时通讯,将检测到的火点传给前端");
Map map = new HashMap(3);
map.put("countyCode",firePointQo.getCountyCode());
map.put("countyName",firePointQo.getCountyName());
@ -101,7 +101,7 @@ public class FirePointServiceImpl implements FirePointService {
map1.put("fire",map);
String websocket = JSON.toJSONString(map1);
// 将监测到的火点信息返给前端
WebSocketServer.broadInfo(websocket);*/
WebSocketServer.broadInfo(websocket);
return firePointDao.save(firePointEntity);
}

View File

@ -136,8 +136,7 @@ public class DateTimeUtil {
* @return
*/
public static String timeMillisToString(long timeMillis){
Instant instant = Instant.ofEpochMilli(timeMillis);
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, DEFAULT_ZONE_OFFSET);
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis, 0, ZoneOffset.ofHours(8));
return COMMON_FORMATTER_DATETIME.format(localDateTime);
}
@ -211,20 +210,11 @@ public class DateTimeUtil {
}
public static void main(String[] args) {
//long l = dateToTimeMillis(LocalDateTime.now());
//timeMillisToString(1626082306233)
//System.out.println(l);
/*LocalDateTime date3 = LocalDateTime.now();
LocalDateTime date4 = LocalDateTime.of(2021, 7, 16, 22, 30, 10);
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]);
}
long l = dateToTimeMillis(LocalDateTime.now());
System.out.println(l);
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(1627616812, 0, ZoneOffset.ofHours(8));
String s = timeMillisToString(1627616812);
System.out.println(s);
}
}

View File

@ -86,7 +86,7 @@ public class PhotoUtil {
}
//String path = "/home/web/wf-fire-service/forestTaskImage/" + newName;
String path = "E:/file/work/image/" + newName;
String uploadPaths = uploadPath + newName;
String uploadPaths = "/" + newName;
//实现上传
file.transferTo(new File(path));
FireTaskPhoto fireTaskPhoto = new FireTaskPhoto();