This commit is contained in:
齐天大圣 2024-04-24 13:29:48 +08:00
parent 6d244e8aa8
commit 9e46716280
7 changed files with 68 additions and 15 deletions

View File

@ -98,6 +98,9 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
activeDiscount.setGasolineUserLevel(arrayToString(activeDiscountDTO.getGasolineUserLevel()));
//天然气会员等级
activeDiscount.setNaturalUserLevel(arrayToString(activeDiscountDTO.getNaturalUserLevel()));
if (activeDiscountDTO.getParticipationAcount().equals("0")){
activeDiscount.setLimitAcount(1000000000);
}
save = save(activeDiscount);
}
activeApplet.setActiveId(activeDiscount.getId());
@ -240,6 +243,9 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
//更新折扣营销
ActiveDiscount activeDiscount = new ActiveDiscount();
BeanUtils.copyProperties(activeDiscountDTO,activeDiscount);
if (activeDiscountDTO.getParticipationAcount().equals("0")){
activeDiscount.setLimitAcount(1000000000);
}
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
if (ObjectUtil.isNotEmpty(accountInfoById)) activeDiscount.setCreateBy(accountInfoById.getRealName());

View File

@ -39,4 +39,5 @@ public class ActiveDiscountPayVO implements Serializable {
private String weekDay;
//每月的会员日
private String monthDay;
private Integer sidsss;
}

View File

@ -497,7 +497,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
ArrayList<ActiveDiscountPayVO> activeDiscountVOList = new ArrayList<>();
//折扣有限制
List<ActiveDiscountPayVO> activeDiscountVOListss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
List<ActiveDiscountPayVO> activeDiscountVOListss = oilOrderMapper.selectActiveDiscount(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOListss) {
//
@ -518,7 +518,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}
}
//折扣无限制
List<ActiveDiscountPayVO> activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
List<ActiveDiscountPayVO> activeDiscountVOLists = oilOrderMapper.selectActiveDiscounts(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOLists) {
//
@ -542,7 +542,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
//activeDiscountVOList.addAll(activeDiscountVOLists);
ArrayList<ActiveDiscountPayVO> activeFuletVOList = new ArrayList<>();
//满减有限制
List<ActiveDiscountPayVO> activeFuletVOListss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
List<ActiveDiscountPayVO> activeFuletVOListss = oilOrderMapper.selectActiveFule(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOListss) {
//
@ -564,7 +564,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}
}
//满减无限制
List<ActiveDiscountPayVO> activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel());
List<ActiveDiscountPayVO> activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId, paymentActiveDTO.getAmount(), paymentActiveDTO.getOilId(), paymentActiveDTO.getMtUserLevel(),paymentActiveDTO.getUserId());
//会员日筛选
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOLists) {
//
@ -857,7 +857,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
} else {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
ArrayList<JSONObject> jsonObjects1 = new ArrayList<>();
for (JSONObject jsonObject : jsonObjects) {
if (paymentActiveDTO.getAmount().compareTo(jsonObject.getBigDecimal("gasolineRule1")) >= 0){
jsonObjects1.add(jsonObject);
}
}
JSONObject jsonObject = jsonObjects1.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1");
if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) {
//升数

View File

@ -82,6 +82,7 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
}
//新增折扣营销活动模板
ActiveFullminus activeFullminus = new ActiveFullminus();
if (ObjectUtils.isNotEmpty(activeFullminusDTO)){
BeanUtils.copyProperties(activeFullminusDTO,activeFullminus);
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
@ -94,6 +95,9 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
activeFullminus.setGasolineUserLevel(arrayToString(activeFullminusDTO.getGasolineUserLevel()));
//天然气会员等级
activeFullminus.setNaturalUserLevel(arrayToString(activeFullminusDTO.getNaturalUserLevel()));
if (activeFullminusDTO.getParticipationAcount().equals("0")){
activeFullminus.setLimitAcount(1000000000);
}
save = save(activeFullminus);
}
@ -330,10 +334,15 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
if (ObjectUtils.isNotEmpty(activeFullminusDTO.getIsonline())){
activeApplet.setIsonline(activeFullminusDTO.getIsonline());
}
activeAppletService.updateById(activeApplet);
//更新折扣营销
ActiveFullminus activeFullminus = new ActiveFullminus();
BeanUtils.copyProperties(activeFullminusDTO,activeFullminus);
if (activeFullminusDTO.getParticipationAcount().equals("0")){
activeFullminus.setLimitAcount(1000000000);
}
TAccount accountInfoById = accountService.getAccountInfoById(TokenUtil.getNowAccountInfo().getId());
if (ObjectUtil.isNotEmpty(accountInfoById)) activeFullminus.setCreateBy(accountInfoById.getRealName());
//柴油会员等级

View File

@ -45,6 +45,7 @@ import javax.annotation.Resource;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
@ -267,7 +268,29 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
*/
@Override
public boolean addCardFavorableRecord(CardFavorableRecord cardFavorableRecord) throws Exception {
Integer mtUserId = cardFavorableRecord.getMtUserId();
CardFavorable cardFavorable = cardFavorableService.getById(cardFavorableRecord.getCardFavorableId());
if (cardFavorable.getClaimRule().equals("0")){
LambdaQueryWrapper<CardFavorableRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFavorableRecord::getMtUserId,mtUserId);
queryWrapper.eq(CardFavorableRecord::getCardFavorableId,cardFavorable.getId());
List<CardFavorableRecord> cardFavorableRecordList = cardFavorableRecordMapper.selectList(queryWrapper);
if (ObjectUtils.isNotEmpty(cardFavorableRecordList)){
return true;
}
}else {
LambdaQueryWrapper<CardFavorableRecord> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(CardFavorableRecord::getMtUserId,mtUserId);
queryWrapper1.eq(CardFavorableRecord::getCardFavorableId,cardFavorable.getId());
queryWrapper1.ge(CardFavorableRecord::getCreateTime, LocalDate.now().atStartOfDay())
.le(CardFavorableRecord::getCreateTime, LocalDate.now().atTime(LocalTime.MAX));
List<CardFavorableRecord> cardFavorableRecordList = cardFavorableRecordMapper.selectList(queryWrapper1);
if (ObjectUtils.isNotEmpty(cardFavorableRecordList)){
return true;
}
}
if (ObjectUtils.isNotEmpty(cardFavorable)){
//优惠券的数量
Integer count = cardFavorable.getCount();

View File

@ -92,8 +92,8 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
* @param amount
* @return
*/
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
List<ActiveDiscountPayVO> selectActiveDiscounts(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId);
List<ActiveDiscountPayVO> selectActiveDiscounts(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId);
/**
* 满减
@ -101,8 +101,8 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
* @param amount
* @return
*/
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
List<ActiveDiscountPayVO> selectActiveFules(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId);
List<ActiveDiscountPayVO> selectActiveFules(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId,@Param("userId") Integer userId);
/**
* 消费有礼

View File

@ -367,7 +367,8 @@
ad.month_day monthDay,
ad.member_day_type memberDayType,
max((case ad.store_id when ${storeId} then adc.amount * (1-(adc.discount * 0.1))
end)) as discount
end)) as discount,
count( adr.id ) sidsss
FROM
active_discount ad
LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id
@ -381,7 +382,7 @@
AND concat(',',ad.adapt_oil,',') like concat('%',#{oilId},'%')
AND concat(',',ad.diesel_user_level,',') like concat('%',#{levelId},'%')
GROUP BY ad.id
HAVING IFNULL(sum(adr.id),0) <![CDATA[ < ]]> limitAcount
HAVING sidsss <![CDATA[ < ]]> limitAcount
</select>
<select id="selectActiveDiscounts" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO">
SELECT
@ -395,7 +396,8 @@
ad.month_day monthDay,
ad.member_day_type memberDayType,
max((case ad.store_id when ${storeId} then adc.amount * (1-(adc.discount * 0.1))
end)) as discount
end)) as discount,
count( adr.id ) sidsss
FROM
active_discount ad
LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id
@ -409,6 +411,7 @@
AND concat(',',ad.adapt_oil,',') like concat('%',#{oilId},'%')
AND concat(',',ad.diesel_user_level,',') like concat('%',#{levelId},'%')
GROUP BY ad.id
HAVING sidsss <![CDATA[ < ]]> limitAcount
</select>
<select id="selectActiveFule" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO">
@ -422,7 +425,8 @@
af.week_day weekDay,
af.month_day monthDay,
af.member_day_type memberDayType,
max(adc.deduction_amount) discount
max(adc.deduction_amount) discount,
count( afr.id ) sidsss
FROM
active_fullminus af
LEFT JOIN active_discount_child adc ON af.id = adc.active_fullminus_id
@ -435,8 +439,9 @@
AND af.STATUS = 0
AND concat(',',af.adapt_oil,',') like concat('%',#{oilId},'%')
AND concat(',',af.diesel_user_level,',') like concat('%',#{levelId},'%')
AND afr.user_id = #{userId}
GROUP BY af.id
HAVING IFNULL(sum(afr.id),0) <![CDATA[ < ]]> limitAcount
HAVING sidsss <![CDATA[ < ]]> limitAcount
</select>
<select id="selectActiveFules" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO">
SELECT
@ -449,7 +454,8 @@
af.week_day weekDay,
af.month_day monthDay,
af.member_day_type memberDayType,
max(adc.deduction_amount) discount
max(adc.deduction_amount) discount,
count( afr.id ) sidsss
FROM
active_fullminus af
LEFT JOIN active_discount_child adc ON af.id = adc.active_fullminus_id
@ -462,7 +468,9 @@
AND af.STATUS = 0
AND concat(',',af.adapt_oil,',') like concat('%',#{oilId},'%')
AND concat(',',af.diesel_user_level,',') like concat('%',#{levelId},'%')
AND afr.user_id = #{userId}
GROUP BY af.id
HAVING sidsss <![CDATA[ < ]]> limitAcount
</select>
<select id="selectActiveConsumption" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO">