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

View File

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

View File

@ -497,7 +497,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
ArrayList<ActiveDiscountPayVO> activeDiscountVOList = new ArrayList<>(); 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) { 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) { for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOLists) {
// //
@ -542,7 +542,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
//activeDiscountVOList.addAll(activeDiscountVOLists); //activeDiscountVOList.addAll(activeDiscountVOLists);
ArrayList<ActiveDiscountPayVO> activeFuletVOList = new ArrayList<>(); 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) { 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) { for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOLists) {
// //
@ -857,7 +857,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
} else { } else {
String gasolineRule = ljUserGrade.getGasolineRule(); String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class); 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"); BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1");
if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) { if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) {
//升数 //升数

View File

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

View File

@ -45,6 +45,7 @@ import javax.annotation.Resource;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.ArrayList; import java.util.ArrayList;
@ -267,7 +268,29 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
*/ */
@Override @Override
public boolean addCardFavorableRecord(CardFavorableRecord cardFavorableRecord) throws Exception { public boolean addCardFavorableRecord(CardFavorableRecord cardFavorableRecord) throws Exception {
Integer mtUserId = cardFavorableRecord.getMtUserId();
CardFavorable cardFavorable = cardFavorableService.getById(cardFavorableRecord.getCardFavorableId()); 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)){ if (ObjectUtils.isNotEmpty(cardFavorable)){
//优惠券的数量 //优惠券的数量
Integer count = cardFavorable.getCount(); Integer count = cardFavorable.getCount();

View File

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