|
|
@@ -0,0 +1,75 @@
|
|
|
+package com.fs.company.controller.qw;
|
|
|
+
|
|
|
+
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.qw.domain.QwExternalContactCommunication;
|
|
|
+import com.fs.qw.service.IQwExternalContactCommunicationService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/qw/communication")
|
|
|
+public class QwExternalContactCommunicationController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IQwExternalContactCommunicationService communicationService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询沟通内容列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询沟通内容列表")
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:communication:list')")
|
|
|
+ @GetMapping("/list/{externalContactId}")
|
|
|
+ public AjaxResult list(@PathVariable String externalContactId) {
|
|
|
+ List<QwExternalContactCommunication> list = communicationService.getListByExternalContactId(externalContactId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增沟通内容
|
|
|
+ */
|
|
|
+ @ApiOperation("新增沟通内容")
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:communication:add')")
|
|
|
+ @Log(title = "沟通内容", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody QwExternalContactCommunication communication) {
|
|
|
+ // 设置聊天时间为当前时间(如果前端没有传)
|
|
|
+ if (communication.getChatTime() == null) {
|
|
|
+ communication.setChatTime(new Date());
|
|
|
+ }
|
|
|
+ return toAjax(communicationService.saveCommunication(communication));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改沟通内容
|
|
|
+ */
|
|
|
+ @ApiOperation("修改沟通内容")
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:communication:edit')")
|
|
|
+ @Log(title = "沟通内容", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody QwExternalContactCommunication communication) {
|
|
|
+ return toAjax(communicationService.updateById(communication));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除沟通内容
|
|
|
+ */
|
|
|
+ @ApiOperation("删除沟通内容")
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:communication:remove')")
|
|
|
+ @Log(title = "沟通内容", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult deleteCommunication(@PathVariable Long[] ids) {
|
|
|
+ // Java 8 兼容写法
|
|
|
+ return toAjax(communicationService.deleteCommunicationByIds(ids));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|