|
@@ -8,31 +8,42 @@ import lombok.extern.log4j.Log4j2;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.modules.app.service.IAppIsinService;
|
|
|
+import org.jeecg.modules.app.vo.AppGmtInfoVO;
|
|
|
import org.jeecg.modules.app.vo.AppIsinVerifyVO;
|
|
|
-import org.jeecg.modules.system.app.entity.AppIsin;
|
|
|
-import org.jeecg.modules.system.app.entity.AppOrder;
|
|
|
-import org.jeecg.modules.system.app.entity.AppOrderProInfo;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppIsinMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppOrderMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppOrderProInfoMapper;
|
|
|
+import org.jeecg.modules.app.vo.AppOrderUseRecordsVO;
|
|
|
+import org.jeecg.modules.system.app.entity.*;
|
|
|
+import org.jeecg.modules.system.app.mapper.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@Log4j2
|
|
|
public class AppIsinServiceImpl extends ServiceImpl<AppIsinMapper, AppIsin> implements IAppIsinService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AppGmtInfoMapper appGmtInfoMapper;
|
|
|
@Resource
|
|
|
private AppOrderProInfoMapper appOrderProInfoMapper;
|
|
|
@Resource
|
|
|
private AppOrderMapper appOrderMapper;
|
|
|
+ @Resource
|
|
|
+ private FamilyMembersMapper familyMembersMapper;
|
|
|
+ @Resource
|
|
|
+ private AppGameMapper appGameMapper;
|
|
|
+ @Resource
|
|
|
+ private AppSiteMapper appSiteMapper;
|
|
|
+ @Resource
|
|
|
+ private AppSitePriceRulesMapper appSitePriceRulesMapper;
|
|
|
+ @Resource
|
|
|
+ private AppSitePlaceMapper appSitePlaceMapper;
|
|
|
+ @Resource
|
|
|
+ private AppGamePriceRulesMapper appGamePriceRulesMapper;
|
|
|
|
|
|
@Override
|
|
|
public Page<AppIsinVerifyVO> pageAppIsinVerifyRecords(Page<AppIsinVerifyVO> page, String orgCode) {
|
|
@@ -89,6 +100,73 @@ public class AppIsinServiceImpl extends ServiceImpl<AppIsinMapper, AppIsin> impl
|
|
|
return "撤销成功!";
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AppOrderUseRecordsVO queryOrderUseRecords(String ticketNo) {
|
|
|
+ AppOrderUseRecordsVO appOrderUseRecordsVO = new AppOrderUseRecordsVO();
|
|
|
+ List<AppIsin> appIsinList = this.list(Wrappers.lambdaQuery(AppIsin.class).eq(AppIsin::getTicketNo, ticketNo));
|
|
|
+ appOrderUseRecordsVO.setAppIsinList(appIsinList);
|
|
|
+ List<AppGmtInfoVO> appGmtInfoVOList = new ArrayList<>();
|
|
|
+ List<AppOrderProInfo> appOrderProInfos = appOrderProInfoMapper.selectList(Wrappers.lambdaQuery(AppOrderProInfo.class).eq(AppOrderProInfo::getTicketNo, ticketNo));
|
|
|
+ for (AppOrderProInfo appOrderProInfo : appOrderProInfos) {
|
|
|
+ if (Objects.equals(appOrderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_4) || Objects.equals(appOrderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_0)){
|
|
|
+ if (Objects.equals(appOrderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_4)){
|
|
|
+ String familyUserId = appOrderProInfo.getFamilyUserId();
|
|
|
+ List<String> familyIds = Arrays.stream(familyUserId.split(",")).collect(Collectors.toList());
|
|
|
+ AppOrder appOrder = appOrderMapper.selectById(appOrderProInfo.getOrderId());
|
|
|
+ AppGamePriceRules appGamePriceRules = appGamePriceRulesMapper.selectById(appOrder.getProductIds());
|
|
|
+ AppGame appGame = appGameMapper.selectById(appGamePriceRules.getGameId());
|
|
|
+ for (String familyId : familyIds) {
|
|
|
+ if (Objects.nonNull(appGame)){
|
|
|
+ List<AppGmtInfo> appGmtInfos = appGmtInfoMapper.selectList(Wrappers.lambdaQuery(AppGmtInfo.class).eq(AppGmtInfo::getFamilyId, familyId).between(AppGmtInfo::getGmtCreate, appGame.getStartTime(), appGame.getEndTime()));
|
|
|
+ for (AppGmtInfo appGmtInfo : appGmtInfos) {
|
|
|
+ String familyUserName = familyMembersMapper.selectById(appGmtInfo.getFamilyId()).getFullName();
|
|
|
+ String siteName = appSiteMapper.selectById(appGmtInfo.getSiteId()).getName();
|
|
|
+ AppGmtInfoVO appGmtInfoVO = new AppGmtInfoVO();
|
|
|
+ appGmtInfoVO
|
|
|
+ .setSiteId(appGmtInfo.getSiteId())
|
|
|
+ .setSiteName(siteName)
|
|
|
+ .setFamilyId(appGmtInfo.getFamilyId())
|
|
|
+ .setFamilyUserName(familyUserName)
|
|
|
+ .setGmtCreate(appGmtInfo.getGmtCreate())
|
|
|
+ .setPicUrl(appGmtInfo.getPicUrl());
|
|
|
+ appGmtInfoVOList.add(appGmtInfoVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Objects.equals(appOrderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_0)){
|
|
|
+ String familyUserId = appOrderProInfo.getFamilyUserId();
|
|
|
+ AppOrder appOrder = appOrderMapper.selectById(appOrderProInfo.getOrderId());
|
|
|
+ String productIds = appOrder.getProductIds();
|
|
|
+ AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectById(productIds);
|
|
|
+ if (Objects.nonNull(appSitePriceRules)){
|
|
|
+ String sitePlaceId = appSitePriceRules.getSitePlaceId();
|
|
|
+ AppSitePlace appSitePlace = appSitePlaceMapper.selectById(sitePlaceId);
|
|
|
+ AppSite appSite = appSiteMapper.selectById(appSitePlace.getSiteId());
|
|
|
+ List<AppGmtInfo> appGmtInfos = appGmtInfoMapper.selectList(Wrappers.lambdaQuery(AppGmtInfo.class)
|
|
|
+ .eq(AppGmtInfo::getSiteId, appSite.getId())
|
|
|
+ .eq(AppGmtInfo::getFamilyId, familyUserId).between(AppGmtInfo::getGmtCreate, appSitePriceRules.getStartTime(), appSitePriceRules.getEndTime()));
|
|
|
+ for (AppGmtInfo appGmtInfo : appGmtInfos) {
|
|
|
+ String familyUserName = familyMembersMapper.selectById(appGmtInfo.getFamilyId()).getFullName();
|
|
|
+ String siteName = appSiteMapper.selectById(appGmtInfo.getSiteId()).getName();
|
|
|
+ AppGmtInfoVO appGmtInfoVO = new AppGmtInfoVO();
|
|
|
+ appGmtInfoVO
|
|
|
+ .setSiteId(appGmtInfo.getSiteId())
|
|
|
+ .setSiteName(siteName)
|
|
|
+ .setFamilyId(appGmtInfo.getFamilyId())
|
|
|
+ .setFamilyUserName(familyUserName)
|
|
|
+ .setGmtCreate(appGmtInfo.getGmtCreate())
|
|
|
+ .setPicUrl(appGmtInfo.getPicUrl());
|
|
|
+ appGmtInfoVOList.add(appGmtInfoVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ appOrderUseRecordsVO.setAppGmtInfoList(appGmtInfoVOList);
|
|
|
+ return appOrderUseRecordsVO;
|
|
|
+ }
|
|
|
+
|
|
|
//时间加1小时
|
|
|
public static Date getDate(Date date){
|
|
|
Calendar cal = Calendar.getInstance();
|