|
|
@@ -3,6 +3,7 @@ package org.dromara.util;
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
@@ -13,19 +14,15 @@ import org.apache.xmlbeans.impl.xb.xsdschema.Public;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.core.utils.SpringUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.redis.utils.CacheUtils;
|
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
|
import org.dromara.system.domain.GpsData;
|
|
|
import org.dromara.system.domain.TblCarInfo;
|
|
|
-import org.dromara.system.domain.bo.SysDictDataBo;
|
|
|
-import org.dromara.system.domain.bo.TblCarInfoBo;
|
|
|
-import org.dromara.system.domain.bo.TblCarScheduleBo;
|
|
|
-import org.dromara.system.domain.bo.TblExpressStaticsBo;
|
|
|
-import org.dromara.system.domain.vo.SysDictDataVo;
|
|
|
-import org.dromara.system.domain.vo.TblCarInfoVo;
|
|
|
-import org.dromara.system.domain.vo.TblCarScheduleVo;
|
|
|
-import org.dromara.system.domain.vo.TblExpressStaticsVo;
|
|
|
+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.ITblExpressStaticsService;
|
|
|
import org.dromara.system.service.impl.TblCarInfoServiceImpl;
|
|
|
import org.dromara.system.service.impl.TblCarScheduleServiceImpl;
|
|
|
@@ -51,6 +48,9 @@ public class CabinetUtil {
|
|
|
@Autowired
|
|
|
ITblExpressStaticsService tblExpressStaticsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ISysUserService userService;
|
|
|
+
|
|
|
private final static String appid = "bw_open_express_A8C848769E5C04E0";
|
|
|
private final static String appkey = "5AFC6E07CFCF4A359B775D1416A9799A";
|
|
|
|
|
|
@@ -108,6 +108,53 @@ public class CabinetUtil {
|
|
|
// }
|
|
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 10 0 ? * ? ")
|
|
|
+ private void getExpressStatic() {
|
|
|
+ ThreadUtil.execAsync(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ SysUserBo sysUserBo = new SysUserBo();
|
|
|
+ sysUserBo.setRoleId(1763484881548447746L);
|
|
|
+ PageQuery pageQuery = new PageQuery();
|
|
|
+ pageQuery.setPageSize(1000);
|
|
|
+ pageQuery.setPageNum(1);
|
|
|
+ List<SysUserVo> userlist = userService.selectAllocatedList(sysUserBo,pageQuery).getRows();
|
|
|
+ log.info(String.valueOf(userlist.size()));
|
|
|
+ for(SysUserVo vo:userlist){
|
|
|
+ if(!vo.getPhonenumber().isEmpty() && vo.getPhonenumber() != null){
|
|
|
+ log.info("----------------------快递员{}开始同步----------------------",vo.getNickName());
|
|
|
+ try{
|
|
|
+ String month = getLastMonth();
|
|
|
+ TblExpressStaticsBo bo = new TblExpressStaticsBo();
|
|
|
+ bo.setMonth(month);
|
|
|
+ bo.setUserId(vo.getUserId());
|
|
|
+ bo.setData(CabinetUtil.getExpressDeliveryStatistics(vo.getPhonenumber(),month));
|
|
|
+ Thread.sleep(10000);
|
|
|
+ TblExpressStaticsBo query = new TblExpressStaticsBo();
|
|
|
+ query.setMonth(month);
|
|
|
+ query.setUserId(vo.getUserId());
|
|
|
+ List<TblExpressStaticsVo> list = tblExpressStaticsService.queryList(query);
|
|
|
+ if(list.size() > 0){
|
|
|
+ bo.setId(list.get(0).getId());
|
|
|
+ tblExpressStaticsService.updateByBo(bo);
|
|
|
+ }else{
|
|
|
+ tblExpressStaticsService.insertByBo(bo);
|
|
|
+ }
|
|
|
+ log.info("----------------------快递员{}结束同步----------------------",vo.getNickName());
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Scheduled(fixedRate = 5*60*1000)
|
|
|
private void genScheduleList(){
|
|
|
|
|
|
@@ -365,9 +412,9 @@ public class CabinetUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static void main(String args[]) throws Exception {
|
|
|
- log.info(getExpressDeliveryStatistics("19559316717","2025-01"));
|
|
|
- }
|
|
|
+// public static void main(String args[]) throws Exception {
|
|
|
+// log.info(getExpressDeliveryStatistics("19559316717","2025-01"));
|
|
|
+// }
|
|
|
|
|
|
// 获取柜子盒子
|
|
|
public static String getCabinetBoxs(String cabinetCode) throws Exception {
|