| | |
| | | package com.dsh.activity.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | THuiminCard huiminCard = huiminCardService.getById(id); |
| | | if (huiminCard.getEndTime()!=null && huiminCard.getEndTime().before(new Date())){ |
| | | return ResultUtil.error("该惠民卡已过期"); |
| | | } |
| | | if (huiminCard.getGrantCount()!=null){ |
| | | if (huiminCard.getGrantCount()<=payHuiminService.lambdaQuery().eq(TPayHuimin::getCardId, huiminCard.getId()) |
| | | .eq(TPayHuimin::getStatus,2).count()){ |
| | |
| | | case 2: |
| | | // 年内卡 |
| | | Date date1 = new Date(); |
| | | |
| | | date1.setMonth(11); |
| | | date1.setDate(31); |
| | | date1.setHours(23); |
| | | date1.setMinutes(59); |
| | | date1.setSeconds(59); |
| | | date1.setSeconds(57); |
| | | tPayHuimin.setEndTime(date1); |
| | | break; |
| | | } |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看惠民卡详情 |
| | |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement.getId())); |
| | | huiminCard.setAgreementSettings(list); |
| | | }else { |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | THuiminAgreement huiminAgreement1 = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .isNull(THuiminAgreement::getOperatorId)); |
| | | if (huiminAgreement1!=null){ |
| | | List<THuiminAgreementSetting> list = huiminAgreementSettingService.list(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement1.getId())); |
| | | huiminCard.setAgreementSettings(list); |
| | | }else { |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | }else{ |
| | | THuiminAgreement one = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .eq(THuiminAgreement::getOperatorId,store.getOperatorId()).last("limit 1")); |
| | | huiminAgreementVO.setIntroduce(one.getStoreNoHuiminCardIntro()); |
| | | if (one == null){ |
| | | THuiminAgreement two = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .isNull(THuiminAgreement::getOperatorId).last("limit 1")); |
| | | huiminAgreementVO.setIntroduce(two.getStoreNoHuiminCardIntro()); |
| | | |
| | | }else{ |
| | | huiminAgreementVO.setIntroduce(one.getStoreNoHuiminCardIntro()); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | List<THuiminCard> list = huiminCardService.list(); |
| | | for (MyHuiminCardVO myHuiminCardVO : cardList) { |
| | | TPayHuimin byId = payHuiminService.getById(myHuiminCardVO.getId()); |
| | | myHuiminCardVO.setEndTime(byId.getEndTime()); |
| | | |
| | | myHuiminCardVO.setSalesMoney(byId.getSalesMoney()); |
| | | if (myHuiminCardVO.getEndTime().before(new Date())){ |
| | | // 已过期 |
| | | myHuiminCardVO.setIsExpire(1); |
| | | }else{ |
| | | myHuiminCardVO.setIsExpire(0); |
| | | } |
| | | |
| | | int count = huiminRecordService.count(new LambdaQueryWrapper<THuiminRecord>() |
| | | .eq(THuiminRecord::getHuiminCardId, myHuiminCardVO.getCardId())); |
| | | // 购卡7日内没有使用记录可退款。超过7日不管有没有使用记录都不能退款 |
| | |
| | | THuiminCard huiminCard = list.stream().filter(e -> e.getId().equals(myHuiminCardVO.getCardId())).findFirst().orElse(null); |
| | | if (null!=huiminCard){ |
| | | myHuiminCardVO.setCover(huiminCard.getBuyCover()); |
| | | } |
| | | if (myHuiminCardVO.getEndTime().before(new Date())){ |
| | | // 已过期 |
| | | myHuiminCardVO.setIsExpire(1); |
| | | if (null!=huiminCard){ |
| | | myHuiminCardVO.setCover(huiminCard.getUnBuyCover()); |
| | | } |
| | | }else{ |
| | | myHuiminCardVO.setIsExpire(0); |
| | | } |
| | | // 查询绑定人员列表 |
| | | List<TStudent> studentByIds = studentClient.getStudentByIds(myHuiminCardVO.getStudentId()); |
| | |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // LocalDateTime localDateTime = LocalDateTime.now().plusDays(365); |
| | | // // 将LocalDateTime转换为Date类型 |
| | | // Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); |
| | | // String format = simpleDateFormat.format(date); |
| | | // System.err.println(format); |
| | | |
| | | String storeIds = "1001,1002"; |
| | | JSONArray jsonArray = JSONArray.parseArray(Arrays.toString(storeIds.split(","))); |
| | | System.err.println(jsonArray); |
| | | } |
| | | /** |
| | | * 个人中心-我的惠民卡-查看详情 |
| | | */ |
| | |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | } |
| | | String temp ="{\"siteIds\":\"" +siteIds+"\","+"\"useTimes:\"\""+byId.getUseWeeks()+"\","+"\"unUseTimes:\""+byId.getUnUseTimes()+"\"}"; |
| | | String storeIds = byId.getStoreIds(); |
| | | JSONArray jsonArray = JSONArray.parseArray(Arrays.toString(storeIds.split(","))); |
| | | String temp ="{\"sid\":\"" +siteIds+"\","+"\"useTimes:\"\""+byId.getUseWeeks()+"\","+"\"unUseTimes:\""+byId.getUnUseTimes()+"\"}"; |
| | | myHuiminCardDetailVO.setQrCode(temp); |
| | | myHuiminCardDetailVO.setCardId(tPayHuimin.getCardId()); |
| | | myHuiminCardDetailVO.setHuiminCard(byId); |