@Service
@Transactional(readOnly=true)
public class HunterShowServiceImpl implements HunterShowService {
@Autowired
private HunterShowDao hunterShowDao;
@Override
public Result getHunterShowList(Long id,Long member_id) {
if(id==null){
return ResultUtils.returnError("没有对应的猎头ID,请查看数据!");
}
List<Map> showList = hunterShowDao.getHunterShowList(id);
for (Map<String,Object> map : showList) {
Integer valueOf = Integer.valueOf(map.get("level").toString());
if(valueOf==0){
map.put("level", "大众猎头");
}
if(valueOf==1){
map.put("level", "高级猎头");
}
if(valueOf==2){
map.put("level", "专家猎头");
}
if(valueOf==3){
map.put("level", "顶级猎头");
}
}
for(Map<String,Object> hunter : showList){
String pro=hunter.get("provincename")==null?"":hunter.get("provincename").toString();
String city=hunter.get("cityname")==null?"":hunter.get("cityname").toString();
String country=hunter.get("countyname")==null?"":hunter.get("countyname").toString();
if("北京市".equals(pro)||"天津市".equals(pro)||"上海市".equals(pro)||"重庆市".equals(pro)){
hunter.put("position", pro+country);//服务的区域
}else{
hunter.put("position",pro+city);
}
}
//List<Map> imgList = hunterShowDao.getImgList();
List<Map> roleList = hunterShowDao.getRoleList(id);
List<Map> productList = hunterShowDao.getproductList(id);
Integer collectionType=0;
if(member_id!=null){
Map<String,Object> params =new HashMap<String,Object>();
params.put("id", id);
params.put("member_id", member_id);
collectionType = hunterShowDao.getcollectionType(params);
}
Map<String,Object> map=new HashMap<String,Object>();
map.put("showList", showList);
//map.put("imgList", imgList);
map.put("roleList", roleList);
map.put("productList", productList);
//判断0是收藏 1是未收藏
map.put("collectionType", collectionType==null?1:collectionType);
return ResultUtils.returnSuccess("详情页+介绍", map);
}
}