|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.ActivityPlanDao;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.ActivityRewardDto;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.ActivityPlan;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -44,7 +45,15 @@ public class ActivityRewardServiceImpl extends ServiceImpl<ActivityRewardDao, Ac
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean submit(ActivityReward activityReward) {
|
|
|
+ public Boolean submit(ActivityRewardDto activityReward) {
|
|
|
+ //更改活动状态
|
|
|
+ if(activityReward.getDraftFlag() == 0){
|
|
|
+ ActivityPlan activityPlan = new ActivityPlan();
|
|
|
+ activityPlan.setId(activityReward.getActivityId());
|
|
|
+ activityPlan.setDraftFlag(activityReward.getDraftFlag());
|
|
|
+ activityPlanDao.updateById(activityPlan);
|
|
|
+ }
|
|
|
+
|
|
|
if(null == activityReward.getId()){
|
|
|
return createActivityReward(activityReward);
|
|
|
}else{
|
|
@@ -57,21 +66,12 @@ public class ActivityRewardServiceImpl extends ServiceImpl<ActivityRewardDao, Ac
|
|
|
.eq(ActivityReward::getActivityId, activityReward.getActivityId())
|
|
|
);
|
|
|
baseMapper.insert(activityReward);
|
|
|
- //更改活动状态
|
|
|
- ActivityPlan activityPlan = new ActivityPlan();
|
|
|
- activityPlan.setId(activityReward.getActivityId());
|
|
|
- activityPlan.setDraftFlag(0);
|
|
|
- activityPlanDao.updateById(activityPlan);
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
private Boolean updateActivityReward(ActivityReward activityReward) {
|
|
|
baseMapper.updateById(activityReward);
|
|
|
- //更改活动状态
|
|
|
- ActivityPlan activityPlan = new ActivityPlan();
|
|
|
- activityPlan.setId(activityReward.getActivityId());
|
|
|
- activityPlan.setDraftFlag(0);
|
|
|
- activityPlanDao.updateById(activityPlan);
|
|
|
return true;
|
|
|
}
|
|
|
|