开发app发起电子签约、短信重发、查询签约结果接口
This commit is contained in:
parent
02dc9c40df
commit
3358a90e80
@ -85,4 +85,64 @@ public class ContractMakeController {
|
||||
return ReturnMapUtil.rollback(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起签约验证
|
||||
*/
|
||||
@Path("/initiate/sign")
|
||||
@POST
|
||||
public Map<String, Object> initiateSign(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca) throws Exception {
|
||||
ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
|
||||
ARE.getLog()
|
||||
.info("[CONTROLLER] BusinessDataController run .................");
|
||||
ARE.getLog().info(
|
||||
"[Path] /contract/make/initiate/sign" + " run .................");
|
||||
try {
|
||||
return service.initiateSign(request, response, tx, sqlca, ReturnMapUtil);
|
||||
} catch (Exception e) {
|
||||
return ReturnMapUtil.rollback(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 电子签约短信重发
|
||||
*/
|
||||
@Path("/sendMessage/again")
|
||||
@POST
|
||||
public Map<String, Object> sendMessageAgain(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca) throws Exception {
|
||||
ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
|
||||
ARE.getLog()
|
||||
.info("[CONTROLLER] BusinessDataController run .................");
|
||||
ARE.getLog().info(
|
||||
"[Path] /contract/make/sendMessage/again" + " run .................");
|
||||
try {
|
||||
return service.sendMessageAgain(request, response, tx, sqlca, ReturnMapUtil);
|
||||
} catch (Exception e) {
|
||||
return ReturnMapUtil.rollback(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 签约结果查询
|
||||
*/
|
||||
@Path("/query/again")
|
||||
@POST
|
||||
public Map<String, Object> queryAgain(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca) throws Exception {
|
||||
ReturnMapUtil ReturnMapUtil = new ReturnMapUtil(tx, sqlca);
|
||||
ARE.getLog()
|
||||
.info("[CONTROLLER] BusinessDataController run .................");
|
||||
ARE.getLog().info(
|
||||
"[Path] /contract/make/query/again" + " run .................");
|
||||
try {
|
||||
return service.queryAgain(request, response, tx, sqlca, ReturnMapUtil);
|
||||
} catch (Exception e) {
|
||||
return ReturnMapUtil.rollback(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,21 @@ public interface ContractMakeService {
|
||||
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil)
|
||||
throws Exception;
|
||||
|
||||
Map<String, Object> initiateSign(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil)
|
||||
throws Exception;
|
||||
|
||||
Map<String, Object> sendMessageAgain(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil)
|
||||
throws Exception;
|
||||
|
||||
Map<String, Object> queryAgain(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response, @Context JBOTransaction tx,
|
||||
@Context Transaction sqlca, ReturnMapUtil ReturnMapUtil)
|
||||
throws Exception;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import net.sf.json.JSONObject;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.awe.Configure;
|
||||
@ -23,7 +24,9 @@ import com.amarsoft.context.ASUser;
|
||||
import com.base.constant.RestfullConstant;
|
||||
import com.base.util.MultipartDataUtil;
|
||||
import com.base.util.ReturnMapUtil;
|
||||
import com.tenwa.action.channelportal.businesshanding.contractaward.ContractAward;
|
||||
import com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil;
|
||||
import com.tenwa.channelportal.action.ContractSignAction;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.makeContract.util.MakeOneCodeAndContractModel;
|
||||
import com.tenwa.officetempalte.action.CreateContractOfficeAction;
|
||||
@ -116,33 +119,34 @@ public class ContractMakeServiceImpl implements ContractMakeService{
|
||||
Configure CurConfig = Configure.getInstance();
|
||||
String wordPath=CurConfig.getConfigure("FileSavePath");
|
||||
if(templateId == null || templateId.length() == 0){
|
||||
body.put("status", "faile");
|
||||
body.put("status", "01");
|
||||
body.put("message", "模板编号不能为空!");
|
||||
}else if(message == null && !"success".equals(message)){
|
||||
body.put("status", "faile");
|
||||
body.put("status", "01");
|
||||
body.put("message", message);
|
||||
}else if("error".equals(projectSignStatus)){
|
||||
body.put("status", "faile");
|
||||
body.put("status", "01");
|
||||
body.put("message", "请提醒客户查看手机短信,首先完成扣款卡的签约验证!");
|
||||
}else{
|
||||
flowParms.put("templateId", templateId);
|
||||
flowParms.put("wordPath", wordPath);
|
||||
String makeContract = ContractMakeControllerUtil.makeContract(flowParms, sqlca);
|
||||
if(!"success".equals(makeContract)){
|
||||
body.put("status", "faile");
|
||||
body.put("status", "01");
|
||||
body.put("message", makeContract);
|
||||
}else{
|
||||
MakeOneCodeAndContractModel modc = new MakeOneCodeAndContractModel();
|
||||
String diskPath=CurConfig.getConfigure("OneDimensionalCode");
|
||||
//根据合同编号生成一维码图片
|
||||
String path = modc.MOneDimensionalCode(contractNo, contractId, projectId,diskPath,tx);
|
||||
String outPdfFile = CurConfig.getConfigure("BQcontract");
|
||||
modc.pdfAndMark(outPdfFile, path, contractId,flowParms.get("leasform"), tx);
|
||||
String path = modc.MOneDimensionalCode(contractNo, contractId, projectId,diskPath,sqlca);
|
||||
String outPdfFile=CurConfig.getConfigure("BQcontract");
|
||||
modc.pdfAndMark(outPdfFile, path, contractId,flowParms.get("leasform"), sqlca);
|
||||
// //判断是否自动盖章sealType signType
|
||||
if(("01".equals(flowParms.get("customertype"))&&"Auto".equals(flowParms.get("sealType")) )||("Auto".equals(flowParms.get("sealType")) && "Hand".equals(flowParms.get("signType")) )){
|
||||
modc.compnySignIng(contractId, tx);
|
||||
modc.compnySignIng(contractId, sqlca);
|
||||
}
|
||||
body.put("status", "success");
|
||||
body.put("status", "00");
|
||||
body.put("message", "");
|
||||
}
|
||||
}
|
||||
ReturnMapUtil.setReturnMap(body,
|
||||
@ -201,4 +205,167 @@ public class ContractMakeServiceImpl implements ContractMakeService{
|
||||
}
|
||||
return falg;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> initiateSign(HttpServletRequest request,
|
||||
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
|
||||
ReturnMapUtil ReturnMapUtil) throws Exception {
|
||||
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
|
||||
.readRequestParam(request, "UTF-8");
|
||||
fieldMap = (Map<String, Object>) testMap.get("fieldMap"); // 参数
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
|
||||
String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString();
|
||||
String flowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString();
|
||||
Map<String, String> flowParms = ContractMakeControllerUtil.getFlowParms(flowUnid);
|
||||
String checkSign = this.checkSign(flowParms,"initiateSign", tx);
|
||||
|
||||
ContractSignAction csa = new ContractSignAction();
|
||||
csa.setProjectId(flowParms.get("ProjectId"));
|
||||
String checkFile = this.checkFile(csa, tx);
|
||||
if(!"success".equals(checkSign)){
|
||||
body.put("status", "01");
|
||||
body.put("message", checkSign);
|
||||
}else if(!"success".equals(checkFile)){
|
||||
body.put("status", "01");
|
||||
body.put("message", checkFile);
|
||||
}else{
|
||||
csa.setCurUserID(userid);
|
||||
csa.setFlowUnid(flowParms.get("FlowUnid"));
|
||||
csa.setSubjectId(flowParms.get("SubjectId"));
|
||||
String signIng = csa.signIng(tx);
|
||||
String[] signStatus = signIng.split("@");
|
||||
if("success".equals(signStatus[0])){
|
||||
body.put("status", "00");
|
||||
body.put("message", "电子签约发起成功!");
|
||||
}else{
|
||||
body.put("status", "01");
|
||||
body.put("message", signStatus[1]);
|
||||
}
|
||||
}
|
||||
body.put("FlowUnid", flowUnid);
|
||||
ReturnMapUtil.setReturnMap(body,
|
||||
RestfullConstant.baseProperty.get("success").toString(), "");
|
||||
return ReturnMapUtil.getReturnMap();
|
||||
}
|
||||
|
||||
//校验发起电子签约条件
|
||||
public String checkFile(ContractSignAction csa ,JBOTransaction tx) throws Exception{
|
||||
String message = "success";
|
||||
String resultMessge = csa.getMakeContractProcess(tx);
|
||||
if( ! "error".equals(resultMessge)){
|
||||
Integer fileStatus = new Integer(resultMessge);
|
||||
if(fileStatus==1){
|
||||
message = "word转换PDF格式部分失败,";
|
||||
}else if(fileStatus==2){
|
||||
message = "word转换PDF格式失败";
|
||||
}else if(fileStatus==3){
|
||||
message = "word转换PDF格式部分失败";
|
||||
}else if(fileStatus==4){
|
||||
message = "word文件正在转换PDF文件格式";
|
||||
}else if(fileStatus==5){
|
||||
message = "word文件没有转换PDF文件格式";
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> sendMessageAgain(HttpServletRequest request,
|
||||
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
|
||||
ReturnMapUtil ReturnMapUtil) throws Exception {
|
||||
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
|
||||
.readRequestParam(request, "UTF-8");
|
||||
fieldMap = (Map<String, Object>) testMap.get("fieldMap"); // 参数
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString();
|
||||
String flowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString();
|
||||
|
||||
Map<String, String> flowParms = ContractMakeControllerUtil.getFlowParms(flowUnid);
|
||||
|
||||
String checkSign = this.checkSign(flowParms,"sendMessageAgain", tx);
|
||||
if(!"success".equals(checkSign)){
|
||||
body.put("status", "01");
|
||||
body.put("message", checkSign);
|
||||
}else{
|
||||
ContractSignAction csa = new ContractSignAction();
|
||||
csa.setProjectId(flowParms.get("ProjectId"));
|
||||
csa.setSubjectId(flowParms.get("SubjectId"));
|
||||
String sendMessageAgain = csa.sendMessageAgain(tx);
|
||||
if("success".equals(sendMessageAgain)){
|
||||
body.put("status", "00");
|
||||
body.put("message", "短信发送成功!");
|
||||
}else{
|
||||
body.put("status", "01");
|
||||
body.put("message", "短信发送失败!["+sendMessageAgain+"]");
|
||||
}
|
||||
}
|
||||
body.put("FlowUnid", flowUnid);
|
||||
ReturnMapUtil.setReturnMap(body,
|
||||
RestfullConstant.baseProperty.get("success").toString(), "");
|
||||
return ReturnMapUtil.getReturnMap();
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> queryAgain(HttpServletRequest request,
|
||||
HttpServletResponse response, JBOTransaction tx, Transaction sqlca,
|
||||
ReturnMapUtil ReturnMapUtil) throws Exception {
|
||||
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
|
||||
.readRequestParam(request, "UTF-8");
|
||||
fieldMap = (Map<String, Object>) testMap.get("fieldMap"); // 参数
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString();
|
||||
String flowUnid = fieldMap.get("FlowUnid") == null ? "" : fieldMap.get("FlowUnid").toString();
|
||||
Map<String, String> flowParms = ContractMakeControllerUtil.getFlowParms(flowUnid);
|
||||
|
||||
String checkSign = this.checkSign(flowParms,"queryAgain", tx);
|
||||
if(!"success".equals(checkSign)){
|
||||
body.put("status", "01");
|
||||
body.put("message", checkSign);
|
||||
}else{
|
||||
ContractSignAction csa = new ContractSignAction();
|
||||
csa.setProjectId(flowParms.get("ProjectId"));
|
||||
csa.setCustomerType(flowParms.get("customertype"));
|
||||
csa.setFlowUnid(flowUnid);
|
||||
csa.setCurUserID(userid);
|
||||
csa.setSubjectId(flowParms.get("SubjectId"));
|
||||
String contractSignStatus = csa.contractSignStatus(tx);
|
||||
if("已经完成电子签约".equals(contractSignStatus)){
|
||||
body.put("status", "00");
|
||||
body.put("message",contractSignStatus);
|
||||
}else{
|
||||
body.put("status", "01");
|
||||
body.put("message", contractSignStatus);
|
||||
}
|
||||
}
|
||||
body.put("FlowUnid", flowUnid);
|
||||
ReturnMapUtil.setReturnMap(body,
|
||||
RestfullConstant.baseProperty.get("success").toString(), "");
|
||||
return ReturnMapUtil.getReturnMap();
|
||||
}
|
||||
|
||||
|
||||
//校验发起电子签约条件
|
||||
public String checkSign(Map<String, String> flowParms,String signType,JBOTransaction tx) throws Exception{
|
||||
String message = "success";
|
||||
ContractAward ca = new ContractAward();
|
||||
ca.setProject_id(flowParms.get("ProjectId"));
|
||||
ca.setFlowUnid(flowParms.get("FlowUnid"));
|
||||
String projectStatus = ca.projectStatus(tx);
|
||||
String[] result = projectStatus.split("@");
|
||||
String status = result[0];
|
||||
if("true".equals(result[3])){
|
||||
message = "请先生成pdf版的合同!!!";
|
||||
};
|
||||
if( status!=null && !status.equals("null") && status.length()>0 && new Integer(status) < 3 ){
|
||||
message = "请生成合同,在电子签约";
|
||||
};
|
||||
if(status!=null && !status.equals("null") && status.length()>0 && new Integer(status) > 4 &&new Integer(status) < 7 ){
|
||||
message = "合同状态为:"+result[1]+"不可以电子签章";
|
||||
}
|
||||
if("4".equals(status)){
|
||||
message = "电子签约已完成,无需重复发起!";
|
||||
};
|
||||
if("8".equals(status) && "initiateSign".equals(signType)){
|
||||
message = "电子签约已发起,请签署电子合同!";
|
||||
};
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user