| | |
| | | package com.dsh.activity.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | 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; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.TextStyle; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/huimin") |
| | | @Api(tags = "惠民卡新增") |
| | | @Api(tags = "玩湃惠民卡新增") |
| | | public class HuiminController { |
| | | |
| | | @Autowired |
| | |
| | | |
| | | |
| | | /** |
| | | * 查看惠民卡详情 |
| | | * 查看玩湃惠民卡详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/payHuiminCard") |
| | | @ApiOperation(value = "购买惠民卡") |
| | | @ApiOperation(value = "购买玩湃惠民卡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "惠民卡id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "玩湃惠民卡id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "支付方式1微信2支付宝", name = "payType", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "绑定学员ids多,个逗号拼接", name = "studentIds", dataType = "String", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<THuiminCard> payHuiminCard(Integer id,Integer payType,String studentIds) { |
| | | public ResultUtil<THuiminCard> payHuiminCard(Integer id, Integer payType, String studentIds) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | THuiminCard huiminCard = huiminCardService.getById(id); |
| | | if (huiminCard.getGrantCount()!=null){ |
| | | if (huiminCard.getGrantCount()<=payHuiminService.lambdaQuery().eq(TPayHuimin::getCardId, huiminCard.getId()) |
| | | .eq(TPayHuimin::getStatus,2).count()){ |
| | | return ResultUtil.error("该惠民卡已售完"); |
| | | 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()) { |
| | | return ResultUtil.error("该玩湃惠民卡已售完"); |
| | | } |
| | | } |
| | | if (huiminCard.getLimitCount()!=null){ |
| | | if (huiminCard.getLimitCount()<=payHuiminService.lambdaQuery().eq(TPayHuimin::getCardId, huiminCard.getId()) |
| | | .eq(TPayHuimin::getStatus,2) |
| | | if (huiminCard.getLimitCount() != null) { |
| | | if (huiminCard.getLimitCount() <= payHuiminService.lambdaQuery().eq(TPayHuimin::getCardId, huiminCard.getId()) |
| | | .eq(TPayHuimin::getStatus, 2) |
| | | .eq(TPayHuimin::getAppUserId, uid) |
| | | .count()){ |
| | | return ResultUtil.error("该惠民卡购买次数已达上限"); |
| | | .count()) { |
| | | return ResultUtil.error("该玩湃惠民卡购买次数已达上限"); |
| | | } |
| | | } |
| | | TPayHuimin tPayHuimin = new TPayHuimin(); |
| | | tPayHuimin.setSalesMoney(huiminCard.getSalesMoney()); |
| | | String[] split = studentIds.split(","); |
| | | |
| | | tPayHuimin.setSalesMoney(huiminCard.getSalesMoney().multiply(new BigDecimal(split.length)).setScale(2)); |
| | | tPayHuimin.setAppUserId(uid); |
| | | tPayHuimin.setStudentId(studentIds); |
| | | switch (huiminCard.getHuiMinType()){ |
| | | switch (huiminCard.getHuiMinType()) { |
| | | case 1: |
| | | // 年度卡 |
| | | LocalDateTime localDateTime = LocalDateTime.now().plusDays(365); |
| | |
| | | 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; |
| | | } |
| | |
| | | tPayHuimin.setCardId(huiminCard.getId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | tPayHuimin.setCode(sdf.format(new Date()) + UUIDUtil.getNumberRandom(5)); |
| | | System.err.println("支付数据"+tPayHuimin); |
| | | System.err.println("支付数据" + tPayHuimin); |
| | | payHuiminService.save(tPayHuimin); |
| | | BigDecimal bigDecimal = new BigDecimal(studentIds.split(",").length); |
| | | switch (payType){ |
| | | switch (payType) { |
| | | case 1: |
| | | return payMoneyUtil.weixinpay("购买惠民卡"+"-"+0, "", tPayHuimin.getCode(), tPayHuimin.getSalesMoney().multiply(bigDecimal).toString(), |
| | | return payMoneyUtil.weixinpay("购买玩湃惠民卡" + "-" + 0, "", tPayHuimin.getCode(), tPayHuimin.getSalesMoney().toString(), |
| | | "/base/huimin/callBack/weixinPayHuiminCallback", "APP", ""); |
| | | case 2: |
| | | String string = tPayHuimin.getSalesMoney().multiply(bigDecimal).setScale(2).toString(); |
| | | return payMoneyUtil.alipay(smid,"购买惠民卡", "购买惠民卡", "", tPayHuimin.getCode(), string, |
| | | String string = tPayHuimin.getSalesMoney().toString(); |
| | | return payMoneyUtil.alipay(smid, "购买玩湃惠民卡", "购买玩湃惠民卡", "", tPayHuimin.getCode(), string, |
| | | "/base/huimin/callBack/aliPayHuiminCallback"); |
| | | } |
| | | |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看惠民卡详情 |
| | | * 查看玩湃惠民卡详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getHuiminCardDetail") |
| | | @ApiOperation(value = "查看惠民卡详情") |
| | | @ApiOperation(value = "查看玩湃惠民卡详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "惠民卡id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "玩湃惠民卡id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "门店id", name = "storeId", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<THuiminCard> getHuiminCardDetail(Integer id,Integer storeId) { |
| | | public ResultUtil<THuiminCard> getHuiminCardDetail(Integer id, Integer storeId) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | |
| | | THuiminCard huiminCard = huiminCardService.getById(id); |
| | | List<TPayHuimin> payHuimins = payHuiminService.list(new LambdaQueryWrapper<TPayHuimin>() |
| | | .eq(TPayHuimin::getAppUserId, uid) |
| | | .ge(TPayHuimin::getEndTime,new Date()) |
| | | .ge(TPayHuimin::getEndTime, new Date()) |
| | | .eq(TPayHuimin::getStatus, 1)); |
| | | List<TPayHuimin> collect = payHuimins.stream().filter(e -> e.getCardId().equals(huiminCard.getId())).collect(Collectors.toList()); |
| | | if (!collect.isEmpty()){ |
| | | if (!collect.isEmpty()) { |
| | | huiminCard.setIsBuy(1); |
| | | }else{ |
| | | } else { |
| | | huiminCard.setIsBuy(0); |
| | | } |
| | | List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(storeId)); |
| | | if (!stores.isEmpty()){ |
| | | Store store = stores.get(0); |
| | | Integer operatorId = store.getOperatorId(); |
| | | if (operatorId==null||operatorId==0){ |
| | | // 平台门店 |
| | | THuiminAgreement huiminAgreement = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(storeId)); |
| | | if (!stores.isEmpty()) { |
| | | Store store = stores.get(0); |
| | | Integer operatorId = store.getOperatorId(); |
| | | if (operatorId == null || operatorId == 0) { |
| | | // 平台门店 |
| | | THuiminAgreement huiminAgreement = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .isNull(THuiminAgreement::getOperatorId)); |
| | | if (huiminAgreement != null) { |
| | | List<THuiminAgreementSetting> list = huiminAgreementSettingService.list(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement.getId())); |
| | | huiminCard.setAgreementSettings(list); |
| | | } else { |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | |
| | | } |
| | | } else { |
| | | // 运营商门店 |
| | | THuiminAgreement huiminAgreement = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .eq(THuiminAgreement::getOperatorId, operatorId)); |
| | | if (huiminAgreement != null) { |
| | | List<THuiminAgreementSetting> list = huiminAgreementSettingService.list(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement.getId())); |
| | | huiminCard.setAgreementSettings(list); |
| | | } else { |
| | | THuiminAgreement huiminAgreement1 = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .isNull(THuiminAgreement::getOperatorId)); |
| | | if (huiminAgreement!=null){ |
| | | if (huiminAgreement1 != null) { |
| | | List<THuiminAgreementSetting> list = huiminAgreementSettingService.list(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement.getId())); |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement1.getId())); |
| | | huiminCard.setAgreementSettings(list); |
| | | }else { |
| | | } else { |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | |
| | | } |
| | | }else{ |
| | | // 运营商门店 |
| | | THuiminAgreement huiminAgreement = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .eq(THuiminAgreement::getOperatorId,operatorId)); |
| | | if (huiminAgreement!=null){ |
| | | List<THuiminAgreementSetting> list = huiminAgreementSettingService.list(new LambdaQueryWrapper<THuiminAgreementSetting>() |
| | | .eq(THuiminAgreementSetting::getAgreementId, huiminAgreement.getId())); |
| | | huiminCard.setAgreementSettings(list); |
| | | }else { |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | } |
| | | } |
| | | }else{ |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | } |
| | | } else { |
| | | huiminCard.setAgreementSettings(new ArrayList<>()); |
| | | } |
| | | |
| | | return ResultUtil.success(huiminCard); |
| | | } catch (Exception e) { |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 惠民卡富文本内容-惠民卡列表 |
| | | * 玩湃惠民卡富文本内容-玩湃惠民卡列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getHuiminAgreementAndList") |
| | | @ApiOperation(value = "惠民卡富文本内容-惠民卡列表") |
| | | @ApiOperation(value = "玩湃惠民卡富文本内容-玩湃惠民卡列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageSize", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "页条数", name = "pageNo", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "门店id", name = "storeId", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<HuiminAgreementVO> getHuiminAgreementAndList(Integer pageSize, Integer pageNo,Integer storeId) { |
| | | public ResultUtil<HuiminAgreementVO> getHuiminAgreementAndList(Integer pageSize, Integer pageNo, Integer storeId) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | pageNo = (pageNo - 1) * pageSize; |
| | | HuiminAgreementVO huiminAgreementVO = new HuiminAgreementVO(); |
| | | List<THuiminCard> cardList = huiminCardService.getHuiminAgreementAndList(pageNo,pageSize,storeId); |
| | | List<THuiminCard> cardList = huiminCardService.getHuiminAgreementAndList(pageNo, pageSize, storeId); |
| | | List<THuiminCard> list = huiminCardService.list(); |
| | | |
| | | List<THuiminCard> cardListNolimit = huiminCardService.getHuiminAgreementAndListNolimit(storeId); |
| | | if (cardListNolimit.isEmpty()){ |
| | | // 没有配置惠民卡 展示富文本内容 |
| | | if (cardListNolimit.isEmpty()) { |
| | | // 没有配置玩湃惠民卡 展示富文本内容 |
| | | huiminAgreementVO.setShowType(1); |
| | | }else{ |
| | | } else { |
| | | huiminAgreementVO.setShowType(2); |
| | | } |
| | | List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(storeId)); |
| | | Store store = stores.get(0); |
| | | if (store.getOperatorId()==null || store.getOperatorId()==0){ |
| | | if (store.getOperatorId() == null || store.getOperatorId() == 0) { |
| | | // 平台 |
| | | THuiminAgreement one = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .isNull(THuiminAgreement::getOperatorId).last("limit 1")); |
| | | huiminAgreementVO.setIntroduce(one.getStoreNoHuiminCardIntro()); |
| | | |
| | | }else{ |
| | | } else { |
| | | THuiminAgreement one = huiminAgreementService.getOne(new LambdaQueryWrapper<THuiminAgreement>() |
| | | .eq(THuiminAgreement::getOperatorId,store.getOperatorId()).last("limit 1")); |
| | | huiminAgreementVO.setIntroduce(one.getStoreNoHuiminCardIntro()); |
| | | .eq(THuiminAgreement::getOperatorId, store.getOperatorId()).last("limit 1")); |
| | | 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<TPayHuimin> payHuimins = payHuiminService.list(new LambdaQueryWrapper<TPayHuimin>() |
| | | .eq(TPayHuimin::getAppUserId, uid) |
| | | .ge(TPayHuimin::getEndTime,new Date()) |
| | | .in(TPayHuimin::getStatus, Arrays.asList(2,3))); |
| | | .ge(TPayHuimin::getEndTime, new Date()) |
| | | .eq(TPayHuimin::getStatus, 2)); |
| | | |
| | | |
| | | List<HuiminCardVO> huiminCardVOS = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<TStudent> tStudents = studentClient.queryStudentList(uid); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | |
| | | for (TPayHuimin payHuimin : payHuimins) { |
| | | if (integers.contains(payHuimin.getCardId())){ |
| | | continue; |
| | | } |
| | | THuiminCard huiminCard = list.stream().filter(e -> e.getId().equals(payHuimin.getCardId())).findFirst().orElse(null); |
| | | if (huiminCard == null) continue; |
| | | |
| | | HuiminCardVO huiminCardVO1 = new HuiminCardVO(); |
| | | huiminCardVO1.setId(huiminCard.getId()); |
| | | huiminCardVO1.setHuiminName(huiminCard.getHuiMinName()); |
| | | huiminCardVO1.setCover(huiminCard.getBuyCover()); |
| | | huiminCardVO1.setIsBuy(1); |
| | | int count = huiminRecordService.list(new LambdaQueryWrapper<THuiminRecord>() |
| | | .eq(THuiminRecord::getPayId, payHuimin.getId())).size(); |
| | | if (count>0){ |
| | | huiminCardVOS.add(huiminCardVO1); |
| | | integers.add(payHuimin.getCardId()); |
| | | continue; |
| | | } |
| | | String siteIds = ""; |
| | | if (huiminCard.getUseScope() == 2) { |
| | | siteIds = huiminCard.getUseIds(); |
| | | } else { |
| | | siteIds = siteClient.querySiteByStoreIds(huiminCard.getStoreIds()) |
| | | .stream() |
| | | .map(Site::getId) |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | } |
| | | String storeIds = huiminCard.getStoreIds(); |
| | | if (storeIds.contains("2024")) { |
| | | siteIds = siteIds + ",32"; |
| | | } |
| | | if (storeIds.contains("1001")) { |
| | | siteIds = siteIds + ",3"; |
| | | } |
| | | // 门店ids |
| | | JSONArray sid = JSONArray.parseArray(Arrays.toString(storeIds.split(","))); |
| | | // 场地ids |
| | | JSONArray rid = JSONArray.parseArray(Arrays.toString(siteIds.split(","))); |
| | | // 可用时间 |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | int week = today.getDayOfWeek().getValue(); |
| | | |
| | | JSONArray time = JSONArray.parseArray(huiminCard.getUseWeeks()); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | String string = LocalDate.now().toString(); |
| | | Date date = new Date(); |
| | | if (date.before(huiminCard.getEndTime()) && date.after(huiminCard.getStartTime())) { |
| | | for (Object o : time) { |
| | | JSONObject jsonObject = (JSONObject) o; |
| | | for (Object days : jsonObject.getJSONArray("days")) { |
| | | JSONObject jsonObject1 = (JSONObject) days; |
| | | if (jsonObject1.getString("value").equals(String.valueOf(week)) && jsonObject1.getBoolean("checked")) { |
| | | JSONObject jsonObject2 = new JSONObject(); |
| | | String s1 = string + " " + jsonObject.getString("startTime") + ":00"; |
| | | String e1 = string + " " + jsonObject.getString("endTime") + ":00"; |
| | | // 转化为Date类型 |
| | | 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)) { |
| | | // jsonObject2.put("start_time", start.getTime() / 1000); |
| | | Date date1 = new Date(); |
| | | jsonObject2.put("start_time", date1.getTime() / 1000); |
| | | date1.setTime(date1.getTime() + 30 * 1000); |
| | | if (start.before(end)) { |
| | | jsonObject2.put("end_time", date1.getTime() / 1000); |
| | | jsonArray.add(jsonObject2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | 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\":\"" + payHuimin.getStudentId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; |
| | | huiminCardVO1.setQrCode(temp); |
| | | huiminCardVOS.add(huiminCardVO1); |
| | | integers.add(payHuimin.getCardId()); |
| | | |
| | | } |
| | | } |
| | | for (THuiminCard huiminCardVO : cardList) { |
| | | HuiminCardVO huiminCardVO1 = new HuiminCardVO(); |
| | | huiminCardVO1.setId(huiminCardVO.getId()); |
| | | List<TPayHuimin> collect = payHuimins.stream().filter(e -> e.getCardId().equals(huiminCardVO.getId())).collect(Collectors.toList()); |
| | | if (!collect.isEmpty()){ |
| | | if (!collect.isEmpty()) { |
| | | for (TPayHuimin tPayHuimin : collect) { |
| | | if (tPayHuimin.getStatus().equals(2)){ |
| | | if (tPayHuimin.getStatus().equals(2)) { |
| | | huiminCardVO1.setCover(huiminCardVO.getBuyCover()); |
| | | huiminCardVO1.setIsBuy(1); |
| | | break; |
| | | }else{ |
| | | } else { |
| | | huiminCardVO1.setCover(huiminCardVO.getUnBuyCover()); |
| | | huiminCardVO1.setIsBuy(0); |
| | | } |
| | | } |
| | | }else{ |
| | | } else { |
| | | huiminCardVO1.setCover(huiminCardVO.getUnBuyCover()); |
| | | huiminCardVO1.setIsBuy(0); |
| | | } |
| | | huiminCardVOS.add(huiminCardVO1); |
| | | } |
| | | huiminAgreementVO.setCardList(huiminCardVOS); |
| | | // 手动对huiminCardVOS进行分页 |
| | | if (pageNo < 1) { |
| | | pageNo = 1; |
| | | } |
| | | if (pageSize < 1) { |
| | | pageSize = 10; // 默认每页10条 |
| | | } |
| | | |
| | | int startIndex = (pageNo - 1) * pageSize; |
| | | int endIndex = Math.min(startIndex + pageSize, huiminCardVOS.size()); |
| | | // 防止 startIndex 超过 huiminCardVOS.size() |
| | | if (startIndex > huiminCardVOS.size()) { |
| | | startIndex = huiminCardVOS.size(); |
| | | } |
| | | List<HuiminCardVO> paginatedHuiminCardVOS = huiminCardVOS.subList(startIndex, endIndex); |
| | | // 将分页后的数据设置到 huiminAgreementVO 中 |
| | | huiminAgreementVO.setCardList(paginatedHuiminCardVOS); |
| | | // 将分页后的数据设置到 huiminAgreementVO 中 |
| | | huiminAgreementVO.setCardList(paginatedHuiminCardVOS); |
| | | // huiminAgreementVO.setCardList(huiminCardVOS); |
| | | return ResultUtil.success(huiminAgreementVO); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.success(new HuiminAgreementVO()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 惠民卡富文本内容-惠民卡列表 |
| | | * 玩湃惠民卡列表-根据玩湃惠民卡获取已购买绑定玩湃惠民卡的学员列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getStudentListByCarId") |
| | | @ApiOperation(value = "玩湃惠民卡列表-根据玩湃惠民卡获取已购买绑定玩湃惠民卡的学员列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "玩湃惠民卡id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TStudent>> getStudentListByCarId(Integer id) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<TPayHuimin> payHuimins = payHuiminService.list(new LambdaQueryWrapper<TPayHuimin>() |
| | | .eq(TPayHuimin::getAppUserId, uid) |
| | | .eq(TPayHuimin::getCardId, id) |
| | | .ge(TPayHuimin::getEndTime, new Date()) |
| | | .eq(TPayHuimin::getStatus, 2)); |
| | | List<THuiminCard> huiminCards = huiminCardService.list(); |
| | | List<Integer> studentIds = new ArrayList<>(); |
| | | for (TPayHuimin payHuimin : payHuimins) { |
| | | THuiminCard huiminCard = huiminCards.stream().filter(e -> e.getId().equals(payHuimin.getCardId())).findFirst().orElse(null); |
| | | if (huiminCard != null) { |
| | | String siteIds = ""; |
| | | if (huiminCard.getUseScope() == 2) { |
| | | siteIds = huiminCard.getUseIds(); |
| | | } else { |
| | | siteIds = siteClient.querySiteByStoreIds(huiminCard.getStoreIds()) |
| | | .stream() |
| | | .map(Site::getId) |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | } |
| | | String storeIds = huiminCard.getStoreIds(); |
| | | if (storeIds.contains("2024")) { |
| | | siteIds = siteIds + ",32"; |
| | | } |
| | | if (storeIds.contains("1001")) { |
| | | siteIds = siteIds + ",3"; |
| | | } |
| | | // 门店ids |
| | | JSONArray sid = JSONArray.parseArray(Arrays.toString(storeIds.split(","))); |
| | | // 场地ids |
| | | JSONArray rid = JSONArray.parseArray(Arrays.toString(siteIds.split(","))); |
| | | // 可用时间 |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | int week = today.getDayOfWeek().getValue(); |
| | | |
| | | JSONArray time = JSONArray.parseArray(huiminCard.getUseWeeks()); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | String string = LocalDate.now().toString(); |
| | | |
| | | Date date = new Date(); |
| | | |
| | | if (date.before(huiminCard.getEndTime()) && date.after(huiminCard.getStartTime())) { |
| | | for (Object o : time) { |
| | | JSONObject jsonObject = (JSONObject) o; |
| | | for (Object days : jsonObject.getJSONArray("days")) { |
| | | JSONObject jsonObject1 = (JSONObject) days; |
| | | if (jsonObject1.getString("value").equals(String.valueOf(week)) && jsonObject1.getBoolean("checked")) { |
| | | JSONObject jsonObject2 = new JSONObject(); |
| | | String s1 = string + " " + jsonObject.getString("startTime") + ":00"; |
| | | String e1 = string + " " + jsonObject.getString("endTime") + ":00"; |
| | | // 转化为Date类型 |
| | | 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)) { |
| | | // jsonObject2.put("start_time", start.getTime() / 1000); |
| | | Date date1 = new Date(); |
| | | jsonObject2.put("start_time", date1.getTime() / 1000); |
| | | date1.setTime(date1.getTime() + 30 * 1000); |
| | | if (start.before(end)) { |
| | | jsonObject2.put("end_time", date1.getTime() / 1000); |
| | | jsonArray.add(jsonObject2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!jsonArray.isEmpty()) { |
| | | // 将学员加入 |
| | | String[] split = payHuimin.getStudentId().split(","); |
| | | for (String s : split) { |
| | | studentIds.add(Integer.valueOf(s)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | String collect = studentIds.stream().map(String::valueOf).collect(Collectors.joining(",")); |
| | | List<TStudent> studentByIds = studentClient.getStudentByIds(collect); |
| | | return ResultUtil.success(studentByIds); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 玩湃惠民卡列表-选择学员后返回对应的二维码生成规则和有效期结束时间 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getQrCodeByStudentId") |
| | | @ApiOperation(value = "玩湃惠民卡列表-选择学员后返回对应的二维码生成规则和有效期结束时间") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "玩湃惠民卡id", name = "cardId", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "学员id", name = "studentId", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<HuiminCardStudentVO> getQrCodeByStudentId(Integer cardId, Integer studentId) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<TStudent> tStudents = studentClient.queryStudentList(uid); |
| | | |
| | | List<TPayHuimin> payHuimins = payHuiminService.list(new LambdaQueryWrapper<TPayHuimin>() |
| | | .apply("FIND_IN_SET(" + studentId + ", studentId) > 0") |
| | | // .eq(TPayHuimin::getStudentId, studentId) |
| | | .eq(TPayHuimin::getCardId, cardId) |
| | | .ge(TPayHuimin::getEndTime, new Date()) |
| | | .eq(TPayHuimin::getStatus, 2) |
| | | |
| | | .orderByDesc(TPayHuimin::getEndTime)); |
| | | HuiminCardStudentVO huiminCardStudentVO = new HuiminCardStudentVO(); |
| | | |
| | | if (!payHuimins.isEmpty()) { |
| | | TPayHuimin tPayHuimin = payHuimins.get(0); |
| | | THuiminCard huiminCard = huiminCardService.getById(cardId); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | huiminCardStudentVO.setEndTime(simpleDateFormat.format(tPayHuimin.getEndTime())); |
| | | String siteIds = ""; |
| | | if (huiminCard.getUseScope() == 2) { |
| | | siteIds = huiminCard.getUseIds(); |
| | | } else { |
| | | siteIds = siteClient.querySiteByStoreIds(huiminCard.getStoreIds()) |
| | | .stream() |
| | | .map(Site::getId) |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | } |
| | | String storeIds = huiminCard.getStoreIds(); |
| | | if (storeIds.contains("2024")) { |
| | | siteIds = siteIds + ",32"; |
| | | } |
| | | if (storeIds.contains("1001")) { |
| | | siteIds = siteIds + ",3"; |
| | | } |
| | | // 门店ids |
| | | JSONArray sid = JSONArray.parseArray(Arrays.toString(storeIds.split(","))); |
| | | // 场地ids |
| | | JSONArray rid = JSONArray.parseArray(Arrays.toString(siteIds.split(","))); |
| | | // 可用时间 |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | int week = today.getDayOfWeek().getValue(); |
| | | |
| | | JSONArray time = JSONArray.parseArray(huiminCard.getUseWeeks()); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | String string = LocalDate.now().toString(); |
| | | |
| | | Date date = new Date(); |
| | | |
| | | if (date.before(huiminCard.getEndTime()) && date.after(huiminCard.getStartTime())) { |
| | | for (Object o : time) { |
| | | JSONObject jsonObject = (JSONObject) o; |
| | | for (Object days : jsonObject.getJSONArray("days")) { |
| | | JSONObject jsonObject1 = (JSONObject) days; |
| | | if (jsonObject1.getString("value").equals(String.valueOf(week)) && jsonObject1.getBoolean("checked")) { |
| | | JSONObject jsonObject2 = new JSONObject(); |
| | | String s1 = string + " " + jsonObject.getString("startTime") + ":00"; |
| | | String e1 = string + " " + jsonObject.getString("endTime") + ":00"; |
| | | // 转化为Date类型 |
| | | Date start = DateUtil.parse(s1, "yyyy-MM-dd HH:mm:ss"); |
| | | Date end = DateUtil.parse(e1, "yyyy-MM-dd HH:mm:ss"); |
| | | jsonObject2.put("start_time", start.getTime() / 1000); |
| | | start.setTime(start.getTime() + 30 * 1000); |
| | | if (new Date().after(start) && new Date().before(end)) { |
| | | // jsonObject2.put("start_time", start.getTime() / 1000); |
| | | Date date1 = new Date(); |
| | | jsonObject2.put("start_time", date1.getTime() / 1000); |
| | | date1.setTime(date1.getTime() + 30 * 1000); |
| | | if (start.before(end)) { |
| | | jsonObject2.put("end_time", date1.getTime() / 1000); |
| | | jsonArray.add(jsonObject2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tPayHuimin.getStudentId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; |
| | | huiminCardStudentVO.setQrCode(temp); |
| | | TStudent tStudent = tStudents.stream().filter(e -> e.getId().equals(studentId)).findFirst().orElse(null); |
| | | if (tStudent!=null){ |
| | | huiminCardStudentVO.setStudentName(tStudent.getName()); |
| | | } |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(huiminCardStudentVO); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 玩湃惠民卡富文本内容-玩湃惠民卡列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/myHuiminCardList") |
| | | @ApiOperation(value = "个人中心-我的惠民卡") |
| | | @ApiOperation(value = "个人中心-我的玩湃惠民卡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageSize", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "页条数", name = "pageNo", dataType = "int", required = true), |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | pageNo = (pageNo - 1) * pageSize; |
| | | List<MyHuiminCardVO> cardList = huiminCardService.getMyHuiminCardList(pageNo,pageSize,uid); |
| | | List<MyHuiminCardVO> cardList = huiminCardService.getMyHuiminCardList(pageNo, pageSize, uid); |
| | | 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())); |
| | | .eq(THuiminRecord::getPayId, byId.getId())); |
| | | // 购卡7日内没有使用记录可退款。超过7日不管有没有使用记录都不能退款 |
| | | if (new Date().after(DateUtil.addDay(myHuiminCardVO.getPaymentTime(),7))){ |
| | | if (new Date().after(DateUtil.addDay(myHuiminCardVO.getPaymentTime(), 7))) { |
| | | // 超过七天不可退款 |
| | | myHuiminCardVO.setIsRefund(0); |
| | | }else if (count>=7){ |
| | | } else if (count > 0) { |
| | | myHuiminCardVO.setIsRefund(0); |
| | | }else{ |
| | | } else { |
| | | myHuiminCardVO.setIsRefund(1); |
| | | } |
| | | if (byId.getStatus()==4){ |
| | | // 退款中 |
| | | myHuiminCardVO.setIsRefund(2); |
| | | |
| | | } |
| | | THuiminCard huiminCard = list.stream().filter(e -> e.getId().equals(myHuiminCardVO.getCardId())).findFirst().orElse(null); |
| | | if (null!=huiminCard){ |
| | | 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<>()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 个人中心-我的惠民卡-退款 |
| | | * 个人中心-我的玩湃惠民卡-退款 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/refund") |
| | | @ApiOperation(value = "个人中心-我的惠民卡-退款") |
| | | @ApiOperation(value = "个人中心-我的玩湃惠民卡-退款") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付记录id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | TPayHuimin tPayHuimin = payHuiminService.getById(id); |
| | | if (tPayHuimin==null){ |
| | | if (tPayHuimin == null) { |
| | | return ResultUtil.error("订单不存在"); |
| | | } |
| | | if (tPayHuimin.getStatus()==3 && tPayHuimin.getRefundStatus()!=1){ |
| | | if (tPayHuimin.getStatus() == 3 && tPayHuimin.getRefundStatus() != 1) { |
| | | return ResultUtil.error("不可重复退款"); |
| | | } |
| | | if (tPayHuimin.getEndTime().before(new Date())){ |
| | | |
| | | if (tPayHuimin.getEndTime().before(new Date())) { |
| | | // 已过期 |
| | | return ResultUtil.error("惠民卡已过期,不可退款"); |
| | | return ResultUtil.error("玩湃惠民卡已过期,不可退款"); |
| | | } |
| | | int count = huiminRecordService.count(new LambdaQueryWrapper<THuiminRecord>() |
| | | .eq(THuiminRecord::getHuiminCardId, tPayHuimin.getCardId())); |
| | | tPayHuimin.setStatus(4); |
| | | payHuiminService.updateById(tPayHuimin); |
| | | int count = huiminRecordService.list(new LambdaQueryWrapper<THuiminRecord>() |
| | | .eq(THuiminRecord::getPayId, tPayHuimin.getId())).size(); |
| | | |
| | | // 购卡7日内没有使用记录可退款。超过7日不管有没有使用记录都不能退款 |
| | | if (new Date().after(DateUtil.addDay(tPayHuimin.getPaymentTime(),7))){ |
| | | if (new Date().after(DateUtil.addDay(tPayHuimin.getPaymentTime(), 7))) { |
| | | // 超过七天不可退款 |
| | | return ResultUtil.error("惠民卡购买超过七天,不可退款"); |
| | | }else if (count>=7){ |
| | | // 使用记录大于等于7次不可退款 |
| | | return ResultUtil.error("惠民卡使用记录大于等于7次,不可退款"); |
| | | return ResultUtil.error("玩湃惠民卡购买超过七天,不可退款"); |
| | | } else if (count > 0) { |
| | | return ResultUtil.error("玩湃惠民卡已使用,不可退款"); |
| | | } |
| | | if (tPayHuimin.getPaymentType()==1){ |
| | | if (tPayHuimin.getPaymentType() == 1) { |
| | | Map<String, String> map = payMoneyUtil.wxRefund(tPayHuimin.getOrderNumber(), tPayHuimin.getCode(), |
| | | tPayHuimin.getSalesMoney().toString(), tPayHuimin.getSalesMoney().toString(), "/base/huimin/callBack/wxRefundHuiminCallback"); |
| | | if(!"SUCCESS".equals(map.get("return_code"))){ |
| | | if (!"SUCCESS".equals(map.get("return_code"))) { |
| | | System.err.println("-------------微信退款失败---------"); |
| | | System.err.println(map.get("return_msg")); |
| | | return ResultUtil.error("微信退款失败"); |
| | | } |
| | | }else{ |
| | | } else { |
| | | Map<String, String> map = payMoneyUtil.aliRefund(tPayHuimin.getOrderNumber(), tPayHuimin.getSalesMoney().toString()); |
| | | String return_code = map.get("code"); |
| | | if (!"10000".equals(return_code)) { |
| | |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 个人中心-我的惠民卡-查看详情 |
| | | * 个人中心-我的玩湃惠民卡-查看详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/myHuiminCardDetail") |
| | | @ApiOperation(value = "个人中心-我的惠民卡-查看详情") |
| | | @ApiOperation(value = "个人中心-我的玩湃惠民卡-查看详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付记录id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | TPayHuimin tPayHuimin = payHuiminService.getById(id); |
| | | if (tPayHuimin==null){ |
| | | return ResultUtil.error("惠民卡不存在"); |
| | | if (tPayHuimin == null) { |
| | | return ResultUtil.error("玩湃惠民卡不存在"); |
| | | } |
| | | THuiminCard byId = huiminCardService.getById(tPayHuimin.getCardId()); |
| | | MyHuiminCardDetailVO myHuiminCardDetailVO = new MyHuiminCardDetailVO(); |
| | | List<TStudent> studentByIds1 = studentClient.getStudentByIds(tPayHuimin.getStudentId()); |
| | | if (CollUtil.isNotEmpty(studentByIds1)) { |
| | | myHuiminCardDetailVO.setStudentName(studentByIds1.get(0).getName()); |
| | | } |
| | | String siteIds = ""; |
| | | if (byId.getUseScope()==2){ |
| | | if (byId.getUseScope() == 2) { |
| | | siteIds = byId.getUseIds(); |
| | | }else{ |
| | | } else { |
| | | siteIds = siteClient.querySiteByStoreIds(byId.getStoreIds()) |
| | | .stream() |
| | | .map(Site::getId) |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | } |
| | | String temp ="{\"siteIds\":\"" +siteIds+"\","+"\"useTimes:\"\""+byId.getUseWeeks()+"\","+"\"unUseTimes:\""+byId.getUnUseTimes()+"\"}"; |
| | | String storeIds = byId.getStoreIds(); |
| | | if (storeIds.contains("2024")) { |
| | | siteIds = siteIds + ",32"; |
| | | } |
| | | if (storeIds.contains("1001")) { |
| | | siteIds = siteIds + ",3"; |
| | | } |
| | | // 门店ids |
| | | JSONArray sid = JSONArray.parseArray(Arrays.toString(storeIds.split(","))); |
| | | // 场地ids |
| | | JSONArray rid = JSONArray.parseArray(Arrays.toString(siteIds.split(","))); |
| | | // 可用时间 |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | int week = today.getDayOfWeek().getValue(); |
| | | |
| | | JSONArray time = JSONArray.parseArray(byId.getUseWeeks()); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | String string = LocalDate.now().toString(); |
| | | |
| | | Date date = new Date(); |
| | | |
| | | if (date.before(byId.getEndTime()) && date.after(byId.getStartTime())) { |
| | | for (Object o : time) { |
| | | JSONObject jsonObject = (JSONObject) o; |
| | | for (Object days : jsonObject.getJSONArray("days")) { |
| | | JSONObject jsonObject1 = (JSONObject) days; |
| | | if (jsonObject1.getString("value").equals(String.valueOf(week)) && jsonObject1.getBoolean("checked")) { |
| | | JSONObject jsonObject2 = new JSONObject(); |
| | | String s1 = string + " " + jsonObject.getString("startTime") + ":00"; |
| | | String e1 = string + " " + jsonObject.getString("endTime") + ":00"; |
| | | // 转化为Date类型 |
| | | Date start = DateUtil.parse(s1, "yyyy-MM-dd HH:mm:ss"); |
| | | Date end = DateUtil.parse(e1, "yyyy-MM-dd HH:mm:ss"); |
| | | jsonObject2.put("start_time", start.getTime() / 1000); |
| | | start.setTime(start.getTime() + 30 * 1000); |
| | | if (new Date().after(start) && new Date().before(end)) { |
| | | // jsonObject2.put("start_time", start.getTime() / 1000); |
| | | Date date1 = new Date(); |
| | | jsonObject2.put("start_time", date1.getTime() / 1000); |
| | | date1.setTime(date1.getTime() + 30 * 1000); |
| | | if (start.before(end)) { |
| | | jsonObject2.put("end_time", date1.getTime() / 1000); |
| | | jsonArray.add(jsonObject2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String temp = "{\"id\":"+tPayHuimin.getId() + ","+"\"sid\":" + sid.toJSONString() + "," + "\"rid\":" + rid + "," + "\"uid\":\"" + tPayHuimin.getStudentId() + "\"," + "\"time\":" + jsonArray.toJSONString() + ",\"type\":" + 2 + "}"; |
| | | myHuiminCardDetailVO.setQrCode(temp); |
| | | myHuiminCardDetailVO.setCardId(tPayHuimin.getCardId()); |
| | | myHuiminCardDetailVO.setHuiminCard(byId); |
| | |
| | | return ResultUtil.success(new MyHuiminCardDetailVO()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取添加人员、选择人员说明文案 |
| | | */ |
| | |
| | | } |
| | | THuiminAgreement one = huiminAgreementService.lambdaQuery() |
| | | .isNull(THuiminAgreement::getOperatorId).last("limit 1").one(); |
| | | return ResultUtil.success(one); |
| | | return ResultUtil.success(one); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.success(new THuiminAgreement()); |