APP邮寄归档接口发起
This commit is contained in:
parent
e8951506a2
commit
64e4058253
@ -126,5 +126,24 @@ public class BusinessApplyStartController {
|
||||
}
|
||||
}
|
||||
|
||||
//ÓʼĹ鵵·¢Æð
|
||||
@Path("/mail/start")
|
||||
@POST
|
||||
public Map<String, Object> MailStart(@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/mail/start" + " run .................");
|
||||
|
||||
BusinessApplyStartService service = new BusinessApplyStartServiceImpl();
|
||||
try {
|
||||
return service.MailStart(request, response, tx, sqlca, ReturnMapUtil);
|
||||
} catch (Exception e) {
|
||||
return ReturnMapUtil.rollback(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,329 @@
|
||||
package apx.com.amarsoft.als.apzl.apply.business.start.initiate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.flow.action.comm.BaseFlowStartAction;
|
||||
import com.tenwa.util.SerialNumberUtil;
|
||||
|
||||
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;
|
||||
|
||||
public class MailArchiveBO implements Serializable{
|
||||
private static final long serialVersionUID = -266598671717858119L;
|
||||
private String ApplyType;
|
||||
private String CurUserID;
|
||||
private String ProjectName;
|
||||
private String ContractNumber;
|
||||
private String ContractId;
|
||||
|
||||
private String customertype;
|
||||
private String msg;
|
||||
private Map<String, String> params;
|
||||
private String fixedFlowParam;
|
||||
private String objectNo;
|
||||
private String serialNo;
|
||||
|
||||
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(ProjectName)) {
|
||||
msg = "项目名称不能为空!";
|
||||
return false;
|
||||
}
|
||||
if (StringX.isSpace(CurUserID)) {
|
||||
msg = "用户id不能为空!";
|
||||
return false;
|
||||
}
|
||||
if (StringX.isSpace(ContractNumber)) {
|
||||
msg = "互斥id不能为空!";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public MailArchiveBO(Map<String, Object> fieldMap, JBOTransaction tx) throws Exception {
|
||||
this.ApplyType = fieldMap.get("ApplyType".toLowerCase()) == null ? ""
|
||||
: fieldMap.get("ApplyType".toLowerCase()).toString(); // 流程实例号
|
||||
this.ProjectName = fieldMap.get("projectName".toLowerCase()) == null ? ""
|
||||
: fieldMap.get("projectName".toLowerCase()).toString(); // 项目名称
|
||||
this.customertype = fieldMap.get("customertype".toLowerCase()) == null ? ""
|
||||
: fieldMap.get("customertype".toLowerCase()).toString(); // 租赁类型
|
||||
this.CurUserID = fieldMap.get("userid".toLowerCase()) == null ? ""
|
||||
: fieldMap.get("userid".toLowerCase()).toString(); // 客户id
|
||||
this.ContractNumber = fieldMap.get("CONTRACT_NUMBER".toLowerCase()) == null ? ""
|
||||
: fieldMap.get("CONTRACT_NUMBER".toLowerCase()).toString(); // 邮寄号
|
||||
|
||||
}
|
||||
|
||||
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("ProjectName", ProjectName);
|
||||
action.setProjectName(ProjectName);
|
||||
map.put("ContractNumber", ContractNumber);
|
||||
map.put("customertype", customertype);
|
||||
action.setCustomertype(customertype);
|
||||
map.put("CurUserID", CurUserID);
|
||||
action.setCurUserID(CurUserID);
|
||||
|
||||
JSONObject jsonObject = JSONObject.fromObject(map);
|
||||
this.fixedFlowParam = jsonObject.toString();
|
||||
action.setFixedFlowParam(fixedFlowParam);
|
||||
msg = action.initFLow(tx); // 定义流程中需要的参数
|
||||
params = action.getFlowParam();
|
||||
|
||||
objectNo = params.get("FlowUnid");
|
||||
ContractId = params.get("ProjectId");
|
||||
if (msg.startsWith("success")) {
|
||||
serialNo = msg.split("@")[1];
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
BizObjectManager libraryManage = JBOFactory
|
||||
.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME);
|
||||
BizObjectQuery query = libraryManage.createQuery(sql).setParameter(
|
||||
"projid", proj_id);
|
||||
@SuppressWarnings("unchecked")
|
||||
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 getApplyType() {
|
||||
return ApplyType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setApplyType(String applyType) {
|
||||
ApplyType = applyType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCurUserID() {
|
||||
return CurUserID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCurUserID(String curUserID) {
|
||||
CurUserID = curUserID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getProjectName() {
|
||||
return ProjectName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
ProjectName = projectName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* public String getFlowKey() {
|
||||
return FlowKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFlowKey(String flowKey) {
|
||||
FlowKey = flowKey;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
public String getCustomertype() {
|
||||
return customertype;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCustomertype(String customertype) {
|
||||
this.customertype = customertype;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setParams(Map<String, String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getFixedFlowParam() {
|
||||
return fixedFlowParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFixedFlowParam(String fixedFlowParam) {
|
||||
this.fixedFlowParam = fixedFlowParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getObjectNo() {
|
||||
return objectNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setObjectNo(String objectNo) {
|
||||
this.objectNo = objectNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getSerialNo() {
|
||||
return serialNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setSerialNo(String serialNo) {
|
||||
this.serialNo = serialNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getContractId() {
|
||||
return ContractId;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
ContractId = contractId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -34,4 +34,8 @@ public interface BusinessApplyStartService {
|
||||
Map<String, Object> OverseersStart(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception;
|
||||
|
||||
Map<String, Object> MailStart(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil) throws Exception;
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ 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.bo.MakeContractBusinessBO;
|
||||
import apx.com.amarsoft.als.apzl.apply.business.start.init.InitDocListTools;
|
||||
import apx.com.amarsoft.als.apzl.apply.business.start.initiate.MailArchiveBO;
|
||||
import apx.com.amarsoft.als.apzl.apply.business.start.initiate.OverseersBO;
|
||||
import apx.com.amarsoft.als.apzl.apply.business.start.initiate.PaymentRequestBO;
|
||||
import apx.com.amarsoft.als.apzl.apply.business.start.service.BusinessApplyStartService;
|
||||
@ -274,5 +275,39 @@ public class BusinessApplyStartServiceImpl implements BusinessApplyStartService
|
||||
|
||||
return ReturnMapUtil.getReturnMap();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, Object> MailStart(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");
|
||||
MailArchiveBO bo = new MailArchiveBO(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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user