|
@ -9,14 +9,14 @@ import com.lottery.result.Result; |
|
|
import com.lottery.utils.HttpUtils; |
|
|
import com.lottery.utils.HttpUtils; |
|
|
import com.lottery.vo.ApiFundingTimeVo; |
|
|
import com.lottery.vo.ApiFundingTimeVo; |
|
|
import com.lottery.vo.ApiFundingVO; |
|
|
import com.lottery.vo.ApiFundingVO; |
|
|
|
|
|
import com.lottery.vo.ApimarketVo; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @program: lottery-system |
|
|
* @program: lottery-system |
|
@ -36,66 +36,6 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
|
//返回前台所有数据 |
|
|
|
|
|
@Override |
|
|
|
|
|
public ApiFundingVO getActivityDetail(Integer activityId) { |
|
|
|
|
|
|
|
|
|
|
|
//根据活动id查询活动时间,市场一,市场二,设置的初始时间,俩个市场总助力次数 |
|
|
|
|
|
|
|
|
|
|
|
//根据活动id查询俩个市场,俩个市场是一条数据 |
|
|
|
|
|
ApiFundingTimeVo data= fundingMapper.getMarket(activityId); |
|
|
|
|
|
|
|
|
|
|
|
Integer marketOne = data.getMarketOne(); |
|
|
|
|
|
Integer marketTwo = data.getMarketTwo(); |
|
|
|
|
|
LocalDate startTime = (LocalDate) data.getStartTime(); |
|
|
|
|
|
LocalDate endTime = (LocalDate) data.getEndTime(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//市场一的总的助力次数 |
|
|
|
|
|
Integer markerOneTotal = fundingMapper.searchMarketTotal(activityId, marketOne); |
|
|
|
|
|
if (markerOneTotal == null) { |
|
|
|
|
|
markerOneTotal = 0; // 默认值 |
|
|
|
|
|
} |
|
|
|
|
|
//市场一的虚拟次数 |
|
|
|
|
|
Integer markerOneVirtual = fundingMapper.searchVirtual(activityId, marketOne); |
|
|
|
|
|
if (markerOneVirtual == null) { |
|
|
|
|
|
markerOneVirtual = 0; // 默认值 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//市场二的总的助力次数 |
|
|
|
|
|
Integer markerTwoTotal = fundingMapper.searchMarketTotal(activityId, marketTwo); |
|
|
|
|
|
if (markerTwoTotal == null) { |
|
|
|
|
|
markerTwoTotal = 0; // 默认值 |
|
|
|
|
|
} |
|
|
|
|
|
//市场二的虚拟次数 |
|
|
|
|
|
Integer markerTwoVirtual = fundingMapper.searchVirtual(activityId, marketTwo); |
|
|
|
|
|
if (markerTwoVirtual == null) { |
|
|
|
|
|
markerTwoVirtual = 0; // 默认值 |
|
|
|
|
|
} |
|
|
|
|
|
//获取的设置时间 |
|
|
|
|
|
Integer time = fundingMapper.getTime(activityId,marketOne); |
|
|
|
|
|
|
|
|
|
|
|
Integer oneShow = markerOneTotal + markerOneVirtual; |
|
|
|
|
|
Integer twoShow = markerTwoTotal + markerTwoVirtual; |
|
|
|
|
|
|
|
|
|
|
|
ApiFundingVO apiFundingVO = new ApiFundingVO(); |
|
|
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
String marketOneName = fundingMapper.selectMarket(marketOne); |
|
|
|
|
|
String marketTwoName = fundingMapper.selectMarket(marketTwo); |
|
|
|
|
|
|
|
|
|
|
|
apiFundingVO.setMarketOne(marketOneName); |
|
|
|
|
|
apiFundingVO.setMarketTwo(marketTwoName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apiFundingVO.setMarketOneCount(oneShow); |
|
|
|
|
|
apiFundingVO.setMarketTwoCount(twoShow); |
|
|
|
|
|
apiFundingVO.setTotalcount(time); |
|
|
|
|
|
apiFundingVO.setStartTime(startTime); |
|
|
|
|
|
apiFundingVO.setEndTime(endTime); |
|
|
|
|
|
|
|
|
|
|
|
return apiFundingVO; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Result getActivityDetailOne(String token) { |
|
|
public Result getActivityDetailOne(String token) { |
|
@ -103,10 +43,10 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
//先查询一下有几个活动开启 |
|
|
//先查询一下有几个活动开启 |
|
|
|
|
|
|
|
|
Integer count = fundingMapper.selectStatusCount(); |
|
|
Integer count = fundingMapper.selectStatusCount(); |
|
|
if (count == null || count < 0 || count > 1) { |
|
|
|
|
|
|
|
|
if (count == null || count == 0 || count > 1) { |
|
|
// 根据业务逻辑,这里可以分别处理count为null、小于0和大于1的情况 |
|
|
// 根据业务逻辑,这里可以分别处理count为null、小于0和大于1的情况 |
|
|
// 但为了简化示例,我们统一返回一个失败结果 |
|
|
// 但为了简化示例,我们统一返回一个失败结果 |
|
|
return Result.failure("活动数量不符合要求,请检查并关闭多余的活动"); |
|
|
|
|
|
|
|
|
return Result.failure("活动数量不符合要求,请检查打开或关闭多余的活动"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Integer activityId = fundingMapper.selectStatus(); |
|
|
Integer activityId = fundingMapper.selectStatus(); |
|
@ -185,21 +125,27 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
|
|
|
|
|
|
ApiFundingVO apiFundingVO = new ApiFundingVO(); |
|
|
ApiFundingVO apiFundingVO = new ApiFundingVO(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String marketOneName = fundingMapper.selectMarket(marketOne); |
|
|
String marketOneName = fundingMapper.selectMarket(marketOne); |
|
|
String marketTwoName = fundingMapper.selectMarket(marketTwo); |
|
|
String marketTwoName = fundingMapper.selectMarket(marketTwo); |
|
|
apiFundingVO.setMarketOne(marketOneName); |
|
|
|
|
|
apiFundingVO.setMarketTwo(marketTwoName); |
|
|
|
|
|
|
|
|
|
|
|
apiFundingVO.setMarketOneId(marketOne); |
|
|
|
|
|
apiFundingVO.setMarketTwoId(marketTwo); |
|
|
|
|
|
apiFundingVO.setMarketOneCount(oneShow); |
|
|
|
|
|
apiFundingVO.setMarketTwoCount(twoShow); |
|
|
|
|
|
apiFundingVO.setTotalcount(time); |
|
|
apiFundingVO.setTotalcount(time); |
|
|
apiFundingVO.setStartTime(startTime); |
|
|
apiFundingVO.setStartTime(startTime); |
|
|
apiFundingVO.setEndTime(endTime); |
|
|
apiFundingVO.setEndTime(endTime); |
|
|
apiFundingVO.setMarketOneStatus(markeroneadd); |
|
|
|
|
|
apiFundingVO.setMarketTwoStatus(marketTwoadd); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApimarketVo marketone = new ApimarketVo(); |
|
|
|
|
|
ApimarketVo markettwo = new ApimarketVo(); |
|
|
|
|
|
|
|
|
|
|
|
marketone.setMarketId(marketOne); |
|
|
|
|
|
marketone.setMarket(marketOneName); |
|
|
|
|
|
marketone.setMarketCount(oneShow); |
|
|
|
|
|
marketone.setMarketStatus(markeroneadd); |
|
|
|
|
|
|
|
|
|
|
|
markettwo.setMarketId(marketTwo); |
|
|
|
|
|
markettwo.setMarket(marketTwoName); |
|
|
|
|
|
markettwo.setMarketCount(twoShow); |
|
|
|
|
|
markettwo.setMarketStatus(marketTwoadd); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apiFundingVO.setData(Arrays.asList(marketone,markettwo)); |
|
|
return Result.success(apiFundingVO); |
|
|
return Result.success(apiFundingVO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|