Merge remote-tracking branch 'origin/ap007' into ap007
This commit is contained in:
commit
dc33138164
@ -28,7 +28,7 @@
|
||||
|
||||
InputStream is = null;
|
||||
//当一次传多个图片时,会多次执行这个页面,下面for循环,只是将参数读取出来,将普通数据封装为map,然后将map传给写入数据库的方法。
|
||||
Map<String,String> params = new HashMap<>();
|
||||
Map<String,String> params = new HashMap<String,String>();
|
||||
for (FileItem fileItem : items) {
|
||||
if (fileItem.isFormField()) { // >> 普通数据
|
||||
String fieldValue = fileItem.getString("utf-8");
|
||||
|
||||
@ -87,7 +87,11 @@ public class CorpusSourceCheck {
|
||||
return sResult;
|
||||
}
|
||||
String fcStage = this.getFcStageByProjectId();
|
||||
if ("AP".equals(fcStage)||"1".equals(fcStage)) {
|
||||
if("-2".equals(fcStage)){
|
||||
return "获取状态信息出现错误,请联系系统管理员!";
|
||||
}
|
||||
//1是终审成功,2是合同签署。两个可能并行,故都可以通过
|
||||
if ("AP".equals(fcStage)||"1".equals(fcStage)||"2".equals(fcStage)) {
|
||||
sResult = "S";
|
||||
} else {
|
||||
sResult = "资金方尚未审批结束,请稍后再试!";
|
||||
@ -106,9 +110,12 @@ public class CorpusSourceCheck {
|
||||
String sResult = null;
|
||||
try {
|
||||
String fcStage = this.getFcStageByProjectId();
|
||||
if("-2".equals(fcStage)){
|
||||
return "获取状态信息出现错误,请联系系统管理员!";
|
||||
}
|
||||
if("2".equals(fcStage)||"AP".equals(fcStage)){
|
||||
return "S";
|
||||
}else{
|
||||
} else {
|
||||
sResult = "客户还未和资方签署合同";
|
||||
}
|
||||
} catch (JBOException e) {
|
||||
@ -135,7 +142,7 @@ public class CorpusSourceCheck {
|
||||
fcStage = "AP" ;
|
||||
}else{
|
||||
BizObjectManager bomFR = JBOFactory.getBizObjectManager(FC_REQUEST.CLASS_NAME);
|
||||
BizObject boFR = bomFR.createQuery("id=:projectId and del_flag='0'").setParameter("projectId", projectId).getSingleResult(false);
|
||||
BizObject boFR = bomFR.createQuery("PROJECT_ID=:projectId and del_flag='0'").setParameter("projectId", projectId).getSingleResult(false);
|
||||
if(boFR!=null){
|
||||
fcStage = boFR.getAttribute("FC_STAGE").toString();
|
||||
}
|
||||
|
||||
@ -101,12 +101,18 @@ public class DocListAction {
|
||||
BizObjectManager BBMbom = null;
|
||||
BizObject BBMBo = null;
|
||||
BBMbom = JBOFactory.getBizObjectManager(BT_BUSSINESS_MESSAGE.CLASS_NAME,tx);
|
||||
BBMBo = BBMbom.createQuery("ID=:id").setParameter("id",messageId).getSingleResult(true);
|
||||
BBMBo.setAttributeValue("is_read","has_read");
|
||||
BBMBo.setAttributeValue("message_status","has_process");
|
||||
BBMBo.setAttributeValue("read_time",currentTime);
|
||||
BBMBo.setAttributeValue("finish_time",currentTime);
|
||||
BBMbom.saveObject(BBMBo);
|
||||
if(messageId!=null&&!"".equals(messageId)){
|
||||
BBMBo = BBMbom.createQuery("ID=:id").setParameter("id",messageId).getSingleResult(true);
|
||||
}else {
|
||||
BBMBo = BBMbom.createQuery("cparam like '%fcRequestId="+fcRequestId+"%'").getSingleResult(true);
|
||||
}
|
||||
if(BBMBo!=null){
|
||||
BBMBo.setAttributeValue("is_read","has_read");
|
||||
BBMBo.setAttributeValue("message_status","has_process");
|
||||
BBMBo.setAttributeValue("read_time",currentTime);
|
||||
BBMBo.setAttributeValue("finish_time",currentTime);
|
||||
BBMbom.saveObject(BBMBo);
|
||||
}
|
||||
}
|
||||
|
||||
public String getFrfId() {
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
package com.tenwa.voucher.service;
|
||||
|
||||
public interface VoucherInfoService {
|
||||
void run() throws Exception;
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
package com.tenwa.voucher.serviceImp;
|
||||
|
||||
import com.amarsoft.are.jbo.*;
|
||||
import com.amarsoft.dict.als.manage.NameManager;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.flow.util.FlowUtil;
|
||||
import com.tenwa.reckon.util.DateUtil;
|
||||
import com.tenwa.voucher.service.VoucherInfoService;
|
||||
import jbo.app.VOUCHER_V8;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FundIncomeVoucherInfoServiceImpl implements VoucherInfoService {
|
||||
//todo 这个字段是自增的,更新生产时,先在生产配置,然后根据生产的编号再更改
|
||||
private static final String VOUCHER_CONFIGNO = "PZ2021072100000020";//凭证号
|
||||
private static final String EVIDENCE_MESSAGE = "凭证输出";//查看凭证表,发现只有这一个值,目前先设置为固定值
|
||||
private static final String EAS_FLAG = "0";//导入财务系统状态 默认0 (同上,只有这一个值)
|
||||
public void run() {
|
||||
JBOTransaction tx = null;
|
||||
try {
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
//凭证编号
|
||||
String voucherNo ="k" + FlowUtil.getVoucher_Number(tx);
|
||||
System.out.println(voucherNo+"======");
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
tx.commit();
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void createVoucher(List<Map<String, String>> list, JBOTransaction tx) throws Exception {
|
||||
BizObjectManager bomV8 = JBOFactory.getBizObjectManager(VOUCHER_V8.CLASS_NAME,tx);
|
||||
List<Map<String,String>> loanInfoList = this.getHasLoanContract(tx);
|
||||
for(Map<String,String> loanInfo : loanInfoList){
|
||||
loanInfo = this.getCommonParam(loanInfo,tx);
|
||||
List<Map<String,String>> paramList = getParamOfVoucher(tx);
|
||||
for(Map<String,String> param : paramList){
|
||||
param.putAll(loanInfo);
|
||||
BizObject boV8 = bomV8.newObject();
|
||||
boV8.setAttributesValue(this.getFinalParam(param));
|
||||
bomV8.saveObject(boV8);
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Map<String,String>> getHasLoanContract(JBOTransaction tx) throws Exception {
|
||||
//todo 目前为邮储,九江的时候将where条件更改参数
|
||||
String sql = "select frl.loan_no,frl.customer_name,frl.loan_date,frl.loan_amt,frl.business_rate,frl.TRANS_AMT,fr.CONTRACT_ID,fr.CONTRACT_NO " +
|
||||
"from fc_request_loan frl " +
|
||||
"left join fc_request fr on frl.LOAN_NO = fr.FC_LOAN_ID " +
|
||||
"where frl.del_flag='0' and fr.DEL_FLAG='0' and voucher_status='0' and fr.CHANNEL_NO='PSBC' ";
|
||||
return DataOperatorUtil.getDataBySql(sql,tx);
|
||||
}
|
||||
public Map<String,String> getCommonParam(Map<String,String> loanInfo,JBOTransaction tx) throws Exception {
|
||||
|
||||
String contractId = loanInfo.get("CONTRACT_ID");
|
||||
String voucherNo ="k" + FlowUtil.getVoucher_Number(tx);
|
||||
loanInfo.put("voucherNo",voucherNo);
|
||||
String userId = "administrator";//操作人
|
||||
String userName = NameManager.getUserName(userId);
|
||||
loanInfo.put("userId",userId);
|
||||
loanInfo.put("userName",userName);
|
||||
//日期
|
||||
String loanDate = loanInfo.get("loan_date").substring(0,8);
|
||||
String periodYear = loanDate.substring(0,4);
|
||||
String periodMonth = loanDate.substring(4,6);
|
||||
Date date = new SimpleDateFormat("yyyyMMdd").parse(loanDate);
|
||||
loanDate = new SimpleDateFormat("yyyy/MM/dd").format(date);
|
||||
loanInfo.put("periodYear",periodYear);
|
||||
loanInfo.put("periodMonth",periodMonth);
|
||||
loanInfo.put("accountingDate",loanDate);
|
||||
loanInfo.put("generate_date", DateUtil.getSystemDateDetailTime());
|
||||
|
||||
return loanInfo;
|
||||
}
|
||||
public List<Map<String,String>> getParamOfVoucher(JBOTransaction tx) throws Exception {
|
||||
String sql = "select lvl.SORT_NUMBER as sortNumber,lvl.LOAN_SUBJECT as loanSubject,CASE WHEN lvl.loan_direction = '1' THEN '1' ELSE '-1' END as entrydc,lvl.VALUE_ABSTRACT as valueAbstract,lsc.SUBJECTS_CODE as subjectsCode,lsc.SUBJECTS_NAME as subjectsName " +
|
||||
"from lv_voucher_loan lvl " +
|
||||
"left join LV_STACTS_CONFIG lsc on lvl.LOAN_SUBJECT=lsc.id " +
|
||||
"left join lv_voucher_config lvc on lvl.VOUCHER_ID=lvc.id " +
|
||||
"where lvc.VOUCHER_NO='"+VOUCHER_CONFIGNO+"'";
|
||||
return DataOperatorUtil.getDataBySql(sql,tx);
|
||||
}
|
||||
public Map<String,String> getFinalParam(Map<String,String> param){
|
||||
Map<String,String> finalParam = new HashMap<>();
|
||||
finalParam.put("evidence_message",EVIDENCE_MESSAGE);//固定值:凭证输出
|
||||
finalParam.put("periodyear",param.get("periodYear")); //年
|
||||
finalParam.put("f1",param.get("accountingDate"));//会计日期
|
||||
finalParam.put("f2",param.get("subjectsCode"));//科目编码
|
||||
finalParam.put("f3",param.get("voucherNo"));//凭证编号
|
||||
finalParam.put("f5",param.get("valueAbstract"));//摘要
|
||||
finalParam.put("f6",param.get("loanSubject"));//科目表id
|
||||
finalParam.put("f7",param.get("periodYear"));//借方金额
|
||||
finalParam.put("f8",param.get("periodYear"));//贷方金额
|
||||
finalParam.put("f12",param.get("userName"));//操作人
|
||||
finalParam.put("f15",param.get("accountingDate"));//日期(与会计日期相同)
|
||||
finalParam.put("f47",param.get("CONTRACT_NO"));//业务合同编号
|
||||
finalParam.put("f48",param.get("periodYear"));//本方信息No
|
||||
finalParam.put("f49",param.get("periodYear"));//所属公司ID(注意:实际此字段存的是code_library表中codeno='ManySubject' 的 itemno 字段)
|
||||
finalParam.put("f50",param.get("periodYear"));//所属公司名称
|
||||
finalParam.put("f51",param.get("periodYear"));//会计期间-年(与上面 ‘年’ 相同)
|
||||
finalParam.put("f52",param.get("periodMonth"));//会计期间-月
|
||||
finalParam.put("f59",param.get("sortNumber"));//凭证配置中排序号
|
||||
finalParam.put("f60",param.get("CONTRACT_NO"));//业务合同号,与f47相同(尚不明为何重复)
|
||||
finalParam.put("f61",param.get("customer_name"));//客户名称
|
||||
finalParam.put("f62",param.get("loanSubject"));//科目表id,与f6相同(尚不明为何重复)
|
||||
finalParam.put("f65",VOUCHER_CONFIGNO);//凭证配置编号
|
||||
finalParam.put("v8_status","已完整");//凭证状态 : 已完整;未完整
|
||||
finalParam.put("generate_date",param.get("generate_date"));//创建时间
|
||||
finalParam.put("v8_flag",EAS_FLAG);//导入财务系统状态 默认0(尚不知有何逻辑,目前整个表中全部为0)
|
||||
finalParam.put("module_name",param.get("subjectsName"));//凭证名称
|
||||
finalParam.put("entrydc",param.get("entrydc"));//借贷:1,借;-1,贷
|
||||
finalParam.put("inputuserid",param.get("userId"));//操作人id
|
||||
|
||||
return finalParam;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.tenwa.lease.app.quartzmession;
|
||||
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.base.util.QuartzUtil;
|
||||
import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentCompensatory;
|
||||
import com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentIncome;
|
||||
import com.tenwa.voucher.service.VoucherInfoService;
|
||||
import com.tenwa.voucher.serviceImp.FundIncomeVoucherInfoServiceImpl;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
/**
|
||||
* 生成外资方放款凭证-定时任务
|
||||
* @author
|
||||
*/
|
||||
public class CorpusSourceFundIncomeCreateVoucherJob 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();
|
||||
JBOTransaction tx = null;
|
||||
try{
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
//
|
||||
VoucherInfoService voucher = new FundIncomeVoucherInfoServiceImpl();
|
||||
voucher.run();
|
||||
|
||||
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BusinessCancelJob", "success", "成功", curUserId);
|
||||
} catch (Exception e) {
|
||||
QuartzUtil.insertLog(startime,"com.tenwa.comm.message.controller.BusinessCancelJob", "error", "失败", curUserId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.tenwa.lease.app.quartzmession;
|
||||
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.jbo.*;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
@ -8,6 +9,7 @@ import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.reckon.executor.CreateTransactionExecutor;
|
||||
import jbo.app.tenwa.calc.LC_CALC_CONDITION;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN_HIS;
|
||||
import jbo.oti.FC_FILE_PUSH;
|
||||
import jbo.oti.FC_YC_FILE_REPAY_PLAN;
|
||||
import jbo.oti.LC_PROFIT_PLAN;
|
||||
@ -49,14 +51,41 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
fyfrpBom = JBOFactory.getBizObjectManager(FC_YC_FILE_REPAY_PLAN.CLASS_NAME,tx);
|
||||
//todo 添加渠道商的选择,哪些需要拷表哪些不需要
|
||||
List<BizObject> ffpBoList = ffpBom.createQuery("select ID,FILE_STS from O where FILE_STS='2'").getResultList(true);
|
||||
if(ffpBoList.size()==0){
|
||||
ARE.getLog().info("暂时没有需要拷表的资方文件");
|
||||
return;
|
||||
}
|
||||
//遍历每个文件
|
||||
for(BizObject ffpBo : ffpBoList){
|
||||
String fcFileId = ffpBo.getAttribute("ID").toString();
|
||||
//1.更新租金计划租金信息,并获取每个文件的contract_id
|
||||
String sql = "select fr.CONTRACT_ID,O.LEND_TERM,O.ANS_REPAYMENT_DATE,O.ANS_PRINCIPAL,O.ANS_INTEREST,ANS_REPAYMENT_MONEY from O left join jbo.oti.FC_REQUEST fr on O.FC_REQUEST_ID=fr.ID where fr.DEL_FLAG='0' and O.FC_FILE_ID=:fcFileId";
|
||||
String sql = "select fr.CONTRACT_ID,O.FC_REQUEST_ID,O.LEND_TERM,O.ANS_REPAYMENT_DATE,O.ANS_PRINCIPAL,O.ANS_INTEREST,ANS_REPAYMENT_MONEY from O left join jbo.oti.FC_REQUEST fr on O.FC_REQUEST_ID=fr.ID where fr.DEL_FLAG='0' and O.FC_FILE_ID=:fcFileId";
|
||||
List<BizObject> fyfrpBoList = fyfrpBom.createQuery(sql).setParameter("fcFileId",fcFileId).getResultList(false);
|
||||
if(fyfrpBoList.size()==0){
|
||||
ARE.getLog().error("未找到FC_REQUEST_ID: "+fcFileId+" 对应的资方还款计划");
|
||||
throw new Exception("未找到FC_REQUEST_ID: "+fcFileId+" 对应的资方还款计划");
|
||||
}
|
||||
//获取对应的合同
|
||||
Map<String,String> contractMap = this.getContractIdMap(fyfrpBoList);
|
||||
if(contractMap.size()==0){
|
||||
ARE.getLog().error("未找到FC_REQUEST_ID: "+fcFileId+" 对应的合同ID");
|
||||
throw new Exception("未找到FC_REQUEST_ID: "+fcFileId+" 对应的合同ID");
|
||||
}
|
||||
//0.租金计划正式表考入历史表
|
||||
for(Map.Entry<String,String> entry: contractMap.entrySet()){
|
||||
Map<String,String> fromCondtion=new HashMap<String,String>();
|
||||
fromCondtion.put("CONTRACT_ID",entry.getKey());
|
||||
|
||||
Set<String> contractSet = this.updateRentPlan(fyfrpBoList,tx);
|
||||
for(String contractId : contractSet){
|
||||
Map<String,String> otherProperty=new HashMap<String,String>();
|
||||
otherProperty.put("MEMO", "安鹏原正式租金计划");
|
||||
otherProperty.put("FLOWUNID", entry.getValue());
|
||||
|
||||
DataOperatorUtil.copyJBOSet(LC_RENT_PLAN.CLASS_NAME, fromCondtion, LC_RENT_PLAN_HIS.CLASS_NAME,null, otherProperty, null, Sqlca);
|
||||
}
|
||||
//1.更新租金计划(直接文件每条信息更新,不需要遍历)
|
||||
this.updateRentPlan(fyfrpBoList,tx);
|
||||
|
||||
for(Map.Entry<String,String> entry: contractMap.entrySet()){
|
||||
String contractId = entry.getKey();
|
||||
Map<String,String> param= this.getParamByContractId(contractId,tx);
|
||||
//2.更新租金计划剩余本金
|
||||
this.updateAllRemainCorpus(contractId,tx);
|
||||
@ -86,6 +115,21 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应的合同ID
|
||||
* @param fyfrpBoList
|
||||
* @return
|
||||
* @throws JBOException
|
||||
*/
|
||||
public Map<String,String> getContractIdMap(List<BizObject> fyfrpBoList) throws JBOException {
|
||||
Map<String,String> contractMap = new HashMap<>();
|
||||
for(BizObject bo : fyfrpBoList){
|
||||
String contractId = bo.getAttribute("CONTRACT_ID").toString();
|
||||
String fcRequestId = bo.getAttribute("FC_REQUEST_ID").toString();
|
||||
contractMap.put(contractId,fcRequestId);
|
||||
}
|
||||
return contractMap;
|
||||
}
|
||||
/**
|
||||
* 租金计划拷贝
|
||||
* @param fyfrpBoList 每个回执文件包含的租金计划信息
|
||||
@ -93,10 +137,9 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
* @throws JBOException
|
||||
* @throws ParseException
|
||||
*/
|
||||
public Set<String> updateRentPlan(List<BizObject> fyfrpBoList,JBOTransaction tx) throws JBOException, ParseException {
|
||||
public void updateRentPlan(List<BizObject> fyfrpBoList,JBOTransaction tx) throws JBOException, ParseException {
|
||||
BizObjectManager lrpBom = null;
|
||||
lrpBom = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx);
|
||||
Set<String> contractSet = new HashSet<>();
|
||||
//更新租金计划表
|
||||
for(BizObject bo : fyfrpBoList){
|
||||
//获取参数
|
||||
@ -119,10 +162,7 @@ public class CorpusSourceRentPlanCopy implements Job {
|
||||
lrpBo.setAttributeValue("PLAN_DATE",repaymentDate);
|
||||
lrpBo.setAttributeValue("RENT",repaymentMoney);
|
||||
lrpBom.saveObject(lrpBo);
|
||||
//放进set去重
|
||||
contractSet.add(contractId);
|
||||
}
|
||||
return contractSet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user