Commit 39098d3b by huluobin

Merge branch 'branch' into fix_coupon

parents fa58fb0e 577dee1d
......@@ -58,6 +58,7 @@ public class CouponCustomerRelevanceServiceImpl extends ServiceImpl<CouponCustom
.eq(CouponCustomerRelevance::getCustomerId, currentCustomerId)
//内部券
.eq(CouponCustomerRelevance::getSourceType, 0)
//卡券状态 正常
.eq(CouponCustomerRelevance::getState, 1))
//
.stream()
......
......@@ -425,9 +425,9 @@ public class MarketServiceImpl implements MarketService {
if (orderServe != null) {
BigDecimal discountAmount = couponCustomerRelevance.getDiscountAmount();
// if (couponCustomerRelevance.getType() == 5) {
// discountAmount = orderServe.getPrice().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
// }
if (couponCustomerRelevance.getType() == 5) {
discountAmount = orderServe.getPrice().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
}
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(discountAmount);
//新增外部券抵扣情况记录
......@@ -494,6 +494,10 @@ public class MarketServiceImpl implements MarketService {
if (!total.setScale(2, BigDecimal.ROUND_HALF_UP).equals(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP))) {
//卡券的总折扣金额
BigDecimal totalCouponDiscount = couponCustomerRelevance.getDiscountAmount();
// //折扣券
// if (couponCustomerRelevance.getType().equals(CouponCustomerRelevance.TYPE_DISCOUNT)) {
// totalCouponDiscount = orderManage.getTotalPaymentAmount().multiply(couponCustomerRelevance.getDiscountPercent());
// }
//卡券总支付金额
BigDecimal totalCouponPay = couponCustomerRelevance.getPayAmount();
......@@ -569,12 +573,26 @@ public class MarketServiceImpl implements MarketService {
//6、普通内部券
List<CouponCustomerRelevance> normalInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList
.stream()
//不是免单券
.filter(couponCustomerRelevance -> !discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId()))
//不是折扣券
.filter(couponCustomerRelevance -> !couponCustomerRelevance.getType().equals(CouponCustomerRelevance.TYPE_DISCOUNT))
.collect(Collectors.toList());
if (normalInnerCouponCustomerRelevanceServiceList.size() > 1) {
throw new RRException("普通内部券只能用一张");
}
normalInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer);
//6、折扣内部券
List<CouponCustomerRelevance> discountInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList
.stream()
//不是免单券
.filter(couponCustomerRelevance -> !discountConfigListCouponId.contains(couponCustomerRelevance.getCouponId()))
//是折扣券
.filter(couponCustomerRelevance -> couponCustomerRelevance.getType().equals(CouponCustomerRelevance.TYPE_DISCOUNT))
.collect(Collectors.toList());
discountInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer);
}
orderManageMapper.updateById(orderManage);
......
......@@ -73,7 +73,7 @@ public interface ScheduleManageService extends IService<ScheduleManage> {
* @param scheduleServeId 预约服务id
* @param status 状态
*/
void updateScheduledServeStatus(Integer scheduleServeId, Integer status,Integer forceLeisureConfig);
void updateScheduledServeStatus(Integer scheduleServeId, Integer status, Integer forceLeisureConfig);
/**
......
......@@ -44,6 +44,7 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMessageMapper;
import com.gogirl.infrastructure.service.push.PushMsgService;
import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.shared.market.command.SetUpInnerCouponCommand;
import com.gogirl.shared.member.order.command.CreateCommentCommand;
import com.gogirl.shared.member.order.command.OrderCommentCommand;
import com.gogirl.shared.order.serve.query.qry.ordermanage.ListOrderQuery;
......@@ -382,6 +383,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
if (param.getShowUnCheck() != null && !param.getShowUnCheck()) {
wrapper.ne(OrderManage::getStatus, OrderManage.STATUS_SYSTEM_UN_CHECK);
}
wrapper.ne(OrderManage::getStatus, OrderManage.STATUS_DELETED);
//noinspection unchecked
wrapper.orderByDesc(OrderManage::getCreateTime);
......@@ -450,6 +452,20 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
name = orderServe.getProduceName();
}
Customer customer = customerService.selectByCustomerId(orderManage.getOrderUser());
//todo 考虑代付
List<CouponCustomerRelevance> couponCustomerRelevanceList = couponCustomerRelevanceService.getOrderCoupon(orderManage.getOrderUser(), orderId);
couponCustomerRelevanceList.stream()
.filter(couponCustomerRelevance -> couponCustomerRelevance.getDiscountAmount() != null)
.filter(couponCustomerRelevance -> couponCustomerRelevance.getDiscountAmount().compareTo(orderManage.getTotalPaymentAmount()) <= 0)
.findAny()
.ifPresent(couponCustomerRelevance -> {
marketService.setUpInnerCoupon(SetUpInnerCouponCommand.builder()
.orderId(orderId)
.innerCouponCustomerRelevanceIds(Lists.newArrayList(couponCustomerRelevance.getId()))
.build());
});
pushMsgService.sendOrderPayNotifyMsg(orderId,
customer.getOpenid1(),
......@@ -1011,7 +1027,6 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
return this.aggregateOrderManage(orderManage);
}
@Override
public Double countOrderDataRate(Customer c, OrderManage om) {
double dataRate = 0;
......
......@@ -42,6 +42,7 @@ import com.gogirl.infrastructure.mapper.product.serve.TechnicianServeMapper;
import com.gogirl.infrastructure.mapper.store.oa.TakeLeaveEventMapper;
import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper;
import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper;
import com.gogirl.infrastructure.service.push.TechnicianPushService;
import com.gogirl.infrastructure.util.MapDistanceUtils;
import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.shared.order.serve.command.schedule.*;
......@@ -101,6 +102,8 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
private final PurchaseSkuMapper purchaseSkuMapper;
private final BaseProduceMapper baseProduceMapper;
private final TechnicianPushService technicianPushService;
@Override
public List<StoreTechnicianPeriod> queryStoreTechnicianPeriod(Integer scheduledId,
Integer departmentId,
......@@ -585,6 +588,8 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
});
scheduleManageMapper.updateById(scheduleManage);
technicianPushService.cancelScheduledMsg(scheduleManage.getId());
}
@Override
......@@ -594,13 +599,15 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
@Override
public void updateScheduledServeStatus(Integer scheduleServeId, Integer status, Integer forceLeisureConfig) {
/*1、校验*/
ScheduleServe scheduleServe = scheduleServeMapper.selectById(scheduleServeId);
if (scheduleServe.getMainServeId() != null) {
throw new RRException("不能对辅助服务开单");
}
//所有需要更新的服务
List<ScheduleServe> updateList = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>()
.eq(ScheduleServe::getSchId, scheduleServe.getSchId())
.eq(ScheduleServe::getServeId, scheduleServe.getServeId()));
List<ScheduleServe> updateList = scheduleServeMapper.selectUpdateStatusList(scheduleServe.getSchId(), scheduleServe.getServeId());
//预约
ScheduleManage scheduleManage = scheduleManageMapper.selectById(scheduleServe.getSchId());
//更新某一个服务状态已完成
......@@ -783,44 +790,57 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
/*2、校验提交的预约时间是否可约*/
IdleTimeQuery query = new IdleTimeQuery();
//店铺id
query.setDepartmentId(scheduleManage.getDepartmentId());
//预约日期
query.setScheduleDate(new SimpleDateFormat("yyyy-MM-dd").format(scheduleManage.getArriveTime()));
query.setListScheduleServer(scheduleManage.getListScheduleServer()
.stream()
.map(scheduleServeCommand -> {
ScheduleServeQuery scheduleServe = new ScheduleServeQuery();
//时长
scheduleServe.setLengthTimeForEndTime(scheduleServeCommand.getLengthTime());
//款式id
scheduleServe.setProduceId(scheduleServeCommand.getProduceId());
//服务id
scheduleServe.setServeId(scheduleServeCommand.getServeId());
return scheduleServe;
})
.collect(Collectors.toList()));
//是否显示详情
query.setShowNodeDetail(true);
//查询时间节点
query.setDateTimeList(Lists.newArrayList(scheduleManage.getArriveTime().getTime()));
//查询方案树
List<IdleTimeDTO> idleTimeDTOList = this.queryIdleTime(query);
//如果时间节点不可用返回false
IdleTimeDTO idleTimeDTO = idleTimeDTOList.stream().findAny().orElseThrow(NullPointerException::new);
if (!idleTimeDTO.isStatus()) {
throw new RRException("预约时间不可用");
}
/*3、判断美甲师是否是可用的美甲师*/
//构造子树
List<TreeProgram> treeProgramList = new ArrayList<>();
TreeProgram treeProgram = new TreeProgram();
List<ScheduleServe> scheduleServeList = scheduleManage.getListScheduleServer()
.stream()
.filter(scheduleServe -> scheduleServe.getServeId() == null)
.collect(Collectors.toList());
List<List<ScheduleServe>> params = new ArrayList<>();
scheduleServeList.forEach(scheduleServe -> {
params.add(CloneUtil.deepClone(scheduleServeList));
});
/*3、如果是指定美甲师、判断美甲师是否仍然可用*/
//构造路径
// List<TreeProgram> treeProgramList = new ArrayList<>();
// TreeProgram treeProgram = new TreeProgram();
// List<ScheduleServe> scheduleServeList = scheduleManage.getListScheduleServer()
// .stream()
// .filter(scheduleServe -> scheduleServe.getServeId() == null)
// .collect(Collectors.toList());
//
// //方案树
// TreeProgram targetTree = idleTimeDTO.getTreeProgram();
//
// boolean isPath = treeProgram.isSubTree(targetTree);
// if (!isPath) {
// throw new RRException("请重新选择美甲师");
// }
}
}
/**
* ScheduleManageServiceImpl
* 通过ScheduleServe构建TreeProgram
*
* @param scheduleServe
......@@ -869,6 +889,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
public void submitSchedule(SubmitScheduleCommand cmd) throws ParseException, ExecutionException, InterruptedException {
/*1、校验*/
cmd.getScheduleManageDTO().setScheduledUser(SessionUtils.getCustomerId());
//参数补全
ScheduleManage scheduleManage = this.setScheduleServe(cmd.getScheduleManageDTO(), cmd.getDefaultNodeList());
this.validSubmit(scheduleManage);
......@@ -881,15 +902,18 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
scheduleManage.setScheduledTime(new Date());
//
scheduleManage.setRemark(scheduleManage.getScheduledUser() + "用户提交预约");
//保存预约
/*2、保存预约*/
scheduleManageMapper.insert(scheduleManage);
scheduleManage.getScheduleServeList().forEach(scheduleServe -> {
scheduleServe.setCreateTime(new Date());
scheduleServe.setSchId(scheduleManage.getId());
});
//保存预约详情
/*2、保存预约详情*/
scheduleManage.getScheduleServeList().forEach(scheduleServeMapper::insert);
/*3、发送美甲师通知*/
technicianPushService.scheduledMsg(scheduleManage.getId());
}
@Override
......@@ -1039,6 +1063,8 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
wrapper.like(ScheduleManage::getTelephone, qry.getPhone());
}
wrapper.ne(ScheduleManage::getStatus, ScheduleManage.STATUS_DELETED);
//已预约 服务中
if (Lists.newArrayList(1, 8).contains(qry.getStatus())) {
wrapper.orderByAsc(ScheduleManage::getArriveTime);
......@@ -1139,7 +1165,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
List<ScheduleServeCommand> scheduleServeCommandList = cmd.getScheduleServeDTOList();
//根据defaultNodeList的参数设置服务开始时间,服务结束时间,服务美甲师
//如果defaultNodeList不为空 根据defaultNodeList的参数设置服务开始时间,服务结束时间,服务美甲师
if (ListUtil.isNotEmpty(defaultNodeList)) {
defaultNodeList.forEach(defaultNode -> {
scheduleServeCommandList
......
......@@ -26,6 +26,8 @@ public class CouponCustomerRelevance implements Serializable {
public static Integer STATE_USED = 2;
public static Integer SOURCE_TYPE_INNER = 0;
public static Integer SOURCE_TYPE_OUTER = 1;
public static Integer TYPE_DISCOUNT = 6;
@TableId(type = IdType.AUTO)
private Integer id;
......
......@@ -37,6 +37,9 @@ public class ScheduleManage implements Serializable {
public static final Integer STATUS_MISS_SCHEDULED = 3;
//取消预约
public static final Integer STATUS_CANCEL_SCHEDULED = 4;
public static final Integer STATUS_DELETED = 5;
//服务中
public static final Integer STATUS_SERVING = 8;
//用户端预约
......
package com.gogirl.dto;
import lombok.Data;
import java.util.List;
@Data
public class EnterpriseWxMsg {
private String msgtype;
private EnterpriseTextWxMsg text;
@Data
public static class EnterpriseTextWxMsg {
private String content;
private List<String> mentioned_mobile_list;
}
}
......@@ -62,4 +62,6 @@ public class GogirlProperties {
private String adminBackendUrl;
private String adminBackendAchievementsUrl;
private String enterpriseWechatWebhook;
}
......@@ -13,4 +13,13 @@ public interface ScheduleServeMapper extends BaseMapper<ScheduleServe> {
@Param("days") Date days,
@Param("schTypeId") Integer schTypeId,
@Param("serveId") Integer serveId);
/**
* 更新服务状态需要更新的预约服务列表
*
* @param schId
* @param serveId
* @return
*/
List<ScheduleServe> selectUpdateStatusList(@Param("schId") Integer schId, @Param("serveId") Integer serveId);
}
......@@ -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);
}
});
......
......@@ -8,6 +8,15 @@ import java.util.Date;
*/
public interface PushMsgService {
/**
* 发送预约消息
*
* @param openId
* @param scheduleName
* @param arriveTime
* @param departmentName
* @param address
*/
void sendScheduleMsg(String openId,
String scheduleName,
Date arriveTime,
......
package com.gogirl.infrastructure.service.push;
public interface TechnicianPushService {
/**
* 预约提醒
*
* @param scheduledId
*/
void scheduledMsg(Integer scheduledId);
/**
* 取消预约提醒
*
* @param scheduledId
*/
void cancelScheduledMsg(Integer scheduledId);
/**
* 预约过期
*
* @param scheduledId
*/
void ScheduledOverTimeMsg(Integer scheduledId);
}
package com.gogirl.infrastructure.service.push.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gogirl.domain.order.serve.ScheduleManage;
import com.gogirl.domain.order.serve.ScheduleServe;
import com.gogirl.domain.store.store.StoreTechnician;
import com.gogirl.dto.EnterpriseWxMsg;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.mapper.order.serve.ScheduleManageMapper;
import com.gogirl.infrastructure.mapper.order.serve.ScheduleServeMapper;
import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper;
import com.gogirl.infrastructure.service.push.TechnicianPushService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class TechnicianPushServiceImpl implements TechnicianPushService {
@Resource
RestTemplate restTemplate;
@Resource
ScheduleManageMapper scheduleManageMapper;
@Resource
ScheduleServeMapper scheduleServeMapper;
@Resource
StoreTechnicianMapper storeTechnicianMapper;
@Resource
GogirlProperties gogirlProperties;
@Override
public void scheduledMsg(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);
}
@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);
}
}
......@@ -22,6 +22,7 @@ import com.gogirl.infrastructure.mapper.order.serve.OrderCommentMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderServeDescribeMapper;
import com.gogirl.infrastructure.mapper.product.purchase.PurchaseSkuMapper;
import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.infrastructure.util.lock.OrderIdLock;
import com.gogirl.shared.order.serve.query.dto.ordermanage.OrderManageDTO;
import com.gogirl.shared.order.serve.query.qry.ordermanage.ListOrderQuery;
import io.swagger.annotations.Api;
......@@ -218,7 +219,13 @@ public class OrderManageController {
@GetMapping("/technician/ordermanage/checkOrder")
public JsonResult<Void> checkOrder(@RequestHeader String token,
@RequestParam Integer orderId) {
orderManageService.checkOrder(orderId);
OrderIdLock orderIdLock = OrderIdLock.getInsatance();
try {
orderIdLock.lock(orderId);
orderManageService.checkOrder(orderId);
} finally {
orderIdLock.unlock(orderId);
}
return JsonResult.success();
}
......
package com.gogirl.shared.market.command;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -13,9 +14,9 @@ import java.util.List;
@AllArgsConstructor
public class SetUpInnerCouponCommand {
@ApiModelProperty("订单id")
private Integer orderId;
// private OrderManageDTO orderManageDTO;
@ApiModelProperty("内部券Id")
private List<Integer> innerCouponCustomerRelevanceIds;
}
......@@ -21,6 +21,7 @@ public class IdleTimeQuery {
@ApiModelProperty("预约")
private List<ScheduleServeQuery> listScheduleServer;
@ApiModelProperty("是否返回节点详情")
private Boolean showNodeDetail;
}
......@@ -97,4 +97,39 @@ public class TreeProgram implements Serializable {
return this.getStoreTechnicianDTO().getTechnicianId().equals(treeProgram.getStoreTechnicianDTO().getTechnicianId())
&& this.getScheduleServeQuery().getServeId().equals(treeProgram.getScheduleServeQuery().getServeId());
}
public boolean isSubTree(TreeProgram treeProgram) {
if (treeProgram == null) {
return true;
}
boolean bool = this.isSameNode(treeProgram);
if (!bool) {
return false;
} else {
TreeProgram subPath = this.getChildList().stream().findAny().orElseThrow(NullPointerException::new);
List<TreeProgram> targetTreeList = treeProgram.getChildList();
TreeProgram targetTree = targetTreeList.stream().filter(val -> val.isSameNode(subPath)).findAny().orElse(null);
if (targetTree == null) {
return false;
}
return subPath.isSubTree(targetTree);
}
}
public boolean isSameNode(TreeProgram treeProgram) {
/**/
boolean sameServe = this.getScheduleServeQuery().getLengthTimeForEndTime()
.equals(treeProgram.getScheduleServeQuery().getLengthTimeForEndTime())
&& this.getScheduleServeQuery().getServeId().equals(treeProgram.getScheduleServeQuery().getServeId())
&& this.getScheduleServeQuery().getProduceId().equals(treeProgram.getScheduleServeQuery().getProduceId())
&& this.getScheduleServeQuery().getPeriod().equals(treeProgram.getScheduleServeQuery().getPeriod());
/**/
boolean sameTech = this.getStoreTechnicianDTO().getTechnicianId().equals(treeProgram.getStoreTechnicianDTO().getTechnicianId());
/**/
return sameServe && sameTech;
}
}
......@@ -94,9 +94,11 @@ gogirl:
#评论延迟时间
test-paper-time: 1440
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage、
#
admin-backend-achievements-url: http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
#
enterprise-wechat-webhook: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e687de79-143e-4c28-8db4-e6058722f286"
wx:
pay:
appId: wx058b46db3cd0e979
......
......@@ -93,10 +93,11 @@ gogirl:
#评论延迟时间
test-paper-time: 1
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url: http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
admin-backend-url: "http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage"
#美甲师评分后台接口地址
admin-backend-achievements-url: "http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi"
#企业微信消息发送webhook地址
enterprise-wechat-webhook: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e687de79-143e-4c28-8db4-e6058722f286"
wx:
pay:
appId: wx058b46db3cd0e979
......
......@@ -94,7 +94,7 @@ gogirl:
#后台后端接口访问地址
admin-backend-url: http://admin.begogirls.com:7712/api/ReportTable/GetTechnicianPageApi
admin-backend-achievements-url: http://admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
enterprise-wechat-webhook: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e687de79-143e-4c28-8db4-e6058722f286"
wx:
pay:
appId: wx058b46db3cd0e979
......
......@@ -95,7 +95,7 @@ gogirl:
#后台后端接口访问地址
admin-backend-url: http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
admin-backend-achievements-url: http://test.admin.begogirls.com:7712/api/salary/AchievementsPersonaResultPageApi
enterprise-wechat-webhook: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e687de79-143e-4c28-8db4-e6058722f286"
wx:
pay:
appId: wx058b46db3cd0e979
......
......@@ -17,5 +17,11 @@
and t1.serve_id != #{serveId}
</if>
</select>
<select id="selectUpdateStatusList" resultType="com.gogirl.domain.order.serve.ScheduleServe">
select *
from scheduled_serve
where sch_id = #{schId}
and (serve_id = #{serveId} or main_serve_id = #{serveId})
</select>
</mapper>
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