parent
437010f5f6
commit
69a40551c8
|
@ -0,0 +1,62 @@
|
||||||
|
package shkd.sys.sys.plugin.list;
|
||||||
|
|
||||||
|
import kd.bos.form.IPageCache;
|
||||||
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
import kd.bos.list.IListView;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import shkd.sys.sys.plugin.list.domain.OverTimeVarietyEnum;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ElectronicPayDealListPlugin extends AbstractListPlugin {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(ElectronicPayDealListPlugin.class);
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||||
|
super.beforeItemClick(evt);
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
String billFormId = ((IListView) this.getView()).getBillFormId();
|
||||||
|
Map<String, List<String>> qtqyrz = OverTimeVarietyEnum.qtqyrz;
|
||||||
|
List<String> list = qtqyrz.get(billFormId);
|
||||||
|
if (list!=null&&list.contains(itemKey)){
|
||||||
|
// 定义日期时间格式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
IPageCache iPageCache =this.getPageCache();
|
||||||
|
|
||||||
|
String LastTime = iPageCache.get("LastTime");
|
||||||
|
if(!StringUtils.isEmpty(LastTime)){
|
||||||
|
// 获取当前时间
|
||||||
|
LocalDateTime currentTime = LocalDateTime.now();
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.parse(LastTime, formatter);
|
||||||
|
// 计算当前时间与另一个时间的时间差
|
||||||
|
Duration duration = Duration.between(localDateTime, currentTime);
|
||||||
|
|
||||||
|
// 判断时间差是否超过 10 秒
|
||||||
|
if (duration.getSeconds() <= 10) {
|
||||||
|
this.getView().showTipNotification("该按钮点击间隔需要超过十秒");
|
||||||
|
evt.setCancel(true);
|
||||||
|
}else {
|
||||||
|
iPageCache.put("LastTime",currentTime.format(formatter));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
iPageCache.put("LastTime",LocalDateTime.now().format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package shkd.sys.sys.plugin.list.domain;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class OverTimeVarietyEnum {
|
||||||
|
public static final Map<String, List<String>> qtqyrz = new HashMap() {{
|
||||||
|
put("cdm_electronic_pay_deal", new ArrayList<>(Arrays.asList("querynotepayable")));
|
||||||
|
put("银行借款合同", new ArrayList<>(Arrays.asList("其他权益融资")));
|
||||||
|
}};
|
||||||
|
}
|
Loading…
Reference in New Issue