Commit 075f959d by huluobin

会员福利提前一天预约

parent 71122a23
......@@ -43,6 +43,7 @@ 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.Period;
import com.gogirl.shared.order.*;
import com.gogirl.shared.product.LeisureScheduleServeQuery;
import com.gogirl.shared.product.LeisureScheduleServeResp;
......@@ -56,9 +57,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.*;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
......@@ -131,6 +130,7 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//一天结束的时间
long dayEndTime = simpleDateFormat.parse(day + " 23:59:59").getTime();
boolean containFreeServe = baseTypeService.containFreeServe(serveIdList);
//遍历美甲师排班 获取每个美甲师的不可用时间段
for (StoreClassesTechnician storeClassesTechnician : storeClassesTechnicianList) {
......@@ -186,6 +186,12 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
periodList.add(period4);
}
if (containFreeServe) {
Period today = new Period(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).toInstant(ZoneOffset.of("+8")).toEpochMilli(),
LocalDateTime.of(LocalDate.now().plusDays(1), LocalTime.MIN).toInstant(ZoneOffset.of("+8")).toEpochMilli());
periodList.add(today);
}
/*9、构造返回值*/
StoreTechnicianPeriod storeTechnicianDTO = new StoreTechnicianPeriod(periodList, storeClassesTechnician.getTechnicianManage());
storeTechnicianPeriodList.add(storeTechnicianDTO);
......
......@@ -4,10 +4,18 @@ package com.gogirl.application.product.serve;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gogirl.domain.product.serve.BaseType;
import java.util.List;
/**
* Created by yinyong on 2018/9/4.
* 美容服务类型 服务接口
*/
public interface BaseTypeService extends IService<BaseType> {
/**
* 是否包含会员福利
* @param serveIdList
* @return
*/
boolean containFreeServe(List<Integer> serveIdList);
}
......@@ -7,11 +7,23 @@ import com.gogirl.domain.product.serve.BaseType;
import com.gogirl.infrastructure.mapper.product.serve.BaseTypeMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by yinyong on 2018/9/4.
*/
@Service
public class BaseTypeServiceImpl extends ServiceImpl<BaseTypeMapper, BaseType> implements BaseTypeService {
@Resource
private BaseTypeMapper baseTypeMapper;
@Override
public boolean containFreeServe(List<Integer> serveIdList) {
List<BaseType> baseTypeList = baseTypeMapper.selectByServeIds(serveIdList);
return baseTypeList.stream().map(BaseType::getName).collect(Collectors.toList()).contains("会员福利");
}
}
......@@ -3,9 +3,17 @@ package com.gogirl.infrastructure.mapper.product.serve;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gogirl.domain.product.serve.BaseType;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
public interface BaseTypeMapper extends BaseMapper<BaseType> {
/**
* 查询服务id对应的服务类型
*
* @param serveIdList
* @return
*/
List<BaseType> selectByServeIds(List<Integer> serveIdList);
}
......@@ -3,4 +3,12 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gogirl.infrastructure.mapper.product.serve.BaseTypeMapper">
<select id="selectByServeIds" resultType="com.gogirl.domain.product.serve.BaseType">
SELECT t2.* from base_serve t1
LEFT JOIN base_type t2 on t1.type_id = t2.id
where t1.id in
<foreach collection="serveIdList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</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