package com.zcloud.controller.comprehensive; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.comprehensive.TrafficSafetyMeetingRecipienService; import com.zcloud.service.comprehensive.TrafficSafetyMeetingService; import com.zcloud.util.*; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.multipart.MultipartFile; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping("/app/safetymeeting") public class AppTrafficSafetyMeetingController extends BaseController { @Autowired private TrafficSafetyMeetingService trafficSafetyMeetingService; @Autowired private TrafficSafetyMeetingRecipienService meetingRecipienService; //列表 @RequestMapping(value = "/listForSafetyMeeting") @ResponseBody public Object listForSecurityNotice(Page page) throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String MEETING_TITLE = pd.getString("MEETING_TITLE"); // 关键词检索条件 if (Tools.notEmpty(MEETING_TITLE)) pd.put("MEETING_TITLE", MEETING_TITLE.trim()); String MEETING_TYPE = pd.getString("MEETING_TYPE"); // 关键词检索条件 if (Tools.notEmpty(MEETING_TYPE)) pd.put("MEETING_TYPE", MEETING_TYPE.trim()); page.setPd(pd); List varList = trafficSafetyMeetingService.listForSafetyMeeting(page); map.put("varList", varList); map.put("page", page); map.put("result", errInfo); return map; } /**删除 * @param * @throws Exception */ @RequestMapping(value="/delete") @ResponseBody public Object delete() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("DELETOR", Jurisdiction.getUSER_ID());//删除人id pd.put("DELETORNAME", Jurisdiction.getUsername());//删除人姓名 pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间 trafficSafetyMeetingService.delete(pd); map.put("result", errInfo); return map; } //详情 @RequestMapping(value="/goEdit") @ResponseBody public Object goEdit() throws Exception { Map map = new HashMap<>(); String errInfo = "success"; PageData pd = this.getPageData(); pd = trafficSafetyMeetingService.findById(pd); // 根据ID读取 if (pd == null) { map.put("pd", pd); // 这里pd是null map.put("result", errInfo); return map; } List varList = trafficSafetyMeetingService.listForSafetyMeetingRecipient(pd); int realPersonNum = 0; for (PageData pageData : varList) { if ("1".equals(pageData.getString("ATTENDANCE_STATUS"))) { realPersonNum++; } } pd.put("totalPersonNum", varList.size()); pd.put("realPersonNum", realPersonNum); pd.put("recipientsList", varList); map.put("pd", pd); map.put("result", errInfo); return map; } //修改 @RequestMapping(value = "/edit") @ResponseBody public Object edit() throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id pd.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 经营企业 meetingRecipienService.edit(pd); map.put("result", errInfo); map.put("pd", pd); return map; } }