Przeglądaj źródła

楚楚正式库该商品上传了新的图片后列表缩略图未显示新的图片

eganwu 1 rok temu
rodzic
commit
e89364a543

+ 14 - 97
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -54,7 +54,7 @@ public class Item extends Controller {
         SQLFactory sqlFactory = new SQLFactory(this, "货品档案新增");
         if (itemid <= 0) {
             itemid = createTableID("plm_item");
-            sqlList.add(DataContrlLog.createLog(this,"plm_item",itemid,"新增","新增商品"+content.getString("itemname")).getSQL());
+            sqlList.add(DataContrlLog.createLog(this, "plm_item", itemid, "新增", "新增商品" + content.getString("itemname")).getSQL());
         } else {
             if (dbConnect.runSqlQuery("SELECT 1 from plm_item WHERE itemid=" + itemid + " and siteid ='" + siteid + "'")
                     .isEmpty()) {
@@ -63,7 +63,7 @@ public class Item extends Controller {
             Rows itemRows = dbConnect.runSqlQuery("SELECT t1.*,t2.material from plm_item t1 left join plm_itemextend t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid WHERE t1.itemid=" + itemid + " and t1.siteid ='" + siteid + "'");
 
             sqlFactory = new SQLFactory(this, "货品档案更新");
-            sqlList.add(DataContrlLog.createLog(this,"plm_item",itemid,"编辑","编辑商品"+content.getString("itemname")).getSQL());
+            sqlList.add(DataContrlLog.createLog(this, "plm_item", itemid, "编辑", "编辑商品" + content.getString("itemname")).getSQL());
             if (content.getLongValue("sa_customschemeid") > 0) {
                 Rows customschemeRows = dbConnect.runSqlQuery("SELECT  t1.*,t2.schemename from sa_customscheme_items t1 left join sa_customscheme t2 on t1.sa_customschemeid=t2.sa_customschemeid and t1.siteid=t2.siteid WHERE t1.sa_customschemeid=" + content.getLongValue("sa_customschemeid") + " and  t1.siteid ='" + siteid + "'");
                 String where = " and 1=1 and t1.itemid != " + itemid + " and sa_customschemeid=" + content.getLongValue("sa_customschemeid");
@@ -482,10 +482,10 @@ public class Item extends Controller {
                 where.append(")");
             }
             if (whereObject.containsKey("itemclass") && !whereObject.getString("itemclass").isEmpty()) {
-                String itemclass=whereObject.getString("itemclass");
+                String itemclass = whereObject.getString("itemclass");
 
                 where.append(" and t1.itemid in (");
-                where.append(" SELECT t1.itemid FROM sa_itemsaleclass t1 INNER JOIN plm_itemclass t2 ON t2.itemclassid=t1.itemclassid AND t2.siteid=t1.siteid WHERE t2.itemclassname LIKE '%"+itemclass+"%' ");
+                where.append(" SELECT t1.itemid FROM sa_itemsaleclass t1 INNER JOIN plm_itemclass t2 ON t2.itemclassid=t1.itemclassid AND t2.siteid=t1.siteid WHERE t2.itemclassname LIKE '%" + itemclass + "%' ");
                 where.append(")");
             }
 
@@ -505,6 +505,7 @@ public class Item extends Controller {
         Rows defaultImageRows = getAttachmentUrl("system", (long) 1, "defaultImage");
         // 附件
         ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
+        RowsMap attRowsMapCover = getAttachmentUrl("plm_item", ids, "cover");
         RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
         // 商品领域
         RowsMap tradefieldRowsMap = beans.Item.Item.getTradefieldRowsMap(this, ids);
@@ -512,106 +513,22 @@ public class Item extends Controller {
         RowsMap brandRowsMap = Brand.getBrandRowsMap(this, ids);
         RowsMap itemclassRowsMap = ItemClass.getAllItemClassRowsMap(this, ids);
         for (Row row : rows) {
-            if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isEmpty()) {
-                row.put("attinfos", defaultImageRows);
-            } else {
+            if (attRowsMapCover.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
+                row.put("attinfos", attRowsMapCover);
+            } else if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
                 row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
+            } else {
+                row.put("attinfos", defaultImageRows);
             }
             String[] tradefield = tradefieldRowsMap.getOrDefault(row.getString("itemid"), new Rows()).toArray("tradefield");
             row.put("tradefield", StringUtils.join(tradefield, ","));
             row.put("brand", brandRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
 
             String[] itemclass = itemclassRowsMap.getOrDefault(row.getString("itemid"), new Rows()).toArray("itemclassname");
-            row.put("itemclass",  StringUtils.join(itemclass, ","));
+            row.put("itemclass", StringUtils.join(itemclass, ","));
         }
 
 
-//        if (isExport) {
-//            //去除不需要导出项
-//            rows.getFieldList().remove("itemid");
-//            rows.getFieldList().remove("marketprice");
-//            rows.getFieldList().remove("unitid");
-//            rows.getFieldList().remove("createdate");
-//            rows.getFieldList().remove("barcode");
-//            rows.getFieldList().remove("skucontrol");
-//            rows.getFieldList().remove("batchcontrol");
-//            rows.getFieldList().remove("grossweight");
-//            rows.getFieldList().remove("weight");
-//            rows.getFieldList().remove("height");
-//            rows.getFieldList().remove("width");
-//            rows.getFieldList().remove("length");
-//            rows.getFieldList().remove("delivery");
-//            rows.getFieldList().remove("istool");
-//            rows.getFieldList().remove("volume");
-//            rows.getFieldList().remove("marketingcategory");
-//            rows.getFieldList().remove("ismodule");
-//            rows.getFieldList().remove("cheek");
-//            rows.getFieldList().remove("material");
-//            rows.getFieldList().remove("iswoodproducts");
-//            rows.getFieldList().remove("financeclasstype");
-//            rows.getFieldList().remove("delistingstatus");
-//            rows.getFieldList().remove("stockno");
-//            rows.getFieldList().remove("widthschemeid");
-//            rows.getFieldList().remove("lengthschemeid");
-//            rows.getFieldList().remove("iscustomsize");
-//            rows.getFieldList().remove("customprice");
-//            rows.getFieldList().remove("auxunitid");
-//            rows.getFieldList().remove("unitgroupname");
-//            rows.getFieldList().remove("axunitname");
-//            rows.getFieldList().remove("caliber");
-//            rows.getFieldList().remove("pressure");
-//            rows.getFieldList().remove("butterflyplatedrive");
-//            rows.getFieldList().remove("valveplatematerial");
-//            rows.getFieldList().remove("bodymaterial");
-//            rows.getFieldList().remove("actuatortype");
-//            rows.getFieldList().remove("actuatorbrand");
-//            rows.getFieldList().remove("isbutterfly");
-//            rows.getFieldList().remove("erpitemno");
-//            rows.getFieldList().remove("erpitemname");
-//            rows.getFieldList().remove("specalnote");
-//            rows.getFieldList().remove("prodline");
-//            rows.getFieldList().remove("device");
-//            rows.getFieldList().remove("widthschemename");
-//            rows.getFieldList().remove("lengthschemename");
-//            rows.getFieldList().remove("brand");
-//            rows.getFieldList().remove("connection");
-//            rows.getFieldList().remove("siteid");
-//            rows.getFieldList().remove("createby");
-//            rows.getFieldList().remove("changeuserid");
-//            rows.getFieldList().remove("changeby");
-//            rows.getFieldList().remove("changedate");
-//            rows.getFieldList().remove("isauxunit");
-//            rows.getFieldList().remove("unitgroupid");
-//
-//            rows.getFieldList().remove("status");
-//            rows.getFieldList().remove("orderminqty_auxunit");
-//            rows.getFieldList().remove("orderaddqty_auxunit");
-//            rows.getFieldList().remove("checkby");
-//            rows.getFieldList().remove("checkdate");
-//            rows.getFieldList().remove("onsaledate");
-//            rows.getFieldList().remove("onsaleby");
-//            rows.getFieldList().remove("remarks");
-//            rows.getFieldList().remove("standards");
-//            rows.getFieldList().remove("stockstatus2");
-//            rows.getFieldList().remove("stockstatus1");
-//            rows.getFieldList().remove("warrantyday");
-//            rows.getFieldList().remove("iswuliao");
-//            rows.getFieldList().remove("isservice");
-//            rows.getFieldList().remove("sa_agentsid");
-//            rows.getFieldList().remove("sa_customschemeid");
-//            rows.getFieldList().remove("k3outcode");
-//            rows.getFieldList().remove("description");
-//            rows.getFieldList().remove("price1");
-//            rows.getFieldList().remove("price2");
-//            rows.getFieldList().remove("price3");
-//            rows.getFieldList().remove("price4");
-//            rows.getFieldList().remove("price5");
-//
-//
-//            Rows uploadRows = uploadExcelToObs("item", "商品列表", rows, getTitleMap());
-//            return getSucReturnObject().setData(uploadRows).toString();
-//        }
-
         return getSucReturnObject().setData(rows).toString();
     }
 
@@ -770,9 +687,9 @@ public class Item extends Controller {
 
                 }
 
-                sqlList.add(DataContrlLog.createLog(this,"plm_item",id,"反审核","反审核失败").getSQL());
-            }else{
-                sqlList.add(DataContrlLog.createLog(this,"plm_item",id,"审核","审核成功").getSQL());
+                sqlList.add(DataContrlLog.createLog(this, "plm_item", id, "反审核", "反审核失败").getSQL());
+            } else {
+                sqlList.add(DataContrlLog.createLog(this, "plm_item", id, "审核", "审核成功").getSQL());
             }
 
             sqlList.add(sqlFactory.getSQL());