This commit is contained in:
齐天大圣 2024-03-14 15:46:09 +08:00
parent ecc6e4cddf
commit daf9f4ff97
5 changed files with 33 additions and 0 deletions

View File

@ -482,6 +482,9 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
Integer storeId = paymentActiveDTO.getStoreId();
double finalAmount = 0.00;
Integer userId = TokenUtil.getNowAccountInfo().getId();
if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())){
userId = paymentActiveDTO.getUserId();
}
//获取今日是周几
DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek();
String displayName = dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault());
@ -630,6 +633,11 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) {
cardFavorableRecordVOS.add(cardFavorableRecordVO);
}
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("2")) {
// paymentActiveDTO.getMtUserLevel()
cardFavorableRecordVOS.add(cardFavorableRecordVO);
}
}
}
//折扣+优惠券

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@ -15,6 +16,7 @@ import java.util.Date;
* @since 2023-11-07 11:02:06
*/
@SuppressWarnings("serial")
@Data
public class CardFavorableDTO extends Model<CardFavorableDTO> {
//主键id
@TableId(type = IdType.AUTO)
@ -25,6 +27,7 @@ public class CardFavorableDTO extends Model<CardFavorableDTO> {
private Integer storeId;
//是否在线 0在线 1 下线
private String isonline;
private String[] membershipLevel;
//优惠券名称
private String name;
//卡券类型 0油品券 1商品券 2通用券

View File

@ -28,6 +28,7 @@ public class CardFavorable extends Model<CardFavorable> {
//是否在线 0在线 1 下线
private String isonline;
private String cardDetail;
private String membershipLevel;
//优惠券名称
private String name;
//卡券类型 0油品券 1商品券 2通用券

View File

@ -76,6 +76,13 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getSpecialDiscount()+"");
}
cardFavorable.setInstruction("消费可用!");
String userLevel = "";
if (ObjectUtils.isNotEmpty(cardFavorableDTO.getMembershipLevel())){
for (String s : cardFavorableDTO.getMembershipLevel()) {
userLevel +=s+",";
}
}
cardFavorable.setMembershipLevel(userLevel);
return save(cardFavorable);
}
@ -186,6 +193,11 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
.map(Integer::valueOf)
.toArray(Integer[]::new));
}
if (StringUtils.isNotEmpty(favorable.getMembershipLevel())){
cardFavorableVO.setMembershipLevel(Arrays.stream(favorable.getMembershipLevel().split(","))
.map(String::valueOf)
.toArray(String[]::new));
}
return cardFavorableVO;
}
@ -198,6 +210,14 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
public Boolean updateOneById(CardFavorableDTO cardFavorableDTO) {
CardFavorable cardFavorable = new CardFavorable();
BeanUtils.copyProperties(cardFavorableDTO,cardFavorable);
String userLevel = "";
if (ObjectUtils.isNotEmpty(cardFavorableDTO.getMembershipLevel())){
for (String s : cardFavorableDTO.getMembershipLevel()) {
userLevel +=s+",";
}
}
cardFavorable.setMembershipLevel(userLevel);
//转换油品类型格式
String oil = "";
if (ObjectUtils.isNotEmpty(cardFavorableDTO.getOilType())){

View File

@ -27,6 +27,7 @@ public class CardFavorableVO extends Model<CardFavorableVO> {
private Integer storeId;
//是否在线 0在线 1 下线
private String isonline;
private String[] membershipLevel;
//优惠券名称
private String name;
//卡券类型 0油品券 1商品券 2通用券