|
@@ -1,12 +1,11 @@
|
|
|
package com.fs.task;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.fs.common.annotation.QuartzRunnable;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
-import com.fs.company.service.ICompanyService;
|
|
|
import com.fs.core.security.SecurityUtils;
|
|
|
import com.fs.erp.domain.ErpDeliverys;
|
|
|
import com.fs.erp.domain.ErpGoods;
|
|
@@ -14,15 +13,10 @@ import com.fs.erp.domain.ErpOrderQuery;
|
|
|
import com.fs.erp.dto.*;
|
|
|
import com.fs.erp.service.IErpGoodsService;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
-import com.fs.pay.pay.domain.OrderResult;
|
|
|
-import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
|
-import com.fs.pay.pay.service.PayService;
|
|
|
import com.fs.store.config.StoreConfig;
|
|
|
import com.fs.store.domain.*;
|
|
|
-import com.fs.store.dto.ExpressInfoDTO;
|
|
|
import com.fs.store.dto.StoreProductGroupDTO;
|
|
|
import com.fs.store.enums.OrderLogEnum;
|
|
|
-import com.fs.store.enums.ShipperCodeEnum;
|
|
|
import com.fs.store.mapper.*;
|
|
|
import com.fs.store.param.*;
|
|
|
import com.fs.store.service.*;
|
|
@@ -68,8 +62,6 @@ public class StoreTask {
|
|
|
@Autowired
|
|
|
private IErpOrderService erpOrderService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private PayService ybPayService;
|
|
|
@Autowired
|
|
|
private FsStoreOrderMapper fsStoreOrderMapper;
|
|
|
|
|
@@ -79,12 +71,6 @@ public class StoreTask {
|
|
|
@Autowired
|
|
|
private IFsStoreOrderItemService storeOrderItemService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private FsStorePaymentMapper fsStorePaymentMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IErpGoodsService goodsService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private FsUserTuiMoneyRankMapper fsUserTuiMoneyRankMapper;
|
|
|
|
|
@@ -100,16 +86,6 @@ public class StoreTask {
|
|
|
@Autowired
|
|
|
private IFsStoreProductGroupService storeProductGroupService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IFsExpressService expressService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private FsStorePaymentMapper paymentMapper;
|
|
|
- @Autowired
|
|
|
- private IFsStorePaymentService fsStorePaymentService;
|
|
|
- @Autowired
|
|
|
- private ICompanyService companyService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private IFsStoreAfterSalesService fsStoreAfterSalesService;
|
|
|
|
|
@@ -122,19 +98,10 @@ public class StoreTask {
|
|
|
@Autowired
|
|
|
private IFsStoreOrderStatusService orderStatusService;
|
|
|
|
|
|
- public void tt() {
|
|
|
- ErpGoodsStockQueryRequert request = new ErpGoodsStockQueryRequert();
|
|
|
- request.setBarcode("105201");
|
|
|
- ErpGoodsStockQueryResponse response = goodsService.getGoodsStock(request);
|
|
|
- ErpGoodsQueryRequert erpGoodsQueryRequert = new ErpGoodsQueryRequert();
|
|
|
- erpGoodsQueryRequert.setCode("105201");
|
|
|
- ErpGoodsQueryResponse goods = goodsService.getGoods(erpGoodsQueryRequert);
|
|
|
-
|
|
|
- System.out.println(goods);
|
|
|
- System.out.println(response);
|
|
|
- }
|
|
|
-
|
|
|
- //每5分钟执行一次
|
|
|
+ /**
|
|
|
+ * 发货任务
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "发货任务")
|
|
|
public void deliveryOp() {
|
|
|
Set<String> orders = redisTemplate.keys(DELIVERY + ":*");
|
|
|
for (String extndOrderId : orders) {
|
|
@@ -169,7 +136,10 @@ public class StoreTask {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 佣金排行榜
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "佣金排行榜")
|
|
|
public void addUserTuiMoneyRank() {
|
|
|
List<FsUserShareVO> fsUserShareVOS1 = fsUserTuiMoneyRankMapper.selectFsUserTuiMoneyRankByType(1);
|
|
|
fsUserTuiMoneyRankMapper.deleteFsUserTuiMoneyRankByType(1);
|
|
@@ -227,7 +197,10 @@ public class StoreTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 更新商品成本价
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "更新商品成本价")
|
|
|
public void storeProdUpdateCostPrice() {
|
|
|
String json = configService.selectConfigByKey("store.config");
|
|
|
StoreConfig config = JSONUtil.toBean(json, StoreConfig.class);
|
|
@@ -300,13 +273,20 @@ public class StoreTask {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 优惠券过期处理
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "优惠券过期处理")
|
|
|
public void couponOp() {
|
|
|
couponUserService.updateFsCouponByExpire();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- //退款自动处理 24小时未审核自动审核通过 每小时执行一次
|
|
|
+ /**
|
|
|
+ * 退款自动处理 24小时未审核自动审核通过 每小时执行一次
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "退款自动处理")
|
|
|
public void refundOp() {
|
|
|
//获取所有退款申请
|
|
|
List<FsStoreAfterSales> list = afterSalesService.selectFsStoreAfterSalesByDoAudit();
|
|
@@ -324,7 +304,10 @@ public class StoreTask {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //每天执行一次
|
|
|
+ /**
|
|
|
+ * 订单完成7天后会员分佣
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "订单完成7天后会员分佣")
|
|
|
public void userMoneyOp() {
|
|
|
List<FsStoreOrder> list = orderService.selectFsStoreOrderListByFinish7Day();
|
|
|
if (list != null) {
|
|
@@ -335,7 +318,10 @@ public class StoreTask {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //每30秒执行一次
|
|
|
+ /**
|
|
|
+ * 订单Items同步
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "订单Items同步")
|
|
|
public void orderItemSyncOp() {
|
|
|
List<FsStoreOrder> list = fsStoreOrderService.selectFsStoreOrderItemJson();
|
|
|
for (FsStoreOrder storeOrder : list) {
|
|
@@ -350,66 +336,12 @@ public class StoreTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void returnDeliveryId() {
|
|
|
- List<String> list = fsStoreOrderMapper.selectErpCode();
|
|
|
- for (String s : list) {
|
|
|
- ErpOrderQueryRequert request = new ErpOrderQueryRequert();
|
|
|
- request.setCode(s);
|
|
|
- ErpOrderQueryResponse response = erpOrderService.getOrder(request);
|
|
|
- if (response.getOrders() != null && response.getOrders().size() > 0) {
|
|
|
- for (ErpOrderQuery orderQuery : response.getOrders()) {
|
|
|
- if (orderQuery.getDeliverys() != null && orderQuery.getDeliverys().size() > 0) {
|
|
|
- for (ErpDeliverys delivery : orderQuery.getDeliverys()) {
|
|
|
- if (delivery.getDelivery() && StringUtils.isNotEmpty(delivery.getMail_no())) {
|
|
|
- FsStoreOrder order = new FsStoreOrder();
|
|
|
- order.setExtendOrderId(s);
|
|
|
- order.setDeliveryId(delivery.getMail_no());
|
|
|
- order.setStatus(2);
|
|
|
- fsStoreOrderMapper.updateDelivery(order);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public void changeStatus() {
|
|
|
- List<Long> list = fsStoreOrderMapper.selectOrderId();
|
|
|
- for (Long orderId : list) {
|
|
|
- FsStoreOrder order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
|
|
|
- String lastFourNumber = "";
|
|
|
- if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
|
|
|
- lastFourNumber = order.getUserPhone();
|
|
|
- if (lastFourNumber.length() == 11) {
|
|
|
- lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
- }
|
|
|
- }
|
|
|
- ExpressInfoDTO dto = expressService.getExpressInfo(order.getOrderCode(), order.getDeliverySn(), order.getDeliveryId(), lastFourNumber);
|
|
|
- FsStoreOrder map = new FsStoreOrder();
|
|
|
- map.setDeliveryStatus(Integer.parseInt(dto.getState()));
|
|
|
- map.setId(order.getId());
|
|
|
- map.setDeliveryType(dto.getStateEx());
|
|
|
- fsStoreOrderMapper.updateFsStoreOrder(map);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void subCompanyMoney() {
|
|
|
- List<Long> list = paymentMapper.selectPaymentIds();
|
|
|
- for (Long paymentId : list) {
|
|
|
- FsStorePayment payment = fsStorePaymentService.selectFsStorePaymentById(paymentId);
|
|
|
- if (payment.getCompanyId() != null && payment.getCompanyId() > 0) {
|
|
|
- companyService.subCompanyPaymentMoney(payment);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量推管易
|
|
|
+ * @throws ParseException 解析异常
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "批量推管易")
|
|
|
public void updateOrderItem() throws ParseException {
|
|
|
List<Long> ids = itemMapper.selectOrderIdByNoErp();
|
|
|
for (Long id : ids) {
|
|
@@ -418,7 +350,10 @@ public class StoreTask {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //每天执行一次
|
|
|
+ /**
|
|
|
+ * 同步物流状态
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "同步物流状态")
|
|
|
public void syncExpress() {
|
|
|
List<Long> ids = fsStoreOrderMapper.selectSyncExpressIds();
|
|
|
|
|
@@ -430,31 +365,11 @@ public class StoreTask {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void returnPayStatus() {
|
|
|
- List<String> ids = fsStorePaymentMapper.selectPayStatusIds();
|
|
|
- for (String id : ids) {
|
|
|
- OrderQueryDTO o = new OrderQueryDTO();
|
|
|
- o.setUpOrderId(id);
|
|
|
- OrderResult orderResult = ybPayService.getOrder(o);
|
|
|
- if ("0".equals(orderResult.getState())) {
|
|
|
- String[] order = orderResult.getLowOrderId().split("-");
|
|
|
- if (orderResult.getStatus().equals("100")) {
|
|
|
- switch (order[0]) {
|
|
|
- case "store":
|
|
|
- orderService.payConfirm(1, null, order[1], o.getUpOrderId(), orderResult.getBankTrxId(), orderResult.getBankOrderId());
|
|
|
- case "store_remain":
|
|
|
- orderService.payRemainConfirm(order[1], o.getUpOrderId(), orderResult.getBankTrxId(), orderResult.getBankOrderId());
|
|
|
- case "payment":
|
|
|
- fsStorePaymentService.payConfirm(order[1], o.getUpOrderId(), orderResult.getBankTrxId(), orderResult.getBankOrderId());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量分佣
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "批量分佣")
|
|
|
public void AddTuiMoney() {
|
|
|
List<Long> ids = fsStoreOrderMapper.selectAddTuiMoney();
|
|
|
for (Long id : ids) {
|
|
@@ -487,6 +402,10 @@ public class StoreTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检测弱密码
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "检测弱密码")
|
|
|
public void updateCompanyUserStatus() {
|
|
|
CompanyUser user = new CompanyUser();
|
|
|
user.setStatus("0");
|
|
@@ -501,6 +420,10 @@ public class StoreTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新发货状态
|
|
|
+ */
|
|
|
+ @QuartzRunnable(name = "发货任务")
|
|
|
public void updateExpress() {
|
|
|
List<FsStoreOrder> list = fsStoreOrderMapper.selectUpdateExpress();
|
|
|
for (FsStoreOrder order : list) {
|