Commit a16ecffb by huluobin

Merge branch 'technician_push' into branch

# Conflicts:
#	src/main/java/com/gogirl/application/order/serve/impl/ScheduleManageServiceImpl.java
#	src/main/java/com/gogirl/infrastructure/service/push/impl/TechnicianPushServiceImpl.java
parents 1b0778b0 185598ad
......@@ -102,7 +102,6 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
private final PurchaseSkuMapper purchaseSkuMapper;
private final BaseProduceMapper baseProduceMapper;
private final TechnicianPushService technicianPushService;
@Override
......@@ -589,6 +588,8 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
});
scheduleManageMapper.updateById(scheduleManage);
technicianPushService.cancelScheduledMsg(scheduleManage.getId());
}
@Override
......
......@@ -44,6 +44,7 @@ import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper;
import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper;
import com.gogirl.infrastructure.service.push.PushMsgService;
import com.gogirl.infrastructure.service.push.TechnicianPushService;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -113,6 +114,7 @@ public class Schedule {
* config
*/
private final GogirlProperties gogirlProperties;
private final TechnicianPushService technicianPushService;
/**
* 每天3点判断优惠券是否过期。
......@@ -201,11 +203,16 @@ public class Schedule {
Customer customer = customerService.getById(scheduleManage.getScheduledUser());
StoreManage storeManage = storeManageService.getById(scheduleManage.getDepartmentId());
/*用户超时提醒*/
List<ScheduleServe> scheduleServeList = scheduleManageMapper.selectByScheduleId(scheduleManage.getId());
pushMsgService.sendScheduleMsg(customer.getOpenid1(), scheduleServeList.get(0).getServeName(), scheduleManage.getArriveTime(), storeManage.getName(), storeManage.getAddress());
/*美甲师超时预约提醒*/
technicianPushService.ScheduledOverTimeMsg(scheduleManage.getId());
scheduleManage.setIsSend(1);
scheduleManageMapper.updateById(scheduleManage);
}
});
......
......@@ -77,11 +77,76 @@ public class TechnicianPushServiceImpl implements TechnicianPushService {
@Override
public void cancelScheduledMsg(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")
.append("取消原因: 用户取消")
.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);
}
@Override
public void ScheduledOverTimeMsg(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")
.append("取消原因: 超时取消"))
.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);
}
}
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