Commit e441d806 by huluobin

更新预约发送美甲师消息通知

parent 97caf669
......@@ -782,7 +782,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
scheduleManage.getArriveTime(),
baseServe.getSchTypeId(),
scheduleManage.getId());
if (ListUtil.isNotEmpty(typeConflictScheduleServe)) {
throw new RRException("同类型服务一天只能预约一次");
}
......@@ -948,6 +948,8 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
}
scheduleManage.addScheduleServeList(scheduleServeList);
this.createOrder(scheduleManage);
technicianPushService.updateScheduledMsg(scheduleManage.getId());
}
@Override
......
......@@ -9,6 +9,13 @@ public interface TechnicianPushService {
*/
void scheduledMsg(Integer scheduledId);
/**
* 修改预约提醒
*
* @param scheduledId
*/
void updateScheduledMsg(Integer scheduledId);
/**
* 取消预约提醒
......
......@@ -16,6 +16,7 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
......@@ -38,6 +39,7 @@ public class TechnicianPushServiceImpl implements TechnicianPushService {
@Resource
GogirlProperties gogirlProperties;
@Async
@Override
public void scheduledMsg(Integer scheduledId) {
ScheduleManage scheduleManage = scheduleManageMapper.selectById(scheduledId);
......@@ -60,7 +62,7 @@ public class TechnicianPushServiceImpl implements TechnicianPushService {
String content = builder.append("预约提醒\n\n")
.append("预约客户: ").append(name).append("\n")
.append("预约客户手机: ").append(phone).append("\n")
.append("预约时: ").append(date).append("\n")
.append("预约时: ").append(date).append("\n")
.append("预约技师: ").append(technicianNames).append("\n")
.append("预约项目: ").append(serves).append("\n")
.toString();
......@@ -75,6 +77,44 @@ public class TechnicianPushServiceImpl implements TechnicianPushService {
}
@Async
@Override
public void updateScheduledMsg(Integer scheduledId) {
ScheduleManage scheduleManage = scheduleManageMapper.selectById(scheduledId);
String name = scheduleManage.getStoreScheduleUsername();
String phone = scheduleManage.getTelephone();
String date = new SimpleDateFormat("yyyy年MM月dd HH:mm:ss").format(scheduleManage.getArriveTime());
List<ScheduleServe> scheduleServeList = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>().eq(ScheduleServe::getSchId, scheduledId));
String serves = scheduleServeList.stream().map(ScheduleServe::getServeName).collect(Collectors.joining(","));
List<StoreTechnician> storeTechnicianList = storeTechnicianMapper.selectBatchIds(scheduleServeList.stream().map(ScheduleServe::getTechnicianId).collect(Collectors.toList()));
String technicianNames = storeTechnicianList.stream().map(StoreTechnician::getName).collect(Collectors.joining(","));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
EnterpriseWxMsg enterpriseWxMsg = new EnterpriseWxMsg();
enterpriseWxMsg.setMsgtype("text");
EnterpriseWxMsg.EnterpriseTextWxMsg textWxMsg = new EnterpriseWxMsg.EnterpriseTextWxMsg();
StringBuilder builder = new StringBuilder();
String content = builder.append("修改预约提醒\n\n")
.append("预约客户: ").append(name).append("\n")
.append("预约客户手机: ").append(phone).append("\n")
.append("预约时间: ").append(date).append("\n")
.append("预约技师: ").append(technicianNames).append("\n")
.append("预约项目: ").append(serves).append("\n")
.toString();
textWxMsg.setMentioned_mobile_list(storeTechnicianList.stream().map(StoreTechnician::getMobile).collect(Collectors.toList()));
textWxMsg.setContent(content);
enterpriseWxMsg.setText(textWxMsg);
HttpEntity<EnterpriseWxMsg> httpEntity = new HttpEntity<>(enterpriseWxMsg, httpHeaders);
log.info("发送企业微信消息:{}", JsonUtilByFsJson.beanToJson(enterpriseWxMsg));
String response = restTemplate.exchange(gogirlProperties.getEnterpriseWechatWebhook(), HttpMethod.POST, httpEntity, String.class).getBody();
log.info("发送企业微信消息响应:{}", response);
}
@Async
@Override
public void cancelScheduledMsg(Integer scheduledId) {
ScheduleManage scheduleManage = scheduleManageMapper.selectById(scheduledId);
......@@ -112,6 +152,7 @@ public class TechnicianPushServiceImpl implements TechnicianPushService {
log.info("发送企业微信消息响应:{}", response);
}
@Async
@Override
public void ScheduledOverTimeMsg(Integer scheduledId) {
ScheduleManage scheduleManage = scheduleManageMapper.selectById(scheduledId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment