1/3
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.yxt.yyth.api.empcard;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.yyth.api.empcardgift.EmpCardGiftVo;
|
||||
@@ -10,6 +11,10 @@ import com.yxt.yyth.api.lpkstore.StoreSelect;
|
||||
import lombok.Data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,21 +54,47 @@ public class EmpAppletVo {
|
||||
private String giftCodeKey;
|
||||
private String qrCode;
|
||||
private List<LpkReserveOrderCardVo> orderCardVoList;
|
||||
private String isTransfer;
|
||||
|
||||
public String getStart() {
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
start=sdf.format(DateUtil.offsetDay(new Date(),+2));
|
||||
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")){
|
||||
start=sdf.format(DateUtil.offsetDay(new Date(),+2));
|
||||
}else{
|
||||
start=sdf.format(DateUtil.offsetDay(new Date(),+1));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(dateEnd)){
|
||||
int i=DateUtil.parse(sdf.format(DateUtil.parse(start))).compareTo(DateUtil.parse(sdf.format(DateUtil.parse(dateEnd))));
|
||||
if(String.valueOf(i).equals("-1")){
|
||||
end=sdf.format(DateUtil.parse(dateEnd));
|
||||
long o=DateUtil.between(DateUtil.parse(start),DateUtil.parse(dateEnd), DateUnit.DAY);
|
||||
if(o<10){
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(dateEnd),10));
|
||||
}else{
|
||||
// end=sdf.format(DateUtil.parse(dateEnd));
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(start),4));
|
||||
}
|
||||
}else{
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(dateEnd),2));
|
||||
if(String.valueOf(k).equals("1")){
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(dateEnd),2));
|
||||
}else{
|
||||
end=sdf.format(DateUtil.offsetDay(DateUtil.parse(dateEnd),1));
|
||||
}
|
||||
}
|
||||
}
|
||||
reserveDate=start;
|
||||
return start;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
name=name+code;
|
||||
return name;
|
||||
@@ -120,7 +151,12 @@ public class EmpAppletVo {
|
||||
if( String.valueOf(i).equals("-1")){
|
||||
state="已过期";
|
||||
showBtn=false;
|
||||
} else{
|
||||
}else if(isTransfer.equals("1")){
|
||||
state="已转赠";
|
||||
showBtn=false;
|
||||
this.notRese=false;
|
||||
}
|
||||
else{
|
||||
state="待提货";
|
||||
if(states.equals("5")){
|
||||
if(isReservation.equals("0")){
|
||||
|
||||
@@ -32,5 +32,7 @@ public class EmpCard {
|
||||
private String customerMobile;
|
||||
private Date bindDate;
|
||||
private String isReservation ;//是否超过预约时间 0 否 1是
|
||||
private String isTransfer ;//是否转增 0 未转赠 1 转赠
|
||||
private String isItInvalid ;//是否失效 0 有效 1失效 用于排序失效卡排后边
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class EmpCardGrantLogVo implements Vo {
|
||||
private List<GoodsVo> goodsVos;
|
||||
private String cardSid;
|
||||
private String goods;
|
||||
private double goodsNumber;
|
||||
private double goodsNumber=0;
|
||||
private String goodsSid;
|
||||
private String code;
|
||||
private String codeKey;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class LpkReserveOrderGoods {
|
||||
private String remarks;
|
||||
private String cardSid;
|
||||
private String goodsSid;
|
||||
private double goodsNumber;
|
||||
private double goodsNumber=0;
|
||||
private String num;
|
||||
private String orderSid;
|
||||
private String goodsName;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yyth.api.empcard.*;
|
||||
import com.yxt.yyth.api.lpkgiftcard.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -86,16 +86,19 @@
|
||||
SELECT card.*,
|
||||
CASE
|
||||
card.state
|
||||
WHEN 2 THEN
|
||||
'已绑定'
|
||||
WHEN 3 THEN
|
||||
'已完成'
|
||||
'未提货'
|
||||
WHEN 4 THEN
|
||||
'已经预约提货(预约部分提货)'
|
||||
WHEN 5 THEN
|
||||
'已经提取完成'
|
||||
END stateValue,
|
||||
bag.dateStart AS dateStart,
|
||||
bag.dateEnd AS dateEnd,
|
||||
bag.NAME AS pname,
|
||||
card.state AS states,
|
||||
card.serialNumber AS serialNumber
|
||||
card.serialNumber AS serialNumber,
|
||||
card.isTransfer as isTransfer
|
||||
FROM emp_card card
|
||||
LEFT JOIN lpk_giftbag bag ON card.giftbagSid = bag.sid
|
||||
where card.sid = #{sid}
|
||||
|
||||
@@ -516,4 +516,18 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
|
||||
Object[] array = weekMap.stream().sorted().toArray();
|
||||
return rb.success().setData(array);
|
||||
}
|
||||
|
||||
/**
|
||||
*是否转赠
|
||||
* @param sid
|
||||
* @return
|
||||
*/
|
||||
public ResultBean cardTransfer(String sid ) {
|
||||
ResultBean rb=new ResultBean();
|
||||
EmpCard card=baseMapper.selectOne(new QueryWrapper<EmpCard>().eq("sid",sid));
|
||||
card.setIsTransfer("1");
|
||||
card.setIsItInvalid("1");//失效
|
||||
baseMapper.updateById(card);
|
||||
return rb.success().setData("成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,13 +353,17 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
|
||||
if(null==empCard){
|
||||
return rb.setMsg("请选择正确的企业卡");
|
||||
}
|
||||
for(GoodsVo goodsVo:dto.getGoodsVoList()){
|
||||
EmpCardVo vo= empCardService.getBagGoods(dto.getEmpCardSid(),goodsVo.getGoodsSid()).getData();
|
||||
if(goodsVo.getSelect()*count>vo.getGoodsNumber()){
|
||||
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()));
|
||||
for (int k = 0; k < count; k++) {
|
||||
EmpCardGrantLog record = new EmpCardGrantLog();
|
||||
@@ -413,35 +417,49 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
|
||||
}
|
||||
record.setSerialNumber(card.getSerialNumber());
|
||||
record.setEmpCardSid(dto.getEmpCardSid());
|
||||
record.setCode(dto.getCode());
|
||||
record.setCode(card.getCode());
|
||||
empCardGrantLogService.updateById(record);
|
||||
int i = 0;
|
||||
/*EmpAppletVo voss =empCardService.getEmpCardBySid(empCard.getSid()).getData();
|
||||
for (com.yxt.yyth.api.lpkgiftcard.GoodsVo vo1 : voss.getGoodsVos()) {
|
||||
LpkReserveOrderGoods goods1 = lpkReserveOrderGoodsMapper.getReserveByCardSid(empCard.getSid(), vo1.getGoodsSid());
|
||||
if (null != goods1) {
|
||||
if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// EmpAppletVo voss =empCardService.getEmpCardBySid(empCard.getSid()).getData();
|
||||
// for (com.yxt.yyth.api.lpkgiftcard.GoodsVo vo1 : voss.getGoodsVos()) {
|
||||
// LpkReserveOrderGoods goods1 = lpkReserveOrderGoodsMapper.getReserveByCardSid(empCard.getSid(), vo1.getGoodsSid());
|
||||
// if (null != goods1) {
|
||||
// if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
EmpAppletVo vo = empCardService.getEmpCardBySid(empCard.getSid()).getData();
|
||||
for (com.yxt.yyth.api.lpkgiftcard.GoodsVo vo1 : vo.getGoodsVos()) {
|
||||
EmpCardGrantLogVo goods1 = empCardGrantLogService.recordListGoods(dto.getEmpCardSid(), vo1.getGoodsSid()).getData();
|
||||
if (null != goods1) {
|
||||
if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
||||
i++;
|
||||
LpkReserveOrderGoods goods2 = lpkReserveOrderGoodsMapper.getReserveByCardSid(empCard.getSid(), vo1.getGoodsSid());
|
||||
double c=0;
|
||||
if(goods1==null){
|
||||
if(goods2==null){
|
||||
c=0;
|
||||
}else{
|
||||
c=goods2.getGoodsNumber();
|
||||
}
|
||||
}else{
|
||||
if(goods2==null){
|
||||
c=goods1.getGoodsNumber();
|
||||
}else{
|
||||
c=goods2.getGoodsNumber()+goods1.getGoodsNumber();
|
||||
}
|
||||
}
|
||||
if (vo.getGoodsVos().size() == i) {
|
||||
empCardService.changState(dto.getEmpCardSid(), "3");
|
||||
if (vo1.getNum() <= c) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (vo.getGoodsVos().size() == i) {
|
||||
int i1=lpkReserveOrderGoodsMapper.selectCount(new QueryWrapper<LpkReserveOrderGoods>().eq("cardSid",empCard.getSid()));
|
||||
if(i1==0){
|
||||
//如果没有预约记录 直接改转赠状态
|
||||
empCardService.cardTransfer(dto.getEmpCardSid());
|
||||
}else{
|
||||
empCardService.changState(empCard.getSid(), "5");
|
||||
}
|
||||
}
|
||||
/* if (vo.getGoodsVos().size() == i) {
|
||||
empCardService.changState(empCard.getSid(), "5");
|
||||
} else {
|
||||
empCardService.changState(empCard.getSid(), "4");
|
||||
}*/
|
||||
}
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
@@ -89,16 +89,34 @@ public class EmpReserveOrderGoodsService extends MybatisBaseService<EmpReserveOr
|
||||
int i = 0;
|
||||
for (com.yxt.yyth.api.lpkgiftcard.GoodsVo vo1 : vo.getGoodsVos()) {
|
||||
LpkReserveOrderGoods goods1 = lpkReserveOrderGoodsMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
|
||||
if (null != goods1) {
|
||||
if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
||||
i++;
|
||||
LpkReserveOrderGoods goods2 = lpkReserveOrderGoodsMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
|
||||
double c=0;
|
||||
if(goods1==null){
|
||||
if(goods2==null){
|
||||
c=0;
|
||||
}else{
|
||||
c=goods2.getGoodsNumber();
|
||||
}
|
||||
}else{
|
||||
if(goods2==null){
|
||||
c=goods1.getGoodsNumber();
|
||||
}else{
|
||||
c=goods2.getGoodsNumber()+goods1.getGoodsNumber();
|
||||
}
|
||||
}
|
||||
if (vo.getGoodsVos().size() == i) {
|
||||
empCardService.changState(dto.getSid(), "5");
|
||||
} else {
|
||||
empCardService.changState(dto.getSid(), "4");
|
||||
if (vo1.getNum() <= c) {
|
||||
i++;
|
||||
}
|
||||
// if (null != goods1) {
|
||||
// if (vo1.getNum() <= goods1.getGoodsNumber()) {
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (vo.getGoodsVos().size() == i) {
|
||||
empCardService.changState(dto.getSid(), "5");
|
||||
} else {
|
||||
empCardService.changState(dto.getSid(), "4");
|
||||
}
|
||||
return rb.success().setData("预约成功");
|
||||
}
|
||||
|
||||
@@ -54,10 +54,12 @@ public class scheduledRest {
|
||||
int in = DateUtil.parse(sdf.format(lpkGiftBag.getDateEnd())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
if (String.valueOf(in).equals("-1")) {
|
||||
Integer i = lpkGiftCardMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
//提货卡 礼包过期处理
|
||||
List<EmpCardGiftVo> empCardGiftVos = empCardGiftMapper.getEmpCardGiftByGiftbagSid(lpkGiftBag.getSid(),"5");
|
||||
if (i != 0) {
|
||||
lpkGiftCardMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
}
|
||||
//福礼卡 礼包过期处理
|
||||
if(empCardGiftVos.size()!=0){
|
||||
List<String> sids=new ArrayList<>();
|
||||
empCardGiftVos.forEach(s->{
|
||||
|
||||
Reference in New Issue
Block a user