This commit is contained in:
齐天大圣 2024-03-06 14:27:42 +08:00
parent ae1f1090ed
commit 12c27fa77c
7 changed files with 97 additions and 21 deletions

View File

@ -23,6 +23,7 @@ public class ActiveConsumptionChild {
* 活动奖品 0赠送积分1赠送优惠券 2. 赠送兑换券 3赠送成长值 4. 赠送实物
*/
private String activeGift;
private String instruction;
/**
* 商品id
*/

View File

@ -14,14 +14,24 @@ import com.fuint.business.marketingActivity.activeConsumption.service.ActiveCons
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO;
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVO;
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionVOS;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -49,18 +59,35 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
@Resource
private StoreService storeService;
@Resource
private ActiveConsumptionChildService activeConsumptionChildService;
@Autowired
private LJUserGradeService userGradeService;
@Resource
private OilNameService oilNameService;
@Resource
private ActiveConsumptionMapper activeConsumptionMapper;
@Resource
private CardFavorableRecordService cardFavorableRecordService;
@Resource
private CardExchangeRecordService cardExchangeRecordService;
@Resource
private CardFavorableMapper cardFavorableMapper;
@Resource
private CardExchangeMapper cardExchangeMapper;
@Resource
private ILJStaffService ljStaffService;
/**
* 新增数据
* @param activeConsumptionDTO
@ -187,6 +214,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
*/
@Override
public ActiveConsumptionVO getOneById(Serializable id) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
ActiveConsumptionVO activeConsumptionVO = new ActiveConsumptionVO();
if (ObjectUtils.isNotEmpty(id)){
//获取消费有礼活动信息
@ -199,6 +227,39 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
List<ActiveConsumptionChild> activeConsumptionChildList = activeConsumptionChildService.list(queryWrapper);
BeanUtils.copyProperties(consumption,activeConsumptionVO);
if (CollectionUtils.isNotEmpty(activeConsumptionChildList)){
//更新子表卡券信息
for (ActiveConsumptionChild activeConsumptionChild : activeConsumptionChildList) {
//优惠券
if (activeConsumptionChild.getActiveGift().equals("1")){
CardFavorable cardFavorable = cardFavorableMapper.selectById(activeConsumptionChild.getVouchersId());
if (ObjectUtils.isNotEmpty(cardFavorable)){
activeConsumptionChild.setGiftCardName(cardFavorable.getName());
activeConsumptionChild.setGiftCardDetail(cardFavorable.getCardDetail());
if (ObjectUtils.isNotEmpty(cardFavorable.getValidityZero())){
activeConsumptionChild.setValidityZero(cardFavorable.getValidityZero());
}
if (ObjectUtils.isNotEmpty(cardFavorable.getValidityOne())){
activeConsumptionChild.setValidityOne(cardFavorable.getValidityOne());
}
if (ObjectUtils.isNotEmpty(cardFavorable.getValidityTwo())){
activeConsumptionChild.setValidityTwo(cardFavorable.getValidityTwo());
}
activeConsumptionChild.setInstruction(cardFavorable.getInstruction());
activeConsumptionChildService.updateById(activeConsumptionChild);
}
}
if (activeConsumptionChild.getActiveGift().equals("2")){
//兑换券
CardExchange cardExchange = cardExchangeMapper.selectById(activeConsumptionChild.getVouchersId());
if (ObjectUtils.isNotEmpty(cardExchange)) {
activeConsumptionChild.setGiftCardName(cardExchange.getName());
activeConsumptionChild.setGiftCardDetail(cardExchange.getCardDetail());
activeConsumptionChild.setGiftCardTime(cardExchange.getValidity());
activeConsumptionChildService.updateById(activeConsumptionChild);
activeConsumptionChild.setInstruction(cardExchange.getUseInstructions());
}
}
}
//封装VO返回
activeConsumptionVO.setParticipationConditionMoney(consumption.getParticipationConditionMoney().toString());
activeConsumptionVO.setDieselUserLevel(consumption.getDieselUserLevel().split(","));

View File

@ -38,8 +38,8 @@ public class CardExchangeController extends BaseController {
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardExchange cardExchange) {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardExchange cardExchange) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardExchangeService.select(page, cardExchange));
}
@ -77,6 +77,11 @@ public class CardExchangeController extends BaseController {
if (cardExchange.getIsonline().equals("1")){
cardExchange.setStatus("1");
}
if (cardExchange.getType().equals("0")){
cardExchange.setCardDetail("可兑换-"+cardExchange.getGiftName());
}else {
cardExchange.setCardDetail("可兑换-"+"洗车券");
}
return getSuccessResult(this.cardExchangeService.updateById(cardExchange));
}

View File

@ -59,5 +59,5 @@ public class CardExchange extends Model<CardExchange> {
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date updateTime;
}
}

View File

@ -55,8 +55,8 @@ public class CardFavorableController extends BaseController {
*/
@GetMapping("appletList")
public ResponseObject selectAllApplet(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorable cardFavorable) {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorable cardFavorable) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableService.selectAllApplet(page,cardFavorable));
}
@ -111,13 +111,13 @@ public class CardFavorableController extends BaseController {
* @param pageSize
* @param cardFavorableDTO
* @return
@GetMapping("OwnApplet")
public ResponseObject selectAllOwnStore(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorableDTO cardFavorableDTO) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableService.selectAllOwnStore(page,cardFavorableDTO));
}*/
@GetMapping("OwnApplet")
public ResponseObject selectAllOwnStore(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorableDTO cardFavorableDTO) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableService.selectAllOwnStore(page,cardFavorableDTO));
}*/
/**
@ -129,8 +129,8 @@ public class CardFavorableController extends BaseController {
*/
@GetMapping("applet")
public ResponseObject selectAllByCondition(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorableDTOS cardFavorableDTOS) {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorableDTOS cardFavorableDTOS) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableService.selectAllByCondition(page,cardFavorableDTOS));
}
@ -144,8 +144,8 @@ public class CardFavorableController extends BaseController {
*/
@GetMapping("PC")
public ResponseObject selectAllByConditionPC(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorableDTOS cardFavorableDTOS) {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFavorableDTOS cardFavorableDTOS) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFavorableService.selectAllByConditionPC(page,cardFavorableDTOS));
}

View File

@ -68,6 +68,8 @@ public class CardFavorable extends Model<CardFavorable> {
private String availablePeriod;
//可用周期类型 day每天可用 week周可用 month月可用
private String checkDateType;
//使用说明
private String instruction;
//可用日期
private String checkTime;
//排除日期

View File

@ -71,10 +71,11 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
}
cardFavorable.setOilType(oil);
if (cardFavorableDTO.getType().equals("0")){
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getDiscountAmount());
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getDiscountAmount()+"");
}else {
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getSpecialDiscount()+"");
}
cardFavorable.setInstruction("请到到店使用!");
return save(cardFavorable);
}
@ -208,6 +209,12 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
if (cardFavorableDTO.getIsonline().equals("1")){
cardFavorable.setStatus("1");
}
if (cardFavorableDTO.getType().equals("0")){
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getDiscountAmount()+"");
}else {
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getSpecialDiscount()+"");
}
cardFavorable.setInstruction("请到到店使用!");
return updateById(cardFavorable);
}
@ -229,10 +236,10 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() < System.currentTimeMillis()).collect(Collectors.toList());
if (ObjectUtils.isNotEmpty(collect)){
for (CouponVO couponVO : collect) {
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setId(couponVO.getCardRecordId());
cardFavorableRecord.setStatus("2");
cardFavorableRecordMapper.updateById(cardFavorableRecord);
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setId(couponVO.getCardRecordId());
cardFavorableRecord.setStatus("2");
cardFavorableRecordMapper.updateById(cardFavorableRecord);
}
}
//couponVOS.setRecords(collect);