|
|
@@ -1,11 +1,13 @@
|
|
|
package com.uas.platform.b2c.trade.order.task;
|
|
|
|
|
|
+import com.uas.message.mail.service.MailService;
|
|
|
import com.uas.message.sms.service.SmsService;
|
|
|
import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
|
|
|
import com.uas.platform.b2c.common.account.dao.UserDao;
|
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
import com.uas.platform.b2c.common.account.model.User;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
|
+import com.uas.platform.b2c.core.constant.SplitChar;
|
|
|
import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
|
|
|
import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
@@ -18,15 +20,16 @@ import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
import com.uas.platform.core.model.Status;
|
|
|
import com.uas.platform.core.model.Type;
|
|
|
+import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 订单的一些自动任务
|
|
|
@@ -51,21 +54,23 @@ public class OrderTask {
|
|
|
|
|
|
private final SmsService smsService;
|
|
|
|
|
|
+ private final MailService mailService;
|
|
|
+
|
|
|
private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
|
|
|
/**
|
|
|
* Instantiates a new Order task.
|
|
|
- *
|
|
|
- * @param orderDao the order dao
|
|
|
+ * @param orderDao the order dao
|
|
|
* @param orderService the order service
|
|
|
- * @param tradeBasicPropertiesDao the trade basic properties dao
|
|
|
- * @param userDao the user dao
|
|
|
- * @param sysConf the sys conf
|
|
|
- * @param enterpriseDao the enterprise dao
|
|
|
- * @param smsService the sms service
|
|
|
- */
|
|
|
+ * @param tradeBasicPropertiesDao the trade basic properties dao
|
|
|
+ * @param userDao the user dao
|
|
|
+ * @param sysConf the sys conf
|
|
|
+ * @param enterpriseDao the enterprise dao
|
|
|
+ * @param smsService the sms service
|
|
|
+ * @param mailService
|
|
|
+ */
|
|
|
@Autowired
|
|
|
- public OrderTask(OrderDao orderDao, OrderService orderService, TradeBasicPropertiesDao tradeBasicPropertiesDao, UserDao userDao, SysConf sysConf, EnterpriseDao enterpriseDao, SmsService smsService) {
|
|
|
+ public OrderTask(OrderDao orderDao, OrderService orderService, TradeBasicPropertiesDao tradeBasicPropertiesDao, UserDao userDao, SysConf sysConf, EnterpriseDao enterpriseDao, SmsService smsService, MailService mailService) {
|
|
|
this.orderDao = orderDao;
|
|
|
this.orderService = orderService;
|
|
|
this.tradeBasicPropertiesDao = tradeBasicPropertiesDao;
|
|
|
@@ -73,12 +78,12 @@ public class OrderTask {
|
|
|
this.sysConf = sysConf;
|
|
|
this.enterpriseDao = enterpriseDao;
|
|
|
this.smsService = smsService;
|
|
|
+ this.mailService = mailService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 对超过收货时间的订单,自动确认收货
|
|
|
*/
|
|
|
- @Transactional
|
|
|
public void autoConfirmOrderRevice() {
|
|
|
try {
|
|
|
User user = null;
|
|
|
@@ -129,10 +134,26 @@ public class OrderTask {
|
|
|
}
|
|
|
if(ids.length() > 1) {
|
|
|
ids = ids.substring(1, ids.length() - 1);
|
|
|
- orderService.ensureOrderAccept(ids);
|
|
|
+ String[] split = ids.split(SplitChar.HYPHEN);
|
|
|
+ for (String id : split) {
|
|
|
+ try {
|
|
|
+ orderService.ensureOrderAccept(id);
|
|
|
+ }catch (Exception e) {
|
|
|
+ Map<String, Object> map = new HashedMap();
|
|
|
+ map.put("title", "自动确认收货");
|
|
|
+ map.put("error", e.toString());
|
|
|
+ mailService.send("f7be38ea-8653-4d7c-9a3d-34c3cdd089a0", "yuj@usoftchina.com", map);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
logger.log("自动收货", "买家自动收货订单:" + ids);
|
|
|
}catch (Exception e) {
|
|
|
+ Map<String, Object> map = new HashedMap();
|
|
|
+ map.put("title", "自动确认收货");
|
|
|
+ map.put("error", e.toString());
|
|
|
+ mailService.send("f7be38ea-8653-4d7c-9a3d-34c3cdd089a0", "yuj@usoftchina.com", map);
|
|
|
} finally {
|
|
|
}
|
|
|
}
|