|
@@ -0,0 +1,93 @@
|
|
|
|
+package cn.ezhizao.project.business.message.controller;
|
|
|
|
+
|
|
|
|
+import cn.ezhizao.common.utils.poi.ExcelUtil;
|
|
|
|
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
|
|
|
|
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
|
|
|
|
+import cn.ezhizao.framework.web.controller.BaseController;
|
|
|
|
+import cn.ezhizao.framework.web.domain.AjaxResult;
|
|
|
|
+import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
|
|
+import cn.ezhizao.project.business.message.domain.BizMessage;
|
|
|
|
+import cn.ezhizao.project.business.message.service.IBizMessageService;
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/business/message")
|
|
|
|
+public class BizMessageController extends BaseController {
|
|
|
|
+ @Resource
|
|
|
|
+ IBizMessageService bizMessageService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询消息列表
|
|
|
|
+ */
|
|
|
|
+// @PreAuthorize("@ss.hasPermi('business:carrier:list')")
|
|
|
|
+ @Log(title = "查询消息列表", businessType = BusinessType.SELECT)
|
|
|
|
+ @GetMapping("/list")
|
|
|
|
+ public TableDataInfo list(BizMessage data) throws NoSuchFieldException, IllegalAccessException, JsonProcessingException {
|
|
|
|
+ Integer zero = 0;
|
|
|
|
+// String tenantId = request.getHeader("tenantId");
|
|
|
|
+// if (tenantId != null && !zero.toString().equals(tenantId)) {
|
|
|
|
+// data.setTenantId(Long.valueOf(tenantId));
|
|
|
|
+// }
|
|
|
|
+ startPage();
|
|
|
|
+ List<BizMessage> list = bizMessageService.getList(data);
|
|
|
|
+ return getDataTable(list);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 导出消息列表
|
|
|
|
+ */
|
|
|
|
+ @Log(title = "报工技术咨询", businessType = BusinessType.EXPORT)
|
|
|
|
+ @PostMapping("/export")
|
|
|
|
+ public void export(HttpServletResponse response, BizMessage bizDayworkItemConsult) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
+ {
|
|
|
|
+ setTenantId(bizDayworkItemConsult);
|
|
|
|
+ List<BizMessage> list = bizMessageService.getList(bizDayworkItemConsult);
|
|
|
|
+ ExcelUtil<BizMessage> util = new ExcelUtil<BizMessage>(BizMessage.class);
|
|
|
|
+ util.exportExcel(response, list, "报工技术咨询数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取消息详情
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
+ {
|
|
|
|
+ return success(bizMessageService.getById(id));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增消息
|
|
|
|
+ */
|
|
|
|
+ @Log(title = "新增消息", businessType = BusinessType.INSERT)
|
|
|
|
+ @PostMapping
|
|
|
|
+ public AjaxResult add(@RequestBody BizMessage bizDayworkItemConsult) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
+ {
|
|
|
|
+// setTenantId(bizDayworkItemConsult);
|
|
|
|
+ return toAjax(bizMessageService.save(bizDayworkItemConsult));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改消息信息
|
|
|
|
+ */
|
|
|
|
+ @Log(title = "修改消息", businessType = BusinessType.UPDATE)
|
|
|
|
+ @PutMapping
|
|
|
|
+ public AjaxResult edit(@RequestBody BizMessage bizDayworkItemConsult) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
+ {
|
|
|
|
+// setTenantId(bizDayworkItemConsult);
|
|
|
|
+ return toAjax(bizMessageService.updateById(bizDayworkItemConsult));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除报工技术咨询
|
|
|
|
+ */
|
|
|
|
+ @Log(title = "删除消息", businessType = BusinessType.DELETE)
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
+ public AjaxResult remove(@PathVariable List<Long> ids)
|
|
|
|
+ {
|
|
|
|
+ return toAjax(bizMessageService.removeBatchByIds(ids));
|
|
|
|
+ }
|
|
|
|
+}
|