Merge branch 'develop' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
		| @@ -2,11 +2,15 @@ package com.stdiet.web.controller.custom; | ||||
|  | ||||
| import com.stdiet.common.core.controller.BaseController; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.core.page.TableDataInfo; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import com.stdiet.custom.domain.SysServicesQuestion; | ||||
| import com.stdiet.custom.service.ISysServicesQuestionService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @RestController | ||||
| @RequestMapping("/services/question") | ||||
| public class SysServiceQuestionController extends BaseController { | ||||
| @@ -14,18 +18,38 @@ public class SysServiceQuestionController extends BaseController { | ||||
|     @Autowired | ||||
|     private ISysServicesQuestionService sysServicesQuestionService; | ||||
|  | ||||
|     @PostMapping("/list") | ||||
|     public AjaxResult list(@RequestBody SysServicesQuestion sysServicesQuestion) { | ||||
|         return AjaxResult.success(sysServicesQuestionService.selectSysServicesQuestionByUserIdAndRole(sysServicesQuestion)); | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(SysServicesQuestion sysServicesQuestion) { | ||||
|         startPage(); | ||||
|         return getDataTable(sysServicesQuestionService.selectSysServicesQuestionByUserIdAndRole(sysServicesQuestion)); | ||||
|     } | ||||
|  | ||||
|     @PutMapping("/updateStatus") | ||||
|     public AjaxResult status(@RequestBody SysServicesQuestion sysServicesQuestion) { | ||||
|         return toAjax(sysServicesQuestionService.updateSysServicesQuestionStatus(sysServicesQuestion)); | ||||
|     } | ||||
| //    @PutMapping("/update/status") | ||||
| //    public AjaxResult status(@RequestBody SysServicesQuestion sysServicesQuestion) { | ||||
| //        return toAjax(sysServicesQuestionService.updateSysServicesQuestionStatus(sysServicesQuestion)); | ||||
| //    } | ||||
|  | ||||
|     @PostMapping("/reply") | ||||
|     public AjaxResult reply(@RequestBody SysServicesQuestion servicesQuestion) { | ||||
|         return toAjax(sysServicesQuestionService.inserSysServicesQuestionReply(servicesQuestion)); | ||||
|         int row = sysServicesQuestionService.inserSysServicesQuestionReply(servicesQuestion); | ||||
|         if (row > 0) { | ||||
|             // 更新customer未读,id不能有值 | ||||
|             servicesQuestion.setRead(0); | ||||
|             sysServicesQuestionService.updateSysServicesQuestionStatus(servicesQuestion); | ||||
|         } | ||||
|         return toAjax(row); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/detail") | ||||
|     public AjaxResult detail(@RequestParam String queId, @RequestParam Long id) { | ||||
|         List<SysServicesQuestion> questions = sysServicesQuestionService.selectSysServicesQuestionSessionByQueId(queId); | ||||
|         if (StringUtils.isNotNull(questions)) { | ||||
|             // 更新问题对应角色的状态 | ||||
|             SysServicesQuestion servicesQuestion = new SysServicesQuestion(); | ||||
|             servicesQuestion.setRead(1); | ||||
|             servicesQuestion.setId(id); | ||||
|             sysServicesQuestionService.updateSysServicesQuestionStatus(servicesQuestion); | ||||
|         } | ||||
|         return AjaxResult.success(questions); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,54 @@ | ||||
| package com.stdiet.web.controller.custom; | ||||
|  | ||||
| import com.stdiet.common.core.controller.BaseController; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.core.page.TableDataInfo; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import com.stdiet.custom.domain.SysServicesTopic; | ||||
| import com.stdiet.custom.service.ISysServicesTopicService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @RestController | ||||
| @RequestMapping("/services/topic") | ||||
| public class SysServiceTopicController extends BaseController { | ||||
|  | ||||
|     @Autowired | ||||
|     private ISysServicesTopicService servicesTopicService; | ||||
|  | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(SysServicesTopic topic) { | ||||
|         startPage(); | ||||
|         return getDataTable(servicesTopicService.selectSysServicesTopicByUserIdAndRole(topic)); | ||||
|     } | ||||
|  | ||||
| //    @PutMapping("/update/status") | ||||
| //    public AjaxResult status(@RequestBody SysServicesQuestion sysServicesQuestion) { | ||||
| //        return toAjax(sysServicesQuestionService.updateSysServicesQuestionStatus(sysServicesQuestion)); | ||||
| //    } | ||||
|  | ||||
|     @PostMapping("/reply") | ||||
|     public AjaxResult reply(@RequestBody SysServicesTopic topic) { | ||||
|         return AjaxResult.success(servicesTopicService.inserSysServicesTopicReply(topic)); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/comment") | ||||
|     public AjaxResult comment(@RequestBody SysServicesTopic topic) { | ||||
|         return AjaxResult.success(servicesTopicService.inserSysServicesTopicComment(topic)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/detail") | ||||
|     public AjaxResult detail(@RequestParam String topicId, @RequestParam String id) { | ||||
|         List<SysServicesTopic> questions = servicesTopicService.selectSysServicesTopicSessionByTopicId(topicId); | ||||
|         if (StringUtils.isNotNull(questions)) { | ||||
|             // 更新问题对应角色的状态 | ||||
|             SysServicesTopic status = new SysServicesTopic(); | ||||
|             status.setRead(1); | ||||
|             status.setId(id); | ||||
|             servicesTopicService.updateSysServicesTopicStatus(status); | ||||
|         } | ||||
|         return AjaxResult.success(questions); | ||||
|     } | ||||
| } | ||||
| @@ -70,6 +70,8 @@ public class WechatAppletController extends BaseController { | ||||
|     private IWechatAppletService iWechatAppletService; | ||||
|     @Autowired | ||||
|     private ISysServicesQuestionService iSysServicesQuestionService; | ||||
|     @Autowired | ||||
|     private ISysServicesTopicService iSysServicesTopicService; | ||||
|  | ||||
|     /** | ||||
|      * 查询微信小程序中展示的客户案例 | ||||
| @@ -593,7 +595,7 @@ public class WechatAppletController extends BaseController { | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/services/list") | ||||
|     public AjaxResult fetchServiceQuestion(@RequestParam String customerId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) { | ||||
|     public TableDataInfo fetchServiceQuestion(@RequestParam String customerId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) { | ||||
|         startPage(); | ||||
|  | ||||
|         Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; | ||||
| @@ -602,11 +604,30 @@ public class WechatAppletController extends BaseController { | ||||
|         servicesQuestion.setRole("customer"); | ||||
|         servicesQuestion.setUserId(cusId); | ||||
|  | ||||
|         return AjaxResult.success(iSysServicesQuestionService.selectSysServicesQuestionByUserIdAndRole(servicesQuestion)); | ||||
|         return getDataTable(iSysServicesQuestionService.selectSysServicesQuestionByUserIdAndRole(servicesQuestion)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 客户添加问题 | ||||
|      * | ||||
|      * @param topic | ||||
|      * @param customerId | ||||
|      * @return | ||||
|      */ | ||||
|     @PostMapping("/services/topic/post") | ||||
|     public AjaxResult postServiceTopic(@RequestBody SysServicesTopic topic, @RequestParam String customerId) { | ||||
|         Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; | ||||
|         if (cusId == 0L) { | ||||
|             return toAjax(0); | ||||
|         } | ||||
|         topic.setUid(cusId); | ||||
|  | ||||
|         return AjaxResult.success(iSysServicesTopicService.insertSysServicesTopic(topic)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 客户添加问题 | ||||
|      * | ||||
|      * @param servicesQuestion | ||||
|      * @param customerId | ||||
|      * @return | ||||
| @@ -614,42 +635,69 @@ public class WechatAppletController extends BaseController { | ||||
|     @PostMapping("/services/post") | ||||
|     public AjaxResult postServiceQuestion(@RequestBody SysServicesQuestion servicesQuestion, @RequestParam String customerId) { | ||||
|         Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; | ||||
|         if(cusId == 0L) { | ||||
|         if (cusId == 0L) { | ||||
|             return toAjax(0); | ||||
|         } | ||||
|         servicesQuestion.setCusId(cusId); | ||||
|         return toAjax(iSysServicesQuestionService.insertSysServicesQuestion(servicesQuestion)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/services/reply") | ||||
|     public AjaxResult serviceQuestionReply(@RequestParam String queId) { | ||||
|         return AjaxResult.success(iSysServicesQuestionService.selectSysServicesQuestionSessionByQueId(queId)); | ||||
|         return AjaxResult.success(iSysServicesQuestionService.insertSysServicesQuestion(servicesQuestion)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 设置已读 | ||||
|      * @param id | ||||
|      * 回答问题 | ||||
|      * | ||||
|      * @param servicesQuestion | ||||
|      * @param customerId | ||||
|      * @return | ||||
|      */ | ||||
|     @GetMapping("/services/post/update") | ||||
|     public AjaxResult updateServiceQuestion(@RequestParam Long id) { | ||||
|         SysServicesQuestion servicesQuestion = new SysServicesQuestion(); | ||||
|         servicesQuestion.setRead(1); | ||||
|         servicesQuestion.setId(id); | ||||
|  | ||||
|         return toAjax(iSysServicesQuestionService.updateSysServicesQuestionStatus(servicesQuestion)); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/services/post/reply") | ||||
|     public AjaxResult replyServiceQuestion(@RequestBody SysServicesQuestion servicesQuestion, @RequestParam String customerId) { | ||||
|         Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; | ||||
|  | ||||
|         if (cusId == 0L) { | ||||
|             return toAjax(0); | ||||
|         } | ||||
|         servicesQuestion.setRole("customer"); | ||||
|         servicesQuestion.setUserId(cusId); | ||||
|  | ||||
|         return toAjax(iSysServicesQuestionService.inserSysServicesQuestionReply(servicesQuestion)); | ||||
|         int row = iSysServicesQuestionService.inserSysServicesQuestionReply(servicesQuestion); | ||||
|         if (row > 0) { | ||||
|             // 更新三个觉得未读,id不能有值 | ||||
|             servicesQuestion.setRead(0); | ||||
|             iSysServicesQuestionService.updateSysServicesQuestionStatus(servicesQuestion); | ||||
|         } | ||||
|  | ||||
|         return toAjax(row); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取问题详情 | ||||
|      * | ||||
|      * @param id | ||||
|      * @return | ||||
|      */ | ||||
|     @GetMapping("/services/detail") | ||||
|     public AjaxResult serviceQuestionDetail(@RequestParam String queId, @RequestParam Long id) { | ||||
|         List<SysServicesQuestion> questions = iSysServicesQuestionService.selectSysServicesQuestionSessionByQueId(queId); | ||||
|         if (StringUtils.isNotNull(questions)) { | ||||
|             SysServicesQuestion status = new SysServicesQuestion(); | ||||
|             status.setId(id); | ||||
|             status.setRead(1); | ||||
|             iSysServicesQuestionService.updateSysServicesQuestionStatus(status); | ||||
|         } | ||||
|         return AjaxResult.success(questions); | ||||
|     } | ||||
|  | ||||
|  | ||||
| //    @GetMapping("/services/post/update") | ||||
| //    public AjaxResult updateServiceQuestion(@RequestParam Long id) { | ||||
| //        SysServicesQuestion servicesQuestion = new SysServicesQuestion(); | ||||
| //        servicesQuestion.setRead(1); | ||||
| //        servicesQuestion.setId(id); | ||||
| // | ||||
| //        return toAjax(iSysServicesQuestionService.updateSysServicesQuestionStatus(servicesQuestion)); | ||||
| //    } | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user