|
|
@@ -1,5 +1,7 @@
|
|
|
package com.cyksj.web.controller.invoice;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.model.request.UserInvoiceOrderReq;
|
|
|
@@ -44,7 +46,17 @@ public class UserInvoiceFrontController {
|
|
|
public Result<SearchResult<UserInvoiceChoseOrderViews>> getOrders() {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
+ String dateCondition;
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ String thisSixMontStr = DateUtil.thisYear() + "-06-01";
|
|
|
+ //当前时间达到6月份 可开发票的订单只能是24年的 去年的发票只能截至到次年5月底
|
|
|
+ if (now.isAfter(DateUtil.parse(thisSixMontStr))) {
|
|
|
+ dateCondition = String.format(" and o.created_time >= '%s'", DateUtil.beginOfYear(now));
|
|
|
+ } else {
|
|
|
+ dateCondition = String.format(" and o.created_time >= '%s'", DateUtil.offsetMonth(DateUtil.beginOfYear(now), -12));
|
|
|
+ }
|
|
|
SearchResult<UserInvoiceChoseOrderViews> search = beanSearcher.search(UserInvoiceChoseOrderViews.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
+ .put("dc", dateCondition)
|
|
|
.field(UserInvoiceChoseOrderViews::getUserId, userIdList).op(Operator.InList)
|
|
|
.build());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|