package com.yeshi.fanli.controller.client;
|
|
import java.io.PrintWriter;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.yeshi.utils.JsonUtil;
|
|
import com.yeshi.fanli.entity.accept.AcceptData;
|
import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
|
import com.yeshi.fanli.entity.bus.homemodule.SuperHomeNavbar;
|
import com.yeshi.fanli.entity.system.BusinessSystem;
|
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
import com.yeshi.fanli.service.inter.homemodule.SuperHomeNavbarService;
|
|
import net.sf.json.JSONObject;
|
|
@Controller
|
@RequestMapping("api/v1/navbar")
|
public class HomeNavbarController<E> {
|
|
@Resource
|
private BusinessSystemService businessSystemService;
|
|
@Resource
|
private SuperHomeNavbarService superHomeNavbarService;
|
|
|
|
/**
|
* 获取导航栏内容
|
*
|
* @param acceptData
|
* @param out
|
*/
|
@RequestMapping(value = "gethomenavbar", method = RequestMethod.POST)
|
public void gethomenavbar(AcceptData acceptData, PrintWriter out) {
|
|
BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
if (system == null) {
|
out.print(JsonUtil.loadFalseResult("系统不存在"));
|
return;
|
}
|
|
List<SuperHomeNavbar> listSuper = superHomeNavbarService.listBySystemCache(system.getId());
|
if (listSuper == null || listSuper.size() == 0) {
|
out.print(JsonUtil.loadFalseResult("暂无数据"));
|
return;
|
}
|
|
List<HomeNavbar> listNavbar = new ArrayList<HomeNavbar>();
|
|
for (SuperHomeNavbar superHomeNavbar : listSuper) {
|
HomeNavbar homeNavbar = superHomeNavbar.getHomeNavbar();
|
if (homeNavbar == null) {
|
continue;
|
}
|
|
homeNavbar.setCreatetime(null);
|
homeNavbar.setUpdatetime(null);
|
|
listNavbar.add(homeNavbar);
|
}
|
|
JSONObject data = new JSONObject();
|
data.put("count", listNavbar.size());
|
data.put("listNavbar", listNavbar);
|
|
out.print(JsonUtil.loadTrueResult(data));
|
}
|
|
}
|