|
@@ -0,0 +1,126 @@
|
|
|
+package com.gree.mall.manager.controller.notice;
|
|
|
+
|
|
|
+import cn.hutool.core.lang.TypeReference;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gree.mall.manager.annotation.ZfireList;
|
|
|
+import com.gree.mall.manager.bean.notice.*;
|
|
|
+import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
+import com.gree.mall.manager.helper.ResponseHelper;
|
|
|
+import com.gree.mall.manager.logic.notice.NoticeLogic;
|
|
|
+import com.gree.mall.manager.logic.notice.NoticeWebsitLogic;
|
|
|
+import com.gree.mall.manager.plus.entity.NoticeWebsit;
|
|
|
+import com.gree.mall.manager.plus.entity.NoticeWebsitRecord;
|
|
|
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
+import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@Api(value = "网点通知API", tags = {"网点通知API"})
|
|
|
+@RequestMapping(value = "/noticeWebsit", produces = "application/json; charset=utf-8")
|
|
|
+public class NoticeWebsitController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private NoticeWebsitLogic noticeWebsitLogic;
|
|
|
+
|
|
|
+
|
|
|
+ @ZfireList
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ApiOperation(value = "通知列表")
|
|
|
+ public ResponseHelper<IPage<NoticeWebsitVO>> list(
|
|
|
+ @RequestBody ZfireParamBean zfireParamBean
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
|
|
|
+ IPage<NoticeWebsitVO> stockBeanIPage = noticeWebsitLogic.list(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
|
|
|
+ return ResponseHelper.success(stockBeanIPage, new TypeReference<NoticeWebsitVO>() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/list/export")
|
|
|
+ @ApiOperation(value = "通知列表导出")
|
|
|
+ public void listExport(
|
|
|
+ @RequestBody ZfireParamBean zfireParamBean,
|
|
|
+ HttpServletRequest request,
|
|
|
+ HttpServletResponse response
|
|
|
+ ) throws Exception {
|
|
|
+ //1.组装查询条件
|
|
|
+ ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
|
|
|
+ //2.查询要导出的内容
|
|
|
+ IPage<NoticeWebsitVO> stockBeanIPage = noticeWebsitLogic.list(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
|
|
|
+ //3.导出
|
|
|
+ FieldUtils.exportData(stockBeanIPage.getRecords(), zfireParam.getExportFields(), request, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperation(value = "消息详情")
|
|
|
+ public ResponseHelper<NoticeWebsit> detail(
|
|
|
+ @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
|
|
|
+ ){
|
|
|
+ NoticeWebsit detail = noticeWebsitLogic.detail(id);
|
|
|
+ return ResponseHelper.success(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ApiOperation(value = "通知-新增")
|
|
|
+ public ResponseHelper add(@RequestBody NoticeWebsitBean noticeBean) {
|
|
|
+ noticeWebsitLogic.add(noticeBean);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation(value = "通知-修改")
|
|
|
+ public ResponseHelper update(@RequestBody NoticeWebsitBean noticeBean) {
|
|
|
+ noticeWebsitLogic.update(noticeBean);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/ofOrSend")
|
|
|
+ @ApiOperation(value = "通知-关闭修改")
|
|
|
+ public ResponseHelper ofOrSend(
|
|
|
+ @ApiParam(value = "id", required = true) @RequestParam(required = true) String id,
|
|
|
+ @ApiParam(value = "SEND 发布 OFF 关闭", required = true) @RequestParam(required = true) String status
|
|
|
+
|
|
|
+ ) {
|
|
|
+ noticeWebsitLogic.ofOrSend(id,status);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ZfireList
|
|
|
+ @PostMapping("/listWebsit")
|
|
|
+ @ApiOperation(value = "网点通知信息列表")
|
|
|
+ public ResponseHelper<IPage<NoticeWebsitRecordVO>> listWebsit(
|
|
|
+ @RequestBody ZfireParamBean zfireParamBean
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
|
|
|
+ IPage<NoticeWebsitRecordVO> stockBeanIPage = noticeWebsitLogic.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
|
|
|
+ return ResponseHelper.success(stockBeanIPage, new TypeReference<NoticeWebsitRecordVO>() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/listWebsit/export")
|
|
|
+ @ApiOperation(value = "网点通知信息列表导出")
|
|
|
+ public void listWebsitExport(
|
|
|
+ @RequestBody ZfireParamBean zfireParamBean,
|
|
|
+ HttpServletRequest request,
|
|
|
+ HttpServletResponse response
|
|
|
+ ) throws Exception {
|
|
|
+ //1.组装查询条件
|
|
|
+ ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
|
|
|
+ //2.查询要导出的内容
|
|
|
+ IPage<NoticeWebsitRecordVO> stockBeanIPage = noticeWebsitLogic.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
|
|
|
+ //3.导出
|
|
|
+ FieldUtils.exportData(stockBeanIPage.getRecords(), zfireParam.getExportFields(), request, response);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|