|
@@ -1,20 +1,143 @@
|
|
|
package com.qmth.sop.server.api;
|
|
|
|
|
|
-
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.qmth.boot.api.annotation.Aac;
|
|
|
+import com.qmth.boot.api.annotation.BOOL;
|
|
|
+import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.sop.business.bean.result.SysMessageCountResult;
|
|
|
+import com.qmth.sop.business.bean.result.SysMessageResult;
|
|
|
+import com.qmth.sop.business.entity.TBTask;
|
|
|
+import com.qmth.sop.business.service.SysMessageService;
|
|
|
+import com.qmth.sop.business.service.TBTaskService;
|
|
|
+import com.qmth.sop.business.templete.execute.AsyncSysMessageExportService;
|
|
|
+import com.qmth.sop.common.contant.SystemConstant;
|
|
|
+import com.qmth.sop.common.enums.TaskTypeEnum;
|
|
|
+import com.qmth.sop.common.util.Result;
|
|
|
+import com.qmth.sop.common.util.ResultUtil;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.constraints.Max;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
/**
|
|
|
- * <p>
|
|
|
- * 系统消息 前端控制器
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * @author wangliang
|
|
|
- * @since 2023-08-01
|
|
|
+ * 系统消息 控制器
|
|
|
+ *
|
|
|
+ * @author: shudonghui
|
|
|
+ * @date: 2023-08-07 13:53:29
|
|
|
+ * @version: 1.0
|
|
|
+ * @email: shudonghui@qmth.com.cn
|
|
|
+ * @Company: www.qmth.com.cn
|
|
|
*/
|
|
|
+@Api(tags = "系统消息 Controller")
|
|
|
@RestController
|
|
|
-@RequestMapping("/sys-message")
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX+SystemConstant.PREFIX_URL_MESSAGE)
|
|
|
+@Validated
|
|
|
public class SysMessageController {
|
|
|
|
|
|
-}
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ SysMessageService sysMessageService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBTaskService tbTaskService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ AsyncSysMessageExportService asyncSysMessageExportService;
|
|
|
+
|
|
|
+ @Aac(auth= BOOL.FALSE)
|
|
|
+ @ApiOperation(value = "回执查询接口")
|
|
|
+ @RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "回执查询结果", response = SysMessageResult.class)})
|
|
|
+ public Result query(
|
|
|
+ @ApiParam(value = "公告表id", required = true) @RequestParam(required = true) Long noticeId,
|
|
|
+ @ApiParam(value = "区域城市", required = false) @RequestParam(required = false) String city,
|
|
|
+ @ApiParam(value = "供应商", required = false) @RequestParam(required = false) Long supplierId,
|
|
|
+ @ApiParam(value = "回执状态", required = false) @RequestParam(required = false) Boolean status,
|
|
|
+ @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
|
+ @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
|
+ IPage<SysMessageResult> resultIPage = sysMessageService.query(new Page<>(pageNumber, pageSize),noticeId,city,supplierId,status);
|
|
|
+ return ResultUtil.ok(resultIPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Aac(auth = BOOL.FALSE)
|
|
|
+ @ApiOperation(value = "回执查询导出")
|
|
|
+ @RequestMapping(value = "/export", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
|
+ public Result export(@ApiParam(value = "公告表id", required = true) @RequestParam(required = true) Long noticeId,
|
|
|
+ @ApiParam(value = "区域城市", required = false) @RequestParam(required = false) String city,
|
|
|
+ @ApiParam(value = "供应商", required = false) @RequestParam(required = false) Long supplierId,
|
|
|
+ @ApiParam(value = "回执状态", required = false) @RequestParam(required = false) Boolean status) throws Exception {
|
|
|
+ Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.MESSAGE_IMPORT);
|
|
|
+ map.put("noticeId", noticeId);
|
|
|
+ map.put("city", Objects.nonNull(city) ?city: null);
|
|
|
+ map.put("supplierId", Objects.nonNull(supplierId) ?supplierId: null);
|
|
|
+ map.put("status", Objects.nonNull(status) ?status: null);
|
|
|
+ asyncSysMessageExportService.exportTask(map);
|
|
|
+ TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
+ return ResultUtil.ok(tbTask.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ 统计已读和未读系统消息
|
|
|
+ */
|
|
|
+ @Aac(auth= BOOL.FALSE)
|
|
|
+ @ApiOperation(value = "回执统计已读和未读")
|
|
|
+ @RequestMapping(value = "/count", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = SysMessageCountResult.class)})
|
|
|
+ public Result count(@ApiParam(value = "公告表id", required = true) @RequestParam(required = true) long noticeId) throws Exception {
|
|
|
+ return ResultUtil.ok(sysMessageService.count(noticeId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// @Aac(auth= BOOL.FALSE)
|
|
|
+// @ApiOperation(value = "系统消息查询接口")
|
|
|
+// @RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "系统消息查询结果", response = SysMessage.class)})
|
|
|
+// public Result query(
|
|
|
+// @ApiParam(value = "模糊查询条件", required = false) @RequestParam(required = false) String query,
|
|
|
+// @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
|
+// @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
|
+// IPage<SysMessage> resultIPage = sysMessageService.query(new Page<>(pageNumber, pageSize),query);
|
|
|
+//
|
|
|
+// return ResultUtil.ok(resultIPage);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Aac(auth= BOOL.FALSE)
|
|
|
+// @ApiOperation(value = "系统消息新增修改接口")
|
|
|
+// @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
|
+// public Result save(@ApiParam(value = "系统消息信息", required = true) @RequestBody(required = true) SysMessage sysMessage) {
|
|
|
+// return ResultUtil.ok(sysMessageService.saveSysMessage(sysMessage));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @Aac(auth= BOOL.FALSE)
|
|
|
+// @ApiOperation(value = "系统消息删除接口")
|
|
|
+// @RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
|
+// public Result delete(@ApiParam(value = "系统消息id", required = true) @RequestParam(required = true) long id) {
|
|
|
+// return ResultUtil.ok(sysMessageService.delete(id));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @ApiOperation(value = "系统消息获取单个接口")
|
|
|
+// @RequestMapping(value = "/get", method = RequestMethod.GET)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "系统消息信息", response = SysMessage.class)})
|
|
|
+// public Result get(@ApiParam(value = "系统消息id", required = true) @RequestParam long id) {
|
|
|
+// return ResultUtil.ok(sysMessageService.getById(id));
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+}
|