From 40ef1fb093068d5dd51e22a8f112f758251e96cb Mon Sep 17 00:00:00 2001 From: tangfutang Date: Sat, 6 Jun 2020 18:51:47 +0800 Subject: [PATCH] =?UTF-8?q?app=E5=90=88=E5=90=8C=E5=88=B6=E4=BD=9C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../start/bo/MakeContractBusinessBO.java | 36 ++- .../impl/BusinessApplyStartServiceImpl.java | 4 +- .../controller/ContractMakeController.java | 57 ++++- .../make/service/ContractMakeService.java | 11 + .../service/impl/ContractMakeServiceImpl.java | 156 ++++++++++++- .../make/util/ContractMakeControllerUtil.java | 214 ++++++++++++++++++ .../data/controller/FlowDataController.java | 69 +++++- .../flow/data/service/FlowDataService.java | 14 ++ .../service/Impl/FlowDataServiceImpl.java | 134 ++++++++++- 9 files changed, 682 insertions(+), 13 deletions(-) create mode 100644 src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/util/ContractMakeControllerUtil.java diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/bo/MakeContractBusinessBO.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/bo/MakeContractBusinessBO.java index 87b006131..7a913690e 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/bo/MakeContractBusinessBO.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/bo/MakeContractBusinessBO.java @@ -21,6 +21,7 @@ import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.are.lang.StringX; +import com.amarsoft.awe.util.Transaction; import com.base.constant.RestfullConstant; import com.base.util.JsonUtil; import com.base.util.StringUtil; @@ -43,9 +44,11 @@ public class MakeContractBusinessBO implements Serializable { private String customertype; private String ProjectName; private String ContractId; + private String isNetCar; + private String gpsVendor; + private String operationType; private String msg; - private String operationType; private Map params; private String fixedFlowParam; private String objectNo; @@ -110,7 +113,7 @@ public class MakeContractBusinessBO implements Serializable { } - public MakeContractBusinessBO(Map fieldMap, JBOTransaction tx) + public MakeContractBusinessBO(Map fieldMap, JBOTransaction tx, Transaction sqlca) throws Exception { this.ApplyType = fieldMap.get("ApplyType".toLowerCase()) == null ? "" : fieldMap.get("ApplyType".toLowerCase()).toString(); // 流程实例号 @@ -140,6 +143,14 @@ public class MakeContractBusinessBO implements Serializable { : fieldMap.get("customertype".toLowerCase()).toString(); // 租赁类型 this.ProjectName = fieldMap.get("project_name".toLowerCase()) == null ? "" : fieldMap.get("project_name".toLowerCase()).toString(); // 项目名称 + this.isNetCar = fieldMap.get("IS_NETCAR".toLowerCase()) == null ? "" + : fieldMap.get("IS_NETCAR".toLowerCase()).toString(); // 是否是网约车 + this.operationType = fieldMap.get("operationType".toLowerCase()) == null ? "" + : fieldMap.get("operationType".toLowerCase()).toString(); // 所属渠道 + this.gpsVendor = sqlca.getString("select GPS_VENDOR from prd_specific_library where PRODUCTID = '"+ProductId+"'"); + if( this.gpsVendor==null || this.gpsVendor.length()==0 ){ + this.gpsVendor = "null"; + } } public void businessAppStart(JBOTransaction tx) throws Exception { @@ -174,6 +185,11 @@ public class MakeContractBusinessBO implements Serializable { map.put("signType", signType); map.put("sealType", sealType); + map.put("isNetCar", isNetCar); + map.put("gpsVendor", gpsVendor); + map.put("operationType", operationType); + + JSONObject jsonObject = JSONObject.fromObject(map); this.fixedFlowParam = jsonObject.toString(); action.setFixedFlowParam(fixedFlowParam); @@ -425,4 +441,20 @@ public class MakeContractBusinessBO implements Serializable { ContractId = contractId; } + public String getIsNetCar() { + return isNetCar; + } + + public void setIsNetCar(String isNetCar) { + this.isNetCar = isNetCar; + } + + public String getGpsVendor() { + return gpsVendor; + } + + public void setGpsVendor(String gpsVendor) { + this.gpsVendor = gpsVendor; + } + } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java index cc6315b2f..20cfd8647 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/start/service/impl/BusinessApplyStartServiceImpl.java @@ -190,7 +190,7 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService System.out.println(testMap.toString()); System.out.println("======================================="); fieldMap = (Map) testMap.get("fieldMap"); - MakeContractBusinessBO bo = new MakeContractBusinessBO(fieldMap, tx); + MakeContractBusinessBO bo = new MakeContractBusinessBO(fieldMap, tx,sqlca); bo.businessAppStart(tx); tx.commit(); String sReturnInfo = bo.getMsg(); @@ -198,7 +198,7 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService Map body = new HashMap(); body.put("flowUnid", bo.getObjectNo()); body.put("objectNo", bo.getObjectNo()); - body.put("projectId", bo.getProjectId()); + body.put("contractId", bo.getContractId()); body.put("taskNo", bo.getSerialNo()); body.put("serialNo", bo.getSerialNo()); ReturnMapUtil.setReturnMap(body, diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/controller/ContractMakeController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/controller/ContractMakeController.java index b49ee78e4..3fa9821d5 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/controller/ContractMakeController.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/controller/ContractMakeController.java @@ -18,8 +18,16 @@ import com.base.util.ReturnMapUtil; @Path("/contract/make") public class ContractMakeController { - - //获取需要合同制作的代办数 + ContractMakeService service = new ContractMakeServiceImpl(); + /** + * 获取需要合同制作的代办数 + * @param request + * @param response + * @param tx + * @param sqlca + * @return + * @throws Exception + */ @Path("/get/number") @POST public Map getMakeContractNumber(@Context HttpServletRequest request, @@ -29,13 +37,52 @@ public class ContractMakeController { ARE.getLog() .info("[CONTROLLER] BusinessDataController run ................."); ARE.getLog().info( - "[Path] /contract/make/number" + " run ................."); - - ContractMakeService service = new ContractMakeServiceImpl(); + "[Path] /contract/make/get/number" + " run ................."); try { return service.getMakeContractNumber(request, response, tx, sqlca, ReturnMapUtil); } catch (Exception e) { return ReturnMapUtil.rollback(e); } } + + + /** + * 获取模板编号 + */ + @Path("/generate/contract") + @POST + public Map generateContract(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BusinessDataController run ................."); + ARE.getLog().info( + "[Path] /contract/make/generate/contract" + " run ................."); + try { + return service.generateContract(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + /** + * 获取模板编号 + */ + @Path("/get/templatenumber") + @POST + public Map getTemplateNumber(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] BusinessDataController run ................."); + ARE.getLog().info( + "[Path] /contract/make/get/templatenumber" + " run ................."); + try { + return service.getTemplateNumber(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/ContractMakeService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/ContractMakeService.java index 853529588..6e5efd872 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/ContractMakeService.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/ContractMakeService.java @@ -15,4 +15,15 @@ public interface ContractMakeService { @Context HttpServletResponse response, @Context JBOTransaction tx, @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception; + Map getTemplateNumber(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; + Map generateContract(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; + + + } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java index d7f09db05..2be98de21 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java @@ -7,15 +7,30 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT; +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_EQUIPMENT_CAR_TEMP; +import net.sf.json.JSONObject; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.Configure; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.base.constant.RestfullConstant; import com.base.util.MultipartDataUtil; import com.base.util.ReturnMapUtil; +import com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil; import com.tenwa.comm.util.jboutil.DataOperatorUtil; +import com.tenwa.makeContract.util.MakeOneCodeAndContractModel; +import com.tenwa.officetempalte.action.CreateContractOfficeAction; +import com.tenwa.util.MultiSubjectUtil; import apx.com.amarsoft.als.apzl.apply.contract.make.service.ContractMakeService; +import apx.com.amarsoft.als.apzl.apply.contract.make.util.ContractMakeControllerUtil; public class ContractMakeServiceImpl implements ContractMakeService{ @@ -45,5 +60,144 @@ public class ContractMakeServiceImpl implements ContractMakeService{ RestfullConstant.baseProperty.get("success").toString(), ""); return ReturnMapUtil.getReturnMap(); } - + @Override + public Map getTemplateNumber(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // 参数 + + Map body = new HashMap(); + String subjectId = fieldMap.get("SubjectId") == null ? "" : fieldMap.get("SubjectId").toString(); + String leasform = fieldMap.get("leasform") == null ? "" : fieldMap.get("leasform").toString(); + String operationType = fieldMap.get("operationType") == null ? "" : fieldMap.get("operationType").toString(); + String FlowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString(); + + body.put("FlowUnid", FlowUnid); + FileTemplateUtil ftu = new FileTemplateUtil(); + ftu.setSubjectId(subjectId); + ftu.setLeasform(leasform); + ftu.setOperationType(operationType); + String templateData = ftu.getContractClass(sqlca); + templateData = templateData.replace("[", ""); + templateData = templateData.replace("]", ""); + JSONObject json = JSONObject.fromObject(templateData); + Object fileTemplate =json.get("fileTemplate"); + JSONObject values = JSONObject.fromObject(fileTemplate); + body.put("templateName", values.get("text").toString()); + body.put("templateId", values.get("value").toString()); + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + //生成合同模板 + @Override + public Map generateContract(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // 参数 + Map body = new HashMap(); + + String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); + String flowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString(); + String templateId = fieldMap.get("templateId") == null ? "" : fieldMap.get("templateId").toString(); + Map flowParms = ContractMakeControllerUtil.getFlowParms(flowUnid); + String contractId = flowParms.get("ContractId"); + String projectId = flowParms.get("ProjectId"); + String contractNo = flowParms.get("ContractNo"); + + + body.put("FlowUnid", flowUnid); + String message = this.CheckCar(flowUnid, templateId, contractId); + String projectSignStatus = this.ProjectSignStatus(projectId); + Configure CurConfig = Configure.getInstance(); + String wordPath=CurConfig.getConfigure("FileSavePath"); + if(templateId == null || templateId.length() == 0){ + body.put("status", "faile"); + body.put("message", "模板编号不能为空!"); + }else if(message == null && !"success".equals(message)){ + body.put("status", "faile"); + body.put("message", message); + }else if("error".equals(projectSignStatus)){ + body.put("status", "faile"); + body.put("message", "请提醒客户查看手机短信,首先完成扣款卡的签约验证!"); + }else{ + flowParms.put("templateId", templateId); + flowParms.put("wordPath", wordPath); + String makeContract = ContractMakeControllerUtil.makeContract(flowParms, sqlca); + if(!"success".equals(makeContract)){ + body.put("status", "faile"); + body.put("message", makeContract); + }else{ + MakeOneCodeAndContractModel modc = new MakeOneCodeAndContractModel(); + String diskPath=CurConfig.getConfigure("OneDimensionalCode"); + //根据合同编号生成一维码图片 + String path = modc.MOneDimensionalCode(contractNo, contractId, projectId,diskPath,tx); + String outPdfFile = CurConfig.getConfigure("BQcontract"); + modc.pdfAndMark(outPdfFile, path, contractId,flowParms.get("leasform"), tx); +// //判断是否自动盖章sealType signType + if(("01".equals(flowParms.get("customertype"))&&"Auto".equals(flowParms.get("sealType")) )||("Auto".equals(flowParms.get("sealType")) && "Hand".equals(flowParms.get("signType")) )){ + modc.compnySignIng(contractId, tx); + } + } + } + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + + //校验租赁物信息和合同是否生成 + public String CheckCar(String flowunid,String templateId,String contractId) throws Exception{ + String message = "success"; + BizObjectManager lrct = JBOFactory.getBizObjectManager(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME); + BizObject lrc = lrct.createQuery("FLOWUNID=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + if(lrc!= null){ + int length = lrc.getAttribute("FRAME_NUMBER").toString().length(); + if(lrc.getAttribute("FRAME_NUMBER").toString().length()==0){ + message = "车架号、"; + } + if(lrc.getAttribute("CAR_COLOUR").toString().length()==0){ + message = message+"车辆颜色、"; + } + if(lrc.getAttribute("ENGINE_NUMBER").toString().length()==0){ + message = message+ "发动机号、"; + } + } + if(message.length()>0){ + return "请先填写:"+message.substring(0,message.length() - 1)+"!"; + } + String docName=""; + BizObjectManager btManager = JBOFactory.getBizObjectManager(BF_TEMPLATE.CLASS_NAME); + BizObjectManager ldclManager = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME); + List ldcls = ldclManager.createQuery("select * from O where file_flag='yes' and ( flow_unid=:flowunid or contract_id=:contractid ) ").setParameter("flowunid", flowunid).setParameter("contractid", contractId).getResultList(false); + + BizObject templatename = btManager.createQuery("select templatename from O where id=:id").setParameter("id", templateId).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){ + message=docName+":已存在,请先删除后再生成!"; + } + return message; + } + + + //检查该项目是否进行过签约验证 + public String ProjectSignStatus(String projectid) throws Exception{ + BizObjectManager caManage = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME); + BizObject ca = caManage.createQuery("PROJECT_ID=:projectid").setParameter("projectid", projectid).getSingleResult(false); + String falg = "error"; + String string = ca.getAttribute("SIGN_STATUS").getString(); + System.out.println(string); + if("Y".equals(ca.getAttribute("SIGN_STATUS").getString())){ + return "success"; + } + return falg; + } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/util/ContractMakeControllerUtil.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/util/ContractMakeControllerUtil.java new file mode 100644 index 000000000..3bf6b1dc9 --- /dev/null +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/util/ContractMakeControllerUtil.java @@ -0,0 +1,214 @@ +package apx.com.amarsoft.als.apzl.apply.contract.make.util; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONObject; + +import com.alibaba.fastjson.JSON; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.awe.Configure; +import com.amarsoft.awe.util.Transaction; +import com.base.util.WordToPDFUtil; +import com.tenwa.makeContract.util.MakeOneCodeAndContractModel; +import com.tenwa.officetempalte.action.CreateContractOfficeAction; + +import jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_COMPANY_TEMP; +import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; +import jbo.app.tenwa.doc.LB_DOCATTRIBUTE; +import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST; +import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; +import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP; +import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP; + +public class ContractMakeControllerUtil { + + public static String makeContract(Map map,Transaction sqlca) throws Exception { + String message = "success"; + CreateContractOfficeAction ccoAction = new CreateContractOfficeAction(); + ccoAction.setTemplateNo(map.get("templateId")); + ccoAction.setTemplateParam(makeContractParms(map, sqlca)); + //生成word文档 + //String sResult = ccoAction.createOfficeByTemplate(sqlca); + MakeOneCodeAndContractModel modc = new MakeOneCodeAndContractModel(); + String sResult = modc.createBqWord(makeContractParms(map, sqlca), map.get("templateId"), sqlca); + String wordToPdfMasage = wordToPdf(sqlca,map.get("FlowUnid")); + if(!"success".equals(wordToPdfMasage)) { + message = "合同转pdf失败!"; + } + + return message; + } + + public static String makeContractParms(Map map, Transaction sqlca) throws Exception { + String flowUnid= map.get("FlowUnid"); + Map tempParam = new HashMap(); + tempParam.put("CurUserId", map.get("CurUserID")); + tempParam.put("CurOrgId", map.get("CurUserID")); + tempParam.put("OBJECTTYPE", "BContractApproveFlow" ); + tempParam.put("FLOW_UNID", flowUnid); + tempParam.put("CONTRACT_ID", map.get("ContractId")); + tempParam.put("PROJECT_ID",map.get("ProjectId")); + tempParam.put("contractNo", map.get("FlowKey")); + tempParam.put("fileSavePath" , map.get("wordPath")); + //获取对应的承租信息 + String certid=""; + String mobile=""; + String address=""; + //网约车挂靠方信息 + String NetMortgagor = ""; + String NetCertid = ""; + String NetMobile = ""; + String Netaddress=""; + + String customerid = sqlca.getString("select customer_id from lb_union_lessee_temp where flowunid='"+flowUnid+"'"); + if("01".equals(map.get("customertype"))){ + BizObjectManager cctm = JBOFactory.getBizObjectManager(CUSTOMER_COMPANY_TEMP.CLASS_NAME); + String sSql = "select o.certid,o.tel,o.reg_address,o.company_name FROM o where o.customerid =:customerid"; + BizObject cct = cctm.createQuery(sSql).setParameter("customerid", customerid).getSingleResult(false); + certid=cct.getAttribute("certid").getString(); + mobile=cct.getAttribute("tel").getString(); + address=cct.getAttribute("reg_address").getString(); + NetMortgagor=cct.getAttribute("company_name").getString(); + }else{ + BizObjectManager cptm = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME); + BizObjectManager catm = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME); + String sSql = "select o.certid,o.mobile,o.nativeplace,o.MAILING_ADDRESS,o.fullname,o.WORKADD FROM o where o.customerid =:customerid and o.flowunid=:flowunid"; + String catSql = "select o.FULLADDRESS FROM o where o.customerid =:customerid and o.flowunid=:flowunid"; + BizObject cpt = cptm.createQuery(sSql).setParameter("customerid", customerid).setParameter("flowunid", flowUnid).getSingleResult(false); + BizObject cat = catm.createQuery(catSql).setParameter("customerid", customerid).setParameter("flowunid", flowUnid).getSingleResult(false); + certid=cpt.getAttribute("certid").getString(); + mobile=cpt.getAttribute("mobile").getString(); + if("居住地址".equals(cpt.getAttribute("MAILING_ADDRESS").getString())){ + address=cat.getAttribute("FULLADDRESS").getString(); + }else if("户籍地址".equals(cpt.getAttribute("MAILING_ADDRESS").getString())){ + address=cpt.getAttribute("nativeplace").getString(); + }else if("单位地址".equals(cpt.getAttribute("MAILING_ADDRESS").getString())){ + address=cpt.getAttribute("WORKADD").getString(); + } + NetMortgagor=cpt.getAttribute("fullname").getString(); + } + //给网约车模板 + if("1".equals(map.get("isNetCar"))){ + BizObjectManager cctm = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO_TEMP.CLASS_NAME); + String sSql = "select o.IS_AFFILIATED,o.NETCERTID,o.AFFILIATEDNAME,o.AFFILIATEDACTUALADDRESS FROM o where o.flowunid =:flowunid"; + BizObject cct = cctm.createQuery(sSql).setParameter("flowunid", flowUnid).getSingleResult(false); + if("1".equals(cct.getAttribute("IS_AFFILIATED").getString())){ + NetMortgagor = cct.getAttribute("AFFILIATEDNAME").getString(); + NetCertid = cct.getAttribute("NETCERTID").getString(); + Netaddress = cct.getAttribute("AFFILIATEDACTUALADDRESS").getString(); + }else{ + NetCertid = certid; + NetMobile = mobile; + Netaddress = address; + } + } + tempParam.put("certid", certid); + tempParam.put("mobile", mobile); + tempParam.put("address", address); + tempParam.put("NETMORTGAGOR", NetMortgagor); + tempParam.put("NETCERTID", NetCertid); + tempParam.put("NETMOBILE", NetMobile); + tempParam.put("NETADDRESS", Netaddress); + JSONObject jsonObject = JSONObject.fromObject(tempParam); + String sJson = jsonObject.toString(); + sJson = sJson.replaceAll("/,/g", "@"); + return sJson; + } + + public static Map getFlowParms(String flowUnid) throws Exception{ + BizObjectManager fboMange = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); + BizObject fbo = fboMange.createQuery("flow_unid=:flow_unid").setParameter("flow_unid", flowUnid).getSingleResult(false); + return JSON.parseObject(fbo.getAttribute("FixedFlowParam").getString(),Map.class); + + } + + + /** + * LibreOffice实现word转换pdf + * word转换pdf + * @throws JBOException + */ + public static String wordToPdf(JBOTransaction tx, String FlowUnid) throws Exception { + WordToPDFUtil wordTopdf = new WordToPDFUtil(); + BizObjectManager fbo = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME, tx); + BizObject fbos = fbo.createQuery("FLOW_UNID=:flowunid").setParameter("flowunid", FlowUnid) + .getSingleResult(false); + // 获取用户信息 + BizObjectManager lult = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_TEMP.CLASS_NAME); + BizObjectManager customer = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME); + BizObject lults = lult.createQuery("flowunid=:flowUnid").setParameter("flowUnid", FlowUnid) + .getSingleResult(false); + BizObject cust = customer.createQuery("flowunid=:flowUnid and customerid=:customerid") + .setParameter("flowUnid", FlowUnid) + .setParameter("customerid", lults.getAttribute("customer_id").toString()).getSingleResult(false); + String customername = null; + String telephone = null; + String ids = null; + + if (cust != null) { + customername = cust.getAttribute("FULLNAME").toString(); + telephone = cust.getAttribute("mobile").toString(); + ids = cust.getAttribute("CUSTOMERID").toString(); + } + + BizObjectManager contBom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME, tx); + BizObjectManager attrBom = JBOFactory.getBizObjectManager(LB_DOCATTRIBUTE.CLASS_NAME,tx); + File file = null; + Boolean result = null; + List bo = contBom.createQuery("flow_unid=:flowUnid and file_flag='yes' and process='1'") + .setParameter("flowUnid", FlowUnid).getResultList(true); + if (bo != null) { + for (BizObject contBo : bo) { + String attrId = contBo.getAttribute("ATTRIBUTE_ID").toString(); + BizObject attrBo = attrBom.createQuery("ID=:id").setParameter("id", attrId).getSingleResult(true); + String path = attrBo.getAttribute("FULLPATH").toString(); + String lastFilePath = path.replace(".docx", ".pdf"); + path = path.replace("//", "/"); + File filePath = new File(path); + if (!filePath.exists()) { + System.out.println("word转换pdf的源文件不存在"); + continue; + } + String lastFilePathpdf = filePath.getParent(); + try { + //result = wToPdfChange(path,lastFilePathpdf); + result = wordTopdf.Word2Pdf(path, lastFilePathpdf); + } catch (Exception e) { + result = false; + e.printStackTrace(); + } + if (result) { + file = new File(lastFilePath); + contBo.setAttributeValue("FULLPATH", lastFilePath); + contBo.setAttributeValue("FILENAME",contBo.getAttribute("FILENAME").toString().replace(".docx", ".pdf")); + contBo.setAttributeValue("FILEPATH",contBo.getAttribute("FILEPATH").toString().replace(".docx", ".pdf")); + contBo.setAttributeValue("CONTENT_TYPE", "application/pdf"); + contBo.setAttributeValue("PROCESS", "2"); + contBo.setAttributeValue("PROJECT_ID", fbos.getAttribute("proj_id").toString()); + contBo.setAttributeValue("CUSTOMERNAME", customername); + contBo.setAttributeValue("TELEPHONE", telephone); + contBo.setAttributeValue("IDS", ids); + contBom.saveObject(contBo); + 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 { + contBo.setAttributeValue("PROCESS", "3"); + contBom.saveObject(contBo); + } + } + } + + return "success"; + } +} diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/controller/FlowDataController.java b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/controller/FlowDataController.java index 53720f2ea..02b942500 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/controller/FlowDataController.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/controller/FlowDataController.java @@ -19,7 +19,10 @@ import com.base.util.ReturnMapUtil; @Path("/flow/data") public class FlowDataController { FlowDataService service = new FlowDataServiceImpl(); - //获取流程中银行卡信息 + + /** + * 获取流程中银行卡信息 + */ @Path("/get/bankcard") @POST public Map getFlowBankCard(@Context HttpServletRequest request, @@ -37,7 +40,9 @@ public class FlowDataController { } } - //获取流程中银行卡信息 + /** + * 获取流程中银行卡信息 + */ @Path("/save/bankcard") @POST public Map saveFlowBankCard(@Context HttpServletRequest request, @@ -54,4 +59,64 @@ public class FlowDataController { return ReturnMapUtil.rollback(e); } } + + /** + * 获取合同制作时的扣款卡信息 + */ + @Path("/get/contractmakebankCard") + @POST + public Map getContractMakeBankCard(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] FlowDataController run ................."); + ARE.getLog().info( + "[Path] /flow/data/get/contractmakebankCard" + " run ................."); + try { + return service.getContractMakeBankCard(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + /** + * 保存合同制作扣款卡信息的方法 + */ + @Path("/save/contractmakebankCard") + @POST + public Map saveContractMakeBankCard(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] FlowDataController run ................."); + ARE.getLog().info( + "[Path] /flow/data/save/contractmakebankCard" + " run ................."); + try { + return service.saveContractMakeBankCard(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } + + /** + * 获取扣款卡姓名信息 + */ + @Path("/get/accountpersoninfo") + @POST + public Map getAccountPersonInfo(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca) throws Exception { + ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca); + ARE.getLog() + .info("[CONTROLLER] FlowDataController run ................."); + ARE.getLog().info( + "[Path] /flow/data/get/accountpersoninfo" + " run ................."); + try { + return service.getAccountPersonInfo(request, response, tx, sqlca, ReturnMapUtil); + } catch (Exception e) { + return ReturnMapUtil.rollback(e); + } + } } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/FlowDataService.java b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/FlowDataService.java index ca69dbbdd..0540584be 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/FlowDataService.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/FlowDataService.java @@ -20,4 +20,18 @@ public interface FlowDataService { @Context HttpServletResponse response, @Context JBOTransaction tx, @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception; + Map getContractMakeBankCard(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; + Map saveContractMakeBankCard(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; + + Map getAccountPersonInfo(@Context HttpServletRequest request, + @Context HttpServletResponse response, @Context JBOTransaction tx, + @Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception; + } diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java index 9e782c927..63ad7c869 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java @@ -7,8 +7,12 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT; +import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_HIS; import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_TEMP; import jbo.app.tenwa.customer.CUSTOMER_INFO_TEMP; +import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST; +import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP; import com.amarsoft.are.jbo.BizObject; @@ -65,7 +69,6 @@ public class FlowDataServiceImpl implements FlowDataService{ body.put("mobile", ""); body.put("certid", ""); } - BizObject lult = this.getLult(flowunid); ReturnMapUtil.setReturnMap(body, RestfullConstant.baseProperty.get("success").toString(), ""); return ReturnMapUtil.getReturnMap(); @@ -126,4 +129,133 @@ public class FlowDataServiceImpl implements FlowDataService{ return lultManage.createQuery(" flowunid=:flowunid ").setParameter("flowunid", flowunid).getSingleResult(false); } + + @Override + public Map getContractMakeBankCard( + HttpServletRequest request, HttpServletResponse response, + JBOTransaction tx, Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // 参数 + String productId = fieldMap.get("product_id") == null ? "" : fieldMap.get("product_id").toString(); + String ContractId = fieldMap.get("ContractId") == null ? "" : fieldMap.get("ContractId").toString(); + String FlowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString(); + String sql = "SELECT id,acc_number,bank_name,account,customerid,project_id,mobile,certid FROM customer_account WHERE acc_type='Debit' and project_id='"+productId+"'"; + List> dataList = DataOperatorUtil.getDataBySql(sql); + Map body = new HashMap(); + Map data = new HashMap(); + if(dataList.size()>0){ + data.put("id", dataList.get(0).get("id")+""); + data.put("acc_number", dataList.get(0).get("acc_number")+""); + data.put("bank_name", dataList.get(0).get("bank_name")+""); + data.put("account", dataList.get(0).get("account")+""); + data.put("project_id", dataList.get(0).get("project_id")+""); + data.put("mobile", dataList.get(0).get("mobile")+""); + data.put("certid", dataList.get(0).get("certid")+""); + body.put("statusCode", "00"); + }else{ + data.put("id", ""); + data.put("acc_number", ""); + data.put("bank_name", ""); + data.put("account", ""); + data.put("project_id", productId); + data.put("mobile", ""); + data.put("certid", ""); + + body.put("statusCode", "01"); + } + data.put("contract_id", ContractId); + body.put("datas", data); + data.put("FlowUnid", FlowUnid); + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + + @Override + public Map saveContractMakeBankCard( + HttpServletRequest request, HttpServletResponse response, + JBOTransaction tx, Transaction sqlca, ReturnMapUtil ReturnMapUtil) + throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // 参数 + Map body = new HashMap(); + String projectId = fieldMap.get("project_id") == null ? "" : fieldMap.get("project_id").toString(); + String ContractId = fieldMap.get("contract_id") == null ? "" : fieldMap.get("contract_id").toString(); + String FlowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString(); + String acc_number = fieldMap.get("acc_number") == null ? "" : fieldMap.get("acc_number").toString(); + String bank_name = fieldMap.get("bank_name") == null ? "" : fieldMap.get("bank_name").toString(); + String account = fieldMap.get("account") == null ? "" : fieldMap.get("account").toString(); + String mobile = fieldMap.get("mobile") == null ? "" : fieldMap.get("mobile").toString(); + String certid = fieldMap.get("certid") == null ? "" : fieldMap.get("certid").toString(); + BizObjectManager ldclManager = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME); + List ldcls = ldclManager.createQuery("select * from O where file_flag='yes' and ( flow_unid=:flowunid or contract_id=:contractid ) ").setParameter("flowunid", FlowUnid).setParameter("contractid", ContractId).getResultList(false); + body.put("FlowUnid", FlowUnid); + if(ldcls.size()>0){ + body.put("statusCode", "01"); + body.put("msg", "已生成合同无法进行扣款卡修改!"); + }else{ + BizObjectManager cahManage = JBOFactory.getFactory().getManager(CUSTOMER_ACCOUNT_HIS.CLASS_NAME); + BizObjectManager caManage = JBOFactory.getFactory().getManager(CUSTOMER_ACCOUNT.CLASS_NAME,tx); + BizObject ca = caManage.createQuery(" project_id=:project_id ").setParameter("project_id", projectId).getSingleResult(false); + if( ca!=null && "Y".equals(ca.getAttribute("sign_status")==null?"":ca.getAttribute("sign_status").toString())){ + BizObject cah = cahManage.createQuery(" account=:account and acc_number=:acc_number and bank_name=:bank_name and mobile=:mobile ") + .setParameter("account", ca.getAttribute("account").toString()).setParameter("acc_number", ca.getAttribute("acc_number").toString()).setParameter("bank_name", ca.getAttribute("bank_name").toString()).setParameter("mobile", ca.getAttribute("mobile").toString()).getSingleResult(false); + if(cah == null ){ + Map signFromCondtion=new HashMap(); + signFromCondtion.put("PROJECT_ID",projectId); + DataOperatorUtil.copyJBOSet(CUSTOMER_ACCOUNT.CLASS_NAME, signFromCondtion,CUSTOMER_ACCOUNT_HIS.CLASS_NAME, null, null,null, tx); + } + }else{ + ca = caManage.newObject(); + BizObject lul = JBOFactory.getFactory().getManager(LB_UNION_LESSEE.CLASS_NAME).createQuery(" project_id=:project_id ").setParameter("project_id", projectId).getSingleResult(false); + ca.setAttributeValue("customerid", lul.getAttribute("customer_id").getString()); + } + ca.setAttributeValue("acc_number", acc_number); + ca.setAttributeValue("bank_name", bank_name); + ca.setAttributeValue("account",account); + ca.setAttributeValue("mobile", mobile); + ca.setAttributeValue("certid", certid); + ca.setAttributeValue("project_id", projectId); + ca.setAttributeValue("contract_id", ContractId); + ca.setAttributeValue("sign_status", this.getSigStatus(account, acc_number, bank_name, mobile)); + caManage.saveObject(ca); + body.put("statusCode", "00"); + body.put("msg", "保存成功!"); + } + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } + + public String getSigStatus(String account,String acc_number,String bank_name,String mobile) throws Exception{ + BizObjectManager cahManage = JBOFactory.getFactory().getManager(CUSTOMER_ACCOUNT_HIS.CLASS_NAME); + BizObject cah = cahManage.createQuery(" account=:account and acc_number=:acc_number and bank_name=:bank_name and mobile=:mobile and sign_status='Y'") + .setParameter("account", account).setParameter("acc_number", acc_number).setParameter("bank_name", bank_name).setParameter("mobile", mobile).getSingleResult(false); + if(cah == null ){ + return "Y"; + }else{ + return "N"; + } + } + + @Override + public Map getAccountPersonInfo(HttpServletRequest request, + HttpServletResponse response, JBOTransaction tx, Transaction sqlca, + ReturnMapUtil ReturnMapUtil) throws Exception { + Map testMap = (Map) MultipartDataUtil + .readRequestParam(request, "UTF-8"); + fieldMap = (Map) testMap.get("fieldMap"); // 参数 + Map body = new HashMap(); + String flowunid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString(); + String sql = "SELECT certid,FULLNAME AS NAME,MOBILE AS phone,'assuror' AS custtype,'担保人' AS typename FROM LB_GUARANTEE_UNIT_TEMP WHERE flowunid='"+flowunid+"' AND CERTTYPE='Ind01' AND CASE WHEN '01'='03' THEN 1=1 ELSE 1=2 END UNION SELECT certid,NAME,tel AS phone,'unionlessee' AS custtype,'共同申请人' AS typename FROM CUSTOMER_FAMILY_TEMP WHERE flowunid='"+flowunid+"' AND Partner_='Y' UNION SELECT certid,fullname AS NAME,mobile AS phone,'lessee' AS custtype,'承租人' AS typename FROM customer_person_temp WHERE flowunid='"+flowunid+"'"; + List> dataList = DataOperatorUtil.getDataBySql(sql); + body.put("FlowUnid", flowunid); + body.put("datas", dataList); + ReturnMapUtil.setReturnMap(body, + RestfullConstant.baseProperty.get("success").toString(), ""); + return ReturnMapUtil.getReturnMap(); + } }