|
|
package com.yohobuy.platform.operations.service.impl;
|
|
|
|
|
|
|
|
|
import com.yohobuy.platform.dal.promotion.IEventConfigMapper;
|
|
|
import com.yohobuy.platform.dal.promotion.model.EventConfig;
|
|
|
import com.yohobuy.platform.model.operations.GroupOrderCouponConfigRespBo;
|
|
|
import com.yohobuy.platform.model.operations.request.GroupOrderCouponReq;
|
|
|
import com.yohobuy.platform.operations.service.IGroupOrderCouponConfigService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@Service
|
|
|
public class GroupOrderCouponConfigServiceImpl implements IGroupOrderCouponConfigService {
|
|
|
|
|
|
@Autowired
|
|
|
IEventConfigMapper eventConfigMapper;
|
|
|
|
|
|
public static final String EVENT_CODE_GROUP_PAY_SUCCESS = "GROUP_PAY_SUCCESS";
|
|
|
|
|
|
public GroupOrderCouponConfigRespBo getGroupOrderConfig(){
|
|
|
|
|
|
EventConfig eventConfig = eventConfigMapper.selectOneByEventCode(EVENT_CODE_GROUP_PAY_SUCCESS);
|
|
|
|
|
|
if (eventConfig == null){
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
return GroupOrderCouponConfigRespBo.builder()
|
|
|
.coupons(eventConfig.getEventValue())
|
|
|
.popImgUrl(eventConfig.getMsgContent())
|
|
|
.isRepeated(eventConfig.getIsRepeat())
|
|
|
.onOff(eventConfig.getStatus())
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
|
|
|
public void saveGroupOrderCouponConfig(GroupOrderCouponReq groupOrderCouponReq){
|
|
|
|
|
|
// 后台就不考虑并发了
|
|
|
EventConfig eventConfig = eventConfigMapper.selectOneByEventCode(EVENT_CODE_GROUP_PAY_SUCCESS);
|
|
|
if (eventConfig == null){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
eventConfig.setEventValue(groupOrderCouponReq.getCoupons());
|
|
|
eventConfig.setMsgContent(groupOrderCouponReq.getPopImgUrl());
|
|
|
eventConfig.setIsRepeat(groupOrderCouponReq.getIsRepeated());
|
|
|
eventConfig.setStatus(groupOrderCouponReq.getOnOff());
|
|
|
|
|
|
eventConfigMapper.updateByPrimaryKeySelective(eventConfig);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|