|
@@ -156,4 +156,41 @@ public class TmsshipShipLocationController extends BaseRESTfulController {
|
|
|
return success(map);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping(value = "/getWarnMsg")
|
|
|
+ public RESTfulResult getWarnMsg(@RequestBody(required = false) Map<String,Object> mapVal) throws Exception {
|
|
|
+ StringBuilder warnMsg = new StringBuilder();
|
|
|
+ List<Map<String, Object>> columnList = tmsshipShipLocationService.selectShipLocationList(mapVal);
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ if(columnList != null && !columnList.isEmpty()) {
|
|
|
+ for (Map<String, Object> map : columnList) {
|
|
|
+ String locationRouteTime = map.get("locationRouteTime").toString();
|
|
|
+ if(locationRouteTime != null && !"".equals(locationRouteTime) ){
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date locationRouteTimeDate = sdf.parse(locationRouteTime);
|
|
|
+ long starTime=locationRouteTimeDate.getTime();
|
|
|
+ long endTime=(new Date()).getTime();
|
|
|
+ long num=endTime-starTime;//时间戳相差的毫秒数
|
|
|
+ System.out.println("相差天数为:"+num/24/60/60/1000);
|
|
|
+ //超过15天提醒
|
|
|
+ if((num/(24*60*60*1000)) > 15){
|
|
|
+ list.add(""+ map.get("materialName") +" \""+ map.get("foreignShipName") +"\" "+map.get("capacityName")
|
|
|
+ +" 离岗日期"+ map.get("locationRouteTime") +" 离岗已超过十五天,请确定船舶状态; ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(list.isEmpty()){
|
|
|
+ warnMsg.append("暂无警告");
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ int k=i+1;
|
|
|
+ if(k == 1){
|
|
|
+ warnMsg.append("警告:");
|
|
|
+ }
|
|
|
+ warnMsg.append(k).append("、").append(list.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success(warnMsg);
|
|
|
+ }
|
|
|
+
|
|
|
}
|