| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.feignClient.account.AppUserClient; |
| | | import com.dsh.course.feignClient.account.model.TAppUser; |
| | | import com.dsh.course.feignClient.activity.IntroduceClient; |
| | | import com.dsh.course.feignClient.activity.model.IntroduceRewards; |
| | | import com.dsh.course.feignClient.other.model.Banner; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | 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 java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 介绍有礼 控制器 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/tIntroductionCourtesy") |
| | | @RequestMapping("/introduce") |
| | | public class TIntroductionCourtesyController { |
| | | |
| | | private String PREFIX = "/system/tIntroductionCourtesy/"; |
| | | private String PREFIX = "/system/introduce/"; |
| | | |
| | | @Autowired |
| | | private ICityService cityService; |
| | | @Autowired |
| | | private IntroduceClient introduceClient; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | /** |
| | | * 优惠券审核列表页 |
| | | * 上/下架 1为上架 2为下架 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/changeState") |
| | | @ResponseBody |
| | | public Object changeState(@RequestBody IntroduceChangeStateDTO dto){ |
| | | introduceClient.changeState(dto); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 介绍有礼列表页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | return PREFIX + "tIntroductionCourtesy.html"; |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | return PREFIX + "introduce.html"; |
| | | } |
| | | /** |
| | | * 介绍有礼-参与用户列表页 |
| | | */ |
| | | @RequestMapping("/user/{id}") |
| | | public String index(Model model,@PathVariable("id")Integer id) { |
| | | // 介绍有礼id |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "introduce_user.html"; |
| | | } |
| | | |
| | | /** |
| | | * 介绍有礼添加页 |
| | | */ |
| | | @RequestMapping("/add") |
| | | public String add(Model model) { |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | |
| | | model.addAttribute("list",list); |
| | | return PREFIX + "introduce_add.html"; |
| | | } |
| | | /** |
| | | * 介绍有礼编辑页 |
| | | */ |
| | | @RequestMapping("/update/{id}") |
| | | public String update(Model model, @PathVariable("id")Integer id) { |
| | | IntroduceRewards data = introduceClient.getInfoById(id); |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | TCity province1 = cityService.getOne(new QueryWrapper<TCity>().eq("name", data.getProvince())); |
| | | List<TCity> city = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, province1.getId())); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String format1 = format.format(data.getStartTime()); |
| | | String format2 = format.format(data.getEndTime()); |
| | | model.addAttribute("data",data); |
| | | model.addAttribute("startTime",format1); |
| | | model.addAttribute("endTime",format2); |
| | | model.addAttribute("list",list); |
| | | model.addAttribute("city",city); |
| | | return PREFIX + "introduce_edit.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取介绍有礼记录列表 |
| | | */ |
| | | @RequestMapping(value = "/listAll") |
| | | @ResponseBody |
| | | public List<IntroduceVO> listAll(IntroduceQuery query) { |
| | | List<IntroduceVO> list = introduceClient.listAll(query); |
| | | for (IntroduceVO introduceVO : list) { |
| | | Integer activityPeoples = appUserClient.getActivityPeoples(introduceVO.getId()); |
| | | introduceVO.setNumber(activityPeoples); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取介绍有礼--参与用户记录列表 |
| | | */ |
| | | @RequestMapping(value = "/listAllUser") |
| | | @ResponseBody |
| | | public List<IntroduceUser> listAll(IntroduceUserQuery query) { |
| | | return appUserClient.queryIntroduceAll(query); |
| | | } |
| | | /** |
| | | * 新增介绍有礼记录表 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/addIntroduce") |
| | | @ResponseBody |
| | | public Object addAppUser(@RequestBody IntroduceRewards introduceRewards){ |
| | | |
| | | return introduceClient.addIntroduce(introduceRewards); |
| | | } |
| | | } |