| | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | |
| | | import java.sql.Ref; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | .eq("status",Constants.ZERO) |
| | | .orderByDesc("create_date") |
| | | )); |
| | | if(systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.IS_STOP_SERVE).getCode().equals(Constants.ONE)){ |
| | | String stopServeStartTime = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.STOP_SERVE_STARTTIME).getCode(); |
| | | String stopServeEndTime = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.STOP_SERVE_ENDTIME).getCode(); |
| | | //查询当前时间是否在停止中 |
| | | long s = DateUtil.StringToDate(stopServeStartTime).getTime(); |
| | | long e = DateUtil.StringToDate(stopServeEndTime).getTime(); |
| | | if(e>System.currentTimeMillis()&&s<=System.currentTimeMillis()){ |
| | | homeResponse.setIsStopServe(Constants.ONE); |
| | | } |
| | | } |
| | | //查询是否存在 已支付的 押金订单 |
| | | Integer status = this.goodsorderMapper.selectCount(new QueryWrapper<Goodsorder>() |
| | | .eq("member_id",memberId) |
| | |
| | | String nowTime = DateUtil.getDate(new Date(),"HH:mm"); |
| | | if(Integer.valueOf(nowTime.replace(":",""))<= Integer.valueOf(businessStartTime.replace(":","")) |
| | | ||Integer.valueOf(nowTime.replace(":","")) > Integer.valueOf(businessEndTime.replace(":",""))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前时间暂未营业服务,请注意查看营业时间"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"营业时间为06:00 ~ 23:59,请在营业时间内使用本系统"); |
| | | } |
| | | } |
| | | |
| | |
| | | long s = DateUtil.StringToDate(stopServeStartTime).getTime(); |
| | | long e = DateUtil.StringToDate(stopServeEndTime).getTime(); |
| | | if(e>System.currentTimeMillis()&&s<=System.currentTimeMillis()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前小程序停止服务,请注意查看公告"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.STOP_SERVE_TIPS).getCode()); |
| | | } |
| | | } |
| | | } |
| | |
| | | ridesDetailResponse.setBikeType(pricingRule.getBikeType()); |
| | | ridesDetailResponse.setDuration(durationSum); |
| | | ridesDetailResponse.setMemberRidesResponseList(collect); |
| | | Refund refund = new Refund(); |
| | | |
| | | RefundDTO refundDTO = new RefundDTO(); |
| | | refundDTO.setOrderId(orderId); |
| | | refundDTO.setCanBalance(goodsorder.getMoney()); |
| | | refundDTO.setRefundAmount(goodsorder.getMoney().subtract(ridesDetailResponse.getAmount())); |
| | | refundDTO.setTotalAmount(goodsorder.getMoney()); |
| | | refundDTO.setMemberId(goodsorder.getMemberId()); |
| | | refundDTO.setReason("用户主动退款"); |
| | | refundDTO.setType(Constants.REFUND_TYPE.NORMAL.getKey()); |
| | | Refund refund = wxMiniUtilService.wxRefund(refundDTO); |
| | | //若消费金额 大于 订单押金,则不进行退款业务 |
| | | if(goodsorder.getMoney().compareTo(ridesDetailResponse.getAmount())>Constants.ZERO){ |
| | | RefundDTO refundDTO = new RefundDTO(); |
| | | refundDTO.setOrderId(orderId); |
| | | refundDTO.setCanBalance(goodsorder.getMoney()); |
| | | refundDTO.setRefundAmount(goodsorder.getMoney().subtract(ridesDetailResponse.getAmount())); |
| | | refundDTO.setTotalAmount(goodsorder.getMoney()); |
| | | refundDTO.setMemberId(goodsorder.getMemberId()); |
| | | refundDTO.setReason("用户主动退款"); |
| | | refundDTO.setType(Constants.REFUND_TYPE.NORMAL.getKey()); |
| | | refund = wxMiniUtilService.wxRefund(refundDTO); |
| | | } |
| | | |
| | | //存储 消费 交易流水 |
| | | |
| | | Transactions transactions = new Transactions(); |
| | | transactions.setMemberId(refundDTO.getMemberId()); |
| | | transactions.setMemberId(goodsorder.getMemberId()); |
| | | transactions.setCreateDate(new Date()); |
| | | transactions.setIsdeleted(Constants.ZERO); |
| | | transactions.setOrderId(refundDTO.getOrderId()); |
| | | transactions.setMoney(ridesDetailResponse.getAmount()); |
| | | transactions.setOrderId(orderId); |
| | | transactions.setMoney(goodsorder.getMoney().compareTo(ridesDetailResponse.getAmount())<=Constants.ZERO?goodsorder.getMoney():ridesDetailResponse.getAmount()); |
| | | transactions.setType(Constants.transactionsType.consumption); |
| | | transactions.setDoneDate(new Date()); |
| | | transactions.setTitle("消费结算"); |
| | | transactions.setContent("结算实际消费"); |
| | | transactions.setBalance(BigDecimal.ZERO); |
| | | transactions.setObjId(refund.getId()); |
| | | transactions.setObjId(orderId); |
| | | transactions.setObjType(Constants.ONE); |
| | | transactionsMapper.insert(transactions); |
| | | |
| | |
| | | update.setId(goodsorder.getId()); |
| | | update.setStatus(Constants.GOODSORDER_STATUS.CLOSE.getKey()); |
| | | update.setCloseMoney(goodsorder.getMoney().subtract(ridesDetailResponse.getAmount())); |
| | | update.setCloseId(refund.getId()); |
| | | update.setCloseDate(refund.getDoneDate()); |
| | | update.setCloseInfo(refund.getInfo()); |
| | | update.setCloseId(!Objects.isNull(refund)?refund.getId():null); |
| | | update.setCloseDate(!Objects.isNull(refund)?refund.getDoneDate():null); |
| | | update.setCloseInfo(!Objects.isNull(refund)?refund.getInfo():null); |
| | | update.setCloseType(Constants.ONE); |
| | | goodsorderMapper.updateById(update); |
| | | } |