|
|
@@ -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 = "中审电子发票报销数据")
|