|
@@ -35,7 +35,7 @@ public class itemgroup extends Controller {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- @API(title = "商品组新增修改", apiversion = R.ID20220922164303.v1.class,intervaltime = 200)
|
|
|
+ @API(title = "商品组新增修改", apiversion = R.ID20220922164303.v1.class, intervaltime = 200)
|
|
|
@CACHEING_CLEAN(cms = {@cm(clazz = itemgroup.class, method = {"queryItemgroup"})})
|
|
|
public String insertormodify_itemgroup() throws YosException {
|
|
|
long sa_itemgroupid = content.getLongValue("sa_itemgroupid");
|
|
@@ -43,7 +43,7 @@ public class itemgroup extends Controller {
|
|
|
String groupname = content.getString("groupname");
|
|
|
String itemno = content.getString("itemno");
|
|
|
String tradefield = content.getStringValue("tradefield");
|
|
|
- long sa_customschemeid=content.getLong("sa_customschemeid");
|
|
|
+ long sa_customschemeid = content.getLong("sa_customschemeid");
|
|
|
Long sequence = content.getLongValue("sequence");
|
|
|
JSONArray tagArray = content.getJSONArray("tag");
|
|
|
ArrayList<String> list = (ArrayList<String>) JSONObject.parseArray(tagArray.toJSONString(), String.class);
|
|
@@ -140,7 +140,7 @@ public class itemgroup extends Controller {
|
|
|
where = where + " and (t3.brandname ='" + whereObject.getString("brandname") + "') ";
|
|
|
}
|
|
|
if (whereObject.containsKey("tradefield") && !"".equals(whereObject.getString("tradefield"))) {
|
|
|
- where=where+" and t1.sa_itemgroupid in(select t1.sa_itemgroupid from sa_itemgroupmx t1 left join plm_item_tradefield t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t2.tradefield like '%"+whereObject.getString("tradefield")+"%') ";
|
|
|
+ where = where + " and t1.sa_itemgroupid in(select t1.sa_itemgroupid from sa_itemgroupmx t1 left join plm_item_tradefield t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t2.tradefield like '%" + whereObject.getString("tradefield") + "%') ";
|
|
|
}
|
|
|
if (whereObject.containsKey("itemclassname") && !"".equals(whereObject.getString("itemclassname"))) {
|
|
|
where = where + " and (t5.itemclassname ='" + whereObject.getString("itemclassname") + "') ";
|
|
@@ -149,7 +149,7 @@ public class itemgroup extends Controller {
|
|
|
where = where + " and (t1.isonsale ='" + whereObject.getString("isonsale") + "') ";
|
|
|
}
|
|
|
if (whereObject.containsKey("iteminfo") && !"".equals(whereObject.getString("iteminfo"))) {
|
|
|
- where=where+" and t1.sa_itemgroupid in(select t1.sa_itemgroupid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where (t2.itemno like '%"+whereObject.getString("iteminfo")+"%' or t2.itemname like '%"+whereObject.getString("iteminfo")+"%')) ";
|
|
|
+ where = where + " and t1.sa_itemgroupid in(select t1.sa_itemgroupid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where (t2.itemno like '%" + whereObject.getString("iteminfo") + "%' or t2.itemname like '%" + whereObject.getString("iteminfo") + "%')) ";
|
|
|
}
|
|
|
}
|
|
|
/*
|
|
@@ -175,7 +175,7 @@ public class itemgroup extends Controller {
|
|
|
//附件
|
|
|
RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
// 附件
|
|
|
- RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", rows.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
+ RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", rows.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
|
|
|
Rows rowsitemclass = dbConnect.runSqlQuery(
|
|
|
" select t7.itemclassname,t6.itemid,t8.brandname from sa_itemsaleclass t6 inner JOIN plm_itemclass t7 ON t7.itemclassid = t6.itemclassid AND t7.siteid = t6.siteid LEFT JOIN sa_brand t8 ON t8.sa_brandid = t7.sa_brandid AND t8.siteid = t7.siteid where t6.siteid='"
|
|
@@ -223,11 +223,11 @@ public class itemgroup extends Controller {
|
|
|
//附件
|
|
|
RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
// 附件
|
|
|
- RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", rows.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
+ RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", rows.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
|
|
|
RowsMap itemclassRowsMap = rowsitemclass.toRowsMap("itemid");
|
|
|
- for (Row row :rows) {
|
|
|
- ArrayList<String> list = DataTag.queryTag(this, "sa_itemgroup",row.getLong("sa_itemgroupid"), false);
|
|
|
+ for (Row row : rows) {
|
|
|
+ ArrayList<String> list = DataTag.queryTag(this, "sa_itemgroup", row.getLong("sa_itemgroupid"), false);
|
|
|
row.put("tag1", JSONArray.parseArray(JSON.toJSONString(list)));
|
|
|
row.put("itemclass", itemclassRowsMap.get(row.getString("itemid")));
|
|
|
|
|
@@ -277,12 +277,12 @@ public class itemgroup extends Controller {
|
|
|
if (StringUtils.isBlank(row.getString("itemno"))) {
|
|
|
return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组不存在默认商品,无法再次上架").toString();
|
|
|
}
|
|
|
- Rows rowscount = dbConnect.runSqlQuery("select distinct ifnull(t2.sa_customschemeid,0) 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="+row.getLong("sa_itemgroupid"));
|
|
|
- if(rowscount.size()>1){
|
|
|
+ Rows rowscount = dbConnect.runSqlQuery("select distinct ifnull(t2.sa_customschemeid,0) 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=" + row.getLong("sa_itemgroupid"));
|
|
|
+ if (rowscount.size() > 1) {
|
|
|
return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组存在两个以上方案的商品,无法上架").toString();
|
|
|
}
|
|
|
- Rows rowsdetailcount = dbConnect.runSqlQuery("select * from sa_itemgroupmx t1 where t1.sa_itemgroupid="+row.getLong("sa_itemgroupid"));
|
|
|
- if(rowsdetailcount.size()==0){
|
|
|
+ Rows rowsdetailcount = dbConnect.runSqlQuery("select * from sa_itemgroupmx t1 where t1.sa_itemgroupid=" + row.getLong("sa_itemgroupid"));
|
|
|
+ if (rowsdetailcount.size() == 0) {
|
|
|
return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组下没有商品,无法上架").toString();
|
|
|
}
|
|
|
|
|
@@ -309,12 +309,12 @@ public class itemgroup extends Controller {
|
|
|
@CACHEING_CLEAN(apiClass = {itemgroup.class, restcontroller.sale.itemgroup.itemgroup.class})
|
|
|
public String isTopping() throws YosException {
|
|
|
JSONArray sa_itemgroupids = content.getJSONArray("sa_itemgroupids");
|
|
|
- boolean isTopping =content.getBooleanValue("isTopping");
|
|
|
+ boolean isTopping = content.getBooleanValue("isTopping");
|
|
|
List<Long> list = sa_itemgroupids.toJavaList(Long.class);
|
|
|
Long[] stringArray = list.toArray(new Long[0]);
|
|
|
SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组取消置顶");
|
|
|
- if(isTopping){
|
|
|
- sqlFactoryupdate = new SQLFactory(this, "商品组置顶");
|
|
|
+ if (isTopping) {
|
|
|
+ sqlFactoryupdate = new SQLFactory(this, "商品组置顶");
|
|
|
}
|
|
|
sqlFactoryupdate.addParameter("siteid", siteid);
|
|
|
sqlFactoryupdate.addParameter_in("sa_itemgroupids", stringArray);
|
|
@@ -333,10 +333,10 @@ public class itemgroup extends Controller {
|
|
|
public String isPriorityshow() throws YosException {
|
|
|
JSONArray sa_itemgroupids = content.getJSONArray("sa_itemgroupids");
|
|
|
List<Long> list = sa_itemgroupids.toJavaList(Long.class);
|
|
|
- boolean isPriorityshow =content.getBooleanValue("isPriorityshow");
|
|
|
+ boolean isPriorityshow = content.getBooleanValue("isPriorityshow");
|
|
|
Long[] stringArray = list.toArray(new Long[0]);
|
|
|
SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组取消优先展示");
|
|
|
- if(isPriorityshow){
|
|
|
+ if (isPriorityshow) {
|
|
|
sqlFactoryupdate = new SQLFactory(this, "商品组优先展示");
|
|
|
}
|
|
|
sqlFactoryupdate.addParameter("siteid", siteid);
|
|
@@ -380,7 +380,7 @@ public class itemgroup extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
- @API(title = "新建或修改商品组商品明细", apiversion = R.ID20220923110303.v1.class,intervaltime = 200)
|
|
|
+ @API(title = "新建或修改商品组商品明细", apiversion = R.ID20220923110303.v1.class, intervaltime = 200)
|
|
|
@CACHEING_CLEAN(cms = {
|
|
|
@cm(clazz = itemgroup.class, method = {"queryItemgroupMxList", "queryItemgList"})})
|
|
|
public String insertormodify_itemgroupmx() throws YosException {
|
|
@@ -456,18 +456,24 @@ public class itemgroup extends Controller {
|
|
|
JSONObject whereObject = content.getJSONObject("where");
|
|
|
if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
where = where + " and (t1.itemname like '%" + whereObject.getString("condition") + "%'"
|
|
|
- + " or t1.itemno like '%" + whereObject.getString("condition") + "%')";
|
|
|
+ + " or t1.itemno like '%" + whereObject.getString("condition") + "%'"
|
|
|
+ + " or t4.material like '%" + whereObject.getString("condition") + "%'"
|
|
|
+ + " or t4.material like '%" + whereObject.getString("condition") + "%'"
|
|
|
+ + " or t1.cheek like '%" + whereObject.getString("condition") + "%'"
|
|
|
+ + " or t1.standards like '%" + whereObject.getString("condition") + "%'"
|
|
|
+ + " or t1.spec like '%" + whereObject.getString("condition") + "%'"
|
|
|
+ + " or t1.color like '%" + whereObject.getString("condition") + "%')";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
Long sa_itemgroupid = content.getLong("sa_itemgroupid");
|
|
|
- long sa_customschemeid=0;
|
|
|
+ long sa_customschemeid = 0;
|
|
|
Rows rowscount = dbConnect.runSqlQuery(
|
|
|
- "select sa_customschemeid from sa_itemgroup where siteid='"+siteid+"' and sa_itemgroupid=" + sa_itemgroupid);
|
|
|
- if(rowscount.isNotEmpty()){
|
|
|
- sa_customschemeid=rowscount.get(0).getLong("sa_customschemeid");
|
|
|
+ "select sa_customschemeid from sa_itemgroup where siteid='" + siteid + "' and sa_itemgroupid=" + sa_itemgroupid);
|
|
|
+ if (rowscount.isNotEmpty()) {
|
|
|
+ sa_customschemeid = rowscount.get(0).getLong("sa_customschemeid");
|
|
|
}
|
|
|
- if(sa_customschemeid!=0){
|
|
|
+ if (sa_customschemeid != 0) {
|
|
|
where = where + " and t1.sa_customschemeid ='" + sa_customschemeid + "'";
|
|
|
}
|
|
|
// String hrid = content.getString("hrid");
|