| | |
| | |
|
| | | import org.jsoup.Jsoup;
|
| | | import org.jsoup.nodes.Document;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.GoodsClassAdmin;
|
| | | import com.yeshi.fanli.entity.admin.HotSearchAdmin;
|
| | | import com.yeshi.fanli.entity.admin.RecommendBannerAdmin;
|
| | | import com.yeshi.fanli.entity.admin.RecommendSectionAdmin;
|
| | | import com.yeshi.fanli.entity.admin.RecommendSpecialAdmin;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | return newMap;
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public static void sort(List list) {
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | if (list.get(0) instanceof RecommendSection) {
|
| | | Collections.sort(list, new Comparator<RecommendSection>() {
|
| | | public int compare(RecommendSection o1, RecommendSection o2) {
|
| | | return o1.getOrderby() - o2.getOrderby();
|
| | | }
|
| | | });
|
| | | } else if (list.get(0) instanceof RecommendSectionGoods) {
|
| | | Collections.sort(list, new Comparator<RecommendSectionGoods>() {
|
| | | public int compare(RecommendSectionGoods o1, RecommendSectionGoods o2) {
|
| | | return o1.getOrderby() - o2.getOrderby();
|
| | | }
|
| | | });
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public static Map orderBy(Map map) {
|
| | |
| | | });
|
| | | LinkedHashMap<Long, Object> newMap = new LinkedHashMap<Long, Object>();
|
| | | for (Entry<Long, GoodsClassAdmin> entry : list) {
|
| | | newMap.put(entry.getKey(), entry.getValue());
|
| | | }
|
| | | return newMap;
|
| | | } else if (obj instanceof RecommendSectionAdmin) {
|
| | | List<Map.Entry<Long, RecommendSectionAdmin>> list = new ArrayList<Map.Entry<Long, RecommendSectionAdmin>>(
|
| | | (Collection) map.entrySet());
|
| | | Collections.sort(list, new Comparator<Map.Entry<Long, RecommendSectionAdmin>>() {
|
| | | public int compare(Map.Entry<Long, RecommendSectionAdmin> mapping1,
|
| | | Map.Entry<Long, RecommendSectionAdmin> mapping2) {
|
| | | int orderby1 = mapping1.getValue().getRecommendSection().getOrderby();
|
| | | int orderby2 = mapping2.getValue().getRecommendSection().getOrderby();
|
| | | return orderby1 - orderby2;
|
| | | }
|
| | | });
|
| | | LinkedHashMap<Long, Object> newMap = new LinkedHashMap<Long, Object>();
|
| | | for (Entry<Long, RecommendSectionAdmin> entry : list) {
|
| | | newMap.put(entry.getKey(), entry.getValue());
|
| | | }
|
| | | return newMap;
|