diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java index c11e1fb..59f85c4 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java @@ -1,5 +1,6 @@ package com.cowr.ssjygl.customer.supermarketproduct; +import com.cowr.common.Const; import com.cowr.common.base.BaseService; import com.cowr.common.view.PageParam; import com.cowr.common.view.Result; @@ -45,38 +46,9 @@ public class CustomerSupermarketProductService extends BaseService { } public List getAllSupProduct(Integer customer_id) { - List list = Db.find("select t.* from customer_supermarket_product t\n" + - " where t.customer_id = ? ", customer_id); - List sups = SupermarketService.me.list(); - - // 没有找到特殊的客户单价时,直接返回砂站原始单价 - if (!list.isEmpty()) { - Map map = new HashMap<>(); - for (Record record : list) { - int supermarket_id = record.getInt("supermarket_id"); - int product_id = record.getInt("product_id"); - - map.put(supermarket_id + "_" + product_id, record); - } - - for (Record record : sups) { - int supermarket_id = record.getInt("id"); - List products = record.get("products"); - - if (products != null && !products.isEmpty()) { - for (Record product : products) { - int product_id = product.getInt("id"); - String key = supermarket_id + "_" + product_id; - - if (map.containsKey(key)) { - product.set("unit_price", map.get(key).get("unit_price")); - } - } - } - } - } - - return sups; + return Db.find("select t.supermarket_id, t.unit_price from customer_supermarket_product t\n" + + "where t.customer_id = ? \n" + + "and t.product_id = ? ", customer_id, Const.DEFAULT_PRODUCT_ID); } public Result get(CustomerSupermarketProduct model) { diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/device/XiShuiScale.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/device/XiShuiScale.java index 88e562b..8788dc8 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/device/XiShuiScale.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/device/XiShuiScale.java @@ -71,7 +71,7 @@ public class XiShuiScale extends AbsScale { String weight = new String(Arrays.copyOfRange(buf, 4, 10)); if (!pattern.matcher(weight).matches() || weight.equals("000000")) { - log.error("error weight: %s", weight); +// log.error("error weight: %s", weight); if (errCount == 100) { break; diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductSyncService.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductSyncService.java index b556b3f..71561b6 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductSyncService.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductSyncService.java @@ -30,6 +30,12 @@ public class CustomerSupermarketProductSyncService extends BaseSyncService { CustomerSupermarketProduct old = CustomerSupermarketProduct.dao.findByIds(model.getCustomerId(), model.getSupermarketId(), model.getProductId()); + SupermarketProduct sp = SupermarketProduct.dao.findByIds(model.getSupermarketId(), model.getProductId()); + + if (sp == null) { + return Result.failed("砂站没有该品类"); + } + if (old == null) { return super.save(model, sysuser); } else {