添加app发起业务变更和撤销

This commit is contained in:
tangfutang 2020-05-25 19:19:28 +08:00
parent 0ac5c298d7
commit fc41096ad3
5 changed files with 506 additions and 5 deletions

View File

@ -0,0 +1,445 @@
package apx.com.amarsoft.als.apzl.apply.business.start.bo;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.app.LB_DOCLIBRARY;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.calc.LC_RENT_PLAN_TEMP;
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
import jbo.app.tenwa.doc.LB_DOCRELATIVE;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import net.sf.json.JSONObject;
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.base.constant.RestfullConstant;
import com.base.util.JsonUtil;
import com.base.util.StringUtil;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.action.comm.BaseFlowStartAction;
import com.tenwa.util.MultiSubjectUtil;
public class ChangeBusinessBO implements Serializable {
private static final long serialVersionUID = -25060991874562555L;
private String applyType;
private String carAttributes; // 车辆属性
private String productId; // 产品类型
private String CUSTOMERID; // 客户编号
private String CUSTOMERNAME; // 客户名称
private String customerType; // 客户类别
private String certtype; // 证件类型
private String SubjectId;
private String SubjectName;
private String ProjectName;
private String leasform;
private String FlowKey;
private String businessType; // 业务类型1是汽车业务2是传统业务3是汽车传统业务
private String curUserId;
private String fixedFlowParam;
private String serialNo;
private String objectNo;
private String projectId;
private String msg;
private String operationType;
private Map<String, String> params;
public void setParam(Map<String, Object> fieldMap, String param, Object obj) {
obj = fieldMap.get(param.toLowerCase()) == null ? null : fieldMap.get(
param.toLowerCase()).toString();
}
public boolean checkKeyField() {
if (StringX.isSpace(applyType)) {
msg = "申请编号不能为空!";
return false;
}
if (StringX.isSpace(carAttributes)) {
msg = "车辆属性不能为空!";
return false;
}
if (StringX.isSpace(CUSTOMERNAME)) {
msg = "客户名称不能为空!";
return false;
}
if (StringX.isSpace(customerType)) {
msg = "客户类别不能为空!";
return false;
}
if (StringX.isSpace(certtype)) {
msg = "证件类型不能为空!";
return false;
}
if (StringX.isSpace(FlowKey)) {
msg = "申请编号不能为空!";
return false;
}
if (StringX.isSpace(leasform)) {
msg = "租赁形式不能为空!";
return false;
}
if (StringX.isSpace(projectId)) {
msg = "项目id不能为空";
return false;
}
if (StringX.isSpace(SubjectId)) {
msg = "主体id不能为空";
return false;
}
return true;
}
public ChangeBusinessBO(Map<String, Object> fieldMap, JBOTransaction tx)
throws Exception {
this.applyType = fieldMap.get("applyType".toLowerCase()) == null ? ""
: fieldMap.get("applyType".toLowerCase()).toString(); // 流程实例号
this.projectId = fieldMap.get("projectId".toLowerCase()) == null ? ""
: fieldMap.get("projectId".toLowerCase()).toString(); // 项目编号
this.carAttributes = fieldMap.get("carAttributes".toLowerCase()) == null ? ""
: fieldMap.get("carAttributes".toLowerCase()).toString(); // 车辆属性
this.productId = fieldMap.get("productId".toLowerCase()) == null ? null
: fieldMap.get("productId".toLowerCase()).toString(); // 产品类型
this.CUSTOMERNAME = fieldMap.get("customername".toLowerCase()) == null ? ""
: fieldMap.get("customername".toLowerCase()).toString(); // 客户名称
this.customerType = fieldMap.get("customer_Type".toLowerCase()) == null ? ""
: fieldMap.get("customer_Type".toLowerCase()).toString(); // 客户类型
// 01,法人,03,个人
this.certtype = "01".equals(this.customerType) ? "Ent02" : "03"
.equals(this.customerType) ? "Ind01" : ""; // 证件类型// Ent02,组织机构号,Ind01,身份证
this.curUserId = fieldMap.get("userid".toLowerCase()) == null ? ""
: fieldMap.get("userid".toLowerCase()).toString();
this.leasform = fieldMap.get("leasform".toLowerCase()) == null ? ""
: fieldMap.get("leasform".toLowerCase()).toString();
this.FlowKey = fieldMap.get("FlowKey".toLowerCase()) == null ? ""
: fieldMap.get("FlowKey".toLowerCase()).toString();
this.businessType = RestfullConstant.baseProperty.get("BUSINESS_TYPE") == null ? ""
: RestfullConstant.baseProperty.get("BUSINESS_TYPE").toString(); // 业务类型
this.ProjectName = FlowKey+"-"+CUSTOMERNAME;
//更具产品id获取对应的主体信息
List<Map<String, String>> sujectIdList = DataOperatorUtil.getDataBySql("SELECT manysubject,operationtype FROM PRD_SPECIFIC_LIBRARY WHERE productid='"+this.productId+"'");
if(sujectIdList.size()>0){
this.SubjectId = sujectIdList.get(0).get("manysubject");
if(MultiSubjectUtil.SZSUBJECTID.equals(this.SubjectId)){//深圳主体
this.SubjectName = MultiSubjectUtil.SZSUBJECTNAME;
}else if (MultiSubjectUtil.TJSUBJECTID.equals(this.SubjectId)){//天津主体
this.SubjectName = MultiSubjectUtil.TJSUBJECTNAME;
}
this.operationType = sujectIdList.get(0).get("operationtype");
}
}
public void businessAppStart(JBOTransaction tx) throws Exception {
if (!checkKeyField()) // 校验非空字段
return;
Map<String, Object> map = new HashMap<String, Object>();
BaseFlowStartAction action = new BaseFlowStartAction();
map.put("ApplyType", applyType);
action.setApplyType(applyType);
map.put("CurUserID", curUserId);
action.setCurUserID(curUserId);
map.put("ProductId", productId);
action.setProductId(productId);
map.put("customertype", customerType);
action.setCustomertype(customerType);
map.put("carAttributes", carAttributes);
action.setCarAttributes(carAttributes);
map.put("custname", CUSTOMERNAME);
action.setCustname(CUSTOMERNAME);
map.put("certtype", certtype);
map.put("businessType", businessType);
map.put("sourcetype", "app");
map.put("SubjectId", SubjectId);
map.put("SubjectName", SubjectName);
map.put("leasform", leasform);
action.setLeasform(leasform);
map.put("ProjectId", projectId);
action.setProjectId(projectId);
map.put("FlowKey", FlowKey);
action.setFlowKey(FlowKey);
map.put("ProjectName", ProjectName);
action.setProjectName(ProjectName);
JSONObject jsonObject = JSONObject.fromObject(map);
this.fixedFlowParam = jsonObject.toString();
action.setFixedFlowParam(fixedFlowParam);
msg = action.initFLow(tx); // 定义流程中需要的参数
params = action.getFlowParam();
objectNo = params.get("FlowUnid");
projectId = params.get("ProjectId");
if (msg.startsWith("success")) {
serialNo = msg.split("@")[1];
}
}
public String getSerialNo() {
return serialNo;
}
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
public String getObjectNo() {
return objectNo;
}
public void setObjectNo(String objectNo) {
this.objectNo = objectNo;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@SuppressWarnings("unchecked")
public boolean checkDoc() throws JBOException {
BizObjectManager fboM = JBOFactory
.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME);
BizObject fbo = fboM.createQuery("flow_unid=:flow_unid")
.setParameter("flow_unid", objectNo).getSingleResult(false);
if (null == fbo) {
msg = "未找到流程实例!";
return false;
}
try {
String flowPara = fbo.getAttribute("FixedFlowParam") == null ? ""
: fbo.getAttribute("FixedFlowParam").toString();
JSONObject jo = JsonUtil.str2JSONObject(flowPara.trim());
customerType = jo.get("CustomerType") == null ? "" : jo
.getString("CustomerType");
} catch (Exception e) {
ARE.getLog().error(e);
msg = "获取客户信息失败!";
return false;
}
String proj_id = fbo.getAttribute("proj_id").getString();
String sql = "";
sql = "SELECT DISTINCT O.ID, O.DOC_NAME,r.id " + "FROM O, "
+ LB_DOCRELATIVE.CLASS_NAME + " R "
+ "WHERE O.RELATIVE_ID = R.ID "
+ "AND O.ID NOT IN (SELECT A.LIBRARY_ID FROM "
+ LB_DOCATTRIBUTE.CLASS_NAME + " A) "
+ "AND R.ObjectType='BusinessApplyFlow' and R.proj_id=:projid " + "AND o.DOC_NATURE='01' "
+ "ORDER BY SERIAL_NUM";
// R.ObjectType='BusinessApplyFlow' and R.proj_id=:projid
BizObjectManager libraryManage = JBOFactory
.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME);
BizObjectQuery query = libraryManage.createQuery(sql).setParameter(
"projid", proj_id);
List<BizObject> librarys = query.getResultList(false);
String docNameConfig = "01".equals(customerType) ? RestfullConstant.baseProperty
.get("COMPANY_DOC_NAME").toString()
: "03".equals(customerType) ? RestfullConstant.baseProperty
.get("PERSON_DOC_NAME").toString() : "";
String[] array = docNameConfig.trim().split(",");
String docName = "";
for (String str : array) {
String[] array2 = str.trim().split("@");
docName += array2[0].trim() + ",";
}
String[] docArr = docName.split(",");
Object[] arr2 = StringUtil.removalDuplicate(docArr);
msg = "";
for (int i = 0; i < arr2.length; i++) {
String doc = arr2[i].toString();
for (BizObject library : librarys) {
if (doc.trim().equals(
library.getAttribute("DOC_NAME").toString().trim())) {
msg += " [" + doc + "] 必备 未上传资料照片!\r\n";
}
}
}
BizObjectManager conditionM = JBOFactory.getBizObjectManager(LC_CALC_CONDITION_TEMP.CLASS_NAME);
BizObjectManager rentM = JBOFactory.getBizObjectManager(LC_RENT_PLAN_TEMP.CLASS_NAME);
BizObject condition = conditionM.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", objectNo).getSingleResult(false);
BizObject rent = rentM.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", objectNo).getSingleResult(false);
if (null == condition || null == rent) {
msg += " [商务条件] 没有找到业务测算信息!\r\n";
}
if (msg.equals("")) {
return true;
}
// msg += "业务申请 提交风险预警报告";
return false;
}
public String getCarAttributes() {
return carAttributes;
}
public void setCarAttributes(String carAttributes) {
this.carAttributes = carAttributes;
}
public String getApplyType() {
return applyType;
}
public void setApplyType(String applyType) {
this.applyType = applyType;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getCUSTOMERID() {
return CUSTOMERID;
}
public void setCUSTOMERID(String cUSTOMERID) {
CUSTOMERID = cUSTOMERID;
}
public String getCUSTOMERNAME() {
return CUSTOMERNAME;
}
public void setCUSTOMERNAME(String cUSTOMERNAME) {
CUSTOMERNAME = cUSTOMERNAME;
}
public String getCustomerType() {
return customerType;
}
public void setCustomerType(String customerType) {
this.customerType = customerType;
}
public String getCerttype() {
return certtype;
}
public void setCerttype(String certtype) {
this.certtype = certtype;
}
public String getSubjectId() {
return SubjectId;
}
public void setSubjectId(String subjectId) {
SubjectId = subjectId;
}
public String getSubjectName() {
return SubjectName;
}
public void setSubjectName(String subjectName) {
SubjectName = subjectName;
}
public String getProjectName() {
return ProjectName;
}
public void setProjectName(String projectName) {
ProjectName = projectName;
}
public String getLeasform() {
return leasform;
}
public void setLeasform(String leasform) {
this.leasform = leasform;
}
public String getFlowKey() {
return FlowKey;
}
public void setFlowKey(String flowKey) {
FlowKey = flowKey;
}
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
public String getCurUserId() {
return curUserId;
}
public void setCurUserId(String curUserId) {
this.curUserId = curUserId;
}
public String getFixedFlowParam() {
return fixedFlowParam;
}
public void setFixedFlowParam(String fixedFlowParam) {
this.fixedFlowParam = fixedFlowParam;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public Map<String, String> getParams() {
return params;
}
public void setParams(Map<String, String> params) {
this.params = params;
}
public void sethaveCommission(String haveCommission) {
haveCommission = haveCommission;
}
}

View File

@ -52,4 +52,22 @@ public class BusinessApplyStartController {
return ReturnMapUtil.rollback(e);
}
}
@Path("/changeApply/start")
@POST
public Map<String, Object> changeApplyStart(@Context HttpServletRequest request,
@Context HttpServletResponse response, @Context JBOTransaction tx,
@Context Transaction sqlca) throws Exception {
ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
ARE.getLog().info(
"[CONTROLLER] BusinessApplyStartController run .................");
ARE.getLog().info("[Path] /apply/changeApply/start" + " run .................");
BusinessApplyStartService service = new BusinessApplyStartServiceImpl();
try {
return service.changeApplyStart(request, response, tx, sqlca, ReturnMapUtil);
} catch (Exception e) {
return ReturnMapUtil.rollback(e);
}
}
}

View File

@ -18,4 +18,8 @@ public interface BusinessApplyStartService {
Map<String, Object> riskWarning(@Context HttpServletRequest request,
@Context HttpServletResponse response, @Context JBOTransaction tx,
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception;
Map<String, Object> changeApplyStart(@Context HttpServletRequest request,
@Context HttpServletResponse response, @Context JBOTransaction tx,
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception;
}

View File

@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP;
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.bo.ChangeBusinessBO;
import apx.com.amarsoft.als.apzl.apply.business.start.init.InitDocListTools;
import apx.com.amarsoft.als.apzl.apply.business.start.service.BusinessApplyStartService;
import apx.com.amarsoft.als.base.awe.execute.method.BusinessCustomerMethod;
@ -36,6 +37,9 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
.readRequestParam(request, "UTF-8");
System.out.println("=============发起业务申请参数================================");
System.out.println(testMap.toString());
System.out.println("=======================================");
fieldMap = (Map<String, Object>) testMap.get("fieldMap");
fileList = (List<Map<String, Object>>) testMap.get("fileList");
BusinessBO bo = new BusinessBO(fieldMap, tx);
@ -139,4 +143,38 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService
return ReturnMapUtil.getReturnMap();
}
@Override
public Map<String, Object> changeApplyStart(HttpServletRequest request,
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
ReturnMapUtil ReturnMapUtil) throws Exception {
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
.readRequestParam(request, "UTF-8");
System.out.println("=============发起申请参数================================");
System.out.println(testMap.toString());
System.out.println("=======================================");
fieldMap = (Map<String, Object>) testMap.get("fieldMap");
fileList = (List<Map<String, Object>>) testMap.get("fileList");
ChangeBusinessBO bo = new ChangeBusinessBO(fieldMap, tx);
bo.businessAppStart(tx);
tx.commit();
String sReturnInfo = bo.getMsg();
if (sReturnInfo.startsWith("success")) {
Map<String, Object> body = new HashMap<String, Object>();
body.put("flowUnid", bo.getObjectNo());
body.put("objectNo", bo.getObjectNo());
body.put("projectId", bo.getProjectId());
body.put("taskNo", bo.getSerialNo());
body.put("serialNo", bo.getSerialNo());
ReturnMapUtil.setReturnMap(body,
RestfullConstant.baseProperty.get("success").toString(),
"发起成功");
}else{
ReturnMapUtil.setReturnMap(null,
RestfullConstant.baseProperty.get("fail").toString(),
sReturnInfo);
}
return ReturnMapUtil.getReturnMap();
}
}

View File

@ -18,7 +18,7 @@ import com.base.util.ReturnMapUtil;
@Path("/flow/data")
public class FlowDataController {
FlowDataService service = new FlowDataServiceImpl();
//»ñÈ¡Á÷³ÌÖÐÒøÐп¨ÐÅÏ¢
@Path("/get/bankcard")
@POST
@ -30,8 +30,6 @@ public class FlowDataController {
.info("[CONTROLLER] FlowDataController run .................");
ARE.getLog().info(
"[Path] /flow/data/get/bankcard" + " run .................");
FlowDataService service = new FlowDataServiceImpl();
try {
return service.getFlowBankCard(request, response, tx, sqlca, ReturnMapUtil);
} catch (Exception e) {
@ -50,8 +48,6 @@ public class FlowDataController {
.info("[CONTROLLER] FlowDataController run .................");
ARE.getLog().info(
"[Path] /flow/data/save/bankcard" + " run .................");
FlowDataService service = new FlowDataServiceImpl();
try {
return service.saveFlowBankCard(request, response, tx, sqlca, ReturnMapUtil);
} catch (Exception e) {