|
@@ -2,14 +2,18 @@ package com.chuanghai.repair.controller;
|
|
|
|
|
|
|
|
import com.chuanghai.repair.entity.RepairsNotice;
|
|
import com.chuanghai.repair.entity.RepairsNotice;
|
|
|
import com.chuanghai.repair.service.RepairsNoticeService;
|
|
import com.chuanghai.repair.service.RepairsNoticeService;
|
|
|
|
|
+import com.chuanghai.repair.utils.CreateTokenUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -30,15 +34,15 @@ public class NoticeController {
|
|
|
|
|
|
|
|
@ApiOperation("添加公告")
|
|
@ApiOperation("添加公告")
|
|
|
@PostMapping(value = "/addNotice")
|
|
@PostMapping(value = "/addNotice")
|
|
|
- public Boolean addNotice(@ApiParam(name = "公告内容", required = true) String noticeContent,
|
|
|
|
|
- @ApiParam(name = "发布时间") String noticeTime,
|
|
|
|
|
- @ApiParam(name = "发布管理员Id") Integer adminId) {
|
|
|
|
|
|
|
+ public Boolean addNotice(HttpServletRequest request,
|
|
|
|
|
+ @ApiParam(name = "公告内容", required = true) String noticeContent) {
|
|
|
//flag false 添加失败 true 添加成功
|
|
//flag false 添加失败 true 添加成功
|
|
|
Boolean flag = Boolean.FALSE;
|
|
Boolean flag = Boolean.FALSE;
|
|
|
try {
|
|
try {
|
|
|
|
|
+ Integer adminId =Integer.parseInt(CreateTokenUtil.getHeadersInfo(request)) ;
|
|
|
if (adminId != null) {
|
|
if (adminId != null) {
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- noticeTime = df.format(new Date());
|
|
|
|
|
|
|
+ String noticeTime = df.format(new Date());
|
|
|
repairsNoticeService.addNotice(noticeContent, noticeTime, adminId);
|
|
repairsNoticeService.addNotice(noticeContent, noticeTime, adminId);
|
|
|
flag = Boolean.TRUE;
|
|
flag = Boolean.TRUE;
|
|
|
}
|
|
}
|
|
@@ -60,8 +64,9 @@ public class NoticeController {
|
|
|
return repairsNotice;
|
|
return repairsNotice;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // @ApiOperation("删除公告")
|
|
|
|
|
-// @PostMapping(value = "/updateNotice")
|
|
|
|
|
|
|
+ @ApiIgnore
|
|
|
|
|
+ @ApiOperation("删除公告")
|
|
|
|
|
+ @PostMapping(value = "/updateNotice")
|
|
|
public Boolean updateNotice(@ApiParam(name = "公告Id", required = true) String noticeId) {
|
|
public Boolean updateNotice(@ApiParam(name = "公告Id", required = true) String noticeId) {
|
|
|
Boolean flag = Boolean.FALSE;
|
|
Boolean flag = Boolean.FALSE;
|
|
|
try {
|
|
try {
|
|
@@ -74,8 +79,10 @@ public class NoticeController {
|
|
|
return flag;
|
|
return flag;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @ApiOperation("修改公告")
|
|
|
|
|
-// @PostMapping(value = "/alterNotice")
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @ApiIgnore
|
|
|
|
|
+ @ApiOperation("修改公告")
|
|
|
|
|
+ @PostMapping(value = "/alterNotice")
|
|
|
public Boolean alterNotice(@ApiParam(name = "公告内容", required = true) String noticeContent,
|
|
public Boolean alterNotice(@ApiParam(name = "公告内容", required = true) String noticeContent,
|
|
|
@ApiParam(name = "修改时间") String noticeTime,
|
|
@ApiParam(name = "修改时间") String noticeTime,
|
|
|
@ApiParam(name = "公告Id", required = true) Integer noticeId) {
|
|
@ApiParam(name = "公告Id", required = true) Integer noticeId) {
|