فهرست منبع

1.修改发票逻辑
2.新增localDateTime 工具类

y 2 سال پیش
والد
کامیت
709def97c5

+ 0 - 10
src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java

@@ -36,17 +36,7 @@ public class InvAccountController {
         return HttpResult.ok("", invAccountService.selectAccountsListPage(invAccountQueryVo));
     }
 
-    @ApiOperation("获取账户详细信息")
-    @GetMapping("getAccountById")
-    public HttpResult getInsAccountById(@RequestParam("accountId") String accountId) {
-        if (accountId == null) {
-            throw new RuntimeException("id不能为空");
-        }
-        InvAccount invAccount = new InvAccount();
-        invAccount.setAccountId(accountId);
 
-        return HttpResult.ok("", invAccountService.selectAccounts(invAccount));
-    }
 
     @ApiOperation("查询账户卡列表")
     @PostMapping("getAccountCardList")

+ 3 - 1
src/main/java/com/ydtech/modules/inv/dao/InvAccountMapper.java

@@ -19,7 +19,9 @@ public interface InvAccountMapper extends BaseMapper<InvAccount> {
 
     IPage<InvAccount> selectAccountsListPage(Page page, @Param("account") InvAccountQueryVo invAccountQueryVo);
 
-    List<InvAccount> selectAccountsList(@Param("account") InvAccount account);
+    List<InvAccount> selectAccountsList(@Param("account") InvAccountQueryVo invAccountQueryVo);
+
+    IPage<InvAccount> getSumInvoicingAmount(Page page,@Param("account") InvAccountQueryVo invAccountQueryVo);
 }
 
 

+ 18 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccount.java

@@ -1,8 +1,11 @@
 package com.ydtech.modules.inv.model;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -112,6 +115,21 @@ public class InvAccount implements Serializable {
     @ApiModelProperty(value = "外部账户标识(0内部账户 1外部账户)")
     private String outerFlag;
 
+    /**
+     * 总开票额度
+     */
+    @ApiModelProperty(value = "总开票额度")
+    @TableField(exist = false)
+    private String sumInvoicingAmount;
+
+    @ApiModelProperty(value = "暂估")
+    @TableField(value = "tentative_estimates", typeHandler = FastjsonTypeHandler.class)
+    private JSONArray tentativeEstimates;
+
+    @ApiModelProperty(value = "季度开票额度")
+    @TableField(exist = false)
+    private String quarterAmountExcess;
+
 
     @ApiModelProperty(value = "所属账户下的卡")
     @TableField(exist = false)

+ 6 - 2
src/main/java/com/ydtech/modules/inv/model/vo/InvAccountQueryVo.java

@@ -5,6 +5,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 
 @Data
 public class InvAccountQueryVo implements Serializable {
@@ -14,6 +15,9 @@ public class InvAccountQueryVo implements Serializable {
     @ApiModelProperty(value = "户名")
     private String accountName;
 
+    @ApiModelProperty(value = "账户id")
+    private String accountId;
+
     @ApiModelProperty(value = "账户类别")
     private String accountQuality;
 
@@ -24,10 +28,10 @@ public class InvAccountQueryVo implements Serializable {
     private String outerFlag;
 
     @ApiModelProperty(value = "开票日期  无需传递")
-    private LocalDate invoiceTimeStart;
+    private LocalDateTime invoiceTimeStart;
 
     @ApiModelProperty(value = "开票日期  无需传递")
-    private LocalDate invoiceTimeEnd;
+    private LocalDateTime invoiceTimeEnd;
 
     private int pageNo;
 

+ 0 - 1
src/main/java/com/ydtech/modules/inv/service/InvAccountService.java

@@ -17,7 +17,6 @@ public interface InvAccountService extends IService<InvAccount> {
 
     IPage<InvAccount> selectAccountsListPage(InvAccountQueryVo account);
 
-    List<InvAccount> selectAccounts(InvAccount account);
 
 
 

+ 55 - 17
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -9,12 +9,17 @@ import com.ydtech.modules.inv.dao.InvAccountMapper;
 import com.ydtech.modules.inv.model.InvAccount;
 import com.ydtech.modules.inv.model.vo.InvAccountQueryVo;
 import com.ydtech.modules.inv.service.InvAccountService;
+import com.ydtech.modules.inv.utils.LocalDateTimeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.temporal.TemporalAdjusters;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @author Administrator
@@ -39,30 +44,63 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
         pageRequest.setPageNum(invAccountQueryVo.getPageNo());
         pageRequest.setPageSize(invAccountQueryVo.getPageSize());
         Page page = PageRequest.buildPageRequest(pageRequest);
-        LocalDate date = LocalDate.now();
-        LocalDate nowDay = date.with(TemporalAdjusters.lastDayOfMonth()); // 获取当前月的最后一天
-        LocalDate lastMonth = date.minusMonths(12); // 当前月份减12
-        LocalDate firstDay = lastMonth.with(TemporalAdjusters.firstDayOfMonth()); // 获取12月前月的第一天
-        System.out.println("当前月份:" + nowDay + "  12月:" + firstDay);
-        invAccountQueryVo.setInvoiceTimeStart(firstDay);
-        invAccountQueryVo.setInvoiceTimeEnd(nowDay);
+
+        invAccountQueryVo.setInvoiceTimeStart(LocalDateTimeUtils.get12MonthsBefore()); // 获取12月前月的第一天
+        invAccountQueryVo.setInvoiceTimeEnd(LocalDateTimeUtils.getTodayLastDay());  //获取当前月最后一天
+
+
         IPage<InvAccount> invAccountIPage = insAccountMapper.selectAccountsListPage(page, invAccountQueryVo);
         List<InvAccount> records = invAccountIPage.getRecords();
-        records.forEach(invAccount -> {
-            if (invAccount.getInvAccountCardList().size() < 2) {
-                if (invAccount.getInvAccountCardList().get(0).getBankCardNum() == null) {
-                    invAccount.setInvAccountCardList(null);
+
+        //计算当前季度剩余300000减去
+        invAccountQueryVo.setInvoiceTimeStart(LocalDateTimeUtils.quarterStartTime());
+        invAccountQueryVo.setInvoiceTimeEnd(LocalDateTimeUtils.quarterEndTime());
+        IPage<InvAccount> invAccountIPage1 = insAccountMapper.selectAccountsListPage(page, invAccountQueryVo);
+
+        //将当前季度额度赋值
+        List<InvAccount> collect = records.stream()
+                .map(rel -> invAccountIPage1.getRecords().stream()
+                        .filter(ord -> Objects.equals(rel.getAccountId(), ord.getAccountId()))
+                        .findFirst()
+                        .map(ord -> {
+                            if (ord.getInvoicingAmountExcess() != null){
+                                rel.setQuarterAmountExcess(new BigDecimal("300000").subtract(new BigDecimal("5000000").subtract(new BigDecimal(ord.getInvoicingAmountExcess()))).toString());
+                            }else{
+                                rel.setQuarterAmountExcess("300000");
+                            }
+                            return rel;
+                        }).orElse(null)
+                ).collect(Collectors.toList());
+
+        //将总开票额度赋值
+        IPage<InvAccount> sumInvoicingAmount = insAccountMapper.getSumInvoicingAmount(page,invAccountQueryVo);
+        List<InvAccount> collect1 = collect.stream()
+                .map(rel -> sumInvoicingAmount.getRecords().stream()
+                        .filter(ord -> Objects.equals(rel.getAccountId(), ord.getAccountId()))
+                        .findFirst()
+                        .map(ord -> {
+                            if (ord.getSumInvoicingAmount() != null) {
+                                rel.setSumInvoicingAmount(new BigDecimal(ord.getSumInvoicingAmount()).add(new BigDecimal(ord.getSumInvoicingAmount())).toString());
+                            }
+                            return rel;
+                        }).orElse(null)
+                ).collect(Collectors.toList());
+
+
+        collect1.forEach(invAccount -> {
+            if (invAccount != null){
+                if (invAccount.getInvAccountCardList().size() < 2) {
+                    if (invAccount.getInvAccountCardList().get(0).getBankCardNum() == null) {
+                        invAccount.setInvAccountCardList(null);
+                    }
                 }
             }
         });
+        invAccountIPage.setRecords(collect1);
         return invAccountIPage;
     }
 
 
-    @Override
-    public List<InvAccount> selectAccounts(InvAccount account) {
-        return insAccountMapper.selectAccountsList(account);
-    }
 
 
     /**
@@ -72,8 +110,8 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
      */
     @Override
     public HttpResult selectByAccountName() {
-        InvAccount invAccount = new InvAccount();
-        List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccount);
+        InvAccountQueryVo invAccountQueryVo = new InvAccountQueryVo();
+        List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccountQueryVo);
 
         if (!insAccounts.isEmpty()) {
             insAccounts.forEach(invAccountN -> {

+ 463 - 0
src/main/java/com/ydtech/modules/inv/utils/LocalDateTimeUtils.java

@@ -0,0 +1,463 @@
+package com.ydtech.modules.inv.utils;
+
+/**
+ * @author jianlong
+ * @date 2024-01-24 18:26
+ */
+import java.time.*;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalAdjusters;
+import java.util.Date;
+
+/**
+ * LocalDateTime工具类
+ *
+ * @author CL
+ */
+public class LocalDateTimeUtils {
+
+    /**
+     * 当前时间
+     *
+     * @return
+     */
+    public static LocalDateTime now() {
+        return LocalDateTime.now();
+    }
+
+    /**
+     * Date 转 LocalDateTime
+     *
+     * @return
+     */
+    public static LocalDateTime convert(Date date) {
+        return LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
+    }
+
+    /**
+     * 获取12月前第一天
+     */
+    public static LocalDateTime get12MonthsBefore() {
+        return LocalDateTime.now().minusMonths(12).with(TemporalAdjusters.firstDayOfMonth());
+    }
+
+    /**
+     * 获取当前月最后一天
+     */
+    public static LocalDateTime getTodayLastDay() {
+        return LocalDateTime.now().with(TemporalAdjusters.lastDayOfMonth());
+    }
+
+
+    /**
+     * LocalDateTime 转 Date
+     *
+     * @return
+     */
+    public static Date convert(LocalDateTime localDateTime) {
+        return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
+    }
+
+    /**
+     * 今天开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime todayStartTime() {
+        return LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
+    }
+
+    /**
+     * 今天结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime todayEndTime() {
+        return LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
+    }
+
+    /**
+     * 昨天开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime yesterdayStartTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.DAYS), LocalTime.MIN);
+    }
+
+    /**
+     * 昨天结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime yesterdayEndTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.DAYS), LocalTime.MAX);
+    }
+
+    /**
+     * 最近7天开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime last7DaysStartTime() {
+        return LocalDateTime.of(LocalDate.now().minus(6L, ChronoUnit.DAYS), LocalTime.MIN);
+    }
+
+    /**
+     * 最近7天结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime last7DaysEndTime() {
+        return LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
+    }
+
+    /**
+     * 最近30天开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime last30DaysStartTime() {
+        return LocalDateTime.of(LocalDate.now().minus(29L, ChronoUnit.DAYS), LocalTime.MIN);
+    }
+
+    /**
+     * 最近30天结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime last30DaysEndTime() {
+        return LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
+    }
+
+    /**
+     * 最近一年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime last1YearStartTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.YEARS).plus(1L, ChronoUnit.DAYS), LocalTime.MIN);
+    }
+
+    /**
+     * 最近一年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime last1YearEndTime() {
+        return LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
+    }
+
+    /**
+     * 本周开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime weekStartTime() {
+        LocalDate now = LocalDate.now();
+        return LocalDateTime.of(now.minusDays(now.getDayOfWeek().getValue() - 1), LocalTime.MIN);
+    }
+
+    /**
+     * 本周结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime weekEndTime() {
+        LocalDate now = LocalDate.now();
+        return LocalDateTime.of(now.plusDays(7 - now.getDayOfWeek().getValue()), LocalTime.MAX);
+    }
+
+    /**
+     * 本月开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime monthStartTime() {
+        return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
+    }
+
+    /**
+     * 本月结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime monthEndTime() {
+        return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+    }
+
+    /**
+     * 本季度开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime quarterStartTime() {
+        LocalDate now = LocalDate.now();
+        Month month = Month.of(now.getMonth().firstMonthOfQuarter().getValue());
+        return LocalDateTime.of(LocalDate.of(now.getYear(), month, 1), LocalTime.MIN);
+    }
+
+    /**
+     * 本季度结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime quarterEndTime() {
+        LocalDate now = LocalDate.now();
+        Month month = Month.of(now.getMonth().firstMonthOfQuarter().getValue()).plus(2L);
+        return LocalDateTime.of(LocalDate.of(now.getYear(), month, month.length(now.isLeapYear())), LocalTime.MAX);
+    }
+
+    /**
+     * 本半年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime halfYearStartTime() {
+        LocalDate now = LocalDate.now();
+        Month month = (now.getMonthValue() > 6) ? Month.JULY : Month.JANUARY;
+        return LocalDateTime.of(LocalDate.of(now.getYear(), month, 1), LocalTime.MIN);
+    }
+
+    /**
+     * 本半年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime halfYearEndTime() {
+        LocalDate now = LocalDate.now();
+        Month month = (now.getMonthValue() > 6) ? Month.DECEMBER : Month.JUNE;
+        return LocalDateTime.of(LocalDate.of(now.getYear(), month, month.length(now.isLeapYear())), LocalTime.MAX);
+    }
+
+    /**
+     * 本年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime yearStartTime() {
+        return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN);
+    }
+
+    /**
+     * 本年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime yearEndTime() {
+        return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.lastDayOfYear()), LocalTime.MAX);
+    }
+
+    /**
+     * 上周开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastWeekStartTime() {
+        LocalDate lastWeek = LocalDate.now().minus(1L, ChronoUnit.WEEKS);
+        return LocalDateTime.of(lastWeek.minusDays(lastWeek.getDayOfWeek().getValue() - 1), LocalTime.MIN);
+    }
+
+    /**
+     * 上周结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastWeekEndTime() {
+        LocalDate lastWeek = LocalDate.now().minus(1L, ChronoUnit.WEEKS);
+        return LocalDateTime.of(lastWeek.plusDays(7 - lastWeek.getDayOfWeek().getValue()), LocalTime.MAX);
+    }
+
+    /**
+     * 上月开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastMonthStartTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.MONTHS).with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
+    }
+
+    /**
+     * 上月结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastMonthEndTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.MONTHS).with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+    }
+
+    /**
+     * 上季度开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastQuarterStartTime() {
+        LocalDate now = LocalDate.now();
+        Month firstMonthOfQuarter = Month.of(now.getMonth().firstMonthOfQuarter().getValue());
+        Month firstMonthOfLastQuarter = firstMonthOfQuarter.minus(3L);
+        int yearOfLastQuarter = firstMonthOfQuarter.getValue() < 4 ? now.getYear() - 1 : now.getYear();
+        return LocalDateTime.of(LocalDate.of(yearOfLastQuarter, firstMonthOfLastQuarter, 1), LocalTime.MIN);
+    }
+
+    /**
+     * 上季度结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastQuarterEndTime() {
+        LocalDate now = LocalDate.now();
+        Month firstMonthOfQuarter = Month.of(now.getMonth().firstMonthOfQuarter().getValue());
+        Month firstMonthOfLastQuarter = firstMonthOfQuarter.minus(1L);
+        int yearOfLastQuarter = firstMonthOfQuarter.getValue() < 4 ? now.getYear() - 1 : now.getYear();
+        return LocalDateTime.of(LocalDate.of(yearOfLastQuarter, firstMonthOfLastQuarter, firstMonthOfLastQuarter.maxLength()), LocalTime.MAX);
+    }
+
+    /**
+     * 上半年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastHalfYearStartTime() {
+        LocalDate now = LocalDate.now();
+        int lastHalfYear = (now.getMonthValue() > 6) ? now.getYear() : now.getYear() - 1;
+        Month firstMonthOfLastHalfYear = (now.getMonthValue() > 6) ? Month.JANUARY : Month.JULY;
+        return LocalDateTime.of(LocalDate.of(lastHalfYear, firstMonthOfLastHalfYear, 1), LocalTime.MIN);
+    }
+
+    /**
+     * 上半年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastHalfYearEndTime() {
+        LocalDate now = LocalDate.now();
+        int lastHalfYear = (now.getMonthValue() > 6) ? now.getYear() : now.getYear() - 1;
+        Month lastMonthOfLastHalfYear = (now.getMonthValue() > 6) ? Month.JUNE : Month.DECEMBER;
+        return LocalDateTime.of(LocalDate.of(lastHalfYear, lastMonthOfLastHalfYear, lastMonthOfLastHalfYear.maxLength()), LocalTime.MAX);
+    }
+
+    /**
+     * 上一年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastYearStartTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.YEARS).with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN);
+    }
+
+    /**
+     * 上一年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime lastYearEndTime() {
+        return LocalDateTime.of(LocalDate.now().minus(1L, ChronoUnit.YEARS).with(TemporalAdjusters.lastDayOfYear()), LocalTime.MAX);
+    }
+
+    /**
+     * 下周开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextWeekStartTime() {
+        LocalDate nextWeek = LocalDate.now().plus(1L, ChronoUnit.WEEKS);
+        return LocalDateTime.of(nextWeek.minusDays(nextWeek.getDayOfWeek().getValue() - 1), LocalTime.MIN);
+    }
+
+    /**
+     * 下周结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextWeekEndTime() {
+        LocalDate nextWeek = LocalDate.now().plus(1L, ChronoUnit.WEEKS);
+        return LocalDateTime.of(nextWeek.plusDays(7 - nextWeek.getDayOfWeek().getValue()), LocalTime.MAX);
+    }
+
+    /**
+     * 下月开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextMonthStartTime() {
+        return LocalDateTime.of(LocalDate.now().plus(1L, ChronoUnit.MONTHS).with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
+    }
+
+    /**
+     * 下月结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextMonthEndTime() {
+        return LocalDateTime.of(LocalDate.now().plus(1L, ChronoUnit.MONTHS).with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+    }
+
+    /**
+     * 下季度开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextQuarterStartTime() {
+        LocalDate now = LocalDate.now();
+        Month firstMonthOfQuarter = Month.of(now.getMonth().firstMonthOfQuarter().getValue());
+        Month firstMonthOfNextQuarter = firstMonthOfQuarter.plus(3L);
+        int yearOfNextQuarter = firstMonthOfQuarter.getValue() > 9 ? now.getYear() + 1 : now.getYear();
+        return LocalDateTime.of(LocalDate.of(yearOfNextQuarter, firstMonthOfNextQuarter, 1), LocalTime.MIN);
+    }
+
+    /**
+     * 下季度结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextQuarterEndTime() {
+        LocalDate now = LocalDate.now();
+        Month firstMonthOfQuarter = Month.of(now.getMonth().firstMonthOfQuarter().getValue());
+        Month firstMonthOfNextQuarter = firstMonthOfQuarter.plus(5L);
+        int yearOfNextQuarter = firstMonthOfQuarter.getValue() > 9 ? now.getYear() + 1 : now.getYear();
+        return LocalDateTime.of(LocalDate.of(yearOfNextQuarter, firstMonthOfNextQuarter, firstMonthOfNextQuarter.maxLength()), LocalTime.MAX);
+    }
+
+    /**
+     * 上半年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextHalfYearStartTime() {
+        LocalDate now = LocalDate.now();
+        int nextHalfYear = (now.getMonthValue() > 6) ? now.getYear() + 1 : now.getYear();
+        Month firstMonthOfNextHalfYear = (now.getMonthValue() > 6) ? Month.JANUARY : Month.JULY;
+        return LocalDateTime.of(LocalDate.of(nextHalfYear, firstMonthOfNextHalfYear, 1), LocalTime.MIN);
+    }
+
+    /**
+     * 上半年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextHalfYearEndTime() {
+        LocalDate now = LocalDate.now();
+        int lastHalfYear = (now.getMonthValue() > 6) ? now.getYear() + 1 : now.getYear();
+        Month lastMonthOfNextHalfYear = (now.getMonthValue() > 6) ? Month.JUNE : Month.DECEMBER;
+        return LocalDateTime.of(LocalDate.of(lastHalfYear, lastMonthOfNextHalfYear, lastMonthOfNextHalfYear.maxLength()), LocalTime.MAX);
+    }
+
+    /**
+     * 下一年开始时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextYearStartTime() {
+        return LocalDateTime.of(LocalDate.now().plus(1L, ChronoUnit.YEARS).with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN);
+    }
+
+    /**
+     * 下一年结束时间
+     *
+     * @return
+     */
+    public static LocalDateTime nextYearEndTime() {
+        return LocalDateTime.of(LocalDate.now().plus(1L, ChronoUnit.YEARS).with(TemporalAdjusters.lastDayOfYear()), LocalTime.MAX);
+    }
+
+}

+ 2 - 1
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -213,7 +213,8 @@
         </if>
         GROUP BY
         iac.orderstatus,
-        io.userid
+        io.userid,
+        io.deptid
         ) AS i ON i.deptid = sd.id
         WHERE
         sd.del_flag = 0

+ 48 - 10
src/main/resources/mapper/modules/inv/InvAccountMapper.xml

@@ -19,7 +19,11 @@
         <result property="biller" column="biller" jdbcType="VARCHAR"/>
         <result property="invoicingAmount" column="invoicing_amount" jdbcType="VARCHAR"/>
         <result property="invoicingAmountExcess" column="invoicing_amount_excess" jdbcType="VARCHAR"/>
-        <collection property="invAccountCardList" ofType="com.ydtech.modules.inv.model.InvAccountCard" resultMap="invAccountCardList"/>
+        <result property="sumInvoicingAmount" column="sum_invoicing_amount" jdbcType="VARCHAR"/>
+        <result property="tentativeEstimates" column="tentative_estimates" javaType="com.alibaba.fastjson.JSONArray"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
+        <collection property="invAccountCardList" ofType="com.ydtech.modules.inv.model.InvAccountCard"
+                    resultMap="invAccountCardList"/>
     </resultMap>
 
     <resultMap id="invAccountCardList" type="com.ydtech.modules.inv.model.InvAccountCard">
@@ -69,10 +73,10 @@
         a.establish_time,
         a.biller,
         a.invoicing_amount,
+        a.sum_invoicing_amount,
+        a.tentative_estimates,
         ABS(sum(c.invoice_money) - 5000000) as invoicing_amount_excess,
 
-
-
         b.bank_card_num,
         b.bank_name,
         b.bank,
@@ -116,6 +120,9 @@
             and c.invoice_time &lt;= #{account.invoiceTimeEnd}
         </if>
         where a.del_flag = '0'
+        <if test="account.accountId != null and account.accountId != ''">
+            and a.account_id like concat('%',#{account.accountId},'%')
+        </if>
         <if test="account.accountName!= null and account.accountName!= ''">
             and a.account_name like concat('%',#{account.accountName},'%')
         </if>
@@ -129,7 +136,34 @@
             and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
         </if>
         GROUP BY
-        a.account_id
+        a.account_id,
+        b.bank_card_num
+    </select>
+
+    <select id="getSumInvoicingAmount" resultMap="BaseResultMap">
+        select a.account_id, SUM(b.invoice_money) as sum_invoicing_amount
+        from inv_account a
+        left join inv_account_incoice b on a.account_id = b.account_id
+        left join inv_account_card c on a.account_id = c.account_id
+        where
+        a.del_flag = '0'
+        <if test="account.accountId != null and account.accountId != ''">
+            and a.account_id like concat('%',#{account.accountId},'%')
+        </if>
+        <if test="account.accountName!= null and account.accountName!= ''">
+            and a.account_name like concat('%',#{account.accountName},'%')
+        </if>
+        <if test="account.outerFlag!= null and account.outerFlag!= ''">
+            and a.outer_flag like concat('%',#{account.outerFlag},'%')
+        </if>
+        <if test="account.accountQuality!= null and account.accountQuality!= ''">
+            and c.account_quality like concat('%',#{account.accountQuality},'%')
+        </if>
+        <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
+            and c.bank_card_num like concat('%',#{account.bankCardNum},'%')
+        </if>
+        GROUP BY a.account_id
+
     </select>
 
     <select id="selectAccountsList" resultMap="BaseResultMap">
@@ -146,18 +180,22 @@
         </if>
         where a.del_flag = '0'
         <if test="account.accountId != null and account.accountId != ''">
-            and a.account_id = #{account.accountId}
+            and a.account_id like concat('%',#{account.accountId},'%')
         </if>
         <if test="account.accountName!= null and account.accountName!= ''">
             and a.account_name like concat('%',#{account.accountName},'%')
         </if>
-        <if test="account.businessQuality!= null and account.businessQuality!= ''">
-            and a.business_quality = #{account.businessQuality}
+        <if test="account.outerFlag!= null and account.outerFlag!= ''">
+            and a.outer_flag like concat('%',#{account.outerFlag},'%')
+        </if>
+        <if test="account.accountQuality!= null and account.accountQuality!= ''">
+            and b.account_quality like concat('%',#{account.accountQuality},'%')
         </if>
-        <if test="account.juridicalPerson!= null and account.juridicalPerson!= ''">
-            and a.juridical_person like concat('%',#{account.juridicalPerson},'%')
+        <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
+            and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
         </if>
         GROUP BY
-        a.account_id
+        a.account_id,
+        b.bank_card_num
     </select>
 </mapper>