| | |
| | | import java.net.UnknownHostException; |
| | | |
| | | import java.sql.Ref; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | homeResponse.setLeaseVideoUrl(systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.RENT_TIPS_VIDEO).getCode()); |
| | | homeResponse.setPricingRules(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PRICING_RULE).getCode()); |
| | | homeResponse.setStopServeTips(systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.STOP_SERVE_TIPS).getCode()); |
| | | homeResponse.setIsStopServe(Constants.ZERO); |
| | | homeResponse.setIsStopServe(this.checkTemporaryStop()?1:0); |
| | | homeResponse.setIsBusiness(this.checkBusiness()?0:1); |
| | | homeResponse.setUnBusinessTips("营业时间为"+ systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.BUSINESS_STARTTIME).getCode() +" ~ "+systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.BUSINESS_ENDTIME).getCode()+",请在营业时间内使用本系统"); |
| | | homeResponse.setAdList(adMapper.selectList(new QueryWrapper<Ad>() |
| | | .eq("isdeleted",Constants.ZERO) |
| | | .eq("status",Constants.ZERO) |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"已支付过定金,无法重复该操作"); |
| | | } |
| | | //是否处于小程序停止服务时间内 |
| | | this.checkTemporaryStop(); |
| | | if(this.checkTemporaryStop()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.STOP_SERVE_TIPS).getCode()); |
| | | }; |
| | | //是否处于营业时间 |
| | | this.checkBusiness(); |
| | | if(this.checkBusiness()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"营业时间为"+ systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.BUSINESS_STARTTIME).getCode() +" ~ "+systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.BUSINESS_ENDTIME).getCode()+",请在营业时间内使用本系统"); |
| | | }; |
| | | Goodsorder goodsorder = new Goodsorder(); |
| | | goodsorder.setId(Constants.getUUID()); |
| | | goodsorder.setCreateDate(new Date()); |
| | |
| | | * 验证营业时间 |
| | | */ |
| | | @Override |
| | | public void checkBusiness(){ |
| | | public Boolean checkBusiness(){ |
| | | String businessStartTime = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.BUSINESS_STARTTIME).getCode(); |
| | | String businessEndTime = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.BUSINESS_ENDTIME).getCode(); |
| | | String nowTime = DateUtil.getDate(new Date(),"HH:mm"); |
| | | LocalTime currentTime = LocalTime.now(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); |
| | | String nowTime = currentTime.format(formatter); |
| | | if(Integer.valueOf(nowTime.replace(":",""))<= Integer.valueOf(businessStartTime.replace(":","")) |
| | | ||Integer.valueOf(nowTime.replace(":","")) > Integer.valueOf(businessEndTime.replace(":",""))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"营业时间为06:00 ~ 23:59,请在营业时间内使用本系统"); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 临时停止服务 未交押金的用户,无法扫车使用;已经交过押金的用户可以继续扫码骑行; |
| | | */ |
| | | @Override |
| | | public void checkTemporaryStop(){ |
| | | public Boolean checkTemporaryStop(){ |
| | | 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()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.STOP_SERVE_TIPS).getCode()); |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |