修改注释编码及添加查询报表时间长处理类

This commit is contained in:
gityjf 2019-12-24 13:59:40 +08:00
parent ee2b90fbc2
commit 02f2b16935
7 changed files with 257 additions and 44 deletions

View File

@ -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);

55
build.xml Normal file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="apzl_leasing">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<property name="compiler.args.clms" value="-encoding UTF-8"/>
<path id="tomcat-lib">
<fileset dir="../ant_ext_lib/tomcat8lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="apzl-lib">
<fileset dir="WebContent/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="apzl.classpath">
<path refid="tomcat-lib"/>
<path refid="apzl-lib"/>
</path>
<target name="clean">
<delete dir="WebContent/WEB-INF/classes"/>
</target>
<target name="init">
<mkdir dir="WebContent/WEB-INF/classes"/>
</target>
<target depends="init" name="build">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" includeantruntime="false"
source="${source}" target="${target}">
<compilerarg line="${compiler.args.clms}"/>
<src path="src"/>
<src path="src_core"/>
<src path="src_app_fresh"/>
<src path="src_tenwa"/>
<src path="src_jbo"/>
<src path="src_sys"/>
<src path="src_cmb"/>
<src path="calc"/>
<src path="config"/>
<src path="src_invoice"/>
<src path="src_acct"/>
<src path="src_prd"/>
<src path="src_base"/>
<classpath refid="apzl.classpath"/>
</javac>
</target>
</project>

View File

@ -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 {
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
*
* 获得流程下一步信息
* @return
* @throws Exception
*/
@ -193,8 +189,7 @@ public class TenwaFlowTask extends FlowTask {
}
/**
* <EFBFBD><EFBFBD>ýڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
*
* 获得节点其他配置信息
* @param phaseNo
* @return
* @throws Exception
@ -224,8 +219,6 @@ public class TenwaFlowTask extends FlowTask {
}
/**
* <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵ĸ<EFBFBD><EFBFBD><EFBFBD>
*
* @return
* @throws Exception
*/
@ -247,9 +240,9 @@ public class TenwaFlowTask extends FlowTask {
return bo.getAttribute("cnumber").getString();
}
/**
* <EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>ϵĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
*
* 获得指定节点上的处理人或传阅人员
* @param phaseNo
* @param Otype
* @return
@ -290,8 +283,7 @@ public class TenwaFlowTask extends FlowTask {
}
/**
* ִ<EFBFBD>й<EFBFBD>ʽ<EFBFBD>ű<EFBFBD>
*
*执行公式脚本
* @param strScript
* @param scriptMap
* @return
@ -314,8 +306,7 @@ public class TenwaFlowTask extends FlowTask {
}
/**
* <EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>źͲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* 获得步骤号和步骤名称
* @param stempInfo
* @return
* @throws Exception
@ -329,8 +320,7 @@ public class TenwaFlowTask extends FlowTask {
}
/**
* <EFBFBD>жϵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD>Ƕ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
*
* 判断当前处理人是不是多人中最后一下
* @return
* @throws Exception
*/
@ -358,7 +348,7 @@ public class TenwaFlowTask extends FlowTask {
ft.getAttribute("relativeSerialNo").getString())
.getSingleResult(false);
int allTaskNum = allTaskNumBo.getAttribute("allTaskNum").getInt();
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 已提交的任务数
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 {
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>Ϣ
*
* 获得流程退回信息
* @return
* @throws Exception
*/
@ -433,7 +422,7 @@ public class TenwaFlowTask extends FlowTask {
.createQuery(sql).setParameter("flowno", this.FlowNo)
.getResultList(false);
if (backSteps.length() == 0) {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
//加载退回上一步
returnMessage += "{\"phaseNo\":\""
+ bos.get(0).getAttribute("phaseno").getString()
+ "\",\"phaseName\":\""
@ -463,9 +452,9 @@ public class TenwaFlowTask extends FlowTask {
return returnMessage;
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>Ϣ
*
* 获得流程退回信息
* @return
* @throws Exception
*/

View File

@ -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µ¼Èë´¦ÀíÀà
* */

View File

@ -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<String, String> model,List<BizObject> 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

View File

@ -101,12 +101,4 @@ public interface LC_FUND_INCOME_CALLBACK_DETAIL_TEMP{
* UPDATETIME STRING(32)<br>
*/
public static final String UPDATETIME = "UPDATETIME";
/**
* 是否查询交易日 STRING(5)<br>
*/
public static final String isPaymentDate = "isPaymentDate";
/**
* 支付时间 STRING(32)<br>
*/
public static final String PaymentDate = "PaymentDate";
}

View File

@ -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<Map<String, String>> 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<String, String> paramMap = new HashedMap();
paramMap.put("tableName", table_name);
paramMap.put("tableSql", table_sql);
list.add(paramMap);
}
for (Map<String, String> 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;
}
}
}