|
|
@@ -24,7 +24,7 @@ import java.util.Map;
|
|
|
@RequestMapping("/app/live/coupon")
|
|
|
public class LiveCouponController extends AppBaseController {
|
|
|
|
|
|
- private static final String DEFAULT_EXCEL_RELATIVE_PATH = "myfile/悦享生活-聚水潭发货,商城待发货.xlsx";
|
|
|
+ private static final String DEFAULT_EXCEL_RELATIVE_PATH = "myfile/悦选订单,未回传商城1.xlsx";
|
|
|
|
|
|
@Autowired
|
|
|
private ILiveCouponService liveCouponService;
|
|
|
@@ -65,47 +65,47 @@ public class LiveCouponController extends AppBaseController {
|
|
|
return liveCouponService.curCoupon(coupon);
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 读取 Excel「平台订单号」,用指定聚水潭店铺查询并发货回传。
|
|
|
-// * 商城走 StoreTask.deliveryOp 同款逻辑,直播走 LiveTask.deliveryOp 同款逻辑。
|
|
|
-// *
|
|
|
-// * 用法1(默认读项目 myfile 下 Excel):
|
|
|
-// * GET /app/live/coupon/syncJstDeliveryFromExcel?shopCode=20486972
|
|
|
-// *
|
|
|
-// * 用法2(指定文件路径):
|
|
|
-// * GET /app/live/coupon/syncJstDeliveryFromExcel?filePath=C:/mycode/ffhx-new/myfile/悦享生活-聚水潭发货,商城待发货.xlsx
|
|
|
-// *
|
|
|
-// * 用法3(上传 Excel):
|
|
|
-// * POST /app/live/coupon/syncJstDeliveryFromExcel form-data: file=xxx.xlsx, shopCode=20486972
|
|
|
-// */
|
|
|
-// @GetMapping("/syncJstDeliveryFromExcel")
|
|
|
-// public R syncJstDeliveryFromExcel(
|
|
|
-// @RequestParam(value = "filePath", required = false) String filePath,
|
|
|
-// @RequestParam(value = "resultFilePath", required = false) String resultFilePath,
|
|
|
-// @RequestParam(value = "shopCode", defaultValue = "20486972") String shopCode) throws Exception {
|
|
|
-// String resolvedPath = resolveExcelPath(filePath);
|
|
|
-// Map<String, Object> result = jstExcelDeliveryBatchService.syncFromExcelPath(resolvedPath, shopCode,
|
|
|
-// resultFilePath);
|
|
|
-// return R.ok(result);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/syncJstDeliveryFromExcel")
|
|
|
-// public R syncJstDeliveryFromExcelUpload(
|
|
|
-// @RequestParam(value = "file", required = false) MultipartFile file,
|
|
|
-// @RequestParam(value = "filePath", required = false) String filePath,
|
|
|
-// @RequestParam(value = "resultFilePath", required = false) String resultFilePath,
|
|
|
-// @RequestParam(value = "shopCode", defaultValue = "20486972") String shopCode) throws Exception {
|
|
|
-// Map<String, Object> result;
|
|
|
-// if (file != null && !file.isEmpty()) {
|
|
|
-// result = jstExcelDeliveryBatchService.syncFromExcel(file.getInputStream(), shopCode,
|
|
|
-// file.getOriginalFilename(), resultFilePath);
|
|
|
-// } else {
|
|
|
-// result = jstExcelDeliveryBatchService.syncFromExcelPath(resolveExcelPath(filePath), shopCode,
|
|
|
-// resultFilePath);
|
|
|
-// }
|
|
|
-// return R.ok(result);
|
|
|
-// }
|
|
|
-//
|
|
|
+ /**
|
|
|
+ * 读取 Excel「平台订单号」,用指定聚水潭店铺查询并发货回传。
|
|
|
+ * 商城走 StoreTask.deliveryOp 同款逻辑,直播走 LiveTask.deliveryOp 同款逻辑。
|
|
|
+ *
|
|
|
+ * 用法1(默认读项目 myfile 下 Excel):
|
|
|
+ * GET /app/live/coupon/syncJstDeliveryFromExcel?shopCode=20486972
|
|
|
+ *
|
|
|
+ * 用法2(指定文件路径):
|
|
|
+ * GET /app/live/coupon/syncJstDeliveryFromExcel?filePath=C:/mycode/ffhx-new/myfile/悦享生活-聚水潭发货,商城待发货.xlsx
|
|
|
+ *
|
|
|
+ * 用法3(上传 Excel):
|
|
|
+ * POST /app/live/coupon/syncJstDeliveryFromExcel form-data: file=xxx.xlsx, shopCode=20486972
|
|
|
+ */
|
|
|
+ @GetMapping("/syncJstDeliveryFromExcel")
|
|
|
+ public R syncJstDeliveryFromExcel(
|
|
|
+ @RequestParam(value = "filePath", required = false) String filePath,
|
|
|
+ @RequestParam(value = "resultFilePath", required = false) String resultFilePath,
|
|
|
+ @RequestParam(value = "shopCode", defaultValue = "20486972") String shopCode) throws Exception {
|
|
|
+ String resolvedPath = resolveExcelPath(filePath);
|
|
|
+ Map<String, Object> result = jstExcelDeliveryBatchService.syncFromExcelPath(resolvedPath, shopCode,
|
|
|
+ resultFilePath);
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/syncJstDeliveryFromExcel")
|
|
|
+ public R syncJstDeliveryFromExcelUpload(
|
|
|
+ @RequestParam(value = "file", required = false) MultipartFile file,
|
|
|
+ @RequestParam(value = "filePath", required = false) String filePath,
|
|
|
+ @RequestParam(value = "resultFilePath", required = false) String resultFilePath,
|
|
|
+ @RequestParam(value = "shopCode", defaultValue = "20486972") String shopCode) throws Exception {
|
|
|
+ Map<String, Object> result;
|
|
|
+ if (file != null && !file.isEmpty()) {
|
|
|
+ result = jstExcelDeliveryBatchService.syncFromExcel(file.getInputStream(), shopCode,
|
|
|
+ file.getOriginalFilename(), resultFilePath);
|
|
|
+ } else {
|
|
|
+ result = jstExcelDeliveryBatchService.syncFromExcelPath(resolveExcelPath(filePath), shopCode,
|
|
|
+ resultFilePath);
|
|
|
+ }
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 诊断指定订单为何未聚水潭发货回传(默认只查原因不写库,逻辑对齐 StoreTask.deliveryOp / LiveTask.deliveryOp)。
|
|
|
*
|
|
|
@@ -136,4 +136,10 @@ public class LiveCouponController extends AppBaseController {
|
|
|
// return workspacePath.toString();
|
|
|
// }
|
|
|
|
|
|
+ private String resolveExcelPath(String filePath) {
|
|
|
+ if (filePath != null && !filePath.trim().isEmpty()) {
|
|
|
+ return filePath.trim();
|
|
|
+ }
|
|
|
+ return DEFAULT_EXCEL_RELATIVE_PATH;
|
|
|
+ }
|
|
|
}
|