!185 fitler data except H5 data

Merge pull request !185 from Admin/sit-Carl-V3
This commit is contained in:
Admin 2022-02-18 04:15:33 +00:00 committed by Gitee
commit 9331447075
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1,5 +1,7 @@
package net.lab1024.smartadmin.module.system.royalcanin;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigFindAllEntity;
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
@ -30,7 +32,24 @@ public class CouponConfigService {
paramMap.put("page",StringUtil.toString(couponConfigFindAllEntity.getPage()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getPage()));
MapRemoveNullUtil.removeNullEntry(paramMap);
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(paramMap);
return SmartHttpUtil.httpPostRaw(url+"getAll",jsonObject.toString(),null,"utf-8");
String result = SmartHttpUtil.httpPostRaw(url+"getAll",jsonObject.toString(),null,"utf-8");
//过滤非官网数据
JSONObject jsonObjectResult = JSONObject.parseObject(result);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObjectResult.getString("data"));
com.alibaba.fastjson.JSONArray afterFilterArrary = new JSONArray();
for(int i = 0;i < jsonArray.size();i ++){
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
if(jsonResult.getString("udf2") != null) {
if (jsonResult.getString("udf2").equals("H5")) {
afterFilterArrary.add(jsonResult);
}
}
}
JSONObject JSONResult = new JSONObject();
JSONResult.put("code",jsonObjectResult.getString("code"));
JSONResult.put("msg",jsonObjectResult.getString("msg"));
JSONResult.put("data",afterFilterArrary);
return JSONResult.toJSONString();
}
}