更新租金通知书盖章方法
This commit is contained in:
parent
5a79a0181c
commit
d16b58ebcd
@ -198,11 +198,16 @@
|
||||
alert("请勾选合同模板!");
|
||||
return;
|
||||
}
|
||||
var message = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","jiaoyan","templateIds="+tempids+",flowunid="+"<%=flowunid%>");
|
||||
if(""!=message){
|
||||
alert(message);
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
var param={};
|
||||
var tempParam={};
|
||||
var sparam="";
|
||||
// param["templateNo"]="0010";
|
||||
|
||||
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
|
||||
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
|
||||
tempParam["OBJECTTYPE"]="<%=CurPage.getParameter("FLOW_NO")%>";
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
sButtons=new String[][]{
|
||||
{"true","All","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"},
|
||||
{"true","All","Button","批量下载","批量下载","lotdown()","","","","btn_icon_down"},
|
||||
{"true","All","Button","公司盖章","公司盖章","stamp()","","","",""},
|
||||
};
|
||||
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
@ -49,8 +50,11 @@
|
||||
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
|
||||
window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate");
|
||||
}
|
||||
function generateQuotation()
|
||||
{
|
||||
function generateQuotation(){
|
||||
/* var paymentnumber=getItemValue(0,getRow(0),"PAYMENT_NUMBER");
|
||||
var planlist=getItemValue(0,getRow(0),"PLAN_LIST");
|
||||
alert(sss);
|
||||
return; */
|
||||
var PAYMENT_NUMBERS=getItemValueArray(0,"PAYMENT_NUMBER");
|
||||
var PLAN_LISTS=getItemValueArray(0,"PLAN_LIST");
|
||||
if(typeof(PAYMENT_NUMBERS)=="undefined"||PAYMENT_NUMBERS==null||PAYMENT_NUMBERS==""){alert("请选择");return;}
|
||||
@ -86,9 +90,8 @@
|
||||
var plan_list=PLAN_LISTS[i];//期次
|
||||
var deleteresult=RunJavaMethodTrans("com.tenwa.officetempalte.controller.RentNotinyDeleteAction","deletequtation","plan_number="+plan_number+",plan_list="+plan_list);
|
||||
var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam);
|
||||
|
||||
|
||||
|
||||
//word转pdf
|
||||
var id = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdfAnnex","PAYMENT_NUMBER="+plan_number+",PLAN_LIST="+plan_list);
|
||||
}
|
||||
alert("生成成功!");
|
||||
reloadSelf();
|
||||
@ -109,5 +112,27 @@
|
||||
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
|
||||
window.open(sWebRootPath+"/servlet/view/DownloadZipServlet?CompClientID=<%=sCompClientID%>&id="+id, "downloadTemplate");
|
||||
}
|
||||
|
||||
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 result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","claimSignA","PAYMENT_NUMBER="+plan_number+",PLAN_LIST="+plan_list);
|
||||
if("success"==result){
|
||||
alert("盖章成功!!!");
|
||||
location.reload();
|
||||
}else{
|
||||
alert("盖章失败!!!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -6,11 +6,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jbo.app.tenwa.doc.LB_DOCRELATIVE;
|
||||
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
|
||||
import jbo.com.tenwa.entity.comm.officetempalte.BF_TEMPLATE;
|
||||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_TEMPLATE;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.are.util.json.JSONDecoder;
|
||||
@ -31,6 +33,7 @@ public class FileTemplateUtil {
|
||||
public String templateNo;//模板编号
|
||||
public String templateParam; //模板参数
|
||||
public String templateIds;//要生成的合同模板
|
||||
public String flowunid;//用于查询已经生成的合同
|
||||
public String getTemplateCalss() {return templateCalss;}
|
||||
public void setTemplateCalss(String templateCalss) {this.templateCalss = templateCalss;}
|
||||
|
||||
@ -52,6 +55,12 @@ public class FileTemplateUtil {
|
||||
public void setTemplateIds(String templateIds) {
|
||||
this.templateIds = templateIds;
|
||||
}
|
||||
public String getFlowunid() {
|
||||
return flowunid;
|
||||
}
|
||||
public void setFlowunid(String flowunid) {
|
||||
this.flowunid = flowunid;
|
||||
}
|
||||
public String getTemplateClass(Transaction Sqlca) throws Exception{
|
||||
String fileClass=templateCalss.replaceAll("@", ",");
|
||||
List<String>tempFiles=new ArrayList<String>();
|
||||
@ -139,5 +148,26 @@ public class FileTemplateUtil {
|
||||
}
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
public String jiaoyan(JBOTransaction tx) throws Exception{
|
||||
String docName="";
|
||||
String[] bfids = templateIds.split("&");
|
||||
BizObjectManager btManager = JBOFactory.getBizObjectManager(BF_TEMPLATE.CLASS_NAME);
|
||||
BizObjectManager ldclManager = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME);
|
||||
List<BizObject> ldcls = ldclManager.createQuery("select * from O where file_flag='yes' and flow_unid=:flowunid").setParameter("flowunid", flowunid).getResultList(false);
|
||||
for(int i=0;i<bfids.length;i++){
|
||||
BizObject templatename = btManager.createQuery("select templatename from O where id=:id").setParameter("id", bfids[0]).getSingleResult(false);
|
||||
for(BizObject ldcl:ldcls){
|
||||
if((templatename.getAttribute("templatename").toString()).equals(ldcl.getAttribute("doc_name").getString())){
|
||||
docName=docName+templatename.getAttribute("templatename").toString()+";";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(docName.length()>0){
|
||||
docName=docName+"已存在,请先删除后再生成!";
|
||||
}
|
||||
|
||||
return docName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -70,6 +70,8 @@ public class ContractSignAction{
|
||||
public String flagType;
|
||||
public HessianProxyFactory factory = new HessianProxyFactory();
|
||||
public HttpRequestAppService requestService;
|
||||
public String PAYMENT_NUMBER;
|
||||
public String PLAN_LIST;
|
||||
private static Logger logger=Logger.getLogger(ContractSignAction.class);
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String getConfigRequestUrl() throws Exception{
|
||||
@ -180,8 +182,20 @@ public class ContractSignAction{
|
||||
public void setAttrId(String attrId) {
|
||||
this.attrId = attrId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getPAYMENT_NUMBER() {
|
||||
return PAYMENT_NUMBER;
|
||||
}
|
||||
public void setPAYMENT_NUMBER(String pAYMENT_NUMBER) {
|
||||
PAYMENT_NUMBER = pAYMENT_NUMBER;
|
||||
}
|
||||
public String getPLAN_LIST() {
|
||||
return PLAN_LIST;
|
||||
}
|
||||
public void setPLAN_LIST(String pLAN_LIST) {
|
||||
PLAN_LIST = pLAN_LIST;
|
||||
}
|
||||
/**
|
||||
* 自然人电子签约
|
||||
*
|
||||
@ -334,10 +348,8 @@ public class ContractSignAction{
|
||||
public StringBuffer manyPeople() throws JBOException{
|
||||
//获取担保人信息
|
||||
StringBuffer info = new StringBuffer();
|
||||
BizObjectManager cptm = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME);
|
||||
List<BizObject> cpts = cptm.createQuery("select * from O left join jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP lgu on lgu.ASSUROR=O.CUSTOMERID where "
|
||||
+ "lgu.flowunid=:FlowUnid AND lgu.DATA_STATE='guarantee' AND "
|
||||
+ "lgu.flowunid=O.flowUnid").setParameter("FlowUnid", FlowUnid).getResultList(false);
|
||||
BizObjectManager cptm = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME);
|
||||
List<BizObject> cpts = cptm.createQuery("select * from O where flowunid=:flowUnid").setParameter("flowUnid", FlowUnid).getResultList(false);
|
||||
for(BizObject cpt:cpts){
|
||||
String name = cpt.getAttribute("FULLNAME").toString();
|
||||
String mobile = cpt.getAttribute("mobile").toString();
|
||||
@ -1323,6 +1335,62 @@ public void wordToPdfJar(JBOTransaction tx){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 租金通知书附件用LibreOffice实现word转换pdf
|
||||
* word转换pdf
|
||||
* @throws JBOException
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "static-access" })
|
||||
public String wordToPdfAnnex(JBOTransaction tx) throws JBOException {
|
||||
|
||||
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);
|
||||
BizObjectManager attrBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME);
|
||||
BizObject attrBo=null;
|
||||
WordToPDFUtil wordTopdf = new WordToPDFUtil();
|
||||
File file = null;
|
||||
Boolean result = null;
|
||||
String sql = "";
|
||||
try {
|
||||
if (DOCRELATIVE != null) {
|
||||
|
||||
String DOCRELATIVEid=DOCRELATIVE.getAttribute("id").toString();
|
||||
BizObjectManager bom1=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME);
|
||||
String DOCLIBRARYid=bom1.createQuery("relative_id=:relative_id").setParameter("relative_id", DOCRELATIVEid).getSingleResult(false).getAttribute("id").toString();
|
||||
attrBo = attrBom.createQuery("library_id=:library_id").setParameter("library_id", DOCLIBRARYid).getSingleResult(true);
|
||||
|
||||
String path = attrBo.getAttribute("FULLPATH").toString();
|
||||
String lastFilePath = path.replace(".docx", ".pdf");
|
||||
File filePath = new File(path);
|
||||
if(!filePath.exists()){
|
||||
logger.info("word转换pdf的源文件不存在");
|
||||
}
|
||||
String lastFilePathpdf = filePath.getParent();
|
||||
try {
|
||||
result = wordTopdf.Word2Pdf(path, lastFilePathpdf);
|
||||
} catch (Exception e) {
|
||||
result = false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (result) {
|
||||
file =new File(lastFilePath);
|
||||
attrBo.setAttributeValue("FULLPATH",attrBo.getAttribute("FULLPATH").toString().replace(".docx", ".pdf"));
|
||||
attrBo.setAttributeValue("FILENAME",attrBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf"));
|
||||
attrBo.setAttributeValue("FILEPATH",attrBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf"));
|
||||
attrBo.setAttributeValue("FileSize",file.length());
|
||||
attrBo.setAttributeValue("CONTENT_TYPE","application/pdf");
|
||||
attrBom.saveObject(attrBo);
|
||||
}else{
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return attrBo.getAttribute("ID").toString();
|
||||
}
|
||||
/**
|
||||
* 多线程word转换pdf
|
||||
* @author tenwa518
|
||||
@ -1702,6 +1770,101 @@ public String claimSign(JBOTransaction tx) throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
public String claimSignA(JBOTransaction tx) throws Exception {
|
||||
requestService = (HttpRequestAppService) factory.create(HttpRequestAppService.class, this.getConfigRequestUrl());
|
||||
String libraryid="";
|
||||
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);
|
||||
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 contract_id="";
|
||||
try{
|
||||
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(id, con);
|
||||
Map<String, String> resultMap = null;
|
||||
//调代理的接口
|
||||
// doc_name = bo.getAttribute("doc_name").toString();
|
||||
// if("租金支付表".equals(doc_name)){
|
||||
//租金支付表
|
||||
resultMap = requestService.createPaymentofHireSign(map);
|
||||
// }
|
||||
if (!resultMap.containsKey("error")) {
|
||||
for (String key : resultMap.keySet()) {
|
||||
if (key.indexOf("contract_") == -1) {
|
||||
// bo.setAttributeValue("SINGCONTRACT_ID",resultMap.get("contract_" + key));
|
||||
// bo.setAttributeValue("DOCUMENT_ID", resultMap.get(key));
|
||||
contract_id = resultMap.get(key);
|
||||
}
|
||||
}
|
||||
// bo.setAttributeValue("PROCESS", "5");
|
||||
// contBom.saveObject(bo);
|
||||
// tx.commit();
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
// bo = contBom.createQuery("file_flag='yes' and process='5' and flow_unid='" + FlowUnid + "' and attribute_id= '"+attribute_id+"'").getSingleResult(true);
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
// bo.setAttributeValue("PROCESS", "6");
|
||||
// contBom.saveObject(bo);
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
|
||||
return "success";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 已经生成的合同,作废,
|
||||
* @param tx
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user