| | |
| | | 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.bus.user.HongBao;
|
| | | import com.yeshi.fanli.dto.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoManage;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | |
|
| | | @RequestMapping(value = "updateHongBaoManage", method = RequestMethod.POST)
|
| | | public void updateHongBaoManage(String map, PrintWriter out) {
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getHongBaoList", method = RequestMethod.POST)
|
| | | public void getHongBaoList(int pageIndex, String state, PrintWriter out) {
|
| | |
|
| | | List<HongBao> list = hongBaoService.getHongBaoList(pageIndex - 1, state);
|
| | |
|
| | | |
| | | JsonConfig jsonConfig = new JsonConfig(); // 建立配置文件
|
| | | jsonConfig.setIgnoreDefaultExcludes(false); // 设置默认忽略
|
| | | jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
|
| | | JSONArray hongBaoList = JSONArray.fromObject(list, jsonConfig);
|
| | |
|
| | | int count = hongBaoService.getCount(state);
|
| | | int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage);
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | map.put("state", state);
|
| | | pe.setParams(map);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("hongBaoList", hongBaoList);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|