1.三期补充2

This commit is contained in:
zhangbb 2019-12-26 10:22:28 +08:00
parent 01dc8d048a
commit 2be3323711
3 changed files with 523 additions and 403 deletions

View File

@ -1,76 +1,120 @@
<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_PROCESS"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_TEMP"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
String flowunid = CurPage.getParameter("FlowUnid");
String phaseNo = CurPage.getParameter("PhaseNo");
String rightType = CurPage.getParameter("RightType");
String ishistory = CurPage.getParameter("IsHistory");
String sTempletNo = CurPage.getParameter("TempletNo");//模板号
ASObjectModel doTemp = new ASObjectModel("LCEbankListRebackTemp");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory");
}
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1";
dwTemp.ShowSummary = "1";
dwTemp.ReadOnly = "1";
if("0040".equals(phaseNo)){
dwTemp.ReadOnly = "0";
}
if(!"ReadOnly".equals(rightType)){
dwTemp.MultiSelect = true;
}
dwTemp.setPageSize(50);
ASDataObject ado = dwTemp.getDataObject();
dwTemp.genHTMLObjectWindow(flowunid);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String[][] sButtons = null;
if("ReadOnly".equals(rightType)){
sButtons = new String[][]{
};
}else if("0010".equals(phaseNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
{"true","","Button","撤销","撤销","deleteProcess()","","","","btn_icon_delete",""}
};
}else if("0040".equals(phaseNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
};
}
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function deleteProcess(){
var ebankNumber = getItemValueArray(0,"EBANK_NUMBER")+","+TablePage.getCheckedItemValueArrayWithOtherPage("EBANK_NUMBER",s_c_p[0]);
if("," == ebankNumber){
alert("请先选择需要撤回的选项");
return;
}
ebankNumber = ebankNumber.replace(/,/ig,"@");
if(ebankNumber.startsWith("@")){
ebankNumber = ebankNumber.substring(1);
}
var sResult = RunJavaMethodTrans("com.tenwa.lease.flow.rent.rentreback.OtherPayMethod","deleteProcess",
"ebankNumbers="+ebankNumber+",flowunid=<%=flowunid%>");
if("success"==sResult){
as_delete(0);
alert("撤销成功!");
reloadSelf();
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}else{
alert("撤销失败!");
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}
}
</script>
<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_PROCESS"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_TEMP"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
String flowunid = CurPage.getParameter("FlowUnid");
String phaseNo = CurPage.getParameter("PhaseNo");
String rightType = CurPage.getParameter("RightType");
String ishistory = CurPage.getParameter("IsHistory");
String sTempletNo = CurPage.getParameter("TempletNo");//模板号
ASObjectModel doTemp = new ASObjectModel("LCEbankListRebackTemp");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1";
dwTemp.ShowSummary = "1";
dwTemp.ReadOnly = "1";
if("0010".equals(phaseNo)||"0040".equals(phaseNo)){
dwTemp.ReadOnly = "0";
}
if(!"ReadOnly".equals(rightType)){
dwTemp.MultiSelect = true;
}
dwTemp.setPageSize(50);
ASDataObject ado = dwTemp.getDataObject();
dwTemp.genHTMLObjectWindow(flowunid);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String[][] sButtons = null;
if("ReadOnly".equals(rightType)){
sButtons = new String[][]{
};
}else if("0010".equals(phaseNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
{"true","","Button","撤销","撤销","deleteProcess()","","","","btn_icon_delete",""},
{"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}
};
}else if("0040".equals(phaseNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
{"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}
};
}else{
sButtons = new String[][]{};
}
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
$(function (){
if(<%=phaseNo%>=="0040"){
// setItemReadOnly(0,0,"splitting_money");
}
});
function deleteProcess(){
var ebankNumber = getItemValueArray(0,"EBANK_NUMBER")+","+TablePage.getCheckedItemValueArrayWithOtherPage("EBANK_NUMBER",s_c_p[0]);
if("," == ebankNumber){
alert("请先选择需要撤回的选项");
return;
}
ebankNumber = ebankNumber.replace(/,/ig,"@");
if(ebankNumber.startsWith("@")){
ebankNumber = ebankNumber.substring(1);
}
var sResult = RunJavaMethodTrans("com.tenwa.lease.flow.rent.rentreback.OtherPayMethod","deleteProcess",
"ebankNumbers="+ebankNumber+",flowunid=<%=flowunid%>");
if("success"==sResult){
as_delete(0);
alert("撤销成功!");
reloadSelf();
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}else{
alert("撤销失败!");
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}
}
function exportExcel(){
var param={};
var tempParam={};
var sparam="";
//模板号
param["templateNo"]="4206a2b7414f4226b7d1cc53019e8ee8";
//生成文件关联关系
tempParam["OBJECTTYPE"]="网银退款明细";
tempParam["FLOW_UNID"]="<%=flowunid%>";
//生成模板固定参数
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>";
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
for(var key in param){
if(sparam.length>0){sparam+=",";}
sparam+=key+"="+param[key];
}
var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam);
if(result == "success"){
var attributeID = AsControl.RunJsp("/Tenwa/Lease/Flow/Rent/BatchIncome/GetLBDocAttributeID.jsp",
"FLOW_UNID="+tempParam["FLOW_UNID"]+"&OBJECTTYPE="+tempParam["OBJECTTYPE"]);
downloadFile(attributeID);
}else{
alert("导出失败!");
}
}
function downloadFile(id){
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -1,75 +1,150 @@
<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_PROCESS"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_TEMP"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
String flowunid = CurPage.getParameter("FlowUnid");
String phaseNo = CurPage.getParameter("PhaseNo");
String rightType = CurPage.getParameter("RightType");
String ishistory = CurPage.getParameter("IsHistory");
String sTempletNo = CurPage.getParameter("TempletNo");//模板号
ASObjectModel doTemp = new ASObjectModel("LCSplittingPayTempList");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory");
}
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1";
dwTemp.ShowSummary = "1";
if(!"ReadOnly".equals(rightType)){
dwTemp.MultiSelect = true;
}
dwTemp.ReadOnly = "1";
if("0040".equals(phaseNo)){
dwTemp.ReadOnly = "0";
}
dwTemp.setPageSize(50);
ASDataObject ado = dwTemp.getDataObject();
dwTemp.genHTMLObjectWindow(flowunid);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String[][] sButtons = null;
if("ReadOnly".equals(rightType)){
sButtons = new String[][]{
};
}else if("0010".equals(phaseNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
{"true","","Button","撤销","撤销","deleteProcess()","","","","btn_icon_delete",""}
};
}else{
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
};
}
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function deleteProcess(){
var planID = getItemValueArray(0,"plan_id")+","+TablePage.getCheckedItemValueArrayWithOtherPage("plan_id",s_c_p[0]);
if("," == planID){
alert("请先选择需要撤回的选项");
return;
}
planID = planID.replace(/,/ig,"@");
if(planID.startsWith("@")){
planID = planID.substring(1);
}
var sResult = RunJavaMethodTrans("com.tenwa.lease.flow.rent.rentreback.OtherPayMethod","changeSplittingStatusBatch",
"planIDs="+planID);
if("success"==sResult){
as_delete(0);
alert("撤销成功!");
reloadSelf();
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}else{
alert("撤销失败!");
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}
}
</script>
<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_PROCESS"%>
<%@page import="jbo.app.tenwa.calc.LC_EBANK_TEMP"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
String flowunid = CurPage.getParameter("FlowUnid");
String phaseNo = CurPage.getParameter("PhaseNo");
String rightType = CurPage.getParameter("RightType");
String ishistory = CurPage.getParameter("IsHistory");
String sTempletNo = CurPage.getParameter("TempletNo");//模板号
ASObjectModel doTemp = new ASObjectModel("LCSplittingPayTempList");
doTemp.setHtmlEvent("service_money", "onchange", "getSplittingMoney");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1";
dwTemp.ShowSummary = "1";
if(!"ReadOnly".equals(rightType)){
dwTemp.MultiSelect = true;
}
dwTemp.ReadOnly = "1";
if("0010".equals(phaseNo)||"0040".equals(phaseNo)){
dwTemp.ReadOnly = "0";
}
dwTemp.setPageSize(50);
ASDataObject ado = dwTemp.getDataObject();
dwTemp.genHTMLObjectWindow(flowunid);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String[][] sButtons = null;
if("ReadOnly".equals(rightType)){
sButtons = new String[][]{
};
}else if("0010".equals(phaseNo)){
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
{"true","","Button","撤销","撤销","deleteProcess()","","","","btn_icon_delete",""},
{"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_detail",""},
{"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}
};
}else{
sButtons = new String[][]{
{"true","","Button","保存","保存","as_save(0)","","","","btn_icon_save",""},
{"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}
};
}
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
$(function (){
if(<%=phaseNo%>=="0040"){
setItemReadOnly(0,0,"splitting_money");
setItemReadOnly(0,0,"service_money");
setItemReadOnly(0,0,"service_ratio");
}
});
function getSplittingMoney(){
var INTEREST_sp = getItemValue(0,getRow(),"INTEREST_sp");
var splittingMoney = INTEREST_sp-getItemValue(0,getRow(),"service_money");
setItemValue(0,getRow(),"splitting_money",splittingMoney+"");
}
function deleteProcess(){
var planID = getItemValueArray(0,"plan_id")+","+TablePage.getCheckedItemValueArrayWithOtherPage("plan_id",s_c_p[0]);
if("," == planID){
alert("请先选择需要撤回的选项");
return;
}
planID = planID.replace(/,/ig,"@");
if(planID.startsWith("@")){
planID = planID.substring(1);
}
var sResult = RunJavaMethodTrans("com.tenwa.lease.flow.rent.rentreback.OtherPayMethod","changeSplittingStatusBatch",
"planIDs="+planID);
if("success"==sResult){
as_delete(0);
alert("撤销成功!");
reloadSelf();
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}else{
alert("撤销失败!");
TablePage.pageCheckedData = {};
TablePage.pageUncheckedData = {};
}
}
function batchModify(){
var rows = getCheckedRows(0);
if(rows.length == 0){
alert("请选择需要批量修改的数据!");
return;
}
AsDialog.PopView("/Tenwa/Lease/Flow/Rent/RentReback/SplittingBatchModify.jsp",'',"dialogWidth=800px;dialogHeight=350px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(data){
if(data.length==0){
return;
}
for(var i=0;i<rows.length;i++){
for (var key in data){
if(typeof(data[key])=="undefined"||""==data[key]){
continue;
}
var INTEREST_sp = getItemValue(0,rows[i],"INTEREST_sp");
var splittingMoney = INTEREST_sp-data[key];
setItemValue(0,rows[i],key,data[key]);
setItemValue(0,rows[i],"splitting_money",splittingMoney+"");
}
}
as_save(0);
},"批量修改");
}
function exportExcel(){
var param={};
var tempParam={};
var sparam="";
//模板号
param["templateNo"]="6e9c203900b7498499717de902f21d8d";
//生成文件关联关系
tempParam["OBJECTTYPE"]="分润支付报表";
tempParam["FLOW_UNID"]="<%=flowunid%>";
//生成模板固定参数
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>";
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
for(var key in param){
if(sparam.length>0){sparam+=",";}
sparam+=key+"="+param[key];
}
var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam);
if(result == "success"){
var attributeID = AsControl.RunJsp("/Tenwa/Lease/Flow/Rent/BatchIncome/GetLBDocAttributeID.jsp",
"FLOW_UNID="+tempParam["FLOW_UNID"]+"&OBJECTTYPE="+tempParam["OBJECTTYPE"]);
downloadFile(attributeID);
}else{
alert("导出失败!");
}
}
function downloadFile(id){
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -1,254 +1,255 @@
package com.tenwa.lease.flow.rent.rentreback;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jbo.app.tenwa.calc.LC_EBANK_PROCESS;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.app.tenwa.customer.LPOUNDAGE_MAINTENANCE;
import jbo.com.tenwa.entity.comm.flow.LC_SPLITTING_PAY_TEMP;
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.StringFunction;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.lease.flow.comm.service.LeaseFlowBaseService;
import com.tenwa.lease.flow.comm.service.ServiceOperatorEnum;
import com.tenwa.lease.flow.comm.serviceImp.LeaseFlowBaseServiceImp;
import com.tenwa.quartz.DateUtil;
public class OtherPayMethod {
private String flowunid;
private String planIDs;
private String interestSPs;
private String serviceType;
private String ids;
private String mayopeMoney;
private String ebankNumbers;
public String createSplittingPayTemp(JBOTransaction tx) throws JBOException{
BigDecimal ratio = null;
String[] planID = planIDs.split("@");
String chargeWay = "AutoBuckle";
for(int i=0;i<planID.length;i++){
BizObject boLRP = JBOFactory.createBizObjectQuery(LC_RENT_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", planID[i]).getSingleResult(false);
String interest_sp = boLRP.getAttribute("INTEREST_sp")==null?"0":boLRP.getAttribute("INTEREST_sp").toString();
String coolectStatus = boLRP.getAttribute("COLLECT_STATUS")==null?"0":boLRP.getAttribute("COLLECT_STATUS").toString();
if(!"代偿".equals(coolectStatus)){
BizObject boLRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PLAN_ID=:ID").setParameter("ID", planID[i]).getSingleResult(false);
chargeWay = boLRI.getAttribute("CHARGE_WAY")==null?"0":boLRP.getAttribute("CHARGE_WAY").toString();
}
String serviceMoney = "0";
String splitting_money = interest_sp;
ratio = getRatio(tx,chargeWay);
if(ratio==null){
return "获取手续费费率失败。";
}
if(ratio.compareTo(new BigDecimal("0"))!=0){
serviceMoney = (new BigDecimal(interest_sp)).multiply(ratio).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
splitting_money = (new BigDecimal(interest_sp)).subtract(new BigDecimal(serviceMoney)).toString();
}
String plan_id = planID[i];
try {
BizObjectManager bomLspt = JBOFactory.getBizObjectManager(LC_SPLITTING_PAY_TEMP.CLASS_NAME,tx);
BizObject bolspt = bomLspt.newObject();
bolspt.setAttributeValue("plan_id", plan_id);
bolspt.setAttributeValue("splitting_money", splitting_money);
bolspt.setAttributeValue("service_ratio", ratio.multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
bolspt.setAttributeValue("service_money", serviceMoney);
bolspt.setAttributeValue("flowunid", flowunid);
bolspt.setAttributeValue("inputtime", StringFunction.getTodayNow());
bomLspt.saveObject(bolspt);
changeSplittingStatus(tx,plan_id,"0");
} catch (Exception e) {
e.printStackTrace();
return "插入临时表失败";
}
}
return "success";
}
/**
* 更改分润支付状态
* @param tx
* @param planID
* @param status 已支付为Y流程中为0未支付为null
* @return
*/
public String changeSplittingStatus(JBOTransaction tx,String planID,String status){
SqlObject so;
try {
so = new SqlObject("update LC_RENT_PLAN set splitting_status='"+status+"' where id='"+planID+"'");
Transaction.createTransaction(tx).executeSQL(so);
} catch (Exception e) {
e.printStackTrace();
return "Error";
}
return "Success";
}
public String changeSplittingStatusBatch(JBOTransaction tx){
String[] planID = planIDs.split("@");
for(String plan_id:planID){
changeSplittingStatus(tx,plan_id,"N");
}
return "success";
}
public String createRebackList(JBOTransaction tx){
String idArray[] = ids.split("@");
String m_Money[] = mayopeMoney.split("@");
int failNmber = 0;
for(int i=0;i<idArray.length;i++){
Map<String,String> fromCondtion = new HashMap<String, String>();
fromCondtion.put("id",idArray[i]);
Map<String,String> otherProperty = new HashMap<String,String>();
otherProperty.put("FlowUnid", flowunid);
otherProperty.put("MAYOPE_MONEY", "0.00");
otherProperty.put("RETURN_MONEY", m_Money[i]);
LeaseFlowBaseService service=new LeaseFlowBaseServiceImp();
try {
BizObjectManager bom = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME,tx);
BizObject bo = bom.newObject();
bo.setAttributeValue("EBANK_NUMBER", idArray[i]);
bo.setAttributeValue("FLOW_NAME" ,"其它支付");
bo.setAttributeValue("FLOWUNID" ,flowunid);
bo.setAttributeValue("INPUTTIME", DateUtil.getDateTime(new Date()));
bom.saveObject(bo);
service.copyEbankInfo(tx, fromCondtion, null,otherProperty, ServiceOperatorEnum.FormalToTemp);
} catch (Exception e) {
e.printStackTrace();
failNmber++;
}
}
if(failNmber==0){
return "success";
}
if(failNmber==idArray.length){
return "操作失败";
}else{
return "部分操作成功";
}
}
public String deleteProcess(JBOTransaction tx){
if(ebankNumbers!=null||"".equals(ebankNumbers)){
if(ebankNumbers.endsWith("@")){
ebankNumbers = ebankNumbers.substring(0, ebankNumbers.length()-1);
};
String ebankNumber = ebankNumbers.replace("@", "','");
try {
SqlObject so = new SqlObject("delete from lc_ebank_process where ebank_number in ('"+ebankNumber+"')");
Transaction.createTransaction(tx).executeSQL(so);
} catch (Exception e) {
e.printStackTrace();
return "error";
}
}
return "success";
}
public BigDecimal getRatio(JBOTransaction tx,String serviceType){
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String currentDate = df.format(new Date());
BizObjectManager lm;
BigDecimal ratio = null;
try {
lm = JBOFactory.getBizObjectManager(LPOUNDAGE_MAINTENANCE.CLASS_NAME,tx);
String getServiceRatioSQL = "select rate from O where charge_way='"+serviceType+"' AND start_date<='"+currentDate+"' AND expiry_date>='"+currentDate+"'";
BizObject boRatio = lm.createQuery(getServiceRatioSQL).getSingleResult(false);
String rate = boRatio.getAttribute("rate")==null?"0":boRatio.getAttribute("rate").toString();
ratio = (new BigDecimal(rate)).divide(new BigDecimal("100"), 6, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return ratio;
}
public String getRatio(String serviceType){
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String currentDate = df.format(new Date());
BizObjectManager lm;
String rate = null;
try {
lm = JBOFactory.getBizObjectManager(LPOUNDAGE_MAINTENANCE.CLASS_NAME);
String getServiceRatioSQL = "select rate from O where charge_way='"+serviceType+"' AND start_date<='"+currentDate+"' AND expiry_date>='"+currentDate+"'";
BizObject boRatio = lm.createQuery(getServiceRatioSQL).getSingleResult(false);
rate = boRatio.getAttribute("rate")==null?"0":boRatio.getAttribute("rate").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
return rate;
}
public String getFlowunid() {
return flowunid;
}
public void setFlowunid(String flowunid) {
this.flowunid = flowunid;
}
public String getPlanIDs() {
return planIDs;
}
public void setPlanIDs(String planIDs) {
this.planIDs = planIDs;
}
public String getInterestSPs() {
return interestSPs;
}
public void setInterestSPs(String interestSPs) {
this.interestSPs = interestSPs;
}
public String getServiceType() {
return serviceType;
}
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public String getEbankNumbers() {
return ebankNumbers;
}
public void setEbankNumbers(String ebankNumbers) {
this.ebankNumbers = ebankNumbers;
}
public String getMayopeMoney() {
return mayopeMoney;
}
public void setMayopeMoney(String mayopeMoney) {
this.mayopeMoney = mayopeMoney;
}
}
package com.tenwa.lease.flow.rent.rentreback;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jbo.app.tenwa.calc.LC_EBANK_PROCESS;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.app.tenwa.customer.LPOUNDAGE_MAINTENANCE;
import jbo.com.tenwa.entity.comm.flow.LC_SPLITTING_PAY_TEMP;
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.StringFunction;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.lease.flow.comm.service.LeaseFlowBaseService;
import com.tenwa.lease.flow.comm.service.ServiceOperatorEnum;
import com.tenwa.lease.flow.comm.serviceImp.LeaseFlowBaseServiceImp;
import com.tenwa.quartz.DateUtil;
public class OtherPayMethod {
private String flowunid;
private String planIDs;
private String interestSPs;
private String serviceType;
private String ids;
private String mayopeMoney;
private String ebankNumbers;
public String createSplittingPayTemp(JBOTransaction tx) throws JBOException{
BigDecimal ratio = null;
String[] planID = planIDs.split("@");
String chargeWay = "AutoBuckle";
for(int i=0;i<planID.length;i++){
BizObject boLRP = JBOFactory.createBizObjectQuery(LC_RENT_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", planID[i]).getSingleResult(false);
String interest_sp = boLRP.getAttribute("INTEREST_sp")==null?"0":boLRP.getAttribute("INTEREST_sp").toString();
String coolectStatus = boLRP.getAttribute("COLLECT_STATUS")==null?"0":boLRP.getAttribute("COLLECT_STATUS").toString();
if(!"代偿".equals(coolectStatus)){
BizObject boLRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PLAN_ID=:ID").setParameter("ID", planID[i]).getSingleResult(false);
chargeWay = boLRI.getAttribute("CHARGE_WAY")==null?"0":boLRI.getAttribute("CHARGE_WAY").toString();
}
String serviceMoney = "0";
String splitting_money = interest_sp;
ratio = getRatio(tx,chargeWay);
if(ratio==null){
return "获取手续费费率失败。";
}
if(ratio.compareTo(new BigDecimal("0"))!=0){
serviceMoney = (new BigDecimal(interest_sp)).multiply(ratio).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
splitting_money = (new BigDecimal(interest_sp)).subtract(new BigDecimal(serviceMoney)).toString();
}
String plan_id = planID[i];
try {
BizObjectManager bomLspt = JBOFactory.getBizObjectManager(LC_SPLITTING_PAY_TEMP.CLASS_NAME,tx);
BizObject bolspt = bomLspt.newObject();
bolspt.setAttributeValue("plan_id", plan_id);
bolspt.setAttributeValue("splitting_money", splitting_money);
bolspt.setAttributeValue("service_ratio", ratio.multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
bolspt.setAttributeValue("service_money", serviceMoney);
bolspt.setAttributeValue("flowunid", flowunid);
bolspt.setAttributeValue("inputtime", StringFunction.getTodayNow());
bomLspt.saveObject(bolspt);
changeSplittingStatus(tx,plan_id,"0");
} catch (Exception e) {
e.printStackTrace();
return "插入临时表失败";
}
}
return "success";
}
/**
* 更改分润支付状态
* @param tx
* @param planID
* @param status 已支付为Y流程中为0未支付为null
* @return
*/
public String changeSplittingStatus(JBOTransaction tx,String planID,String status){
SqlObject so;
try {
so = new SqlObject("update LC_RENT_PLAN set splitting_status='"+status+"' where id='"+planID+"'");
Transaction.createTransaction(tx).executeSQL(so);
} catch (Exception e) {
e.printStackTrace();
return "Error";
}
return "Success";
}
public String changeSplittingStatusBatch(JBOTransaction tx){
String[] planID = planIDs.split("@");
for(String plan_id:planID){
changeSplittingStatus(tx,plan_id,"N");
}
return "success";
}
public String createRebackList(JBOTransaction tx){
String idArray[] = ids.split("@");
String m_Money[] = mayopeMoney.split("@");
int failNmber = 0;
for(int i=0;i<idArray.length;i++){
Map<String,String> fromCondtion = new HashMap<String, String>();
fromCondtion.put("id",idArray[i]);
Map<String,String> otherProperty = new HashMap<String,String>();
otherProperty.put("FlowUnid", flowunid);
otherProperty.put("MAYOPE_MONEY", "0.00");
otherProperty.put("RETURN_MONEY", m_Money[i]);
LeaseFlowBaseService service=new LeaseFlowBaseServiceImp();
try {
BizObjectManager bom = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME,tx);
BizObject bo = bom.newObject();
bo.setAttributeValue("EBANK_NUMBER", idArray[i]);
bo.setAttributeValue("FLOW_NAME" ,"其它支付");
bo.setAttributeValue("FLOWUNID" ,flowunid);
bo.setAttributeValue("INPUTTIME", DateUtil.getDateTime(new Date()));
bom.saveObject(bo);
service.copyEbankInfo(tx, fromCondtion, null,otherProperty, ServiceOperatorEnum.FormalToTemp);
} catch (Exception e) {
e.printStackTrace();
failNmber++;
}
}
if(failNmber==0){
return "success";
}
if(failNmber==idArray.length){
return "操作失败";
}else{
return "部分操作成功";
}
}
public String deleteProcess(JBOTransaction tx){
if(ebankNumbers!=null||"".equals(ebankNumbers)){
if(ebankNumbers.endsWith("@")){
ebankNumbers = ebankNumbers.substring(0, ebankNumbers.length()-1);
};
String ebankNumber = ebankNumbers.replace("@", "','");
try {
SqlObject so = new SqlObject("delete from lc_ebank_process where ebank_number in ('"+ebankNumber+"')");
Transaction.createTransaction(tx).executeSQL(so);
} catch (Exception e) {
e.printStackTrace();
return "error";
}
}
return "success";
}
public BigDecimal getRatio(JBOTransaction tx,String serviceType){
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String currentDate = df.format(new Date());
BizObjectManager lm;
BigDecimal ratio = null;
try {
lm = JBOFactory.getBizObjectManager(LPOUNDAGE_MAINTENANCE.CLASS_NAME,tx);
String getServiceRatioSQL = "select rate from O where charge_way='"+serviceType+"' AND start_date<='"+currentDate+"' AND expiry_date>='"+currentDate+"'";
BizObject boRatio = lm.createQuery(getServiceRatioSQL).getSingleResult(false);
String rate = boRatio.getAttribute("rate")==null?"0":boRatio.getAttribute("rate").toString();
ratio = (new BigDecimal(rate)).divide(new BigDecimal("100"), 6, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return ratio;
}
public String getRatio(String serviceType){
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String currentDate = df.format(new Date());
BizObjectManager lm;
String rate = null;
try {
lm = JBOFactory.getBizObjectManager(LPOUNDAGE_MAINTENANCE.CLASS_NAME);
String getServiceRatioSQL = "select rate from O where charge_way='"+serviceType+"' AND start_date<='"+currentDate+"' AND expiry_date>='"+currentDate+"'";
BizObject boRatio = lm.createQuery(getServiceRatioSQL).getSingleResult(false);
rate = boRatio.getAttribute("rate")==null?"0":boRatio.getAttribute("rate").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
return rate;
}
public String getFlowunid() {
return flowunid;
}
public void setFlowunid(String flowunid) {
this.flowunid = flowunid;
}
public String getPlanIDs() {
return planIDs;
}
public void setPlanIDs(String planIDs) {
this.planIDs = planIDs;
}
public String getInterestSPs() {
return interestSPs;
}
public void setInterestSPs(String interestSPs) {
this.interestSPs = interestSPs;
}
public String getServiceType() {
return serviceType;
}
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public String getEbankNumbers() {
return ebankNumbers;
}
public void setEbankNumbers(String ebankNumbers) {
this.ebankNumbers = ebankNumbers;
}
public String getMayopeMoney() {
return mayopeMoney;
}
public void setMayopeMoney(String mayopeMoney) {
this.mayopeMoney = mayopeMoney;
}
}