no message
							parent
							
								
									b4940ee399
								
							
						
					
					
						commit
						1ab895aa65
					
				| 
						 | 
					@ -10,6 +10,8 @@ import java.io.UnsupportedEncodingException;
 | 
				
			||||||
import java.text.DateFormat;
 | 
					import java.text.DateFormat;
 | 
				
			||||||
import java.text.ParseException;
 | 
					import java.text.ParseException;
 | 
				
			||||||
import java.text.SimpleDateFormat;
 | 
					import java.text.SimpleDateFormat;
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.time.format.DateTimeFormatter;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
| 
						 | 
					@ -273,6 +275,14 @@ public class DefaultImportOrderManager extends DefaultBaseManager implements Imp
 | 
				
			||||||
	        		order.setOrderDate(new Date());
 | 
						        		order.setOrderDate(new Date());
 | 
				
			||||||
	        	}else{
 | 
						        	}else{
 | 
				
			||||||
	        		 kdrq=format1.parse(orderDate);
 | 
						        		 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)){
 | 
						        	if(planFromDate==null ||  "".equals(planFromDate)){
 | 
				
			||||||
	        		order.setPlanFromDate(new Date());
 | 
						        		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){
 | 
						public Date ZHdate(String str,int i){
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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.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.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.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"/>
 | 
					            <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"/>
 | 
					             <checkbox id="organization.bePlatForm" title="editOrganizationPage.organization.bePlatForm" row="7" col="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="true" defaultValue="true"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -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.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.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.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"/>
 | 
					            <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"/>
 | 
					             <checkbox id="organization.bePlatForm" title="editOrganizationPage.organization.bePlatForm" row="7" col="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="true" defaultValue="true"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue