beb2540bd753d8bf477218fdfd8997d84d1a229c.svn-base 4.15 KB
/**
 * Copyright &copy; 2015-2018 <a href="#">J-Site</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.ycsl.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSjmain;
import com.thinkgem.jeesite.modules.ycsl.entity.YcslSj;
import com.thinkgem.jeesite.modules.ycsl.service.YcslSjService;

/**
 * 一窗受理-收件材料Controller
 * @author lzj
 * @version 2020-12-26
 */
@Controller
@RequestMapping(value = "${adminPath}/ycsl/ycslSj")
public class YcslSjController extends BaseController {

	@Autowired
	private YcslSjService ycslSjService;
	
	@ModelAttribute
	public YcslSj get(@RequestParam(required=false) String id) {
		YcslSj entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = ycslSjService.get(id);
		}
		if (entity == null){
			entity = new YcslSj();
		}
		return entity;
	}
	
	@RequiresPermissions("ycsl:ycslSj:view")
	@RequestMapping(value = {"list", ""})
	public String list(YcslSj ycslSj, HttpServletRequest request, HttpServletResponse response, Model model) {
		if(StringUtils.isNotBlank(request.getParameter("WO"))) {
			model.addAttribute("WO", request.getParameter("WO"));
		}
		if(StringUtils.isNotBlank(request.getParameter("proid"))) {
			model.addAttribute("proid", request.getParameter("proid"));
		}
		if(StringUtils.isNotBlank(request.getParameter("view"))) {
			model.addAttribute("view", request.getParameter("view"));
		}
		Page<YcslSj> page = ycslSjService.findPage(new Page<YcslSj>(request, response), ycslSj); 
		model.addAttribute("page", page);
		return "modules/ycsl/ycslSjList";
	}

	@RequiresPermissions("ycsl:ycslSj:view")
	@RequestMapping(value = "form")
	public String form(YcslSj ycslSj, Model model, HttpServletRequest request) {
		if(StringUtils.isNotBlank(request.getParameter("view"))) {
			model.addAttribute("view", request.getParameter("view"));
		}
		model.addAttribute("proid", request.getParameter("proid"));
		model.addAttribute("ycslSj", ycslSj);
		return "modules/ycsl/ycslSjForm";
	}

	@RequiresPermissions("ycsl:ycslSj:edit")
	@RequestMapping(value = "save")
	public String save(YcslSj ycslSj, Model model, RedirectAttributes redirectAttributes) {
		 
		ycslSjService.saveSj(ycslSj);
		addMessage(redirectAttributes, "保存一窗受理-收件材料成功");
		return "redirect:"+Global.getAdminPath()+"/ycsl/ycslSj/list?proid="+ycslSj.getProid()+"&WO=1";
	}
	
	@RequiresPermissions("ycsl:ycslSj:edit")
	@RequestMapping(value = "delete")
	public String delete(YcslSj ycslSj, RedirectAttributes redirectAttributes) {
		ycslSjService.delete(ycslSj);
		addMessage(redirectAttributes, "删除一窗受理-收件材料成功");
		return "redirect:"+Global.getAdminPath()+"/ycsl/ycslSj/list?proid="+ycslSj.getProid();
	}
	
	/***
	* @Title: issjed 
	* @Description: 判断是否已经收件
	* @param @param request
	* @param @return    设定文件 
	* @return ModelMap    返回类型 
	* @throws
	 */
	@RequestMapping(value = "issjed")
	@ResponseBody
	public ModelMap issjed(HttpServletRequest request) {
		String ywh = request.getParameter("proid");
		YcslSj ycslSj = new YcslSj();
		ycslSj.setProid(ywh);
		List<YcslSj> findList = ycslSjService.findList(ycslSj);
		ModelMap modelMap = new ModelMap();
		if(findList.size()>0){
			modelMap.put("data", "1");//已经有收件信息记录
		}else{
			modelMap.put("data", "0");
		}
        return modelMap;
	}

}