催收函列表添加‘生成电子章’按钮

This commit is contained in:
tangfutang 2018-07-30 09:33:41 +08:00
parent 427df8d113
commit d2a549cdec
2 changed files with 142 additions and 8 deletions

View File

@ -25,8 +25,9 @@
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","","Button","生成催收函","生成催收函","viewAndEdit()","","","","btn_icon_transfer",""},
{"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""}
{"true","","Button","生成催收函","生成催收函","exportExcel('1')","","","","btn_icon_transfer",""},
{"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""},
{"true","All","Button","生成电子章","盖公司电子章","stamp()","","","",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
@ -39,6 +40,11 @@
alert("请选择一条记录!");
return ;
}
var pay_number = getItemValue(0,getRow(0),"payment_number");
if(typeof(pay_number)=="undefined" || pay_number.length==0 ){
alert("无效数据,请选择有投放编号的数据!");
return ;
}
AsDialog.PopView("/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/generatededitshow.jsp","contractlist="+sPara+"&payment_number="+payment_number,
{width:"500px",height:"200px",title:"选择发送日期"},function(sReturn){
if(sReturn!=null&&sReturn.length>0){
@ -60,6 +66,11 @@
}
function exportExcel(sReturn){
var pay_number = getItemValue(0,getRow(0),"payment_number");
if(typeof(pay_number)=="undefined" || pay_number.length==0 ){
alert("无效数据,请选择有投放编号的数据!");
return ;
}
var payment_numbers = getItemValueArray(0,'payment_number');
var allPaymentNumbers="";
for(var i=0;i<payment_numbers.length;i++){
@ -70,17 +81,18 @@
var tempParam={};
var sparam="";
//模板号
debugger;
param["templateNo"]="a67d1e799d35435e866010dd1325674c";
//param["templateNo"]="a67d1e799d35435e866010dd1325674c";
param["templateNo"]="264756bca5a6467d8159661ff1ba7d69";
//生成文件关联关系
tempParam["OBJECTTYPE"]="打印催款函";
tempParam["FLOW_UNID"]="<%=new java.util.Date().getTime()%>";
tempParam["ID"]=getItemValue(0,getRow(0),"ID");
/* tempParam["payment_number"]=getItemValue(0,getRow(0),"PAYMENT_NUMBER");
tempParam["PLAN_LIST"]=PLAN_LISTS[i];
tempParam["payment_number"]=getItemValue(0,getRow(0),"PAYMENT_NUMBER");
/*tempParam["PLAN_LIST"]=PLAN_LISTS[i];
tempParam["PLAN_NUMBER"]=PAYMENT_NUMBERS[i];
tempParam["customername"]=getItemValue(0,getRow(0),"customername");
tempParam["contract_number"]=getItemValue(0,getRow(0),"contract_number"); */
tempParam["PLAN_NUMBER"]=getItemValue(0,getRow(0),"PAYMENT_NUMBER");
//生成模板固定参数
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
@ -92,9 +104,10 @@
if(sparam.length>0){sparam+=",";}
sparam+=key+"="+param[key];
}
RunJavaMethodTrans("com.tenwa.officetempalte.controller.RentCollectDeleteAction","deletequtation","plan_number="+payment_numbers[i]);
RunJavaMethodTrans("com.tenwa.officetempalte.controller.RentCollectDeleteAction","deletequtation","plan_number="+getItemValue(0,getRow(0),"PAYMENT_NUMBER"));
console.log(sparam);
var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam);
var id = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdfAnnex","PAYMENT_NUMBER="+getItemValue(0,getRow(0),"PAYMENT_NUMBER")+",PLAN_LIST="+null);
console.log(getNowFormatDate());
reloadSelf();
@ -131,5 +144,28 @@
+ seperator2 + date.getSeconds();
return currentdate;
}
function stamp(){
var flie = getItemValue(0,getRow(0),"FILENAME");
if(typeof(flie)=="undefined"||flie==null||flie==""){
alert("请先生成租金催收函!");
return;
}
var PAYMENT_NUMBERS=getItemValueArray(0,"PAYMENT_NUMBER");
var PLAN_LISTS=getItemValueArray(0,"PLAN_LIST");
for(var i=0;i<PAYMENT_NUMBERS.length;i++){
var plan_number=PAYMENT_NUMBERS[i];//投放编号
var plan_list=PLAN_LISTS[i];//期次
var contractID = getItemValue(0,getRow(0),"contract_id");
var result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","collectionSignA","PAYMENT_NUMBER="+plan_number+",PLAN_LIST="+null+",contract_id="+contractID+",flagType=collection");
if("success"==result){
alert("盖章成功!!!");
location.reload();
}else{
alert("盖章失败!!!");
}
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -1461,7 +1461,13 @@ public void wordToPdfJar(JBOTransaction tx){
PLAN_LIST=PLAN_LIST.split("\\.")[0];
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
BizObject DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false);
BizObject DOCRELATIVE = null;
if("null".equals(PLAN_LIST)){
DOCRELATIVE=bom.createQuery("plan_number=:plan_number").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
}else{
DOCRELATIVE=bom.createQuery("plan_number=:plan_number and plan_list=:plan_list").setParameter("plan_number",PAYMENT_NUMBER).setParameter("plan_list", PLAN_LIST).getSingleResult(false);
}
BizObjectManager attrBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME);
BizObject attrBo=null;
WordToPDFUtil wordTopdf = new WordToPDFUtil();
@ -1996,6 +2002,98 @@ public String claimSign(JBOTransaction tx) throws Exception {
}
}
/**
* 打印租金通知书并发短信给客户
* @param tx
* @return
* @throws Exception
*/
public String collectionSignA(JBOTransaction tx) throws Exception {
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
String libraryid="";
BizObjectManager bom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME);
BizObject DOCRELATIVE=bom.createQuery("plan_number=:plan_number and objecttype LIKE '%打印催款函%' ").setParameter("plan_number",PAYMENT_NUMBER).getSingleResult(false);
if (DOCRELATIVE != null) {
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
libraryid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString();
}
BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME, tx);
ContractSignInfo con = null;
BizObject bo = null;
String info="";
try{
info = libraryid + "@" + libraryid+"@"+flagType;
//获取需要盖章的文件信息
Map<String,ContractSignInfo> map=new HashMap<String,ContractSignInfo>();
bo = contBom.createQuery("library_id=:libraryid").setParameter("libraryid", libraryid).getSingleResult(true);
if(bo != null){
id = bo.getAttribute("id").toString();
con = new ContractSignInfo();
con.setFileid(id);
con.setFilename(bo.getAttribute("FILENAME").toString());
String makefullPath = bo.getAttribute("FULLPATH").toString();
File file = new File(makefullPath);
if (!file.exists()) {
throw new RuntimeException("要读取的文件不存在");
}
con.setInputfile(BASE64.encodeImgageToBase64(file));
map.put(info, con);
Map<String, String> resultMap = null;
resultMap = requestService.createPaymentofHireSign(map);
if (!resultMap.containsKey("error")) {
for (String key : resultMap.keySet()) {
if (key.indexOf("contract_") == -1) {
contract_id = resultMap.get(key);
}
}
} else {
return "error";
}
}
if (bo != null) {
Map<String, String> map1 = new HashMap<String, String>();
map1.put(contract_id, bo.getAttribute("FULLPATH").toString());
Map<String, String> result1 = requestService.downloadDoc(map1);
if (!result1.containsKey("error")) {
for (String contractId : map1.keySet()) {
try {
if ("success".equals(result1.get(contractId))) {
String fileString = result1.get("file_" + contractId);
InputStream fileInput = BASE64.encodeFileToBase64(fileString);
OutputStream fileOut = new FileOutputStream(map1.get(contractId));// TODO
byte[] buffByte = new byte[1024];
int size = 0;
while ((size = fileInput.read(buffByte)) != -1) {
fileOut.write(buffByte, 0, size);
}
fileInput.close();
fileOut.close();
} else if ("error".equals(result1.get(contractId))) {
return "error";
}
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
return "error";
}
} else {
return "error";
}
return "success";
} catch (Exception e) {
e.printStackTrace();
return "error";
}
}
/***
* 已经生成的合同作废
* @param tx