78 lines
2.4 KiB
Java
78 lines
2.4 KiB
Java
package com.tenwa.customer.controller.group;
|
||
|
||
import java.text.DateFormat;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.Date;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
import com.amarsoft.are.jbo.JBOTransaction;
|
||
import com.tenwa.reckon.util.Conn;
|
||
|
||
public class CheckPoundegeDate {
|
||
|
||
private String chargeChannel;//扣款渠道
|
||
private String chargeWay;//扣款方式
|
||
private String startDate;//开始时间
|
||
private String expiryDate;//结束时间
|
||
private String id;
|
||
public String getChargeChannel() {
|
||
return chargeChannel;
|
||
}
|
||
public void setChargeChannel(String chargeChannel) {
|
||
this.chargeChannel = chargeChannel;
|
||
}
|
||
public String getChargeWay() {
|
||
return chargeWay;
|
||
}
|
||
public void setChargeWay(String chargeWay) {
|
||
this.chargeWay = chargeWay;
|
||
}
|
||
public String getStartDate() {
|
||
return startDate;
|
||
}
|
||
public void setStartDate(String startDate) {
|
||
this.startDate = startDate;
|
||
}
|
||
public String getExpiryDate() {
|
||
return expiryDate;
|
||
}
|
||
public void setExpiryDate(String expiryDate) {
|
||
this.expiryDate = expiryDate;
|
||
}
|
||
public String getId() {
|
||
return id;
|
||
}
|
||
public void setId(String id) {
|
||
this.id = id;
|
||
}
|
||
|
||
|
||
//校验扣款手续费维护日期
|
||
public String checkPoundegeDate(JBOTransaction tx) throws Exception{
|
||
Conn conn = new Conn(tx);
|
||
String sql = "SELECT id FROM LPOUNDAGE_MAINTENANCE where charge_channel=? AND charge_way=? AND DATE_FORMAT(expiry_date,'%Y/%m/%d')>DATE_FORMAT(?,'%Y/%m/%d')";
|
||
List<Map<String, String>> results = conn.executeQuery(sql, chargeChannel,chargeWay,startDate);
|
||
if(id==null &&results.size()>0){
|
||
return "开始时间大于已有数据的结束时间!!";
|
||
}
|
||
|
||
String endSql = "SELECT a.expiry_date FROM LPOUNDAGE_MAINTENANCE AS a WHERE expiry_date = (SELECT MAX(expiry_date) FROM LPOUNDAGE_MAINTENANCE WHERE a.charge_channel=charge_channel AND a.charge_way=charge_way) and a.charge_channel=? AND a.charge_way=?";
|
||
List<Map<String, String>> endtime = conn.executeQuery(endSql, chargeChannel,chargeWay);
|
||
if(id==null && endtime.size()>0){
|
||
String enddate = endtime.get(0).get("expiry_date");
|
||
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
|
||
Date startdate = df.parse(startDate);
|
||
Date endTime = df.parse(enddate);
|
||
long days = (startdate.getTime() - endTime.getTime()) / 1000 / 3600 / 24;
|
||
if(days!=1){
|
||
return "开始时间比上一条数据结束时间相差大于1天!";
|
||
}
|
||
}
|
||
|
||
|
||
return "true";
|
||
|
||
}
|
||
}
|