| | |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.isNotEmpty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | import com.panzhihua.service_community.entity.McsGame; |
| | | import com.panzhihua.service_community.entity.McsMerchant; |
| | | import com.panzhihua.service_community.service.McsGameService; |
| | | import com.panzhihua.service_community.util.NearbyUtil; |
| | | import com.panzhihua.service_community.util.QRCodeUtil; |
| | | import com.spatial4j.core.shape.Rectangle; |
| | | |
| | | /** |
| | | * (McsGame)表服务实现类 |
| | |
| | | //体验游戏 |
| | | Integer awardType = mcsGame.getAwardType(); |
| | | if (awardType.equals(1)) { |
| | | mcsCoupon.setAward("免费产品"); |
| | | mcsCoupon.setAward("免费领"); |
| | | } else if (awardType.equals(2)) { |
| | | mcsCoupon.setAward("产品试用"); |
| | | } else if (awardType.equals(3)) { |
| | | mcsCoupon.setAward("消费赠礼"); |
| | | } else { |
| | | mcsCoupon.setAward("免费服务"); |
| | | mcsCoupon.setAward("优惠券"); |
| | | } |
| | | } |
| | | int num = mcsCouponDAO.insert(mcsCoupon); |
| | |
| | | Page page = new Page<>(); |
| | | page.setSize(pageMcsGameDTO.getPageSize()); |
| | | page.setCurrent(pageMcsGameDTO.getPageNum()); |
| | | String lat = pageMcsGameDTO.getLat(); |
| | | String lon = pageMcsGameDTO.getLon(); |
| | | Integer distance = pageMcsGameDTO.getDistance(); |
| | | IPage<McsGameVO> mcsGames; |
| | | if (isNotEmpty(lat) && isNotEmpty(lon) && nonNull(distance)) { |
| | | Rectangle rectangle = new NearbyUtil().getRectangle(pageMcsGameDTO.getDistance(), |
| | | Double.parseDouble(pageMcsGameDTO.getLon()), Double.parseDouble(pageMcsGameDTO.getLat())); |
| | | mcsGames = this.baseMapper.pageH5McsGame(page, rectangle.getMinX(), rectangle.getMaxX(), |
| | | rectangle.getMinY(), rectangle.getMaxY(), pageMcsGameDTO); |
| | | } else { |
| | | mcsGames = this.baseMapper.pageH5McsGame(page, null, null, null, null, pageMcsGameDTO); |
| | | } |
| | | |
| | | IPage<McsGameVO> mcsGames = this.baseMapper.pageH5McsGame(page, pageMcsGameDTO); |
| | | return R.ok(mcsGames); |
| | | } |
| | | |