diff --git a/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateDownUpload/BFTemplateUpload.jsp b/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateDownUpload/BFTemplateUpload.jsp index 53b74eda2..922494e52 100644 --- a/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateDownUpload/BFTemplateUpload.jsp +++ b/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateDownUpload/BFTemplateUpload.jsp @@ -45,7 +45,7 @@ String beforefilename=bo.getAttribute("TEMPLATEPATH").getString(); String tempfile=sFileSavePath+"/"+beforefilename; File tfile=new File(tempfile); - if(tfile.exists()){tfile.deleteOnExit();} + if(tfile.exists()){tfile.delete();} bo.setAttributeValue("TEMPLATEPATH",sFileName); String sTemplatePath = sFileSavePath+"/"+sFileName; myAmarsoftUpload.getFiles().getFile(0).saveAs(sTemplatePath); diff --git a/build.xml b/build.xml new file mode 100644 index 000000000..d03c07bcb --- /dev/null +++ b/build.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src_core/com/tenwa/flow/task/TenwaFlowTask.java b/src_core/com/tenwa/flow/task/TenwaFlowTask.java index d06e0435b..c08aa694d 100644 --- a/src_core/com/tenwa/flow/task/TenwaFlowTask.java +++ b/src_core/com/tenwa/flow/task/TenwaFlowTask.java @@ -1,11 +1,9 @@ package com.tenwa.flow.task; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.alibaba.fastjson.JSON; import com.amarsoft.amarscript.Any; import com.amarsoft.amarscript.ELContext; import com.amarsoft.amarscript.Expression; @@ -18,7 +16,6 @@ import com.amarsoft.are.util.json.JSONDecoder; import com.amarsoft.are.util.json.JSONObject; import com.amarsoft.biz.workflow.FlowTask; import com.amarsoft.context.ASUser; -import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.flow.service.FlowUserManageServie; import com.tenwa.flow.service.FlowUserManageServieImp; @@ -35,8 +32,7 @@ public class TenwaFlowTask extends FlowTask { } /** - * ���������һ����Ϣ - * + * »ñµÃÁ÷³ÌÏÂÒ»²½ÐÅÏ¢ * @return * @throws Exception */ @@ -193,8 +189,7 @@ public class TenwaFlowTask extends FlowTask { } /** - * ��ýڵ�����������Ϣ - * + * »ñµÃ½ÚµãÆäËûÅäÖÃÐÅÏ¢ * @param phaseNo * @return * @throws Exception @@ -224,8 +219,6 @@ public class TenwaFlowTask extends FlowTask { } /** - * ��ǰ�������̵ĸ��� - * * @return * @throws Exception */ @@ -247,9 +240,9 @@ public class TenwaFlowTask extends FlowTask { return bo.getAttribute("cnumber").getString(); } + /** - * ���ָ���ڵ��ϵĴ����˻�����Ա - * + * »ñµÃÖ¸¶¨½ÚµãÉϵĴ¦ÀíÈË»ò´«ÔÄÈËÔ± * @param phaseNo * @param Otype * @return @@ -290,8 +283,7 @@ public class TenwaFlowTask extends FlowTask { } /** - * ִ�й�ʽ�ű� - * + *Ö´Ðй«Ê½½Å±¾ * @param strScript * @param scriptMap * @return @@ -314,8 +306,7 @@ public class TenwaFlowTask extends FlowTask { } /** - * ��ò���źͲ������� - * + * »ñµÃ²½ÖèºÅºÍ²½ÖèÃû³Æ * @param stempInfo * @return * @throws Exception @@ -329,8 +320,7 @@ public class TenwaFlowTask extends FlowTask { } /** - * �жϵ�ǰ�������Dz��Ƕ��������һ�� - * + * Åжϵ±Ç°´¦ÀíÈËÊDz»ÊǶàÈËÖÐ×îºóһϠ* @return * @throws Exception */ @@ -358,7 +348,7 @@ public class TenwaFlowTask extends FlowTask { ft.getAttribute("relativeSerialNo").getString()) .getSingleResult(false); int allTaskNum = allTaskNumBo.getAttribute("allTaskNum").getInt(); - // ���ύ�������� + // ÒÑÌá½»µÄÈÎÎñÊý BizObject commitedTaskNumBo = ftManager .createQuery( " select count(1) as v.commited from O where relativeSerialNo=:relativeSerialNo and phaseNo<>'5000' and endTime is not null and length(endTime)>0 ") @@ -392,8 +382,7 @@ public class TenwaFlowTask extends FlowTask { } /** - * ��������˻���Ϣ - * + * »ñµÃÁ÷³ÌÍË»ØÐÅÏ¢ * @return * @throws Exception */ @@ -433,7 +422,7 @@ public class TenwaFlowTask extends FlowTask { .createQuery(sql).setParameter("flowno", this.FlowNo) .getResultList(false); if (backSteps.length() == 0) { - // �����˻���һ�� + //¼ÓÔØÍË»ØÉÏÒ»²½ returnMessage += "{\"phaseNo\":\"" + bos.get(0).getAttribute("phaseno").getString() + "\",\"phaseName\":\"" @@ -463,9 +452,9 @@ public class TenwaFlowTask extends FlowTask { return returnMessage; } + /** - * ��������˻���Ϣ - * + * »ñµÃÁ÷³ÌÍË»ØÐÅÏ¢ * @return * @throws Exception */ diff --git a/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java b/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java index 35db81946..96d49621c 100644 --- a/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java +++ b/src_core/com/tenwa/officetempalte/importcallback/impl/BaseImportExcelCallBack.java @@ -11,13 +11,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import jbo.app.tenwa.calc.LC_CARD_DEDUCT_DOC; - import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; -import org.springframework.web.context.ContextLoader; -import org.springframework.web.context.WebApplicationContext; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; @@ -29,13 +25,14 @@ import com.amarsoft.awe.util.ASResultSet; import com.amarsoft.awe.util.SqlObject; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; -import com.mchange.v2.c3p0.ComboPooledDataSource; import com.tenwa.comm.exception.BusinessException; import com.tenwa.officetempalte.importcallback.ImportCallBack; import com.tenwa.officetempalte.util.ExcelImportUtil; import com.tenwa.officetempalte.util.FileOperatorUtil; import com.tenwa.officetempalte.util.PoiExcelUtil; import com.tenwa.reckon.util.UUIDUtil; + +import jbo.app.tenwa.calc.LC_CARD_DEDUCT_DOC; /** * ĬÈÏexcelµ¼Èë´¦ÀíÀà * */ diff --git a/src_core/com/tenwa/officetempalte/importcallback/impl/LBRentPlanTempCallBack.java b/src_core/com/tenwa/officetempalte/importcallback/impl/LBRentPlanTempCallBack.java index 30e6631ae..d3f3bdc8b 100644 --- a/src_core/com/tenwa/officetempalte/importcallback/impl/LBRentPlanTempCallBack.java +++ b/src_core/com/tenwa/officetempalte/importcallback/impl/LBRentPlanTempCallBack.java @@ -5,19 +5,22 @@ import java.math.BigDecimal; import java.util.List; import java.util.Map; -import jbo.app.tenwa.calc.LC_RENT_PLAN_TEMP; -import jbo.app.tenwa.calc.VI_LC_RENT_PLAN; - 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.are.lang.DataElement; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.tenwa.comm.exception.BusinessException; import com.tenwa.reckon.util.DateUtil; import com.tenwa.reckon.util.NumberUtils; +import jbo.app.tenwa.calc.LC_RENT_PLAN_TEMP; +import jbo.app.tenwa.calc.VI_LC_RENT_PLAN; + public class LBRentPlanTempCallBack extends BaseImportExcelCallBack { @Override @@ -27,13 +30,22 @@ public class LBRentPlanTempCallBack extends BaseImportExcelCallBack { String paymentnumber=model.get("plannumber"); String planlist=importObject.getAttribute("plan_list").getString(); - BizObject virent=JBOFactory.createBizObjectQuery(VI_LC_RENT_PLAN.CLASS_NAME,"payment_number=:paymentnumber and plan_list=:planlist").setParameter("paymentnumber", paymentnumber).setParameter("planlist", planlist).getSingleResult(false); - if(virent!=null&&!virent.getAttribute("planstatus").getString().equals("δ»ØÁý")){ - throw new BusinessException("×â½ð¼Æ»®ÆÚ´Î£º"+planlist+"ÒÑ»ØÁý²»ÄÜÐÞ¸Ä"); - } BigDecimal rent=new BigDecimal(NumberUtils.round(importObject.getAttribute("rent").getDouble(),2)+""); BigDecimal CORPUS=new BigDecimal(NumberUtils.round(importObject.getAttribute("CORPUS").getDouble(),2)+""); BigDecimal INTEREST=new BigDecimal(NumberUtils.round(importObject.getAttribute("INTEREST").getDouble(),2)+""); + + BizObject virent=JBOFactory.createBizObjectQuery(VI_LC_RENT_PLAN.CLASS_NAME,"payment_number=:paymentnumber and plan_list=:planlist").setParameter("paymentnumber", paymentnumber).setParameter("planlist", planlist).getSingleResult(false); + if(virent!=null&&!virent.getAttribute("planstatus").getString().equals("δ»ØÁý")){ + BigDecimal DB_CORPUS=new BigDecimal(NumberUtils.round(virent.getAttribute("CORPUS").getDouble(),2)+""); + BigDecimal DB_INTEREST=new BigDecimal(NumberUtils.round(virent.getAttribute("INTEREST").getDouble(),2)+""); + if (CORPUS.compareTo(DB_CORPUS) != 0) { + throw new RuntimeException(" µÚ" + planlist + "ÆÚ×â½ð¼Æ»®¡¾ÒÑ»ØÁý¡¿µ¼Èë±¾½ðÓëϵͳ²»Ò»Ö£¡"); + } + if (INTEREST.compareTo(DB_INTEREST) != 0) { + throw new RuntimeException(" µÚ" + planlist + "ÆÚ×â½ð¼Æ»®¡¾ÒÑ»ØÁý¡¿µ¼ÈëÀûÏ¢Óëϵͳ²»Ò»Ö£¡"); + } + } + if(rent.compareTo(CORPUS.add(INTEREST))!=0){ throw new BusinessException("×â½ð¼Æ»®ÆÚ´Î£º"+planlist+"×â½ð²»µÈÓÚ±¾½ð¼ÓÀûÏ¢£¬Çë¼ì²éºóÔÙµ¼Èë"); } @@ -59,6 +71,26 @@ public class LBRentPlanTempCallBack extends BaseImportExcelCallBack { @Override public void runBefore(ASUser CurUser,Map model,List importObjects, JBOTransaction tx,Transaction Sqlca)throws Exception { + BigDecimal verifyBigDecimal = new BigDecimal(0); + StringBuffer sb = new StringBuffer(); + for (BizObject bizObject : importObjects) { + sb.append(bizObject.getAttribute("plan_list").getInt()+","); + DataElement element = bizObject.getAttribute("corpus"); + verifyBigDecimal = verifyBigDecimal.add(new BigDecimal(element.getValue()==null?"0":String.valueOf(element.getValue()))); + } + sb.deleteCharAt(sb.length() - 1); + + String paymentnumber=model.get("plannumber"); + SqlObject sqlObject = new SqlObject("select clean_lease_money from lc_calc_condition where payment_number = :paymentnumber ").setParameter("paymentnumber", paymentnumber); + ASResultSet asResultSet = Sqlca.getASResultSet(sqlObject); + if(asResultSet.next()) { + if(verifyBigDecimal.compareTo(new BigDecimal(asResultSet.getString("clean_lease_money")))!=0){ + throw new RuntimeException(" ±¾½ð×ܶîУÑéʧ°Ü£¬Çë¼ì²éºóÔÙµ¼Èë"); + } + } + //ɾ³ýδ°üº¬Åú´ÎÊý¾Ý + String deleSql = "delete from lc_rent_plan_temp where payment_number =:paymentNumber and plan_list not in ("+sb.toString()+") "; + Sqlca.executeSQL(new SqlObject(deleSql).setParameter("paymentNumber", paymentnumber)); } @Override diff --git a/src_jbo/jbo/com/tenwa/lease/comm/LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.java b/src_jbo/jbo/com/tenwa/lease/comm/LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.java index 6394de038..c4fe0729d 100644 --- a/src_jbo/jbo/com/tenwa/lease/comm/LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.java +++ b/src_jbo/jbo/com/tenwa/lease/comm/LC_FUND_INCOME_CALLBACK_DETAIL_TEMP.java @@ -101,12 +101,4 @@ public interface LC_FUND_INCOME_CALLBACK_DETAIL_TEMP{ * UPDATETIME STRING(32)
*/ public static final String UPDATETIME = "UPDATETIME"; - /** - * ÊÇ·ñ²éѯ½»Ò×ÈÕ STRING(5)
- */ - public static final String isPaymentDate = "isPaymentDate"; - /** - * Ö§¸¶Ê±¼ä STRING(32)
- */ - public static final String PaymentDate = "PaymentDate"; } \ No newline at end of file diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/SaveReportHistoryData.java b/src_tenwa/com/tenwa/lease/app/quartzmession/SaveReportHistoryData.java new file mode 100644 index 000000000..c2b88e757 --- /dev/null +++ b/src_tenwa/com/tenwa/lease/app/quartzmession/SaveReportHistoryData.java @@ -0,0 +1,148 @@ +package com.tenwa.lease.app.quartzmession; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.collections.map.HashedMap; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.amarsoft.are.ARE; +import com.amarsoft.are.util.StringFunction; +import com.base.util.QuartzUtil; +import com.tenwa.util.QuartzPropertiesUtil; +import com.tenwa.util.SecurityUtil; + +public class SaveReportHistoryData implements Job { + + @Override + public void execute(JobExecutionContext arg0) throws JobExecutionException { + String startime = StringFunction.getTodayNow(); + Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId"); + String curUserId = userId == null? "system" : userId.toString(); + this.copyOriginalData(startime,curUserId); + + } + + /** + * »ñÈ¡Êý¾Ý¿âÁ¬½Ó + * @return + * @throws Exception + */ + private Connection getConnection() throws Exception{ + Connection conn = null; + QuartzPropertiesUtil.load(); + String driverName = QuartzPropertiesUtil.get("org.quartz.dataSource.zhulhDS.driver"); + String url = QuartzPropertiesUtil.get("org.quartz.dataSource.zhulhDS.URL"); + String userName = QuartzPropertiesUtil.get("org.quartz.dataSource.zhulhDS.user"); + userName = SecurityUtil.detrypt(userName, ""); + String pwd = QuartzPropertiesUtil.get("org.quartz.dataSource.zhulhDS.key"); + pwd = SecurityUtil.detrypt(pwd, ""); + Class.forName(driverName); + conn = DriverManager.getConnection(url, userName, pwd); + conn.setAutoCommit(false); + return conn; + } + + /** + * ¿½±´Ô­Êýµ½ÅäÖñí + */ + private void copyOriginalData(String startime,String curUserId ) { + ResultSet rs = null; + Statement stat = null; + Connection conn = null; + String tableEnName = ""; + String insertSql = ""; + List> list = new ArrayList<>(); + try { + conn = getConnection(); + stat = conn.createStatement(); + //»ñȡҪ´æ´¢ÀúÊ·Êý¾ÝµÄ±íÃû¼°ÀúÊ·Êý¾Ý²éѯsql + rs = stat.executeQuery(" select table_name,table_sql from report_quartz where is_use = 'N' "); + while (rs.next()) { + String table_name = rs.getString("table_name"); + String table_sql = rs.getString("table_sql"); + Map paramMap = new HashedMap(); + paramMap.put("tableName", table_name); + paramMap.put("tableSql", table_sql); + list.add(paramMap); + } + for (Map map : list) { + tableEnName = map.get("tableName"); + insertSql = map.get("tableSql"); + if(isTableExist(conn,tableEnName)) { + stat.execute("truncate table " + tableEnName); + stat.execute("insert into " + tableEnName + " " + insertSql); + }else { + ARE.getLog().info("create table "+tableEnName+" and copy data ........"); + createNewHisDataTable(conn,tableEnName,insertSql); + } + } + conn.commit(); + ARE.getLog().info("report history copy success ........"); + QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.SaveReportHistoryData", "success", "³É¹¦", curUserId); + } catch (Exception e) { + ARE.getLog().info("report history copy error ........",e); + QuartzUtil.insertLog(startime,"com.tenwa.lease.app.quartzmession.SaveReportHistoryData", "error", "ʧ°Ü", curUserId); + try { + conn.rollback(); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } finally { + try { + if (rs != null) + rs.close(); + if (stat != null) + stat.close(); + if (conn != null) + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + /** + * ´«Èë±íÃû£¬Ð½¨±¨±í²¢µ¼Èëµ±´ÎÊý¾Ý + * @param tablename + * @return + */ + private void createNewHisDataTable(Connection conn,String tablename,String insertSql) throws Exception{ + Statement stat =null; + stat=conn.createStatement(); + String sql=" create table "+tablename.toUpperCase()+" as "; + stat.executeUpdate(sql+insertSql); + stat.close(); + } + + private boolean isTableExist(Connection conn,String tablename)throws Exception{ + PreparedStatement prestat=null; + ResultSet rs=null; + int cont=0; + String sql=" select count(*) from information_schema.`TABLES` where table_name = ?"; + prestat=conn.prepareStatement(sql); + prestat.setString(1, tablename); + rs=prestat.executeQuery(); + if(rs.next()){ + cont=rs.getInt(1); + } + rs.close(); + prestat.close(); + if(cont==0){ + return false; + }else{ + return true; + } + } + + +}