This commit is contained in:
liujiaji 2018-08-01 10:56:26 +08:00
parent fcadd46bd8
commit dddfae284b
3 changed files with 346 additions and 25 deletions

View File

@ -43,10 +43,17 @@ public class BusinessDocUploadServiceImpl implements BusinessDocUploadService {
public Map<String, Object> upload(HttpServletRequest request,
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
ReturnMapUtil ReturnMapUtil) throws Exception {
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
Map<String, Object> testMap = null;
if (response != null) {
testMap = (Map<String, Object>) MultipartDataUtil
.readRequestParam(request, "UTF-8");
fieldMap = fieldMap == null ? (Map<String, Object>) testMap.get("fieldMap") : fieldMap; // 参数
fileList = fileList == null ? (List<Map<String, Object>>) testMap.get("fileList") : fileList; // 资料列表
}
fieldMap = testMap != null ? (Map<String, Object>) testMap.get("fieldMap") : fieldMap; // 参数
fileList = testMap != null ? (List<Map<String, Object>>) testMap.get("fileList") : fileList; // 资料列表
String applyType = "BusinessApplyApply";
String flowUnid = fieldMap.get("objectno") == null ? "" : fieldMap.get(
"objectno").toString(); // Á÷³ÌºÅ
@ -133,7 +140,7 @@ public class BusinessDocUploadServiceImpl implements BusinessDocUploadService {
attr.setAttributeValue("FullPath",sFullPath);
attr.setAttributeValue("Content_Type", file.get("fileContentType"));
attr.setAttributeValue("FileSize", file.get("fileSize"));
tx.join(attrBm);
// tx.join(attrBm);
attrBm.saveObject(attr);
}

View File

@ -0,0 +1,311 @@
package apx.com.amarsoft.als.apzl.apply.business.loan.product;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import jbo.sys.CODE_LIBRARY;
import apx.com.amarsoft.als.base.cache.instance.AppAweDoCache;
import com.amarsoft.app.lc.workflow.action.GetFlowAction;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.lang.StringX;
import com.amarsoft.awe.dw.ui.validator.ValidateRule;
import com.tenwa.reckon.bean.TabCalBean;
import com.tenwa.reckon.product.ProductCondition;
import com.tenwa.reckon.util.TbBeanTools;
import com.tenwa.util.SerialNumberUtil;
public class ProductBaseLoanTools {
@SuppressWarnings("unchecked")
public static Map<String, Object> checkSource(Map<String, Object> app,
String colName, String operation, Object value) {
if ("finatype01".equals(value)) {
ARE.getLog().info("finatype01");
}
if (operation.contains("defaultValue")) {
app.put("coldefaultvalue", value);
} else {
if (!"coldefaultvalue".equals(operation)) {
return app;
}
}
Map<String, Object> donoTemp = (Map<String, Object>) (AppAweDoCache.getAppAweDoCachePool().get("LoanSimulationBasicInfoApp"));
List<Map<String, Object>> libarary = (List<Map<String, Object>>) (donoTemp.get("library"));
String source = "";
String sourceType = "";
for (Map<String, Object> col : libarary) {
String sColName = col.get("colname") == null ? "" : col.get("colname").toString();
if (sColName.equals(colName)) {
source = col.get("coleditsource") == null ? "" : col.get("coleditsource").toString();
sourceType = col.get("coleditsourcetype") == null ? "" : col.get("coleditsourcetype").toString();
break;
}
}
source = app.get("coleditsource") == null ? source : app.get("coleditsource").toString();
sourceType = app.get("coleditsourcetype") == null ? sourceType : app.get("coleditsourcetype").toString();
if (StringX.isSpace(source)) {
app.put("coldefaultitemno", value);
return app;
}
if (StringX.isSpace(sourceType)) {
app.put("coldefaultitemno", value);
return app;
}
if ("Code".equals(sourceType)) { // CODENO='SettleMethod'
try {
String itemno = value == null ? null : value.toString();
BizObjectManager bom = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME);
BizObject bo = bom.createQuery("CODENO=:CODENO and itemno=:itemno")
.setParameter("CODENO", source).setParameter("itemno", itemno)
.getSingleResult(false);
if (null == bo) {
app.put("coldefaultitemno", value);
return app;
}
app.put("coldefaultitemno", bo.getAttribute("itemname").getValue());
return app;
} catch (JBOException e) {
ARE.getLog().error(e);
app.put("coldefaultitemno", value);
return app;
}
} else if ("CodeTable".equals(sourceType)) { // ,,,
try {
String itemno = value == null ? null : value.toString();
int size = source.split(",").length;
if (size > 0 && size % 2 == 0) {
String [] array = source.split(",");
for (int i = 0; i < size; i++) {
if (i!=0 && i + 1 > size) break;
String itemno2 = array[i];
if (itemno2.equalsIgnoreCase(itemno)) {
app.put("coldefaultitemno", array[i+1]);
break;
}
i++;
}
if (null == app.get("coldefaultitemno")) {
app.put("coldefaultitemno", value);
return app;
}
} else {
app.put("coldefaultitemno", value);
return app;
}
} catch (Exception e) {
ARE.getLog().error(e);
app.put("coldefaultitemno", value);
return app;
}
} else if ("JBO".equals(sourceType)) { // jbo.app.tenwa.customer.DISTRIBUTOR_INFO,ID,DISTRIBUTOR_NAME,1=1
try {
String itemno = value == null ? null : value.toString();
if (source.contains(",")) {
String[] arrayJbo = source.split(",");
if (arrayJbo.length >= 4) {
String sClass = arrayJbo[0];
String sKey = arrayJbo[1];
String sValue = arrayJbo[2];
String sWhere = arrayJbo[3];
if (arrayJbo.length > 4) {
for (int io = 4; io < arrayJbo.length; io++) {
sWhere += "," + arrayJbo[io];
}
}
BizObjectManager bom = JBOFactory
.getBizObjectManager(sClass);
BizObjectQuery boq = bom.createQuery("SELECT "
+ sKey + ", " + sValue
+ " FROM O WHERE " + sWhere);
List<BizObject> bos = boq.getResultList(false);
for (BizObject bo : bos) {
// sDefult
if (itemno.equals(bo.getAttribute(sKey)
.getValue())) {
app.put("coldefaultitemno", bo.getAttribute(sValue)
.getValue());
return app;
}
}
if (null == app.get("coldefaultitemno")) {
app.put("coldefaultitemno", value);
return app;
}
}
}
} catch (JBOException e) {
ARE.getLog().error(e);
app.put("coldefaultitemno", value);
return app;
}
} else if ("@MIN_MAX".equals(sourceType)) { // 6,8
try {
String itemno = value == null ? null : value.toString();
int size = source.split(",").length;
if (size == 2) {
String [] array = source.split(",");
String itemno2 = array[0];
String itemno3 = array[1];
int min = Integer.valueOf(itemno2);
int max = Integer.valueOf(itemno3);
int iin = Integer.valueOf(itemno);
if(min <= iin && iin <= max) {
app.put("coldefaultitemno", iin);
return app;
} else {
app.put("coldefaultitemno", value);
return app;
}
} else {
app.put("coldefaultitemno", value);
return app;
}
} catch (NumberFormatException e) {
ARE.getLog().error(e);
app.put("coldefaultitemno", value);
return app;
}
}
return app;
}
public static void addAppList(List<Map<String, Object>> appList,
String colName, String operation, Object value) {
if (null == appList)
return;
if (null == colName)
return;
if (null == operation)
return;
boolean flag = false;
for (Map<String, Object> app : appList) {
String colName2 = app.get("colname") == null ? "" : app.get(
"colname").toString();
if (colName.equals(colName2)) {
app.put(operation, value);
checkSource(app, colName, operation, value);
flag = true;
break;
}
}
if (!flag) {
Map<String, Object> app = new HashMap<String, Object>();
app.put("colname", colName);
app.put(operation, value);
checkSource(app, colName, operation, value);
appList.add(app);
}
flag = false;
}
// begin 费用规则
public static String getProductFundRules(List<Map<String, Object>> appList,
String productId) throws Exception {
if (null == appList)
appList = new ArrayList<Map<String, Object>>();
ProductCondition pc = new ProductCondition();
pc.getProductFundRulesApp(appList, productId);
/* 设置模板属性 */
Vector<ValidateRule> vali = new Vector<ValidateRule>();
String calcRules = pc.getProductRulesApp(appList, productId, vali);
return calcRules;
}
// end
// begin 获取 测算基础值及流水号
public static Map<String, Object> deadWork(String productId,
String calType, String planCName, String plannumber, String tb,
String flowunid, JBOTransaction tx) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
/* 获取参数 */
/* 根据参数判断 是否去数据库查询 */
BizObject flow = GetFlowAction.getFlowBussinessObject(flowunid);
if (productId == null) {
productId = flow.getAttribute("productId").getString();
}
map.put("productId", productId);
if (calType == null) {
calType = "proj_process";
}
map.put("calType", calType);
TabCalBean tcb = TbBeanTools.getTabInfo(calType);
planCName = tcb.getPlanCName();
map.put("planCName", planCName);
// 方案编号
if (plannumber == null) {
if ("pay_process".equals(calType)
|| "onHire_process".equals(calType)) {
BizObject condtion = JBOFactory
.createBizObjectQuery(
"jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP",
"flowunid=:flowunid and PAYMENT_NUMBER is not null and length(PAYMENT_NUMBER)>0 ")
.setParameter("flowunid", flowunid)
.getSingleResult(false);
if (condtion != null) {
plannumber = condtion.getAttribute(planCName).getString();
}
} else {
BizObject condtion = JBOFactory
.createBizObjectQuery(
"jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP",
"flowunid=:flowunid")
.setParameter("flowunid", flowunid)
.getSingleResult(false);
if (condtion != null) {
plannumber = condtion.getAttribute(planCName).getString();
}
}
}
// 新增数据 自动生成方案编号
if (plannumber == null) {
String sSerialType = "";
if ("proj_process".equals(calType)) {
BizObject proj = JBOFactory
.createBizObjectQuery(
"jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP",
"flowunid=:flowunid")
.setParameter("flowunid", flowunid)
.getSingleResult(false);
sSerialType = proj.getAttribute("PROJECT_NO").getString();
} else {
BizObject contract = JBOFactory
.createBizObjectQuery(
"jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP",
"flowunid=:flowunid")
.setParameter("flowunid", flowunid)
.getSingleResult(false);
sSerialType = contract.getAttribute("CONTRACT_NO").getString();
}
plannumber = SerialNumberUtil.getPlannumber(sSerialType, calType,
tx);
tx.commit();
}
map.put("plannumber", plannumber);
tb = tcb.getCondition_tb();
map.put("tb", tb);
return map;
}
// end
}

View File

@ -8,7 +8,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import apx.com.amarsoft.als.apzl.apply.business.doc.upload.service.BusinessDocUploadService;
import apx.com.amarsoft.als.apzl.apply.business.doc.upload.service.impl.BusinessDocUploadServiceImpl;
import apx.com.amarsoft.als.apzl.apply.business.start.bo.BusinessBO;
import apx.com.amarsoft.als.apzl.apply.business.start.init.InitDocListTools;
@ -24,6 +23,7 @@ import com.base.util.ReturnMapUtil;
public class BusinessApplyStartServiceImpl implements BusinessApplyStartService {
private Map<String, Object> fieldMap;
private List<Map<String, Object>> fileList;
@SuppressWarnings("unchecked")
public Map<String, Object> applyStart(HttpServletRequest request,
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
@ -40,6 +40,29 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService
String serialNo = sReturnInfo.split("@")[1];
// 获取当前申请的相关参数包含FlowUnid
Map<String, String> params = bo.getParams();
// 加载附件
boolean flag = InitDocListTools.initDocList(params.get("FlowUnid"),
fieldMap.get("userid").toString(), bo.getCarAttributes());
String certType = bo.getCerttype();
String date = DateUtil.getDateTime(new Date());
if (flag && "ind01".equals(certType.toLowerCase())
&& (fileList != null && fileList.size() > 0)) { // 承租人身份证正反面照片
fieldMap.put("objectNo".toUpperCase(), params.get("FlowUnid"));
fieldMap.put("objectNo".toLowerCase(), params.get("FlowUnid"));
fieldMap.put("docname".toUpperCase(), "承租人身份证(正反面)");
fieldMap.put("docname".toLowerCase(), "承租人身份证(正反面)");
fieldMap.put("remark".toUpperCase(),
"业务申请流程手机APP发起 - 上传资料照片 - " + date);
fieldMap.put("remark".toLowerCase(),
"业务申请流程手机APP发起 - 上传资料照片 - " + date);
BusinessDocUploadServiceImpl service = new BusinessDocUploadServiceImpl();
service.setFieldMap(fieldMap);
service.setFileList(fileList);
service.upload(null, null, tx, sqlca, null);
}
// 返回前台的数据
Map<String, Object> body = new HashMap<String, Object>();
body.put("flowUnid", params.get("FlowUnid"));
@ -50,26 +73,6 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService
ReturnMapUtil.setReturnMap(body,
RestfullConstant.baseProperty.get("success").toString(),
"发起成功");
// 加载附件
boolean flag = InitDocListTools.initDocList(params.get("FlowUnid"),
fieldMap.get("userid").toString(), bo.getCarAttributes());
String certType = bo.getCerttype();
String date = DateUtil.getDateTime(new Date());
if (flag && "ind01".equals(certType.toLowerCase())
&& (fileList != null && fileList.size() > 0)) { // 承租人身份证正反面照片
fieldMap.put("objectNo".toUpperCase(), params.get("FlowUnid"));
fieldMap.put("objectNo".toLowerCase(), params.get("FlowUnid"));
fieldMap.put("docname".toUpperCase(), "承租人身份证(正反面)");
fieldMap.put("docname".toLowerCase(), "承租人身份证(正反面)");
fieldMap.put("remark".toUpperCase(), "业务申请流程手机APP发起 - 上传资料照片 - " + date);
fieldMap.put("remark".toLowerCase(), "业务申请流程手机APP发起 - 上传资料照片 - " + date);
BusinessDocUploadServiceImpl service = new BusinessDocUploadServiceImpl();
service.setFieldMap(fieldMap);
service.setFileList(fileList);
}
} else if (sReturnInfo.startsWith("failed")) {
ReturnMapUtil.setReturnMap(null,
RestfullConstant.baseProperty.get("FAIL").toString(),