|
|
@@ -56,9 +56,9 @@ public class ErpShopController {
|
|
|
@RequirePermission("erp:shop:bind")
|
|
|
@Log(module = "ERP店铺管理", operation = OperationType.UPDATE, summary = "绑定ERP店铺")
|
|
|
@PostMapping("/bind")
|
|
|
- public Result<Void> bind(@RequestBody Map<String, Long> params) {
|
|
|
- Long deviceId = params.get("deviceId");
|
|
|
- Long erpShopId = params.get("erpShopId");
|
|
|
+ public Result<Void> bind(@RequestBody Map<String, Object> params) {
|
|
|
+ Long deviceId = toLong(params.get("deviceId"));
|
|
|
+ Long erpShopId = toLong(params.get("erpShopId"));
|
|
|
if (deviceId == null || erpShopId == null) {
|
|
|
return Result.error("deviceId 和 erpShopId 不能为空");
|
|
|
}
|
|
|
@@ -72,8 +72,8 @@ public class ErpShopController {
|
|
|
@RequirePermission("erp:shop:bind")
|
|
|
@Log(module = "ERP店铺管理", operation = OperationType.UPDATE, summary = "解绑ERP店铺")
|
|
|
@PostMapping("/unbind")
|
|
|
- public Result<Void> unbind(@RequestBody Map<String, Long> params) {
|
|
|
- Long deviceId = params.get("deviceId");
|
|
|
+ public Result<Void> unbind(@RequestBody Map<String, Object> params) {
|
|
|
+ Long deviceId = toLong(params.get("deviceId"));
|
|
|
if (deviceId == null) {
|
|
|
return Result.error("deviceId 不能为空");
|
|
|
}
|
|
|
@@ -81,6 +81,13 @@ public class ErpShopController {
|
|
|
return Result.success("解绑成功");
|
|
|
}
|
|
|
|
|
|
+ /** Long 精度统一处理:前端可能传 Number 或 String */
|
|
|
+ private Long toLong(Object val) {
|
|
|
+ if (val == null) return null;
|
|
|
+ if (val instanceof Number) return ((Number) val).longValue();
|
|
|
+ return Long.parseLong(val.toString());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 批量修改允许绑定标识
|
|
|
*/
|
|
|
@@ -88,9 +95,11 @@ public class ErpShopController {
|
|
|
@Log(module = "ERP店铺管理", operation = OperationType.UPDATE, summary = "批量修改允许绑定标识")
|
|
|
@PostMapping("/batch-bind-enabled")
|
|
|
public Result<Integer> batchUpdateBindEnabled(@RequestBody Map<String, Object> params) {
|
|
|
+ // erpShopId 是 Long 类型,前端 JSON 可能以字符串传递(精度问题),统一转 Long
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- List<Long> erpShopIds = ((List<Number>) params.get("erpShopIds")).stream()
|
|
|
- .map(Number::longValue).toList();
|
|
|
+ List<Long> erpShopIds = ((List<?>) params.get("erpShopIds")).stream()
|
|
|
+ .map(o -> o instanceof Number ? ((Number) o).longValue() : Long.parseLong(o.toString()))
|
|
|
+ .toList();
|
|
|
Integer bindEnabled = (Integer) params.get("bindEnabled");
|
|
|
if (erpShopIds == null || erpShopIds.isEmpty() || bindEnabled == null) {
|
|
|
return Result.error("参数不能为空");
|