Browse Source

会计,评估,项目,中审,培训-导出报销金额展示调整

huangguoce 2 ngày trước cách đây
mục cha
commit
57417c763f

+ 72 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/reimbursement/reimbursementInfo/controller/ReimbursementInfoController.java

@@ -28,9 +28,13 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.mysql.cj.util.TimeUtil.DATE_FORMATTER;
+
 @RestController
 @Api(tags ="报销申请")
 @RequestMapping(value = "/reimbursement/info")
@@ -156,6 +160,8 @@ public class ReimbursementInfoController {
         if(result.size()>0){
             //获取字典数据
             String statusDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("status");
+            String newVersionReimbursementDate = SpringUtil.getBean(IDictApi.class).getDictLabel("1", "new_version_reimbursement_date", null);
+
             Map<String,Object> statusValueDTOs = JSON.parseObject(statusDatas, new TypeReference<Map<String,Object>>() {});
 
             String cwReimbursementSourceTypeDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("pg_reimbursement_source_type");
@@ -192,6 +198,14 @@ public class ReimbursementInfoController {
                 }else {
                     info.setPaymentStatus("未付款");
                 }
+
+
+                //处理新旧版本报销金额展示
+                boolean newVersion = isNewVersion(info.getApprovalTime(), newVersionReimbursementDate);
+                if(!newVersion){
+                    info.setNumberCount(info.getNumber().toString());
+                }
+
             }
         }
 
@@ -201,6 +215,64 @@ public class ReimbursementInfoController {
 
     }
 
+    /**
+     * 判断是否为新版本。
+     *
+     * 规则:
+     * approvalTime 等于或晚于 newStartDate,返回 true;
+     * approvalTime 早于 newStartDate,返回 false。
+     */
+    public static boolean isNewVersion(Date approvalTime, String newStartDate) {
+        if (approvalTime == null
+                || newStartDate == null
+                || newStartDate.trim().isEmpty()) {
+            return true;
+        }
+
+        String compareResult = compareDate(approvalTime, newStartDate);
+
+        return "same".equals(compareResult)
+                || "after".equals(compareResult);
+    }
+
+    /**
+     * 按“天”比较日期,忽略时、分、秒。
+     *
+     * @param date1    Date 类型日期
+     * @param date2Str yyyy-MM-dd 格式日期字符串
+     * @return before、after、same
+     */
+    public static String compareDate(Date date1, String date2Str) {
+        if (date1 == null) {
+            throw new IllegalArgumentException("date1 不能为空");
+        }
+
+        if (date2Str == null
+                || date2Str.trim().isEmpty()
+                || "-".equals(date2Str.trim())) {
+            throw new IllegalArgumentException("date2Str 不能为空");
+        }
+
+        LocalDate d1 = date1.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+
+        LocalDate d2 = LocalDate.parse(
+                date2Str.trim(),
+                DATE_FORMATTER
+        );
+
+        if (d1.isBefore(d2)) {
+            return "before";
+        }
+
+        if (d1.isAfter(d2)) {
+            return "after";
+        }
+
+        return "same";
+    }
+
 
     @ApiLog(value = "评估电子发票报销数据")
     @GetMapping("exportInvoiceReimbursementFile")

+ 68 - 0
jeeplus-modules/jeeplus-ccpm/src/main/java/com/jeeplus/ccpm/approvalInfo/controller/CcpmReimbursementInfoController.java

@@ -29,9 +29,13 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.mysql.cj.util.TimeUtil.DATE_FORMATTER;
+
 /**
  * @author: 桑文巍
  * @create: 2022-11-24 16:44
@@ -187,6 +191,7 @@ public class CcpmReimbursementInfoController {
         if(result.size()>0){
             //获取字典数据
             String statusDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("status");
+            String newVersionReimbursementDate = SpringUtil.getBean(IDictApi.class).getDictLabel("1", "new_version_reimbursement_date", null);
             Map<String,Object> statusValueDTOs = JSON.parseObject(statusDatas, new TypeReference<Map<String,Object>>() {});
 
             String cwReimbursementSourceTypeDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("cw_reimbursement_source_type");
@@ -223,6 +228,11 @@ public class CcpmReimbursementInfoController {
                 }else {
                     info.setPaymentStatus("未付款");
                 }
+                //处理新旧版本报销金额展示
+                boolean newVersion = isNewVersion(info.getApprovalTime(), newVersionReimbursementDate);
+                if(!newVersion){
+                    info.setNumberCount(info.getNumber().toString());
+                }
             }
         }
 
@@ -230,6 +240,64 @@ public class CcpmReimbursementInfoController {
 
     }
 
+    /**
+     * 判断是否为新版本。
+     *
+     * 规则:
+     * approvalTime 等于或晚于 newStartDate,返回 true;
+     * approvalTime 早于 newStartDate,返回 false。
+     */
+    public static boolean isNewVersion(Date approvalTime, String newStartDate) {
+        if (approvalTime == null
+                || newStartDate == null
+                || newStartDate.trim().isEmpty()) {
+            return true;
+        }
+
+        String compareResult = compareDate(approvalTime, newStartDate);
+
+        return "same".equals(compareResult)
+                || "after".equals(compareResult);
+    }
+
+    /**
+     * 按“天”比较日期,忽略时、分、秒。
+     *
+     * @param date1    Date 类型日期
+     * @param date2Str yyyy-MM-dd 格式日期字符串
+     * @return before、after、same
+     */
+    public static String compareDate(Date date1, String date2Str) {
+        if (date1 == null) {
+            throw new IllegalArgumentException("date1 不能为空");
+        }
+
+        if (date2Str == null
+                || date2Str.trim().isEmpty()
+                || "-".equals(date2Str.trim())) {
+            throw new IllegalArgumentException("date2Str 不能为空");
+        }
+
+        LocalDate d1 = date1.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+
+        LocalDate d2 = LocalDate.parse(
+                date2Str.trim(),
+                DATE_FORMATTER
+        );
+
+        if (d1.isBefore(d2)) {
+            return "before";
+        }
+
+        if (d1.isAfter(d2)) {
+            return "after";
+        }
+
+        return "same";
+    }
+
     @ApiLog(value = "项目电子发票报销数据")
     @GetMapping("exportInvoiceReimbursementFile")
     @ApiOperation(value = "项目电子发票报销数据")

+ 69 - 0
jeeplus-modules/jeeplus-centrecareful/src/main/java/com/jeeplus/centrecareful/approvalInfo/controller/ZsReimbursementInfoController.java

@@ -27,9 +27,13 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.http.ResponseEntity;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.mysql.cj.util.TimeUtil.DATE_FORMATTER;
+
 /**
  * @author: 王强
  * @create: 2022-11-24 16:44
@@ -186,6 +190,7 @@ public class ZsReimbursementInfoController {
         if(result.size()>0){
             //获取字典数据
             String statusDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("status");
+            String newVersionReimbursementDate = SpringUtil.getBean(IDictApi.class).getDictLabel("1", "new_version_reimbursement_date", null);
             Map<String,Object> statusValueDTOs = JSON.parseObject(statusDatas, new TypeReference<Map<String,Object>>() {});
 
             String cwReimbursementSourceTypeDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("zs_cw_reimbursement_source_type");
@@ -222,12 +227,76 @@ public class ZsReimbursementInfoController {
                 }else {
                     info.setPaymentStatus("未付款");
                 }
+
+                //处理新旧版本报销金额展示
+                boolean newVersion = isNewVersion(info.getApprovalTime(), newVersionReimbursementDate);
+                if(!newVersion){
+                    info.setNumberCount(info.getNumber().toString());
+                }
             }
         }
         ZSEasyPoiUtil.exportExcel ( result, sheetName,  sheetName, ZsRetureListDto.class, fileName, response );
 
     }
 
+    /**
+     * 判断是否为新版本。
+     *
+     * 规则:
+     * approvalTime 等于或晚于 newStartDate,返回 true;
+     * approvalTime 早于 newStartDate,返回 false。
+     */
+    public static boolean isNewVersion(Date approvalTime, String newStartDate) {
+        if (approvalTime == null
+                || newStartDate == null
+                || newStartDate.trim().isEmpty()) {
+            return true;
+        }
+
+        String compareResult = compareDate(approvalTime, newStartDate);
+
+        return "same".equals(compareResult)
+                || "after".equals(compareResult);
+    }
+
+    /**
+     * 按“天”比较日期,忽略时、分、秒。
+     *
+     * @param date1    Date 类型日期
+     * @param date2Str yyyy-MM-dd 格式日期字符串
+     * @return before、after、same
+     */
+    public static String compareDate(Date date1, String date2Str) {
+        if (date1 == null) {
+            throw new IllegalArgumentException("date1 不能为空");
+        }
+
+        if (date2Str == null
+                || date2Str.trim().isEmpty()
+                || "-".equals(date2Str.trim())) {
+            throw new IllegalArgumentException("date2Str 不能为空");
+        }
+
+        LocalDate d1 = date1.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+
+        LocalDate d2 = LocalDate.parse(
+                date2Str.trim(),
+                DATE_FORMATTER
+        );
+
+        if (d1.isBefore(d2)) {
+            return "before";
+        }
+
+        if (d1.isAfter(d2)) {
+            return "after";
+        }
+
+        return "same";
+    }
+
     @ApiLog(value = "中审电子发票报销数据")
     @GetMapping("exportInvoiceReimbursementFile")
     @ApiOperation(value = "中审电子发票报销数据")

+ 68 - 0
jeeplus-modules/jeeplus-consult/src/main/java/com/jeeplus/consultancy/approvalInfo/controller/ConsultancyReimbursementInfoController.java

@@ -28,9 +28,13 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.mysql.cj.util.TimeUtil.DATE_FORMATTER;
+
 /**
  * @author: 桑文巍
  * @create: 2022-11-24 16:44
@@ -185,6 +189,7 @@ public class ConsultancyReimbursementInfoController {
         if(result.size()>0){
             //获取字典数据
             String statusDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("status");
+            String newVersionReimbursementDate = SpringUtil.getBean(IDictApi.class).getDictLabel("1", "new_version_reimbursement_date", null);
             Map<String,Object> statusValueDTOs = JSON.parseObject(statusDatas, new TypeReference<Map<String,Object>>() {});
 
             String cwReimbursementSourceTypeDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("cw_reimbursement_source_type");
@@ -221,6 +226,11 @@ public class ConsultancyReimbursementInfoController {
                 }else {
                     info.setPaymentStatus("未付款");
                 }
+                //处理新旧版本报销金额展示
+                boolean newVersion = isNewVersion(info.getApprovalTime(), newVersionReimbursementDate);
+                if(!newVersion){
+                    info.setNumberCount(info.getNumber().toString());
+                }
             }
         }
 
@@ -228,6 +238,64 @@ public class ConsultancyReimbursementInfoController {
 
     }
 
+    /**
+     * 判断是否为新版本。
+     *
+     * 规则:
+     * approvalTime 等于或晚于 newStartDate,返回 true;
+     * approvalTime 早于 newStartDate,返回 false。
+     */
+    public static boolean isNewVersion(Date approvalTime, String newStartDate) {
+        if (approvalTime == null
+                || newStartDate == null
+                || newStartDate.trim().isEmpty()) {
+            return true;
+        }
+
+        String compareResult = compareDate(approvalTime, newStartDate);
+
+        return "same".equals(compareResult)
+                || "after".equals(compareResult);
+    }
+
+    /**
+     * 按“天”比较日期,忽略时、分、秒。
+     *
+     * @param date1    Date 类型日期
+     * @param date2Str yyyy-MM-dd 格式日期字符串
+     * @return before、after、same
+     */
+    public static String compareDate(Date date1, String date2Str) {
+        if (date1 == null) {
+            throw new IllegalArgumentException("date1 不能为空");
+        }
+
+        if (date2Str == null
+                || date2Str.trim().isEmpty()
+                || "-".equals(date2Str.trim())) {
+            throw new IllegalArgumentException("date2Str 不能为空");
+        }
+
+        LocalDate d1 = date1.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+
+        LocalDate d2 = LocalDate.parse(
+                date2Str.trim(),
+                DATE_FORMATTER
+        );
+
+        if (d1.isBefore(d2)) {
+            return "before";
+        }
+
+        if (d1.isAfter(d2)) {
+            return "after";
+        }
+
+        return "same";
+    }
+
     @ApiLog(value = "项目电子发票报销数据")
     @GetMapping("exportInvoiceReimbursementFile")
     @ApiOperation(value = "项目电子发票报销数据")

+ 71 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reimbursementApproval/approvalInfo/controller/CwReimbursementInfoController.java

@@ -30,9 +30,13 @@ import org.springframework.http.ResponseEntity;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDate;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.mysql.cj.util.TimeUtil.DATE_FORMATTER;
+
 /**
  * @author: 王强
  * @create: 2022-11-24 16:44
@@ -219,6 +223,8 @@ public class CwReimbursementInfoController {
         if(result.size()>0){
             //获取字典数据
             String statusDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("status");
+            String newVersionReimbursementDate = SpringUtil.getBean(IDictApi.class).getDictLabel("1", "new_version_reimbursement_date", null);
+
             Map<String,Object> statusValueDTOs = JSON.parseObject(statusDatas, new TypeReference<Map<String,Object>>() {});
 
             String cwReimbursementSourceTypeDatas = SpringUtil.getBean ( IDictApi.class ).getDictListMapByDict ("cw_reimbursement_source_type");
@@ -255,6 +261,13 @@ public class CwReimbursementInfoController {
                 }else {
                     info.setPaymentStatus("未付款");
                 }
+
+                //处理新旧版本报销金额展示
+                boolean newVersion = isNewVersion(info.getApprovalTime(), newVersionReimbursementDate);
+                if(!newVersion){
+                    info.setNumberCount(info.getNumber().toString());
+                }
+
             }
         }
 
@@ -262,6 +275,64 @@ public class CwReimbursementInfoController {
     }
 
     /**
+     * 判断是否为新版本。
+     *
+     * 规则:
+     * approvalTime 等于或晚于 newStartDate,返回 true;
+     * approvalTime 早于 newStartDate,返回 false。
+     */
+    public static boolean isNewVersion(Date approvalTime, String newStartDate) {
+        if (approvalTime == null
+                || newStartDate == null
+                || newStartDate.trim().isEmpty()) {
+            return true;
+        }
+
+        String compareResult = compareDate(approvalTime, newStartDate);
+
+        return "same".equals(compareResult)
+                || "after".equals(compareResult);
+    }
+
+    /**
+     * 按“天”比较日期,忽略时、分、秒。
+     *
+     * @param date1    Date 类型日期
+     * @param date2Str yyyy-MM-dd 格式日期字符串
+     * @return before、after、same
+     */
+    public static String compareDate(Date date1, String date2Str) {
+        if (date1 == null) {
+            throw new IllegalArgumentException("date1 不能为空");
+        }
+
+        if (date2Str == null
+                || date2Str.trim().isEmpty()
+                || "-".equals(date2Str.trim())) {
+            throw new IllegalArgumentException("date2Str 不能为空");
+        }
+
+        LocalDate d1 = date1.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+
+        LocalDate d2 = LocalDate.parse(
+                date2Str.trim(),
+                DATE_FORMATTER
+        );
+
+        if (d1.isBefore(d2)) {
+            return "before";
+        }
+
+        if (d1.isAfter(d2)) {
+            return "after";
+        }
+
+        return "same";
+    }
+
+    /**
      * 苏州报销(杨忆湄)
      * @param cwDTO
      * @param page