if (voucher.getBeginTime().isAfter(LocalDateTime.now()))
时间: 2024-04-04 22:35:12 浏览: 122
这段代码使用了Java 8中的日期时间API。其中 `voucher.getBeginTime()` 返回了一个 `LocalDateTime` 对象,表示抵用券的开始时间。`LocalDateTime.now()` 返回了当前系统时间。`isAfter()` 方法是 `LocalDateTime` 类的一个方法,用来比较两个日期时间的先后顺序,如果当前时刻在抵用券开始时间之后,那么这个条件表达式的值为 `true`,否则为 `false`。因此,这段代码的意思是判断当前时刻是否在抵用券的有效期内,如果在有效期内,则返回 `true`,否则返回 `false`。
相关问题
insert table cdata_safe_income_new_day_analysis_item_status with t1 as ( select if(a.app_id is null,b.app_id,a.app_id) as app_id, if(a.product is null,b.product,a.product) as product, if(a.item_code_name is null,b.item_code_name,a.item_code_name) as item_code_name, case when a.app_id is null and (if(a.tiaozhang_cnt is null,0,a.tiaozhang_cnt) + if(b.tiaozhang_cnt is null,0,b.tiaozhang_cnt)) > 0 then '调账影响' when b.app_id is null and (if(a.tiaozhang_cnt is null,0,a.tiaozhang_cnt) + if(b.tiaozhang_cnt is null,0,b.tiaozhang_cnt)) > 0 then '调账影响' when a.app_id is null and (if(a.tuifei_cnt is null,0,a.tuifei_cnt) + if(b.tuifei_cnt is null,0,b.tuifei_cnt)) > 0 then '退费影响' when b.app_id is null and (if(a.tuifei_cnt is null,0,a.tuifei_cnt) + if(b.tuifei_cnt is null,0,b.tuifei_cnt)) > 0 then '退费影响' when a.app_id is null and c.voucher_begin > 0 then '优惠券影响' --- 原:续费使用了代金券 when a.app_id is null and c.voucher_end > 0 and change_order_cnt = 0 then '优惠券影响' --- 原:续费使用了代金券 when b.app_id is null and c.voucher_begin > 0 then '优惠券影响' --- 原:续费由代金券转为正常 when b.app_id is null and c.voucher_end > 0 and change_order_cnt = 0 then '优惠券影响' --- 原:续费由代金券转为正常 else 'item维度正常' end flag_status from (select app_id, product,item_code_name,sum(if(paymode_type = '调账',1,0)) as tiaozhang_cnt, sum(if(instr(paymode,'退费')>0,1,0)) as tuifei_cnt from cdata_safe_income_new_day where ftime = '${YYYYMMDD}' and paymode != '0元订单' and prod_class1_name = '基础安全' and prod_class2_name = '云原生安全' and product is not null and pay_type = '公有云' group by app_id,product,item_code_name ) a full join
cdata_safe_income_new_day_analysis_item_status 表中插入数据的SQL语句是:
```sql
insert table cdata_safe_income_new_day_analysis_item_status
with t1 as (
select if(a.app_id is null,b.app_id,a.app_id) as app_id,
if(a.product is null,b.product,a.product) as product,
if(a.item_code_name is null,b.item_code_name,a.item_code_name) as item_code_name,
case
when a.app_id is null and (if(a.tiaozhang_cnt is null,0,a.tiaozhang_cnt) + if(b.tiaozhang_cnt is null,0,b.tiaozhang_cnt)) > 0 then '调账影响'
when b.app_id is null and (if(a.tiaozhang_cnt is null,0,a.tiaozhang_cnt) + if(b.tiaozhang_cnt is null,0,b.tiaozhang_cnt)) > 0 then '调账影响'
when a.app_id is null and (if(a.tuifei_cnt is null,0,a.tuifei_cnt) + if(b.tuifei_cnt is null,0,b.tuifei_cnt)) > 0 then '退费影响'
when b.app_id is null and (if(a.tuifei_cnt is null,0,a.tuifei_cnt) + if(b.tuifei_cnt is null,0,b.tuifei_cnt)) > 0 then '退费影响'
when a.app_id is null and c.voucher_begin > 0 then '优惠券影响'
when a.app_id is null and c.voucher_end > 0 and change_order_cnt = 0 then '优惠券影响'
when b.app_id is null and c.voucher_begin > 0 then '优惠券影响'
when b.app_id is null and c.voucher_end > 0 and change_order_cnt = 0 then '优惠券影响'
else 'item维度正常'
end flag_status
from (
select app_id,
product,
item_code_name,
sum(if(paymode_type = '调账',1,0)) as tiaozhang_cnt,
sum(if(instr(paymode,'退费')>0,1,0)) as tuifei_cnt
from cdata_safe_income_new_day
where ftime = '${YYYYMMDD}'
and paymode != '0元订单'
and prod_class1_name = '基础安全'
and prod_class2_name = '云原生安全'
and product is not null
and pay_type = '公有云'
group by app_id,product,item_code_name
) a
full join <表名> b on <条件>
)
select * from t1;
```
其中 `<表名>` 和 `<条件>` 表示需要进行全连接的另外一个表的表名和连接条件。请在实际使用时将其替换为正确的表名和条件。
<view class="describle item">{{ info.desc }}</view> <view class="date item" wx:if="{{ info.voucher }}"> <view class="label">取货凭证</view> <view >{{ info.voucher }}</view> </view> </view>怎样实现让认领人和发布人看到取货凭证
要实现让认领人和发布人都能看到取货凭证,可以在后台数据库中存储认领人的openid和发布人的openid,并建立对应关系。在小程序页面中,判断当前用户的openid是否与认领人的openid或发布人的openid一致,如果一致,则显示取货凭证信息。
例如,在小程序页面中可以使用以下代码实现让认领人和发布人都能看到取货凭证:
```javascript
// 获取本地缓存中的openid
let openid = wx.getStorageSync('openid');
// 判断当前用户的openid是否与认领人的openid或发布人的openid一致
if (info.claimer === openid || info.publisher === openid) {
// 显示取货凭证信息
<view class="date item" wx:if="{{ info.voucher }}">
<view class="label">取货凭证</view>
<view >{{ info.voucher }}</view>
</view>
}
```
其中,info.claimer是认领人的openid,info.publisher是发布人的openid,info.voucher是取货凭证信息。如果当前用户的openid与认领人的openid或发布人的openid一致,则显示取货凭证信息。
需要注意的是,这种方法同样存在安全性问题,如果认领人或发布人将自己的openid分享给其他人,其他人仍然可以通过openid获取到该认领人或发布人的取货凭证信息。因此,在设计系统时还需要考虑其他安全性措施,如加密算法、防盗链等。
阅读全文