76 changed files with 3594 additions and 120 deletions
@ -0,0 +1,40 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 16:54 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGift { |
|||
private String id; |
|||
private String sid= UUID.randomUUID().toString(); |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String empCardSid; |
|||
private String empCardSerialNumber; |
|||
private String empCardCode; |
|||
private String empCardCustomerSid; |
|||
private String serialNumber; |
|||
private String code; |
|||
private String codeKey; |
|||
private String state; |
|||
private String grantName; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date grantDate; |
|||
private String customerSid; |
|||
private String customerMobile; |
|||
private String recordSid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date bindDate; |
|||
private String isItlnvalid; |
|||
private String isReservation; |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 16:58 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String empCardSid; |
|||
private String empCardSerialNumber; |
|||
private String empCardCode; |
|||
private String empCardCustomerSid; |
|||
private String serialNumber; |
|||
private String code; |
|||
private String codeKey; |
|||
private String state; |
|||
private String grantName; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date grantDate; |
|||
private String customerSid; |
|||
private String customerMobile; |
|||
private String recordSid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date bindDate; |
|||
private String isItlnvalid; |
|||
private String iReservation; |
|||
private List<GoodsVo> goodsVoList; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import com.yxt.common.core.utils.ExportEntityMap; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/27 10:34 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftExport { |
|||
@ExportEntityMap(CnName = "提货二维码", EnName = "pic") |
|||
private String pic; |
|||
@ExportEntityMap(CnName = "提货编码第一行", EnName = "code1") |
|||
private String code1; |
|||
@ExportEntityMap(CnName = "提货编码第二行", EnName = "code2") |
|||
private String code2; |
|||
@ExportEntityMap(CnName = "提货密码", EnName = "codeKey") |
|||
private String codeKey; |
|||
@ExportEntityMap(CnName = "序列号", EnName = "serialNumber") |
|||
private String serialNumber; |
|||
private String code; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/24 10:07 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftListQuery implements Query { |
|||
private String state; |
|||
private String noStart; //序列号开始
|
|||
private String noEnd; //序列号结束
|
|||
private String sid; |
|||
private String number; |
|||
} |
@ -0,0 +1,8 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 17:09 |
|||
*/ |
|||
public class EmpCardGiftListVo { |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 16:57 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftQuery implements Query { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String empCardSid; |
|||
private String empCardSerialNumber; |
|||
private String empCardCode; |
|||
private String empCardCustomerSid; |
|||
private String serialNumber; |
|||
private String code; |
|||
private String codeKey; |
|||
private String state; |
|||
private String grantName; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date grantDate; |
|||
private String customerSid; |
|||
private String customerMobile; |
|||
private String recordSid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date bindDate; |
|||
private String isItlnvalid; |
|||
private String iReservation; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 16:57 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String empCardSid; |
|||
private String empCardSerialNumber; |
|||
private String empCardCode; |
|||
private String empCardCustomerSid; |
|||
private String serialNumber; |
|||
private String code; |
|||
private String codeKey; |
|||
private String state; |
|||
private String grantName; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date grantDate; |
|||
private String customerSid; |
|||
private String customerMobile; |
|||
private String recordSid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date bindDate; |
|||
private String isItlnvalid; |
|||
private String iReservation; |
|||
private double goodsNumber=0; |
|||
private String qrCode; |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/6 15:49 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftWordVo { |
|||
private String qrCode;//二维码
|
|||
private String bagName;//礼包名
|
|||
private String serialNumber;//序列号
|
|||
private String code;//卡号
|
|||
private String codeKey;//密码
|
|||
|
|||
} |
@ -0,0 +1,158 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
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.GoodsVo; |
|||
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderCardVo; |
|||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo; |
|||
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; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 17:14 |
|||
*/ |
|||
@Data |
|||
public class EmpGiftAppletVo { |
|||
|
|||
private String dateStart; |
|||
private String dateEnd; |
|||
private String customerSid; |
|||
private String giftbagSid; |
|||
private String code; |
|||
private String sid; |
|||
private String state; |
|||
private String states; |
|||
private boolean showBtn = true; |
|||
private boolean showRecord = true; |
|||
private String time; |
|||
private String name = "卡号:"; |
|||
private String pName; |
|||
private String start; |
|||
private String end; |
|||
private String store; //门店
|
|||
private String reserveDate; //预约时间
|
|||
private List<GoodsVo> goodsVos; |
|||
private List<StoreSelect> select; |
|||
private String storeSid;//上次提货地点
|
|||
private String addressName; |
|||
private String isReservation;//是否超过预约时间 0 否 1是
|
|||
private boolean notRese = true; //是否能预约
|
|||
private List<EmpReserveOrderCardVo> orderCardVoList; |
|||
private String value; |
|||
private String serialNumber; |
|||
|
|||
|
|||
public String getStart() { |
|||
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(16, 0); // 设置下午4点的小时数为16,分钟数为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")) { |
|||
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)); |
|||
} |
|||
} else { |
|||
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; |
|||
} |
|||
|
|||
public String getTime() { |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); |
|||
if (StringUtils.isNotBlank(dateStart)) { |
|||
if (StringUtils.isNotBlank(dateEnd)) { |
|||
time = sdf.format(DateUtil.parse(dateStart)) + "~" + sdf.format(DateUtil.parse(dateEnd)); |
|||
} |
|||
} |
|||
return time; |
|||
} |
|||
|
|||
public boolean isShowBtn() { |
|||
if (states.equals("5")) { |
|||
if (isReservation.equals("1")) { |
|||
this.state = "已完成"; |
|||
showBtn = false; |
|||
} |
|||
} |
|||
return showBtn; |
|||
} |
|||
|
|||
public String getState() { |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
if (StringUtils.isNotBlank(dateEnd)) { |
|||
int i = DateUtil.parse(sdf.format(DateUtil.parse(dateEnd))).compareTo(DateUtil.parse(sdf.format(DateUtil.date()))); |
|||
if (String.valueOf(i).equals("-1")) { |
|||
state = "已过期"; |
|||
showBtn = false; |
|||
} else { |
|||
state = "待提货"; |
|||
if (states.equals("5")) { |
|||
System.out.println("isReservation"+isReservation); |
|||
if (isReservation.equals("0")) { |
|||
this.state = "已预约"; |
|||
this.notRese = false; |
|||
} else { |
|||
this.state = "已完成"; |
|||
showBtn = false; |
|||
} |
|||
} else if (states.equals("4")) { |
|||
if (isReservation.equals("0")) { |
|||
this.state = "已预约"; |
|||
} else { |
|||
this.state = "待提货"; |
|||
} |
|||
} |
|||
} |
|||
} else { |
|||
state = "待提货"; |
|||
if (states.equals("5")) { |
|||
if (isReservation.equals("0")) { |
|||
this.state = "已预约"; |
|||
} else { |
|||
this.state = "已完成"; |
|||
showBtn = false; |
|||
} |
|||
} |
|||
} |
|||
return state; |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.yyth.api.empcardgift; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/22 15:35 |
|||
*/ |
|||
@Data |
|||
public class GoodsVo { |
|||
private String goods; |
|||
private String pic; |
|||
private double num; |
|||
private double lNum; |
|||
private double select = 0; |
|||
private String goodsSid; |
|||
private double orderNum; //预约数量
|
|||
private String price; //预约数量
|
|||
private String unitName; //预约数量
|
|||
private String remarks; //预约数量
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.yyth.api.empcardgiftgoods; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:10 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftGoods { |
|||
private String id; |
|||
private String sid= UUID.randomUUID().toString(); |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String empCardGiftSid; |
|||
private String goodsSid; |
|||
private String goodsNumber; |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.yyth.api.empcardgiftgoods; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftGoodsDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
private String createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String empCardGiftSid; |
|||
private String goodsSid; |
|||
private double goodsNumber; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.yxt.yyth.api.empcardgiftgoods; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftGoodsQuery implements Query { |
|||
private String empCardGiftSid; |
|||
private String goodsSid; |
|||
private String goodsNumber; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.yyth.api.empcardgiftgoods; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGiftGoodsVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String empCardGiftSid; |
|||
private String goodsSid; |
|||
private Integer goodsNumber; |
|||
private String name; |
|||
private String unitName; |
|||
private String picUrl; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.yyth.api.empcardgrantlog; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:10 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGrantLog { |
|||
private String id; |
|||
private String sid= UUID.randomUUID().toString(); |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String empCardSid; |
|||
private String empCardCustomerSid; |
|||
private String serialNumber; |
|||
private String code; |
|||
private String isShare; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.yxt.yyth.api.empcardgrantlog; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGrantLogDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
private String createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String recordId; |
|||
private String recordSid; |
|||
private String giftbagSid; |
|||
private String serialNumber; |
|||
private String code; |
|||
private String codeKey; |
|||
private String state; |
|||
private String grantName; |
|||
private String grantDate; |
|||
private String customerSid; |
|||
private String customerMobile; |
|||
private String Num; |
|||
private String cardArea; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.yxt.yyth.api.empcardgrantlog; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGrantLogQuery implements Query { |
|||
private String startDate; //开始时间
|
|||
private String endDate; //结束时间
|
|||
private String countNumber; //总数
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.yxt.yyth.api.empcardgrantlog; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.yyth.api.empcardgift.GoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:11 |
|||
*/ |
|||
@Data |
|||
public class EmpCardGrantLogVo implements Vo { |
|||
private String sid; |
|||
private String buildDate; //创建时间
|
|||
private String countNumber; //总数
|
|||
private String startNumber; //起始号
|
|||
private String endNumber; //结束号
|
|||
private String bagName; |
|||
private String grantCountNumber; //发放总数
|
|||
private List<GoodsVo> goodsVos; |
|||
private String cardSid; |
|||
private String goods; |
|||
private double goodsNumber; |
|||
private String code; |
|||
private String codeKey; |
|||
private String remarks; |
|||
private String isShare; |
|||
private boolean share=false; |
|||
|
|||
public boolean isShare() { |
|||
if(isShare.equals("2")){ |
|||
return share=true; |
|||
} |
|||
return share; |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrder { |
|||
private String id; |
|||
private String sid= UUID.randomUUID().toString(); |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String reserveType; |
|||
private String cardSid; |
|||
private String cardCode; |
|||
private String isCustomer; |
|||
private String customerSid; |
|||
private String userName; |
|||
private String userPhone; |
|||
private String userAddress; |
|||
private String storeSid; |
|||
private String reserveDate; |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.yyth.api.lpkgiftcard.GoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/27 16:53 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrderCardVo implements Vo { |
|||
private String code; //卡号
|
|||
private String sid; |
|||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
|||
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") |
|||
private Date reserveDate; //预约时间
|
|||
private String store; //提货门店
|
|||
private String storeSid; //提货门店
|
|||
private String bagName; //礼包
|
|||
private String cardSid; // 提货卡sid
|
|||
private String orderSid; //预约订单sid
|
|||
private String userName; |
|||
private String userPhone; |
|||
private String state;//提货状态
|
|||
private List<GoodsVo> goodsVos; |
|||
private String goods; |
|||
private String serialNumber; |
|||
|
|||
public String getState() { |
|||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); |
|||
int c= DateUtil.parse(sdf.format(reserveDate)).compareTo(DateUtil.parse(sdf.format(new Date()))); |
|||
if(String.valueOf(c).equals("-1")){ |
|||
this.state="已提货"; |
|||
}else{ |
|||
this.state="未提货"; |
|||
} |
|||
return state; |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.yyth.api.empcardgift.GoodsVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrderDto implements Dto { |
|||
private String cardSid;//礼包卡sid
|
|||
private String sid; |
|||
private String value; |
|||
private String storeSid;//发放点
|
|||
private String customerSid;//客户sid
|
|||
private String reserveDate;//发放时间
|
|||
private String userName;//用户名
|
|||
private String userPhone;//用户联系方式
|
|||
private List<GoodsVo> goodsVos; |
|||
private String orderSid; |
|||
private String addressName; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:30 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrderQuery implements Query { |
|||
private String userName; //用户名
|
|||
private String store; // 门店
|
|||
private String startDate; //预约开始日期
|
|||
private String endDate; // 预约结束日期
|
|||
private String userSid; |
|||
private String storeSid; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/27 15:11 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrderVo implements Vo { |
|||
private String sid; //预约订单sid
|
|||
private String userName; //用户名
|
|||
private String userPhone; //用户电话
|
|||
private String store; //门店
|
|||
private String storeSid; //门店
|
|||
@JsonFormat(pattern = "yyyy-MM-dd ",timezone="GMT+8") |
|||
private Date reserveDate; //预约时间
|
|||
private String bagName; //礼包
|
|||
private String code; //卡号
|
|||
private String goodsInfo; |
|||
private List<OrderGoodsVo> goodsVo = new ArrayList<>(); |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 14:34 |
|||
*/ |
|||
@Data |
|||
public class Goods { |
|||
private double goodsNumber;//数量
|
|||
private String goodsSid;//商品sid
|
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/28 10:11 |
|||
*/ |
|||
@Data |
|||
public class OrderGoodsVo implements Vo { |
|||
private int num; |
|||
private String goodName; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.yxt.common.core.utils.ExportEntityMap; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/28 10:26 |
|||
*/ |
|||
@Data |
|||
public class ReserveOrderExport { |
|||
@ExportEntityMap(CnName = "预约时间", EnName = "reserveDate") |
|||
private String reserveDate; |
|||
@ExportEntityMap(CnName = "提货门店", EnName = "store") |
|||
private String store; |
|||
@ExportEntityMap(CnName = "姓名", EnName = "userName") |
|||
private String userName; |
|||
@ExportEntityMap(CnName = "联系方式", EnName = "userPhone") |
|||
private String userPhone; |
|||
@ExportEntityMap(CnName = "提货卡号", EnName = "code") |
|||
private String code; |
|||
@ExportEntityMap(CnName = "礼包名称", EnName = "bagName") |
|||
private String bagName; |
|||
@ExportEntityMap(CnName = "商品明细", EnName = "goodsInfo") |
|||
private String goodsInfo; |
|||
private String sid; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.yyth.api.empreserveorder; |
|||
|
|||
import com.yxt.common.core.utils.ExportEntityMap; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 13:58 |
|||
*/ |
|||
@Data |
|||
public class ReserveOrderExportByStore { |
|||
@ExportEntityMap(CnName = "预约时间", EnName = "reserveDate") |
|||
private String reserveDate; |
|||
@ExportEntityMap(CnName = "提货门店", EnName = "store") |
|||
private String store; |
|||
private String storeSid; |
|||
@ExportEntityMap(CnName = "商品明细", EnName = "goodsInfo") |
|||
private String goodsInfo; |
|||
private String sid; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.yyth.api.empreserveordergoods; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrderGoods { |
|||
private String id; |
|||
private String sid= UUID.randomUUID().toString(); |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String cardSid; |
|||
private String goodsSid; |
|||
private double goodsNumber; |
|||
private String num; |
|||
private String orderSid; |
|||
private String goodsName; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.yxt.yyth.api.empreserveordergoods; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:29 |
|||
*/ |
|||
@Data |
|||
public class EmpReserveOrderGoodsDto { |
|||
private String cardSid; |
|||
private String goodsSid; |
|||
private String goodsNumber; |
|||
} |
@ -0,0 +1,8 @@ |
|||
package com.yxt.yyth.api.empreserveordergoods; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:30 |
|||
*/ |
|||
public class EmpReserveOrderGoodsQuery { |
|||
} |
@ -0,0 +1,89 @@ |
|||
package com.yxt.yyth.api.lpkreserveorder; |
|||
|
|||
import com.alibaba.excel.metadata.Head; |
|||
import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
|||
import org.apache.commons.collections.map.HashedMap; |
|||
import org.apache.poi.ss.usermodel.Cell; |
|||
import org.apache.poi.ss.usermodel.Sheet; |
|||
import org.apache.poi.ss.util.CellRangeAddress; |
|||
|
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/15 13:43 |
|||
*/ |
|||
public class MergeStrategy extends AbstractMergeStrategy { |
|||
|
|||
// 合并的列编号,从0开始,指定的index或自己按字段顺序数
|
|||
private Set<Integer> mergeCellIndex = new HashSet<>(); |
|||
|
|||
// 数据集大小,用于区别结束行位置
|
|||
private Integer maxRow = 0; |
|||
|
|||
// 禁止无参声明
|
|||
private MergeStrategy() { |
|||
} |
|||
|
|||
public MergeStrategy(Integer maxRow, int... mergeCellIndex) { |
|||
Arrays.stream(mergeCellIndex).forEach(item -> { |
|||
this.mergeCellIndex.add(item); |
|||
}); |
|||
this.maxRow = maxRow; |
|||
} |
|||
|
|||
// 记录上一次合并的信息
|
|||
private Map<Integer, MergeRange> lastRow = new HashedMap(); |
|||
|
|||
// 每行每列都会进入,绝对不要在这写循环
|
|||
@Override |
|||
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) { |
|||
int currentCellIndex = cell.getColumnIndex(); |
|||
// 判断该行是否需要合并
|
|||
if (mergeCellIndex.contains(currentCellIndex)) { |
|||
String currentCellValue = cell.getStringCellValue(); |
|||
int currentRowIndex = cell.getRowIndex(); |
|||
if (!lastRow.containsKey(currentCellIndex)) { |
|||
// 记录首行起始位置
|
|||
lastRow.put(currentCellIndex, new MergeRange(currentCellValue, currentRowIndex, currentRowIndex, currentCellIndex, currentCellIndex)); |
|||
return; |
|||
} |
|||
//有上行这列的值了,拿来对比.
|
|||
MergeRange mergeRange = lastRow.get(currentCellIndex); |
|||
if (!(mergeRange.lastValue != null && mergeRange.lastValue.equals(currentCellValue))) { |
|||
// 结束的位置触发下合并.
|
|||
// 同行同列不能合并,会抛异常
|
|||
if (mergeRange.startRow != mergeRange.endRow || mergeRange.startCell != mergeRange.endCell) { |
|||
sheet.addMergedRegionUnsafe(new CellRangeAddress(mergeRange.startRow, mergeRange.endRow, mergeRange.startCell, mergeRange.endCell)); |
|||
} |
|||
// 更新当前列起始位置
|
|||
lastRow.put(currentCellIndex, new MergeRange(currentCellValue, currentRowIndex, currentRowIndex, currentCellIndex, currentCellIndex)); |
|||
} |
|||
// 合并行 + 1
|
|||
mergeRange.endRow += 1; |
|||
// 结束的位置触发下最后一次没完成的合并
|
|||
if (relativeRowIndex.equals(maxRow - 1)) { |
|||
MergeRange lastMergeRange = lastRow.get(currentCellIndex); |
|||
// 同行同列不能合并,会抛异常
|
|||
if (lastMergeRange.startRow != lastMergeRange.endRow || lastMergeRange.startCell != lastMergeRange.endCell) { |
|||
sheet.addMergedRegionUnsafe(new CellRangeAddress(lastMergeRange.startRow, lastMergeRange.endRow, lastMergeRange.startCell, lastMergeRange.endCell)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
class MergeRange { |
|||
public int startRow; |
|||
public int endRow; |
|||
public int startCell; |
|||
public int endCell; |
|||
public String lastValue; |
|||
|
|||
public MergeRange(String lastValue, int startRow, int endRow, int startCell, int endCell) { |
|||
this.startRow = startRow; |
|||
this.endRow = endRow; |
|||
this.startCell = startCell; |
|||
this.endCell = endCell; |
|||
this.lastValue = lastValue; |
|||
} |
|||
} |
@ -1,28 +1,51 @@ |
|||
package com.yxt.yyth.api.lpkreserveorder; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelIgnore; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
|||
import com.yxt.common.core.utils.ExportEntityMap; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2023/11/28 10:26 |
|||
*/ |
|||
@Data |
|||
@Getter |
|||
@Setter |
|||
@EqualsAndHashCode |
|||
public class ReserveOrderExport { |
|||
@ExportEntityMap(CnName = "预约时间", EnName = "reserveDate") |
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "预约时间",index = 0) |
|||
private String reserveDate; |
|||
@ExportEntityMap(CnName = "提货门店", EnName = "store") |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "提货门店",index = 1) |
|||
private String store; |
|||
@ExportEntityMap(CnName = "姓名", EnName = "userName") |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "姓名",index = 2) |
|||
private String userName; |
|||
@ExportEntityMap(CnName = "联系方式", EnName = "userPhone") |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "联系方式",index = 3) |
|||
private String userPhone; |
|||
@ExportEntityMap(CnName = "提货卡号", EnName = "code") |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "提货卡号",index = 4) |
|||
private String code; |
|||
@ExportEntityMap(CnName = "礼包名称", EnName = "bagName") |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "礼包名称",index = 5) |
|||
private String bagName; |
|||
@ExportEntityMap(CnName = "商品明细", EnName = "goodsInfo") |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "商品明细",index = 6) |
|||
private String goodsInfo; |
|||
|
|||
@ExcelIgnore |
|||
private String sid; |
|||
} |
|||
|
@ -1,20 +1,33 @@ |
|||
package com.yxt.yyth.api.lpkreserveorder; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelIgnore; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
|||
import com.yxt.common.core.utils.ExportEntityMap; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/11 13:58 |
|||
*/ |
|||
@Data |
|||
@Getter |
|||
@Setter |
|||
@EqualsAndHashCode |
|||
public class ReserveOrderExportByStore { |
|||
@ExportEntityMap(CnName = "预约时间", EnName = "reserveDate") |
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "预约时间",index = 0) |
|||
private String reserveDate; |
|||
@ExportEntityMap(CnName = "提货门店", EnName = "store") |
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "提货门店",index = 1) |
|||
private String store; |
|||
private String storeSid; |
|||
@ExportEntityMap(CnName = "商品明细", EnName = "goodsInfo") |
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "商品明细",index = 2) |
|||
private String goodsInfo; |
|||
private String sid; |
|||
@ExcelIgnore |
|||
private String storeSid; |
|||
} |
|||
|
@ -0,0 +1,48 @@ |
|||
package com.yxt.yyth.biz.empcardgift; |
|||
|
|||
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.yyth.api.empcardgift.*; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/21 15:03 |
|||
*/ |
|||
@Mapper |
|||
public interface EmpCardGiftMapper extends BaseMapper<EmpCardGift> { |
|||
|
|||
IPage<EmpGiftAppletVo> getGifCardByCustomerSid(IPage<EmpCardGift> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw); |
|||
|
|||
EmpGiftAppletVo getGifCardBySid(@Param("sid") String sid); |
|||
|
|||
|
|||
String selctMaxSerNum(@Param("cardArea") String cardArea); |
|||
|
|||
IPage<EmpCardGiftListVo> cardList(IPage<EmpCardGift> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw); |
|||
|
|||
List<EmpCardGiftListVo> selAllByRecordSid(@Param("sid") String sid); |
|||
|
|||
IPage<EmpCardGiftListVo> recordDetails(IPage<EmpCardGift> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw); |
|||
|
|||
List<EmpCardGiftExport> exportExcel(@Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw); |
|||
|
|||
Integer updateState(@Param("serialNumbers") List<Integer> serialNumbers, @Param("state") String state, @Param("bankSid") String bankSid, @Param("recordSid") String recordSid); |
|||
|
|||
@Select("select count(id) from lpk_giftcard where recordSid=#{recordSid} and grantRecordSid is not null") |
|||
Integer cardGrantCount(@Param("recordSid") String recordSid); |
|||
|
|||
@Select("update lpk_giftcard set isItInvalid='1' where giftbagSid=#{giftbagSid} and state!=#{state} ") |
|||
Integer updateIsItInvalid(@Param("giftbagSid") String giftbagSid, @Param("state") String state); |
|||
|
|||
// List<EmpCardGiftWordVo> selGiftCard(@Param("serialNumbers") List<Integer> serialNumbers);
|
|||
IPage<EmpCardGiftWordVo> selGiftCard(IPage<EmpCardGift> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw); |
|||
EmpCardGiftVo getEmpCardGoods(@Param("empCardSid")String empCardSid,@Param("goodsSid")String goodsSid); |
|||
|
|||
} |
@ -0,0 +1,177 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.yyth.biz.empcardgift.EmpCardGiftMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
|
|||
<select id="getGifCardByCustomerSid" resultType="com.yxt.yyth.api.empcardgift.EmpGiftAppletVo"> |
|||
SELECT |
|||
gi.*, |
|||
gi.state AS states, |
|||
gi.serialNumber AS serialNumber, |
|||
go.goodsNumber, |
|||
gif.dateStart, |
|||
gif.dateEnd, |
|||
CASE |
|||
gi.state |
|||
WHEN 3 THEN |
|||
'未提货' |
|||
WHEN 4 THEN |
|||
'已经预约提货(预约部分提货)' |
|||
WHEN 5 THEN |
|||
'已经提取完成' |
|||
END stateValue |
|||
FROM |
|||
emp_card_gift gi |
|||
LEFT JOIN emp_card_gift_goods go ON go.empCardGiftSid = gi.sid |
|||
LEFT JOIN emp_card emp ON emp.sid = gi.empCardSid |
|||
LEFT JOIN lpk_giftbag gif ON gif.sid = emp.giftbagSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
ORDER BY gi.isItlnvalid asc,gi.bindDate desc |
|||
</select> |
|||
<select id="getGifCardBySid" resultType="com.yxt.yyth.api.empcardgift.EmpGiftAppletVo"> |
|||
SELECT |
|||
gi.*, |
|||
gi.state AS states, |
|||
gi.serialNumber AS serialNumber, |
|||
go.goodsNumber, |
|||
gif.dateStart, |
|||
gif.dateEnd, |
|||
CASE |
|||
gi.state |
|||
WHEN 3 THEN |
|||
'未提货' |
|||
WHEN 4 THEN |
|||
'已经预约提货(预约部分提货)' |
|||
WHEN 5 THEN |
|||
'已经提取完成' |
|||
END stateValue |
|||
FROM |
|||
emp_card_gift gi |
|||
LEFT JOIN emp_card_gift_goods go ON go.empCardGiftSid = gi.sid |
|||
LEFT JOIN emp_card emp ON emp.sid = gi.empCardSid |
|||
LEFT JOIN lpk_giftbag gif ON gif.sid = emp.giftbagSid |
|||
WHERE |
|||
gi.sid = #{sid} |
|||
</select> |
|||
<select id="selctMaxSerNum" resultType="java.lang.String"> |
|||
SELECT MAX(serialNumber) as sNo |
|||
FROM emp_card_gift |
|||
WHERE LENGTH(serialNumber) = 8 |
|||
AND LEFT (serialNumber |
|||
, 1) = #{cardArea} |
|||
</select> |
|||
<select id="cardList" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardListVo"> |
|||
SELECT |
|||
sid, |
|||
date_format(createTime, '%Y-%m-%d') as createTime, |
|||
remarks, |
|||
giftbagSid, |
|||
serialNumber, |
|||
code, |
|||
codeKey, |
|||
CASE `state` |
|||
WHEN 1 THEN '未发放' |
|||
WHEN 2 THEN '未绑定客户' |
|||
WHEN 3 THEN '未提货' |
|||
WHEN 4 THEN '已经预约提货(预约部分提货)' |
|||
WHEN 5 THEN '已经提取完成' END AS `state`, |
|||
grantName, |
|||
date_format(grantDate, '%Y-%m-%d') as grantDate, |
|||
customerMobile, |
|||
customerSid |
|||
FROM |
|||
lpk_giftcard |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="selAllByRecordSid" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardListVo"> |
|||
SELECT sid, |
|||
date_format(createTime, '%Y-%m-%d') as createTime, |
|||
remarks, |
|||
giftbagSid, |
|||
serialNumber, |
|||
code, |
|||
codeKey, |
|||
`state`, |
|||
grantName, |
|||
date_format(grantDate, '%Y-%m-%d') as grantDate, |
|||
customerMobile, |
|||
customerSid |
|||
FROM lpk_giftcard |
|||
where recordSid = #{sid} |
|||
</select> |
|||
<select id="recordDetails" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardListVo"> |
|||
SELECT |
|||
card.sid, |
|||
card.recordId, |
|||
date_format(card.createTime, '%Y-%m-%d') as createTime, |
|||
card.remarks, |
|||
card.giftbagSid, |
|||
card.serialNumber, |
|||
card.code, |
|||
card.codeKey, |
|||
CASE card.state |
|||
WHEN 1 THEN '未发放' |
|||
WHEN 2 THEN '未绑定客户' |
|||
WHEN 3 THEN '未提货' |
|||
WHEN 4 THEN '已经预约提货(预约部分提货)' |
|||
WHEN 5 THEN '已经提取完成' END AS `state`, |
|||
grantName, |
|||
date_format(card.grantDate, '%Y-%m-%d') as grantDate, |
|||
card.customerMobile, |
|||
card.customerSid, |
|||
bank.name as name, |
|||
date_format(rr.buildDate, '%Y-%m-%d') as buildDate |
|||
FROM |
|||
lpk_giftcard card |
|||
left join lpk_bank bank on bank.sid=card.bankSid |
|||
left join lpk_card_grant_record rr on rr.sid =card.grantRecordSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="exportExcel" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardExport"> |
|||
SELECT |
|||
serialNumber, |
|||
code, |
|||
codeKey |
|||
FROM |
|||
lpk_giftcard |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<update id="updateState"> |
|||
update lpk_giftcard set state=#{state}, bankSid=#{bankSid},grantRecordSid =#{recordSid} where serialNumber in |
|||
<foreach collection="serialNumbers" item="item" index="index" open="(" close=")" separator=","> |
|||
#{item} |
|||
</foreach> |
|||
</update> |
|||
<!-- <select id="selGiftCard" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardWordVo">--> |
|||
<!-- select card.*,bag.name as bagName from lpk_giftcard card left join lpk_giftbag bag on bag.sid =card.giftbagSid where card.serialNumber in--> |
|||
<!-- <foreach collection="serialNumbers" item="item" index="index" open="(" close=")" separator=",">--> |
|||
<!-- #{item}--> |
|||
<!-- </foreach>--> |
|||
<!-- </select>--> |
|||
<select id="selGiftCard" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardWordVo"> |
|||
select card.*,bag.name as bagName from lpk_giftcard card left join lpk_giftbag bag on bag.sid =card.giftbagSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="getEmpCardGoods" resultType="com.yxt.yyth.api.empcardgift.EmpCardGiftVo"> |
|||
SELECT |
|||
sum(goodsNumber) as goodsNumber |
|||
FROM |
|||
emp_card_gift gift |
|||
LEFT JOIN emp_card_gift_goods goods ON gift.sid = goods.empCardGiftSid |
|||
WHERE |
|||
gift.empCardSid = #{empCardSid} |
|||
AND goods.goodsSid = #{goodsSid}; |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,112 @@ |
|||
package com.yxt.yyth.biz.empcardgift; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.yyth.api.empcardgift.EmpCardGiftDto; |
|||
import com.yxt.yyth.api.empcardgift.EmpCardGiftListVo; |
|||
import com.yxt.yyth.api.empcardgift.EmpCardGiftQuery; |
|||
import com.yxt.yyth.api.lpkgiftcard.BindCardDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/21 15:03 |
|||
*/ |
|||
|
|||
@Api(tags = "礼品卡信息") |
|||
@RestController |
|||
@RequestMapping("empcardgift") |
|||
public class EmpCardGiftRest { |
|||
|
|||
@Autowired |
|||
EmpCardGiftService EmpCardGiftService; |
|||
|
|||
|
|||
@PostMapping("/bindCard") |
|||
@ApiOperation(value = "客户绑定礼包卡") |
|||
public ResultBean wxBindMobile(@RequestBody BindCardDto bindCardDto) { |
|||
return EmpCardGiftService.bindCard(bindCardDto); |
|||
} |
|||
|
|||
@PostMapping("/gifCardByCustomerSid") |
|||
@ApiOperation(value = "获取客户绑定的福利卡") |
|||
public ResultBean gifCardByCustomerSid(@RequestBody PagerQuery<EmpCardGiftQuery> query) { |
|||
return EmpCardGiftService.getGifCardByCustomerSid(query); |
|||
} |
|||
@GetMapping("/isSaturAndSun/{cardSid}") |
|||
@ApiOperation(value = "获取时间段的周六日") |
|||
public ResultBean isSaturAndSun(@PathVariable("cardSid") String cardSid) { |
|||
return EmpCardGiftService.isSaturAndSun(cardSid); |
|||
} |
|||
|
|||
@GetMapping("/getGifCardBySid/{sid}") |
|||
@ApiOperation(value = "获取礼包卡的详情信息") |
|||
public ResultBean getGifCardBySid(@PathVariable("sid") String sid) { |
|||
return EmpCardGiftService.getGifCardBySid(sid); |
|||
} |
|||
|
|||
// @GetMapping("/getReservationBySid/{sid}")
|
|||
// @ApiOperation(value = "查询可预约取货的详情")
|
|||
// public ResultBean getReservationBySid(@PathVariable("sid") String sid) {
|
|||
// return EmpCardGiftService.getReservationBySid(sid);
|
|||
// }
|
|||
|
|||
@PostMapping("/generateCard") |
|||
@ApiOperation(value = "生成礼包卡信息") |
|||
public ResultBean generateCard(@RequestBody EmpCardGiftDto dto) { |
|||
return EmpCardGiftService.generateCard(dto); |
|||
} |
|||
// @GetMapping("/getCardByBank")
|
|||
// @ApiOperation(value = "生成礼包卡信息")
|
|||
// public JSONObject getCardByBank(@RequestParam(value = "pageNo",defaultValue = "1")Integer pageNo,
|
|||
// @RequestParam(value = "pageSize",defaultValue = "8")Integer pageSize,
|
|||
// @RequestParam(value = "printAll",required = false) String printAll,
|
|||
// @RequestParam(value = "end",defaultValue = "") String end,
|
|||
// @RequestParam(value = "start",defaultValue = "") String start) {
|
|||
// PagerQuery<EmpCardGiftListQuery> pq=new PagerQuery<>();
|
|||
// EmpCardGiftListQuery q=new EmpCardGiftListQuery();
|
|||
// pq.setCurrent(pageNo);
|
|||
// pq.setSize(pageSize);
|
|||
//
|
|||
// q.setNoEnd(end);
|
|||
// q.setNoStart(start);
|
|||
// pq.setParams(q);
|
|||
//
|
|||
// PagerVo<EmpCardGiftWordVo> p=EmpCardGiftService.getCardByBank(pq).getData();
|
|||
// JSONObject jsonObject=new JSONObject();
|
|||
// jsonObject.put("date",p.getRecords());
|
|||
// jsonObject.put("total",p.getPages());
|
|||
// jsonObject.put("count",p.getTotal());
|
|||
// return jsonObject;
|
|||
// }
|
|||
|
|||
// @PostMapping("/cardList")
|
|||
// @ApiOperation(value = "礼包卡信息列表")
|
|||
// public ResultBean<PagerVo<EmpCardGiftListVo>> cardList(@RequestBody PagerQuery<EmpCardGiftQuery> pq) {
|
|||
// return EmpCardGiftService.cardList(pq);
|
|||
// }
|
|||
|
|||
// @ApiOperation("查看记录详情列表")
|
|||
// @PostMapping("/recordDetails")
|
|||
// public ResultBean<PagerVo<EmpCardGiftListVo>> recordDetails(@RequestBody PagerQuery<EmpCardGiftQuery> pq) {
|
|||
// return EmpCardGiftService.recordDetails(pq);
|
|||
// }
|
|||
|
|||
|
|||
// @ApiOperation(value = "礼包卡信息列表导出")
|
|||
// @PostMapping("/exportExcel")
|
|||
// public void exportExcel(@RequestBody EmpCardGiftListQuery query) {
|
|||
// EmpCardGiftService.exportExcel(query);
|
|||
// }
|
|||
|
|||
// @ApiOperation(value = "礼包卡发放信息")
|
|||
// @PostMapping("/cardGrant")
|
|||
// public ResultBean cardGrant(@RequestBody CardGrantDto dto) {
|
|||
// return EmpCardGiftService.cardGrant(dto);
|
|||
// }
|
|||
|
|||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@ |
|||
package com.yxt.yyth.biz.empcardgiftgoods; |
|||
|
|||
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.yyth.api.empcardgift.*; |
|||
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoods; |
|||
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/21 15:03 |
|||
*/ |
|||
@Mapper |
|||
public interface EmpCardGiftGoodsMapper extends BaseMapper<EmpCardGiftGoods> { |
|||
List<EmpCardGiftGoodsVo> getGoodsByEmpCardGiftSid(@Param("empCardGiftSid")String empCardGiftSid ); |
|||
List<EmpCardGiftGoodsVo> getGoodsBySid(@Param("empCardGiftSid")String empCardGiftSid ); |
|||
} |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.yyth.biz.empcardgiftgoods.EmpCardGiftGoodsMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
<select id="getGoodsByEmpCardGiftSid" resultType="com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo"> |
|||
select gg.*,goods.name as name,goods.unitName as unitName,goods.picUrl as picUrl |
|||
from emp_card_gift_goods gg left join lpk_goods goods on gg.goodsSid=goods.sid |
|||
where gg.empCardGiftSid =#{empCardGiftSid} |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,27 @@ |
|||
package com.yxt.yyth.biz.empcardgiftgoods; |
|||
|
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.yyth.api.empcardgift.EmpCardGiftDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/21 15:03 |
|||
*/ |
|||
|
|||
@Api(tags = "企业福利卡商品") |
|||
@RestController |
|||
@RequestMapping("empcardgiftgoods") |
|||
public class EmpCardGiftGoodsRest { |
|||
|
|||
@Autowired |
|||
EmpCardGiftGoodsService EmpCardGiftService; |
|||
|
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.yxt.yyth.biz.empcardgiftgoods; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.yyth.api.empcard.EmpCard; |
|||
import com.yxt.yyth.api.empcardgift.EmpCardGift; |
|||
import com.yxt.yyth.api.empcardgift.EmpCardGiftDto; |
|||
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoods; |
|||
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsDto; |
|||
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLog; |
|||
import com.yxt.yyth.api.lpkbank.LpkBank; |
|||
import com.yxt.yyth.biz.empcard.EmpCardService; |
|||
import com.yxt.yyth.biz.empcardgrantlog.EmpCardGrantLogService; |
|||
import com.yxt.yyth.biz.lpkgiftcard.generateRule.UniqueIdGenerator; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Random; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/21 15:03 |
|||
*/ |
|||
@Service |
|||
public class EmpCardGiftGoodsService extends MybatisBaseService<EmpCardGiftGoodsMapper, EmpCardGiftGoods> { |
|||
|
|||
|
|||
|
|||
public ResultBean save(EmpCardGiftGoodsDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
EmpCardGiftGoods entity=new EmpCardGiftGoods(); |
|||
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|||
baseMapper.insert(entity); |
|||
return rb.success(); |
|||
} |
|||
public ResultBean<List<EmpCardGiftGoodsVo>> getGoodsByEmpCardGiftSid(String empCardGiftSid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<EmpCardGiftGoodsVo> list= baseMapper.getGoodsByEmpCardGiftSid(empCardGiftSid); |
|||
return rb.success().setData(list); |
|||
} |
|||
public ResultBean<List<EmpCardGiftGoodsVo>> getGoodsBySid(String empCardGiftSid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<EmpCardGiftGoodsVo> list= baseMapper.getGoodsBySid(empCardGiftSid); |
|||
return rb.success().setData(list); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.yyth.biz.empcardgrantlog; |
|||
|
|||
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.yyth.api.empcardgrantlog.EmpCardGrantLog; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:19 |
|||
*/ |
|||
@Mapper |
|||
public interface EmpCardGrantLogMapper extends BaseMapper<EmpCardGrantLog> { |
|||
IPage<EmpCardGrantLogVo> recordListPage(IPage<EmpCardGrantLog> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGrantLog> qw); |
|||
List<EmpCardGrantLogVo> recordList(@Param("empCardSid")String empCardSid); |
|||
EmpCardGrantLogVo recordListGoods(@Param("empCardSid")String empCardSid,@Param("goodsSid")String goodsSid); |
|||
} |
@ -0,0 +1,47 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.yyth.biz.empcardgrantlog.EmpCardGrantLogMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
|
|||
<select id="recordListPage" resultType="com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo"> |
|||
select |
|||
r.sid, |
|||
date_format(r.buildDate, '%Y-%m-%d') as buildDate, |
|||
r.countNumber, |
|||
r.startNumber, |
|||
r.endNumber, |
|||
g.name as bagName |
|||
from emp_card_build_record as r |
|||
left join lpk_giftbag as g on r.giftbagSid = g.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="recordList" resultType="com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo"> |
|||
SELECT |
|||
log.*, |
|||
gi.sid as cardSid, |
|||
gi.code as code, |
|||
gi.codeKey as codeKey, |
|||
gi.remarks as remakrs |
|||
FROM |
|||
emp_card_grant_log log |
|||
LEFT JOIN emp_card_gift gi ON gi.CODE = log.CODE |
|||
where log.empCardSid=#{empCardSid} |
|||
|
|||
</select> |
|||
<select id="recordListGoods" resultType="com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo"> |
|||
SELECT |
|||
log.sid, |
|||
sum( go.goodsNumber ) AS goodsNumber |
|||
FROM |
|||
emp_card_grant_log log |
|||
LEFT JOIN emp_card_gift gi ON gi.CODE = log. |
|||
CODE LEFT JOIN emp_card_gift_goods go on go.empCardGiftSid = gi.sid |
|||
where log.empCardSid=#{empCardSid} and go.goodsSid=#{goodsSid} |
|||
GROUP BY go.goodsSid |
|||
|
|||
</select> |
|||
</mapper> |
@ -0,0 +1,31 @@ |
|||
package com.yxt.yyth.biz.empcardgrantlog; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogQuery; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:19 |
|||
*/ |
|||
@Api(tags = "礼品卡信息") |
|||
@RestController |
|||
@RequestMapping("empcardgrantlog") |
|||
public class EmpCardGrantLogRest { |
|||
@Autowired |
|||
EmpCardGrantLogService EmpCardGrantLogService; |
|||
@ApiOperation("创建记录列表") |
|||
@PostMapping("/recordListPage") |
|||
public ResultBean<PagerVo<EmpCardGrantLogVo>> recordListPage(@RequestBody PagerQuery<EmpCardGrantLogQuery> pq) { |
|||
return EmpCardGrantLogService.recordListPage(pq); |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.yxt.yyth.biz.empcardgrantlog; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLog; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogQuery; |
|||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo; |
|||
import com.yxt.yyth.biz.empcard.EmpCardService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/12/8 9:19 |
|||
*/ |
|||
@Service |
|||
public class EmpCardGrantLogService extends MybatisBaseService<EmpCardGrantLogMapper, EmpCardGrantLog> { |
|||
|
|||
@Autowired |
|||
EmpCardService empCardService; |
|||
public ResultBean<PagerVo<EmpCardGrantLogVo>> recordListPage(PagerQuery<EmpCardGrantLogQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
EmpCardGrantLogQuery query = pq.getParams(); |
|||
QueryWrapper<EmpCardGrantLog> qw = new QueryWrapper<>(); |
|||
qw.eq("1", "1"); |
|||
if (StringUtils.isNotBlank(query.getCountNumber())) { |
|||
qw.eq("r.countNumber", query.getCountNumber()); |
|||
} |
|||
String startDate = query.getStartDate(); |
|||
String effEndTime = query.getEndDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (r.buildDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"). |
|||
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(effEndTime), "date_format (r.buildDate,'%Y-%m-%d') <= date_format('" + effEndTime + "','%Y-%m-%d')" |
|||
); |
|||
qw.orderByDesc("r.createTime"); |
|||
IPage<EmpCardGrantLog> page = PagerUtil.queryToPage(pq); |
|||
IPage<EmpCardGrantLogVo> pagging = baseMapper.recordListPage(page, qw); |
|||
// for(EmpCardGrantLogVo vo:pagging.getRecords()){
|
|||
// vo.setGrantCountNumber(String.valueOf(empCardService.cardGrantCount(vo.getSid()).getData()));
|
|||
// }
|
|||
PagerVo<EmpCardGrantLogVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
|
|||
public ResultBean<List<EmpCardGrantLogVo>> recordList(String empCardSid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<EmpCardGrantLogVo> pagging = baseMapper.recordList(empCardSid); |
|||
return rb.success().setData(pagging); |
|||
} |
|||
public ResultBean<EmpCardGrantLogVo> recordListGoods(String empCardSid,String goodsSid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
EmpCardGrantLogVo pagging = baseMapper.recordListGoods(empCardSid,goodsSid); |
|||
return rb.success().setData(pagging); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.yxt.yyth.biz.empreserveorder; |
|||
|
|||
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.yyth.api.empreserveorder.*; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Mapper |
|||
public interface EmpReserveOrderMapper extends BaseMapper<EmpReserveOrder> { |
|||
IPage<EmpReserveOrderVo> orderList(IPage<EmpReserveOrder> page, @Param(Constants.WRAPPER) QueryWrapper<EmpReserveOrder> qw); |
|||
IPage<EmpReserveOrderVo> orderListByStore(IPage<EmpReserveOrder> page, @Param(Constants.WRAPPER) QueryWrapper<EmpReserveOrder> qw); |
|||
List<EmpReserveOrderCardVo> orderByCardSid(String sid); |
|||
|
|||
IPage<EmpReserveOrderCardVo> orderListByUserSid(IPage<EmpReserveOrder> page, @Param(Constants.WRAPPER) QueryWrapper<EmpReserveOrder> qw); |
|||
|
|||
List<ReserveOrderExport> exportExcel(@Param(Constants.WRAPPER) QueryWrapper<EmpReserveOrderQuery> qw); |
|||
List<ReserveOrderExportByStore> exportExcelByStore(@Param(Constants.WRAPPER) QueryWrapper<EmpReserveOrderQuery> qw); |
|||
@Select("select sid from lpk_reserve_order where storeSid=#{storeSid}") |
|||
List<String> getOrderByStore(@Param("storeSid")String storeSid); |
|||
@Select("select * from emp_reserve_order where customerSid =#{sid} order by createTime desc limit 1") |
|||
EmpReserveOrderVo getStoreByCustomerSid(@Param("sid") String sid); |
|||
@Select("select * from lpk_reserve_order where cardSid =#{sid} order by reserveDate desc limit 1") |
|||
EmpReserveOrderVo selByCardSid(@Param("sid") String sid); |
|||
@Select("SELECT o.*,st.`name` AS store FROM emp_reserve_order o LEFT JOIN lpk_store st ON o.storeSid = st.sid where o.cardSid =#{sid} ORDER BY o.reserveDate desc") |
|||
List<EmpReserveOrderCardVo> selOrderByCardSid(@Param("sid") String sid); |
|||
|
|||
} |
@ -0,0 +1,114 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.yyth.biz.empreserveorder.EmpReserveOrderMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="storeListPage" resultType="com.yxt.yyth.api.lpkstore.LpkStoreVo"> |
|||
select |
|||
sid, |
|||
date_format(createTime, '%Y-%m-%d') as createTime, |
|||
code, |
|||
`name`, |
|||
address, |
|||
phone, |
|||
businessHours |
|||
from lpk_store |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="orderList" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo"> |
|||
select |
|||
o.sid, |
|||
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
|||
o.userName, |
|||
o.userPhone, |
|||
s.`name` as store, |
|||
b.`name` as bagName, |
|||
c.`code` |
|||
from lpk_reserve_order as o |
|||
left join lpk_store as s on o.storeSid = s.sid |
|||
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
|||
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="orderListByStore" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo"> |
|||
select |
|||
o.sid, |
|||
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
|||
s.`name` as store, |
|||
s.sid as storeSid |
|||
from lpk_reserve_order as o |
|||
left join lpk_store as s on o.storeSid = s.sid |
|||
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
|||
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="orderByCardSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo"> |
|||
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
|||
c.`code`, |
|||
s.`name` as store, |
|||
b.`name` as bagName, |
|||
o.sid as orderSid |
|||
FROM lpk_reserve_order AS o |
|||
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid |
|||
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
|||
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
|||
WHERE o.cardSid = #{sid} |
|||
</select> |
|||
<select id="orderListByUserSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo"> |
|||
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
|||
c.`code`, |
|||
s.`name` as store, |
|||
b.`name` as bagName, |
|||
o.cardSid as cardSid, |
|||
o.sid as orderSid, |
|||
o.userName, |
|||
o.userPhone,c.serialNumber as serialNumber, |
|||
o.sid |
|||
FROM lpk_reserve_order AS o |
|||
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid |
|||
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
|||
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="exportExcel" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExport"> |
|||
select |
|||
o.sid, |
|||
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
|||
o.userName, |
|||
o.userPhone, |
|||
s.`name` as store, |
|||
b.`name` as bagName, |
|||
c.`code` |
|||
from lpk_reserve_order as o |
|||
left join lpk_store as s on o.storeSid = s.sid |
|||
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
|||
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="exportExcelByStore" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExportByStore"> |
|||
select |
|||
o.sid, |
|||
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
|||
s.`name` as store, |
|||
s.sid as storeSid |
|||
from lpk_reserve_order as o |
|||
left join lpk_store as s on o.storeSid = s.sid |
|||
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
|||
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,72 @@ |
|||
package com.yxt.yyth.biz.empreserveorder; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderCardVo; |
|||
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderDto; |
|||
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderQuery; |
|||
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderVo; |
|||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:35 |
|||
*/ |
|||
@Api(tags = "预约订单信息") |
|||
@RestController |
|||
@RequestMapping("/empsreservoorder") |
|||
public class EmpReserveOrderRest { |
|||
@Autowired |
|||
EmpReserveOrderService empReserveOrderService; |
|||
|
|||
|
|||
@ApiOperation("预约提交") |
|||
@PostMapping("/submission") |
|||
public ResultBean submission(@RequestBody EmpReserveOrderDto dto) { |
|||
return empReserveOrderService.submission(dto); |
|||
} |
|||
|
|||
@ApiOperation("订单列表") |
|||
@PostMapping("/orderList") |
|||
public ResultBean<PagerVo<EmpReserveOrderVo>> orderList(@RequestBody PagerQuery<EmpReserveOrderQuery> pq) { |
|||
return empReserveOrderService.orderList(pq); |
|||
} |
|||
@ApiOperation("订单门店汇总列表") |
|||
@PostMapping("/orderListByStore") |
|||
public ResultBean<PagerVo<EmpReserveOrderVo>> orderListByStore(@RequestBody PagerQuery<EmpReserveOrderQuery> pq) { |
|||
return empReserveOrderService.orderListByStore(pq); |
|||
} |
|||
@ApiOperation("根据提货卡查询预约记录") |
|||
@GetMapping("/orderByCardSid/{sid}") |
|||
public ResultBean orderByCardSid(@PathVariable("sid") String sid) { |
|||
return empReserveOrderService.orderByCardSid(sid); |
|||
} |
|||
|
|||
@ApiOperation("移动端预约订单列表") |
|||
@PostMapping("/orderListByUserSid") |
|||
public ResultBean<PagerVo<EmpReserveOrderCardVo>> orderListByUserSid(@RequestBody PagerQuery<EmpReserveOrderQuery> pq) { |
|||
return empReserveOrderService.orderListByUserSid(pq); |
|||
} |
|||
|
|||
@ApiOperation("预约记录详情") |
|||
@GetMapping("/orderDetails/{orderSid}") |
|||
public ResultBean orderDetails(@PathVariable("orderSid") String orderSid) { |
|||
return empReserveOrderService.orderDetails(orderSid); |
|||
} |
|||
|
|||
@ApiOperation(value = "预约订单信息列表导出") |
|||
@PostMapping("/exportExcel") |
|||
public void exportExcel(@RequestBody EmpReserveOrderQuery query) { |
|||
empReserveOrderService.exportExcel(query); |
|||
} |
|||
@ApiOperation(value = "预约订单门店汇总导出") |
|||
@PostMapping("/exportExcelByStore") |
|||
public void exportExcelByStore(@RequestBody EmpReserveOrderQuery query) { |
|||
empReserveOrderService.exportExcelByStore(query); |
|||
} |
|||
} |
@ -0,0 +1,439 @@ |
|||
package com.yxt.yyth.biz.empreserveorder; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.ExportExcelUtils; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.yyth.api.empreserveorder.*; |
|||
import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods; |
|||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo; |
|||
import com.yxt.yyth.api.lpkgiftcard.AppletVo; |
|||
import com.yxt.yyth.api.lpkgiftcard.GoodsVo; |
|||
import com.yxt.yyth.api.lpkgoods.LpkGoods; |
|||
import com.yxt.yyth.api.lpkstore.LpkStore; |
|||
import com.yxt.yyth.api.lpkstore.StoreSelect; |
|||
import com.yxt.yyth.biz.empreserveordergoods.EmpReserveOrderGoodsService; |
|||
import com.yxt.yyth.biz.lpkgiftbaggoods.LpkGiftBagGoodsService; |
|||
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardMapper; |
|||
import com.yxt.yyth.biz.lpkgoods.LpkGoodsService; |
|||
import com.yxt.yyth.biz.lpkstore.LpkStoreService; |
|||
import org.junit.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.text.ParseException; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Service |
|||
public class EmpReserveOrderService extends MybatisBaseService<EmpReserveOrderMapper, EmpReserveOrder> { |
|||
@Autowired |
|||
EmpReserveOrderGoodsService empReserveOrderGoodsService; |
|||
@Autowired |
|||
LpkGiftCardMapper lpkGiftCardMapper; |
|||
@Autowired |
|||
LpkGiftBagGoodsService lpkGiftBagGoodsService; |
|||
@Autowired |
|||
LpkStoreService lpkStoreService; |
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
@Autowired |
|||
private LpkGoodsService lpkGoodsService; |
|||
@Autowired |
|||
private HttpServletResponse response; |
|||
|
|||
public ResultBean submission(EmpReserveOrderDto dto) { |
|||
ResultBean rb = new ResultBean().fail(); |
|||
boolean b=isSatAndSun(dto.getReserveDate()); |
|||
if(!b){ |
|||
return rb.setMsg("周六、周日不能预约提货"); |
|||
} |
|||
EmpReserveOrder order = new EmpReserveOrder(); |
|||
BeanUtil.copyProperties(dto, order, "id", "sid"); |
|||
order.setStoreSid(dto.getValue()); |
|||
order.setCardSid(dto.getSid()); |
|||
order.setCreateTime(new DateTime()); |
|||
baseMapper.insert(order); |
|||
dto.setOrderSid(order.getSid()); |
|||
empReserveOrderGoodsService.submissionDetail(dto); |
|||
return rb.success().setData("预约成功"); |
|||
} |
|||
public boolean isSatAndSun(String date){ |
|||
DateTime dateTime = DateUtil.parse(date);; // 获取当前时间
|
|||
int dayOfWeek = dateTime.dayOfWeekEnum().getValue();// 获取星期几(1-7)
|
|||
System.out.println(dayOfWeek); |
|||
if (dayOfWeek == 1 || dayOfWeek == 7) { |
|||
return false; |
|||
} else { |
|||
return true; |
|||
} |
|||
} |
|||
@Test |
|||
public void isSatAndSun(){ |
|||
String date="2023-12-11"; |
|||
DateTime dateTime = DateUtil.parse(date);; // 获取当前时间
|
|||
int dayOfWeek = dateTime.dayOfWeekEnum().getValue();// 获取星期几(1-7)
|
|||
|
|||
System.out.println(dayOfWeek); |
|||
if (dayOfWeek == 1 || dayOfWeek == 7) { |
|||
System.out.println(dayOfWeek); |
|||
} else { |
|||
System.out.println(11111); |
|||
} |
|||
} |
|||
public ResultBean<PagerVo<EmpReserveOrderVo>> orderList(PagerQuery<EmpReserveOrderQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
EmpReserveOrderQuery query = pq.getParams(); |
|||
QueryWrapper<EmpReserveOrder> qw = new QueryWrapper<>(); |
|||
qw.eq("1", "1"); |
|||
if (StringUtils.isNotBlank(query.getStore())) { |
|||
qw.like("s.name", query.getStore()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getUserName())) { |
|||
qw.like("o.userName", query.getUserName()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getUserSid())) { |
|||
qw.like("o.customerSid", query.getUserSid()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getStartDate())) { |
|||
|
|||
String startDate = query.getStartDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (o.reserveDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getEndDate())) { |
|||
String endDate = query.getEndDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(endDate), "date_format (o.reserveDate,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')"); |
|||
} |
|||
|
|||
|
|||
qw.orderByDesc("o.reserveDate"); |
|||
IPage<EmpReserveOrder> page = PagerUtil.queryToPage(pq); |
|||
IPage<EmpReserveOrderVo> pagging = baseMapper.orderList(page, qw); |
|||
List<EmpReserveOrderVo> records = pagging.getRecords(); |
|||
if (!records.isEmpty()) { |
|||
records.forEach(s -> { |
|||
List<EmpReserveOrderGoods> orderGoods = empReserveOrderGoodsService.selByOrderSid(s.getSid()); |
|||
List<OrderGoodsVo> goodsVoList = new ArrayList<>(); |
|||
if (!orderGoods.isEmpty()) { |
|||
for (EmpReserveOrderGoods orderGood : orderGoods) { |
|||
OrderGoodsVo goodsVo = new OrderGoodsVo(); |
|||
if (StringUtils.isNotBlank(orderGood.getGoodsSid())) { |
|||
LpkGoods lpkGoods = lpkGoodsService.fetchBySid(orderGood.getGoodsSid()); |
|||
if (null != lpkGoods) { |
|||
goodsVo.setGoodName(lpkGoods.getName()); |
|||
} |
|||
} |
|||
if (orderGood.getGoodsNumber() != 0) { |
|||
goodsVo.setNum((int) orderGood.getGoodsNumber()); |
|||
} |
|||
goodsVoList.add(goodsVo); |
|||
} |
|||
} |
|||
s.setGoodsVo(goodsVoList); |
|||
}); |
|||
} |
|||
PagerVo<EmpReserveOrderVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
public ResultBean<PagerVo<EmpReserveOrderVo>> orderListByStore(PagerQuery<EmpReserveOrderQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
EmpReserveOrderQuery query = pq.getParams(); |
|||
QueryWrapper<EmpReserveOrder> qw = new QueryWrapper<>(); |
|||
qw.eq("1", "1"); |
|||
if (StringUtils.isNotBlank(query.getStore())) { |
|||
qw.like("s.name", query.getStore()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getUserName())) { |
|||
qw.like("o.userName", query.getUserName()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getUserSid())) { |
|||
qw.like("o.customerSid", query.getUserSid()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getStartDate())) { |
|||
|
|||
String startDate = query.getStartDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (o.reserveDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getEndDate())) { |
|||
String endDate = query.getEndDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(endDate), "date_format (o.reserveDate,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')"); |
|||
} |
|||
|
|||
qw.orderByDesc("o.reserveDate"); |
|||
IPage<EmpReserveOrder> page = PagerUtil.queryToPage(pq); |
|||
IPage<EmpReserveOrderVo> pagging = baseMapper.orderListByStore(page, qw); |
|||
List<EmpReserveOrderVo> records = pagging.getRecords(); |
|||
if (!records.isEmpty()) { |
|||
records.forEach(s -> { |
|||
List<String> list=baseMapper.getOrderByStore(s.getStoreSid()); |
|||
List<EmpReserveOrderGoods> orderGoods = empReserveOrderGoodsService.selInOrderSid(list); |
|||
if (!orderGoods.isEmpty()) { |
|||
StringBuffer sb = new StringBuffer(); |
|||
for (EmpReserveOrderGoods orderGood : orderGoods) { |
|||
String num = ""; |
|||
String goodsName = ""; |
|||
String finWord = ""; |
|||
String unitName = ""; |
|||
if (StringUtils.isNotBlank(orderGood.getGoodsSid())) { |
|||
LpkGoods lpkGoods = lpkGoodsService.fetchBySid(orderGood.getGoodsSid()); |
|||
if (null != lpkGoods) { |
|||
goodsName = lpkGoods.getName(); |
|||
if (StringUtils.isNotBlank(lpkGoods.getUnitName())) { |
|||
unitName = lpkGoods.getUnitName(); |
|||
} |
|||
} |
|||
} |
|||
if (orderGood.getGoodsNumber() != 0) { |
|||
num = String.valueOf((int) orderGood.getGoodsNumber()); |
|||
} |
|||
finWord = num + unitName + goodsName; |
|||
sb.append(finWord).append("、"); |
|||
} |
|||
if (sb.length() > 0) { |
|||
sb.delete(sb.length() - 1, sb.length()); |
|||
s.setGoodsInfo(sb.toString()); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
PagerVo<EmpReserveOrderVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
public ResultBean orderByCardSid(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<EmpReserveOrderCardVo> list = baseMapper.orderByCardSid(sid); |
|||
return rb.success().setData(list); |
|||
} |
|||
|
|||
public ResultBean<PagerVo<EmpReserveOrderCardVo>> orderListByUserSid(PagerQuery<EmpReserveOrderQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
EmpReserveOrderQuery query = pq.getParams(); |
|||
QueryWrapper<EmpReserveOrder> qw = new QueryWrapper<>(); |
|||
qw.eq("o.customerSid", query.getUserSid()); |
|||
qw.orderByDesc("o.reserveDate"); |
|||
IPage<EmpReserveOrder> page = PagerUtil.queryToPage(pq); |
|||
IPage<EmpReserveOrderCardVo> pagging = baseMapper.orderListByUserSid(page, qw); |
|||
for(EmpReserveOrderCardVo vo:pagging.getRecords()){ |
|||
List<EmpReserveOrderGoods> goods =empReserveOrderGoodsService.selByOrderSids(vo.getSid()); |
|||
for(EmpReserveOrderGoods goods1:goods){ |
|||
LpkGoods lpkGoods=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",goods1.getGoodsSid())); |
|||
if(StringUtils.isBlank(vo.getGoods())){ |
|||
vo.setGoods(lpkGoods.getName()+":"+goods1.getNum()+lpkGoods.getUnitName()); |
|||
}else{ |
|||
vo.setGoods(vo.getGoods()+" "+lpkGoods.getName()+":"+goods1.getNum()+lpkGoods.getUnitName()); |
|||
} |
|||
} |
|||
} |
|||
PagerVo<EmpReserveOrderCardVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
|
|||
public ResultBean orderDetails(String orderSid) { |
|||
ResultBean rb = new ResultBean().fail(); |
|||
EmpReserveOrder EmpReserveOrder = fetchBySid(orderSid); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
if (null != EmpReserveOrder) { |
|||
AppletVo vo = lpkGiftCardMapper.getGifCardBySid(EmpReserveOrder.getCardSid()); |
|||
if (StringUtils.isNotBlank(EmpReserveOrder.getStoreSid())) { |
|||
LpkStore lpkStore = lpkStoreService.fetchBySid(EmpReserveOrder.getStoreSid()); |
|||
if (null != lpkStore) { |
|||
if (StringUtils.isNotBlank(lpkStore.getName())) { |
|||
vo.setStore(lpkStore.getName()); |
|||
} |
|||
} |
|||
} |
|||
if (StringUtils.isNotBlank(EmpReserveOrder.getReserveDate())) { |
|||
try { |
|||
Date parse = sdf.parse(EmpReserveOrder.getReserveDate()); |
|||
vo.setReserveDate(sdf.format(parse)); |
|||
} catch (ParseException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
List<LpkGiftBagGoodsVo> list = lpkGiftBagGoodsService.getGoodsByBagSid(vo.getGiftbagSid()); |
|||
List<StoreSelect> l = lpkStoreService.getAllStore().getData(); |
|||
List<GoodsVo> goodsVos = new ArrayList<>(); |
|||
list.forEach(s -> { |
|||
EmpReserveOrderGoods goods = empReserveOrderGoodsService.getReserveByCardSid(vo.getSid(), s.getGoodsSid()).getData(); |
|||
EmpReserveOrderGoods orderGoods = empReserveOrderGoodsService.selByOrderSidAndGoodSid(orderSid, s.getGoodsSid()); |
|||
GoodsVo goodsVo = new GoodsVo(); |
|||
goodsVo.setGoods(s.getGoodsName()); |
|||
goodsVo.setNum(s.getGoodsNumber()); |
|||
goodsVo.setGoodsSid(s.getGoodsSid()); |
|||
goodsVo.setPic(fileUploadComponent.getUrlPrefix() + s.getPicUrl()); |
|||
if (null != goods) { |
|||
if (goods.getGoodsNumber() != s.getGoodsNumber()) { |
|||
goodsVo.setLNum(s.getGoodsNumber() - goods.getGoodsNumber()); |
|||
goodsVo.setSelect(s.getGoodsNumber() - goods.getGoodsNumber()); |
|||
if (null != orderGoods) { |
|||
goodsVo.setOrderNum(orderGoods.getGoodsNumber()); |
|||
} |
|||
goodsVos.add(goodsVo); |
|||
} |
|||
} else { |
|||
goodsVo.setLNum(s.getGoodsNumber()); |
|||
goodsVo.setSelect(s.getGoodsNumber()); |
|||
goodsVos.add(goodsVo); |
|||
} |
|||
}); |
|||
vo.setGoodsVos(goodsVos); |
|||
vo.setSelect(l); |
|||
return rb.success().setData(vo); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public void exportExcel(EmpReserveOrderQuery query) { |
|||
QueryWrapper<EmpReserveOrderQuery> qw = new QueryWrapper<>(); |
|||
qw.eq("1", "1"); |
|||
if (StringUtils.isNotBlank(query.getStore())) { |
|||
qw.like("s.name", query.getStore()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getUserName())) { |
|||
qw.like("o.userName", query.getUserName()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getStartDate())) { |
|||
String startDate = query.getStartDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (o.reserveDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getEndDate())) { |
|||
String endDate = query.getEndDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(endDate), "date_format (o.reserveDate,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')"); |
|||
} |
|||
qw.orderByDesc("o.createTime"); |
|||
//得到所有要导出的数据
|
|||
List<ReserveOrderExport> exportList = baseMapper.exportExcel(qw); |
|||
if (!exportList.isEmpty()) { |
|||
exportList.forEach(s -> { |
|||
if (StringUtils.isNotBlank(s.getUserPhone())) { |
|||
// String phone = s.getUserPhone().substring(0, 3) + "****" + s.getUserPhone().substring(7);
|
|||
String phone = s.getUserPhone(); |
|||
s.setUserPhone(phone); |
|||
} |
|||
List<EmpReserveOrderGoods> orderGoods = empReserveOrderGoodsService.selByOrderSid(s.getSid()); |
|||
if (!orderGoods.isEmpty()) { |
|||
StringBuffer sb = new StringBuffer(); |
|||
for (EmpReserveOrderGoods orderGood : orderGoods) { |
|||
String num = ""; |
|||
String goodsName = ""; |
|||
String finWord = ""; |
|||
String unitName = ""; |
|||
if (StringUtils.isNotBlank(orderGood.getGoodsSid())) { |
|||
LpkGoods lpkGoods = lpkGoodsService.fetchBySid(orderGood.getGoodsSid()); |
|||
if (null != lpkGoods) { |
|||
goodsName = lpkGoods.getName(); |
|||
if (StringUtils.isNotBlank(lpkGoods.getUnitName())) { |
|||
unitName = lpkGoods.getUnitName(); |
|||
} |
|||
} |
|||
} |
|||
if (orderGood.getGoodsNumber() != 0) { |
|||
num = String.valueOf((int) orderGood.getGoodsNumber()); |
|||
} |
|||
finWord = num + unitName + goodsName; |
|||
sb.append(finWord).append("、"); |
|||
} |
|||
if (sb.length() > 0) { |
|||
sb.delete(sb.length() - 1, sb.length()); |
|||
s.setGoodsInfo(sb.toString()); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
//定义导出的excel名字
|
|||
String excelName = "1"; |
|||
String fileNameURL = "1"; |
|||
// try {
|
|||
// fileNameURL = URLEncoder.encode(excelName, "UTF-8");
|
|||
// fileNameURL = URLEncoder.encode(excelName, "UTF-8");
|
|||
// } catch (UnsupportedEncodingException e) {
|
|||
// e.printStackTrace();
|
|||
// }
|
|||
//导出预约订单信息列表
|
|||
ExportExcelUtils.export(fileNameURL, exportList, ReserveOrderExport.class, response); |
|||
} |
|||
public void exportExcelByStore(EmpReserveOrderQuery query) { |
|||
QueryWrapper<EmpReserveOrderQuery> qw = new QueryWrapper<>(); |
|||
qw.eq("1", "1"); |
|||
if (StringUtils.isNotBlank(query.getStartDate())) { |
|||
String startDate = query.getStartDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (o.reserveDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getEndDate())) { |
|||
String endDate = query.getEndDate(); |
|||
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(endDate), "date_format (o.reserveDate,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')"); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getStore())) { |
|||
qw.like("s.name", query.getStore()); |
|||
} |
|||
qw.orderByDesc("o.createTime"); |
|||
qw.groupBy("s.name"); |
|||
//得到所有要导出的数据
|
|||
List<ReserveOrderExportByStore> exportList = baseMapper.exportExcelByStore(qw); |
|||
if (!exportList.isEmpty()) { |
|||
exportList.forEach(s -> { |
|||
List<String> list=baseMapper.getOrderByStore(s.getStoreSid()); |
|||
List<EmpReserveOrderGoods> orderGoods = empReserveOrderGoodsService.selInOrderSid(list); |
|||
if (!orderGoods.isEmpty()) { |
|||
StringBuffer sb = new StringBuffer(); |
|||
for (EmpReserveOrderGoods orderGood : orderGoods) { |
|||
String num = ""; |
|||
String goodsName = ""; |
|||
String finWord = ""; |
|||
String unitName = ""; |
|||
if (StringUtils.isNotBlank(orderGood.getGoodsSid())) { |
|||
LpkGoods lpkGoods = lpkGoodsService.fetchBySid(orderGood.getGoodsSid()); |
|||
if (null != lpkGoods) { |
|||
goodsName = lpkGoods.getName(); |
|||
if (StringUtils.isNotBlank(lpkGoods.getUnitName())) { |
|||
unitName = lpkGoods.getUnitName(); |
|||
} |
|||
} |
|||
} |
|||
if (orderGood.getGoodsNumber() != 0) { |
|||
num = String.valueOf((int) orderGood.getGoodsNumber()); |
|||
} |
|||
finWord = num + unitName + goodsName; |
|||
sb.append(finWord).append("、"); |
|||
} |
|||
if (sb.length() > 0) { |
|||
sb.delete(sb.length() - 1, sb.length()); |
|||
s.setGoodsInfo(sb.toString()); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
//定义导出的excel名字
|
|||
String excelName = "1"; |
|||
String fileNameURL = "1"; |
|||
//导出预约订单信息列表
|
|||
ExportExcelUtils.export(fileNameURL, exportList, ReserveOrderExportByStore.class, response); |
|||
} |
|||
|
|||
|
|||
public ResultBean<EmpReserveOrderVo> getStoreByCustomerSid(String sid) { |
|||
return new ResultBean().success().setData(baseMapper.getStoreByCustomerSid(sid)); |
|||
} |
|||
public ResultBean<EmpReserveOrderVo> selByCardSid(String sid) { |
|||
return new ResultBean().success().setData(baseMapper.selByCardSid(sid)); |
|||
} |
|||
public ResultBean<List<EmpReserveOrderCardVo>> selOrderByCardSid(String sid) { |
|||
return new ResultBean().success().setData(baseMapper.selOrderByCardSid(sid)); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.yyth.biz.empreserveordergoods; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Mapper |
|||
public interface EmpReserveOrderGoodsMapper extends BaseMapper<EmpReserveOrderGoods> { |
|||
@Select("select sum(goodsNumber) as goodsNumber , goodsSid as goodsSid from emp_reserve_order_goods where cardSid=#{cardSid} and goodsSid=#{goodsSid}") |
|||
EmpReserveOrderGoods getReserveByCardSid(@Param("cardSid") String cardSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
EmpReserveOrderGoods selByOrderSidAndGoodSid(@Param("orderSid") String orderSid, @Param("goodsSid") String goodsSid); |
|||
|
|||
@Select("select * from lpk_reserve_order_goods where orderSid=#{orderSid}") |
|||
List<EmpReserveOrderGoods> selByOrderSid(String orderSid); |
|||
|
|||
List<EmpReserveOrderGoods> selInOrderSid(@Param("orderSids") List<String> orderSids); |
|||
@Select("select *,goodsNumber as num from emp_reserve_order_goods where orderSid=#{orderSid}") |
|||
List<EmpReserveOrderGoods> selByOrderSids(String orderSid); |
|||
} |
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.yyth.biz.empreserveordergoods.EmpReserveOrderGoodsMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="storeListPage" resultType="com.yxt.yyth.api.lpkstore.LpkStoreVo"> |
|||
select |
|||
sid, |
|||
date_format(createTime, '%Y-%m-%d') as createTime, |
|||
code, |
|||
`name`, |
|||
address, |
|||
phone, |
|||
businessHours |
|||
from lpk_store |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="selByOrderSidAndGoodSid" |
|||
resultType="com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods"> |
|||
select * |
|||
from lpk_reserve_order_goods |
|||
where orderSid = #{orderSid} |
|||
and goodsSid = #{goodsSid} |
|||
</select> |
|||
<select id="selInOrderSid" resultType="com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods"> |
|||
select s.* |
|||
from lpk_reserve_order_goods s |
|||
where orderSid in |
|||
<foreach collection="orderSids" item="item" index="index" open="(" close=")" separator=","> |
|||
#{item} |
|||
</foreach> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,29 @@ |
|||
package com.yxt.yyth.biz.empreserveordergoods; |
|||
|
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoodsDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:35 |
|||
*/ |
|||
@Api(tags = "预约订单信息") |
|||
@RestController |
|||
@RequestMapping("empsreservoorder") |
|||
public class EmpReserveOrderGoodsRest { |
|||
@Autowired |
|||
EmpReserveOrderGoodsService empReserveOrderGoodsService; |
|||
|
|||
|
|||
// @ApiOperation("预约提交")
|
|||
// @PostMapping("/submissionDetail")
|
|||
// public ResultBean submissionDetail(EmpReserveOrderGoodsDto dto){
|
|||
// return empReserveOrderGoodsService.submissionDetail(dto);
|
|||
// }
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.yxt.yyth.biz.empreserveordergoods; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.yyth.api.empcardgift.EmpGiftAppletVo; |
|||
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderDto; |
|||
import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods; |
|||
import com.yxt.yyth.api.lpkgiftcard.AppletVo; |
|||
import com.yxt.yyth.api.empcardgift.GoodsVo; |
|||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto; |
|||
import com.yxt.yyth.biz.empcardgift.EmpCardGiftService; |
|||
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/11/23 10:36 |
|||
*/ |
|||
@Service |
|||
public class EmpReserveOrderGoodsService extends MybatisBaseService<EmpReserveOrderGoodsMapper, EmpReserveOrderGoods> { |
|||
@Autowired |
|||
EmpCardGiftService empCardGiftService; |
|||
public ResultBean<EmpReserveOrderGoods> getReserveByCardSid(String carSid, String goodsSid) { |
|||
ResultBean rb = new ResultBean(); |
|||
EmpReserveOrderGoods goods = baseMapper.getReserveByCardSid(carSid, goodsSid); |
|||
return rb.success().setData(goods); |
|||
} |
|||
|
|||
public ResultBean submissionDetail(EmpReserveOrderDto dto) { |
|||
ResultBean rb = new ResultBean(); |
|||
EmpReserveOrderGoods goods = new EmpReserveOrderGoods(); |
|||
BeanUtil.copyProperties(dto, goods, "id", "sid"); |
|||
goods.setCardSid(dto.getSid()); |
|||
for (GoodsVo goods1 : dto.getGoodsVos()) { |
|||
if (goods1.getSelect() != 0) { |
|||
goods.setCardSid(dto.getSid()); |
|||
goods.setGoodsSid(goods1.getGoodsSid()); |
|||
goods.setGoodsNumber(goods1.getSelect()); |
|||
goods.setCreateTime(new DateTime()); |
|||
baseMapper.insert(goods); |
|||
} |
|||
} |
|||
EmpGiftAppletVo vo = empCardGiftService.getGifCardBySid(dto.getSid()).getData(); |
|||
int i = 0; |
|||
for (GoodsVo vo1 : vo.getGoodsVos()) { |
|||
EmpReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid()); |
|||
if (null != goods1) { |
|||
if (vo1.getNum() <= goods1.getGoodsNumber()) { |
|||
i++; |
|||
} |
|||
} |
|||
if (vo.getGoodsVos().size() == i) { |
|||
empCardGiftService.changState(dto.getSid(), "5"); |
|||
} else { |
|||
empCardGiftService.changState(dto.getSid(), "4"); |
|||
} |
|||
} |
|||
return rb.success().setData("预约成功"); |
|||
} |
|||
|
|||
public EmpReserveOrderGoods selByOrderSidAndGoodSid(String orderSid, String goodsSid) { |
|||
return baseMapper.selByOrderSidAndGoodSid(orderSid,goodsSid); |
|||
} |
|||
public List<EmpReserveOrderGoods> selByOrderSid(String orderSid) { |
|||
return baseMapper.selByOrderSid(orderSid); |
|||
} |
|||
public List<EmpReserveOrderGoods> selInOrderSid(List<String> orderSids) { |
|||
return baseMapper.selInOrderSid(orderSids); |
|||
} |
|||
public List<EmpReserveOrderGoods> selByOrderSids(String orderSid) { |
|||
return baseMapper.selByOrderSids(orderSid); |
|||
} |
|||
} |
Loading…
Reference in new issue