package com.nationalelectric.greenH5; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import javax.annotation.Resource; import org.apache.commons.lang.SerializationUtils; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.nationalelectirc.Constant.Constant; import com.nationalelectirc.utils.RestResult; import com.nationalelectric.greenH5.bizc.BaseServiceImpl; import com.nationalelectric.greenH5.bizc.IGreenOperateLogBizc; import com.nationalelectric.greenH5.bizc.IGreenUserInfoBizc; import com.nationalelectric.greenH5.po.GreenUserInfo; import com.nationalelectric.greenH5.utils.DateTime; import com.nationalelectric.greenH5.utils.DateUtil; import com.sgcc.uap.persistence.IHibernateDao; import okhttp3.Call; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; /** * 概述
*

* 功能
* * @author chenweikang */ @Controller @RequestMapping("/greenCatagory") public class GreenCatagoryController extends GreenBaseController { /** * 字典表controller */ @Resource private GreenDictionaryInfoController greenDictionaryInfoController; @Resource private IGreenOperateLogBizc greenOperateLogBizc; /** * HibernateDao逻辑构件 */ @Autowired IHibernateDao hibernateDao; @Autowired private BaseServiceImpl baseService; /** * 获取类别列表 * * @param stime * @param etime * @return */ @SuppressWarnings({ "unchecked", "unused" }) @RequestMapping(value = "/getCatagoryList", method = RequestMethod.POST) public @ResponseBody RestResult getCatagoryList(@RequestBody Object requestBody) { HashMap rMap = new HashMap(); try { String sql = "select * from t_production_catagory t " + "where t.is_deleted='N' order by t.parent_id,t.seq"; List> productionCatagoryList = hibernateDao.queryForListWithSql(sql.toString(), new Object[]{ }); HashMap tempMap = new HashMap(); List> levelList = new ArrayList>(); List> subSelectorList = new ArrayList>(); List> lastList = new ArrayList>(); String id = ""; String name = ""; String value = ""; String parentId = ""; for(int i=0; i(); tempMap.put("id", id); tempMap.put("name", name); levelList.add(tempMap); continue; } //如果是产品二级目录 else if(productionCatagoryList.get(i).get("grade").equals("2")){ parentId = productionCatagoryList.get(i).get("parent_id").toString(); id = productionCatagoryList.get(i).get("uuid").toString(); name = productionCatagoryList.get(i).get("name").toString(); //找出产品一级目录在list中的下标 HashMap indexMap = getIndex(levelList,parentId,2); int index = indexMap.get("firstIndex"); subSelectorList = new ArrayList>(); if(levelList.get(index).containsKey("subSelectorList")){ subSelectorList = (List>) levelList.get(index).get("subSelectorList"); } tempMap = new HashMap(); tempMap.put("id", id); tempMap.put("name", name); subSelectorList.add(tempMap); levelList.get(index).put("subSelectorList", subSelectorList); continue; } //如果是产品三级目录 else if(productionCatagoryList.get(i).get("grade").equals("3")){ parentId = productionCatagoryList.get(i).get("parent_id").toString(); id = productionCatagoryList.get(i).get("uuid").toString(); name = productionCatagoryList.get(i).get("name").toString(); HashMap indexMap = getIndex(levelList,parentId,3); int index = indexMap.get("firstIndex"); int secondIndex = indexMap.get("secondIndex"); subSelectorList = (List>)levelList.get(index).get("subSelectorList"); lastList = new ArrayList>(); if(subSelectorList.get(secondIndex).containsKey("levelList")){ lastList = (List>) subSelectorList.get(secondIndex).get("levelList"); } tempMap = new HashMap(); tempMap.put("id", id); tempMap.put("name", name); tempMap.put("value", id); lastList.add(tempMap); subSelectorList.get(secondIndex).put("levelList", lastList); levelList.get(index).put("subSelectorList", subSelectorList); // (((List>)levelList.get(index).get("subSelectorList")).get(secondIndex)).put("levelList", subSelectorList); continue; } } sql = "select tp.* from t_production tp where tp.catagory_id=?"; ArrayList> productionList =new ArrayList>(); ArrayList> tempList =new ArrayList>(); List> levelProductionList =new ArrayList>(); //获取每个等级产品list //每个等级产品list List> prods = new ArrayList>(); String catagoryId = ""; String subCatagoryId = "";//子模块id String levelId = "";//具体等级id HashMap prod = new HashMap(); for(int i=0; i< levelList.size(); i++){ //一级目录内的二级目录list subSelectorList = new ArrayList>(); if(levelList.get(i).containsKey("subSelectorList")){ subSelectorList = (List>) levelList.get(i).get("subSelectorList"); } for(int j=0; j>(); subCatagoryId = subSelectorList.get(j).get("id").toString(); if(subSelectorList.get(j).containsKey("levelList")){ lastList = (List>) subSelectorList.get(j).get("levelList"); } sql = "select tp.name,tp.uuid as value from t_production tp where tp.is_deleted='N' and tp.is_in_rack=1 and tp.catagory_id=?"; productionList = (ArrayList>) hibernateDao.queryForListWithSql(sql.toString(), new Object[]{subCatagoryId }); for(int k=0; k>(); for(int uu=0; uu)productionList.get(uu).clone()); } // tempList = (ArrayList>) productionList.clone(); sql = "select tp.uuid,tp.name,1 as checked from t_production_relation tpr " +"left JOIN t_production tp on tpr.production_id=tp.uuid " +"where tp.is_deleted='N' and tp.is_in_rack=1 and tpr.catagory_id=? " +"group by tp.seq"; levelProductionList = hibernateDao.queryForListWithSql(sql.toString(), new Object[]{ lastList.get(k).get("id") }); for(int n=0; n>)((List>)levelList.get(i).get("subSelectorList")).get(j).get("levelList")).get(k).put("prods", tempList); lastList.get(k).put("prods", tempList); } } } rMap.put("list", levelList); return new RestResult(Constant.SUCCESS, "请求成功",rMap); } catch (Exception e) { e.printStackTrace(); return new RestResult(Constant.FAILED, "请求失败"); } } /** * 获取类别列表 * * @param stime * @param etime * @return */ @SuppressWarnings({ "unchecked", "unused" }) @RequestMapping(value = "/getAllProdunctions", method = RequestMethod.POST) public @ResponseBody RestResult getAllProdunctions(@RequestBody Object requestBody) { HashMap rMap = new HashMap(); try { String sql = "SELECT" +" menu1," +" mainId," +" menu2," +" subId," +" menu3," +" levelId," +" production_name," +" prodId," +"CASE" +" WHEN ( ISNULL( t_production_relation.production_id ) = 1 ) THEN" +" 0 ELSE 1 " +" END" +" as isChecked" +" FROM" +" (" +" SELECT" +" table1.`name` AS menu1," +" table1.uuid as mainId," +" table1.seq AS seq1," +" table2.`name` AS menu2," +" table2.uuid as subId," +" table2.seq AS seq2," +" table3.`name` AS menu3," +" table3.UUid as levelId," +" table3.seq AS seq3," +" table3.uuid AS catagory_id," +" table4.`name` AS menu4," +" table4.uuid as prodId," +" table4.uuid AS production_id," +" table4.name as production_name," +" table4.seq as seq4" +" FROM" +" `t_production_catagory` AS table1," +" `t_production_catagory` AS table2," +" `t_production_catagory` AS table3," +" t_production AS table4 " +" WHERE" +" table1.grade = '1'" +" AND table2.parent_id = table1.uuid" +" AND table3.parent_id = table2.uuid " +" AND table4.catagory_id = table2.uuid " +" AND table1.is_deleted='N'" +" AND table2.is_deleted='N'" +" AND table3.is_deleted='N'" +" AND table4.is_deleted='N'" +" AND table4.is_in_rack=1" +" ) production_all" +" LEFT JOIN t_production_relation ON production_all.catagory_id = t_production_relation.catagory_id " +" AND production_all.production_id = t_production_relation.production_id " +"ORDER BY production_all.seq1,production_all.seq2,production_all.seq3,production_all.seq4"; List> productionCatagoryList = hibernateDao.queryForListWithSql(sql.toString(), new Object[]{ }); String mainId = ""; String menu1 = ""; String lastMainId = ""; String subId = ""; String menu2 = ""; String lastSubId = ""; String levelId = ""; String menu3 = ""; String lastLevelId = ""; String lastLevelName = ""; String proId = ""; String productionName = ""; String lastProId = ""; int isChecked = 0; HashMap tempMap = new HashMap(); /** * 某个产品的map */ HashMap prodMap = new HashMap(); /** * 某个等级的map */ HashMap levelMap = new HashMap(); /** * 某个子类的map */ HashMap subMap = new HashMap(); /** * 某个主类的map */ HashMap mainMap = new HashMap(); List> prodsList = new ArrayList>(); List> levelsList = new ArrayList>(); List> subsList = new ArrayList>(); List> mainsList = new ArrayList>(); for(int i=0; i(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); subsList = (List>) mainsList.get(mainsList.size()-1).get("subSelectorList"); levelsList = (List>) subsList.get(subsList.size()-1).get("levelList"); prodsList = (List>) levelsList.get(levelsList.size()-1).get("prods"); prodsList = prodsList !=null ? prodsList:new ArrayList>(); prodsList.add(prodMap); levelsList.get(levelsList.size()-1).put("prods", prodsList); } else{ //不是同一等级的,等级列表一级新加一个等级,新等级下新加一个产品列表,产品列表下新加产品 prodMap = new HashMap(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); subsList = (List>) mainsList.get(mainsList.size()-1).get("subSelectorList"); levelsList = (List>) subsList.get(subsList.size()-1).get("levelList"); levelsList = levelsList !=null ? levelsList:new ArrayList>(); prodsList = new ArrayList>(); prodsList.add(prodMap); levelMap = new HashMap(); levelMap.put("id", tempMap.get("levelId")); levelMap.put("name", tempMap.get("menu3")); levelMap.put("prods", prodsList); levelsList.add(levelMap); subsList.get(subsList.size()-1).put("levelList", levelsList); } } else{ //不是同一子类,子类列表新加一个子类, //此子类中新加一个等级列表,等级列表中新加一个产品列表,产品列表下新加产品 prodMap = new HashMap(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); levelsList = new ArrayList>(); prodsList = new ArrayList>(); prodsList.add(prodMap); levelMap = new HashMap(); levelMap.put("id", tempMap.get("levelId")); levelMap.put("name", tempMap.get("menu3")); levelMap.put("prods", prodsList); levelsList.add(levelMap); subMap = new HashMap(); subMap.put("id", tempMap.get("subId")); subMap.put("name", tempMap.get("menu2")); subMap.put("levelList", levelsList); subsList = (List>) mainsList.get(mainsList.size()-1).get("subSelectorList"); subsList = subsList !=null ? subsList:new ArrayList>(); subsList.add(subMap); mainsList.get(mainsList.size()-1).put("subSelectorList", subsList); } } else{ //产品list增加产品 prodMap = new HashMap(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); prodsList = new ArrayList>(); prodsList.add(prodMap); //等级list增加一个新的等级 levelMap = new HashMap(); levelMap.put("id", tempMap.get("levelId")); levelMap.put("name", tempMap.get("menu3")); levelMap.put("prods", prodsList); levelsList = new ArrayList>(); levelsList.add(levelMap); //子类list增加一个子类 subsList = new ArrayList>(); subMap = new HashMap(); subMap.put("id", tempMap.get("subId")); subMap.put("name", tempMap.get("menu2")); subMap.put("levelList", levelsList); subsList.add(subMap); //模块list增加一个子类 mainMap = new HashMap(); mainMap.put("id", tempMap.get("mainId")); mainMap.put("name", tempMap.get("menu1")); mainMap.put("subSelectorList", subsList); mainsList.add(mainMap); } lastMainId = ((HashMap)tempMap.clone()).get("mainId").toString(); // System.out.println(lastMainId); lastSubId = tempMap.get("subId").toString(); lastLevelId = tempMap.get("levelId").toString(); } rMap.put("list", mainsList); return new RestResult(Constant.SUCCESS, "请求成功",rMap); } catch (Exception e) { e.printStackTrace(); return new RestResult(Constant.FAILED, "请求失败"); } } /** * 获取已选中类别列表 * * @param stime * @param etime * @return */ @SuppressWarnings({ "unchecked", "unused" }) @RequestMapping(value = "/getChoosedProdunctions", method = RequestMethod.POST) public @ResponseBody RestResult getChoosedProdunctions(@RequestBody Object requestBody) { HashMap rMap = new HashMap(); try { Map map = new ObjectMapper().convertValue(requestBody, new TypeReference>(){}); String applyId = map.get("applyId").toString(); String userPhone = ""; String userId = ""; String userName = ""; String sql = "SELECT" +" menu1," +" mainId," +" menu2," +" subId," +" menu3," +" levelId," +" production_name," +" prodId," +" chProd.user_id," +" chProd.user_name," +" chProd.user_phone," +" chProd.apply_status," +" chProd.apply_time," +"CASE" +" WHEN ( ISNULL( t_production_relation.production_id ) = 1 ) THEN" +" 0 ELSE 1 " +" END" +" as isChecked" +" FROM" +" (" +" SELECT" +" table1.`name` AS menu1," +" table1.uuid as mainId," +" table1.seq AS seq1," +" table2.`name` AS menu2," +" table2.uuid as subId," +" table2.seq AS seq2," +" table3.`name` AS menu3," +" table3.UUid as levelId," +" table3.seq AS seq3," +" table3.uuid AS catagory_id," +" table4.`name` AS menu4," +" table4.uuid as prodId," +" table4.uuid AS production_id," +" table4.name as production_name," +" table4.seq as seq4" +" FROM" +" `t_production_catagory` AS table1," +" `t_production_catagory` AS table2," +" `t_production_catagory` AS table3," +" t_production AS table4 " +" WHERE" +" table1.grade = '1'" +" AND table2.parent_id = table1.uuid" +" AND table3.parent_id = table2.uuid " +" AND table4.catagory_id = table2.uuid " +" AND table1.is_deleted='N'" +" AND table2.is_deleted='N'" +" AND table3.is_deleted='N'" +" AND table4.is_deleted='N'" +" AND table4.is_in_rack=1" +" ) production_all" +" LEFT JOIN t_production_relation ON production_all.catagory_id = t_production_relation.catagory_id " +" AND production_all.production_id = t_production_relation.production_id ," +" (select tpad.level_id,tpad.apply_status as dStatus,tpa.user_id,tpa.user_name,tpa.user_phone," +" tpa.apply_status,tpa.apply_time " +" from t_production_apply_detail tpad LEFT JOIN " +" t_production_apply tpa on tpad.apply_id=tpa.uuid " +" where tpa.uuid=?) as chProd " +" WHERE" +" production_all.levelId = chProd.level_id " +"ORDER BY production_all.seq1,production_all.seq2,production_all.seq3,production_all.seq4"; List> productionCatagoryList = hibernateDao.queryForListWithSql(sql.toString(), new Object[]{ applyId }); String mainId = ""; String menu1 = ""; String lastMainId = ""; String subId = ""; String menu2 = ""; String lastSubId = ""; String levelId = ""; String menu3 = ""; String lastLevelId = ""; String lastLevelName = ""; String proId = ""; String productionName = ""; String lastProId = ""; int isChecked = 0; HashMap tempMap = new HashMap(); /** * 某个产品的map */ HashMap prodMap = new HashMap(); /** * 某个等级的map */ HashMap levelMap = new HashMap(); /** * 某个子类的map */ HashMap subMap = new HashMap(); /** * 某个主类的map */ HashMap mainMap = new HashMap(); List> prodsList = new ArrayList>(); List> levelsList = new ArrayList>(); List> subsList = new ArrayList>(); List> mainsList = new ArrayList>(); for(int i=0; i(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); subsList = (List>) mainsList.get(mainsList.size()-1).get("subSelectorList"); levelsList = (List>) subsList.get(subsList.size()-1).get("levelList"); prodsList = (List>) levelsList.get(levelsList.size()-1).get("prods"); prodsList = prodsList !=null ? prodsList:new ArrayList>(); prodsList.add(prodMap); levelsList.get(levelsList.size()-1).put("prods", prodsList); } else{ //不是同一等级的,等级列表一级新加一个等级,新等级下新加一个产品列表,产品列表下新加产品 prodMap = new HashMap(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); subsList = (List>) mainsList.get(mainsList.size()-1).get("subSelectorList"); levelsList = (List>) subsList.get(subsList.size()-1).get("levelList"); levelsList = levelsList !=null ? levelsList:new ArrayList>(); prodsList = new ArrayList>(); prodsList.add(prodMap); levelMap = new HashMap(); levelMap.put("id", tempMap.get("levelId")); levelMap.put("name", tempMap.get("menu3")); levelMap.put("prods", prodsList); levelsList.add(levelMap); subsList.get(subsList.size()-1).put("levelList", levelsList); } } else{ //不是同一子类,子类列表新加一个子类, //此子类中新加一个等级列表,等级列表中新加一个产品列表,产品列表下新加产品 prodMap = new HashMap(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); levelsList = new ArrayList>(); prodsList = new ArrayList>(); prodsList.add(prodMap); levelMap = new HashMap(); levelMap.put("id", tempMap.get("levelId")); levelMap.put("name", tempMap.get("menu3")); levelMap.put("prods", prodsList); levelsList.add(levelMap); subMap = new HashMap(); subMap.put("id", tempMap.get("subId")); subMap.put("name", tempMap.get("menu2")); subMap.put("levelList", levelsList); subsList = (List>) mainsList.get(mainsList.size()-1).get("subSelectorList"); subsList = subsList !=null ? subsList:new ArrayList>(); subsList.add(subMap); mainsList.get(mainsList.size()-1).put("subSelectorList", subsList); } } else{ //产品list增加产品 prodMap = new HashMap(); prodMap.put("id", tempMap.get("prodId")); prodMap.put("name", tempMap.get("production_name")); prodMap.put("value", tempMap.get("prodId")); prodMap.put("isChecked", tempMap.get("isChecked")); prodsList = new ArrayList>(); prodsList.add(prodMap); //等级list增加一个新的等级 levelMap = new HashMap(); levelMap.put("id", tempMap.get("levelId")); levelMap.put("name", tempMap.get("menu3")); levelMap.put("prods", prodsList); levelsList = new ArrayList>(); levelsList.add(levelMap); //子类list增加一个子类 subsList = new ArrayList>(); subMap = new HashMap(); subMap.put("id", tempMap.get("subId")); subMap.put("name", tempMap.get("menu2")); subMap.put("levelList", levelsList); subsList.add(subMap); //模块list增加一个子类 mainMap = new HashMap(); mainMap.put("id", tempMap.get("mainId")); mainMap.put("name", tempMap.get("menu1")); mainMap.put("subSelectorList", subsList); mainsList.add(mainMap); } lastMainId = ((HashMap)tempMap.clone()).get("mainId").toString(); // System.out.println(lastMainId); lastSubId = tempMap.get("subId").toString(); lastLevelId = tempMap.get("levelId").toString(); } rMap.put("list", mainsList); rMap.put("userPhone", userPhone); rMap.put("userId", userId); rMap.put("userName", userName); return new RestResult(Constant.SUCCESS, "请求成功",rMap); } catch (Exception e) { e.printStackTrace(); return new RestResult(Constant.FAILED, "请求失败"); } } /** * 获取类别列表 * * @param stime * @param etime * @return */ @SuppressWarnings({ "unchecked", "unused" }) @RequestMapping(value = "/getProductionList", method = RequestMethod.POST) public @ResponseBody RestResult getProductionList(@RequestBody Object requestBody) { Map map = new ObjectMapper().convertValue(requestBody, new TypeReference>(){}); String userId = map.get("userId") == null || "".equals(map.get("userId")) ? null : map.get("userId").toString(); GreenUserInfo info = getUserInfo(userId); if (info == null) { return new RestResult(Constant.FAILED, "非法用户"); } String catagoryId = map.get("catagoryId").toString(); HashMap rMap = new HashMap(); try { String sql = "select tp.uuid,tp.name,1 as checked from t_production_relation tpr " +"left JOIN t_production tp on tpr.production_id=tp.uuid " +"where tp.is_deleted='N' and tp.is_in_rack=1 and tpr.catagory_id=? " +"group by tp.seq"; List> productionList = hibernateDao.queryForListWithSql(sql.toString(), new Object[]{ catagoryId }); rMap.put("list", productionList); return new RestResult(Constant.SUCCESS, "请求成功",rMap); } catch (Exception e) { e.printStackTrace(); return new RestResult(Constant.FAILED, "请求失败"); } } /** * 保存我的产品列表 * @param requestBody * @return */ @SuppressWarnings({ "unchecked", "unused" }) @RequestMapping(value = "/saveMyProductionApply", method = RequestMethod.POST) public @ResponseBody RestResult saveMyProductionApply(@RequestBody Object requestBody) { HashMap rMap = new HashMap(); try { Map map = new ObjectMapper().convertValue(requestBody, new TypeReference>(){}); String userId = map.get("userId") == null || "".equals(map.get("userId")) ? null : map.get("userId").toString(); GreenUserInfo info = getUserInfo(userId); if (info == null) { return new RestResult(Constant.FAILED, "非法用户"); } String applyId = UUID.randomUUID().toString(); int applyStatus = 1; String userName = map.get("userName").toString(); //插入到申请表 String insertSql = "INSERT INTO t_production_apply (uuid,user_id,user_phone,apply_time,apply_status," + " creator,modifier,gmt_created,gmt_modified,user_name " + ") " + "VALUES(?,?,?,SYSDATE(),?," + "?,?,SYSDATE(),SYSDATE(),?" + ")"; hibernateDao.updateWithSql(insertSql,new Object[] { applyId,map.get("userId"), map.get("userPhone"),applyStatus, map.get("userId"),map.get("userId"),userName}); ArrayList list = (ArrayList) map.get("choosedLevelIds"); //插入到详情表 String levelId = ""; for(int i=0;i getIndex(List> levelList,String parentId,int grade){ HashMap indexMap = new HashMap(); int firstIndex = -1; int secondIndex = -1; indexMap.put("firstIndex", firstIndex); indexMap.put("secondIndex", secondIndex); if(grade == 2){ for(int i=0; i< levelList.size(); i++){ if(levelList.get(i).get("id").equals(parentId)){ firstIndex = i; indexMap.put("firstIndex", firstIndex); return indexMap; } } } else if(grade == 3){ for(int i=0; i< levelList.size(); i++){ for(int j=0; j<((List>)levelList.get(i).get("subSelectorList")).size(); j++){ if(((List>)levelList.get(i).get("subSelectorList")).get(j).get("id").equals(parentId)){ firstIndex = i; secondIndex = j; indexMap.put("firstIndex", firstIndex); indexMap.put("secondIndex", secondIndex); return indexMap; } } } } return indexMap; } }