|  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.controller.BaseController; | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.QueryRequest; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.service.impl.CommonService; | 
|---|
|  |  |  | import cc.mrbird.febs.vip.entity.MallVipConfig; | 
|---|
|  |  |  | import cc.mrbird.febs.vip.service.IMallVipConfigService; | 
|---|
|  |  |  | import cc.mrbird.febs.vip.vo.VipSettingVo; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import lombok.RequiredArgsConstructor; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 会员配置接口类 | 
|---|
|  |  |  | 
|---|
|  |  |  | public class AdminMallVipConfigController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final IMallVipConfigService mallVipConfigService; | 
|---|
|  |  |  | private final CommonService commonService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping(value = "/list") | 
|---|
|  |  |  | public FebsResponse list(QueryRequest request) { | 
|---|
|  |  |  | return new FebsResponse().success().data(getDataTable(mallVipConfigService.vipConfigList(request))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/addOrEdit") | 
|---|
|  |  |  | public FebsResponse addOrEdit(@RequestBody MallVipConfig config) { | 
|---|
|  |  |  | if (config.getType() == 1) { | 
|---|
|  |  |  | config.setTimes(null); | 
|---|
|  |  |  | config.setAmount(null); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | config.setTargetId(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (config.getId() == null) { | 
|---|
|  |  |  | mallVipConfigService.addVipConfig(config); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | mallVipConfigService.editVipConfig(config); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new FebsResponse().success().message("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping(value = "/del/{id}") | 
|---|
|  |  |  | public FebsResponse del(@PathVariable("id") Long id) { | 
|---|
|  |  |  | mallVipConfigService.delVipConfig(id); | 
|---|
|  |  |  | return new FebsResponse().success().message("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/vipSetting") | 
|---|
|  |  |  | public FebsResponse vipSetting(@RequestBody VipSettingVo vipSettingVo) { | 
|---|
|  |  |  | commonService.addDataDic(DataDictionaryEnum.VIP_DATE.getType(), DataDictionaryEnum.VIP_DATE.getCode(), vipSettingVo.getVipDate(), null, false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | commonService.addDataDic(DataDictionaryEnum.UNALIVE_COUPON.getType(), DataDictionaryEnum.UNALIVE_COUPON.getCode(), vipSettingVo.getItems(), "失活会员优惠券配置", true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | commonService.addDataDic(DataDictionaryEnum.VIP_SCORE_RULE.getType(), DataDictionaryEnum.VIP_SCORE_RULE.getCode(), vipSettingVo.getRule(), "会员规则", false); | 
|---|
|  |  |  | return new FebsResponse().success(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping(value = "/allList") | 
|---|
|  |  |  | public FebsResponse allList() { | 
|---|
|  |  |  | return new FebsResponse().success().data(mallVipConfigService.list()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|