bug修改
parent
79c79d1218
commit
7efbec9808
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,17 +1,7 @@
|
||||||
package com.api.aiyh_pcn.fadada.web;
|
package com.api.aiyh_pcn.fadada.web;
|
||||||
|
|
||||||
import aiyh.utils.ApiResult;
|
import java.util.HashMap;
|
||||||
import aiyh.utils.Util;
|
import java.util.Map;
|
||||||
import aiyh.utils.zwl.common.ToolUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping;
|
|
||||||
import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO;
|
|
||||||
import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService;
|
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
|
||||||
import org.h2.util.StringUtils;
|
|
||||||
import weaver.hrm.HrmUserVarify;
|
|
||||||
import weaver.hrm.User;
|
|
||||||
import weaver.systeminfo.SystemEnv;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -20,157 +10,169 @@ import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.StreamingOutput;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import org.h2.util.StringUtils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping;
|
||||||
|
import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO;
|
||||||
|
import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.zwl.common.ToolUtil;
|
||||||
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import weaver.hrm.HrmUserVarify;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
* @create 2021/11/3 0003 14:49
|
* @create 2021/11/3 0003 14:49 fadada
|
||||||
* fadada
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Path("/v2/fadada")
|
@Path("/v2/fadada")
|
||||||
public class FaDDContractController {
|
public class FaDDContractController {
|
||||||
private final FaDDContractService faDDService = new FaDDContractService();
|
private final FaDDContractService faDDService = new FaDDContractService();
|
||||||
private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping();
|
private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping();
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取流程全版本
|
||||||
|
*
|
||||||
|
* @param workflowId
|
||||||
|
* 流程id
|
||||||
|
* @return 流程全版本id
|
||||||
|
*/
|
||||||
|
@Path("/getAllVersion/{workflowId}/{markOnly}")
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) {
|
||||||
|
try {
|
||||||
|
Map<String, Object> allVersion = faDDService.getAllVersion(workflowId);
|
||||||
|
return ApiResult.success(allVersion);
|
||||||
|
} catch (Exception e) {
|
||||||
|
toolUtil.writeErrorLog("错误:" + e.toString());
|
||||||
|
return ApiResult.error(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取流程全版本
|
* 合同签署回调
|
||||||
*
|
*
|
||||||
* @param workflowId 流程id
|
* @param params
|
||||||
* @return 流程全版本id
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/getAllVersion/{workflowId}/{markOnly}")
|
@Path("/callback/signed")
|
||||||
@GET
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) {
|
public String signedCallBack(@RequestBody Map<String, Object> params) {
|
||||||
try {
|
toolUtil.writeErrorLog("回调方法,获取到的请求参数:" + JSON.toJSONString(params));
|
||||||
Map<String, Object> allVersion = faDDService.getAllVersion(workflowId);
|
Map<String, Object> result = new HashMap<>();
|
||||||
return ApiResult.success(allVersion);
|
result.put("code", 200);
|
||||||
} catch (Exception e) {
|
result.put("msg", "操作成功!");
|
||||||
toolUtil.writeErrorLog("错误:" + e.toString());
|
String resultCode = String.valueOf(params.get("resultCode"));
|
||||||
return ApiResult.error(e.toString());
|
if (!"1".equals(resultCode)) {
|
||||||
}
|
// 签署失败
|
||||||
}
|
toolUtil.writeErrorLog("合同回调:签署失败,失败信息:" + JSON.toJSONString(params));
|
||||||
|
return JSON.toJSONString(result);
|
||||||
|
}
|
||||||
|
String contractNo = String.valueOf(params.get("docNo"));
|
||||||
|
faDDService.signedCallBack(contractNo);
|
||||||
|
return JSON.toJSONString(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否签署完毕
|
||||||
|
*
|
||||||
|
* @param requestId
|
||||||
|
* @param workflowId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Path("/isAllSigned/{workflowId}/{requestId}")
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String querySignedStatus(@PathParam("requestId") String requestId,
|
||||||
|
@PathParam("workflowId") String workflowId) {
|
||||||
|
Map<String, Object> result = faDDService.querySignedStatus(requestId);
|
||||||
|
return ApiResult.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同签署回调
|
* 本方签署
|
||||||
* @param params
|
*
|
||||||
* @return
|
* @param workflowId
|
||||||
*/
|
* 流程id
|
||||||
@Path("/callback/signed")
|
* @param requestId
|
||||||
@POST
|
* 请求id
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
* @return 本方签署结果
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
*/
|
||||||
public String signedCallBack(@RequestBody Map<String, Object> params) {
|
@Path("/signedContract/own/{requestId}/{workflowId}")
|
||||||
toolUtil.writeErrorLog("回调方法,获取到的请求参数:" + JSON.toJSONString(params));
|
@GET
|
||||||
Map<String, Object> result = new HashMap<>();
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
result.put("code", 200);
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
result.put("msg", "操作成功!");
|
public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
String resultCode = String.valueOf(params.get("resultCode"));
|
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId) {
|
||||||
if(!"1".equals(resultCode)){
|
// TODO 更换labelIndex
|
||||||
// 签署失败
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
toolUtil.writeErrorLog("合同回调:签署失败,失败信息:" + JSON.toJSONString(params));
|
try {
|
||||||
return JSON.toJSONString(result);
|
faDDService.signedContractOwn(requestId, user);
|
||||||
}
|
} catch (Exception e) {
|
||||||
String contractNo = String.valueOf(params.get("docNo"));
|
return ApiResult.error(Util.getHtmlLabelName(-87658, user.getLanguage(), "合同签署失败!"));
|
||||||
faDDService.signedCallBack(contractNo);
|
}
|
||||||
return JSON.toJSONString(result);
|
return ApiResult.success(Util.getHtmlLabelName(-87657, user.getLanguage(), "本方签署成功!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 催一催
|
||||||
|
*
|
||||||
|
* @param requestId
|
||||||
|
* 请求id
|
||||||
|
* @return 催一催
|
||||||
|
*/
|
||||||
|
@Path("/signedContract/{requestId}")
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String signedContract(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
|
@PathParam("requestId") String requestId) {
|
||||||
|
return ApiResult.success("没有催一催接口还点!淦!等法大大调整,额。。。具体啥时候好我也不知道,反正不关我的事!");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否签署完毕
|
* 合同下载
|
||||||
* @param requestId
|
*
|
||||||
* @param workflowId
|
* @param requestId
|
||||||
* @return
|
* 请求id
|
||||||
*/
|
* @return 合同问价压缩包
|
||||||
@Path("/isAllSigned/{workflowId}/{requestId}")
|
*/
|
||||||
@GET
|
@Path("/contract/download/{requestId}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@GET
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
public String querySignedStatus(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId){
|
public Response contractDownload(@PathParam("requestId") String requestId) {
|
||||||
Map<String, Object> result = faDDService.querySignedStatus(requestId);
|
toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId);
|
||||||
return ApiResult.success(result);
|
try {
|
||||||
}
|
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId);
|
||||||
|
StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO);
|
||||||
|
// String requestTitle =
|
||||||
/**
|
// Util.null2String(Util.getRequestTitleById(String.valueOf(requestId)));
|
||||||
* 本方签署
|
String requestTitle = ufContractInfoDTO.getFileName();
|
||||||
*
|
if (StringUtils.isNullOrEmpty(requestTitle)) {
|
||||||
* @param workflowId 流程id
|
requestTitle = "contracts.pdf";
|
||||||
* @param requestId 请求id
|
}
|
||||||
* @return 本方签署结果
|
if (Util.null2String(ufContractInfoDTO.getContractNo()).split(",").length >= 2) {
|
||||||
*/
|
// 多文件
|
||||||
@Path("/signedContract/own/{requestId}/{workflowId}")
|
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM).type("application/zip")
|
||||||
@GET
|
.header("Content-Disposition", "attachment;filename=" + requestTitle + ".zip").build();
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
} else {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
// 单文件
|
||||||
public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM).type("application/pdf")
|
||||||
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId) {
|
.header("Content-Disposition", "attachment;filename=" + requestTitle).build();
|
||||||
// TODO 更换labelIndex
|
}
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
} catch (Exception e) {
|
||||||
try {
|
toolUtil.writeErrorLog("文件流转换失败," + e);
|
||||||
faDDService.signedContractOwn(requestId, user);
|
return Response.ok(ApiResult.error("出现错误,错误原因: " + e), MediaType.TEXT_PLAIN).build();
|
||||||
}catch (Exception e){
|
}
|
||||||
return ApiResult.error(Util.getHtmlLabelName(-87658,user.getLanguage(),"合同签署失败!"));
|
}
|
||||||
}
|
|
||||||
return ApiResult.success(Util.getHtmlLabelName(-87657,user.getLanguage(),"本方签署成功!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 催一催
|
|
||||||
*
|
|
||||||
* @param requestId 请求id
|
|
||||||
* @return 催一催
|
|
||||||
*/
|
|
||||||
@Path("/signedContract/{requestId}")
|
|
||||||
@GET
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
|
||||||
public String signedContract(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
|
||||||
@PathParam("requestId") String requestId) {
|
|
||||||
return ApiResult.success("没有催一催接口还点!淦!等法大大调整,额。。。具体啥时候好我也不知道,反正不关我的事!");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合同下载
|
|
||||||
*
|
|
||||||
* @param requestId 请求id
|
|
||||||
* @return 合同问价压缩包
|
|
||||||
*/
|
|
||||||
@Path("/contract/download/{requestId}")
|
|
||||||
@GET
|
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
||||||
public Response contractDownload(@PathParam("requestId") String requestId) {
|
|
||||||
toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId);
|
|
||||||
try {
|
|
||||||
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId);
|
|
||||||
StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO);
|
|
||||||
String requestTitle = Util.null2String(Util.getRequestTitleById(String.valueOf(requestId)));
|
|
||||||
if(StringUtils.isNullOrEmpty(requestTitle)){
|
|
||||||
requestTitle = "contracts";
|
|
||||||
}
|
|
||||||
if(Util.null2String(ufContractInfoDTO.getContractNo()).split(",").length >= 2){
|
|
||||||
// 多文件
|
|
||||||
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM)
|
|
||||||
.type("application/zip")
|
|
||||||
.header("Content-Disposition", "attachment;filename=" + requestTitle + ".zip").build();
|
|
||||||
}else{
|
|
||||||
// 单文件
|
|
||||||
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM)
|
|
||||||
.type("application/pdf")
|
|
||||||
.header("Content-Disposition", "attachment;filename=" + requestTitle + ".pdf").build();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
toolUtil.writeErrorLog("文件流转换失败," + e);
|
|
||||||
return Response.ok(ApiResult.error("出现错误,错误原因: " + e), MediaType.TEXT_PLAIN).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
package com.api.aiyh_pcn.fadada.web;
|
package com.api.aiyh_pcn.fadada.web;
|
||||||
|
|
||||||
import aiyh.utils.ApiResult;
|
import java.io.UnsupportedEncodingException;
|
||||||
import aiyh.utils.Util;
|
import java.net.URLDecoder;
|
||||||
import aiyh.utils.mapUtil.ParaMap;
|
import java.nio.charset.StandardCharsets;
|
||||||
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
import java.util.Base64;
|
||||||
import aiyh.utils.zwl.common.ToolUtil;
|
import java.util.HashMap;
|
||||||
import com.alibaba.fastjson.JSON;
|
import java.util.Map;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
|
|
||||||
import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl;
|
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
|
||||||
import org.h2.util.StringUtils;
|
|
||||||
import weaver.conn.RecordSet;
|
|
||||||
import weaver.hrm.HrmUserVarify;
|
|
||||||
import weaver.hrm.User;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -22,236 +14,252 @@ import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.StreamingOutput;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
import org.h2.util.StringUtils;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Base64;
|
import com.alibaba.fastjson.JSON;
|
||||||
import java.util.HashMap;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import java.util.Map;
|
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
|
||||||
|
import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.mapUtil.ParaMap;
|
||||||
|
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
||||||
|
import aiyh.utils.zwl.common.ToolUtil;
|
||||||
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.hrm.HrmUserVarify;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
* @create 2021/9/28 0028 16:05
|
* @create 2021/9/28 0028 16:05 法大大相关接口
|
||||||
* 法大大相关接口
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@Path("/fadada")
|
@Path("/fadada")
|
||||||
public class FaDDController {
|
public class FaDDController {
|
||||||
private final FaDDServiceImpl faDDService = new FaDDServiceImpl();
|
private final FaDDServiceImpl faDDService = new FaDDServiceImpl();
|
||||||
private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();
|
private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配置信息
|
* 查询配置信息
|
||||||
*
|
*
|
||||||
* @param workflowId 流程id
|
* @param workflowId
|
||||||
* @return 配置信息
|
* 流程id
|
||||||
*/
|
* @return 配置信息
|
||||||
@GET
|
*/
|
||||||
@Path("/getConfig/{workflowId}")
|
@GET
|
||||||
public String getConfig(@PathParam("workflowId") String workflowId) {
|
@Path("/getConfig/{workflowId}")
|
||||||
try {
|
public String getConfig(@PathParam("workflowId") String workflowId) {
|
||||||
Map<String, Object> configParam = faDDService.getConfigParam(workflowId);
|
try {
|
||||||
return ApiResult.success(configParam);
|
Map<String, Object> configParam = faDDService.getConfigParam(workflowId);
|
||||||
} catch (Exception e) {
|
return ApiResult.success(configParam);
|
||||||
return ApiResult.error(e.toString());
|
} catch (Exception e) {
|
||||||
}
|
return ApiResult.error(e.toString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证企业签署状态
|
* 验证企业签署状态
|
||||||
*
|
*
|
||||||
* @param params 查验参数
|
* @param params
|
||||||
* @return 企业验证的状态
|
* 查验参数
|
||||||
*/
|
* @return 企业验证的状态
|
||||||
@Path("/signature")
|
*/
|
||||||
@POST
|
@Path("/signature")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public String checkCertification(@RequestBody Map<String, Object> params) {
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
try {
|
public String checkCertification(@RequestBody Map<String, Object> params) {
|
||||||
Map<String, Object> certificationResult = faDDService.checkCertification(params);
|
try {
|
||||||
return ApiResult.success(certificationResult);
|
Map<String, Object> certificationResult = faDDService.checkCertification(params);
|
||||||
} catch (Exception e) {
|
return ApiResult.success(certificationResult);
|
||||||
return ApiResult.error(e.toString());
|
} catch (Exception e) {
|
||||||
}
|
return ApiResult.error(e.toString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 催一催
|
* 催一催
|
||||||
*
|
*
|
||||||
* @param workflowId 流程id
|
* @param workflowId
|
||||||
* @param requestId 请求id
|
* 流程id
|
||||||
* @return 催一催
|
* @param requestId
|
||||||
*/
|
* 请求id
|
||||||
@Path("/signedContract/{languageGroupId}/{requestId}/{workflowId}")
|
* @return 催一催
|
||||||
@GET
|
*/
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Path("/signedContract/{languageGroupId}/{requestId}/{workflowId}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@GET
|
||||||
public String signedContract(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId,
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@PathParam("languageGroupId") int languageGroupId) {
|
public String signedContract(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId,
|
||||||
try {
|
@PathParam("languageGroupId") int languageGroupId) {
|
||||||
faDDService.queryContractStatus(workflowId, requestId,0);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage());
|
try {
|
||||||
String info = language.get("rushInfo");
|
faDDService.queryContractStatus(workflowId, requestId, 0);
|
||||||
return ApiResult.success(info);
|
Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage());
|
||||||
} catch (Exception e) {
|
String info = language.get("rushInfo");
|
||||||
toolUtil.writeErrorLog("错误:" + e);
|
return ApiResult.success(info);
|
||||||
return ApiResult.error(e.toString());
|
} catch (Exception e) {
|
||||||
}
|
toolUtil.writeErrorLog("错误:" + e);
|
||||||
}
|
return ApiResult.error(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本方签署
|
* 本方签署
|
||||||
*
|
*
|
||||||
* @param workflowId 流程id
|
* @param workflowId
|
||||||
* @param requestId 请求id
|
* 流程id
|
||||||
* @return 本方签署结果
|
* @param requestId
|
||||||
*/
|
* 请求id
|
||||||
@Path("/signedContract/own/{languageGroupId}/{requestId}/{workflowId}")
|
* @return 本方签署结果
|
||||||
@GET
|
*/
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Path("/signedContract/own/{languageGroupId}/{requestId}/{workflowId}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@GET
|
||||||
public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId,
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@PathParam("languageGroupId") int languageGroupId) {
|
public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId,
|
||||||
try {
|
@PathParam("languageGroupId") int languageGroupId) {
|
||||||
faDDService.signedContractOwn(workflowId, requestId);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
String mainTable = faDDServiceMapping.getMainTable(workflowId);
|
try {
|
||||||
// TODO 更新本方签署
|
faDDService.signedContractOwn(workflowId, requestId);
|
||||||
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(mainTable, ParaMap.create()
|
String mainTable = faDDServiceMapping.getMainTable(workflowId);
|
||||||
.put("signed_oneself", 1), Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
|
// TODO 更新本方签署
|
||||||
RecordSet rs = new RecordSet();
|
PrepSqlResultImpl sqlResult =
|
||||||
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
|
Util.createSqlBuilder().updateSql(mainTable, ParaMap.create().put("signed_oneself", 1),
|
||||||
Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage());
|
Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
|
||||||
String info = language.get("contractSignedInfo");
|
RecordSet rs = new RecordSet();
|
||||||
return ApiResult.success(info);
|
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
|
||||||
} catch (Exception e) {
|
Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage());
|
||||||
toolUtil.writeErrorLog("错误:" + e.toString());
|
String info = language.get("contractSignedInfo");
|
||||||
return ApiResult.error(e.toString());
|
return ApiResult.success(info);
|
||||||
}
|
} catch (Exception e) {
|
||||||
}
|
toolUtil.writeErrorLog("错误:" + e.toString());
|
||||||
|
return ApiResult.error(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同下载
|
* 合同下载
|
||||||
*
|
*
|
||||||
* @param requestId 请求id
|
* @param requestId
|
||||||
* @return 合同问价压缩包
|
* 请求id
|
||||||
*/
|
* @return 合同问价压缩包
|
||||||
@Path("/contract/download/{workflowId}/{requestId}")
|
*/
|
||||||
@GET
|
@Path("/contract/download/{workflowId}/{requestId}")
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@GET
|
||||||
public Response contractDownload(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) {
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId);
|
public Response contractDownload(@PathParam("requestId") String requestId,
|
||||||
try {
|
@PathParam("workflowId") String workflowId) {
|
||||||
StreamingOutput contractZipStream = faDDService.contractDownload(requestId, workflowId);
|
toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId);
|
||||||
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM)
|
try {
|
||||||
.type("application/zip")
|
StreamingOutput contractZipStream = faDDService.contractDownload(requestId, workflowId);
|
||||||
.header("Content-Disposition", "attachment;filename=contracts.zip").build();
|
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM).type("application/zip")
|
||||||
} catch (Exception e) {
|
.header("Content-Disposition", "attachment;filename=contracts.zip").build();
|
||||||
toolUtil.writeErrorLog("转换失败," + e.toString());
|
} catch (Exception e) {
|
||||||
return Response.ok(ApiResult.error("出现错误,错误原因: " + e),MediaType.APPLICATION_JSON).build();
|
toolUtil.writeErrorLog("转换失败," + e.toString());
|
||||||
}
|
return Response.ok(ApiResult.error("出现错误,错误原因: " + e), MediaType.APPLICATION_JSON).build();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取流程全版本
|
* 获取流程全版本
|
||||||
*
|
*
|
||||||
* @param workflowId 流程id
|
* @param workflowId
|
||||||
* @return 流程全版本id
|
* 流程id
|
||||||
*/
|
* @return 流程全版本id
|
||||||
@Path("/getAllVersion/{workflowId}/{markOnly}")
|
*/
|
||||||
@GET
|
@Path("/getAllVersion/{workflowId}/{markOnly}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@GET
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) {
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
try {
|
public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) {
|
||||||
Map<String, Object> allVersion = faDDService.getAllVersion(workflowId, markOnly);
|
try {
|
||||||
return ApiResult.success(allVersion);
|
Map<String, Object> allVersion = faDDService.getAllVersion(workflowId, markOnly);
|
||||||
} catch (Exception e) {
|
return ApiResult.success(allVersion);
|
||||||
toolUtil.writeErrorLog("错误:" + e.toString());
|
} catch (Exception e) {
|
||||||
return ApiResult.error(e.toString());
|
toolUtil.writeErrorLog("错误:" + e.toString());
|
||||||
}
|
return ApiResult.error(e.toString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查验是否全部签订完毕
|
||||||
|
*
|
||||||
|
* @param requestId
|
||||||
|
* 请求id
|
||||||
|
* @return 查验结果
|
||||||
|
*/
|
||||||
|
@Path("/isAllSigned/{workflowId}/{requestId}")
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String isAllSinged(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) {
|
||||||
|
try {
|
||||||
|
faDDService.queryContractStatus(workflowId, requestId, 1);
|
||||||
|
boolean isAllSinged = faDDService.isAllSinged(requestId, workflowId);
|
||||||
|
boolean isSingedOneself = faDDService.isSingedOneself(requestId, workflowId);
|
||||||
|
Map<String, Object> result =
|
||||||
|
ParaMap.create().put("isAllSinged", isAllSinged).put("isSingedOneself", isSingedOneself);
|
||||||
|
return ApiResult.success(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
toolUtil.writeErrorLog("错误:" + e);
|
||||||
|
return ApiResult.error(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
@Path("/getLanguage/{languageGroupId}")
|
||||||
* 查验是否全部签订完毕
|
@GET
|
||||||
*
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
* @param requestId 请求id
|
public String getLanguage(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
* @return 查验结果
|
@PathParam("languageGroupId") int languageGroupId) {
|
||||||
*/
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
@Path("/isAllSigned/{workflowId}/{requestId}")
|
Map<String, String> map = Util.queryLanguage(languageGroupId, user.getLanguage());
|
||||||
@GET
|
return ApiResult.success(map);
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
}
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
public String isAllSinged(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) {
|
|
||||||
try {
|
|
||||||
faDDService.queryContractStatus(workflowId,requestId,1);
|
|
||||||
boolean isAllSinged = faDDService.isAllSinged(requestId, workflowId);
|
|
||||||
boolean isSingedOneself = faDDService.isSingedOneself(requestId, workflowId);
|
|
||||||
Map<String, Object> result = ParaMap.create().put("isAllSinged", isAllSinged)
|
|
||||||
.put("isSingedOneself", isSingedOneself);
|
|
||||||
return ApiResult.success(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
toolUtil.writeErrorLog("错误:" + e);
|
|
||||||
return ApiResult.error(e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Path("/callback/signed")
|
||||||
|
@POST
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String callBackSigned(@RequestBody Map<String, Object> params) {
|
||||||
|
toolUtil.writeErrorLog("回调方法:" + JSONObject.toJSONString(params));
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
String bizContent = String.valueOf(params.get("bizContent"));
|
||||||
|
if (StringUtils.isNullOrEmpty(bizContent)) {
|
||||||
|
toolUtil.writeErrorLog("参数没获取到!");
|
||||||
|
result.put("code", "200");
|
||||||
|
result.put("msg", "操作失败!");
|
||||||
|
return JSONObject.toJSONString(result);
|
||||||
|
}
|
||||||
|
byte[] decode = Base64.getDecoder().decode(bizContent.getBytes(StandardCharsets.UTF_8));
|
||||||
|
String decodeStr = null;
|
||||||
|
try {
|
||||||
|
decodeStr = new String(decode, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String jsonStr = null;
|
||||||
|
try {
|
||||||
|
jsonStr = URLDecoder.decode(decodeStr, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||||
|
String resultCode = String.valueOf(jsonObject.getString("resultCode"));
|
||||||
|
String docNo = String.valueOf(jsonObject.getString("docNo"));
|
||||||
|
if (!"1".equals(resultCode)) {
|
||||||
|
toolUtil.writeErrorLog("重复签署合同!" + docNo);
|
||||||
|
}
|
||||||
|
// Util.createSqlBuilder().updateSql()
|
||||||
|
|
||||||
@Path("/getLanguage/{languageGroupId}")
|
this.toolUtil.writeErrorLog(jsonObject.toJSONString());
|
||||||
@GET
|
result.put("code", "200");
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
result.put("msg", "操作成功!");
|
||||||
public String getLanguage(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
return JSONObject.toJSONString(result);
|
||||||
@PathParam("languageGroupId") int languageGroupId) {
|
}
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
|
||||||
Map<String, String> map = Util.queryLanguage(languageGroupId, user.getLanguage());
|
|
||||||
return ApiResult.success(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Path("/callback/signed")
|
|
||||||
@POST
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
public String callBackSigned(@RequestBody Map<String, Object> params){
|
|
||||||
toolUtil.writeErrorLog("回调方法:" + JSONObject.toJSONString(params));
|
|
||||||
Map<String,Object> result = new HashMap<>();
|
|
||||||
String bizContent = String.valueOf(params.get("bizContent"));
|
|
||||||
if(StringUtils.isNullOrEmpty(bizContent)){
|
|
||||||
toolUtil.writeErrorLog("参数没获取到!");
|
|
||||||
result.put("code","200");
|
|
||||||
result.put("msg","操作失败!");
|
|
||||||
return JSONObject.toJSONString(result);
|
|
||||||
}
|
|
||||||
byte[] decode = Base64.getDecoder().decode(bizContent.getBytes(StandardCharsets.UTF_8));
|
|
||||||
String decodeStr = null;
|
|
||||||
try {
|
|
||||||
decodeStr = new String(decode,"UTF-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
String jsonStr = null;
|
|
||||||
try {
|
|
||||||
jsonStr = URLDecoder.decode(decodeStr, "UTF-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
|
||||||
String resultCode = String.valueOf(jsonObject.getString("resultCode"));
|
|
||||||
String docNo = String.valueOf(jsonObject.getString("docNo"));
|
|
||||||
if(!"1".equals(resultCode)){
|
|
||||||
toolUtil.writeErrorLog("重复签署合同!" + docNo);
|
|
||||||
}
|
|
||||||
// Util.createSqlBuilder().updateSql()
|
|
||||||
|
|
||||||
this.toolUtil.writeErrorLog(jsonObject.toJSONString());
|
|
||||||
result.put("code","200");
|
|
||||||
result.put("msg","操作成功!");
|
|
||||||
return JSONObject.toJSONString(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,44 @@
|
||||||
package com.api.aiyh_pcn.patentWall.dao;
|
package com.api.aiyh_pcn.patentWall.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.zwl.common.ToolUtil;
|
import aiyh.utils.zwl.common.ToolUtil;
|
||||||
import com.api.aiyh_pcn.patentWall.dto.FilterWhere;
|
|
||||||
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
|
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
* @create 2021/11/25 0025 15:28
|
* @create 2021/11/25 0025 15:28
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class PatentWallMapping {
|
public class PatentWallMapping {
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
|
|
||||||
public List<Map<String, Object>> getAllList(String tableName){
|
public List<Map<String, Object>> getAllList(String tableName) {
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
String query = "select * from " + tableName;
|
String query = "select * from " + tableName;
|
||||||
rs.executeQuery(query);
|
rs.executeQuery(query);
|
||||||
return Util.recordSet2MapList(rs);
|
return Util.recordSet2MapList(rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String,Object>> getListByFilterWhere(StringBuilder whereBuilder,List<String> args, String tableName) {
|
public List<Map<String, Object>> getListByFilterWhere(StringBuilder whereBuilder, List<String> args,
|
||||||
RecordSet rs = new RecordSet();
|
String tableName) {
|
||||||
String query = "select * from " + tableName + whereBuilder.toString().replace(" where add "," where ");
|
RecordSet rs = new RecordSet();
|
||||||
rs.executeQuery(query,args);
|
String query = "select * from " + tableName + whereBuilder.toString().replace(" where add ", " where ");
|
||||||
toolUtil.writeDebuggerLog(String.format("执行SQL: {%s} ---> 参数: {%s}",query,args));
|
rs.executeQuery(query, args);
|
||||||
return Util.recordSet2MapList(rs);
|
toolUtil.writeDebuggerLog(String.format("执行SQL: {%s} ---> 参数: {%s}", query, args));
|
||||||
}
|
return Util.recordSet2MapList(rs);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Map<String,Object>> getSelectOptions(String dataResource, String dbFieldName) {
|
public List<Map<String, Object>> getSelectOptions(String dataResource, String dbFieldName) {
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
String query = "select wbf.id,wbf.fieldname,wbf.fieldlabel,wb.tablename, " +
|
String query = "select wbf.id,wbf.fieldname,wbf.fieldlabel,wb.tablename, " + "ws.selectname,ws.selectvalue "
|
||||||
"ws.selectname,ws.selectvalue " +
|
+ "from workflow_billfield wbf " + "left join workflow_bill wb on wbf.billid = wb.id "
|
||||||
"from workflow_billfield wbf " +
|
+ "left join workflow_selectitem ws on ws.fieldid = wbf.id " + "where wb.tablename = ? and fieldname = ? ";
|
||||||
"left join workflow_bill wb on wbf.billid = wb.id " +
|
rs.executeQuery(query, dataResource, dbFieldName);
|
||||||
"left join workflow_selectitem ws on ws.fieldid = wbf.id " +
|
toolUtil
|
||||||
"where wb.tablename = ? and fieldname = ? ";
|
.writeDebuggerLog(String.format("执行SQL: {%s} ---> 参数: {%s}", query, dataResource + " -- " + dbFieldName));
|
||||||
rs.executeQuery(query,dataResource,dbFieldName);
|
return Util.recordSet2MapList(rs);
|
||||||
toolUtil.writeDebuggerLog(String.format("执行SQL: {%s} ---> 参数: {%s}",query,dataResource + " -- " + dbFieldName));
|
}
|
||||||
return Util.recordSet2MapList(rs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,341 +27,345 @@ import java.util.regex.Pattern;
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
* @create 2021/11/25 0025 15:23
|
* @create 2021/11/25 0025 15:23
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class PatentWallService {
|
public class PatentWallService {
|
||||||
private final PatentWallMapping patentWallMapping = new PatentWallMapping();
|
private final PatentWallMapping patentWallMapping = new PatentWallMapping();
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
private Map<String, Object> patentWallConf;
|
private Map<String, Object> patentWallConf;
|
||||||
private Map<String, Object> patentWallSearchConf;
|
private Map<String, Object> patentWallSearchConf;
|
||||||
private final RecordSet rs = new RecordSet();
|
private final RecordSet rs = new RecordSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询搜索框配置信息
|
||||||
|
*
|
||||||
|
* @param prefix 前缀
|
||||||
|
* @return 配置信息
|
||||||
|
*/
|
||||||
|
public List<SearchInputVO> getSearchList(String prefix, int languageId) {
|
||||||
|
Map<String, Object> patentWallSearchConf = getPatentWallSearchConf(prefix + ".search");
|
||||||
|
String dataResource = String.valueOf(patentWallSearchConf.get("dataResource"));
|
||||||
|
List<Map<String, Object>> inputs =
|
||||||
|
(List<Map<String, Object>>) patentWallSearchConf.get("inputs");
|
||||||
|
List<SearchInputVO> searchInputList = new ArrayList<>();
|
||||||
|
for (Map<String, Object> input : inputs) {
|
||||||
|
SearchInputVO searchInputVO = new SearchInputVO();
|
||||||
|
int type = Integer.parseInt(Util.null2DefaultStr(input.get("type"), "0"));
|
||||||
|
String dbFieldName = Util.null2String(input.get("dbFieldName"));
|
||||||
|
String value = Util.null2String(input.get("value"));
|
||||||
|
String labelName = Util.null2String(input.get("labelName"));
|
||||||
|
Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"), "0"));
|
||||||
|
Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"), "0"));
|
||||||
|
Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"), "false"));
|
||||||
|
searchInputVO.setType(type);
|
||||||
|
searchInputVO.setLabelName(labelName);
|
||||||
|
searchInputVO.setSearchType(searchType);
|
||||||
|
searchInputVO.setDbFieldName(dbFieldName);
|
||||||
|
searchInputVO.setLabelIndex(labelIndex);
|
||||||
|
searchInputVO.setLabelIndex(labelIndex);
|
||||||
|
searchInputVO.setMultiple(multiple);
|
||||||
|
searchInputVO.setValue(value);
|
||||||
|
searchInputList.add(searchInputVO);
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
// 下拉框 查询options
|
||||||
|
List<SelectOptionsVo> optionsVos =
|
||||||
|
getSelectOptions(dataResource, dbFieldName, languageId);
|
||||||
|
searchInputVO.setSelectOptions(optionsVos);
|
||||||
|
case 2:
|
||||||
|
// 单行文本
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 日期
|
||||||
|
case 4:
|
||||||
|
// 单人力资源
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
// 多人力资源
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
// 流程路径
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
// 多流程路径
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return searchInputList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
private List<SelectOptionsVo> getSelectOptions(
|
||||||
* 查询搜索框配置信息
|
String dataResource, String dbFieldName, int languageId) {
|
||||||
*
|
List<Map<String, Object>> selectOptions =
|
||||||
* @param prefix 前缀
|
patentWallMapping.getSelectOptions(dataResource, dbFieldName);
|
||||||
* @return 配置信息
|
List<SelectOptionsVo> optionsVos = new ArrayList<>();
|
||||||
*/
|
SelectOptionsVo optionsDefault = new SelectOptionsVo();
|
||||||
public List<SearchInputVO> getSearchList(String prefix,int languageId) {
|
optionsDefault.setSelected(true);
|
||||||
Map<String, Object> patentWallSearchConf = getPatentWallSearchConf(prefix + ".search");
|
optionsDefault.setKey("");
|
||||||
String dataResource = String.valueOf(patentWallSearchConf.get("dataResource"));
|
optionsDefault.setShowname("");
|
||||||
List<Map<String, Object>> inputs = (List<Map<String, Object>>) patentWallSearchConf.get("inputs");
|
optionsVos.add(optionsDefault);
|
||||||
List<SearchInputVO> searchInputList = new ArrayList<>();
|
for (Map<String, Object> selectOption : selectOptions) {
|
||||||
for (Map<String, Object> input : inputs) {
|
SelectOptionsVo optionsVo = new SelectOptionsVo();
|
||||||
SearchInputVO searchInputVO = new SearchInputVO();
|
optionsVo.setSelected(false);
|
||||||
int type = Integer.parseInt(Util.null2DefaultStr(input.get("type"), "0"));
|
optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"), ""));
|
||||||
String dbFieldName = Util.null2String(input.get("dbFieldName"));
|
String selectName = Util.null2DefaultStr(selectOption.get("selectname"), "");
|
||||||
String value = Util.null2String(input.get("value"));
|
String showName = selectName;
|
||||||
String labelName = Util.null2String(input.get("labelName"));
|
if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
|
||||||
Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"),"0"));
|
String pattern = "(`~`" + languageId + " )(?<label>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
|
||||||
Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"),"0"));
|
Pattern compile = Pattern.compile(pattern);
|
||||||
Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"),"false"));
|
Matcher matcher = compile.matcher(selectName);
|
||||||
searchInputVO.setType(type);
|
if (matcher.find()) {
|
||||||
searchInputVO.setLabelName(labelName);
|
showName = matcher.group("label");
|
||||||
searchInputVO.setSearchType(searchType);
|
}
|
||||||
searchInputVO.setDbFieldName(dbFieldName);
|
}
|
||||||
searchInputVO.setLabelIndex(labelIndex);
|
optionsVo.setShowname(showName);
|
||||||
searchInputVO.setLabelIndex(labelIndex);
|
optionsVos.add(optionsVo);
|
||||||
searchInputVO.setMultiple(multiple);
|
}
|
||||||
searchInputVO.setValue(value);
|
return optionsVos;
|
||||||
searchInputList.add(searchInputVO);
|
}
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
// 下拉框 查询options
|
|
||||||
List<SelectOptionsVo> optionsVos = getSelectOptions(dataResource, dbFieldName,languageId);
|
|
||||||
searchInputVO.setSelectOptions(optionsVos);
|
|
||||||
case 2:
|
|
||||||
// 单行文本
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// 日期
|
|
||||||
case 4:
|
|
||||||
// 单人力资源
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
// 多人力资源
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
// 流程路径
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
// 多流程路径
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return searchInputList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<SelectOptionsVo> getSelectOptions(String dataResource, String dbFieldName, int languageId) {
|
/**
|
||||||
List<Map<String, Object>> selectOptions = patentWallMapping.getSelectOptions(dataResource, dbFieldName);
|
* 查询结果信息
|
||||||
List<SelectOptionsVo> optionsVos = new ArrayList<>();
|
*
|
||||||
SelectOptionsVo optionsDefault = new SelectOptionsVo();
|
* @param filterWheres 结果过滤条件
|
||||||
optionsDefault.setSelected(true);
|
* @param prefix 前缀
|
||||||
optionsDefault.setKey("");
|
* @return 查询结果
|
||||||
optionsDefault.setShowname("");
|
*/
|
||||||
optionsVos.add(optionsDefault);
|
public List<PatentVO> getList(List<FilterWhere> filterWheres, String prefix) {
|
||||||
for (Map<String, Object> selectOption : selectOptions) {
|
Map<String, Object> patentWallConf = getPatentWallConf(prefix + ".voMapping");
|
||||||
SelectOptionsVo optionsVo = new SelectOptionsVo();
|
List<Map<String, Object>> dataList;
|
||||||
optionsVo.setSelected(false);
|
toolUtil.writeDebuggerLog(String.format("查询数据,接收到的过滤信息为: %s", JSON.toJSONString(filterWheres)));
|
||||||
optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"),""));
|
if (filterWheres == null || filterWheres.isEmpty()) {
|
||||||
String selectName = Util.null2DefaultStr(selectOption.get("selectname"), "");
|
// 查询全部
|
||||||
String showName = selectName;
|
dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource")));
|
||||||
if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
|
} else {
|
||||||
String pattern = "(`~`" + languageId + " )(?<label>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
|
// 筛选查询
|
||||||
Pattern compile = Pattern.compile(pattern);
|
dataList =
|
||||||
Matcher matcher = compile.matcher(selectName);
|
handleFilterWhere(filterWheres, Util.null2String(patentWallConf.get("dataResource")));
|
||||||
if (matcher.find()) {
|
}
|
||||||
showName = matcher.group("label");
|
List<PatentVO> list = new ArrayList<>();
|
||||||
}
|
List<String> args = new ArrayList<>();
|
||||||
}
|
RecordSet rs = new RecordSet();
|
||||||
optionsVo.setShowname(showName);
|
for (Map<String, Object> data : dataList) {
|
||||||
optionsVos.add(optionsVo);
|
Map<String, Object> config = new HashMap<>(patentWallConf);
|
||||||
}
|
for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) {
|
||||||
return optionsVos;
|
String patentVoField = entry.getKey();
|
||||||
}
|
// linkList
|
||||||
|
String parsing = null;
|
||||||
|
// 值解析
|
||||||
|
if ("linkList".equals(patentVoField)) {
|
||||||
|
List<LinkUrlVO> linkUrlVOS = new ArrayList<>();
|
||||||
|
List<Map<String, Object>> linkUrlList = (List<Map<String, Object>>) entry.getValue();
|
||||||
|
for (Map<String, Object> linkUrlMap : linkUrlList) {
|
||||||
|
LinkUrlVO linkUrlVO = new LinkUrlVO();
|
||||||
|
BeanInfo beanInfo = null;
|
||||||
|
try {
|
||||||
|
beanInfo = Introspector.getBeanInfo(LinkUrlVO.class, Object.class);
|
||||||
|
} catch (IntrospectionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
toolUtil.writeDebuggerLog("获取beanInfo错误");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||||
|
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
|
||||||
|
String keyName = propertyDescriptor.getName();
|
||||||
|
String parsingValue = String.valueOf(linkUrlMap.get(keyName));
|
||||||
|
parsingValue = handleParsingConf(parsingValue, data, args);
|
||||||
|
// 清除参数信息
|
||||||
|
args.clear();
|
||||||
|
if (propertyDescriptor.getPropertyType().equals(Integer.class)) {
|
||||||
|
try {
|
||||||
|
propertyDescriptor
|
||||||
|
.getWriteMethod()
|
||||||
|
.invoke(linkUrlVO, Integer.valueOf(parsingValue));
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
toolUtil.writeErrorLog("设置值失败,调用beanInfo的set方法错误");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
propertyDescriptor.getWriteMethod().invoke(linkUrlVO, parsingValue);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
toolUtil.writeErrorLog("设置值失败,调用beanInfo的set方法错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
linkUrlVOS.add(linkUrlVO);
|
||||||
|
}
|
||||||
|
config.replace(patentVoField, linkUrlVOS);
|
||||||
|
} else {
|
||||||
|
parsing = String.valueOf(entry.getValue());
|
||||||
|
parsing = handleParsingConf(parsing, data, args);
|
||||||
|
// 修改数据
|
||||||
|
config.replace(patentVoField, parsing);
|
||||||
|
// 清除参数信息
|
||||||
|
args.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PatentVO patentVO = null;
|
||||||
|
try {
|
||||||
|
patentVO = Util.mapToObject(config, PatentVO.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
toolUtil.writeErrorLog("map转为PatentVO失败!");
|
||||||
|
}
|
||||||
|
list.add(patentVO);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public String handleParsingConf(String parsing, Map<String, Object> data, List<String> args) {
|
||||||
* 查询结果信息
|
// 值解析
|
||||||
*
|
// 解析 ${}类型的参数,直接替换
|
||||||
* @param filterWheres 结果过滤条件
|
String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}";
|
||||||
* @param prefix 前缀
|
Pattern compile = Pattern.compile(pattern);
|
||||||
* @return 查询结果
|
Matcher matcher = compile.matcher(parsing);
|
||||||
*/
|
while (matcher.find()) {
|
||||||
public List<PatentVO> getList(List<FilterWhere> filterWheres, String prefix) {
|
parsing = parsing.replaceFirst(pattern, Util.null2String(data.get(matcher.group("field"))));
|
||||||
Map<String, Object> patentWallConf = getPatentWallConf(prefix + ".voMapping");
|
}
|
||||||
List<Map<String, Object>> dataList;
|
// 解析#{}类型的参数,替换为?并按照顺序收集args
|
||||||
toolUtil.writeDebuggerLog(String.format("查询数据,接收到的过滤信息为: %s", JSON.toJSONString(filterWheres)));
|
pattern = "#\\{(?<field>(\\s|\\S)+?)}";
|
||||||
if (filterWheres == null || filterWheres.isEmpty()) {
|
compile = Pattern.compile(pattern);
|
||||||
// 查询全部
|
matcher = compile.matcher(parsing);
|
||||||
dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource")));
|
while (matcher.find()) {
|
||||||
} else {
|
parsing = parsing.replaceFirst(pattern, "?");
|
||||||
// 筛选查询
|
args.add(Util.null2String(data.get(matcher.group("field"))));
|
||||||
dataList = handleFilterWhere(filterWheres
|
}
|
||||||
, Util.null2String(patentWallConf.get("dataResource")));
|
// 解析#sql{}类型的参数,并执行SQL,获取到SQL的值
|
||||||
}
|
pattern = "#sql\\{(?<sqlStr>([\\s\\S])+?)}";
|
||||||
List<PatentVO> list = new ArrayList<>();
|
compile = Pattern.compile(pattern);
|
||||||
List<String> args = new ArrayList<>();
|
matcher = compile.matcher(parsing);
|
||||||
RecordSet rs = new RecordSet();
|
while (matcher.find()) {
|
||||||
for (Map<String, Object> data : dataList) {
|
String sqlStr = matcher.group("sqlStr");
|
||||||
Map<String, Object> config = new HashMap<>(patentWallConf);
|
toolUtil.writeDebuggerLog(String.format("执行SQL: {%s} ---> 参数: {%s}", sqlStr, args));
|
||||||
for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) {
|
rs.executeQuery(sqlStr, args);
|
||||||
String patentVoField = entry.getKey();
|
rs.next();
|
||||||
// linkList
|
parsing = parsing.replaceFirst(pattern, Util.null2String(rs.getString(1)));
|
||||||
String parsing = null;
|
;
|
||||||
// 值解析
|
}
|
||||||
if("linkList".equals(patentVoField)){
|
return parsing;
|
||||||
List<LinkUrlVO> linkUrlVOS = new ArrayList<>();
|
}
|
||||||
List<Map<String,Object>> linkUrlList = (List<Map<String, Object>>) entry.getValue();
|
|
||||||
for (Map<String, Object> linkUrlMap : linkUrlList) {
|
|
||||||
LinkUrlVO linkUrlVO = new LinkUrlVO();
|
|
||||||
BeanInfo beanInfo = null;
|
|
||||||
try {
|
|
||||||
beanInfo = Introspector.getBeanInfo(LinkUrlVO.class, Object.class);
|
|
||||||
} catch (IntrospectionException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
toolUtil.writeDebuggerLog("获取beanInfo错误");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
|
||||||
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
|
|
||||||
String keyName = propertyDescriptor.getName();
|
|
||||||
String parsingValue = String.valueOf(linkUrlMap.get(keyName));
|
|
||||||
parsingValue = handleParsingConf(parsingValue,data,args);
|
|
||||||
// 清除参数信息
|
|
||||||
args.clear();
|
|
||||||
if(propertyDescriptor.getPropertyType().equals(Integer.class)){
|
|
||||||
try {
|
|
||||||
propertyDescriptor.getWriteMethod().invoke(linkUrlVO,Integer.valueOf(parsingValue));
|
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
||||||
toolUtil.writeErrorLog("设置值失败,调用beanInfo的set方法错误");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
try {
|
|
||||||
propertyDescriptor.getWriteMethod().invoke(linkUrlVO,parsingValue);
|
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
toolUtil.writeErrorLog("设置值失败,调用beanInfo的set方法错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
linkUrlVOS.add(linkUrlVO);
|
|
||||||
}
|
|
||||||
config.replace(patentVoField, linkUrlVOS);
|
|
||||||
}else{
|
|
||||||
parsing = String.valueOf(entry.getValue());
|
|
||||||
parsing = handleParsingConf(parsing,data,args);
|
|
||||||
// 修改数据
|
|
||||||
config.replace(patentVoField, parsing);
|
|
||||||
// 清除参数信息
|
|
||||||
args.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
public List<Map<String, Object>> handleFilterWhere(
|
||||||
PatentVO patentVO = null;
|
List<FilterWhere> filterWheres, String tableName) {
|
||||||
try {
|
StringBuilder whereBuilder = new StringBuilder(" where ");
|
||||||
patentVO = Util.mapToObject(config, PatentVO.class);
|
List<String> args = new ArrayList<>();
|
||||||
} catch (Exception e) {
|
for (FilterWhere filterWhere : filterWheres) {
|
||||||
e.printStackTrace();
|
whereBuilder.append(" add ");
|
||||||
toolUtil.writeErrorLog("map转为PatentVO失败!");
|
if (filterWhere.getSearchType() == 1) {
|
||||||
}
|
// 等于
|
||||||
list.add(patentVO);
|
whereBuilder.append(filterWhere.getDbField()).append(" = ? ");
|
||||||
}
|
args.add(filterWhere.getValue());
|
||||||
return list;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (filterWhere.getSearchType() == 2) {
|
||||||
|
// 大于
|
||||||
|
whereBuilder.append(filterWhere.getDbField()).append(" > ?");
|
||||||
|
args.add(filterWhere.getValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filterWhere.getSearchType() == 3) {
|
||||||
|
// 小于
|
||||||
|
whereBuilder.append(filterWhere.getDbField()).append(" < ?");
|
||||||
|
args.add(filterWhere.getValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filterWhere.getSearchType() == 4) {
|
||||||
|
// in
|
||||||
|
whereBuilder
|
||||||
|
.append(filterWhere.getDbField())
|
||||||
|
.append(" in ( ")
|
||||||
|
.append(filterWhere.getValue())
|
||||||
|
.append(") ");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filterWhere.getSearchType() == 5) {
|
||||||
|
// 日期大于
|
||||||
|
whereBuilder
|
||||||
|
.append(" DATE_FORMAT(")
|
||||||
|
.append(filterWhere.getDbField())
|
||||||
|
.append(",'%y-%m-%d') > ")
|
||||||
|
.append("DATE_FORMAT(?,'%y-%m-%d')");
|
||||||
|
args.add(filterWhere.getValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filterWhere.getSearchType() == 6) {
|
||||||
|
// 日期小于
|
||||||
|
whereBuilder
|
||||||
|
.append(" DATE_FORMAT(")
|
||||||
|
.append(filterWhere.getDbField())
|
||||||
|
.append(",'%y-%m-%d') < ")
|
||||||
|
.append("DATE_FORMAT(?,'%y-%m-%d')");
|
||||||
|
args.add(filterWhere.getValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filterWhere.getSearchType() == 7) {
|
||||||
|
// 日期等于
|
||||||
|
whereBuilder
|
||||||
|
.append(" DATE_FORMAT(")
|
||||||
|
.append(filterWhere.getDbField())
|
||||||
|
.append(",'%y-%m-%d') = ")
|
||||||
|
.append("DATE_FORMAT(?,'%y-%m-%d')");
|
||||||
|
args.add(filterWhere.getValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filterWhere.getSearchType() == 8) {
|
||||||
|
// 日期范围
|
||||||
|
whereBuilder
|
||||||
|
.append(" DATE_FORMAT(")
|
||||||
|
.append(filterWhere.getDbField())
|
||||||
|
.append(",'%y-%m-%d') between ")
|
||||||
|
.append("DATE_FORMAT(?,'%y-%m-%d')")
|
||||||
|
.append(" and DATE_FORMAT(?,'%y-%m-%d')");
|
||||||
|
args.add(filterWhere.getValue().split("&")[0]);
|
||||||
|
args.add(filterWhere.getValue().split("&")[1]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return patentWallMapping.getListByFilterWhere(whereBuilder, args, tableName);
|
||||||
|
}
|
||||||
|
|
||||||
public String handleParsingConf(String parsing, Map<String, Object> data,List<String> args){
|
/**
|
||||||
// 值解析
|
* 获取单例的配置文件信息
|
||||||
// 解析 ${}类型的参数,直接替换
|
*
|
||||||
String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}";
|
* @return
|
||||||
Pattern compile = Pattern.compile(pattern);
|
*/
|
||||||
Matcher matcher = compile.matcher(parsing);
|
private Map<String, Object> getPatentWallConf(String prefix) {
|
||||||
while (matcher.find()) {
|
synchronized (this) {
|
||||||
parsing = parsing.replaceFirst(pattern, Util.null2String(data.get(matcher.group("field"))));
|
if (this.patentWallConf == null) {
|
||||||
}
|
this.patentWallConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
|
||||||
// 解析#{}类型的参数,替换为?并按照顺序收集args
|
}
|
||||||
pattern = "#\\{(?<field>(\\s|\\S)+?)}";
|
if (this.patentWallConf == null) {
|
||||||
compile = Pattern.compile(pattern);
|
return new HashMap<>(0);
|
||||||
matcher = compile.matcher(parsing);
|
}
|
||||||
while (matcher.find()) {
|
return new HashMap<>(this.patentWallConf);
|
||||||
parsing = parsing.replaceFirst(pattern, "?");
|
}
|
||||||
args.add(Util.null2String(data.get(matcher.group("field"))));
|
}
|
||||||
}
|
|
||||||
// 解析#sql{}类型的参数,并执行SQL,获取到SQL的值
|
|
||||||
pattern = "#sql\\{(?<sqlStr>([\\s\\S])+?)}";
|
|
||||||
compile = Pattern.compile(pattern);
|
|
||||||
matcher = compile.matcher(parsing);
|
|
||||||
while (matcher.find()) {
|
|
||||||
String sqlStr = matcher.group("sqlStr");
|
|
||||||
toolUtil.writeDebuggerLog(String.format("执行SQL: {%s} ---> 参数: {%s}", sqlStr, args));
|
|
||||||
rs.executeQuery(sqlStr, args);
|
|
||||||
rs.next();
|
|
||||||
parsing = parsing.replaceFirst(pattern, Util.null2String(rs.getString(1)));;
|
|
||||||
}
|
|
||||||
return parsing;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public void clearPatentWallConf() {
|
||||||
|
this.patentWallConf = null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> handleFilterWhere(List<FilterWhere> filterWheres, String tableName) {
|
/**
|
||||||
StringBuilder whereBuilder = new StringBuilder(" where ");
|
* 获取单例的配置文件信息
|
||||||
List<String> args = new ArrayList<>();
|
*
|
||||||
for (FilterWhere filterWhere : filterWheres) {
|
* @return
|
||||||
whereBuilder.append(" add ");
|
*/
|
||||||
if (filterWhere.getSearchType() == 1) {
|
private Map<String, Object> getPatentWallSearchConf(String prefix) {
|
||||||
// 等于
|
synchronized (this) {
|
||||||
whereBuilder.append(filterWhere.getDbField())
|
if (this.patentWallSearchConf == null) {
|
||||||
.append(" = ? ");
|
this.patentWallSearchConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
|
||||||
args.add(filterWhere.getValue());
|
}
|
||||||
continue;
|
if (this.patentWallSearchConf == null) {
|
||||||
}
|
return new HashMap<>(0);
|
||||||
if (filterWhere.getSearchType() == 2) {
|
}
|
||||||
// 大于
|
return new HashMap<>(this.patentWallSearchConf);
|
||||||
whereBuilder.append(filterWhere.getDbField())
|
}
|
||||||
.append(" > ?");
|
}
|
||||||
args.add(filterWhere.getValue());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (filterWhere.getSearchType() == 3) {
|
|
||||||
// 小于
|
|
||||||
whereBuilder.append(filterWhere.getDbField())
|
|
||||||
.append(" < ?");
|
|
||||||
args.add(filterWhere.getValue());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (filterWhere.getSearchType() == 4) {
|
|
||||||
// in
|
|
||||||
whereBuilder.append(filterWhere.getDbField())
|
|
||||||
.append(" in ( ")
|
|
||||||
.append(filterWhere.getValue())
|
|
||||||
.append(") ");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (filterWhere.getSearchType() == 5) {
|
|
||||||
// 日期大于
|
|
||||||
whereBuilder.append(" DATE_FORMAT(")
|
|
||||||
.append(filterWhere.getDbField())
|
|
||||||
.append(",'%y-%m-%d') > ")
|
|
||||||
.append("DATE_FORMAT(?,'%y-%m-%d')");
|
|
||||||
args.add(filterWhere.getValue());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (filterWhere.getSearchType() == 6) {
|
|
||||||
// 日期小于
|
|
||||||
whereBuilder.append(" DATE_FORMAT(")
|
|
||||||
.append(filterWhere.getDbField())
|
|
||||||
.append(",'%y-%m-%d') < ")
|
|
||||||
.append("DATE_FORMAT(?,'%y-%m-%d')");
|
|
||||||
args.add(filterWhere.getValue());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (filterWhere.getSearchType() == 7) {
|
|
||||||
// 日期等于
|
|
||||||
whereBuilder.append(" DATE_FORMAT(")
|
|
||||||
.append(filterWhere.getDbField())
|
|
||||||
.append(",'%y-%m-%d') = ")
|
|
||||||
.append("DATE_FORMAT(?,'%y-%m-%d')");
|
|
||||||
args.add(filterWhere.getValue());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (filterWhere.getSearchType() == 8) {
|
|
||||||
// 日期范围
|
|
||||||
whereBuilder.append(" DATE_FORMAT(")
|
|
||||||
.append(filterWhere.getDbField())
|
|
||||||
.append(",'%y-%m-%d') between ")
|
|
||||||
.append("DATE_FORMAT(?,'%y-%m-%d')")
|
|
||||||
.append(" and DATE_FORMAT(?,'%y-%m-%d')");
|
|
||||||
args.add(filterWhere.getValue().split("&")[0]);
|
|
||||||
args.add(filterWhere.getValue().split("&")[1]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return patentWallMapping.getListByFilterWhere(whereBuilder, args, tableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取单例的配置文件信息
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<String, Object> getPatentWallConf(String prefix) {
|
|
||||||
synchronized (this) {
|
|
||||||
if (this.patentWallConf == null) {
|
|
||||||
this.patentWallConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
|
|
||||||
}
|
|
||||||
if (this.patentWallConf == null) {
|
|
||||||
return new HashMap<>(0);
|
|
||||||
}
|
|
||||||
return new HashMap<>(this.patentWallConf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearPatentWallConf() {
|
|
||||||
this.patentWallConf = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取单例的配置文件信息
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<String, Object> getPatentWallSearchConf(String prefix) {
|
|
||||||
synchronized (this) {
|
|
||||||
if (this.patentWallSearchConf == null) {
|
|
||||||
this.patentWallSearchConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
|
|
||||||
}
|
|
||||||
if (this.patentWallSearchConf == null) {
|
|
||||||
return new HashMap<>(0);
|
|
||||||
}
|
|
||||||
return new HashMap<>(this.patentWallSearchConf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearPatentWallSerachConf() {
|
|
||||||
this.patentWallSearchConf = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public void clearPatentWallSerachConf() {
|
||||||
|
this.patentWallSearchConf = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue