|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.yxt.yyth.biz.empcardgift; |
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
@ -59,9 +60,7 @@ import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.DayOfWeek; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.Period; |
|
|
|
import java.time.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
@ -258,6 +257,7 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
|
vo.setEmpCardGift(empCardGift); |
|
|
|
vo.setOrderCardVoList(empReserveOrderCardVos); |
|
|
|
vo.setGoodsVos(goodsVos); |
|
|
|
vo.setPName("亲情菜窖"); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
public ResultBean<List<EmpCardGiftVo>> recordList(String empCardSid) { |
|
|
@ -362,7 +362,6 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
LpkGiftBag bag=lpkGiftBagService.getOne(new QueryWrapper<LpkGiftBag>().eq("sid",empCard.getGiftbagSid())); |
|
|
|
for (int k = 0; k < count; k++) { |
|
|
@ -475,6 +474,16 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
|
if (null == empCard) { |
|
|
|
return rb.setMsg("请选择正确的提货卡"); |
|
|
|
} |
|
|
|
// EmpAppletVo empAppletVo =empCardService.getEmpCardBySid(dto.getEmpCardSid()).getData();
|
|
|
|
// for(com.yxt.yyth.api.lpkgiftcard.GoodsVo goodsVo:empAppletVo.getGoodsVos()){
|
|
|
|
// for(GoodsVo gv :dto.getGoodsVoList()){
|
|
|
|
// if(goodsVo.getGoodsSid().equals(gv.getGoodsSid())){
|
|
|
|
// if(goodsVo.getSelect()*count>goodsVo.getLNum()){
|
|
|
|
// return rb.setMsg("商品数量不足,请重新选择");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
LpkGiftBag bag=lpkGiftBagService.getOne(new QueryWrapper<LpkGiftBag>().eq("sid",empCard.getGiftbagSid())); |
|
|
|
EmpCardGift card = new EmpCardGift(); |
|
|
|
card.setCardType("3"); |
|
|
@ -909,14 +918,43 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// public static void main(String[] args) {
|
|
|
|
// LocalDate start = LocalDate.of(2021, Month.JANUARY, 1); // 设置起始日期为2021年1月1日
|
|
|
|
// LocalDate end = LocalDate.now(); // 设置结束日期为当前日期
|
|
|
|
//
|
|
|
|
// Stream<LocalDate> dates = start.datesUntil(end).filter(date -> date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY);
|
|
|
|
//
|
|
|
|
// for (LocalDate date : dates) {
|
|
|
|
// System.out.println(date);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
public EmpGiftAppletVo getDate(EmpGiftAppletVo vo) { |
|
|
|
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
SimpleDateFormat sdf1 =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
LocalDate today = LocalDate.now(); // 获取今天的日期
|
|
|
|
LocalTime timeOfDay = LocalTime.of(15, 0); // 设置下午3点的小时数为15,分钟数为0
|
|
|
|
LocalDateTime dateAndTime = LocalDateTime.of(today, timeOfDay); // 将日期和时间合并成完整的日期时间对象
|
|
|
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
|
Date date = Date.from(dateAndTime.atZone(zoneId).toInstant()); |
|
|
|
// System.out.println(date);
|
|
|
|
//1>2 1 、1<2 -1 、1=2 0
|
|
|
|
int k=DateUtil.parse(sdf1.format(DateUtil.parse(sdf1.format(new Date())))).compareTo(DateUtil.parse(sdf1.format(DateUtil.parse(sdf1.format(date))))); |
|
|
|
if(String.valueOf(k).equals("1")){ |
|
|
|
vo.setStart(sdf.format(DateUtil.offsetDay(new Date(),+2))); |
|
|
|
}else{ |
|
|
|
vo.setStart(sdf.format(DateUtil.offsetDay(new Date(),+1))); |
|
|
|
} |
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(vo.getDateStart())){ |
|
|
|
int i=DateUtil.parse(sdf.format(DateUtil.parse(vo.getStart()))).compareTo(DateUtil.parse(sdf.format(DateUtil.parse(vo.getDateEnd())))); |
|
|
|
if(String.valueOf(i).equals("-1")){ |
|
|
|
long o=DateUtil.between(DateUtil.parse(vo.getStart()),DateUtil.parse(vo.getDateEnd()), DateUnit.DAY); |
|
|
|
if(o<10){ |
|
|
|
vo.setEnd(sdf.format(DateUtil.offsetDay(DateUtil.parse(vo.getDateEnd()),10))); |
|
|
|
}else{ |
|
|
|
// end=sdf.format(DateUtil.parse(dateEnd));
|
|
|
|
vo.setEnd(sdf.format(DateUtil.offsetDay(DateUtil.parse(vo.getStart()),4))); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(String.valueOf(k).equals("1")){ |
|
|
|
vo.setEnd(sdf.format(DateUtil.offsetDay(DateUtil.parse(vo.getDateEnd()),2))); |
|
|
|
}else{ |
|
|
|
vo.setEnd(sdf.format(DateUtil.offsetDay(DateUtil.parse(vo.getDateEnd()),1))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setReserveDate(vo.getStart()); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|