|
|
@@ -14,8 +14,10 @@ import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
|
|
|
import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.b2c.trade.order.dao.OrderDao;
|
|
|
import com.uas.platform.b2c.trade.order.model.Order;
|
|
|
+import com.uas.platform.b2c.trade.order.model.Purchase;
|
|
|
import com.uas.platform.b2c.trade.order.model.StatusHistory;
|
|
|
import com.uas.platform.b2c.trade.order.service.OrderService;
|
|
|
+import com.uas.platform.b2c.trade.order.service.PurchaseService;
|
|
|
import com.uas.platform.b2c.trade.presale.dao.TradeBasicPropertiesDao;
|
|
|
import com.uas.platform.b2c.trade.rate.service.RateService;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
@@ -45,6 +47,8 @@ public class RateTask {
|
|
|
|
|
|
private final OrderService orderService;
|
|
|
|
|
|
+ private final PurchaseService purchaseService;
|
|
|
+
|
|
|
private final TradeBasicPropertiesDao tradeBasicPropertiesDao;
|
|
|
|
|
|
private final UserDao userDao;
|
|
|
@@ -59,9 +63,10 @@ public class RateTask {
|
|
|
private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
|
|
|
@Autowired
|
|
|
- public RateTask(OrderDao orderDao, OrderService orderService, TradeBasicPropertiesDao tradeBasicPropertiesDao, UserDao userDao, SysConf sysConf, EnterpriseDao enterpriseDao, RateService rateService) {
|
|
|
+ public RateTask(OrderDao orderDao, OrderService orderService,PurchaseService purchaseService, TradeBasicPropertiesDao tradeBasicPropertiesDao, UserDao userDao, SysConf sysConf, EnterpriseDao enterpriseDao, RateService rateService) {
|
|
|
this.orderDao = orderDao;
|
|
|
this.orderService = orderService;
|
|
|
+ this.purchaseService = purchaseService;
|
|
|
this.tradeBasicPropertiesDao = tradeBasicPropertiesDao;
|
|
|
this.userDao = userDao;
|
|
|
this.sysConf = sysConf;
|
|
|
@@ -117,7 +122,7 @@ public class RateTask {
|
|
|
shipTime.setMinutes(0);
|
|
|
shipTime.setSeconds(0);
|
|
|
if(compareTimeIsGigger24Hours(time, shipTime)) {
|
|
|
- ids = ids + order.getId() + "-";
|
|
|
+ ids = ids + order.getOrderid() + "-";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -128,12 +133,13 @@ public class RateTask {
|
|
|
rateService.autosavebuyerRate(ids);
|
|
|
}
|
|
|
logger.log("自动初评", "买家自动初评订单:" + ids);
|
|
|
+ autoVendorRate(automaticReceipt);
|
|
|
}catch (Exception e) {
|
|
|
} finally {
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
- * 对超过追评时间的订单,自动初评
|
|
|
+ * 对超过追评时间的订单,自动追评
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void autoAfterRate() {
|
|
|
@@ -179,7 +185,7 @@ public class RateTask {
|
|
|
shipTime.setMinutes(0);
|
|
|
shipTime.setSeconds(0);
|
|
|
if(compareTimeIsGigger24Hours(time, shipTime)) {
|
|
|
- ids = ids + order.getId() + "-";
|
|
|
+ ids = ids + order.getOrderid() + "-";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -189,11 +195,53 @@ public class RateTask {
|
|
|
rateService.autosaveAfterbuyerRate(ids);
|
|
|
}
|
|
|
logger.log("自动追评", "买家自动追加评价:" + ids);
|
|
|
+ autoVendorRate(automaticReceipt);
|
|
|
}catch (Exception e) {
|
|
|
} finally {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 卖家的自动评价操作
|
|
|
+ * @param automaticReceipt
|
|
|
+ */
|
|
|
+ private void autoVendorRate(Integer automaticReceipt) {
|
|
|
+ try {
|
|
|
+ //采购单的自动初评
|
|
|
+ List<Purchase> purchasesList = purchaseService.findByStatus(Status.COMPLETED.value());
|
|
|
+ String pids = "-";
|
|
|
+ for (Purchase purchase : purchasesList) {
|
|
|
+ List<StatusHistory> statusHistories = FastjsonUtils.fromJsonArray(purchase.getStatushistory(), StatusHistory.class);
|
|
|
+ for (int i = statusHistories.size() - 1; i > 0 ; i--) {
|
|
|
+ StatusHistory statusHistory = statusHistories.get(i);
|
|
|
+ if(statusHistory.getStatus().intValue() == Status.COMPLETED.value()) {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ Date date = new Date();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - automaticReceipt);
|
|
|
+ Date time = calendar.getTime();
|
|
|
+ time.setHours(0);
|
|
|
+ time.setMinutes(0);
|
|
|
+ time.setSeconds(0);
|
|
|
+ Date shipTime = statusHistory.getTime();
|
|
|
+ shipTime.setHours(0);
|
|
|
+ shipTime.setMinutes(0);
|
|
|
+ shipTime.setSeconds(0);
|
|
|
+ if(compareTimeIsGigger24Hours(time, shipTime)) {
|
|
|
+ pids = pids + purchase.getPurchaseid() + "-";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if(pids.length() > 1) {
|
|
|
+ pids = pids.substring(1, pids.length() - 1);
|
|
|
+ rateService.autosaveVendorRate(pids);
|
|
|
+ }
|
|
|
+ logger.log("自动初评", "卖家自动初评订单:" + pids);
|
|
|
+ }catch (Exception e){}
|
|
|
+ finally {}
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 比较日期的大小(只比较年、月、日),,相隔的时间是否超过24小时
|