Commit aa8043ef authored by litengwei's avatar litengwei

报废问题

parent 1edc3d07
...@@ -1828,22 +1828,25 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1828,22 +1828,25 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap(); List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap();
equipSpecificScrap.forEach(e->{ equipSpecificScrap.forEach(e->{
try { try {
int year = e.get("weExpiry") != null ? Integer.parseInt(e.get("weExpiry").toString()) : Integer.parseInt(e.get("wesExpiry").toString()); if(e.get("wesExpiry") != null) {
Date productDate = DateUtils.dateParse(e.get("product").toString(),"yyyy-MM-dd'T'HH:mm"); int year = Integer.parseInt(e.get("wesExpiry").toString());
Calendar calendar = Calendar.getInstance(); Date productDate = DateUtils.dateParse(e.get("product").toString(),"yyyy-MM-dd'T'HH:mm");
calendar.setTime(productDate); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.YEAR, year); calendar.setTime(productDate);
calendar.add(Calendar.YEAR, year);
Date now = new Date();
String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime()); Date now = new Date();
String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime());
int i = -1;
while (now.after(calendar.getTime())) { long time1 = calendar.getTimeInMillis();
calendar.add(Calendar.DAY_OF_MONTH,1); calendar.setTime(now);
i++; long time2 = calendar.getTimeInMillis();
} long between_days=(time2-time1)/(10003600*24);
if(i < Integer.parseInt(equipmentScrapDay) && i > -1) { int day = Integer.parseInt(String.valueOf(between_days));
syncSystemctlMsg(e, scrapTime,i);
if(day < Integer.parseInt(equipmentScrapDay) && day > -1) {
syncSystemctlMsg(e, scrapTime, day);
}
} }
} catch (ParseException parseException) { } catch (ParseException parseException) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment