| | |
| | | |
| | | |
| | | import com.xiaopeng.api.dto.operation.XpActivityDto; |
| | | import com.xiaopeng.api.model.operation.XpActicityStrategy; |
| | | import com.xiaopeng.api.model.operation.XpActicityUser; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.api.model.operation.XpCoupon; |
| | | import com.xiaopeng.api.query.operation.XpActivityPageListQuery; |
| | |
| | | import com.xiaopeng.common.core.utils.bean.BeanUtils; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.service.IXpActicityService; |
| | | import com.xiaopeng.operation.service.IXpActicityStrategyService; |
| | | import com.xiaopeng.operation.service.IXpActicityUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | |
| | | @Api(tags = "活动管理") |
| | | @RestController |
| | | @RequestMapping("") |
| | | @Slf4j |
| | | @RequiredArgsConstructor(onConstructor_ = @Lazy) |
| | | public class XpActicityController { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/v1/api/appUserCoupon/update") |
| | | @ApiOperation(value = "修改活动",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> updateById(@RequestBody XpActivity xpActivity){ |
| | | service.updateById(xpActivity); |
| | | @PostMapping("/v1/api/appUserCoupon/{op}") |
| | | @ApiOperation(value = "修改活动状态,release,pause,resume,stop,del",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> updateById(@PathVariable String op,@RequestParam Long id){ |
| | | |
| | | XpActivity activity = service.getById(id); |
| | | switch (op){ |
| | | case "release": |
| | | activity.setStatus(2); |
| | | break; |
| | | case "pause": |
| | | activity.setStatus(4); |
| | | break; |
| | | case "resume": |
| | | activity.setStatus(1); |
| | | break; |
| | | case "stop": |
| | | activity.setStatus(3); |
| | | break; |
| | | case "del": |
| | | activity.setDeleted(true); |
| | | break; |
| | | default: |
| | | throw new UnsupportedOperationException("Unsupported" + op); |
| | | } |
| | | service.updateById(activity); |
| | | log.info("修改活动状态:{}",activity); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/v1/api/appUserCoupon/update") |
| | | @GetMapping("/v1/api/appUserCoupon/detail") |
| | | @ApiOperation(value = "活动详情",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> queryById(@RequestBody XpActivity xpActivity){ |
| | | public R<XpActivityDto> queryById(@RequestParam Long id){ |
| | | |
| | | return R.ok(service.getById(xpActivity)); |
| | | return R.ok(service.detail(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |