|
@@ -814,9 +814,50 @@ public class promotion extends Controller {
|
|
|
@API(title = "查询促销方案里的套餐明细", apiversion = R.ID2024080614131103.v1.class)
|
|
|
@CACHEING
|
|
|
public String queryPackagetypemx() throws YosException {
|
|
|
+ Rows optiontypeRows = dbConnect.runSqlQuery("select optiontypeid,issql,issubvaluemag from sys_optiontype where typename='package'");
|
|
|
+ if (optiontypeRows.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("找不到指定的选项分类").toString();
|
|
|
+ }
|
|
|
+ long optiontypeid = optiontypeRows.get(0).getLong("optiontypeid");
|
|
|
+ String packagetype=content.getStringValue("packagetype");
|
|
|
+
|
|
|
+ boolean issubvaluemag = optiontypeRows.get(0).getBoolean("issubvaluemag");
|
|
|
+ JSONArray valueArray = new JSONArray();
|
|
|
+
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_optiontypemx", "value,remarks,subvalues");
|
|
|
+ querySQL.setWhere("isused", 1).setWhere("optiontypeid", optiontypeid).setWhere("value",packagetype);
|
|
|
+ querySQL.setWhere("(ifnull(siteid,'')='' or siteid='" + siteid + "')");
|
|
|
+ querySQL.setCondition("value", "remarks");
|
|
|
+ querySQL.setOrderBy("sequence");
|
|
|
+ Rows valuerows = querySQL.query();
|
|
|
+
|
|
|
long sa_promotionid =content.getLong("sa_promotionid");
|
|
|
+
|
|
|
Rows rows = dbConnect.runSqlQuery("select distinct packagetypemx from sa_promotion_items where siteid='"+siteid+"' and ifnull(packagetypemx,'')!='' and sa_promotionid="+sa_promotionid);
|
|
|
- return getSucReturnObject().setData(rows).toString();
|
|
|
+ RowsMap rowsMap = rows.toRowsMap("packagetypemx");
|
|
|
+ for (Row valuerow : valuerows) {
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("value", valuerow.getString("value"));
|
|
|
+ object.put("remarks", valuerow.getString("remarks"));
|
|
|
+ if (issubvaluemag) {
|
|
|
+ try {
|
|
|
+ JSONArray subvaluesArray = valuerow.getJSONArray("subvalues");
|
|
|
+ JSONArray subvaluesArrayResult = new JSONArray();
|
|
|
+ for(Object obj :subvaluesArray){
|
|
|
+ String subvalue =(String)obj;
|
|
|
+ if(rowsMap.containsKey(subvalue)) {
|
|
|
+ subvaluesArrayResult.add(subvalue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ object.put("subvalues", subvaluesArrayResult);
|
|
|
+ } catch (Exception e) {
|
|
|
+ object.put("subvalues", new JSONArray());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ valueArray.add(object);
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setData(valueArray).toString();
|
|
|
}
|
|
|
|
|
|
}
|