Commit 82f1b7a3 authored by litengwei's avatar litengwei

任务 9900

parent a7450979
...@@ -10,7 +10,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -10,7 +10,9 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.entity.vo.*; import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*; import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.*; import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import org.apache.catalina.util.IOTools; import org.apache.catalina.util.IOTools;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -98,6 +100,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -98,6 +100,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired @Autowired
IEquPropertyService equPropertyService; IEquPropertyService equPropertyService;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private SystemctlFeign systemctlFeign;
@Autowired
@Lazy @Lazy
IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce; IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired @Autowired
...@@ -1823,7 +1829,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1823,7 +1829,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
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()); int year = e.get("weExpiry") != null ? Integer.parseInt(e.get("weExpiry").toString()) : Integer.parseInt(e.get("wesExpiry").toString());
Date productDate = DateUtils.dateParse(e.get("product").toString(),DateUtils.DATE_TIME_PATTERN); Date productDate = DateUtils.dateParse(e.get("product").toString(),"yyyy-MM-dd'T'HH:mm");
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(productDate); calendar.setTime(productDate);
calendar.add(Calendar.YEAR, year); calendar.add(Calendar.YEAR, year);
...@@ -1831,7 +1837,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1831,7 +1837,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
Date now = new Date(); Date now = new Date();
String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime()); String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime());
int i = 0; int i = -1;
while (now.after(calendar.getTime())) { while (now.after(calendar.getTime())) {
calendar.add(Calendar.DAY_OF_MONTH,1); calendar.add(Calendar.DAY_OF_MONTH,1);
i++; i++;
...@@ -1853,7 +1859,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1853,7 +1859,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
model.setTitle("报废到期提醒"); model.setTitle("报废到期提醒");
String equipName = map.get("name").toString(); String equipName = map.get("name").toString();
String location = map.get("sName").toString() + map.get("position").toString() ; String location = map.get("sname").toString() + map.get("position").toString() ;
String body = String.format("%s-%s于%s报废,请提前更换处理", equipName, location, scrapTime); String body = String.format("%s-%s于%s报废,请提前更换处理", equipName, location, scrapTime);
String join = String.format("设备还剩%s天报废,请提前更换", i); String join = String.format("设备还剩%s天报废,请提前更换", i);
...@@ -1874,7 +1880,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1874,7 +1880,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
ext.put("time", new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date())); ext.put("time", new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()));
model.setExtras(ext); model.setExtras(ext);
model.setRecivers(receive); model.setRecivers(receive);
Systemctl.messageClient.create(model); // Systemctl.messageClient.create(model);
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
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