文件下载页面常用方法及导入

This commit is contained in:
tenwa666 2019-04-20 17:45:43 +08:00
parent 69eb5de862
commit ac90e81bb9
5 changed files with 221 additions and 72 deletions

View File

@ -0,0 +1,27 @@
<%@page import="com.itextpdf.text.log.SysoCounter"%>
<%@ page contentType="text/html; charset=GBK"%><%@
include
file="/Frame/resources/include/include_begin_info.jspf"%>
<%
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp";
String sTempletNo = "li_Property_importS";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
dwTemp.ReadOnly = "0";//只读模式
dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID"));
String sButtons[][] = {
{"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""},
};
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
function goBack(){
parent.AsDialog.ClosePage();
}
function saveRecord(sPostEvents) {
as_save("myiframe0", "goBack()");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -1,24 +1,18 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%>
<%
String PG_TITLE = "本方信息"; // 浏览器窗口标题 <title> PG_TITLE </title>
String PG_TITLE = "文件下载"; // 浏览器窗口标题 <title> PG_TITLE </title>
%>
<%
ASObjectModel doTemp = new ASObjectModel("li_Property_import");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.MultiSelect = true; //多选
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(30);
dwTemp.genHTMLObjectWindow("id");
dwTemp.genHTMLObjectWindow("");
%>
<%/*~END~*/%>
@ -34,10 +28,6 @@
};
%>
<%/*~END~*/%>
<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%>
<%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<%/*~END~*/%>
@ -52,13 +42,35 @@
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newRecord(){
var sUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Testinfo.jsp";
var sUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportInfo.jsp";
AsDialog.PopView(sUrl,'',"resizable=yes;dialogWidth=800px;dialogHeight=300px;center:yes;status:no;statusbar:no",function(){
reloadSelf();
},"新增信息");
reloadSelf();},"新增信息");
}
function viewAndEdit(){
debugger;
var sUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportInfo.jsp";
var sPara = getItemValue(0,getRow(0),'ID');
if(typeof(sPara)=="undefined" || sPara.length==0 ){
alert("参数不能为空!");
return ;
}
AsDialog.PopView(sUrl,"ID="+sPara,"resizable=yes;dialogWidth=800px;dialogHeight=300px;center:yes;status:no;statusbar:no",function(){reloadSelf();},"修改信息");
}
//excel导入
function importExcel(){
var importCondition={};//导入配置
importCondition["templateNo"]="4f5e73385146431d9aec13d06aae21bf";//导入的模板编号必填s
//增加其他配置参数
importCondition["inputuserid"]="<%=CurUser.getUserID()%>";
importCondition["inputorgid"]="<%=CurUser.getOrgID()%>";
var sparam=JSON.stringify(importCondition).replace(/,/g,"@");//生成模板的参数据
AsDialog.PopView("/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateTest/uploadExcel.jsp","importparam="+sparam,
{width:"350px",height:"40px",title:"上传文件下载数据"},function(){
reloadSelf();});
}
/* function viewAndEdit(){
var sUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentInfo.jsp";
var IDs = getItemValueArray(0,'ID');//+","+TablePage.getCheckedItemValueArrayWithOtherPage("ID",s_c_p[0]);
if(typeof(IDs) == "undefined" || IDs.length == 0 ){
@ -76,10 +88,10 @@
},"资产转出登记修改");
reloadSelf();
}
} */
//模板下载
function DiscountDownload(){
var sId="522b89b1329c46f2af20daced778e366";
var sId="4f5e73385146431d9aec13d06aae21bf";
if (typeof(sId)=="undefined" || sId.length==0){
return;
}else{
@ -92,21 +104,6 @@
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate");
}
//excel导入
function importExcel(){
var importCondition={};//导入配置
importCondition["templateNo"]="522b89b1329c46f2af20daced778e366";//导入的模板编号必填s
//增加其他配置参数
importCondition["inputuserid"]="<%=CurUser.getUserID()%>";
importCondition["inputorgid"]="<%=CurUser.getOrgID()%>";
var sparam=JSON.stringify(importCondition).replace(/,/g,"@");//生成模板的参数据
AsDialog.PopView("/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateTest/uploadExcel.jsp","importparam="+sparam,
{width:"350px",height:"40px",title:"上传资产转出数据"},function(){
importExcelNew();
reloadSelf();});
}
function deleteRecord(){
var ownNumber = getItemValue(0,getRow(),'id');
if(typeof(ownNumber)=="undefined" || ownNumber.length==0 ){
@ -114,8 +111,7 @@
return ;
}
if(confirm('确实要删除吗?')){
as_delete(0,'');
as_delete(0,'');
}
}
</script>

View File

@ -1,26 +0,0 @@
<%@page import="com.itextpdf.text.log.SysoCounter"%>
<%@ page contentType="text/html; charset=GBK"%><%@
include
file="/Frame/resources/include/include_begin_info.jspf"%>
<%
//获得参数
String id = CurPage.getParameter("id");
if (id == null)
id = "";
ASObjectModel doTemp = new ASObjectModel("li_Property_importS");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform
dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写
dwTemp.genHTMLObjectWindow("");
String sButtons[][] = {{"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""},};
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
function goBack(){
parent.AsDialog.ClosePage();
}
function saveRecord(sPostEvents) {
as_save("myiframe0", "goBack()");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -5360,25 +5360,26 @@
</manager>
</class>
<class name="li_Property_import" label="文件下载导入" keyAttributes="id">
<!-- 文件导入下载页面jbo -->
<class name="li_property_import" label="文件下载导入" keyAttributes="ID">
<attributes>
<attribute name="id" label="id" type="STRING" length="30"/>
<attribute name="inputuserid" label="inputuserid" type="STRING" length="30"/>
<attribute name="inputtemp" label="inputtemp" type="STRING" length="30"/>
<attribute name="updateuserid" label="updateuserid" type="STRING" length="30"/>
<attribute name="updatetime" label="updatetime" type="STRING" length="30"/>
<attribute name="ID" label="ID" type="STRING" length="32"/>
<attribute name="CONTRACT_NO" label="合同号" type="STRING" length="64"/>
<attribute name="BATCH_NO" label="批次号" type="STRING" length="64"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="64"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="64"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="64"/>
<attribute name="UPDATEUSERID" label="变更人" type="STRING" length="64"/>
<attribute name="UPDATEORGID" label="变更部门" type="STRING" length="64"/>
<attribute name="UPDATETIME" label="变更时间" type="STRING" length="64"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="li_Property_import" />
<property name="table" value="li_property_import" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -0,0 +1,151 @@
package com.tenwa.officetempalte.importcallback.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.calc.LC_EBANK;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.voucher.LB_DISCOUNT;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.context.ASUser;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.officetempalte.importcallback.impl.BaseImportExcelCallBack;
public class FileDownloadCallBack extends BaseImportExcelCallBack{
@Override
public void run(ASUser CurUser, BizObject importObject,Map<String, String> model, Integer rowIndex, JBOTransaction tx,Transaction Sqlca) throws Exception {
}
/**
* 贴息文件校验
*/
@Override
public void runBefore(ASUser CurUser, Map<String, String> model, List<BizObject> importObjects, JBOTransaction tx,Transaction Sqlca) throws Exception {
/*// 错误描述
String error="";
// 用于判断是否错
boolean flag = false;
*//**
* 获取网银信息, 并将网银编号及可核销金额存入map集合
*//*
// 存储网银可核销金额
Map<String,Double> Ebank_Map =new HashMap<String,Double>();
List<BizObject> list=JBOFactory.createBizObjectQuery(LC_EBANK.CLASS_NAME,null).getResultList(false);
for(int i=0;i<list.size();i++) {
Ebank_Map.put(list.get(i).getAttribute("EBANK_SN").getString(),Double.parseDouble(list.get(i).getAttribute("MAYOPE_MONEY").getString()));
}
*//**
* 校验网银编号是否正确
*//*
// 存储本次导入的所有不重复网银
for(BizObject bo:importObjects){
// 获取本次导入网银编号
String ebankSn = bo.getAttribute("EBAND_NO").getString();
if(!Ebank_Map.containsKey(ebankSn)){
error+=",【"+ebankSn+"";
flag=true;
}
}
if(flag) {
error = error.substring(1);
throw new BusinessException("网银: "+error+"不存在!");
}
*//**
* 校验网银可核销金额是否大于等于贴息金额
*//*
// 用于存放本次同一个网银的贴息金额
Map<String, Double> map= new HashMap<String, Double>();
// 存放本次导入唯一网银流水号
List<String> DisCountEbandList = new ArrayList<String>();
for(BizObject bo:importObjects){
// 获取本次导入的网银编号
String ebankSn = bo.getAttribute("EBAND_NO").getString();
// 没有新新增, 有就把贴息金额相加, 没有就直接存
double DISCOUNT_MONEY=Double.parseDouble(bo.getAttribute("DISCOUNT_MONEY").getString());
if(!DisCountEbandList.contains(ebankSn)) {
DisCountEbandList.add(ebankSn);
map.put(ebankSn, DISCOUNT_MONEY);
}else {
Double old_money = map.get(ebankSn);
map.put(ebankSn, old_money+=DISCOUNT_MONEY);
}
}
// 判断网银金额是否大于等于贴息金额
for(String ss : DisCountEbandList) {
double Ebank_money = Ebank_Map.get(ss);
double DISCOUNT_MONEY =map.get(ss);
if(DISCOUNT_MONEY>Ebank_money) {
error+=",【"+ss+"";
flag=true;
}
}
if(flag) {
error = error.substring(1);
throw new BusinessException("网银:"+error+"可核销金额小于贴息金额 ");
}
*//**
* 将业务合同号增加到集合中
*//*
// 用于校验合同号是否存在
List<String> contractNo = new ArrayList<String>();
// 经所有业务合同号存入集合
List<BizObject> ConList=JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME,null).getResultList(false);
for(int i=0;i<ConList.size();i++) {
contractNo.add(ConList.get(i).getAttribute("CONTRACT_NUMBER").getString());
}
*//**
* 校验合同号是否存在
*//*
for(BizObject bo:importObjects){
String CONTRACT_NO = bo.getAttribute("CONTRACT_NO").getString();
if(!contractNo.contains(CONTRACT_NO)){
error+=",【"+CONTRACT_NO+"";
flag=true;
}
}
if(flag) {
error = error.substring(1);
throw new BusinessException("合同号:"+error+"不存在!");
}
*//**
* 校验合同号是否重复
*//*
// 用于校验合同号是否重复
List<String> DcontractNo = new ArrayList<String>();
List<BizObject>DiscountList=JBOFactory.createBizObjectQuery(LB_DISCOUNT.CLASS_NAME,null).getResultList(false);
// 将贴息已有的合同号存入集合
for(int i=0;i<DiscountList.size();i++) {
DcontractNo.add(DiscountList.get(i).getAttribute("CONTRACT_NO").getString());
}
for(BizObject bo:importObjects){
String CONTRACT_NO = bo.getAttribute("CONTRACT_NO").getString();
if(!DcontractNo.contains(CONTRACT_NO)){
DcontractNo.add(CONTRACT_NO);
}else {
error+=",【"+CONTRACT_NO+"";
flag=true;
}
}
if(flag) {
error = error.substring(1);
throw new BusinessException("合同号:"+error+"重复!");
}*/
}
}