integrated_traffic/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSecurityNoticeCon...

120 lines
4.5 KiB
Java

package com.zcloud.controller.comprehensive;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.comprehensive.TrafficSecurityNoticeService;
import com.zcloud.service.comprehensive.TrafficSecurityReadDetailService;
import com.zcloud.service.notice.NoticeCorpService;
import com.zcloud.service.notice.ServiceNoticeService;
import com.zcloud.service.system.UsersService;
import com.zcloud.util.Const;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
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/trafficNotice")
public class AppTrafficSecurityNoticeController extends BaseController {
@Autowired
private TrafficSecurityNoticeService securityNoticeService;
@Autowired
private TrafficSecurityReadDetailService trafficSecurityReadDetailService;
@Autowired
private TrafficSecurityReadDetailService securityReadDetail;
/**删除
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
// @RequiresPermissions("traininginfo:del")
@ResponseBody
public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>();
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())); //删除时间
securityNoticeService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
@RequestMapping(value = "/edit")
@ResponseBody
public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("SIGNEDDATE",DateUtil.date2Str(new Date())); // 签收时间
pd.put("SIGNING", "1"); //设置签收情况
if (pd.getString("REPLYCONTENT") != null && !pd.getString("REPLYCONTENT").isEmpty()) {
pd.put("REPLYDATE", DateUtil.date2Str(new Date())); //设置回复时间
pd.put("REPLY", "1"); //设置回复情况
}
securityReadDetail.edit(pd);
map.put("result", errInfo);
map.put("pd", pd);
return map;
}
/** 企业公告信息统计
* @param page
* @throws Exception
*/
@RequestMapping(value="/getRedPoint")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "通知公告",instructionsOperate = "通知公告",instructionsType = "企业公告信息")
public Object getRedPoint() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd.put("USER_ID", pd.getString("loginUserId"));
pd = this.getPageData();
int count1 = securityNoticeService.getRedPoint(pd);
//int count2 = noticeService.getRedPoint(pd);
map.put("count", count1);
map.put("result", errInfo);
return map;
}
/** 企业公告信息列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/listForCp")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "通知公告",instructionsOperate = "通知公告",instructionsType = "企业公告信息")
public Object listForCp(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
/*
* 1.获取关系信息
* 2.根据关系信息找到公告信息
*/
pd.put("USER_ID", pd.getString("loginUserId"));
page.setPd(pd);
List<PageData> varList = trafficSecurityReadDetailService.listByUserId(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
}