新增深圳订单交易导入功能

This commit is contained in:
zhangjun 2020-03-23 21:28:15 +08:00
parent eb3a0401f3
commit 32d881d38d
5 changed files with 371 additions and 1 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/LBImportPage/TheTradeOrderReportImportlist.jsp";
String sTempletNo = "TradeOrderInfo";//--模板号--
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

@ -0,0 +1,115 @@
<%@ 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>
//商用车
%>
<%
ASObjectModel doTemp = new ASObjectModel("TradeOrderList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.MultiSelect = true; //多选
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(30);
dwTemp.genHTMLObjectWindow("");
%>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%>
<%
String sButtons[][] = {
//{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
//{"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"},
{"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""},
{"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"},
{"true","","Button","模版下载","模版下载","DiscountDownload()","","","","btn_icon_down",""},
/* {"true","All","Button","生成租金计划","生成租金计划","createPlan()","","","","btn_icon_generate"},
{"true","All","Button","测试拷贝","测试拷贝","copyPath()","","","","btn_icon_generate"}, */
};
%>
<%/*~END~*/%>
<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%>
<%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<%/*~END~*/%>
<iframe name="MyAtt" src="<%=com.amarsoft.awe.util.Escape.getBlankJsp(sWebRootPath,"正在下载附件,请稍候...")%>" style="background-color: blue" width=100% height=100% frameborder=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 scrolling="no">
</iframe>
<form name=form1 method=post action="<%=sWebRootPath%>/servlet/view/fileTemplateView?CompClientID=<%=sCompClientID%>" target=MyAtt>
<div style="display:none">
<input id="sqlString" name="sqlString" value="">
</div>
</form>
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%>
<script type="text/javascript">
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newRecord(){
var sUrl = "/Tenwa/Lease/Flow/Comm/LBImportPage/TheTradeOrderReportImportInfo.jsp";
AsDialog.PopView(sUrl,'',"resizable=yes;dialogWidth=800px;dialogHeight=300px;center:yes;status:no;statusbar:no",function(){
reloadSelf();},"新增信息");
}
function viewAndEdit(){
var sUrl = "/Tenwa/Lease/Flow/Comm/LBImportPage/TheTradeOrderReportImportInfo.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=850px;dialogHeight=200px;center:yes;status:no;statusbar:no",function(){reloadSelf();},"修改信息");
}
//excel导入
function importExcel(){
var importCondition={};//导入配置
importCondition["templateNo"]="cff8a26a458041e19be498f424b9274f";//导入的模板编号必填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 DiscountDownload(){
var sId="cff8a26a458041e19be498f424b9274f";
if (typeof(sId)=="undefined" || sId.length==0){
return;
}else{
$("#sqlString").val("save@"+sId);
form1.submit();
}
}
function deleteRecord(){
var ownNumber = getItemValue(0,getRow(),'id');
if(typeof(ownNumber)=="undefined" || ownNumber.length==0 ){
alert("请选择一条信息!");
return ;
}
if(confirm('确实要删除吗?')){
as_delete(0,'');
}
}
</script>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%>
<script type="text/javascript">
//如果没有找到对应记录,则新增一条,并可以设置字段默认值
setItemValue(0,0,"INPUTUSERID","<%=CurUser.getUserName()%>");
setItemValue(0,0,"INPUTORGID","<%=CurUser.getOrgName()%>");
setItemValue(0,0,"INPUTTIME","<%=StringFunction.getTodayNow()%>");
setItemValue(0,0,"UPDATEUSERID","<%=CurUser.getUserName()%>");
setItemValue(0,0,"UPDATEORGID","<%=CurUser.getOrgName()%>");
setItemValue(0,0,"UPDATETIME","<%=StringFunction.getTodayNow()%>");
</script>
<%/*~END~*/%>
<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%>
<script type="text/javascript">
</script>
<%/*~END~*/%>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -5285,7 +5285,7 @@
</managerProperties>
</manager>
</class>
<class name="WX_PAY_THE_BILLS" label="" keyAttributes="id">
<class name="WX_PAY_THE_BILLS" label="微信账单支付导入" keyAttributes="id">
<attributes>
<attribute name="id" label="标识" type="STRING" length="32"/>
<attribute name="Trading_hours" label="交易时间" type="STRING" length="32"/>
@ -5336,6 +5336,40 @@
</managerProperties>
</manager>
</class>
<class name="SZ_TRADE_ORDER" label="深圳交易订单报表" keyAttributes="id">
<attributes>
<attribute name="id" label="标识" type="STRING" length="32"/>
<attribute name="creation_date" label="生成日期" type="STRING" length="32"/>
<attribute name="total_number_records" label="总记录数" type="STRING" length="32"/>
<attribute name="total_amount_order" label="订单总金额" type="STRING" length="32"/>
<attribute name="Total_amount_paid" label="支付金额总数" type="STRING" length="32"/>
<attribute name="keep_domain_one" label="保留域01" type="STRING" length="50"/>
<attribute name="keep_domain_two" label="保留域02" type="STRING" length="50"/>
<attribute name="payment_channel" label="支付渠道" type="STRING" length="50"/>
<attribute name="Ebank_order_number" label="网银订单号" type="STRING" length="50"/>
<attribute name="merchants_order_number" label="商户订单号" type="STRING" length="50"/>
<attribute name="Transaction_date" label="交易日期" type="STRING" length="32"/>
<attribute name="order_amount" label="订单金额" type="STRING" length="32"/>
<attribute name="currency_name" label="货币名称" type="STRING" length="32"/>
<attribute name="order_type" label="订单状态" type="STRING" length="50"/>
<attribute name="Pay_amount" label="支付金额" type="STRING" length="32"/>
<attribute name="bank_code" label="银行代码(发卡行)" type="STRING" length="50"/>
<attribute name="Unionpay_payment_order" label="银联支付单号" type="STRING" length="50"/>
<attribute name="System_serial_number" label="系统流水号" type="STRING" length="50"/>
<attribute name="INPUTUSERID" label="登记人" type="STRING" length="32"/>
<attribute name="INPUTORGID" label="登记部门" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="登记时间" type="STRING" length="32"/>
<attribute name="UPDATEUSERID" label="更新人" type="STRING" length="32"/>
<attribute name="UPDATEORGID" label="更新部门" type="STRING" length="32"/>
<attribute name="UPDATETIME" label="更新日期" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="sz_trade_order" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
<package name="jbo.com.tenwa.lease.carbrand" >
<class name="LB_CLAIMS_BOOK_DETAIL" label="索赔申请书详情表" keyAttributes="ID">

View File

@ -0,0 +1,112 @@
package jbo.com.tenwa.lease.comm;
import java.lang.String;
/**
* 深圳交易订单报表 - JBO命名常量类<br><br>
* Note: This file is generated by ADE tools, <em>dont</em> modify it.<br>
*/
public interface SZ_TRADE_ORDER{
/**
* 深圳交易订单报表<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.com.tenwa.lease.comm.SZ_TRADE_ORDER";
/**
* 标识 STRING(32)<br>
*/
public static final String id = "id";
/**
* 生成日期 STRING(32)<br>
*/
public static final String creation_date = "creation_date";
/**
* 总记录数 STRING(32)<br>
*/
public static final String total_number_records = "total_number_records";
/**
* 订单总金额 STRING(32)<br>
*/
public static final String total_amount_order = "total_amount_order";
/**
* 支付金额总数 STRING(32)<br>
*/
public static final String Total_amount_paid = "Total_amount_paid";
/**
* 保留域01 STRING(50)<br>
*/
public static final String keep_domain_one = "keep_domain_one";
/**
* 保留域02 STRING(50)<br>
*/
public static final String keep_domain_two = "keep_domain_two";
/**
* 支付渠道 STRING(50)<br>
*/
public static final String payment_channel = "payment_channel";
/**
* 网银订单号 STRING(50)<br>
*/
public static final String Ebank_order_number = "Ebank_order_number";
/**
* 商户订单号 STRING(50)<br>
*/
public static final String merchants_order_number = "merchants_order_number";
/**
* 交易日期 STRING(32)<br>
*/
public static final String Transaction_date = "Transaction_date";
/**
* 订单金额 STRING(32)<br>
*/
public static final String order_amount = "order_amount";
/**
* 货币名称 STRING(32)<br>
*/
public static final String currency_name = "currency_name";
/**
* 订单状态 STRING(50)<br>
*/
public static final String order_type = "order_type";
/**
* 支付金额 STRING(32)<br>
*/
public static final String Pay_amount = "Pay_amount";
/**
* 银行代码发卡行 STRING(50)<br>
*/
public static final String bank_code = "bank_code";
/**
* 银联支付单号 STRING(50)<br>
*/
public static final String Unionpay_payment_order = "Unionpay_payment_order";
/**
* 系统流水号 STRING(50)<br>
*/
public static final String System_serial_number = "System_serial_number";
/**
* 登记人 STRING(32)<br>
*/
public static final String INPUTUSERID = "INPUTUSERID";
/**
* 登记部门 STRING(32)<br>
*/
public static final String INPUTORGID = "INPUTORGID";
/**
* 登记时间 STRING(32)<br>
*/
public static final String INPUTTIME = "INPUTTIME";
/**
* 更新人 STRING(32)<br>
*/
public static final String UPDATEUSERID = "UPDATEUSERID";
/**
* 更新部门 STRING(32)<br>
*/
public static final String UPDATEORGID = "UPDATEORGID";
/**
* 更新日期 STRING(32)<br>
*/
public static final String UPDATETIME = "UPDATETIME";
}

View File

@ -0,0 +1,82 @@
package com.tenwa.apzl.comm;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.context.ASUser;
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.officetempalte.importcallback.impl.BaseImportExcelCallBack;
public class TheTradeOrderImport 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 {
Transaction Sqlca1 = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
/**
* 定义全局变量
*/
String error=""; // 错误描述
boolean flag=false; // 错误描述
String Ebank_order_number=null; // 导入的网银订单号
String merchants_order_number=null; // 导入的商户订单号
String System_serial_number=null; // 导入的系统流水号
String sql1=""; // 原有的数据
/**
* 校验本次Excel是否有重复的
*/
/**
* 校验本次导入数据在导入表是否已有
*/
List<Map<String, String>> list = new ArrayList<Map<String,String>>();
Map<String, String> map = new HashMap<String, String>();
List<String> arrayList = new ArrayList<String>();
for(BizObject bo:importObjects){
Ebank_order_number=bo.getAttribute("Ebank_order_number").getString();
merchants_order_number=bo.getAttribute("merchants_order_number").getString();
System_serial_number=bo.getAttribute("System_serial_number").getString();
arrayList.add(Ebank_order_number);
// 通过本次excel中的数据查询导入的表, 判断是否重复
sql1="SELECT Ebank_order_number FROM sz_trade_order WHERE Ebank_order_number='"+Ebank_order_number+"' AND merchants_order_number='"+merchants_order_number+"' AND System_serial_number='"+System_serial_number+"'";
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(Sqlca, sql1, null);
// 有结果集, 说明重复
if(dataList.size()>0){
error=",【网银订单号: "+Ebank_order_number+", 商户订单号: "+merchants_order_number+", 系统流水号 : "+System_serial_number+"";
flag=true;
}
}
if(flag) {
error = error.substring(1);
throw new BusinessException(error+"已存在 ");
}
long count = arrayList.stream().distinct().count();
boolean isRepeat = count < arrayList.size();
if(isRepeat){
Set<String> set = new HashSet<>();
Set<String> exist = new HashSet<>();
for (String s : arrayList) {
if (set.contains(s)) {
exist.add(s);
} else {
set.add(s);
}
}
throw new BusinessException("excl中的网银订单号:"+String.join(", ", exist)+"重复。");
}
}
}