You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aggregation-platform/src/com/platform/controller/CheckoutController.java

141 lines
4.2 KiB

package com.platform.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.base.BaseController;
import com.platform.entities.CheckoutEntity;
import com.platform.entities.PreDataInfo;
import com.platform.service.ICheckoutService;
import com.platform.utils.Configs;
/** 信息系统--校验
* @author chen
*
*/
@Controller
@RequestMapping("/checkout")
public class CheckoutController extends BaseController {
@SuppressWarnings("static-access")
public static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(CheckoutController.class);
@Resource(name = "checkoutService")
private ICheckoutService checkoutService;
/**
* 查看所有系统的 标准表情况
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/findAll")
public ModelMap findAll() throws Exception {
log.info("---------/findAll--- ");
ModelMap modelMap = new ModelMap();
List<CheckoutEntity> result = checkoutService.findAll();
modelMap.addAttribute("data", result);
modelMap.addAttribute("length", result.size());
return modelMap;
}
/**
* 查看所有系统的 标准表情况
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/findByCity")
public ModelMap findByCity(@RequestBody String cityName, HttpServletRequest req, HttpServletResponse res) throws Exception {
log.info("---------/findByCity--- "+cityName);
ModelMap modelMap = new ModelMap();
List<CheckoutEntity> result = checkoutService.findByCity(cityName);
modelMap.addAttribute("data", result);
modelMap.addAttribute("length", result.size());
return modelMap;
}
/**
* 校验勾选的数据
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/checkList")
public ModelMap checkList(@RequestBody List<CheckoutEntity> form, HttpServletRequest req, HttpServletResponse res) throws Exception {
ModelMap modelMap = new ModelMap();
if (null != form) {
log.info("---------/checkList--- "+ form.size());
List<CheckoutEntity> result = checkoutService.checkAll(form);
List<CheckoutEntity> data = new ArrayList<CheckoutEntity>();
modelMap.addAttribute("data", result);
modelMap.addAttribute("length", result.size());
}
else {
log.info("---------/checkList--- "+ form);
}
return modelMap;
}
/**
* 查看单条数据的修改详情
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/findDetails")
public ModelMap findDetails(@RequestBody CheckoutEntity form, HttpServletRequest req, HttpServletResponse res) throws Exception {
ModelMap modelMap = new ModelMap();
if (null != form) {
log.info("---------/findDetails--- "+ form);
Map<String, PreDataInfo> result = checkoutService.findDetail(form);
modelMap.addAllAttributes(result);
}
else {
log.info("---------/findDetails--- "+ form);
}
return modelMap;
}
/**
* 查看单条数据的修改详情
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/update")
public ModelMap update(@RequestBody PreDataInfo form, HttpServletRequest req, HttpServletResponse res) throws Exception {
ModelMap modelMap = new ModelMap();
if (null != form) {
log.info("---------/update--- "+ form);
int result = checkoutService.updateStandardInfo(form);
if (result == 0) {
res.setStatus(500);
}
else {
List<CheckoutEntity> data = checkoutService.findByCity(form.getCityName());
modelMap.addAttribute("data", data);
modelMap.addAttribute("length", data.size());
}
}
else {
log.info("---------/update--- "+ form);
res.setStatus(500);
}
return modelMap;
}
}