diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/CardDeductDataList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/CardDeductDataList.jsp new file mode 100644 index 000000000..13d492c8d --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/CardDeductDataList.jsp @@ -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"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp index 25a3bb57c..586f5ea67 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp @@ -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 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml index 7d10240c3..9b1ad47a6 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml @@ -2004,6 +2004,8 @@ + + diff --git a/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java b/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java index 47ef2fe6c..9a2383fd8 100644 --- a/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java +++ b/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java @@ -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("数据错误!"); + } } } //导入之后的回调 diff --git a/src_tenwa/com/tenwa/flow/rent/carddeduct/CardDeductManage.java b/src_tenwa/com/tenwa/flow/rent/carddeduct/CardDeductManage.java index 5874d2742..434a45c29 100644 --- a/src_tenwa/com/tenwa/flow/rent/carddeduct/CardDeductManage.java +++ b/src_tenwa/com/tenwa/flow/rent/carddeduct/CardDeductManage.java @@ -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"; diff --git a/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java b/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java index db87aaa0f..d71920a75 100644 --- a/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java +++ b/src_tenwa/com/tenwa/flow/rent/rentincome/RentIncomeMethod.java @@ -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; - } + }*/ }