|
@@ -95,151 +95,6 @@ public class MQTask implements InitializingBean {
|
|
|
@Override
|
|
|
public void afterPropertiesSet() throws Exception {}
|
|
|
|
|
|
- //@Scheduled(cron = "*/10 * * * * ?")
|
|
|
- //@Scheduled(cron = "0 0 9,11,14,16,18,20 * * ? ")//推送时间分别为每天早上九点、中午十一点、下午三点、下午六点、晚上八点
|
|
|
- //@Scheduled(cron = "0 0 */1 * * ?")//每小时执行一次
|
|
|
-// @Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
|
|
|
- public void auditMessagePush(){
|
|
|
- logger.info("------------执行消息提醒,推送待处理订单短信 start-----------");
|
|
|
- List<SmsMessage> smsMessageList = messageService.listOrderMessages();
|
|
|
- if(smsMessageList != null && smsMessageList.size() > 0){
|
|
|
- //循环推送短信
|
|
|
- for(SmsMessage smsMessage : smsMessageList){
|
|
|
- ResponseJson json = smsService.sms(smsMessage.getTel(),smsMessage.getTypes(),smsMessage.getCounts());
|
|
|
- if(json.getReturnCode() == 200){
|
|
|
- logger.info("------------推送到+"+smsMessage.getTel()+"一条"+(smsMessage.getTypes() == 1?"待处理":"驳回")+"短信成功");
|
|
|
- //设置审核通过记录为无效
|
|
|
- if(smsMessage.getTypes() == 3){
|
|
|
- OrderMessage orderMessage = new OrderMessage();
|
|
|
- orderMessage.setMessageStatus(2);
|
|
|
- orderMessage.setMessageType(3);
|
|
|
- messageService.updateOrderMessageStatus(orderMessage);
|
|
|
- }
|
|
|
- }else{
|
|
|
- logger.info("------------推送到+"+smsMessage.getTel()+"一条"+(smsMessage.getTypes() == 1?"待处理":"驳回")+"短信失败"+json.getReturnMsg());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量同步百胜订单信息 -- 客诉系统 -- 作废
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- //@Scheduled(cron = "0 0 */1 * * ?")//每小时执行一次
|
|
|
- //@Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
|
|
|
- //@Scheduled(cron = "*/10 * * * * ?")
|
|
|
- public void syncEfastOrderList() throws Exception {
|
|
|
- logger.info("---------------- 批量同步百胜订单开始 ---------------");
|
|
|
- int pageNo = 1;
|
|
|
- int pageSize = 20;
|
|
|
- boolean flag = false; //控制是否还需要获取百胜订单信息
|
|
|
- String date = "";
|
|
|
- synchronized (lock) {
|
|
|
- String configParameter = sysConfigService.getSysConfig(1);
|
|
|
- do {
|
|
|
- //批量获取百胜订单信息
|
|
|
- JSONObject obj = null;
|
|
|
- try{
|
|
|
- obj = efastOrderService.listOrderInfoFormEfast(pageNo, pageSize, configParameter);
|
|
|
- }catch (Exception e){
|
|
|
- logger.info("Efast订单获取失败,失败原因:"+e.getMessage());
|
|
|
- }
|
|
|
- if (obj == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- int totalResults = obj.getInt("total_results"); //百胜返回总页数
|
|
|
- if (pageNo < totalResults) {
|
|
|
- flag = true;
|
|
|
- pageNo++;
|
|
|
- } else {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- salesOrderService.addSalesOrderList(obj);
|
|
|
- } while (flag); //百胜返回条目数如果等于设置的分页条目数,则继续查询下一页
|
|
|
- }
|
|
|
- logger.info("---------------- 批量同步百胜订单结束 ---------------");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 同步百胜订单状态等信息----客诉系统 -- 作废
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- //@Scheduled(cron = "0 0 */1 * * ?")//每小时执行一次
|
|
|
-// @Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
|
|
|
- //@Scheduled(cron = "*/10 * * * * ?")
|
|
|
- public void syncEfastOrderStatus() throws Exception {
|
|
|
- int pageNo = 1;
|
|
|
- int pageSize = 20;
|
|
|
- boolean flag = false; //控制是否还需要获取百胜订单信息
|
|
|
-
|
|
|
- /*int returnPageNo = 1;
|
|
|
- int returnPageSize = 20;
|
|
|
- boolean returnFlag = false; //控制是否还需要获取百胜退单信息*/
|
|
|
- synchronized (lock1) {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date beginDate = new Date();
|
|
|
- SalesOrder order = new SalesOrder();
|
|
|
- Calendar date = Calendar.getInstance();
|
|
|
-
|
|
|
- //获取同步百胜订单的开始时间
|
|
|
- String configParameter = sysConfigService.getSysConfig(2); //获取客诉订单同步百胜订单状态时间间隔
|
|
|
- date.setTime(beginDate);
|
|
|
- date.set(Calendar.DATE, date.get(Calendar.DATE) - Integer.valueOf(configParameter));
|
|
|
- order.setStartDate(format.parse(format.format(date.getTime())));
|
|
|
- order.setSalesCreateTime(format.parse(format.format(date.getTime())));
|
|
|
-
|
|
|
- //根据创建时间获取订单信息
|
|
|
- List<SalesOrder> orderlist = salesOrderService.listSalesOrder(order);
|
|
|
- logger.info("需要同步订单状态的订单有:" + orderlist.size() + "个;");
|
|
|
- if (orderlist == null || orderlist.size() == 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- do {
|
|
|
- //批量获取百胜订单信息
|
|
|
- JSONObject obj = efastOrderService.listOrderInfoFormEfast(pageNo, pageSize, format.format(order.getSalesCreateTime()));
|
|
|
- if (obj == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- JSONArray orderList = obj.getJSONArray("list");
|
|
|
- if (orderList == null || orderList.size() == 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- salesOrderService.updateOrderList(orderList, orderlist);
|
|
|
- int totalResults = obj.getInt("total_results"); //百胜返回总页数
|
|
|
- if (pageNo < totalResults) {
|
|
|
- flag = true;
|
|
|
- pageNo++;
|
|
|
- } else {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- } while (flag); //百胜返回条目数如果等于设置的分页条目数,则继续查询下一页
|
|
|
-
|
|
|
- //无法实现获取退单信息,只能查出已确认未收货的订单
|
|
|
- /*do {
|
|
|
- //批量获取百胜退单信息
|
|
|
- JSONObject obj = efastOrderService.listReturnOrderFormEfast(returnPageNo, returnPageSize, format.format(date.getTime()));
|
|
|
- if (obj == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- JSONArray orderList = obj.getJSONArray("list");
|
|
|
- System.out.println("orderList="+orderList);
|
|
|
- if (orderList == null || orderList.size() == 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- salesOrderService.updateReturnOrderList(orderList, orderlist);
|
|
|
- int totalResults = obj.getInt("total_results"); //百胜返回总页数
|
|
|
- if (returnPageNo < totalResults) {
|
|
|
- returnFlag = true;
|
|
|
- returnPageNo++;
|
|
|
- } else {
|
|
|
- returnFlag = false;
|
|
|
- }
|
|
|
- } while (returnFlag); //百胜返回条目数如果等于设置的分页条目数,则继续查询下一页*/
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 发送发货通知
|
|
@@ -279,108 +134,10 @@ public class MQTask implements InitializingBean {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**客诉系统 自动追踪发货信息**/
|
|
|
-// @Scheduled(cron = "0 0/2 * * * ?")//每2分钟执行一次
|
|
|
- @Scheduled(cron = "0 0 9 * * ?")//每天上午午9点触发
|
|
|
- public void postageRemind()throws Exception{
|
|
|
- if (isDebug) {
|
|
|
- logger.info("debug模式,无法运行正式任务");
|
|
|
- return;
|
|
|
- }
|
|
|
- Map<Integer,Integer> map = new HashMap<Integer,Integer>();
|
|
|
-
|
|
|
- List<CompanyInfo> companyInfoList = companyInfoService.listCompanyInfo(new CompanyInfo());
|
|
|
- for (CompanyInfo ci: companyInfoList ) {
|
|
|
- /*权限去重*/
|
|
|
- Set<Integer> authorityCustomerManagerSet = new HashSet();
|
|
|
- Set<Integer> authorityFinancialManagerSet = new HashSet();
|
|
|
- Set<Integer> authorityFinancialPaymentSet = new HashSet();
|
|
|
-
|
|
|
- PostageAuthority postageAuthority = new PostageAuthority();
|
|
|
- postageAuthority.setAuthorityStatus(1);
|
|
|
- postageAuthority.setCompanyId(ci.getCompanyId());
|
|
|
- List<PostageAuthority> postageAuthorityList = postageAuthorityService.getPostageAuthorityList(postageAuthority);
|
|
|
- for (int j=0;j<postageAuthorityList.size();j++){
|
|
|
- PostageAuthority pa = postageAuthorityList.get(j);
|
|
|
-
|
|
|
- if(pa.getAuthorityCustomerManager() != null && pa.getAuthorityCustomerManager() != 0){
|
|
|
- authorityCustomerManagerSet.add(pa.getAuthorityCustomerManager());
|
|
|
- }
|
|
|
-
|
|
|
- if(pa.getAuthorityFinancialManager() != null && pa.getAuthorityFinancialManager() != 0){
|
|
|
- authorityFinancialManagerSet.add(pa.getAuthorityFinancialManager());
|
|
|
- }
|
|
|
-
|
|
|
- if(pa.getAuthorityFinancialPayment() != null && pa.getAuthorityFinancialPayment() != 0){
|
|
|
- authorityFinancialPaymentSet.add(pa.getAuthorityFinancialPayment());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Postage pt = new Postage();
|
|
|
- pt.setCompanyId(ci.getCompanyId());
|
|
|
- pt.setPostageManagerStatus(1); //客服经理审核 1:审核中
|
|
|
- for (Integer customerManager: authorityCustomerManagerSet) { //customerManager 为id
|
|
|
- Integer postageNumber = postageService.getPostageNumber(pt);
|
|
|
- if(map.get(customerManager) == null){
|
|
|
- map.put(customerManager,postageNumber);
|
|
|
- }else{
|
|
|
- Integer number = map.get(customerManager);
|
|
|
- map.put(customerManager,number + postageNumber);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- pt = new Postage();
|
|
|
- pt.setCompanyId(ci.getCompanyId());
|
|
|
- pt.setPostageFinanceStatus(1); //状态(财务审核) 1:审核中
|
|
|
- for (Integer financialManager: authorityFinancialManagerSet) { //financialManager 为id
|
|
|
- Integer postageNumber = postageService.getPostageNumber(pt);
|
|
|
- if(map.get(financialManager) == null){
|
|
|
- map.put(financialManager,postageNumber);
|
|
|
- }else{
|
|
|
- Integer number = map.get(financialManager);
|
|
|
- map.put(financialManager,number + postageNumber);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- pt = new Postage();
|
|
|
- pt.setCompanyId(ci.getCompanyId());
|
|
|
- pt.setPostageTransferStatus(1); //是否转账:1待转 2:已转
|
|
|
- for (Integer financialPayment: authorityFinancialPaymentSet) { //financialPayment 为id
|
|
|
- Integer postageNumber = postageService.getPostageNumber(pt);
|
|
|
- if(map.get(financialPayment) == null){
|
|
|
- map.put(financialPayment,postageNumber);
|
|
|
- }else{
|
|
|
- Integer number = map.get(financialPayment);
|
|
|
- map.put(financialPayment,number + postageNumber);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- for (Map.Entry<Integer,Integer> m: map.entrySet()) {
|
|
|
- Integer number = m.getValue();
|
|
|
- Admin admin = new Admin();
|
|
|
- admin.setAdminId(m.getKey());
|
|
|
- admin = sysService.get(admin);
|
|
|
-
|
|
|
- String tel = admin.getAdminTel();
|
|
|
- if(admin == null || tel == null || "".equals(tel)){
|
|
|
- logger.info("邮费转账发送待处理短信,手机号码为空,"+ tel+"===id为"+m.getKey());
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(number == null || number == 0){
|
|
|
- continue;
|
|
|
- }
|
|
|
- String text = MessageFormat.format(REMIND_POSTAGE_PENDING,number);
|
|
|
- smsService.sendOtherCMS(tel,text);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 查询维修超时数据并短信通知
|
|
|
*/
|
|
|
@Scheduled(cron = "0 50 8 * * ?")//每天上午午9点触发
|
|
|
-/* @Scheduled(cron = "0 0/1 * * * ?")//每2分钟执行一次*/
|
|
|
public void detectTimeoutNotice() throws Exception {
|
|
|
if (isDebug) {
|
|
|
logger.info("debug模式,无法运行正式任务");
|
|
@@ -418,48 +175,9 @@ public class MQTask implements InitializingBean {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 定时拉取签收信息
|
|
|
- */
|
|
|
- @Scheduled(fixedDelay = 3_600_000, initialDelay = 3_000)//每小时执行一次
|
|
|
- public void orderCaseDate(){
|
|
|
- if (isDebug) {
|
|
|
- logger.info("debug模式,无法运行正式任务");
|
|
|
- return;
|
|
|
- }
|
|
|
- logger.info("查询订单揽件时间");
|
|
|
- List<SalesOrder> salesOrderList = salesOrderService.orderAfterCaseDate();
|
|
|
- if (salesOrderList == null || salesOrderList.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- for (SalesOrder salesOrder:salesOrderList) {
|
|
|
- // 查询订单对应的物流公司
|
|
|
- LogisticsInfo log = new LogisticsInfo();
|
|
|
- log.setLogisticsRstCode(salesOrder.getSalesPostFirm());
|
|
|
- List<LogisticsInfo> listlog = logisticsInfoService.getLogisticsInfoList(log);
|
|
|
- if(listlog.size() > 0){
|
|
|
- if(listlog.get(0).getLogisticsIsSynchronous() == 1){
|
|
|
- // 调用第三方接口查询物流信息
|
|
|
- Date date = kuaidi100.selectCourierSignCaseTime(listlog.get(0),salesOrder.getSalesPostNum());
|
|
|
- if(date == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 编辑订单的揽件时间
|
|
|
- SalesOrder so = new SalesOrder();
|
|
|
- so.setSalesId(salesOrder.getSalesId());
|
|
|
- so.setOrderCaseDate(date);
|
|
|
- if(salesOrderService.update(so) <= 0){
|
|
|
- logger.info("修改揽件时间异常,订单号:"+salesOrder.getSalesOrderId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 定时拉取小亚通订单
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
|
|
|
- @Scheduled(cron = "0 0/1 * * * ?")//每十分钟执行一次
|
|
|
+ @Scheduled(fixedDelay = 600_000, initialDelay = 60_000)
|
|
|
public void syncXytOrder(){
|
|
|
if (isDebug) {
|
|
|
logger.info("debug模式,无法运行正式任务");
|
|
@@ -468,17 +186,12 @@ public class MQTask implements InitializingBean {
|
|
|
logger.info("-----定时拉取小亚通订单-开始----");
|
|
|
Integer num = orderSyncLogService.syncXYTOrder(1,"20",null);
|
|
|
logger.info("-----定时拉取小亚通订单,拉取订单数量:"+ num +"-结束----");
|
|
|
- logger.info("-----定时拉取小亚通已发货订单");
|
|
|
- orderSyncLogService.syncXYTOrder(1,"60",null);
|
|
|
- logger.info("-----定时拉取小亚通已签收订单");
|
|
|
- orderSyncLogService.syncXYTOrder(1,"70",null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 同步拉取京东自发订单的发货单号
|
|
|
+ * 同步拉取京东自发订单的发货单号(10分钟一次)
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0/3 * * * ?")//每三分钟执行一次
|
|
|
- @Scheduled(fixedDelay = 3_600_000, initialDelay = 3_000)//每小时执行一次
|
|
|
+ @Scheduled(fixedDelay = 600_000, initialDelay = 60_000)
|
|
|
public void syncXytOrderPostNum(){
|
|
|
if (isDebug) {
|
|
|
logger.info("debug模式,无法运行正式任务");
|
|
@@ -497,9 +210,9 @@ public class MQTask implements InitializingBean {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 同步拉取京东自发订单的发货单号
|
|
|
+ * 同步拉取京东自发订单的发货单号(10分钟一次)
|
|
|
*/
|
|
|
- @Scheduled(fixedDelay = 3_600_000, initialDelay = 3_000)//每小时执行一次
|
|
|
+ @Scheduled(fixedDelay = 600_000, initialDelay = 60_000)
|
|
|
public void syncXytOrderByJd(){
|
|
|
if (isDebug) {
|
|
|
logger.info("debug模式,无法运行正式任务");
|