no message

main
HUOJIN\92525 2024-09-11 11:19:34 +08:00
parent b4940ee399
commit 1ab895aa65
4 changed files with 44 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -273,6 +275,14 @@ public class DefaultImportOrderManager extends DefaultBaseManager implements Imp
order.setOrderDate(new Date());
}else{
kdrq=format1.parse(orderDate);
Organization contractor=PlatFormHolder.getPlatForm();
if(contractor.getTaxRate()>0){
//导入限制
if (!isOrderDateValid(orderDate, contractor.getTaxRate())) {
throw new BusinessException(contractor.getTaxRate() + "月之前的订单, 不允许导入!");
}
}
}
if(planFromDate==null || "".equals(planFromDate)){
order.setPlanFromDate(new Date());
@ -516,6 +526,36 @@ public class DefaultImportOrderManager extends DefaultBaseManager implements Imp
}
}
/**
*
*
* @param orderDate "yyyy/MM/dd"
* @param months
* @return false true
*/
public static boolean isOrderDateValid(String orderDate, int months) {
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/M/d");
// 将订单日期字符串转换为 LocalDate 对象
try {
LocalDate orderLocalDate = LocalDate.parse(orderDate, formatter);
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算截止日期
LocalDate cutoffDate = currentDate.minusMonths(months);
// 比较订单日期和截止日期
return !orderLocalDate.isBefore(cutoffDate) || orderLocalDate.equals(cutoffDate);
}catch (Exception e){
throw new IllegalArgumentException("日期格式错误: " + orderDate, e);
}
}
public Date ZHdate(String str,int i){
try {

View File

@ -22,6 +22,8 @@
<text id="organization.contact.email" title="editOrganizationPage.organization.contact.email" row="4" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<text id="organization.contact.address" title="editOrganizationPage.platForm.contact.address" row="5" col="1" span="2" width="295" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true" isPrecision="false"/>
<text id="organization.contact.postcode" title="editOrganizationPage.organization.contact.postcode" row="6" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="true" trimSpace="true" isPrecision="false"/>
<text id="organization.taxRate" title="导入限制(月)" row="7" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<textArea id="organization.description" title="editOrganizationPage.organization.description" row="10" col="1" span="2" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" rows="4" cols="40"/>
<checkbox id="organization.bePlatForm" title="editOrganizationPage.organization.bePlatForm" row="7" col="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="true" defaultValue="true"/>

View File

@ -22,6 +22,8 @@
<text id="organization.contact.email" title="editOrganizationPage.organization.contact.email" row="4" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<text id="organization.contact.address" title="editOrganizationPage.platForm.contact.address" row="5" col="1" span="2" width="295" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true" isPrecision="false"/>
<text id="organization.contact.postcode" title="editOrganizationPage.organization.contact.postcode" row="6" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="true" trimSpace="true" isPrecision="false"/>
<text id="organization.taxRate" title="导入限制(月)" row="7" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<textArea id="organization.description" title="editOrganizationPage.organization.description" row="10" col="1" span="2" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" rows="4" cols="40"/>
<checkbox id="organization.bePlatForm" title="editOrganizationPage.organization.bePlatForm" row="7" col="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="true" defaultValue="true"/>