| | |
| | | import com.dsh.activity.feignclient.other.model.Store; |
| | | import com.dsh.activity.model.*; |
| | | import com.dsh.activity.service.IntroduceRewardsService; |
| | | import com.dsh.activity.service.IntroduceUserService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.Format; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | |
| | | @Autowired |
| | | private IntroduceRewardsService idrService; |
| | | @Autowired |
| | | private IntroduceUserService introduceUserService; |
| | | |
| | | private final SimpleDateFormat mat = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | | /** |
| | | * 获取所有体测预约记录 |
| | | * 获取介绍有礼-参与用户记录表 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/introduceUser/listAllUser") |
| | | public List<IntroduceUser> listAllUser(@RequestBody IntroduceUserQuery query){ |
| | | return introduceUserService.listAll(query); |
| | | } |
| | | /** |
| | | * 通过id获取介绍有礼 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/introduce/getInfoById") |
| | | public IntroduceRewards getInfoById(@RequestBody Integer id){ |
| | | return idrService.getById(id); |
| | | |
| | | } |
| | | /** |
| | | * 获取介绍有礼记录表 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/introduce/listAll") |
| | | public List<IntroduceVO> listAll(@RequestBody IntroduceQuery query){ |
| | | |
| | | return null; |
| | | Date date = new Date(); |
| | | List<IntroduceVO> introduceVOS = idrService.listAll(query); |
| | | for (IntroduceVO introduceVO : introduceVOS) { |
| | | Date startTime = introduceVO.getStartTime(); |
| | | Date endTime = introduceVO.getEndTime(); |
| | | if (date.after(startTime) && date.before(endTime)) { |
| | | introduceVO.setActivityState(1); |
| | | } else if (date.before(startTime)) { |
| | | introduceVO.setActivityState(2); |
| | | } else if (date.after(endTime)) { |
| | | introduceVO.setActivityState(3); |
| | | } |
| | | } |
| | | return introduceVOS; |
| | | } |
| | | /** |
| | | * 增加/修改介绍有礼记录 |
| | |
| | | */ |
| | | @RequestMapping("/base/introduce/addIntroduce") |
| | | public Object addIntroduce(@RequestBody IntroduceRewards introduceRewards){ |
| | | |
| | | if (introduceRewards.getId()!=null){ |
| | | return idrService.updateById(introduceRewards); |
| | | }else { |
| | | introduceRewards.setInsertTime(new Date()); |
| | | return idrService.save(introduceRewards); |
| | | } |
| | | } |