cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/ExchangeDetailsResponse.java
@@ -9,6 +9,10 @@ @Data public class ExchangeDetailsResponse { @ApiModelProperty(value = "2.0新增字段二维码类型 1订场 2散客 3门票 4惠民卡") private Integer codeType; @ApiModelProperty(value = "2.0新增字段数据id") private Integer dataId; @ApiModelProperty(value = "记录id") private Long detailsId; @@ -25,6 +29,7 @@ @ApiModelProperty(value = "兑换方式(1=积分,2=积分+现金 3=现金 4=会员赠送 当该字段为4时切goodType=3门票时 展示的二维码内容增加一个vipDetail:当前数据id)") private Integer exchangeType; @ApiModelProperty(value = "有效期开始时间") private String startTime; cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminController.java
@@ -398,41 +398,44 @@ jsonArray.add(jsonObject2); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } } else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); jsonArray.add(jsonObject3); } } if (!jsonArray.isEmpty()) { huiminCardVO1.setEndTime(simpleDateFormat.format(payHuimin.getEndTime())); TStudent tStudent = tStudents.stream().filter(e -> e.getId().equals(Integer.valueOf(payHuimin.getStudentId().split(",")[0]))).findFirst().orElse(null); if (tStudent!=null){ huiminCardVO1.setStudentName(tStudent.getName()); String temp = "{\"id\":"+payHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tStudent.getId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; String temp = "{\"id\":"+payHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tStudent.getId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + ",\"codeType\":"+4+"\"dataId\":"+payHuimin.getId()+"}"; huiminCardVO1.setQrCode(temp); }else{ huiminCardVO1.setStudentName(""); String temp = "{\"id\":"+payHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + 0 + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; String temp = "{\"id\":"+payHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + 0 + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + ",\"codeType\":"+4+"\"dataId\":"+payHuimin.getId()+"}"; huiminCardVO1.setQrCode(temp); } huiminCardVOS.add(huiminCardVO1); @@ -559,7 +562,7 @@ Date start = DateUtil.parse(s1, "yyyy-MM-dd HH:mm:ss"); Date end = DateUtil.parse(e1, "yyyy-MM-dd HH:mm:ss"); if (new Date().after(start) && new Date().before(end)) { // // Date date1 = new Date(); jsonObject2.put("start_time", simpleDateFormat1.format( date1)); date1.setTime(date1.getTime() + 30 * 1000); @@ -568,27 +571,30 @@ jsonArray.add(jsonObject2); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject.put("end_time", simpleDateFormat1.format( date1)); jsonObject.put("start_time", simpleDateFormat1.format( date1)); if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject); jsonArray.add(jsonObject3); } } if (!jsonArray.isEmpty()) { // 将学员加入 @@ -698,36 +704,39 @@ jsonArray.add(jsonObject2); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject.put("end_time", simpleDateFormat1.format( date1)); jsonObject.put("start_time", simpleDateFormat1.format( date1)); if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject); jsonArray.add(jsonObject3); } } TStudent tStudent = tStudents.stream().filter(e -> e.getId().equals(studentId)).findFirst().orElse(null); if (tStudent!=null){ huiminCardStudentVO.setStudentName(tStudent.getName()); String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tStudent.getId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tStudent.getId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + ",\"codeType\":"+4+"\"dataId\":"+tPayHuimin.getId()+"}"; huiminCardStudentVO.setQrCode(temp); }else{ huiminCardStudentVO.setStudentName(""); String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + 0 + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + 0 + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + ",\"codeType\":"+4+"\"dataId\":"+tPayHuimin.getId()+"}"; huiminCardStudentVO.setQrCode(temp); } @@ -963,30 +972,33 @@ jsonArray.add(jsonObject2); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject3); } } }else{ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject.put("end_time", simpleDateFormat1.format( date1)); jsonObject.put("start_time", simpleDateFormat1.format( date1)); if (jsonArray.isEmpty()){ // 返回过期的二维码 保证开门失败即可 JSONObject jsonObject3 = new JSONObject(); Date date1 = new Date(); date1.setTime(date1.getTime() - 300 * 1000); jsonObject3.put("end_time", simpleDateFormat1.format( date1)); jsonObject3.put("start_time", simpleDateFormat1.format( date1)); jsonArray.add(jsonObject); jsonArray.add(jsonObject3); } } String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tPayHuimin.getStudentId().split(",")[0] + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tPayHuimin.getStudentId().split(",")[0] + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + ",\"codeType\":"+4+"\"dataId\":"+tPayHuimin.getId()+"}"; myHuiminCardDetailVO.setQrCode(temp); myHuiminCardDetailVO.setCardId(tPayHuimin.getCardId()); myHuiminCardDetailVO.setHuiminCard(byId); cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -95,11 +95,13 @@ public void changeState(@RequestBody CoachChangeStateVO dto) { pmdsService.changeState(dto); } @ResponseBody @PostMapping("/base/pointMerchars/goodsList") public List<PointsMerchandise> goodsList() { return pmdsService.list(); } /** * 根据id查询 */ @@ -209,7 +211,7 @@ List<Integer> storeIds = ofSearch.getStoreIds(); // 优惠券指定的门店 List<Integer> collect5 = cstoreService.list(new QueryWrapper<CouponStore>().eq("couponId", id3) .in("storeId", storeIds)).stream().map(CouponStore::getStoreId) .in("storeId", storeIds)).stream().map(CouponStore::getStoreId) .collect(Collectors.toList()); // 判断两个集合是否相交 // 比较两个集合中是否有相同的元素;当两个集合中没有相同元素时返回true, @@ -303,7 +305,7 @@ List<IntegralCommodity> commodity = new ArrayList<>(); Map<String, String> geocode = gdMapGeocodingUtil.geocode(location.getLon(), location.getLat()); if(null == geocode){ if (null == geocode) { return new ArrayList<>(); } String provinceCode = geocode.get("provinceCode"); @@ -331,7 +333,7 @@ .eq("shelves", 1) .gt("endTime", new Date()) .eq("status", 1); if(cIds.size() > 0){ if (cIds.size() > 0) { wrapper.in("id", cIds); } List<PointsMerchandise> merchandises = pmdsService.list(wrapper.last("ORDER BY sort desc,insertTime desc")); @@ -341,14 +343,14 @@ integralCommodity.setCommodityId(merchandise.getId()); integralCommodity.setCommodityImg(merchandise.getCover()); integralCommodity.setCommodityName(merchandise.getName()); if(merchandise.getRedemptionMethod() == 1){ if (merchandise.getRedemptionMethod() == 1) { integralCommodity.setIntegral(merchandise.getIntegral()); } if(merchandise.getRedemptionMethod() == 2){ if (merchandise.getRedemptionMethod() == 2) { integralCommodity.setCommodityPrice(merchandise.getPrice()); integralCommodity.setIntegral(merchandise.getIntegral()); } if(merchandise.getRedemptionMethod() == 3){ if (merchandise.getRedemptionMethod() == 3) { integralCommodity.setCommodityPrice(merchandise.getPrice()); } integralCommodity.setRedemptionMethod(merchandise.getRedemptionMethod()); @@ -366,20 +368,20 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); QueryWrapper<Coupon> queryWrapper = new QueryWrapper<Coupon>() .eq("state", 1).gt("endTime", sdf.format(new Date())); if(storeCoupons.size() > 0){ if (storeCoupons.size() > 0) { queryWrapper.in("id", storeCoupons); } List<Coupon> list = couponService.list(queryWrapper.last(" ORDER BY insertTime desc")); if (!list.isEmpty()){ if (!list.isEmpty()) { for (Coupon coupon : list) { IntegralCommodity integralCommodity = new IntegralCommodity(); integralCommodity.setCommodityId(coupon.getId()); integralCommodity.setCommodityImg(coupon.getCover()); integralCommodity.setCommodityName(coupon.getName()); if(coupon.getRedemptionMethod() == 1){ if (coupon.getRedemptionMethod() == 1) { integralCommodity.setIntegral(coupon.getIntegral().intValue()); } if(coupon.getRedemptionMethod() == 2){ if (coupon.getRedemptionMethod() == 2) { integralCommodity.setCommodityPrice(coupon.getCash()); integralCommodity.setIntegral(coupon.getIntegral().intValue()); } @@ -396,20 +398,22 @@ @PostMapping("/base/pointMerchars/getCommoditys") public PointMerchandiseVo getVicinityGoods(@RequestBody CommodityRequest request) { PointMerchandiseVo pointMerchandiseVo = new PointMerchandiseVo(); List<PointsMerchandise> list = new ArrayList<>(); String provinceCode = ""; String cityCode = ""; if (ToolUtil.isEmpty(request.getLon()) && ToolUtil.isEmpty(request.getLat())) { return pointMerchandiseVo; }else{ try { Map<String, String> geocode = gdMapGeocodingUtil.geocode(request.getLon(), request.getLat()); provinceCode = geocode.get("provinceCode"); cityCode = geocode.get("cityCode"); } catch (Exception e) { e.printStackTrace(); } } try { Map<String, String> geocode = gdMapGeocodingUtil.geocode(request.getLon(), request.getLat()); provinceCode = geocode.get("provinceCode"); cityCode = geocode.get("cityCode"); } catch (Exception e) { e.printStackTrace(); } list = pmdsService.list(new QueryWrapper<PointsMerchandise>() .eq("state", 1) @@ -418,6 +422,27 @@ .ge("endTime", new Date()) .eq("status", 1) ); if (request.getShopId()!=null){ List<Integer> storeId = new ArrayList<>(); storeId.add(request.getShopId()); List<Store> stores = storeClient.queryStoreByIds(storeId); Store store = stores.get(0); provinceCode = store.getProvinceCode(); cityCode = store.getCityCode(); List<Integer> pointsMerchandiseIds = pmdstoService.lambdaQuery().eq(PointsMerchandiseStore::getStoreId, request.getShopId()).list() .stream().map(PointsMerchandiseStore::getPointsMerchandiseId) .collect(Collectors.toList()); if (pointsMerchandiseIds.isEmpty()){ pointMerchandiseVo.setMerchandises(list); return pointMerchandiseVo; }else{ List<PointsMerchandise> pointsMerchandiseList = pmdsService.lambdaQuery().in(PointsMerchandise::getId, pointsMerchandiseIds).list(); list.addAll(pointsMerchandiseList); List<PointsMerchandise> listAll = list.stream().distinct().collect(Collectors.toList()); list = listAll; } } if (list.size() > 0) { Iterator<PointsMerchandise> iterator = list.iterator(); while (iterator.hasNext()) { @@ -834,7 +859,6 @@ private ICouponService couponService; @ResponseBody @PostMapping("/base/pointMerchars/getDetailsOfExchange") public ExchangeDetailsVo getIntegralExchangeDetails(@RequestBody Integer appUserId) throws ParseException { @@ -857,7 +881,7 @@ List<UserCoupon> userCoupons = new ArrayList<>(); if (ids.size() > 0) { userCoupons = userCouponService.list(new QueryWrapper<UserCoupon>().eq("userId", appUserId).in("couponId", ids) .ne("status",3)); .ne("status", 3)); } if (pointsMerchandises.size() > 0) { for (UserPointsMerchandise pointsMerchandise : pointsMerchandises) { @@ -885,6 +909,8 @@ detailsResponse.setUseStatus(pointsMerchandise.getStatus() == 1 ? 2 : 1); detailsResponse.setGoodType(merchandise.getType()); if (merchandise.getType() == 3) { detailsResponse.setCodeType(3); detailsResponse.setDataId(pointsMerchandise.getPointsMerchandiseId()); detailsResponse.setCardType(merchandise.getCardType()); List<Integer> sids = new ArrayList<>(); detailsResponse.setUserId(appUserId); @@ -923,49 +949,49 @@ // 以下代码均为临时代码=============================== for (Integer integer : collect) { ArrayList<Integer> list2 = new ArrayList<>(); if (integer==2024){ if (integer == 2024) { list2.add(32); detailsResponse.setRid(list2); } // 临时 根据门票id 指定的区域 if (integer==9919){ if (pointsMerchandise.getPointsMerchandiseId()==196||pointsMerchandise.getPointsMerchandiseId()==198){ if (integer == 9919) { if (pointsMerchandise.getPointsMerchandiseId() == 196 || pointsMerchandise.getPointsMerchandiseId() == 198) { // 返回儿童区id ArrayList<Integer> list3 = new ArrayList<>(); list3.add(44); detailsResponse.setRid(list3); }else if(pointsMerchandise.getPointsMerchandiseId()==197) { } else if (pointsMerchandise.getPointsMerchandiseId() == 197) { ArrayList<Integer> list4 = new ArrayList<>(); list4.add(43); detailsResponse.setRid(list4); } } } if (detailsResponse.getRid()==null){ if (detailsResponse.getRid() == null) { List<Integer> integers = stoClient.querySiteIdById(collect); detailsResponse.setRid(integers); } //====================================================== } }else{ // todo 返回门店id 和场地id // 查询指定场地 List<PointsMerchandiseStore> list = pmdstoService.list(new LambdaQueryWrapper<PointsMerchandiseStore>() .eq(PointsMerchandiseStore::getPointsMerchandiseId, merchandise.getId())); // 门店 ArrayList<Integer> list3 = new ArrayList<>(); // 场地 ArrayList<Integer> list4 = new ArrayList<>(); for (PointsMerchandiseStore temp : list) { Integer storeId = temp.getStoreId(); Integer siteId = temp.getSiteId(); list3.add(storeId); list4.add(siteId); } detailsResponse.setRid(list4); detailsResponse.setSid(list3); System.err.println("门票rid"+list4); System.err.println("门票sid"+list3); } else { // todo 返回门店id 和场地id // 查询指定场地 List<PointsMerchandiseStore> list = pmdstoService.list(new LambdaQueryWrapper<PointsMerchandiseStore>() .eq(PointsMerchandiseStore::getPointsMerchandiseId, merchandise.getId())); // 门店 ArrayList<Integer> list3 = new ArrayList<>(); // 场地 ArrayList<Integer> list4 = new ArrayList<>(); for (PointsMerchandiseStore temp : list) { Integer storeId = temp.getStoreId(); Integer siteId = temp.getSiteId(); list3.add(storeId); list4.add(siteId); } detailsResponse.setRid(list4); detailsResponse.setSid(list3); System.err.println("门票rid" + list4); System.err.println("门票sid" + list3); } @@ -1003,10 +1029,10 @@ } } String format = simpleDateFormat1.format(pointsMerchandise.getInsertTime()); detailsResponse.setStartTime(format+" "+startTime+":00"); detailsResponse.setEndTime(format+" "+endTime+":00"); if (simpleDateFormat.parse(format+" "+endTime+":00").before(new Date())){ System.err.println("过期了,当前门店中最晚营业时间为"+format+" "+endTime+":00"); detailsResponse.setStartTime(format + " " + startTime + ":00"); detailsResponse.setEndTime(format + " " + endTime + ":00"); if (simpleDateFormat.parse(format + " " + endTime + ":00").before(new Date())) { System.err.println("过期了,当前门店中最晚营业时间为" + format + " " + endTime + ":00"); detailsResponse.setUseStatus(3); } } else if (merchandise.getCardType() == 2) { @@ -1070,22 +1096,23 @@ List<VipDetail> list = vipDetailService.lambdaQuery() .eq(VipDetail::getAppUserId, appUserId).eq(VipDetail::getType, 2).list(); for (VipDetail vipDetail : list) { ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); // 添加-用于区分会员权益门票 detailsResponse.setDetailsId(Long.valueOf("-"+vipDetail.getId())); detailsResponse.setGoodName(vipDetail.getTicketName()); detailsResponse.setStartTime(simpleDateFormat.format(vipDetail.getStartTime())); detailsResponse.setEndTime(simpleDateFormat.format(vipDetail.getEndTime())); detailsResponse.setUseStatus(vipDetail.getStatus()==1?2:1); detailsResponse.setGoodType(3); // 表明是会员赠送的门票 detailsResponse.setExchangeType(4); // 全国通用 ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); // 添加-用于区分会员权益门票 detailsResponse.setDetailsId(Long.valueOf("-" + vipDetail.getId())); detailsResponse.setGoodName(vipDetail.getTicketName()); detailsResponse.setStartTime(simpleDateFormat.format(vipDetail.getStartTime())); detailsResponse.setEndTime(simpleDateFormat.format(vipDetail.getEndTime())); detailsResponse.setUseStatus(vipDetail.getStatus() == 1 ? 2 : 1); detailsResponse.setGoodType(3); detailsResponse.setCardType(3); // 表明是会员赠送的门票 detailsResponse.setExchangeType(4); // 全国通用 detailsResponse.setRid(Collections.singletonList(0)); detailsResponse.setSid(Collections.singletonList(0)); responses.add(detailsResponse); } responses.add(detailsResponse); } if (userCoupons.size() > 0) { for (UserCoupon userCoupon : userCoupons) { @@ -1105,7 +1132,7 @@ detailsResponse.setIntegral(c.getIntegral().intValue()); detailsResponse.setCash(c.getCash()); } if (userCoupon.getIsVipGrant()!=null && userCoupon.getIsVipGrant()==1){ if (userCoupon.getIsVipGrant() != null && userCoupon.getIsVipGrant() == 1) { detailsResponse.setExchangeType(4); } detailsResponse.setStartTime(simpleDateFormat.format(c.getStartTime())); @@ -1132,10 +1159,10 @@ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); PointDetailsVo detailsVo = new PointDetailsVo(); if (speMercharsId.toString().contains("-1")){ if (speMercharsId.toString().contains("-1")) { // 会员优惠券 VipDetail vipDetail = vipDetailService.getById(Math.abs(speMercharsId)); if (vipDetail.getType()==1){ if (vipDetail.getType() == 1) { Coupon coupon = iCouponService.getById(vipDetail.getCouponId()); detailsVo.setDetailsId(Long.valueOf(coupon.getId())); List<String> list3 = new ArrayList<>(); @@ -1184,12 +1211,12 @@ detailsVo.setContents(coupon.getIllustrate()); detailsVo.setGoodType(4); }else{ } else { // 门票 detailsVo.setDetailsId(Long.valueOf("-"+vipDetail.getId())); detailsVo.setDetailsId(Long.valueOf("-" + vipDetail.getId())); detailsVo.setGoodName(vipDetail.getTicketName()); switch (vipDetail.getStatus()){ switch (vipDetail.getStatus()) { case 1: detailsVo.setUseType(2); break; @@ -1203,10 +1230,10 @@ detailsVo.setStartTime(simpleDateFormat.format(vipDetail.getStartTime())); detailsVo.setEndTime(simpleDateFormat.format(vipDetail.getEndTime())); detailsVo.setOrderTime(simpleDateFormat.format(vipDetail.getInsertTime())); if (vipDetail.getUseTime()!=null){ if (vipDetail.getUseTime() != null) { detailsVo.setWriteOffTime(simpleDateFormat.format(vipDetail.getUseTime())); } if (vipDetail.getUseStoreId()!=null){ if (vipDetail.getUseStoreId() != null) { StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(vipDetail.getUseStoreId()); detailsVo.setWriteOffName(courseOfStore.getStoreName()); } @@ -1216,7 +1243,7 @@ detailsVo.setCardType(1); detailsVo.setExchangeAddrType(1); } detailsVo.setDetailsId(Long.valueOf("-"+vipDetail.getId())); detailsVo.setDetailsId(Long.valueOf("-" + vipDetail.getId())); return detailsVo; } UserPointsMerchandise byId = upmseService.getById(speMercharsId); @@ -1362,7 +1389,7 @@ list1.add(coursePackage.getCoverDrawing()); detailsVo.setPics(list1); detailsVo.setClassHours(0); if(coursePackage.getType() != 3){ if (coursePackage.getType() != 3) { CoursePackagePaymentConfig coursePackagePaymentConfig = cpClient.queryConfigCoursePackData(pmdsServiceById.getCoursePackageConfigId()); detailsVo.setClassHours(coursePackagePaymentConfig.getClassHours()); } @@ -1510,6 +1537,7 @@ upmseService.save(merchandise); return merchandise.getId(); } @PostMapping("/base/pointMerchars/saveDetailsUserPointMercaseList") public Boolean saveDetailsUserPointMercaseList(@RequestBody List<UserPointsMerchandise> merchandises) { for (UserPointsMerchandise merchandise : merchandises) { @@ -1848,7 +1876,7 @@ if (list.size() > 0) { if (byId.getUseScope()==3){ if (byId.getUseScope() == 3) { // 如果是指定门店 List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); @@ -1858,9 +1886,9 @@ for (Store store : stores) { StoreVos storeVos1 = new StoreVos(); storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市"); if (store.getOperatorId()==null){ if (store.getOperatorId() == null) { storeVos1.setNum2("平台"); }else if (store.getOperatorId() == 0) { } else if (store.getOperatorId() == 0) { storeVos1.setNum2("平台"); } else { storeVos1.setNum2(store.getOName()); @@ -1870,10 +1898,10 @@ storeVos.add(storeVos1); } } }else if (byId.getUseScope()==4){ } else if (byId.getUseScope() == 4) { // 如果是指定场地 List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).distinct().collect(Collectors.toList()); int temp =0; int temp = 0; List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); List<Store> stores1 = new ArrayList<>(); for (Integer integer : collect) { @@ -1883,16 +1911,16 @@ stores1.addAll(stores); } List<Store> stores = stoClient.queryStoreByIds(collect); while (temp!=collect1.size()){ while (temp != collect1.size()) { for (Store store : stores1) { Integer integer = collect1.get(temp); Site site = siteClient.querySiteById(integer); StoreVos storeVos1 = new StoreVos(); storeVos1.setNum5(site.getName()); storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市"); if (store.getOperatorId()==null){ if (store.getOperatorId() == null) { storeVos1.setNum2("平台"); }else if (store.getOperatorId() == 0) { } else if (store.getOperatorId() == 0) { storeVos1.setNum2("平台"); } else { storeVos1.setNum2(store.getOName()); @@ -1912,7 +1940,6 @@ } @ResponseBody @PostMapping("/base/pointMerchars/updateGoodsDetail") public boolean updateGoodsDetail(@RequestBody Map<String, Object> map) { @@ -1923,7 +1950,7 @@ if (Integer.valueOf(map.get("type").toString()) != 1) { byId1.setStatus(2); } if(StringUtils.hasLength(name)){ if (StringUtils.hasLength(name)) { byId1.setName(name); } Integer quantityIssued = (Integer) map.get("quantityIssued"); @@ -1977,19 +2004,19 @@ public Boolean addOther(@RequestBody String pam) { Boolean save = false; String[] split = pam.split("_"); if (split.length>2){ if (StringUtils.hasLength(split[2])){ for (String s : split[2].split(",")) { PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); Site site = siteClient.querySiteById(Integer.valueOf(s)); pointsMerchandiseStore.setStoreId(site.getStoreId()); save = pmdstoService.save(pointsMerchandiseStore); if (split.length > 2) { if (StringUtils.hasLength(split[2])) { for (String s : split[2].split(",")) { PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); Site site = siteClient.querySiteById(Integer.valueOf(s)); pointsMerchandiseStore.setStoreId(site.getStoreId()); save = pmdstoService.save(pointsMerchandiseStore); } // 这个门票是选择的场地 return save; } // 这个门票是选择的场地 return save; } } for (String s : split[1].split(",")) { PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); @@ -2093,7 +2120,7 @@ List<Integer> ids = queryDataFee.getIds(); if (ids.size() == 0) { ids.add(-1); }else{ } else { } List<PointsMerchandise> list1 = pmdsService.list(new LambdaQueryWrapper<PointsMerchandise>().eq(PointsMerchandise::getRedemptionMethod, 3)); cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/ExchangeDetailsResponse.java
@@ -10,6 +10,10 @@ @Data public class ExchangeDetailsResponse { @ApiModelProperty(value = "2.0新增字段二维码类型 1订场 2散客 3门票 4惠民卡") private Integer codeType; @ApiModelProperty(value = "2.0新增字段数据id") private Integer dataId; @ApiModelProperty(value = "记录id") private Long detailsId; @@ -25,6 +29,8 @@ @ApiModelProperty(value = "兑换方式(1=积分,2=积分+现金 3=现金 4=会员赠送 当该字段为4时 展示的二维码内容增加一个vipDetail:当前数据id)") private Integer exchangeType; @ApiModelProperty(value = "有效期开始时间") private String startTime; cloud-server-management/src/main/java/com/dsh/guns/modular/system/util/OssUploadUtil.java
@@ -11,10 +11,14 @@ import java.util.UUID; public class OssUploadUtil { // LTAI5tKLeAE1B5n2mvTZ5yy6 // zradDLTBGdzq26tYz9RUCUh0sPmfhh //OSS图片访问域名 public static String oss_domain = "https://we-park-life.oss-cn-beijing.aliyuncs.com/"; public static String accessKeyId = "LTAI47eyqWWhBPXM"; public static String accessKeySecret = "orsYX78NvgXS9KbN7wCwRja1wkUwPc"; // public static String accessKeyId = "LTAI5tE3ownRhJ7eXsuW7Vn7"; // public static String accessKeySecret = "Crgi0OhtDRuJafIeyT3JQL9v0P4EgH"; public static String accessKeyId = "LTAI5tKLeAE1B5n2mvTZ5yy6"; public static String accessKeySecret = "zradDLTBGdzq26tYz9RUCUh0sPmfhh"; public static String bucketName="we-park-life"; public static String endpoint = "oss-cn-beijing.aliyuncs.com"; cloud-server-other/src/main/java/com/dsh/other/controller/CodeCallBackController.java
@@ -21,18 +21,20 @@ @RestController @RequestMapping("/base/code") public class CodeCallBackController { /** // 进场二维码新增参数codeType 1=订场 2=散客,3=门票,玩湃惠民卡codeType=4 /** * 硬件开门后回调 是否可进场检查接口 sid门店id rid场地id */ @PostMapping("/verify") public ResultUtil verify(Integer codeType, Integer rid, Integer sid) { public ResultUtil verify(Integer codeType,Integer dataId, Integer rid, Integer sid) { System.err.println("硬件开门后回调 校验是否可入场"); System.err.println("codeType:"+codeType); System.err.println("dataId:"+dataId); System.err.println("rid:"+rid); System.err.println("sid:"+sid); Date date = new Date(); // codeType二维码类型 1=订场 2=散客 散客需要校验能否进场 // codeType二维码类型1=订场 2=散客,3=门票,玩湃惠民卡codeType=4 234需要校验能否进场 if (codeType==1){ return ResultUtil.success(true); } cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -363,10 +363,12 @@ }) public ResultUtil reservationSite(ReservationSite reservationSite) { try { Integer uid = tokenUtil.getUserIdFormRedis(); if (null == uid) { return ResultUtil.tokenErr(); } // Integer uid = tokenUtil.getUserIdFormRedis(); // if (null == uid) { // return ResultUtil.tokenErr(); // } Integer uid = 201; return siteService.reservationSite(uid, reservationSite); } catch (Exception e) { e.printStackTrace(); @@ -634,6 +636,7 @@ HashMap<String, Object> map = new HashMap<>(); System.err.println("预约id"+id); SiteBooking siteBooking = siteBookingService.getById(id); Integer targetAudience = siteBooking.getTargetAudience(); System.err.println("预约"+siteBooking); Integer storeId = siteBooking.getStoreId(); Store byId1 = service.getById(storeId); @@ -644,6 +647,10 @@ map.put("siteType", siteType.getName()); map.put("shopName", byId1.getName()); map.put("shopAddress", byId1.getAddress()); // 进场二维码新增参数codeType 1=订场 2=散客,3=门票,玩湃惠民卡codeType=4 map.put("codeType", targetAudience); map.put("dataId", siteBooking.getId()); System.err.println("订场类型:"+targetAudience); map.put("name", site.getName()); cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -90,6 +90,7 @@ private ISiteService siteService; /** * 获取场地列表 * @@ -137,7 +138,6 @@ querySiteInfoVo.setTargetAudience(3); } querySiteInfoVo.setTargetAudience(3); querySiteInfoVo.setId(site.getId()); querySiteInfoVo.setTypeName(site.getTypeName()); querySiteInfoVo.setName(site.getName()); @@ -817,17 +817,39 @@ List<QueryMySiteVo> queryMySiteVos = this.baseMapper.queryMySite(uid, status, pageNo, pageSize); for (QueryMySiteVo queryMySiteVo : queryMySiteVos) { SiteBooking siteBooking = siteBookingService.getById(queryMySiteVo.getId()); Site site = this.getById(siteBooking.getSiteId()); String[] split = siteBooking.getTimes().split(";"); if (site != null) { if (queryMySiteVo.getIsHalf() == 1) { queryMySiteVo.setPlayPaiCoin((int) (site.getPlayPaiCoinOne() * split.length)); // 所选时间段 所需总计金额 BigDecimal money = BigDecimal.ZERO; BigDecimal playCoin = BigDecimal.ZERO; for (String s : split) { } else { queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length); String day = s.split(" ")[0]; String time = s.split(" ")[1]; String bookingStart = day + " " + time.split("-")[0]; String bookingEnd = day + " " + time.split("-")[1]; List<QuerySiteTimes> querySiteTimes = querySiteTimes(siteBooking.getId(), day, siteBooking.getHalfName(), siteBooking.getNextName(), siteBooking.getTargetAudience()); for (QuerySiteTimes querySiteTime : querySiteTimes) { String timePriceStart = day + " " + querySiteTime.getTime().split("-")[0]; String timePriceEnd = day + " " + querySiteTime.getTime().split("-")[1]; // if (!isTimePeriodsIntersect(timePriceStart, timePriceEnd, bookingStart, bookingEnd)) { // // 时间不相交 // } else if (querySiteTime.getSelectable() == 0) { // if (querySiteTime.getIsReserve() == 1) { // return ResultUtil.error("【" + s + "】" + // "时间段已被使用"); // } else { // return ResultUtil.error("【" + s + "】" + // "时间段散客人数已满"); // } // } if (querySiteTime.getTime().equals(time)) { money = money.add(querySiteTime.getCashPrice()); playCoin = playCoin.add(querySiteTime.getCoinPrice()); break; } } } queryMySiteVo.setPlayPaiCoin(playCoin.setScale(0, RoundingMode.DOWN).intValue()); } return queryMySiteVos; } @@ -967,23 +989,34 @@ Site site = this.getById(siteBooking.getSiteId()); AppUser appUser = appUserClient.queryAppUser(uid); String[] split = siteBooking.getTimes().split(";"); Double payMoney = 0D; if (payType == 3) { // payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); if (appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0) { return ResultUtil.error("玩湃币不足"); } if (siteBooking.getIsHalf() == 2) { payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } else { payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } } else { if (siteBooking.getIsHalf() == 2) { payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } else { payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); // 所选时间段 所需总计金额 BigDecimal money = BigDecimal.ZERO; BigDecimal playCoin = BigDecimal.ZERO; for (String s : split) { String day = s.split(" ")[0]; String time = s.split(" ")[1]; String bookingStart = day + " " + time.split("-")[0]; String bookingEnd = day + " " + time.split("-")[1]; List<QuerySiteTimes> querySiteTimes = querySiteTimes(siteBooking.getId(), day, siteBooking.getHalfName(), siteBooking.getNextName(), siteBooking.getTargetAudience()); for (QuerySiteTimes querySiteTime : querySiteTimes) { String timePriceStart = day + " " + querySiteTime.getTime().split("-")[0]; String timePriceEnd = day + " " + querySiteTime.getTime().split("-")[1]; if (!isTimePeriodsIntersect(timePriceStart, timePriceEnd, bookingStart, bookingEnd)) { // 时间不相交 } else if (querySiteTime.getSelectable() == 0) { if (querySiteTime.getIsReserve() == 1) { return ResultUtil.error("【" + s + "】" + "时间段已被使用"); } else { return ResultUtil.error("【" + s + "】" + "时间段散客人数已满"); } } if (querySiteTime.getTime().equals(time)) { money = money.add(querySiteTime.getCashPrice()); playCoin = playCoin.add(querySiteTime.getCoinPrice()); break; } } } @@ -997,12 +1030,12 @@ JSONObject jsonObject = JSON.parseObject(coupon.getContent()); Double num1 = jsonObject.getDouble("conditionalAmount"); Double num2 = jsonObject.getDouble("deductionAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); money = money.subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN); } if (coupon.getType() == 2) {//代金券 JSONObject jsonObject = JSON.parseObject(coupon.getContent()); Double num1 = jsonObject.getDouble("conditionalAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); money = money.subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN); } userCoupon.setStatus(2); userCouponClient.updateUserCoupon(userCoupon); @@ -1016,19 +1049,19 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); siteBooking.setOrderNo(sdf.format(new Date()) + UUIDUtil.getNumberRandom(3)); siteBooking.setPayType(payType); siteBooking.setPayMoney(payMoney); siteBooking.setPayMoney(money.doubleValue()); if (payType == 3) { siteBooking.setUserCouponId(null); } siteBookingService.updateById(siteBooking); if (payType == 1) {//微信支付 return weChatPaymentSite(payMoney, siteBooking); return weChatPaymentSite(money.doubleValue(), siteBooking); } if (payType == 2) {//支付宝支付 return aliPaymentSite(payMoney, siteBooking); return aliPaymentSite(money.doubleValue(), siteBooking); } if (payType == 3) {//玩湃币支付 return playPaiCoinPaymentSite(appUser, payMoney, siteBooking); return playPaiCoinPaymentSite(appUser, playCoin.doubleValue(), siteBooking); } return ResultUtil.success(); } @@ -1050,22 +1083,35 @@ Site site = this.getById(siteBooking.getSiteId()); String[] split = siteBooking.getTimes().split(";"); Map<String, Double> map = new HashMap<>(); Double payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); if (siteBooking.getIsHalf() == 2) { payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } else { payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } map.put("playPaiCoin", payMoney); payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); if (siteBooking.getIsHalf() == 2) { payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } else { payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); // 所选时间段 所需总计金额 BigDecimal money = BigDecimal.ZERO; BigDecimal playCoin = BigDecimal.ZERO; for (String s : split) { String day = s.split(" ")[0]; String time = s.split(" ")[1]; String bookingStart = day + " " + time.split("-")[0]; String bookingEnd = day + " " + time.split("-")[1]; List<QuerySiteTimes> querySiteTimes = querySiteTimes(siteBooking.getId(), day, siteBooking.getHalfName(), siteBooking.getNextName(), siteBooking.getTargetAudience()); for (QuerySiteTimes querySiteTime : querySiteTimes) { String timePriceStart = day + " " + querySiteTime.getTime().split("-")[0]; String timePriceEnd = day + " " + querySiteTime.getTime().split("-")[1]; if (!isTimePeriodsIntersect(timePriceStart, timePriceEnd, bookingStart, bookingEnd)) { // 时间不相交 } else if (querySiteTime.getSelectable() == 0) { if (querySiteTime.getIsReserve() == 1) { return ResultUtil.error("【" + s + "】" + "时间段已被使用"); } else { return ResultUtil.error("【" + s + "】" + "时间段散客人数已满"); } } if (querySiteTime.getTime().equals(time)) { money = money.add(querySiteTime.getCashPrice()); playCoin = playCoin.add(querySiteTime.getCoinPrice()); break; } } } //校验优惠券 @@ -1078,15 +1124,24 @@ JSONObject jsonObject = JSON.parseObject(coupon.getContent()); Double num1 = jsonObject.getDouble("conditionalAmount"); Double num2 = jsonObject.getDouble("deductionAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); money = money.subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN); } if (coupon.getType() == 2) {//代金券 JSONObject jsonObject = JSON.parseObject(coupon.getContent()); Double num1 = jsonObject.getDouble("conditionalAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); money = money.subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN); } } map.put("cash", payMoney); switch (siteBooking.getPayType()){ case 1: map.put("cash", money.doubleValue()); break; case 2: map.put("cash", money.doubleValue()); break; case 3: map.put("cash", playCoin.doubleValue()); } return ResultUtil.success(map); }