From a89221efd99beffa3f295b1a5c427e1ea0537bad Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 05 三月 2024 09:31:38 +0800 Subject: [PATCH] 合并代码 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 46 insertions(+), 5 deletions(-) diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java index f6fec68..3319ef9 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java @@ -19,15 +19,13 @@ import com.dsh.communityWorldCup.mapper.WorldCupMapper; import com.dsh.communityWorldCup.model.*; import com.dsh.communityWorldCup.service.*; -import com.dsh.communityWorldCup.util.GeodesyUtil; -import com.dsh.communityWorldCup.util.PayMoneyUtil; -import com.dsh.communityWorldCup.util.ResultUtil; -import com.dsh.communityWorldCup.util.UUIDUtil; +import com.dsh.communityWorldCup.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -213,7 +211,7 @@ * @return */ @Override - public WorldCupInfo getWorldCupInfo(Integer id) { + public WorldCupInfo getWorldCupInfo(Integer id, String lon, String lat) { WorldCupInfo worldCupInfo = this.baseMapper.getWorldCupInfo(id); List<WorldCupStore> worldCupStores = worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("worldCupId", id)); JSONArray jsonArray = new JSONArray(); @@ -231,6 +229,34 @@ heat += count; } worldCupInfo.setHeat(heat); + ArrayList<Map<String, Object>> objects = new ArrayList<>(); + for (WorldCupStore worldCupStore : worldCupStores) { + HashMap<String, Object> map = new HashMap<>(); + Store store = storeClient.queryStoreById(worldCupStore.getStoreId()); + map.put("name", store.getName()); + + + String str = store.getAddress(); + str = str.substring(str.indexOf("省") + 1); + + // 去掉第一个“市”及之前的字符串 + str = str.substring(str.indexOf("市") + 1); + + // 去掉第一个“区”及之前的字符串 + str = str.substring(str.indexOf("区") + 1); + + map.put("address", str); + map.put("storeLon", store.getLon()); + map.put("storeLat", store.getLat()); + map.put("storeCoverDrawing", store.getCoverDrawing()); + if (ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)) { + Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); + double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + map.put("distance", wgs84); + } + objects.add(map); + } + worldCupInfo.setStoreInfos(objects); return worldCupInfo; } @@ -357,6 +383,7 @@ //微信 if(payType == 1){ worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), worldCup.getCash().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); @@ -364,6 +391,7 @@ //支付宝 if(payType == 2){ worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), worldCup.getCash().toString(), "/base/worldCup/aliPayWorldCupCallback"); @@ -378,6 +406,7 @@ worldCupPayment.setAmount(multiply); worldCupPayment.setPayStatus(2); worldCupPayment.setPayTime(new Date()); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - multiply.intValue()); @@ -456,6 +485,7 @@ worldCupPayment.setAmount(multiply); worldCupPayment.setPayStatus(2); worldCupPayment.setPayTime(new Date()); + worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return ResultUtil.success(); } @@ -464,6 +494,7 @@ worldCupPayment.setAmount(BigDecimal.ZERO); worldCupPayment.setPayStatus(2); worldCupPayment.setPayTime(new Date()); + worldCupPayment.setUnitPrice(BigDecimal.ZERO); worldCupPaymentService.save(worldCupPayment); //添加报名明细 @@ -521,4 +552,14 @@ } return ResultUtil.success(); } + + + /** + * 取消赛事后退还费用 + * @param id + */ + @Override + public void cancelWorldCupRefund(Integer id) { + + } } -- Gitblit v1.7.1