| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.dsh.course.entity.Img; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | private BannerClient bannerClient; |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | /** |
| | | * 跳转到广告页面 |
| | | */ |
| | |
| | | model.addAttribute("roleType",roleType); |
| | | return PREFIX + "advertisement_add.html"; |
| | | } |
| | | /** |
| | | * 配置基础页面 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateConfig") |
| | | public Object updateConfig(String p1,String p2 ,String p7) { |
| | | if (!p1.equals("")){ |
| | | storeService.updateBasicConfig(1,p1); |
| | | } |
| | | if (!p2.equals("")){ |
| | | storeService.updateBasicConfig(2,p2); |
| | | } |
| | | if (!p7.equals("")){ |
| | | storeService.updateBasicConfig(7,p7); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 配置福利页面 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateBenefits") |
| | | public Object updateBenefits(String p3,String p4 ,String p5,String p6) { |
| | | if (!p3.equals("")){ |
| | | storeService.updateBenefits(3,p3); |
| | | } |
| | | if (!p4.equals("")){ |
| | | storeService.updateBenefits(4,p4); |
| | | } |
| | | if (!p5.equals("")){ |
| | | storeService.updateBenefits(5,p5); |
| | | } |
| | | if (!p6.equals("")){ |
| | | storeService.updateBenefits(6,p6); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | /** |
| | | * 跳转基础页面配置 |
| | | */ |
| | | @RequestMapping("/config") |
| | | public String config(Model model) { |
| | | List<TImgConfig> result =storeService.getConfig(); |
| | | for (TImgConfig tImgConfig : result) { |
| | | switch (tImgConfig.getPosition()){ |
| | | case 1: |
| | | model.addAttribute("c1",tImgConfig.getContent()); |
| | | break; |
| | | case 2: |
| | | model.addAttribute("c2",tImgConfig.getContent()); |
| | | break; |
| | | case 7: |
| | | model.addAttribute("c7",tImgConfig.getContent()); |
| | | break; |
| | | } |
| | | } |
| | | return PREFIX + "advertisement_config.html"; |
| | | } |
| | | /** |
| | | * 跳转福利页面配置 |
| | | */ |
| | | @RequestMapping("/benefits") |
| | | public String benefits(Model model) { |
| | | List<TImgConfig> result =storeService.getConfig(); |
| | | for (TImgConfig tImgConfig : result) { |
| | | switch (tImgConfig.getPosition()){ |
| | | case 3: |
| | | model.addAttribute("c3",tImgConfig.getContent()); |
| | | break; |
| | | case 4: |
| | | model.addAttribute("c4",tImgConfig.getContent()); |
| | | break; |
| | | case 5: |
| | | model.addAttribute("c5",tImgConfig.getContent()); |
| | | break; |
| | | case 6: |
| | | model.addAttribute("c6",tImgConfig.getContent()); |
| | | break; |
| | | } |
| | | } |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("roleType",roleType); |
| | | return PREFIX + "advertisement_benefits.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到广告编辑页面 |
| | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/addAdvertisement") |
| | | public ResultUtil addAdvertisement(@RequestBody Banner banner) { |
| | | if (banner.getType().equals("请选择")){ |
| | | banner.setType(null); |
| | | } |
| | | if (banner.getPage().equals("请选择")){ |
| | | banner.setPage(null); |
| | | } |
| | | banner.setInsertTime(new Date()); |
| | | bannerClient.addAdvertisement(banner); |
| | | return ResultUtil.success("添加成功"); |
| | |
| | | if (banner.getImg().equals("")||banner==null){ |
| | | banner.setImg(byId.getImg()); |
| | | } |
| | | |
| | | if (banner.getType().equals("请选择")){ |
| | | banner.setType(null); |
| | | } |
| | | if (banner.getPage().equals("请选择")){ |
| | | banner.setPage(null); |
| | | } |
| | | |
| | | |
| | | bannerClient.updateAdvertisement(banner); |
| | | return ResultUtil.success("添加成功"); |
| | | } |