|
@@ -6,11 +6,21 @@ import java.util.Map;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.erp.domain.ErpDeliverys;
|
|
|
+import com.fs.erp.domain.ErpOrderQuery;
|
|
|
+import com.fs.erp.dto.ErpOrderQueryRequert;
|
|
|
+import com.fs.erp.dto.ErpOrderQueryResponse;
|
|
|
+import com.fs.erp.service.IErpOrderService;
|
|
|
+import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.FsStoreOrder;
|
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
|
import com.fs.his.service.IFsExpressService;
|
|
|
+import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.live.enums.LiveOrderCancleReason;
|
|
|
+import com.fs.live.vo.LiveGoodsVo;
|
|
|
+import com.fs.live.vo.LiveOrderVo;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -49,6 +59,17 @@ public class LiveOrderController extends BaseController
|
|
|
@Autowired
|
|
|
private IFsExpressService expressService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ConfigUtil configUtil;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("erpOrderServiceImpl")
|
|
|
+ private IErpOrderService gyOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("wdtErpOrderServiceImpl")
|
|
|
+ private IErpOrderService wdtOrderService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询订单列表
|
|
|
*/
|
|
@@ -84,6 +105,7 @@ public class LiveOrderController extends BaseController
|
|
|
return AjaxResult.success(liveOrderService.selectLiveOrderByOrderId(orderId));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 新增订单
|
|
|
*/
|
|
@@ -166,5 +188,81 @@ public class LiveOrderController extends BaseController
|
|
|
return R.ok().put("reason",allCodeDescMap).put("data",byId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 按照时间粒度返回订单
|
|
|
+ * */
|
|
|
+ @GetMapping(value = "/getLiveOrderTimeGranularity")
|
|
|
+ public R getLiveOrderTimeGranularity(LiveOrderVo liveOrder){
|
|
|
+ return liveOrderService.getLiveOrderTimeGranularity(liveOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Log(title = "同步物流", businessType = BusinessType.UPDATE)
|
|
|
+ @GetMapping(value = "/syncExpress/{id}")
|
|
|
+ public R syncExpress(@PathVariable("id") Long id) {
|
|
|
+ return liveOrderService.syncExpress(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Log(title = "同步管易物流单号", businessType = BusinessType.UPDATE)
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:storeOrder:updateErpOrder')")
|
|
|
+ @PostMapping("/updateErpOrder")
|
|
|
+ public R updateErpOrder( @RequestBody LiveOrder param) {
|
|
|
+ LiveOrder order = liveOrderService.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
|
|
|
+ ErpOrderQueryRequert request = new ErpOrderQueryRequert();
|
|
|
+ IErpOrderService erpOrderService = getErpService();
|
|
|
+ request.setCode(order.getExtendOrderId());
|
|
|
+ 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())){
|
|
|
+ //更新商订单状态
|
|
|
+ liveOrderService.updateDeliveryOrder(param.getOrderId(), delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name());
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.error("未查询到快递信息");
|
|
|
+ }
|
|
|
+ private IErpOrderService getErpService() {
|
|
|
+ FsSysConfig sysConfig = configUtil.getSysConfig();
|
|
|
+ Integer erpOpen = sysConfig.getErpOpen();
|
|
|
+ if (erpOpen != null && erpOpen == 1){
|
|
|
+ //判断erp类型
|
|
|
+ Integer erpType = sysConfig.getErpType();
|
|
|
+ if (erpType != null){
|
|
|
+ IErpOrderService erpOrderService = null;
|
|
|
+ if (erpType == 1){
|
|
|
+ //管易
|
|
|
+ erpOrderService = gyOrderService;
|
|
|
+ } else if (erpType == 2){
|
|
|
+ //旺店通
|
|
|
+ erpOrderService = wdtOrderService;
|
|
|
+ }
|
|
|
+ return erpOrderService;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询订单商品列表
|
|
|
+ */
|
|
|
+
|
|
|
+ @GetMapping("/ltemlist/{orderId}")
|
|
|
+ public TableDataInfo ltemlist(@PathVariable("orderId") String orderId)
|
|
|
+ {
|
|
|
+ List<LiveGoodsVo> list = liveOrderService.selectLiveOrderItemList(orderId);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|