Merge branch 'develop' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
@ -0,0 +1,92 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SysServicesTopic {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
String id;
|
||||
|
||||
/**
|
||||
* 问题id
|
||||
*/
|
||||
String topicId;
|
||||
|
||||
/**
|
||||
* 问题类型
|
||||
*/
|
||||
Integer topicType;
|
||||
|
||||
String commentId;
|
||||
|
||||
String replyId;
|
||||
|
||||
Integer replyType;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
Long uid;
|
||||
|
||||
Long fromUid;
|
||||
|
||||
Long toUid;
|
||||
|
||||
/**
|
||||
* 问题内容
|
||||
*/
|
||||
String content;
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
JSONArray img;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
Date createTime;
|
||||
|
||||
/**
|
||||
* 0-未读 1-已读
|
||||
*/
|
||||
Integer read;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
Date updateTime;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
String role;
|
||||
|
||||
String fromRole;
|
||||
|
||||
String toRole;
|
||||
|
||||
// 非持久化字段
|
||||
/**
|
||||
* 角色名字
|
||||
*/
|
||||
String fromName;
|
||||
String toName;
|
||||
String name;
|
||||
|
||||
List<SysServicesTopic> comments;
|
||||
|
||||
List<SysServicesTopic> replys;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import com.stdiet.custom.domain.SysServicesQuestion;
|
||||
import com.stdiet.custom.domain.SysServicesTopic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysServicesTopicMapper {
|
||||
List<SysServicesTopic> selectSysServicesTopicByUserIdAndRole(SysServicesTopic topic);
|
||||
|
||||
int insertSysServicesTopic(SysServicesTopic topic);
|
||||
|
||||
int insertSysServicesTopicStatus(List<SysServicesTopic> topics);
|
||||
|
||||
int updateSysServicesTopicStatus(SysServicesTopic topic);
|
||||
|
||||
int inserSysServicesTopicComment(SysServicesTopic topic);
|
||||
|
||||
int inserSysServicesTopicReply(SysServicesTopic topic);
|
||||
|
||||
List<SysServicesTopic> selectSysServicesTopicSessionByTopicId(String topicId);
|
||||
}
|
@ -8,7 +8,7 @@ public interface ISysServicesQuestionService {
|
||||
|
||||
List<SysServicesQuestion> selectSysServicesQuestionByUserIdAndRole(SysServicesQuestion servicesQuestion);
|
||||
|
||||
int insertSysServicesQuestion(SysServicesQuestion servicesQuestion);
|
||||
SysServicesQuestion insertSysServicesQuestion(SysServicesQuestion servicesQuestion);
|
||||
|
||||
int updateSysServicesQuestionStatus(SysServicesQuestion sysServicesQuestion);
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import com.stdiet.custom.domain.SysServicesQuestion;
|
||||
import com.stdiet.custom.domain.SysServicesTopic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysServicesTopicService {
|
||||
|
||||
List<SysServicesTopic> selectSysServicesTopicByUserIdAndRole(SysServicesTopic topic);
|
||||
|
||||
SysServicesTopic insertSysServicesTopic(SysServicesTopic topic);
|
||||
|
||||
int updateSysServicesTopicStatus(SysServicesTopic topic);
|
||||
|
||||
SysServicesTopic inserSysServicesTopicReply(SysServicesTopic topic);
|
||||
|
||||
SysServicesTopic inserSysServicesTopicComment(SysServicesTopic topic);
|
||||
|
||||
List<SysServicesTopic> selectSysServicesTopicSessionByTopicId(String topicId);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.uuid.UUID;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysServicesQuestion;
|
||||
@ -26,9 +27,11 @@ public class SysServicesQuestionServiceImp implements ISysServicesQuestionServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSysServicesQuestion(SysServicesQuestion servicesQuestion) {
|
||||
public SysServicesQuestion insertSysServicesQuestion(SysServicesQuestion servicesQuestion) {
|
||||
// 生成uuid
|
||||
servicesQuestion.setQueId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
servicesQuestion.setRead(1);
|
||||
servicesQuestion.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
servicesQuestionMapper.insertSysServicesQuestion(servicesQuestion);
|
||||
|
||||
@ -45,25 +48,31 @@ public class SysServicesQuestionServiceImp implements ISysServicesQuestionServic
|
||||
SysServicesQuestion dieticianStatus = new SysServicesQuestion();
|
||||
dieticianStatus.setUserId(customer.getMainDietitian());
|
||||
dieticianStatus.setRole("dietician");
|
||||
customerStatus.setRead(0);
|
||||
dieticianStatus.setRead(0);
|
||||
dieticianStatus.setQueId(servicesQuestion.getQueId());
|
||||
statusList.add(dieticianStatus);
|
||||
|
||||
SysServicesQuestion afterSaleStatus = new SysServicesQuestion();
|
||||
afterSaleStatus.setUserId(customer.getAfterDietitian());
|
||||
afterSaleStatus.setRole("after_sale");
|
||||
customerStatus.setRead(0);
|
||||
afterSaleStatus.setRead(0);
|
||||
afterSaleStatus.setQueId(servicesQuestion.getQueId());
|
||||
statusList.add(afterSaleStatus);
|
||||
|
||||
SysServicesQuestion dieticianAssistantStatus = new SysServicesQuestion();
|
||||
dieticianAssistantStatus.setUserId(customer.getAssistantDietitian());
|
||||
dieticianAssistantStatus.setRole("dietician_assistant");
|
||||
customerStatus.setRead(0);
|
||||
dieticianAssistantStatus.setRead(0);
|
||||
dieticianAssistantStatus.setQueId(servicesQuestion.getQueId());
|
||||
|
||||
statusList.add(dieticianAssistantStatus);
|
||||
|
||||
return servicesQuestionMapper.insertSysServicesQuestionStatus(statusList);
|
||||
servicesQuestionMapper.insertSysServicesQuestionStatus(statusList);
|
||||
|
||||
servicesQuestion.setId(customerStatus.getId());
|
||||
servicesQuestion.setCusId(null);
|
||||
|
||||
return servicesQuestion;
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,121 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.uuid.UUID;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysServicesTopic;
|
||||
import com.stdiet.custom.mapper.SysCustomerMapper;
|
||||
import com.stdiet.custom.mapper.SysServicesTopicMapper;
|
||||
import com.stdiet.custom.service.ISysServicesTopicService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysServicesTopicServiceImp implements ISysServicesTopicService {
|
||||
@Autowired
|
||||
SysServicesTopicMapper servicesTopicMapper;
|
||||
|
||||
@Autowired
|
||||
SysCustomerMapper sysCustomerMapper;
|
||||
|
||||
@Override
|
||||
public List<SysServicesTopic> selectSysServicesTopicByUserIdAndRole(SysServicesTopic topic) {
|
||||
return servicesTopicMapper.selectSysServicesTopicByUserIdAndRole(topic);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SysServicesTopic insertSysServicesTopic(SysServicesTopic topic) {
|
||||
// 生成uuid
|
||||
topic.setTopicId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
topic.setRead(1);
|
||||
topic.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
servicesTopicMapper.insertSysServicesTopic(topic);
|
||||
|
||||
SysCustomer customer = sysCustomerMapper.selectSysCustomerById(topic.getUid());
|
||||
|
||||
List<SysServicesTopic> statusList = new ArrayList<>();
|
||||
|
||||
SysServicesTopic customerStatus = new SysServicesTopic();
|
||||
customerStatus.setUid(customer.getId());
|
||||
customerStatus.setRole("customer");
|
||||
customerStatus.setRead(1);
|
||||
customerStatus.setTopicId(topic.getTopicId());
|
||||
statusList.add(customerStatus);
|
||||
|
||||
SysServicesTopic dieticianStatus = new SysServicesTopic();
|
||||
dieticianStatus.setUid(customer.getMainDietitian());
|
||||
dieticianStatus.setRole("dietician");
|
||||
dieticianStatus.setRead(0);
|
||||
dieticianStatus.setTopicId(topic.getTopicId());
|
||||
statusList.add(dieticianStatus);
|
||||
|
||||
SysServicesTopic afterSaleStatus = new SysServicesTopic();
|
||||
afterSaleStatus.setUid(customer.getAfterDietitian());
|
||||
afterSaleStatus.setRole("after_sale");
|
||||
afterSaleStatus.setRead(0);
|
||||
afterSaleStatus.setTopicId(topic.getTopicId());
|
||||
statusList.add(afterSaleStatus);
|
||||
|
||||
SysServicesTopic dieticianAssistantStatus = new SysServicesTopic();
|
||||
dieticianAssistantStatus.setUid(customer.getAssistantDietitian());
|
||||
dieticianAssistantStatus.setRole("dietician_assistant");
|
||||
dieticianAssistantStatus.setRead(0);
|
||||
dieticianAssistantStatus.setTopicId(topic.getTopicId());
|
||||
statusList.add(dieticianAssistantStatus);
|
||||
|
||||
servicesTopicMapper.insertSysServicesTopicStatus(statusList);
|
||||
|
||||
topic.setId(customerStatus.getId());
|
||||
topic.setUid(null);
|
||||
|
||||
return topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateSysServicesTopicStatus(SysServicesTopic topic) {
|
||||
return servicesTopicMapper.updateSysServicesTopicStatus(topic);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SysServicesTopic inserSysServicesTopicReply(SysServicesTopic topic) {
|
||||
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||
topic.setId(uuid);
|
||||
int row = servicesTopicMapper.inserSysServicesTopicReply(topic);
|
||||
if (row > 0) {
|
||||
// 设置未读
|
||||
SysServicesTopic status = new SysServicesTopic();
|
||||
status.setRead(0);
|
||||
status.setTopicId(topic.getTopicId());
|
||||
status.setRole(topic.getRole());
|
||||
servicesTopicMapper.updateSysServicesTopicStatus(status);
|
||||
}
|
||||
return topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysServicesTopic inserSysServicesTopicComment(SysServicesTopic topic) {
|
||||
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||
topic.setId(uuid);
|
||||
int row = servicesTopicMapper.inserSysServicesTopicComment(topic);
|
||||
if (row > 0) {
|
||||
// 设置未读
|
||||
SysServicesTopic status = new SysServicesTopic();
|
||||
status.setRead(0);
|
||||
status.setTopicId(topic.getTopicId());
|
||||
status.setRole(topic.getRole());
|
||||
servicesTopicMapper.updateSysServicesTopicStatus(status);
|
||||
}
|
||||
return topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysServicesTopic> selectSysServicesTopicSessionByTopicId(String topicId) {
|
||||
return servicesTopicMapper.selectSysServicesTopicSessionByTopicId(topicId);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user