|
|
@@ -23,14 +23,19 @@ import org.dromara.system.domain.bo.*;
|
|
|
import org.dromara.system.domain.vo.*;
|
|
|
import org.dromara.system.service.ISysDictDataService;
|
|
|
import org.dromara.system.service.ISysUserService;
|
|
|
+import org.dromara.system.service.ITblBagService;
|
|
|
import org.dromara.system.service.ITblExpressStaticsService;
|
|
|
import org.dromara.system.service.impl.TblCarInfoServiceImpl;
|
|
|
import org.dromara.system.service.impl.TblCarScheduleServiceImpl;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import tech.powerjob.worker.core.processor.ProcessResult;
|
|
|
+import tech.powerjob.worker.core.processor.TaskContext;
|
|
|
+import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
|
|
|
|
|
import javax.crypto.Cipher;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
@@ -41,7 +46,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Component
|
|
|
-public class CabinetUtil {
|
|
|
+public class CabinetUtil implements BasicProcessor {
|
|
|
|
|
|
private final static String appid = "bw_open_express_A8C848769E5C04E0";
|
|
|
private final static String appkey = "5AFC6E07CFCF4A359B775D1416A9799A";
|
|
|
@@ -287,10 +292,12 @@ public class CabinetUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Scheduled(fixedRate = 2*60*60*1000)
|
|
|
+// @Scheduled(fixedRate = 2*60*60*1000)
|
|
|
public void getExpressHistory() throws UnsupportedEncodingException {
|
|
|
+ Map<String, JSONObject> cabinetMap2 = new HashMap<>();
|
|
|
//获取所有快递柜的快递信息
|
|
|
Map<String, JSONObject> cabinetMap = new HashMap<>();
|
|
|
+
|
|
|
SysDictDataBo bo =new SysDictDataBo();
|
|
|
bo.setDictType("tbl_sites");
|
|
|
List<SysDictDataVo> list = SpringUtils.getBean(ISysDictDataService.class).selectDictDataList(bo);
|
|
|
@@ -302,6 +309,7 @@ public class CabinetUtil {
|
|
|
if(((JSONObject)item2).getStr("type").equals("cabinet")){
|
|
|
((JSONObject) item2).put("location",item.getDictValue());
|
|
|
cabinetMap.put( item.getDictLabel(),(JSONObject)item2);
|
|
|
+ cabinetMap2.put(((JSONObject) item2).getStr("cabinetType"),(JSONObject)item2);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -309,28 +317,41 @@ public class CabinetUtil {
|
|
|
}catch (Exception e){
|
|
|
|
|
|
}
|
|
|
- if(cabinetMap!=null && cabinetMap.size()>0) {
|
|
|
- try {
|
|
|
-
|
|
|
- List<JSONObject> cabinetList = new ArrayList<>();
|
|
|
- cabinetMap.keySet().forEach(i->{
|
|
|
- JSONObject c = cabinetMap.get(i);
|
|
|
- if(c.getStr("location")!=null&&c.getStr("wdcode")!=null){
|
|
|
- c.put("deviceId", c.getStr("code"));
|
|
|
- c.put("stationId", c.getStr("wdcode"));
|
|
|
- c.put("deviceType", "cabinet");
|
|
|
- cabinetList.add(c);
|
|
|
- }
|
|
|
- } );
|
|
|
+ //获取历史
|
|
|
+ try {
|
|
|
|
|
|
- SPlatUtils.SysDevice(cabinetList);
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
- }
|
|
|
+// TblBagBo bo1 =new TblBagBo();
|
|
|
+// bo1.getParams().put("remark","");
|
|
|
+// List<TblBagVo> bagList = SpringUtils.getBean(ITblBagService.class).queryList(bo1);
|
|
|
+// List<JSONObject> jsonObjectList1 = new ArrayList<>();
|
|
|
+// List<TblBagVo> sysd = new ArrayList<>();
|
|
|
+// if(bagList!=null && bagList.size()>0) {
|
|
|
+// bagList.forEach(item->{
|
|
|
+// if(cabinetMap2.containsKey(item.getDeviceId().toString())){
|
|
|
+// JSONObject json = new JSONObject();
|
|
|
+// json.put("deviceId",item.getDeviceId());
|
|
|
+// json.put("cpCode",item.getCpCode());
|
|
|
+// json.put("waybillNo",item.getWaybillNo());
|
|
|
+// json.put("scTime",item.getScTime());
|
|
|
+// json.put("scType",item.getScType());
|
|
|
+// jsonObjectList1.add(json);
|
|
|
+// sysd.add(item);
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+//
|
|
|
+// SPlatUtils.pushExpressInfo(jsonObjectList1);
|
|
|
+// if(sysd!=null && sysd.size()>0) {
|
|
|
+// sysd.forEach(item -> {
|
|
|
+// item.setRemark("已同步");
|
|
|
+// TblBagBo item1 = new TblBagBo();
|
|
|
+// BeanUtils.copyProperties(item, item1);
|
|
|
+// SpringUtils.getBean(ITblBagService.class).updateByBo(item1);
|
|
|
+// });
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
- }
|
|
|
- //获取历史
|
|
|
- try {
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("start_ctime ", DateUtil.format( DateUtil.offsetHour(DateUtil.date(),-2), "yyyy-MM-dd HH:mm:ss"));
|
|
|
map.put("end_ctime ", DateUtil.format( DateUtil.date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
@@ -359,10 +380,35 @@ public class CabinetUtil {
|
|
|
}
|
|
|
SPlatUtils.pushExpressInfo(jsonObjectList);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}catch (Exception e){
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if(cabinetMap!=null && cabinetMap.size()>0) {
|
|
|
+ try {
|
|
|
+
|
|
|
+ List<JSONObject> cabinetList = new ArrayList<>();
|
|
|
+ cabinetMap.keySet().forEach(i->{
|
|
|
+ JSONObject c = cabinetMap.get(i);
|
|
|
+ if(c.getStr("location")!=null&&c.getStr("wdcode")!=null){
|
|
|
+ c.put("deviceId", c.getStr("code"));
|
|
|
+ c.put("stationId", c.getStr("wdcode"));
|
|
|
+ c.put("deviceType", "cabinet");
|
|
|
+ cabinetList.add(c);
|
|
|
+ }
|
|
|
+ } );
|
|
|
+
|
|
|
+ SPlatUtils.SysDevice(cabinetList);
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
@@ -576,8 +622,9 @@ public class CabinetUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public ProcessResult process(TaskContext taskContext) throws Exception {
|
|
|
+ getExpressHistory();
|
|
|
+ return new ProcessResult(true, "定时任务执行成功");
|
|
|
+ }
|
|
|
}
|