This commit is contained in:
zhangbb 2018-08-04 12:08:11 +08:00
commit 341d260091
8 changed files with 325 additions and 38 deletions

View File

@ -0,0 +1,112 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2017-10-23
Content:
History Log:
*/
String id = CurPage.getParameter("id");
String bankType = CurPage.getParameter("BankType");
String templetNo = "CardDeductDataList";
ASObjectModel doTemp = new ASObjectModel(templetNo);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(pageSize != null?Integer.parseInt(pageSize):10);
dwTemp.genHTMLObjectWindow(id);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","","Button","划扣核销","划扣核销","createRentIncomeWithCard()","","","","btn_icon_get",""},
//{"true","","Button","修改核销合同","修改核销合同","changeIncomeContract()","","","","btn_icon_detail",""},
{"true","","Button","返回","返回","returnList()","","","","btn_icon_back",""}
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function afterSearch(){
for(var i=0;i<DZ[0][2].length;i++){
var incomeStatus = getItemValue(0,i,"income_status");
if(incomeStatus == "3"){
for(var j=0;j<DZ[0][1].length;j++){
var obj = getObj(0,i,DZ[0][1][j][15]);
if(obj){
obj.style.color = "red";
}
}
}
}
}
function changeIncomeContract(){
var deductId = getItemValue(0,getRow(0),"id");
var mayopeMoney = getItemValue(0,getRow(0),"mayope_money");
var incomeStatus = getItemValue(0,getRow(0),"income_status");
if(incomeStatus != "3"){
AsDebug.showMessage("提示","此数据非红冲数据,不可修改合同!","","",true);
return;
}
if(Number(mayopeMoney) == 0){
AsDebug.showMessage("提示","此红冲数据没有可核销金额!","","",true);
return;
}
AsDialog.OpenSelector("SelectCardDeductContract","bankType,<%=bankType%>","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"){
return;
}
var contractId = sReturn.split("@")[0];
AsDialog.OpenSelector("SelectCardDeductRentPlan","contractId,"+contractId,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"){
return;
}
sReturn = sReturn.split("@~");
var id = "";
var allMoney = 0;
for(var i=0;i<sReturn.length;i++){
if(sReturn[i] == ""){
continue;
}
id += "@" + sReturn[i].split("@")[0];
var rentOver = sReturn[i].split("@")[1];
var penaltyOver = sReturn[i].split("@")[2];
allMoney += eval(rentOver + "+" + penaltyOver);
}
id = id.substring(1);
if(Number(mayopeMoney) < allMoney){
AsDebug.showMessage("提示","选择的计划金额大于可核销金额,请重新选择","","",true);
return;
}
var result = RunJavaMethodTrans("com.tenwa.flow.rent.rentincome.RentIncomeMethod","setCardDeductRentPlan","deductId="+deductId+",planIds="+sReturn+",allMoney="+allMoney);
if(result == "SUCCESS"){
AsDebug.showMessage("提示","操作成功","","",true);
reloadSelf();
}else{
AsDebug.showMessage("提示","操作失败","","",true);
}
},"请选择租金计划");
},"请选择合同");
}
function returnList(){
parent.AsDialog.ClosePage();
AsControl.OpenView("/Tenwa/Lease/Flow/Rent/CardDeduct/LcCardDeductDataList.jsp", "BankType=<%=bankType%>","_self","");
}
function createRentIncomeWithCard(){
if(DZ[0][2].length == 0){
AsDebug.showMessage("提示","页面没有可核销的数据!","","",true);
return;
}
var sReturn = RunJavaMethodTrans("com.tenwa.flow.rent.rentincome.RentIncomeMethod","createRentIncomeWithCard","deductDocId=<%=id%>,bankType=<%=bankType%>,userid=<%=CurUser.getUserID()%>,orgid=<%=CurUser.getOrgID()%>,importDate="+getItemValue(0,getRow(0),"import_date"),true);
/* if(sReturn == "true"){
AsDebug.showMessage("提示","系统开始核销数据...","","",true);
} */
if("SUCCESS" == sReturn){
AsDebug.showMessage("提示","操作成功!","","",true);
reloadSelf();
}else if(sReturn.indexOf("false") != -1){
AsDebug.showMessage("提示","没有可核销数据!","","",true);
}else{
AsDebug.showMessage("提示","操作失败!","","",true);
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -15,9 +15,9 @@
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","删除","删除","doDelete()","","","","btn_icon_delete",""},
{"true","","Button","卡扣数据上传","卡扣数据上传","importExcel()","","","","btn_icon_importNew",""},
{"true","","Button","卡扣模版下载","卡扣模版下载","CardDownload()","","","","btn_icon_down",""}
{"true","","Button","跳转到核销页面","跳转到核销页面","openIncomePage()","","","","btn_icon_return",""}
//{"true","","Button","卡扣模版下载","卡扣模版下载","CardDownload()","","","","btn_icon_down",""}
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
@ -30,6 +30,10 @@
</form>
<script type="text/javascript">
function openIncomePage() {
AsControl.OpenTab("/Tenwa/Lease/Flow/Rent/CardDeduct/LcCardDeductDataList.jsp",'',{title:"卡扣核销"});
}
function CardDownload(){
var sId="5605a63d456d454a81b368dbc765474f";

View File

@ -15,7 +15,7 @@
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","导出数据","导出数据","exportExcel()","","","","btn_icon_export",""},
{"true","All","Button","导出撤回","导出撤回","doDelete()","","","","btn_icon_delete",""},
{"true","All","Button","³·»Ø","³·»Ø","doDelete()","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">

View File

@ -0,0 +1,85 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2017-10-23
Content:
History Log:
*/
ASObjectModel doTemp = new ASObjectModel("LCCardDeductDataList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(pageSize != null?Integer.parseInt(pageSize):20);
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","","Button","划扣核销","划扣核销","rentIncome()","","","","btn_icon_get",""},
{"true","","Button","删除","删除","doDelete()","","","","btn_icon_delete",""}
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function afterSearch(){
var rows = getRowCount(0);
for(var i=0;i<rows;i++){
var value = getItemValue(0,i,"docname");
getObj(0,i,"docname").innerHTML = "<a style='color:blue;' onclick='downloadFile("+i+");'>"+value+"</a>";
}
}
function doDelete(){
var ids = getItemValue(0,getRow(0),'id');
if(ids == ""){
AsDebug.showMessage("提示","请选中一行数据!","","",true);
return;
}
var allhadMoney = getItemValue(0,getRow(0),'allhad_money');
if(Number(allhadMoney) > 0){
AsDebug.showMessage("提示","已核销数据不能删除!","","",true);
return;
}
var importDate = getItemValue(0,getRow(0),"import_date");
var deductInfoId = getItemValue(0,getRow(0),"deduct_info_id");
if(confirm("是否确认删除?")){
ids = ids.replace(/,/ig,"@");
var sResult = RunJavaMethodTrans("com.tenwa.flow.rent.carddeduct.CardDeductManage","delete","ids="+ids+",importDate="+importDate+",bankType=card,deductInfoId="+deductInfoId+",userId=<%=CurUser.getUserID()%>");
if("SUCCESS" == sResult){
AsDebug.showMessage("提示","删除成功!","","",true);
reloadSelf();
}else{
AsDebug.showMessage("提示","删除失败!","","",true);
}
}
}
function rentIncome(){
var allmayopeMoney = getItemValue(0,getRow(0),'allmayope_money');
if(allmayopeMoney == 0 && getItemValue(0,getRow(0),"status") == "not_income"){
AsDebug.showMessage("提示","可核销金额为0","","",true);
return;
}
if(allmayopeMoney == 0){
AsDebug.showMessage("提示","该数据已核销!","","",true);
return;
}
var sUrl = "/Tenwa/Lease/Flow/Rent/CardDeduct/CardDeductDataList.jsp";
var id = getItemValue(0,getRow(0),'id');
if(typeof(id)=="undefined" || id.length==0 ){
AsDebug.showMessage("提示","参数不能为空!","","",true);
return ;
}
AsControl.OpenView(sUrl,'id='+id,'_self','');
}
function downloadFile(i){
var fullpath = getItemValue(0,i,"fullpath");
var docname = getItemValue(0,i,"docname");
fullpath = encodeURI(fullpath);
fullpath = encodeURI(fullpath);
docname = encodeURI(docname);
docname = encodeURI(docname);
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/DownloadServlet?CompClientID=<%=sCompClientID%>&fullpath="+fullpath+"&docname="+docname, "downloadTemplate");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -2004,6 +2004,8 @@
<attribute name="inputuserid" label="上传人" type="STRING" length="32"/>
<attribute name="inputorgid" label="上传人所在部门" type="STRING" length="32"/>
<attribute name="inputtime" label="上传时间" type="STRING" length="32"/>
<attribute name="import_date" label="导入日期" type="STRING" length="32"/>
<attribute name="deduct_info_id" label="导出数据编号" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>

View File

@ -278,7 +278,7 @@ public class BaseImportExcelCallBack extends ImportCallBack{
int n = 0;
long start = System.currentTimeMillis();
BizObject bo = importObjects.get(0);
String deductInfoId = Sqlca.getString(new SqlObject("select id from lc_card_deduct_info where import_date is null"));
String deductInfoId = Sqlca.getString(new SqlObject("select id from lc_card_deduct_info where import_date = '' or import_date is null"));
if(deductInfoId == null){
throw new BusinessException("所有导出的数据都已导入,不能再次导入!");
}
@ -341,6 +341,16 @@ public class BaseImportExcelCallBack extends ImportCallBack{
money = money.add(new BigDecimal(des1[d].getDouble()));
}
continue;
case 38:
stat.setBigDecimal(d+1, BigDecimal.ZERO);
continue;
case 39:
if("0".equals(status)) {
stat.setBigDecimal(d+1, new BigDecimal(des1[22].getString().replaceAll(",", "")));
} else {
stat.setBigDecimal(d+1, BigDecimal.ZERO);
}
continue;
default:
stat.setString(d+1, bo.getAttribute(des1[d].getName()).getString());
continue;
@ -370,13 +380,18 @@ public class BaseImportExcelCallBack extends ImportCallBack{
boLCDD.setAttributeValue("allfact_money", money);
boLCDD.setAttributeValue("allmayope_money", money);
boLCDD.setAttributeValue("allhad_money", 0);
boLCDD.setAttributeValue("import_date", StringFunction.getTodayNow().split(" ")[0]);
boLCDD.setAttributeValue("deduct_info_id", deductInfoId);
bomLCDD.saveObject(boLCDD);
stat.executeUpdate("update lc_card_deduct_info set import_date='"+StringFunction.getTodayNow().split(" ")[0]+"',updateuserid='"+CurUser.getUserID()+"',updateorgid='"+CurUser.getUserID()+"',updatetime='"+StringFunction.getTodayNow()+"' where import_date is null");
stat.executeUpdate("update lc_card_deduct_info set import_date='"+StringFunction.getTodayNow().split(" ")[0]+"',updateuserid='"+CurUser.getUserID()+"',updateorgid='"+CurUser.getUserID()+"',updatetime='"+StringFunction.getTodayNow()+"' where import_date is null or import_date = ''");
}catch(Exception e){
e.printStackTrace();
tx.rollback();
con.rollback();
throw new BusinessException("µ¼Èëʧ°Ü£¡");
if(e instanceof BusinessException) {
throw new BusinessException(e.getMessage());
} else {
throw new BusinessException("Êý¾Ý´íÎó£¡");
}
}
}
//导入之后的回调

View File

@ -1,17 +1,62 @@
package com.tenwa.flow.rent.carddeduct;
import java.sql.Connection;
import java.sql.Statement;
import jbo.app.tenwa.calc.LC_CARD_DEDUCT_DATA;
import jbo.app.tenwa.calc.LC_CARD_DEDUCT_DOC;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
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.amarsoft.context.ASUser;
import com.tenwa.quartz.DateUtil;
public class CardDeductManage {
private String ids;
private String id;
private String importDate;
private String bankType;
private String deductInfoId;
private String userId;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getDeductInfoId() {
return deductInfoId;
}
public void setDeductInfoId(String deductInfoId) {
this.deductInfoId = deductInfoId;
}
public String getBankType() {
return bankType;
}
public void setBankType(String bankType) {
this.bankType = bankType;
}
public String getImportDate() {
return importDate;
}
public void setImportDate(String importDate) {
this.importDate = importDate;
}
public String getIds() {
return ids;
}
@ -19,48 +64,35 @@ public class CardDeductManage {
public void setIds(String ids) {
this.ids = ids;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String delete(JBOTransaction tx){
public String delete(JBOTransaction tx) throws JBOException{
try{
String[] id = ids.split("@");
BizObjectManager bomLCDD = JBOFactory.getBizObjectManager(LC_CARD_DEDUCT_DOC.CLASS_NAME);
BizObjectManager bomLCDDA = JBOFactory.getBizObjectManager(LC_CARD_DEDUCT_DATA.CLASS_NAME);
Transaction tran = Transaction.createTransaction(tx);
ASUser user = ASUser.getUser(userId, tran);
tx.join(bomLCDD);
tx.join(bomLCDDA);
for(String d:id){
bomLCDD.createQuery("delete from O where id=:ID").setParameter("ID", d).executeUpdate();
bomLCDDA.createQuery("delete from O where deduct_docid=:ID").setParameter("ID", d).executeUpdate();
SqlObject so = new SqlObject("delete from lb_docrelative where id=(select ldl.relative_id from lb_doclibrary ldl left join lb_docattribute lda on ldl.id=lda.library_id where lda.id=(select file_id from lc_card_deduct_info where id='"+deductInfoId+"'))");
tran.executeSQL(so);
so = new SqlObject("delete from lb_doclibrary where id=(select library_id from lb_docattribute where id=(select file_id from lc_card_deduct_info where id='"+deductInfoId+"'))");
tran.executeSQL(so);
so = new SqlObject("delete from lb_docattribute where id=(select file_id from lc_card_deduct_info where id='"+deductInfoId+"')");
tran.executeSQL(so);
so = new SqlObject("update lc_card_deduct_info set updateuserid='"+user.getUserID()+"',updateorgid='"+user.getOrgID()+"',updatetime='"+StringFunction.getTodayNow().replaceAll(":", "¡÷")+"',import_date=null where id='"+deductInfoId+"'");
so.setDebugSql(so.getDebugSql().replaceAll("¡÷", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("¡÷", ":"));
so.setRunSql(so.getRunSql().replaceAll("¡÷", ":"));
tran.executeSQL(so);
}
}catch(Exception e){
e.printStackTrace();
return "ERROR";
}
return "SUCCESS";
}
/**
* 检查此笔卡扣数据是否在流程中
* @param tx
* @return
*/
public String checkIsInFlow(JBOTransaction tx){
try{
BizObjectManager bomFBO = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME);
tx.join(bomFBO);
BizObject fbo = bomFBO.createQuery("select FLOW_KEY FROM O WHERE flow_key=:flowkey and FLOW_NAME='卡扣核销流程' ").setParameter("flowkey",id).getSingleResult(false);
if(fbo!=null){
return "ERROR";
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
return "ERROR";
}
return "SUCCESS";

View File

@ -1,8 +1,11 @@
package com.tenwa.flow.rent.rentincome;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -33,6 +36,7 @@ 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.Transaction;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.tenwa.reckon.constant.Scale;
import com.tenwa.reckon.util.UUIDUtil;
@ -55,7 +59,16 @@ public class RentIncomeMethod {
private String sql;
private String userid;
private String orgid;
private String deductDocId;
public String getDeductDocId() {
return deductDocId;
}
public void setDeductDocId(String deductDocId) {
this.deductDocId = deductDocId;
}
public String getUserid() {
return userid;
}
@ -800,6 +813,30 @@ public class RentIncomeMethod {
}
public String createRentIncomeWithCard(JBOTransaction tx) throws Exception{
String sReturn = "SUCCESS";
Transaction tran = Transaction.createTransaction(tx);
Connection con = null;
try{
con = tran.getConnection(tran);
/* ResultSet rs = stat.executeQuery("select count(1) cou from lc_card_deduct_data where deduct_docid='"+deductDocId+"' and income_status='0'");
if(rs.next()){
String cou = rs.getString("cou");
if("0".equals(cou)){
return "false";
}
}*/
CallableStatement call = con.prepareCall("call proc_card_income('"+deductDocId+"','"+userid+"','"+orgid+"')");
call.execute();
}catch(Exception e){
e.printStackTrace();
con.rollback();
tx.rollback();
return "ERROR";
}
return sReturn;
}
/*public String createRentIncomeWithCard(JBOTransaction tx) throws Exception{
String sReturn = "SUCCESS";
sql = sql.replaceAll("¡÷", ",");
sql = sql.replaceAll("&", "=");
@ -1031,5 +1068,5 @@ public class RentIncomeMethod {
return "ERROR";
}
return sReturn;
}
}*/
}