|
|
@@ -8,8 +8,6 @@ import beans.itemprice.ItemPrice;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.huaweicloud.sdk.thirdparty.com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.FromDecimalArguments;
|
|
|
-import com.sun.org.apache.bcel.internal.generic.Select;
|
|
|
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
@@ -21,14 +19,10 @@ import common.data.RowsMap;
|
|
|
import common.data.SQLFactory;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
-import org.apache.commons.math3.util.MultidimensionalCounter;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.LinkedHashSet;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@API(title = "商品组")
|
|
|
public class itemgroup extends Controller {
|
|
|
@@ -62,51 +56,51 @@ public class itemgroup extends Controller {
|
|
|
public String queryItemgroup() throws YosException {
|
|
|
Long istool = content.getLongValue("istool");
|
|
|
//Rows itemclassRows = Enterprise.getItemSaleClasses(this, sys_enterpriseid, true, istool);
|
|
|
- if(content.containsKey("sys_enterpriseid")) {
|
|
|
- sys_enterpriseid=content.getLongValue("sys_enterpriseid");
|
|
|
+ if (content.containsKey("sys_enterpriseid")) {
|
|
|
+ sys_enterpriseid = content.getLongValue("sys_enterpriseid");
|
|
|
}
|
|
|
/*
|
|
|
* * 过滤条件设置
|
|
|
*/
|
|
|
String where = " 1=1 ";
|
|
|
String where1 = "";
|
|
|
- String itemclasssql="select itemclassid from plm_itemclass where siteid='" + siteid + "'";
|
|
|
+ String itemclasssql = "select itemclassid from plm_itemclass where siteid='" + siteid + "'";
|
|
|
if (sys_enterpriseid > 0) {
|
|
|
Row enterpriseRow = Enterprise.getEnterprise(this, sys_enterpriseid);
|
|
|
if (!enterpriseRow.isEmpty()) {
|
|
|
- //企业营销类别
|
|
|
+ //企业营销类别
|
|
|
boolean saleclassauth = enterpriseRow.getBoolean("saleclassauth");
|
|
|
if (saleclassauth) {
|
|
|
- itemclasssql ="select itemclassid from plm_itemclass where siteid='" + siteid + "' and itemclassid in ( SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "')";
|
|
|
+ itemclasssql = "select itemclassid from plm_itemclass where siteid='" + siteid + "' and itemclassid in ( SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "')";
|
|
|
}
|
|
|
//企业领域
|
|
|
- Rows tradefieldrows =dbConnect.runSqlQuery("SELECT tradefield from sys_enterprise_tradefield WHERE sys_enterpriseid ="+sys_enterpriseid+" and siteid ='"+siteid+"'" );
|
|
|
- if(!tradefieldrows.isEmpty()) {
|
|
|
- for (Row row : tradefieldrows) {
|
|
|
- where1 = where1 + " (t1.tradefield like'%" + row.getString("tradefield") + "%') or ";
|
|
|
- }
|
|
|
- }else {
|
|
|
- where1 =where1+" 1=2 ";
|
|
|
- }
|
|
|
- }else {
|
|
|
- where1 =" 1=2 ";
|
|
|
- }
|
|
|
-
|
|
|
- }else {
|
|
|
- where1 =" 1=1 ";
|
|
|
- }
|
|
|
- if(where1.contains("or")) {
|
|
|
- where1=where1.substring(0, where1.lastIndexOf("or"));
|
|
|
+ Rows tradefieldrows = dbConnect.runSqlQuery("SELECT tradefield from sys_enterprise_tradefield WHERE sys_enterpriseid =" + sys_enterpriseid + " and siteid ='" + siteid + "'");
|
|
|
+ if (!tradefieldrows.isEmpty()) {
|
|
|
+ for (Row row : tradefieldrows) {
|
|
|
+ where1 = where1 + " (t1.tradefield like'%" + row.getString("tradefield") + "%') or ";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ where1 = where1 + " 1=2 ";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ where1 = " 1=2 ";
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ where1 = " 1=1 ";
|
|
|
+ }
|
|
|
+ if (where1.contains("or")) {
|
|
|
+ where1 = where1.substring(0, where1.lastIndexOf("or"));
|
|
|
}
|
|
|
Rows itemclassRows = dbConnect.runSqlQuery(itemclasssql);
|
|
|
-
|
|
|
+
|
|
|
ArrayList<Long> itemclassList = new ArrayList<Long>();
|
|
|
for (Row row : itemclassRows) {
|
|
|
- //System.out.println(row.getLong("itemclassid"));
|
|
|
- itemclassList.add(row.getLong("itemclassid"));
|
|
|
- itemclassList.addAll(ItemClass.getSubItemClassIds(this, row.getLong("itemclassid")));
|
|
|
- }
|
|
|
-
|
|
|
+ //System.out.println(row.getLong("itemclassid"));
|
|
|
+ itemclassList.add(row.getLong("itemclassid"));
|
|
|
+ itemclassList.addAll(ItemClass.getSubItemClassIds(this, row.getLong("itemclassid")));
|
|
|
+ }
|
|
|
+
|
|
|
SQLFactory factorygroupid = new SQLFactory(this, "查询授权范围内的商品组商品");
|
|
|
factorygroupid.addParameter("siteid", siteid);
|
|
|
|
|
|
@@ -122,7 +116,7 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
if (whereObject.containsKey("tradefield") && !"".equals(whereObject.getString("tradefield"))) {
|
|
|
where = where + " and (t1.tradefield like'%" + whereObject.getString("tradefield") + "%') ";
|
|
|
- }
|
|
|
+ }
|
|
|
// else {
|
|
|
// if (sys_enterpriseid > 0) {
|
|
|
// where = where + " and (t1.tradefield in (SELECT tradefield from sys_enterprise_tradefield WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "') ) ";
|
|
|
@@ -141,29 +135,29 @@ public class itemgroup extends Controller {
|
|
|
|
|
|
} else {
|
|
|
factorygroupid.addParameter_in("itemclassid",
|
|
|
- itemclassList);
|
|
|
+ itemclassList);
|
|
|
}
|
|
|
} else {
|
|
|
factorygroupid.addParameter_in("itemclassid",
|
|
|
- itemclassList);
|
|
|
+ itemclassList);
|
|
|
}
|
|
|
|
|
|
JSONArray brandids = content.getJSONArray("brandids");
|
|
|
if (brandids.isEmpty()) {
|
|
|
- Rows rows;
|
|
|
- if(sys_enterpriseid>0) {
|
|
|
- rows= Enterprise.getBrands(this, sys_enterpriseid);
|
|
|
- }else {
|
|
|
- rows = dbConnect.runSqlQuery("select sa_brandid from sa_brand where siteid='" + siteid + "'");
|
|
|
- }
|
|
|
- if(!rows.isEmpty()) {
|
|
|
- for (Row row : rows) {
|
|
|
- brandids.add(row.getLong("sa_brandid"));
|
|
|
- }
|
|
|
- }else {
|
|
|
- brandids.add(0);
|
|
|
- }
|
|
|
-
|
|
|
+ Rows rows;
|
|
|
+ if (sys_enterpriseid > 0) {
|
|
|
+ rows = Enterprise.getBrands(this, sys_enterpriseid);
|
|
|
+ } else {
|
|
|
+ rows = dbConnect.runSqlQuery("select sa_brandid from sa_brand where siteid='" + siteid + "'");
|
|
|
+ }
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ brandids.add(row.getLong("sa_brandid"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ brandids.add(0);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
factorygroupid.addParameter("siteid", siteid);
|
|
|
@@ -181,8 +175,8 @@ public class itemgroup extends Controller {
|
|
|
String sql = factory.getSQL();
|
|
|
//System.out.println(sql);
|
|
|
Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
- ArrayList<Long> itemgroupids =rows.toArrayList("sa_itemgroupid", new ArrayList<Long>());
|
|
|
- RowsMap itemgroupScemeRowsMap = Itemgroup.getItemgroupScemeid(this,itemgroupids);
|
|
|
+ ArrayList<Long> itemgroupids = rows.toArrayList("sa_itemgroupid", new ArrayList<Long>());
|
|
|
+ RowsMap itemgroupScemeRowsMap = Itemgroup.getItemgroupScemeid(this, itemgroupids);
|
|
|
for (Row row2 : rows) {
|
|
|
ArrayList<String> list = DataTag.queryTag(this, "sa_itemgroup", row2.getLong("sa_itemgroupid"), false);
|
|
|
row2.put("tag1", JSONArray.parseArray(JSON.toJSONString(list)));
|
|
|
@@ -203,10 +197,10 @@ public class itemgroup extends Controller {
|
|
|
|
|
|
Long id = row2.getLong("sa_itemgroupid");
|
|
|
if (itemgroupScemeRowsMap.get(id.toString()).isNotEmpty()) {
|
|
|
- if(itemgroupScemeRowsMap.get(id.toString()).get(0).getLong("sa_customschemeid")>0){
|
|
|
- row2.put("isscheme",true);
|
|
|
- }else {
|
|
|
- row2.put("isscheme",false);
|
|
|
+ if (itemgroupScemeRowsMap.get(id.toString()).get(0).getLong("sa_customschemeid") > 0) {
|
|
|
+ row2.put("isscheme", true);
|
|
|
+ } else {
|
|
|
+ row2.put("isscheme", false);
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -271,9 +265,9 @@ public class itemgroup extends Controller {
|
|
|
@API(title = "商品组商品明细列表", apiversion = R.ID20220926142403.v1.class)
|
|
|
@CACHEING
|
|
|
public String queryItemgroupMxList() throws YosException {
|
|
|
- if(content.containsKey("sys_enterpriseid")) {
|
|
|
- sys_enterpriseid=content.getLongValue("sys_enterpriseid");
|
|
|
- }
|
|
|
+ if (content.containsKey("sys_enterpriseid")) {
|
|
|
+ sys_enterpriseid = content.getLongValue("sys_enterpriseid");
|
|
|
+ }
|
|
|
/*
|
|
|
* 过滤条件设置
|
|
|
*/
|
|
|
@@ -295,9 +289,9 @@ public class itemgroup extends Controller {
|
|
|
for (Row row : rows) {
|
|
|
ItemPrice itemPrice = ItemPrice.getItemPrice(this, sys_enterpriseid, row.getLong("itemid"));
|
|
|
row.put("oldprice", itemPrice.getMarketprice());
|
|
|
- if(sys_enterpriseid>0 || (usertype == 21 || usertype == 22)) {
|
|
|
- row.put("gradeprice", itemPrice.getContractprice());
|
|
|
- }else {
|
|
|
+ if (sys_enterpriseid > 0 || (usertype == 21 || usertype == 22)) {
|
|
|
+ row.put("gradeprice", itemPrice.getContractprice());
|
|
|
+ } else {
|
|
|
row.put("gradeprice", itemPrice.getMarketprice());
|
|
|
}
|
|
|
|
|
|
@@ -365,14 +359,19 @@ public class itemgroup extends Controller {
|
|
|
public String querymx() throws YosException {
|
|
|
Set<String> listParmBlank = new LinkedHashSet<String>();
|
|
|
Set<String> listParmNotBlank = new LinkedHashSet<String>();
|
|
|
- Set colorList = new LinkedHashSet();
|
|
|
- Set specList = new LinkedHashSet();
|
|
|
- Set materialList = new LinkedHashSet();
|
|
|
- Set cheekList = new LinkedHashSet();
|
|
|
- String color=content.getStringValue("color");
|
|
|
- String spec=content.getStringValue("spec");
|
|
|
- String material=content.getStringValue("material");
|
|
|
- String cheek=content.getStringValue("cheek");
|
|
|
+ Set<String> firstcolorList = new LinkedHashSet();
|
|
|
+ Set<String> firstspecList = new LinkedHashSet();
|
|
|
+ Set<String> firstmaterialList = new LinkedHashSet();
|
|
|
+ Set<String> firstcheekList = new LinkedHashSet();
|
|
|
+
|
|
|
+ Set<parm> colorList = new LinkedHashSet();
|
|
|
+ Set<parm> specList = new LinkedHashSet();
|
|
|
+ Set<parm> materialList = new LinkedHashSet();
|
|
|
+ Set<parm> cheekList = new LinkedHashSet();
|
|
|
+ String color = content.getStringValue("color");
|
|
|
+ String spec = content.getStringValue("spec");
|
|
|
+ String material = content.getStringValue("material");
|
|
|
+ String cheek = content.getStringValue("cheek");
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -384,60 +383,405 @@ public class itemgroup extends Controller {
|
|
|
factory.addParameter("siteid", siteid);
|
|
|
|
|
|
|
|
|
- Rows customschemeItems = dbConnect.runSqlQuery("select distinct value,description from sa_customscheme_items where sa_customschemeid in(select t2.sa_customschemeid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and t1.sa_itemgroupid="+content.getString("sa_itemgroupid")+")");
|
|
|
- if(!customschemeItems.isEmpty()){
|
|
|
- for (Row row:customschemeItems) {
|
|
|
+ Rows customschemeItems = dbConnect.runSqlQuery("select distinct value,description from sa_customscheme_items where sa_customschemeid in(select t2.sa_customschemeid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_itemgroupid=" + content.getString("sa_itemgroupid") + ")");
|
|
|
+ if (!customschemeItems.isEmpty()) {
|
|
|
+ for (Row row : customschemeItems) {
|
|
|
|
|
|
- if(StringUtils.isNotBlank(row.getString("value"))){
|
|
|
- if(StringUtils.isNotBlank(content.getString(row.getString("value")))){
|
|
|
+ if (StringUtils.isNotBlank(row.getString("value"))) {
|
|
|
+ if (StringUtils.isNotBlank(content.getString(row.getString("value")))) {
|
|
|
listParmNotBlank.add(row.getString("value"));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
listParmBlank.add(row.getString("value"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Set<String> listAll = new LinkedHashSet<String>();
|
|
|
+ listAll.addAll(listParmBlank);
|
|
|
+ listAll.addAll(listParmNotBlank);
|
|
|
+ factory.addParameter_SQL("where", "1=1");
|
|
|
+ rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+ for (Row row : rows) {
|
|
|
+ for (String value : listAll) {
|
|
|
+ if (value.equals("color")) {
|
|
|
+ firstcolorList.add(row.getString("color"));
|
|
|
+ } else if (value.equals("spec")) {
|
|
|
+ firstspecList.add(row.getString("spec"));
|
|
|
+ } else if (value.equals("material")) {
|
|
|
+ firstmaterialList.add(row.getString("material"));
|
|
|
+ } else if (value.equals("cheek")) {
|
|
|
+ firstcheekList.add(row.getString("cheek"));
|
|
|
+ }
|
|
|
|
|
|
- if(listParmNotBlank==null || listParmNotBlank.size()==0){
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONArray colormap = new JSONArray();
|
|
|
+ JSONArray specmap = new JSONArray();
|
|
|
+ JSONArray materialmap = new JSONArray();
|
|
|
+ JSONArray cheekmap = new JSONArray();
|
|
|
+ if (listParmNotBlank == null || listParmNotBlank.size() == 0) {
|
|
|
factory.addParameter_SQL("where", "1=1");
|
|
|
- }else {
|
|
|
+ for (Row row : rows) {
|
|
|
+ for (String value : listParmBlank) {
|
|
|
+ if (value.equals("color")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("color"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ colormap.add(jsonObject);
|
|
|
+ } else if (value.equals("spec")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("spec"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ specmap.add(jsonObject);
|
|
|
+ } else if (value.equals("material")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("material"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ materialmap.add(jsonObject);
|
|
|
+ } else if (value.equals("cheek")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("cheek"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ cheekmap.add(jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (listParmBlank == null || listParmBlank.size() == 0) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ for (String value : listParmNotBlank) {
|
|
|
+ if (value.equals("color")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("color"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ colormap.add(jsonObject);
|
|
|
+ } else if (value.equals("spec")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("spec"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ specmap.add(jsonObject);
|
|
|
+ } else if (value.equals("material")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("material"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ materialmap.add(jsonObject);
|
|
|
+ } else if (value.equals("cheek")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("cheek"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ cheekmap.add(jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String colorwhere = "";
|
|
|
+ String specwhere = "";
|
|
|
+ String materialwhere = "";
|
|
|
+ String cheekwhere = "";
|
|
|
+ for (String value : listParmNotBlank) {
|
|
|
+ if (value.equals("color")) {
|
|
|
+ colorwhere = " and " + value + "='" + content.getString(value) + "' ";
|
|
|
+ } else if (value.equals("spec")) {
|
|
|
+ specwhere = " and " + value + "='" + content.getString(value) + "' ";
|
|
|
+ } else if (value.equals("material")) {
|
|
|
+ materialwhere = " and " + value + "='" + content.getString(value) + "' ";
|
|
|
+ } else if (value.equals("cheek")) {
|
|
|
+ cheekwhere = " and " + value + "='" + content.getString(value) + "' ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ factory.addParameter_SQL("where", " 1=1 " + colorwhere + specwhere + materialwhere+cheekwhere);
|
|
|
+// System.out.println("listParmBlank");
|
|
|
+
|
|
|
+// for (String value : listAll) {
|
|
|
+// if (value.equals("color")) {
|
|
|
+// factory.addParameter_SQL("where", " 1=1 " + specwhere + materialwhere + cheekwhere);
|
|
|
+// System.out.println(" 1=1 " + specwhere + materialwhere + cheekwhere);
|
|
|
+// rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+// if (!rows.isEmpty()) {
|
|
|
+// for (Row row : rows) {
|
|
|
+// colormap.put(row.getString("color"), true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else if (value.equals("spec")) {
|
|
|
+// factory.addParameter_SQL("where", " 1=1 " + colorwhere + materialwhere + cheekwhere);
|
|
|
+// rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+// if (!rows.isEmpty()) {
|
|
|
+// for (Row row : rows) {
|
|
|
+// specmap.put(row.getString("spec"), true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else if (value.equals("material")) {
|
|
|
+// factory.addParameter_SQL("where", " 1=1 " + colorwhere + specwhere + cheekwhere);
|
|
|
+// rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+// if (!rows.isEmpty()) {
|
|
|
+// for (Row row : rows) {
|
|
|
+// materialmap.put(row.getString("material"), true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else if (value.equals("cheek")) {
|
|
|
+// factory.addParameter_SQL("where", " 1=1 " + colorwhere + specwhere + materialwhere);
|
|
|
+// rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+// if (!rows.isEmpty()) {
|
|
|
+// for (Row row : rows) {
|
|
|
+// cheekmap.put(row.getString("cheek"), true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// for (String firstcolor : firstcolorList) {
|
|
|
+// if (!colormap.containsKey(firstcolor)) {
|
|
|
+// colormap.put(firstcolor, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for (String firstspec : firstspecList) {
|
|
|
+// if (!specmap.containsKey(firstspec)) {
|
|
|
+// specmap.put(firstspec, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for (String firstmaterial : firstmaterialList) {
|
|
|
+// if (!materialmap.containsKey(firstmaterial)) {
|
|
|
+// materialmap.put(firstmaterial, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for (String firstcheek : firstcheekList) {
|
|
|
+// if (!cheekmap.containsKey(firstcheek)) {
|
|
|
+// cheekmap.put(firstcheek, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// factory.addParameter_SQL("where", " 1=1 " + colorwhere + specwhere + materialwhere+cheekwhere);
|
|
|
+ } else {
|
|
|
String where = " 1=1 ";
|
|
|
- for (String value:listParmNotBlank) {
|
|
|
- if(value.equals("color")){
|
|
|
- colorList.add(content.getString("color"));
|
|
|
- }else if(value.equals("spec")){
|
|
|
- specList.add(content.getString("spec"));
|
|
|
- }else if(value.equals("material")){
|
|
|
- materialList.add(content.getString("material"));
|
|
|
- }else if(value.equals("cheek")){
|
|
|
- cheekList.add(content.getString("cheek"));
|
|
|
+ for (String value : listParmNotBlank) {
|
|
|
+ if (value.equals("color")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", content.getString("color"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ colormap.add(jsonObject);
|
|
|
+ for (String firstcolor : firstcolorList) {
|
|
|
+ JSONObject jsonObject1 =new JSONObject();
|
|
|
+ if (!firstcolor.equals(content.getString("color"))) {
|
|
|
+ jsonObject1.put("parm",firstcolor);
|
|
|
+ jsonObject1.put("flag", true);
|
|
|
+ colormap.add(jsonObject1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (value.equals("spec")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", content.getString("spec"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ specmap.add(jsonObject);
|
|
|
+ for (String firstspec : firstspecList) {
|
|
|
+ JSONObject jsonObject1 =new JSONObject();
|
|
|
+ if (!firstspec.equals(content.getString("spec"))) {
|
|
|
+ jsonObject1.put("parm",firstspec);
|
|
|
+ jsonObject1.put("flag", true);
|
|
|
+ specmap.add(jsonObject1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (value.equals("material")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", content.getString("material"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ materialmap.add(jsonObject);
|
|
|
+ for (String firstmaterial : firstmaterialList) {
|
|
|
+ JSONObject jsonObject1 =new JSONObject();
|
|
|
+ if (!firstmaterial.equals(content.getString("material"))) {
|
|
|
+ jsonObject1.put("parm",firstmaterial);
|
|
|
+ jsonObject1.put("flag", true);
|
|
|
+ materialmap.add(jsonObject1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (value.equals("cheek")) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", content.getString("cheek"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ cheekmap.add(jsonObject);
|
|
|
+ for (String firstcheek : firstcheekList) {
|
|
|
+ JSONObject jsonObject1 =new JSONObject();
|
|
|
+ if (!firstcheek.equals(content.getString("cheek"))) {
|
|
|
+ jsonObject1.put("parm", firstcheek);
|
|
|
+ jsonObject1.put("flag", true);
|
|
|
+ cheekmap.add(jsonObject1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- where=where+" and "+value+"='"+content.getString(value)+"' ";
|
|
|
+ where = where + " and " + value + "='" + content.getString(value) + "' ";
|
|
|
}
|
|
|
factory.addParameter_SQL("where", where);
|
|
|
- }
|
|
|
- rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
- String itemno="";
|
|
|
- if(!rows.isEmpty()){
|
|
|
- itemno=rows.get(0).getString("itemno");
|
|
|
- for (Row row : rows) {
|
|
|
- if(listParmBlank!=null && !listParmBlank.isEmpty()){
|
|
|
- for (String value:listParmBlank) {
|
|
|
- if(value.equals("color")){
|
|
|
- colorList.add(row.getString("color"));
|
|
|
- }else if(value.equals("spec")){
|
|
|
- specList.add(row.getString("spec"));
|
|
|
- }else if(value.equals("material")){
|
|
|
- materialList.add(row.getString("material"));
|
|
|
- }else if(value.equals("cheek")){
|
|
|
- cheekList.add(row.getString("cheek"));
|
|
|
+ for (String value : listParmBlank) {
|
|
|
+ if (value.equals("color")) {
|
|
|
+ rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("color"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ colormap.add(jsonObject);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ } else if (value.equals("spec")) {
|
|
|
+ rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("spec"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ specmap.add(jsonObject);
|
|
|
+ }
|
|
|
}
|
|
|
+ } else if (value.equals("material")) {
|
|
|
+ rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("material"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ materialmap.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (value.equals("cheek")) {
|
|
|
+ rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", row.getString("cheek"));
|
|
|
+ jsonObject.put("flag", true);
|
|
|
+ cheekmap.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String firstcolor : firstcolorList) {
|
|
|
+ boolean isexistParm=false;
|
|
|
+ for (Object object:colormap) {
|
|
|
+ JSONObject jsonObject = (JSONObject) object;
|
|
|
+ if(jsonObject.getString("parm").equals(firstcolor)){
|
|
|
+ isexistParm=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isexistParm) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", firstcolor);
|
|
|
+ jsonObject.put("flag", false);
|
|
|
+ colormap.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String firstspec : firstspecList) {
|
|
|
+ boolean isexistParm=false;
|
|
|
+ for (Object object:specmap) {
|
|
|
+ JSONObject jsonObject = (JSONObject) object;
|
|
|
+ if(jsonObject.getString("parm").equals(firstspec)){
|
|
|
+ isexistParm=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isexistParm) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", firstspec);
|
|
|
+ jsonObject.put("flag", false);
|
|
|
+ specmap.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String firstmaterial : firstmaterialList) {
|
|
|
+ boolean isexistParm=false;
|
|
|
+ for (Object object:materialmap) {
|
|
|
+ JSONObject jsonObject = (JSONObject) object;
|
|
|
+ if(jsonObject.getString("parm").equals(firstmaterial)){
|
|
|
+ isexistParm=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isexistParm) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", firstmaterial);
|
|
|
+ jsonObject.put("flag", false);
|
|
|
+ materialmap.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String firstcheek : firstcheekList) {
|
|
|
+ boolean isexistParm=false;
|
|
|
+ for (Object object:cheekmap) {
|
|
|
+ JSONObject jsonObject = (JSONObject) object;
|
|
|
+ if(jsonObject.getString("parm").equals(firstcheek)){
|
|
|
+ isexistParm=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isexistParm) {
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("parm", firstcheek);
|
|
|
+ jsonObject.put("flag", false);
|
|
|
+ cheekmap.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ for (Object object:colormap) {
|
|
|
+ boolean flag=false;
|
|
|
+ parm parm =JSON.parseObject(((JSONObject)object).toJSONString(),parm.class);
|
|
|
+ for (parm parm1:colorList) {
|
|
|
+ if(parm1.getParm().equals(parm.getParm())){
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!flag){
|
|
|
+ colorList.add(parm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Object object:specmap) {
|
|
|
+ boolean flag=false;
|
|
|
+ parm parm =JSON.parseObject(((JSONObject)object).toJSONString(),parm.class);
|
|
|
+ for (parm parm1:specList) {
|
|
|
+ if(parm1.getParm().equals(parm.getParm())){
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!flag){
|
|
|
+ specList.add(parm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Object object:materialmap) {
|
|
|
+ boolean flag=false;
|
|
|
+ parm parm =JSON.parseObject(((JSONObject)object).toJSONString(),parm.class);
|
|
|
+ for (parm parm1:materialList) {
|
|
|
+ if(parm1.getParm().equals(parm.getParm())){
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!flag){
|
|
|
+ materialList.add(parm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Object object:cheekmap) {
|
|
|
+ boolean flag=false;
|
|
|
+ parm parm =JSON.parseObject(((JSONObject)object).toJSONString(),parm.class);
|
|
|
+ for (parm parm1:cheekList) {
|
|
|
+ if(parm1.getParm().equals(parm.getParm())){
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!flag){
|
|
|
+ cheekList.add(parm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// colorList.addAll(JSONObject.parseArray(colormap.toJSONString(), parm.class));
|
|
|
+// specList.addAll(JSONObject.parseArray(specmap.toJSONString(), parm.class));
|
|
|
+// materialList.addAll(JSONObject.parseArray(materialmap.toJSONString(), parm.class));
|
|
|
+// cheekList.addAll(JSONObject.parseArray(cheekmap.toJSONString(), parm.class));
|
|
|
+ rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
+ String itemno = "";
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -451,9 +795,9 @@ public class itemgroup extends Controller {
|
|
|
for (Row row : itemrows) {
|
|
|
ItemPrice itemPrice = ItemPrice.getItemPrice(this, sys_enterpriseid, row.getLong("itemid"));
|
|
|
row.put("oldprice", itemPrice.getPrice());
|
|
|
- if(sys_enterpriseid>0 || (usertype == 21 || usertype == 22)) {
|
|
|
+ if (sys_enterpriseid > 0 || (usertype == 21 || usertype == 22)) {
|
|
|
row.put("gradeprice", itemPrice.getContractprice());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
row.put("gradeprice", itemPrice.getMarketprice());
|
|
|
}
|
|
|
}
|