|
@@ -6,8 +6,10 @@ import com.qs.mp.admin.domain.param.*;
|
|
|
import com.qs.mp.admin.mapper.MarketingMapper;
|
|
|
import com.qs.mp.admin.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.qs.mp.common.enums.MarketingOnTypeEnum;
|
|
|
import com.qs.mp.common.enums.TicketPrizeTypeEnum;
|
|
|
import com.qs.mp.common.exception.ServiceException;
|
|
|
+import com.qs.mp.common.utils.DateUtils;
|
|
|
import com.qs.mp.common.utils.bean.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -15,7 +17,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -58,6 +62,10 @@ public class MarketingServiceImpl extends ServiceImpl<MarketingMapper, Marketing
|
|
|
createAwardsAndPrize(marketingCreateParam.getAwardsList(), marketing);
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateMarketing(MarketingUpdateParam marketingUpdateParam) {
|
|
@@ -66,6 +74,12 @@ public class MarketingServiceImpl extends ServiceImpl<MarketingMapper, Marketing
|
|
|
throw new ServiceException("营销活动不存在");
|
|
|
}
|
|
|
|
|
|
+ Date now = DateUtils.getNowDate();
|
|
|
+ if (MarketingOnTypeEnum.CLOSE.getValue().equals(marketing.getIsOn()) || now.after(marketing.getStartTime())) {
|
|
|
+ throw new ServiceException("活动当前状态不支持修改");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 更新营销活动
|
|
|
BeanUtils.copyProperties(marketingUpdateParam, marketing);
|
|
|
this.updateById(marketing);
|