Compare commits
No commits in common. "main" and "chabaidao" have entirely different histories.
|
|
@ -1,92 +0,0 @@
|
|||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="java.io.File" %>
|
||||
<%@ page import="java.io.FileOutputStream" %>
|
||||
<%@ page import="java.io.InputStream" %>
|
||||
<%@ page import="weaver.file.ImageFileManager" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String basePath = File.separator+"opt"+File.separator+"weaver"+File.separator+"ecology"+File.separator+"filesystem" ;
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
String docid = request.getParameter("docid");
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String doccreatedate = "";
|
||||
String imagefileid = "";
|
||||
String imagefilename = "";
|
||||
if(StringUtils.isNotBlank(docid)){
|
||||
|
||||
String sql = " select doccreatedate from docdetail where id = "+docid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
doccreatedate = Util.null2String(rs.getString("doccreatedate"));
|
||||
}
|
||||
|
||||
sql = " select imagefileid from docimagefile where docid = "+docid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
imagefileid = Util.null2String(rs.getString("imagefileid"));
|
||||
}
|
||||
|
||||
|
||||
String iszip = "";
|
||||
String filerealpath = "";
|
||||
|
||||
if(StringUtils.isNotBlank(imagefileid)){
|
||||
sql = "select imagefilename,iszip,filerealpath from imagefile where imagefileid="+imagefileid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
imagefilename = Util.null2String(rs.getString("imagefilename"));
|
||||
}
|
||||
}
|
||||
|
||||
String filepath = basePath+File.separator+"convertvideo"+File.separator+doccreatedate+File.separator+imagefileid;
|
||||
File path = new File(filepath) ;
|
||||
if(!path.exists()){
|
||||
path.mkdirs();
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(imagefilename)){
|
||||
File videoPath = new File(filepath+File.separator+imagefilename) ;
|
||||
|
||||
if(!videoPath.exists()){
|
||||
|
||||
InputStream inputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imagefileid));
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(videoPath);
|
||||
int size = 0;
|
||||
int byteLength = 8196;
|
||||
byte[] buffer = new byte[byteLength];
|
||||
while ((size = inputStream.read(buffer,0,byteLength)) !=-1){
|
||||
fileOutputStream.write(buffer,0,size);
|
||||
}
|
||||
|
||||
fileOutputStream.close();
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String filepath = basePath+File.separator+"convertvideo"+File.separator+doccreatedate+File.separator+imagefileid;
|
||||
File videoPath = new File(filepath+File.separator+imagefilename) ;
|
||||
String code = "";
|
||||
if(videoPath.exists()){
|
||||
code = "200";
|
||||
}else{
|
||||
code = "500";
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code",code);
|
||||
|
||||
%>
|
||||
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="java.io.File" %>
|
||||
<%@ page import="java.nio.charset.StandardCharsets" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String basePath = File.separator+"opt"+File.separator+"weaver"+File.separator+"ecology" ;
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
String docid = request.getParameter("docid");
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String videoUrl = "";
|
||||
if(StringUtils.isNotBlank(docid)){
|
||||
String doccreatedate = "";
|
||||
String sql = " select doccreatedate from docdetail where id = "+docid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
doccreatedate = Util.null2String(rs.getString("doccreatedate"));
|
||||
}
|
||||
String imagefileid = "";
|
||||
sql = " select imagefileid from docimagefile where docid = "+docid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
imagefileid = Util.null2String(rs.getString("imagefileid"));
|
||||
}
|
||||
String imagefilename = "";
|
||||
if(StringUtils.isNotBlank(imagefileid)){
|
||||
sql = "select imagefilename from imagefile where imagefileid="+imagefileid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
imagefilename = Util.null2String(rs.getString("imagefilename"));
|
||||
}
|
||||
}
|
||||
String filepath = File.separator+"filesystem"+File.separator+"convertvideo"+File.separator+doccreatedate+File.separator+imagefileid;
|
||||
File path = new File(basePath+filepath) ;
|
||||
if(!path.exists()){
|
||||
path.mkdirs();
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(imagefilename)){
|
||||
String videoPathUrl = filepath + File.separator+imagefilename ; // new String(imagefilename.getBytes(StandardCharsets.ISO_8859_1));
|
||||
File videoPath = new File( basePath + videoPathUrl) ;
|
||||
|
||||
if(videoPath.exists()){
|
||||
videoUrl = videoPathUrl;
|
||||
}else{
|
||||
|
||||
|
||||
String imagestr = "";
|
||||
if(StringUtils.isNotBlank(imagefileid)){
|
||||
imagestr = DocDownloadCheckUtil.checkPermission(imagefileid, user);
|
||||
videoUrl = "/weaver/weaver.file.FileDownload?fileid="+imagestr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// String url = "/weaver/weaver.file.FileDownload?fileid="+imagstr;
|
||||
// out.print(url);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("videoUrl",videoUrl);
|
||||
|
||||
%>
|
||||
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="java.io.File" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
String docid = request.getParameter("docid");
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String videoUrl = "";
|
||||
if(StringUtils.isNotBlank(docid)){
|
||||
|
||||
String imagefileid = "";
|
||||
String sql = " select imagefileid from docimagefile where docid = "+docid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()) {
|
||||
imagefileid = Util.null2String(rs.getString("imagefileid"));
|
||||
}
|
||||
String imagestr = "";
|
||||
if(StringUtils.isNotBlank(imagefileid)){
|
||||
imagestr = DocDownloadCheckUtil.checkPermission(imagefileid, user);
|
||||
videoUrl = "/weaver/weaver.file.FileDownload?fileid="+imagestr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// String url = "/weaver/weaver.file.FileDownload?fileid="+imagstr;
|
||||
// out.print(url);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("videoUrl",videoUrl);
|
||||
|
||||
%>
|
||||
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="java.io.File" %>
|
||||
<%@ page import="java.io.FileOutputStream" %>
|
||||
<%@ page import="java.io.InputStream" %>
|
||||
<%@ page import="weaver.file.ImageFileManager" %>
|
||||
<%@ page import="com.engine.workflow.service.NewRequestService" %>
|
||||
<%@ page import="com.engine.workflow.util.CommonUtil" %>
|
||||
<%@ page import="com.engine.common.util.ServiceUtil" %>
|
||||
<%@ page import="com.engine.workflow.service.impl.NewRequestServiceImpl" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.engine.common.util.ParamUtil" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
|
||||
Map<String,Object> apidatas = getService(request,response).getWfInfo(ParamUtil.request2Map(request));
|
||||
out.print("apidatas:"+ JSON.toJSON(apidatas)+"</br>");
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
|
||||
%>
|
||||
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
||||
|
||||
<%!
|
||||
private NewRequestService getService(HttpServletRequest request, HttpServletResponse response){
|
||||
User user = CommonUtil.getUserByRequest(request,response);
|
||||
return (NewRequestService) ServiceUtil.getService(NewRequestServiceImpl.class,user);
|
||||
}
|
||||
|
||||
%>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.engine.workflow.service.NewRequestService" %>
|
||||
<%@ page import="com.engine.workflow.util.CommonUtil" %>
|
||||
<%@ page import="com.engine.common.util.ServiceUtil" %>
|
||||
<%@ page import="com.engine.workflow.service.impl.NewRequestServiceImpl" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="com.engine.common.util.ParamUtil" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.Arrays" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String workflowid = request.getParameter("workflowid");
|
||||
List<String> workflowList = new ArrayList<String>();
|
||||
if(StringUtils.isNotBlank(workflowid)){
|
||||
workflowList = Arrays.asList(workflowid.split(","));
|
||||
}
|
||||
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
if(workflowList.size()>0){
|
||||
|
||||
Map<String,Object> apidatas = getService(request,response).getWfInfo(ParamUtil.request2Map(request));
|
||||
JSONObject datasObject = JSONObject.parseObject(JSONObject.toJSONString(apidatas));
|
||||
|
||||
if(datasObject.containsKey("datas")){
|
||||
JSONArray datasArray = datasObject.getJSONArray("datas");
|
||||
|
||||
for(int i=0;i<datasArray.size();i++){
|
||||
JSONObject dataObject = datasArray.getJSONObject(i);
|
||||
if(dataObject.containsKey("wfbeans")){
|
||||
JSONArray wfbeansArray = dataObject.getJSONArray("wfbeans");
|
||||
for(int k=0;k<wfbeansArray.size();k++){
|
||||
JSONObject wfBeansObject = wfbeansArray.getJSONObject(k);
|
||||
String id = wfBeansObject.getString("id");
|
||||
String name = wfBeansObject.getString("name");
|
||||
if(workflowList.contains(id)){
|
||||
|
||||
JSONObject workObject = new JSONObject();
|
||||
workObject.put("id",id);
|
||||
workObject.put("name",name);
|
||||
workObject.put("pcurl","/workflow/request/CreateRequestForward.jsp?workflowid="+id);
|
||||
workObject.put("mobileurl","/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid="+id);
|
||||
jsonArray.add(workObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data",jsonArray);
|
||||
%>
|
||||
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
||||
<%!
|
||||
private NewRequestService getService(HttpServletRequest request, HttpServletResponse response){
|
||||
User user = CommonUtil.getUserByRequest(request,response);
|
||||
return (NewRequestService) ServiceUtil.getService(NewRequestServiceImpl.class,user);
|
||||
}
|
||||
|
||||
%>
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String billid = request.getParameter("billid");
|
||||
RecordSet rs = new RecordSet();
|
||||
String bmzzsqs = "";
|
||||
if(StringUtils.isNotBlank(billid)){
|
||||
|
||||
String zlcid = "";
|
||||
String sql =" select zlcid from formtable_main_236 where id = "+billid ;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
zlcid = rs.getString("zlcid");
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(zlcid)){
|
||||
String mainTable = "";
|
||||
sql = " select abs(k.formid) as formid from workflow_requestbase t inner join workflow_base k on k.id = t.workflowid " +
|
||||
" where t.requestid = "+zlcid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
mainTable = "formtable_main_"+ Util.null2String(rs.getString("formid"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(mainTable)) {
|
||||
sql = "select bmzzsqs from "+mainTable+" where requestid = "+zlcid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
bmzzsqs = Util.null2String(rs.getString("bmzzsqs"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String docUrl = "/spa/document/index2file.jsp?id="+bmzzsqs+"#/main/document/fileView";
|
||||
|
||||
%>
|
||||
|
||||
<script type="text/javascript" src="/cloudstore/resource/pc/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function (){
|
||||
var docUrl = "<%=docUrl %>" ;
|
||||
window.location.href = docUrl;
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String billid = request.getParameter("billid");
|
||||
RecordSet rs = new RecordSet();
|
||||
String bmzzsqs = "";
|
||||
if(StringUtils.isNotBlank(billid)){
|
||||
|
||||
String zlcid = "";
|
||||
String sql =" select zlcid from formtable_main_236 where id = "+billid ;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
zlcid = rs.getString("zlcid");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(zlcid)){
|
||||
String mainTable = "";
|
||||
sql = " select abs(k.formid) as formid from workflow_requestbase t inner join workflow_base k on k.id = t.workflowid " +
|
||||
" where t.requestid = "+zlcid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
mainTable = "formtable_main_"+ Util.null2String(rs.getString("formid"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(mainTable)) {
|
||||
sql = "select bmzzsqs from "+mainTable+" where requestid = "+zlcid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
bmzzsqs = Util.null2String(rs.getString("bmzzsqs"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("bmzzsqs",bmzzsqs);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0;
|
||||
int jcjj_total = 0;
|
||||
int jcyj_total = 0;
|
||||
int yzjj_total = 0;
|
||||
int yzyj_total = 0 ;
|
||||
int jsssyj_total = 0;
|
||||
int jsssej_total = 0;
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
int yjjg = 0;
|
||||
int ejjg = 0;
|
||||
int jcjj = 0;
|
||||
int jcyj = 0;
|
||||
int yzjj = 0;
|
||||
int yzyj = 0 ;
|
||||
int jsssyj = 0;
|
||||
int jsssej = 0;
|
||||
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = " select k.id,k.zzdj,k.zzlx\n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0\n" +
|
||||
" and t.szcs=" + cityKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String zzlx = Util.null2String(rs.getString("zzlx"));
|
||||
if("0".equals(zzlx)){ // 涉密信息系统集成
|
||||
if("1".equals(zzdj)){
|
||||
jcjj++;
|
||||
}else if("2".equals(zzdj)){
|
||||
jcyj++;
|
||||
}
|
||||
}else if("1".equals(zzlx)){ //国家秘密载体印制
|
||||
if("1".equals(zzdj)){
|
||||
yzjj++;
|
||||
}else if("2".equals(zzdj)){
|
||||
yzyj++;
|
||||
}
|
||||
}else if("2".equals(zzlx)){ //武器装备科研生产单位
|
||||
if("3".equals(zzdj)){
|
||||
yjjg++;
|
||||
}else if("4".equals(zzdj)){
|
||||
ejjg++;
|
||||
}
|
||||
}else if("3".equals(zzlx)){ //涉密军事设施建设
|
||||
if("3".equals(zzdj)){
|
||||
jsssyj++;
|
||||
}else if("4".equals(zzdj)){
|
||||
jsssej++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
cityMap.put("jcjj",jcjj);
|
||||
cityMap.put("jcyj",jcyj);
|
||||
cityMap.put("yzjj",yzjj);
|
||||
cityMap.put("yzyj",yzyj);
|
||||
cityMap.put("jsssyj",jsssyj);
|
||||
cityMap.put("jsssej",jsssej);
|
||||
|
||||
yjjg_total += yjjg ;
|
||||
ejjg_total += ejjg ;
|
||||
jcjj_total += jcjj ;
|
||||
jcyj_total += jcyj ;
|
||||
yzjj_total += yzjj ;
|
||||
yzyj_total += yzyj ;
|
||||
jsssyj_total += jsssyj ;
|
||||
jsssej_total += jsssej ;
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
totalMap.put("jcjj",jcjj_total);
|
||||
totalMap.put("jcyj",jcyj_total);
|
||||
totalMap.put("yzjj",yzjj_total);
|
||||
totalMap.put("yzyj",yzyj_total);
|
||||
totalMap.put("jsssyj",jsssyj_total);
|
||||
totalMap.put("jsssej",jsssej_total);
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select t.sm,t.yb,t.jd,t.wd,count(k.id) as cou\n" +
|
||||
" from uf_sjsj t\n" +
|
||||
" left join uf_zzdwdzxx k on k.szs = t.id\n" +
|
||||
" group by t.sm,t.yb,t.jd,t.wd ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String adcode = rs.getString("yb");
|
||||
String name = rs.getString("sm");
|
||||
String jd = rs.getString("jd");
|
||||
String wd = rs.getString("wd");
|
||||
String center = "["+jd+","+wd+"]";
|
||||
String cou = rs.getString("cou");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("adcode",adcode);
|
||||
map.put("name",name);
|
||||
map.put("center",center);
|
||||
map.put("num",cou);
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select t.sm,t.yb,t.jd,t.wd,count(k.id) as cou\n" +
|
||||
" from uf_sjsj t\n" +
|
||||
" left join uf_zzdwdzxx k on k.szs = t.id\n" +
|
||||
" group by t.sm,t.yb,t.jd,t.wd ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String adcode = rs.getString("yb");
|
||||
String name = rs.getString("sm");
|
||||
String jd = rs.getString("jd");
|
||||
String wd = rs.getString("wd");
|
||||
String center = "["+jd+","+wd+"]";
|
||||
String cou = rs.getString("cou");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("adcode",adcode);
|
||||
map.put("name",name);
|
||||
map.put("center",center);
|
||||
map.put("num",cou);
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String parentCode = request.getParameter("adcode");
|
||||
List<Map<String,Object>> dataList= new ArrayList<Map<String,Object>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentCode)){
|
||||
|
||||
|
||||
|
||||
String sql =" select t.jd,t.wd,count(1) as cou\n" +
|
||||
" from uf_zzdwdzxx t\n" +
|
||||
" inner join uf_qjsj k on k.id = t.szq\n" +
|
||||
" where k.yb='"+parentCode+"'\n" +
|
||||
" group by t.jd,t.wd ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
|
||||
String jd = rs.getString("jd");
|
||||
String wd = rs.getString("wd");
|
||||
String cou = rs.getString("cou");
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("jd",jd);
|
||||
dataMap.put("wd",wd);
|
||||
dataMap.put("num",cou);
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
Map<String,Object> dataMap = dataList.get(i);
|
||||
|
||||
String jd = Util.null2String(dataMap.get("jd"));
|
||||
String wd = Util.null2String(dataMap.get("wd"));
|
||||
|
||||
Double[] center = new Double[2];
|
||||
|
||||
if(StringUtils.isNotBlank(jd) && StringUtils.isNotBlank(wd)){
|
||||
center[0] = Double.parseDouble(jd);
|
||||
center[1] = Double.parseDouble(wd);
|
||||
}
|
||||
|
||||
String adcodes = "";
|
||||
String names = "";
|
||||
String zcdzs = "";
|
||||
String jydzs = "";
|
||||
|
||||
sql = " select id,dwmc,zcdz,jydz\n" +
|
||||
"from uf_zzdwdzxx\n" +
|
||||
" where jd='"+jd+"'\n" +
|
||||
" and wd='"+wd+"'";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String adcode = rs.getString("id");
|
||||
String name = rs.getString("dwmc");
|
||||
String zcdz = rs.getString("zcdz");
|
||||
String jydz = rs.getString("jydz");
|
||||
|
||||
adcodes += StringUtils.isBlank(adcodes) ? adcode :" ,"+adcode;
|
||||
names += StringUtils.isBlank(names) ? name :" \n"+name;
|
||||
|
||||
zcdzs += StringUtils.isBlank(zcdzs) ? names+":"+zcdz :" \n"+names+":"+zcdz;
|
||||
jydzs += StringUtils.isBlank(jydzs) ? names+":"+jydz :" \n"+names+":"+jydz;
|
||||
|
||||
}
|
||||
|
||||
dataMap.put("adcode",adcodes);
|
||||
dataMap.put("name",zcdzs);
|
||||
dataMap.put("center",center);
|
||||
dataMap.put("zcdz",zcdzs);
|
||||
dataMap.put("jydz",jydzs);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",dataList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String parentCode = request.getParameter("adcode");
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentCode)){
|
||||
|
||||
|
||||
String sql =" select t.qm,t.yb,t.jd,t.wd,count(k.id) as cou\n" +
|
||||
" from uf_qjsj t\n" +
|
||||
" left join uf_zzdwdzxx k on k.szq = t.id\n" +
|
||||
" inner join uf_sjsj p on p.id = t.sss\n" +
|
||||
" where p.yb = '"+parentCode+"'\n" +
|
||||
" group by t.qm,t.yb,t.jd,t.wd ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String adcode = rs.getString("yb");
|
||||
String name = rs.getString("qm");
|
||||
String jd = rs.getString("jd");
|
||||
String wd = rs.getString("wd");
|
||||
String center = "["+jd+","+wd+"]";
|
||||
String cou = rs.getString("cou");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("adcode",adcode);
|
||||
map.put("name",name);
|
||||
map.put("center",center);
|
||||
map.put("num",cou);
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String parentCode = request.getParameter("adcode");
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentCode)){
|
||||
|
||||
|
||||
String sql =" select t.qm,t.yb,t.jd,t.wd,count(k.id) as cou\n" +
|
||||
" from uf_qjsj t\n" +
|
||||
" left join uf_zzdwdzxx k on k.szq = t.id\n" +
|
||||
" inner join uf_sjsj p on p.id = t.sss\n" +
|
||||
" where p.yb = '"+parentCode+"'\n" +
|
||||
" group by t.qm,t.yb,t.jd,t.wd ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String adcode = rs.getString("yb");
|
||||
String name = rs.getString("qm");
|
||||
String jd = rs.getString("jd");
|
||||
String wd = rs.getString("wd");
|
||||
String center = "["+jd+","+wd+"]";
|
||||
String cou = rs.getString("cou");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("adcode",adcode);
|
||||
map.put("name",name);
|
||||
map.put("center",center);
|
||||
map.put("num",cou);
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,272 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
Map<String,String> signMap = new HashMap<String,String>();
|
||||
signMap.put("总体集成","ztjc");
|
||||
signMap.put("系统咨询","xtzx");
|
||||
signMap.put("软件开发","rjkf");
|
||||
signMap.put("安防监控","afjk");
|
||||
signMap.put("运行维护","yxwh");
|
||||
signMap.put("数据恢复","sjhf");
|
||||
signMap.put("工程监理","gcjl");
|
||||
|
||||
|
||||
Map<String,Integer> countMap = new HashMap<String,Integer>();
|
||||
countMap.put("ztjc",0);
|
||||
countMap.put("xtzx",0);
|
||||
countMap.put("rjkf",0);
|
||||
countMap.put("afjk",0);
|
||||
countMap.put("yxwh",0);
|
||||
countMap.put("sjhf",0);
|
||||
countMap.put("gcjl",0);
|
||||
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "0";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
String selectnames = "";
|
||||
Iterator<Map.Entry<String,String>> iterator = signMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<String,String> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
selectnames += StringUtils.isBlank(selectnames) ? "'" + key + "'" : ",'" + key + "'";
|
||||
}
|
||||
|
||||
|
||||
List<Map<String,String>> typeList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) and fieldname='ywzl' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" AND selectname in("+selectnames+")" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> typeMap = new HashMap<String,String>();
|
||||
typeMap.put("selectname",selectname);
|
||||
typeMap.put("selectvalue",selectvalue);
|
||||
String selectType = signMap.get(selectname);
|
||||
typeMap.put("selecttype",selectType);
|
||||
typeList.add(typeMap);
|
||||
}
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0 ;
|
||||
// int ztjc_tootal = 0;
|
||||
// int xtzx_tootal = 0;
|
||||
// int rjkf_tootal = 0;
|
||||
// int afjk_tootal = 0;
|
||||
// int yxwh_tootal = 0;
|
||||
// int sjhf_tootal = 0;
|
||||
// int gcjl_tootal = 0;
|
||||
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String yjjg = "0";
|
||||
String ejjg = "0";
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = " select zzdj,count(1) as cou\n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0\n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs=" + cityKey + where +
|
||||
" group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("1".equals(zzdj)){
|
||||
yjjg = cou;
|
||||
}else if("2".equals(zzdj)){
|
||||
ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(yjjg)){
|
||||
yjjg_total += Util.getIntValue(yjjg,0);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ejjg)){
|
||||
ejjg_total += Util.getIntValue(ejjg,0);
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
|
||||
for(int k=0;k<typeList.size();k++){
|
||||
Map<String,String> typeMap = typeList.get(k);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
int count = 0;
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and instr(','||ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs="+cityKey + where ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
int total = countMap.get(selecttype);
|
||||
total += count;
|
||||
countMap.put(selecttype,total);
|
||||
}
|
||||
|
||||
cityMap.put(selecttype,count);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szqx= " + districtKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("1".equals(zzdj)){
|
||||
districtMap.put("yjjg",cou);
|
||||
}else if("2".equals(zzdj)){
|
||||
districtMap.put("ejjg",cou);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int n=0;n<typeList.size();n++){
|
||||
Map<String,String> typeMap = typeList.get(n);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
|
||||
int count = 0;
|
||||
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and instr(','||ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szqx= " + districtKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
districtMap.put(selecttype,count);
|
||||
}
|
||||
}
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
totalMap.putAll(countMap);
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,277 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
Map<String,String> signMap = new HashMap<String,String>();
|
||||
signMap.put("总体集成","ztjc");
|
||||
signMap.put("系统咨询","xtzx");
|
||||
signMap.put("软件开发","rjkf");
|
||||
signMap.put("安防监控","afjk");
|
||||
signMap.put("运行维护","yxwh");
|
||||
signMap.put("数据恢复","sjhf");
|
||||
signMap.put("工程监理","gcjl");
|
||||
|
||||
|
||||
Map<String,Integer> countMap = new HashMap<String,Integer>();
|
||||
countMap.put("ztjc",0);
|
||||
countMap.put("xtzx",0);
|
||||
countMap.put("rjkf",0);
|
||||
countMap.put("afjk",0);
|
||||
countMap.put("yxwh",0);
|
||||
countMap.put("sjhf",0);
|
||||
countMap.put("gcjl",0);
|
||||
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "0";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
String selectnames = "";
|
||||
Iterator<Map.Entry<String,String>> iterator = signMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<String,String> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
selectnames += StringUtils.isBlank(selectnames) ? "'" + key + "'" : ",'" + key + "'";
|
||||
}
|
||||
|
||||
|
||||
List<Map<String,String>> typeList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) and fieldname='ywzl' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" AND selectname in("+selectnames+")" ;
|
||||
|
||||
out.print("sql:"+sql+"</br>");
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> typeMap = new HashMap<String,String>();
|
||||
typeMap.put("selectname",selectname);
|
||||
typeMap.put("selectvalue",selectvalue);
|
||||
String selectType = signMap.get(selectname);
|
||||
typeMap.put("selecttype",selectType);
|
||||
typeList.add(typeMap);
|
||||
}
|
||||
|
||||
out.print("typeList:"+typeList.size()+"</br>");
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0 ;
|
||||
// int ztjc_tootal = 0;
|
||||
// int xtzx_tootal = 0;
|
||||
// int rjkf_tootal = 0;
|
||||
// int afjk_tootal = 0;
|
||||
// int yxwh_tootal = 0;
|
||||
// int sjhf_tootal = 0;
|
||||
// int gcjl_tootal = 0;
|
||||
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String yjjg = "0";
|
||||
String ejjg = "0";
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = " select zzdj,count(1) as cou\n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0\n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs=" + cityKey + where +
|
||||
" group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("1".equals(zzdj)){
|
||||
yjjg = cou;
|
||||
}else if("2".equals(zzdj)){
|
||||
ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(yjjg)){
|
||||
yjjg_total += Util.getIntValue(yjjg,0);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ejjg)){
|
||||
ejjg_total += Util.getIntValue(ejjg,0);
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
|
||||
for(int k=0;k<typeList.size();k++){
|
||||
Map<String,String> typeMap = typeList.get(k);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
int count = 0;
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and instr(','||ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs="+cityKey + where ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
int total = countMap.get(selecttype);
|
||||
total += count;
|
||||
countMap.put(selecttype,total);
|
||||
}
|
||||
|
||||
cityMap.put(selecttype,count);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szqx= " + districtKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("1".equals(zzdj)){
|
||||
districtMap.put("yjjg",cou);
|
||||
}else if("2".equals(zzdj)){
|
||||
districtMap.put("ejjg",cou);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int n=0;n<typeList.size();n++){
|
||||
Map<String,String> typeMap = typeList.get(n);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
out.print("selectvalue:"+selectvalue+" selecttype:"+selecttype+"</br>");
|
||||
|
||||
int count = 0;
|
||||
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and instr(','||ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szqx= " + districtKey + where ;
|
||||
out.print("sql:"+sql+"</br>");
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
out.print("count:"+count+"</br>");
|
||||
districtMap.put(selecttype,count);
|
||||
}
|
||||
}
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
totalMap.putAll(countMap);
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,253 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String,String> signMap = new HashMap<String,String>();
|
||||
signMap.put("总体集成","ztjc");
|
||||
signMap.put("系统咨询","xtzx");
|
||||
signMap.put("软件开发","rjkf");
|
||||
signMap.put("安防监控","afjk");
|
||||
signMap.put("运行维护","yxwh");
|
||||
signMap.put("数据恢复","sjhf");
|
||||
signMap.put("工程监理","gcjl");
|
||||
|
||||
|
||||
Map<String,Integer> countMap = new HashMap<String,Integer>();
|
||||
countMap.put("jj_ztjc",0);
|
||||
countMap.put("jj_xtzx",0);
|
||||
countMap.put("jj_rjkf",0);
|
||||
countMap.put("jj_afjk",0);
|
||||
countMap.put("jj_yxwh",0);
|
||||
countMap.put("jj_sjhf",0);
|
||||
countMap.put("jj_gcjl",0);
|
||||
|
||||
countMap.put("yj_ztjc",0);
|
||||
countMap.put("yj_xtzx",0);
|
||||
countMap.put("yj_rjkf",0);
|
||||
countMap.put("yj_afjk",0);
|
||||
countMap.put("yj_yxwh",0);
|
||||
countMap.put("yj_sjhf",0);
|
||||
countMap.put("yj_gcjl",0);
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "0";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
|
||||
String selectnames = "";
|
||||
Iterator<Map.Entry<String,String>> iterator = signMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<String,String> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
selectnames += StringUtils.isBlank(selectnames) ? "'" + key + "'" : ",'" + key + "'";
|
||||
}
|
||||
|
||||
List<Map<String,String>> typeList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) and fieldname='ywzl' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" AND selectname in("+selectnames+")" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> typeMap = new HashMap<String,String>();
|
||||
typeMap.put("selectname",selectname);
|
||||
typeMap.put("selectvalue",selectvalue);
|
||||
String selectType = signMap.get(selectname);
|
||||
typeMap.put("selecttype",selectType);
|
||||
typeList.add(typeMap);
|
||||
}
|
||||
|
||||
List<Map<String,String>> djList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) \n" +
|
||||
" and fieldname='zzdj' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" and selectname in('甲级','乙级') ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> djMap = new HashMap<String,String>();
|
||||
djMap.put("selectvalue",selectvalue);
|
||||
djMap.put("selectname",selectname);
|
||||
String type = "";
|
||||
if("甲级".equals(selectname)){
|
||||
type = "jj";
|
||||
}else if("乙级".equals(selectname)){
|
||||
type = "yj";
|
||||
}
|
||||
|
||||
djMap.put("rowtype",type);
|
||||
djList.add(djMap);
|
||||
}
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
for(int p=0;p<djList.size();p++){
|
||||
|
||||
Map<String,String> djMap = djList.get(p);
|
||||
String rowtype = djMap.get("rowtype");
|
||||
String djvalue = djMap.get("selectvalue");
|
||||
|
||||
for(int k=0;k<typeList.size();k++){
|
||||
Map<String,String> typeMap = typeList.get(k);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
int count = 0;
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0" +
|
||||
" and k.zzdj = " + djvalue +
|
||||
" and instr(','||k.ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs="+cityKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
int total = countMap.get(rowtype+"_"+selecttype);
|
||||
total += count;
|
||||
countMap.put(selecttype,total);
|
||||
}
|
||||
cityMap.put(rowtype+"_"+selecttype,count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
for(int p=0;p<djList.size();p++) {
|
||||
|
||||
Map<String, String> djMap = djList.get(p);
|
||||
String rowtype = djMap.get("rowtype");
|
||||
String djvalue = djMap.get("selectvalue");
|
||||
|
||||
|
||||
for(int n=0;n<typeList.size();n++){
|
||||
Map<String,String> typeMap = typeList.get(n);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
|
||||
int count = 0;
|
||||
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and k.zzdj = " + djvalue +
|
||||
" and instr(','||k.ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szqx= " + districtKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
districtMap.put(rowtype+"_"+selecttype,count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sjid = request.getParameter("sjid");
|
||||
|
||||
String zblj = "";
|
||||
String yblj = "";
|
||||
String ycmrzs = "";
|
||||
String sql = " select zblj,yblj,ycmrzs from uf_zybjpz where id="+sjid;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
zblj = Util.null2String(rs.getString("zblj"));
|
||||
yblj = Util.null2String(rs.getString("yblj"));
|
||||
ycmrzs = Util.null2String(rs.getString("ycmrzs"));
|
||||
|
||||
}
|
||||
if(StringUtils.isBlank(ycmrzs)){
|
||||
ycmrzs = "0";
|
||||
}
|
||||
|
||||
dataJson.put("zblj",zblj);
|
||||
dataJson.put("yblj",yblj);
|
||||
dataJson.put("ycmrzs",ycmrzs);
|
||||
|
||||
// /interface/custom/queryLeftRightUrl.jsp?sjid=1
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "3";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0 ;
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String yjjg = "0";
|
||||
String ejjg = "0";
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
sql = " select zzdj,count(1) as cou\n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0\n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs=" + cityKey + where +
|
||||
" group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("3".equals(zzdj)){
|
||||
yjjg = cou;
|
||||
}else if("4".equals(zzdj)){
|
||||
ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(yjjg)){
|
||||
yjjg_total += Util.getIntValue(yjjg,0);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ejjg)){
|
||||
ejjg_total += Util.getIntValue(ejjg,0);
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
String dist_yjjg = "0";
|
||||
String dist_ejjg = "0";
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szqx= " + districtKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("3".equals(zzdj)){
|
||||
dist_yjjg = cou;
|
||||
}else if("4".equals(zzdj)){
|
||||
dist_ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
districtMap.put("yjjg",dist_yjjg);
|
||||
districtMap.put("ejjg",dist_ejjg);
|
||||
}
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "3";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0 ;
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String yjjg = "0";
|
||||
String ejjg = "0";
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
sql = " select zzdj,count(1) as cou\n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0\n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs=" + cityKey + where +
|
||||
" group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("3".equals(zzdj)){
|
||||
yjjg = cou;
|
||||
}else if("4".equals(zzdj)){
|
||||
ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(yjjg)){
|
||||
yjjg_total += Util.getIntValue(yjjg,0);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ejjg)){
|
||||
ejjg_total += Util.getIntValue(ejjg,0);
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
String dist_yjjg = "0";
|
||||
String dist_ejjg = "0";
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szqx= " + districtKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("3".equals(zzdj)){
|
||||
dist_yjjg = cou;
|
||||
}else if("4".equals(zzdj)){
|
||||
dist_ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
districtMap.put("yjjg",dist_yjjg);
|
||||
districtMap.put("ejjg",dist_ejjg);
|
||||
}
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
RecordSet rs = new RecordSet();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
int userid = user.getUID();
|
||||
String requestid = request.getParameter("requestid");
|
||||
int count = 0;
|
||||
int isprocess = 0;
|
||||
String sql = " select isremark from workflow_currentoperator where requestid="+requestid+" and userid = "+userid ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String isremark = Util.null2String(rs.getString("isremark"));
|
||||
if(!"2".equals(isremark) && !"4".equals(isremark)){
|
||||
isprocess++;
|
||||
}
|
||||
count++ ;
|
||||
}
|
||||
|
||||
if(count == 0){
|
||||
dataJson.put("msg","");
|
||||
}else{
|
||||
if(isprocess >0){
|
||||
dataJson.put("msg","待处理");
|
||||
}else{
|
||||
dataJson.put("msg","已处理");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
<%!
|
||||
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String dwid = request.getParameter("dwid");
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> sqslMap = getSqslMap(dwid);
|
||||
if(sqslMap !=null && sqslMap.size()>0){
|
||||
list.add(sqslMap);
|
||||
String yxDate = sqslMap.get("enddate");
|
||||
|
||||
Map<String,String> smscMap = getSmscMap(dwid,yxDate);
|
||||
list.add(smscMap);
|
||||
|
||||
|
||||
Map<String,String> xcscMap = getXcscMap(dwid,yxDate);
|
||||
list.add(xcscMap);
|
||||
|
||||
|
||||
Map<String,String> spjdMap = getSpjdMap(dwid,yxDate);
|
||||
list.add(spjdMap);
|
||||
|
||||
Map<String,String> fzrqMap = getFzrqMap(dwid,yxDate);
|
||||
list.add(fzrqMap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("dataList",list);
|
||||
dataJson.put("api_status",true);
|
||||
dataJson.put("message","success");
|
||||
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
<%!
|
||||
|
||||
public Map<String,String> getSqslMap(String dwid){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,String> sqslMap = new HashMap<String,String>();
|
||||
sqslMap.put("detail_desc","受理日期");
|
||||
sqslMap.put("title","申请受理");
|
||||
sqslMap.put("finish","0");
|
||||
|
||||
String slrq = "";
|
||||
String status = "4";
|
||||
String sql =" select slrq\n" +
|
||||
" from uf_sqsl\n" +
|
||||
" where id in(\n" +
|
||||
" select max(id) from uf_sqsl where dwmc = '"+dwid+"'"+
|
||||
" ) " ;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
slrq = rs.getString("slrq");
|
||||
status = "2";
|
||||
}
|
||||
|
||||
sqslMap.put("enddate",slrq);
|
||||
sqslMap.put("detail_date",slrq);
|
||||
sqslMap.put("status",status);
|
||||
return sqslMap;
|
||||
}
|
||||
|
||||
public Map<String,String> getSmscMap(String dwid,String yxDate){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,String> sqslMap = new HashMap<String,String>();
|
||||
sqslMap.put("finish","0");
|
||||
sqslMap.put("title","书面审查");
|
||||
sqslMap.put("status","2");
|
||||
|
||||
sqslMap.put("detail_desc","书面审查日期");
|
||||
|
||||
String smscrq = "";
|
||||
String status = "4";
|
||||
if(StringUtils.isNotBlank(yxDate)){
|
||||
String sql =" select smscrq from uf_smsc where dwmc = '"+dwid+"' and smscrq >='"+yxDate+"'" ;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
smscrq = rs.getString("smscrq");
|
||||
status = "2";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
sqslMap.put("enddate",smscrq);
|
||||
sqslMap.put("detail_date",smscrq);
|
||||
sqslMap.put("status",status);
|
||||
return sqslMap;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> getXcscMap(String dwid,String yxDate){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,String> sqslMap = new HashMap<String,String>();
|
||||
|
||||
sqslMap.put("title","现场审查");
|
||||
sqslMap.put("status","2");
|
||||
sqslMap.put("finish","0");
|
||||
sqslMap.put("detail_desc","现场审查日期");
|
||||
|
||||
String xcscrq = "";
|
||||
String status = "4";
|
||||
if(StringUtils.isNotBlank(yxDate)){
|
||||
String sql =" select xcscrq from uf_xcscjl where dwmc = '"+dwid+"' and xcscrq >='"+yxDate+"'" ;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
xcscrq = rs.getString("xcscrq");
|
||||
status = "2";
|
||||
}
|
||||
}
|
||||
sqslMap.put("enddate",xcscrq);
|
||||
sqslMap.put("detail_date",xcscrq);
|
||||
sqslMap.put("status",status);
|
||||
return sqslMap;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> getSpjdMap(String dwid,String yxDate){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,String> sqslMap = new HashMap<String,String>();
|
||||
|
||||
sqslMap.put("finish","0");
|
||||
sqslMap.put("title","审批决定");
|
||||
sqslMap.put("status","2");
|
||||
|
||||
sqslMap.put("detail_desc","行政许可日期");
|
||||
|
||||
String xzxkrq = "";
|
||||
String status = "4";
|
||||
if(StringUtils.isNotBlank(yxDate)){
|
||||
String sql =" select xzxkrq from uf_spjdjl where dwmc = '"+dwid+"' and xzxkrq >='"+yxDate+"' " ;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
xzxkrq = rs.getString("xzxkrq");
|
||||
status = "2";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sqslMap.put("enddate",xzxkrq);
|
||||
sqslMap.put("detail_date",xzxkrq);
|
||||
sqslMap.put("status",status);
|
||||
|
||||
return sqslMap;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> getFzrqMap(String dwid,String yxDate){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,String> sqslMap = new HashMap<String,String>();
|
||||
sqslMap.put("finish","0");
|
||||
sqslMap.put("detail_desc","发证日期");
|
||||
sqslMap.put("title","制证发证");
|
||||
|
||||
|
||||
String fzrq = "";
|
||||
String status = "4";
|
||||
if(StringUtils.isNotBlank(yxDate)) {
|
||||
String sql = " select fzrq from uf_zzfzjl where dwmc = '" + dwid + "' and fzrq >= '" + yxDate + "' ";
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
fzrq = rs.getString("fzrq");
|
||||
status = "2";
|
||||
}
|
||||
}
|
||||
|
||||
sqslMap.put("enddate",fzrq);
|
||||
sqslMap.put("detail_date",fzrq);
|
||||
sqslMap.put("status",status);
|
||||
|
||||
return sqslMap;
|
||||
}
|
||||
|
||||
|
||||
%>
|
||||
|
||||
|
||||
|
|
@ -1,253 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String,String> signMap = new HashMap<String,String>();
|
||||
signMap.put("涉密文件资料","smwjzl");
|
||||
signMap.put("国家统一考试试卷","gjtykssj");
|
||||
signMap.put("涉密防伪票据证书","smfwpjzs");
|
||||
signMap.put("涉密光电磁介质","smgdcjz");
|
||||
signMap.put("涉密档案数字化加工","smdaszhjg");
|
||||
|
||||
Map<String,Integer> countMap = new HashMap<String,Integer>();
|
||||
countMap.put("smwjzl",0);
|
||||
countMap.put("gjtykssj",0);
|
||||
countMap.put("smfwpjzs",0);
|
||||
countMap.put("smgdcjz",0);
|
||||
countMap.put("smdaszhjg",0);
|
||||
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "1";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
|
||||
String selectnames = "";
|
||||
Iterator<Map.Entry<String,String>> iterator = signMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<String,String> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
selectnames += StringUtils.isBlank(selectnames) ? "'" + key + "'" : ",'" + key + "'";
|
||||
}
|
||||
|
||||
List<Map<String,String>> typeList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) and fieldname='ywzl' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" AND selectname in("+selectnames+")" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> typeMap = new HashMap<String,String>();
|
||||
typeMap.put("selectname",selectname);
|
||||
typeMap.put("selectvalue",selectvalue);
|
||||
String selectType = signMap.get(selectname);
|
||||
typeMap.put("selecttype",selectType);
|
||||
typeList.add(typeMap);
|
||||
}
|
||||
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0 ;
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String yjjg = "0";
|
||||
String ejjg = "0";
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szcs=" + cityKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("1".equals(zzdj)){
|
||||
yjjg = cou;
|
||||
}else if("2".equals(zzdj)){
|
||||
ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(yjjg)){
|
||||
yjjg_total += Util.getIntValue(yjjg,0);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ejjg)){
|
||||
ejjg_total += Util.getIntValue(ejjg,0);
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
|
||||
for(int k=0;k<typeList.size();k++){
|
||||
Map<String,String> typeMap = typeList.get(k);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
int count = 0;
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and instr(','||ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs="+cityKey + where ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
int total = countMap.get(selecttype);
|
||||
total += count;
|
||||
countMap.put(selecttype,total);
|
||||
}
|
||||
cityMap.put(selecttype,count);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
String dist_yjjg = "0";
|
||||
String dist_ejjg = "0";
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szqx= " + districtKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("1".equals(zzdj)){
|
||||
dist_yjjg = cou;
|
||||
}else if("2".equals(zzdj)){
|
||||
dist_ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
districtMap.put("yjjg",dist_yjjg);
|
||||
districtMap.put("ejjg",dist_ejjg);
|
||||
|
||||
for(int n=0;n<typeList.size();n++){
|
||||
Map<String,String> typeMap = typeList.get(n);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
|
||||
int count = 0;
|
||||
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and instr(','||ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szqx= " + districtKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
districtMap.put(selecttype,count);
|
||||
}
|
||||
|
||||
}
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String,String> signMap = new HashMap<String,String>();
|
||||
signMap.put("涉密文件资料","smwjzl");
|
||||
signMap.put("国家统一考试试卷","gjtykssj");
|
||||
signMap.put("涉密防伪票据证书","smfwpjzs");
|
||||
signMap.put("涉密光电磁介质","smgdcjz");
|
||||
signMap.put("涉密档案数字化加工","smdaszhjg");
|
||||
|
||||
Map<String,Integer> countMap = new HashMap<String,Integer>();
|
||||
countMap.put("jj_smwjzl",0);
|
||||
countMap.put("jj_gjtykssj",0);
|
||||
countMap.put("jj_smfwpjzs",0);
|
||||
countMap.put("jj_smgdcjz",0);
|
||||
countMap.put("jj_smdaszhjg",0);
|
||||
|
||||
countMap.put("yj_smwjzl",0);
|
||||
countMap.put("yj_gjtykssj",0);
|
||||
countMap.put("yj_smfwpjzs",0);
|
||||
countMap.put("yj_smgdcjz",0);
|
||||
countMap.put("yj_smdaszhjg",0);
|
||||
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "1";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
|
||||
String selectnames = "";
|
||||
Iterator<Map.Entry<String,String>> iterator = signMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<String,String> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
selectnames += StringUtils.isBlank(selectnames) ? "'" + key + "'" : ",'" + key + "'";
|
||||
}
|
||||
|
||||
List<Map<String,String>> typeList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) and fieldname='ywzl' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" AND selectname in("+selectnames+")" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> typeMap = new HashMap<String,String>();
|
||||
typeMap.put("selectname",selectname);
|
||||
typeMap.put("selectvalue",selectvalue);
|
||||
String selectType = signMap.get(selectname);
|
||||
typeMap.put("selecttype",selectType);
|
||||
typeList.add(typeMap);
|
||||
}
|
||||
|
||||
List<Map<String,String>> djList = new ArrayList<Map<String,String>>();
|
||||
sql = " select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem\n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_bmzzzsxx' ) \n" +
|
||||
" and fieldname='zzdj' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" and selectname in('甲级','乙级') ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
String selectname = Util.null2String(rs.getString("selectname"));
|
||||
|
||||
Map<String,String> djMap = new HashMap<String,String>();
|
||||
djMap.put("selectvalue",selectvalue);
|
||||
djMap.put("selectname",selectname);
|
||||
String type = "";
|
||||
if("甲级".equals(selectname)){
|
||||
type = "jj";
|
||||
}else if("乙级".equals(selectname)){
|
||||
type = "yj";
|
||||
}
|
||||
|
||||
djMap.put("rowtype",type);
|
||||
djList.add(djMap);
|
||||
}
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
for(int p=0;p<djList.size();p++){
|
||||
|
||||
Map<String,String> djMap = djList.get(p);
|
||||
String rowtype = djMap.get("rowtype");
|
||||
String djvalue = djMap.get("selectvalue");
|
||||
|
||||
for(int k=0;k<typeList.size();k++){
|
||||
Map<String,String> typeMap = typeList.get(k);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
int count = 0;
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0" +
|
||||
" and k.zzdj = " + djvalue +
|
||||
" and instr(','||k.ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szcs="+cityKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
int total = countMap.get(rowtype+"_"+selecttype);
|
||||
total += count;
|
||||
countMap.put(selecttype,total);
|
||||
}
|
||||
cityMap.put(rowtype+"_"+selecttype,count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
for(int p=0;p<djList.size();p++) {
|
||||
|
||||
Map<String, String> djMap = djList.get(p);
|
||||
String rowtype = djMap.get("rowtype");
|
||||
String djvalue = djMap.get("selectvalue");
|
||||
|
||||
|
||||
for(int n=0;n<typeList.size();n++){
|
||||
Map<String,String> typeMap = typeList.get(n);
|
||||
String selectvalue = typeMap.get("selectvalue");
|
||||
String selecttype = typeMap.get("selecttype");
|
||||
|
||||
int count = 0;
|
||||
|
||||
if(StringUtils.isNotBlank(selectvalue)){
|
||||
sql = " select k.id \n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0 \n" +
|
||||
" and k.zzdj = " + djvalue +
|
||||
" and instr(','||k.ywzl||',',',"+selectvalue+",')>0 \n" +
|
||||
" and k.zzlx = " + zzlx +
|
||||
" and t.szqx= " + districtKey + where ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
districtMap.put(rowtype+"_"+selecttype,count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String sqdw = request.getParameter("sqdw");
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(sqdw)){
|
||||
|
||||
|
||||
String sql =" select id,'' as parentid,gdmc as name,'' as cgbl,'' as gdlx from \n" +
|
||||
" uf_gd\n" +
|
||||
" where id = '" + sqdw + "'"+
|
||||
" union \n" +
|
||||
" select p.id,sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggd\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where sqdw = '"+sqdw+"'" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String parentid = rs.getString("parentid");
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id",id);
|
||||
map.put("parentid",parentid);
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl);
|
||||
map.put("gdlx",gdlx);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String dwxx = request.getParameter("sqdw");
|
||||
String gd = request.getParameter("gd");
|
||||
List<Map<String,String>> datalist = new ArrayList<Map<String,String>>();
|
||||
List<Map<String,String>> parentList =new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(dwxx)){
|
||||
|
||||
String sqdw = "";
|
||||
String sql = " select id from uf_gd where dwxx='"+dwxx+"' ";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
sqdw = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(sqdw)){
|
||||
|
||||
sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw ='"+sqdw+"'" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id",id);
|
||||
map.put("parentid","T"+sqdw);
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl+"%");
|
||||
map.put("gdlx",gdlx);
|
||||
datalist.add(map);
|
||||
parentList.add(map);
|
||||
|
||||
}
|
||||
|
||||
if(datalist.size()>0){
|
||||
queryShareHolder(datalist,parentList);
|
||||
}
|
||||
|
||||
sql =" select id,'' as parentid,gdmc as name,'' as cgbl,'' as gdlx from \n" +
|
||||
" uf_gd\n" +
|
||||
" where id = '" + sqdw + "'";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id","T"+id);
|
||||
map.put("parentid","");
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl+"%");
|
||||
map.put("gdlx",gdlx);
|
||||
datalist.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
}else if(StringUtils.isNotBlank(gd)){
|
||||
|
||||
String sqdw = "";
|
||||
String sql = " select id from uf_gd where id='"+gd+"' ";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
sqdw = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(sqdw)){
|
||||
|
||||
sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw ='"+sqdw+"'" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id",id);
|
||||
map.put("parentid","T"+sqdw);
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl+"%");
|
||||
map.put("gdlx",gdlx);
|
||||
datalist.add(map);
|
||||
parentList.add(map);
|
||||
|
||||
}
|
||||
|
||||
if(datalist.size()>0){
|
||||
queryShareHolder(datalist,parentList);
|
||||
}
|
||||
|
||||
sql =" select id,'' as parentid,gdmc as name,'' as cgbl,'' as gdlx from \n" +
|
||||
" uf_gd\n" +
|
||||
" where id = '" + sqdw + "'";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id","T"+id);
|
||||
map.put("parentid","");
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl+"%");
|
||||
map.put("gdlx",gdlx);
|
||||
datalist.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// for(int i=0;i<dataList.size();i++){
|
||||
// String dataId = dataList.get(i);
|
||||
//
|
||||
// List<Map<String,String>> holderList = queryShareHolderByParent(dataId);
|
||||
// if(holderList.size()>0){
|
||||
// list.addAll(holderList);
|
||||
// }
|
||||
// }
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",datalist);
|
||||
dataJson.put("jncgbl","83.5%");
|
||||
dataJson.put("jwcgbl","22.5%");
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
||||
<%!
|
||||
public List<Map<String,String>> queryShareHolderByParent(String parentId){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentId)){
|
||||
|
||||
String sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw in ( select cggdx from uf_gdxx where id = '"+parentId+"' ) " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id",id);
|
||||
map.put("parentid",parentId);
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl+"%");
|
||||
map.put("gdlx",gdlx);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> queryShareHolder(List<Map<String,String>> datalist,List<Map<String,String>> parentList){
|
||||
|
||||
for(int i=0;i<parentList.size();i++){
|
||||
Map<String,String> parentMap = parentList.get(i);
|
||||
String parentId = parentMap.get("id");
|
||||
if(StringUtils.isNotBlank(parentId)){
|
||||
List<Map<String,String>> holderList = queryShareHolderByParent(parentId);
|
||||
if(holderList.size()>0){
|
||||
datalist.addAll(holderList);
|
||||
queryShareHolder(datalist,holderList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String sqdw = request.getParameter("sqdw");
|
||||
List<Map<String,String>> datalist = new ArrayList<Map<String,String>>();
|
||||
List<Map<String,String>> parentList =new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(sqdw)){
|
||||
|
||||
|
||||
String sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw = '"+sqdw+"'" ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id",id);
|
||||
map.put("parentid","T"+sqdw);
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl);
|
||||
map.put("gdlx",gdlx);
|
||||
datalist.add(map);
|
||||
parentList.add(map);
|
||||
|
||||
}
|
||||
|
||||
if(datalist.size()>0){
|
||||
queryShareHolder(datalist,parentList);
|
||||
}
|
||||
|
||||
sql =" select id,'' as parentid,gdmc as name,'' as cgbl,'' as gdlx from \n" +
|
||||
" uf_gd\n" +
|
||||
" where id = '" + sqdw + "'";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id","T"+id);
|
||||
map.put("parentid","");
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl);
|
||||
map.put("gdlx",gdlx);
|
||||
datalist.add(map);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// for(int i=0;i<dataList.size();i++){
|
||||
// String dataId = dataList.get(i);
|
||||
//
|
||||
// List<Map<String,String>> holderList = queryShareHolderByParent(dataId);
|
||||
// if(holderList.size()>0){
|
||||
// list.addAll(holderList);
|
||||
// }
|
||||
// }
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",datalist);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
||||
<%!
|
||||
public List<Map<String,String>> queryShareHolderByParent(String parentId){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentId)){
|
||||
|
||||
String sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw in ( select cggdx from uf_gdxx where id = '"+parentId+"' ) " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String name = rs.getString("name");
|
||||
String cgbl = rs.getString("cgbl");
|
||||
String gdlx = rs.getString("gdlx");
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
map.put("id",id);
|
||||
map.put("parentid",parentId);
|
||||
map.put("name",name);
|
||||
map.put("cgbl",cgbl);
|
||||
map.put("gdlx",gdlx);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> queryShareHolder(List<Map<String,String>> datalist,List<Map<String,String>> parentList){
|
||||
|
||||
for(int i=0;i<parentList.size();i++){
|
||||
Map<String,String> parentMap = parentList.get(i);
|
||||
String parentId = parentMap.get("id");
|
||||
if(StringUtils.isNotBlank(parentId)){
|
||||
List<Map<String,String>> holderList = queryShareHolderByParent(parentId);
|
||||
if(holderList.size()>0){
|
||||
datalist.addAll(holderList);
|
||||
queryShareHolder(datalist,holderList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,386 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.interfaces.domain.TreeNode" %>
|
||||
<%@ page import="java.math.BigDecimal" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String dwxx = request.getParameter("sqdw");
|
||||
String gd = request.getParameter("gd");
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(dwxx)){
|
||||
|
||||
|
||||
String sqdw = "";
|
||||
String sql = " select id from uf_gd where dwxx='"+dwxx+"' ";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
sqdw = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
|
||||
TreeNode root = new TreeNode("T"+sqdw);
|
||||
getChildrenDataByRoot(root,sqdw);
|
||||
|
||||
dataMap = recurTree(root);
|
||||
dataMap.put("id","T"+sqdw);
|
||||
dataMap.put("parentid","");
|
||||
|
||||
|
||||
|
||||
}else if(StringUtils.isNotBlank(gd)){
|
||||
TreeNode root = new TreeNode();
|
||||
|
||||
String sql =" select id from uf_gd where id = '" + gd + "'";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
root = new TreeNode("T"+id);
|
||||
getChildrenDataByRoot(root,gd);
|
||||
}
|
||||
dataMap = recurTree(root);
|
||||
dataMap.put("id","T"+gd);
|
||||
dataMap.put("parentid","");
|
||||
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
list.add(dataMap);
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
||||
<%!
|
||||
|
||||
|
||||
public void getChildrenDataByRoot(TreeNode root,String sqdw){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
bb.writeLog("getChildrenDataByRoot");
|
||||
|
||||
List<String> treeList = new ArrayList<String>();
|
||||
String sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw ='"+sqdw+"'" ;
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
treeList.add(id);
|
||||
}
|
||||
|
||||
for(int i=0;i<treeList.size();i++){
|
||||
String id = treeList.get(i);
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
TreeNode treeNode = new TreeNode();
|
||||
treeNode.setValue(id);
|
||||
List<TreeNode> childNodeList = queryShareHolderByParent2(id);
|
||||
if(childNodeList.size() > 0){
|
||||
treeNode.setChildren(childNodeList);
|
||||
}
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
}
|
||||
root.setChildren(treeNodeList);
|
||||
}
|
||||
|
||||
|
||||
public List<TreeNode> queryShareHolderByParent2(String parentId){
|
||||
List<TreeNode> treeNodesList = new ArrayList<TreeNode>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentId)){
|
||||
|
||||
String sql =" select t.id,t.sqdw as parentid,p.gdmc as name,t.cgbl,k.selectname as gdlx\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" left join (\n" +
|
||||
" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_gd' ) and fieldname='gdlx' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) \n" +
|
||||
" ) k on k.selectvalue = p.gdlx\n" +
|
||||
" where t.sqdw in ( select cggdx from uf_gdxx where id = '"+parentId+"' ) " ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
TreeNode treeNode = new TreeNode();
|
||||
treeNode.setValue(id);
|
||||
List<TreeNode> childList = queryShareHolderByParent2(id);
|
||||
if(childList.size()>0){
|
||||
treeNode.setChildren(childList);
|
||||
}
|
||||
treeNodesList.add(treeNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeNodesList;
|
||||
}
|
||||
|
||||
public Map<String,Object> recurTree(TreeNode root){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("recurTree");
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
List<List<String>> result = new ArrayList<>();
|
||||
List<String> path = new ArrayList<>();
|
||||
|
||||
path.add(root.getValue());
|
||||
findPath(result,root,path);
|
||||
|
||||
String return_jn_msg = "";
|
||||
String return_jw_msg = "";
|
||||
double jn_value = 0.0;
|
||||
double jw_value = 0.0;
|
||||
|
||||
for(int i=0;i<result.size();i++){
|
||||
|
||||
List<String> treeList = result.get(i);
|
||||
double jwcgbl = 0.0;
|
||||
double jncgbl = 0.0;
|
||||
String jn_msg = "";
|
||||
String jw_msg = "";
|
||||
|
||||
if(treeList.size() == 2){
|
||||
String gdid = treeList.get(1);
|
||||
if(StringUtils.isNotBlank(gdid) && !gdid.startsWith("T")){
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String gdmc = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
|
||||
bb.writeLog("sql:"+sql);
|
||||
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
gdmc = Util.null2String(rs.getString("gdmc"));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cgbl)){
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
|
||||
jwcgbl = dou_cgbl;
|
||||
|
||||
jw_msg = gdmc+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl;
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jncgbl = dou_cgbl;
|
||||
|
||||
jn_msg = gdmc+"["+jncgbl+"%]";
|
||||
|
||||
jn_value += jncgbl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String gdmcx = "";
|
||||
for(int k=treeList.size()-1;k>=0;k--){
|
||||
|
||||
if(k==treeList.size()-1){
|
||||
|
||||
String gdid = treeList.get(k);
|
||||
if(StringUtils.isNotBlank(gdid) && !gdid.startsWith("T")){
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
gdmcx = Util.null2String(rs.getString("gdmc"));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cgbl)){
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jwcgbl = dou_cgbl;
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jncgbl = dou_cgbl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if( k == 1){
|
||||
|
||||
String gdid = treeList.get(k);
|
||||
if(StringUtils.isNotBlank(gdid) && !gdid.startsWith("T")) {
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(cgbl)) {
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jwcgbl = dou_cgbl;
|
||||
jn_msg += gdmcx+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl ;
|
||||
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
if(jncgbl > 0){
|
||||
jncgbl = (jncgbl * dou_cgbl)/100.00;
|
||||
jncgbl = new BigDecimal(jncgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jn_msg = gdmcx+"["+jncgbl+"%]";
|
||||
|
||||
jn_value += jncgbl ;
|
||||
|
||||
}
|
||||
|
||||
if(jwcgbl > 0){
|
||||
jwcgbl = (jwcgbl * dou_cgbl)/100.00;
|
||||
jwcgbl = new BigDecimal(jwcgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jw_msg = gdmcx+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(k !=0 ){
|
||||
String gdid = treeList.get(k);
|
||||
if(StringUtils.isNotBlank(gdid) && !gdid.startsWith("T")) {
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(cgbl)) {
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jwcgbl = dou_cgbl;
|
||||
jn_msg += gdmcx+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl ;
|
||||
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
if(jncgbl > 0){
|
||||
jncgbl = (jncgbl * dou_cgbl)/100.00;
|
||||
jncgbl = new BigDecimal(jncgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jn_msg = gdmcx+"["+jncgbl+"%]";
|
||||
|
||||
jn_value += jncgbl ;
|
||||
}
|
||||
|
||||
if(jwcgbl > 0){
|
||||
jwcgbl = (jwcgbl * dou_cgbl)/100.00;
|
||||
jwcgbl = new BigDecimal(jwcgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jw_msg = gdmcx+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb.writeLog("jwcgbl:"+jwcgbl);
|
||||
bb.writeLog("jncgbl:"+jncgbl);
|
||||
bb.writeLog("jn_msg:"+jn_msg);
|
||||
bb.writeLog("jw_msg:"+jw_msg);
|
||||
|
||||
if(StringUtils.isNotBlank(jn_msg)){
|
||||
return_jn_msg += StringUtils.isBlank(return_jn_msg) ? jn_msg : ","+jn_msg ;
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(jw_msg)){
|
||||
return_jw_msg += StringUtils.isBlank(return_jw_msg) ? jw_msg : ","+jw_msg ;
|
||||
}
|
||||
}
|
||||
|
||||
dataMap.put("jn_msg",return_jn_msg);
|
||||
dataMap.put("jw_msg",return_jw_msg);
|
||||
dataMap.put("jn_value",jn_value);
|
||||
dataMap.put("jw_value",jw_value);
|
||||
|
||||
// System.out.println("return_jn_msg:"+return_jn_msg);
|
||||
// System.out.println("return_jw_msg:"+return_jw_msg);
|
||||
// System.out.println("jn_value:"+jn_value);
|
||||
// System.out.println("jw_value:"+jw_value);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public void findPath(List<List<String>> result,TreeNode node,List<String> path){
|
||||
if(node.getChildren() == null || node.getChildren().size() <=0){
|
||||
result.add(path);
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i=0;i<node.getChildren().size();i++){
|
||||
TreeNode child = node.getChildren().get(i);
|
||||
List<String> cPath = new ArrayList<>();
|
||||
cPath.addAll(path);
|
||||
cPath.add(child.getValue());
|
||||
findPath(result,child,cPath);
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,409 +0,0 @@
|
|||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.interfaces.domain.TreeNode" %>
|
||||
<%@ page import="java.math.BigDecimal" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String dwxx = request.getParameter("sqdw");
|
||||
String gd = request.getParameter("gd");
|
||||
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
List<String> nodeList = new ArrayList<String>();
|
||||
|
||||
if(StringUtils.isNotBlank(dwxx)){
|
||||
String sqdw = "";
|
||||
String sql = " select id from uf_gd where dwxx='"+dwxx+"' ";
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
sqdw = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
if(StringUtils.isNotBlank(sqdw)){
|
||||
TreeNode root = new TreeNode("T"+sqdw);
|
||||
getChildrenByRoot(root,sqdw,nodeList);
|
||||
Map<String,Object> dataMap = recurTree(root);
|
||||
dataMap.put("id","T"+sqdw);
|
||||
list.add(dataMap);
|
||||
}
|
||||
|
||||
if(nodeList.size()>0){
|
||||
for(int i=0;i<nodeList.size();i++){
|
||||
String gdxxId = nodeList.get(i);
|
||||
System.out.println("gdxxId:"+gdxxId);
|
||||
if(StringUtils.isNotBlank(gdxxId)){
|
||||
sql = " select cggdx from uf_gdxx where id = "+gdxxId;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
String cggdx = Util.null2String(rs.getString("cggdx"));
|
||||
if(StringUtils.isNotBlank(cggdx)){
|
||||
Map<String,Object> nodeMap = getRootDataByNode(cggdx);
|
||||
nodeMap.put("id",gdxxId);
|
||||
list.add(nodeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(StringUtils.isNotBlank(gd)){
|
||||
String sql =" select id from uf_gd where id = '" + gd + "'";
|
||||
String gdid = "";
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
gdid = rs.getString("id");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(gdid)){
|
||||
TreeNode root = new TreeNode("T"+gdid);
|
||||
getChildrenByRoot(root,gd,nodeList);
|
||||
Map<String,Object> dataMap = recurTree(root);
|
||||
dataMap.put("id","T"+gd);
|
||||
list.add(dataMap);
|
||||
}
|
||||
|
||||
if(nodeList.size()>0){
|
||||
for(int i=0;i<nodeList.size();i++){
|
||||
String gdxxId = nodeList.get(i);
|
||||
System.out.println("gdxxId:"+gdxxId);
|
||||
if(StringUtils.isNotBlank(gdxxId)){
|
||||
sql = " select cggdx from uf_gdxx where id = "+gdxxId;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
String cggdx = Util.null2String(rs.getString("cggdx"));
|
||||
if(StringUtils.isNotBlank(cggdx)){
|
||||
Map<String,Object> nodeMap = getRootDataByNode(cggdx);
|
||||
nodeMap.put("id",gdxxId);
|
||||
list.add(nodeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",list);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
||||
<%!
|
||||
|
||||
|
||||
// public void getRootData(String sqdw){
|
||||
// RecordSet rs = new RecordSet();
|
||||
// String gdid = "";
|
||||
// String sql =" select id from uf_gd where id = '" + sqdw + "'";
|
||||
// rs.executeQuery(sql);
|
||||
// if (rs.next()) {
|
||||
// gdid = rs.getString("id");
|
||||
// }
|
||||
// if(StringUtils.isNotBlank(gdid)){
|
||||
// TreeNode root = new TreeNode("T"+gdid);
|
||||
// List<String> nodeList = new ArrayList<String>();
|
||||
// getChildrenByRoot(root,gdid,nodeList);
|
||||
// System.out.println("nodeList:"+nodeList.toString());
|
||||
// recurTree(root);
|
||||
// if(nodeList.size()>0){
|
||||
// for(int i=0;i<nodeList.size();i++){
|
||||
// String gdxxId = nodeList.get(i);
|
||||
// System.out.println("gdxxId:"+gdxxId);
|
||||
// sql = " select t.cggdx from uf_gdxx t\n" +
|
||||
// "inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
// "where t.id = "+gdxxId;
|
||||
// rs.executeQuery(sql);
|
||||
// if(rs.next()){
|
||||
// String cggdx = Util.null2String(rs.getString("cggdx"));
|
||||
// if(StringUtils.isNotBlank(cggdx)){
|
||||
// Map<String,Object> nodeMap = getRootDataByNode(cggdx);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public Map<String,Object> getRootDataByNode(String sqdw){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,Object> nodeMap = new HashMap<String,Object>();
|
||||
String gdid = "";
|
||||
String sql =" select id from uf_gd where id = '" + sqdw + "'";
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
gdid = rs.getString("id");
|
||||
}
|
||||
if(StringUtils.isNotBlank(gdid)){
|
||||
TreeNode root = new TreeNode("T"+gdid);
|
||||
List<String> nodeList = new ArrayList<String>();
|
||||
getChildrenByRoot(root,gdid,nodeList);
|
||||
System.out.println("nodeList:"+nodeList.toString());
|
||||
nodeMap = recurTree(root);
|
||||
}
|
||||
|
||||
return nodeMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void getChildrenByRoot(TreeNode root,String sqdw,List<String> nodeList){
|
||||
RecordSet rs = new RecordSet();
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
|
||||
List<String> treeList = new ArrayList<String>();
|
||||
String sql =" select t.id\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" where t.sqdw ='"+sqdw+"'" ;
|
||||
System.out.println("getChildrenByRoot:sql:"+sql);
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String gdxxid = rs.getString("id");
|
||||
treeList.add(gdxxid);
|
||||
}
|
||||
|
||||
for(int i=0;i<treeList.size();i++){
|
||||
String gdxxid = treeList.get(i);
|
||||
System.out.println("gdxxid:"+gdxxid);
|
||||
if(StringUtils.isNotBlank(gdxxid)){
|
||||
TreeNode treeNode = new TreeNode();
|
||||
treeNode.setValue(gdxxid);
|
||||
List<TreeNode> childNodeList = queryChildrenByGdxxId(gdxxid,nodeList);
|
||||
if(childNodeList.size() > 0){
|
||||
treeNode.setChildren(childNodeList);
|
||||
nodeList.add(gdxxid);
|
||||
}
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
}
|
||||
root.setChildren(treeNodeList);
|
||||
}
|
||||
|
||||
|
||||
public List<TreeNode> queryChildrenByGdxxId(String parentGdxxId,List<String> nodeList){
|
||||
List<TreeNode> treeNodesList = new ArrayList<TreeNode>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotBlank(parentGdxxId)){
|
||||
|
||||
String sql =" select t.id\n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd p on p.id = t.cggdx\n" +
|
||||
" where t.sqdw in ( select cggdx from uf_gdxx where id = '"+parentGdxxId+"' ) " ;
|
||||
|
||||
System.out.println("sql:"+sql);
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String gdxxId = rs.getString("id");
|
||||
if(StringUtils.isNotBlank(gdxxId)){
|
||||
TreeNode treeNode = new TreeNode();
|
||||
treeNode.setValue(gdxxId);
|
||||
List<TreeNode> childList = queryChildrenByGdxxId(gdxxId,nodeList);
|
||||
if(childList.size()>0){
|
||||
treeNode.setChildren(childList);
|
||||
nodeList.add(gdxxId);
|
||||
}
|
||||
treeNodesList.add(treeNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeNodesList;
|
||||
}
|
||||
|
||||
public Map<String,Object> recurTree(TreeNode root){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
|
||||
List<List<String>> result = new ArrayList<>();
|
||||
List<String> path = new ArrayList<>();
|
||||
path.add(root.getValue());
|
||||
findTreePath(result,root,path);
|
||||
|
||||
System.out.println("result:"+result);
|
||||
|
||||
String return_jn_msg = "";
|
||||
String return_jw_msg = "";
|
||||
double jn_value = 0.0;
|
||||
double jw_value = 0.0;
|
||||
|
||||
for(int i=0;i<result.size();i++){
|
||||
|
||||
List<String> treeList = result.get(i);
|
||||
System.out.println("treeList:"+treeList.size());
|
||||
double jwcgbl = 0.0;
|
||||
double jncgbl = 0.0;
|
||||
|
||||
String jn_msg = "";
|
||||
String jw_msg = "";
|
||||
|
||||
if(treeList.size() == 2){
|
||||
String gdid = treeList.get(1);
|
||||
|
||||
if(StringUtils.isNotBlank(gdid)){
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String gdmc = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
gdmc = Util.null2String(rs.getString("gdmc"));
|
||||
}
|
||||
|
||||
System.out.println("cgbl:"+cgbl);
|
||||
System.out.println("gdmc:"+gdmc);
|
||||
|
||||
if(StringUtils.isNotBlank(cgbl)){
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
|
||||
jwcgbl = dou_cgbl;
|
||||
|
||||
jw_msg = gdmc+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl;
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jncgbl = dou_cgbl;
|
||||
|
||||
jn_msg = gdmc+"["+jncgbl+"%]";
|
||||
|
||||
jn_value += jncgbl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
String gdmcx = "";
|
||||
Collections.reverse(treeList);
|
||||
for(int k=0;k<treeList.size();k++){
|
||||
|
||||
String gdid = treeList.get(k);
|
||||
if(StringUtils.isNotBlank(gdid) && !gdid.startsWith("T")){
|
||||
|
||||
if( k== 0){
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
gdmcx = Util.null2String(rs.getString("gdmc"));
|
||||
}
|
||||
|
||||
System.out.println("cgbl:"+cgbl);
|
||||
if(StringUtils.isNotBlank(cgbl)){
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jwcgbl = dou_cgbl;
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jncgbl = dou_cgbl;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
String lx ="";
|
||||
String cgbl = "";
|
||||
String sql =" select t.cgbl,k.lx,k.gdmc \n" +
|
||||
" from uf_gdxx t\n" +
|
||||
" inner join uf_gd k on k.id = t.cggdx\n" +
|
||||
" where t.id= "+gdid ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
lx = Util.null2String(rs.getString("lx"));
|
||||
cgbl = Util.null2String(rs.getString("cgbl"));
|
||||
}
|
||||
|
||||
System.out.println("cgbl:" + cgbl);
|
||||
if (StringUtils.isNotBlank(cgbl)) {
|
||||
if("1".equals(lx)){
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
dou_cgbl = new BigDecimal(dou_cgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jwcgbl = dou_cgbl;
|
||||
jw_msg += gdmcx+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl ;
|
||||
|
||||
}else{
|
||||
double dou_cgbl = Double.parseDouble(cgbl);
|
||||
if(jncgbl > 0){
|
||||
jncgbl = (jncgbl * dou_cgbl)/100.00;
|
||||
jncgbl = new BigDecimal(jncgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jn_msg = gdmcx+"["+jncgbl+"%]";
|
||||
|
||||
jn_value += jncgbl ;
|
||||
|
||||
}
|
||||
|
||||
if(jwcgbl > 0){
|
||||
jwcgbl = (jwcgbl * dou_cgbl)/100.00;
|
||||
jwcgbl = new BigDecimal(jwcgbl).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jw_msg = gdmcx+"["+jwcgbl+"%]";
|
||||
|
||||
jw_value += jwcgbl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(jn_msg)){
|
||||
return_jn_msg += StringUtils.isBlank(return_jn_msg) ? jn_msg : ","+jn_msg ;
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(jw_msg)){
|
||||
return_jw_msg += StringUtils.isBlank(return_jw_msg) ? jw_msg : ","+jw_msg ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jn_value = new BigDecimal(jn_value).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
jw_value = new BigDecimal(jw_value).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
dataMap.put("jn_msg",return_jn_msg);
|
||||
dataMap.put("jw_msg",return_jw_msg);
|
||||
dataMap.put("jn_value",jn_value);
|
||||
dataMap.put("jw_value",jw_value);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
private void findTreePath(List<List<String>> result,TreeNode node,List<String> path){
|
||||
if(node.getChildren() == null || node.getChildren().size() <=0){
|
||||
result.add(path);
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i=0;i<node.getChildren().size();i++){
|
||||
TreeNode child = node.getChildren().get(i);
|
||||
List<String> cPath = new ArrayList<>();
|
||||
cPath.addAll(path);
|
||||
cPath.add(child.getValue());
|
||||
findTreePath(result,child,cPath);
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if(user==null) {
|
||||
response.sendRedirect("/login/Login.jsp");
|
||||
return;
|
||||
}
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0;
|
||||
int jcjj_total = 0;
|
||||
int jcyj_total = 0;
|
||||
int yzjj_total = 0;
|
||||
int yzyj_total = 0 ;
|
||||
int jsssyj_total = 0;
|
||||
int jsssej_total = 0;
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
|
||||
int yjjg = 0;
|
||||
int ejjg = 0;
|
||||
int jcjj = 0;
|
||||
int jcyj = 0;
|
||||
int yzjj = 0;
|
||||
int yzyj = 0 ;
|
||||
int jsssyj = 0;
|
||||
int jsssej = 0;
|
||||
|
||||
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = " select k.zzdj,k.zzlx,count(1)\n" +
|
||||
" from uf_dwjbxx t\n" +
|
||||
" inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
" where k.zszt=0\n" +
|
||||
" and t.szcs=" + cityKey + where +
|
||||
" group by k.zzdj,k.zzlx ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String zzlx = Util.null2String(rs.getString("zzlx"));
|
||||
if("0".equals(zzlx)){ // 涉密信息系统集成
|
||||
if("1".equals(zzdj)){
|
||||
jcjj++;
|
||||
}else if("2".equals(zzdj)){
|
||||
jcyj++;
|
||||
}
|
||||
}else if("1".equals(zzlx)){ //国家秘密载体印制
|
||||
if("1".equals(zzdj)){
|
||||
yzjj++;
|
||||
}else if("2".equals(zzdj)){
|
||||
yzyj++;
|
||||
}
|
||||
}else if("2".equals(zzlx)){ //武器装备科研生产单位
|
||||
if("3".equals(zzdj)){
|
||||
yjjg++;
|
||||
}else if("4".equals(zzdj)){
|
||||
ejjg++;
|
||||
}
|
||||
}else if("3".equals(zzlx)){ //涉密军事设施建设
|
||||
if("3".equals(zzdj)){
|
||||
jsssyj++;
|
||||
}else if("4".equals(zzdj)){
|
||||
jsssej++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
cityMap.put("jcjj",jcjj);
|
||||
cityMap.put("jcyj",jcyj);
|
||||
cityMap.put("yzjj",yzjj);
|
||||
cityMap.put("yzyj",yzyj);
|
||||
cityMap.put("jsssyj",jsssyj);
|
||||
cityMap.put("jsssej",jsssej);
|
||||
|
||||
yjjg_total += yjjg ;
|
||||
ejjg_total += ejjg ;
|
||||
jcjj_total += jcjj ;
|
||||
jcyj_total += jcyj ;
|
||||
yzjj_total += yzjj ;
|
||||
yzyj_total += yzyj ;
|
||||
jsssyj_total += jsssyj ;
|
||||
jsssej_total += jsssej ;
|
||||
}
|
||||
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
totalMap.put("jcjj",jcjj_total);
|
||||
totalMap.put("jcyj",jcyj_total);
|
||||
totalMap.put("yzjj",yzjj_total);
|
||||
totalMap.put("yzyj",yzyj_total);
|
||||
totalMap.put("jsssyj",jsssyj_total);
|
||||
totalMap.put("jsssej",jsssej_total);
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
String startDate = request.getParameter("startDate");
|
||||
String endDate = request.getParameter("endDate");
|
||||
|
||||
String zzlx = "2";
|
||||
RecordSet rs = new RecordSet();
|
||||
List<Map<String,Object>> cityList = new ArrayList<Map<String,Object>>();
|
||||
String sql =" select selectvalue,selectname \n" +
|
||||
" from workflow_selectitem \n" +
|
||||
" where fieldid in(\n" +
|
||||
" select id from workflow_billfield \n" +
|
||||
" where billid in( select id from workflow_bill where tablename='uf_dwjbxx' ) and fieldname='szcs' \n" +
|
||||
" and detailtable is null\n" +
|
||||
" ) ";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String selectvalue = rs.getString("selectvalue");
|
||||
String selectname = rs.getString("selectname");
|
||||
Map<String,Object> cityMap = new HashMap<String,Object>();
|
||||
cityMap.put("key","City"+selectvalue);
|
||||
cityMap.put("title",selectname);
|
||||
cityList.add(cityMap);
|
||||
}
|
||||
|
||||
int yjjg_total = 0;
|
||||
int ejjg_total = 0 ;
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String yjjg = "0";
|
||||
String ejjg = "0";
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szcs=" + cityKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("3".equals(zzdj)){
|
||||
yjjg = cou;
|
||||
}else if("4".equals(zzdj)){
|
||||
ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(yjjg)){
|
||||
yjjg_total += Util.getIntValue(yjjg,0);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ejjg)){
|
||||
ejjg_total += Util.getIntValue(ejjg,0);
|
||||
}
|
||||
|
||||
cityMap.put("yjjg",yjjg);
|
||||
cityMap.put("ejjg",ejjg);
|
||||
}
|
||||
|
||||
for(int i=0;i<cityList.size();i++){
|
||||
Map<String,Object> cityMap = cityList.get(i);
|
||||
String cityKey = Util.null2String(cityMap.get("key")).replace("City","");
|
||||
|
||||
List<Map<String,Object>> districtList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(cityKey)){
|
||||
int cityKey_ = Util.getIntValue(cityKey)+1;
|
||||
sql = "select id,qm,yb from uf_qjsj where sss="+cityKey_;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String qm = Util.null2String(rs.getString("qm"));
|
||||
|
||||
Map<String,Object> districtMap = new HashMap<String,Object>();
|
||||
districtMap.put("key","District"+id);
|
||||
districtMap.put("title",qm);
|
||||
districtList.add(districtMap);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<districtList.size();k++){
|
||||
Map<String,Object> districtMap = districtList.get(k);
|
||||
String districtKey = Util.null2String(districtMap.get("key")).replace("District","");
|
||||
|
||||
String dist_yjjg = "0";
|
||||
String dist_ejjg = "0";
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(startDate)){
|
||||
where += " and k.fzrq >= '"+startDate+"' ";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(endDate)){
|
||||
where += " and k.fzrq <= '"+endDate+"' ";
|
||||
}
|
||||
|
||||
sql = "select zzdj,count(1) as cou\n" +
|
||||
"from uf_dwjbxx t\n" +
|
||||
"inner join uf_bmzzzsxx k on k.dwmc = t.id\n" +
|
||||
"where k.zszt=0\n" +
|
||||
"and k.zzlx = " + zzlx +
|
||||
"and t.szqx= " + districtKey + where +
|
||||
"group by zzdj ";
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String zzdj = Util.null2String(rs.getString("zzdj"));
|
||||
String cou = Util.null2String(rs.getString("cou"));
|
||||
if("3".equals(zzdj)){
|
||||
dist_yjjg = cou;
|
||||
}else if("4".equals(zzdj)){
|
||||
dist_ejjg = cou;
|
||||
}
|
||||
}
|
||||
|
||||
districtMap.put("yjjg",dist_yjjg);
|
||||
districtMap.put("ejjg",dist_ejjg);
|
||||
}
|
||||
cityMap.put("subList",districtList);
|
||||
}
|
||||
|
||||
Map<String,Object> totalMap = new HashMap<String,Object>();
|
||||
totalMap.put("key","total");
|
||||
totalMap.put("title","合计");
|
||||
totalMap.put("yjjg",yjjg_total);
|
||||
totalMap.put("ejjg",ejjg_total);
|
||||
|
||||
cityList.add(totalMap);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",cityList);
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="weaver.mobile.webservices.workflow.WorkflowServiceImpl" %>
|
||||
<%@ page import="java.math.BigDecimal" %>
|
||||
<%@ page import="java.math.RoundingMode" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
|
||||
WorkflowServiceImpl workflowServiceImpl = new WorkflowServiceImpl();
|
||||
int createCount = 0;
|
||||
try{
|
||||
createCount = workflowServiceImpl.getMyWorkflowRequestCount(user.getUID(),null,true);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
int handleCount = 0 ;
|
||||
try{
|
||||
handleCount = workflowServiceImpl.getHendledWorkflowRequestCount(user.getUID(),true,null,true);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
int todoCount= 0;
|
||||
try{
|
||||
todoCount= workflowServiceImpl.getToDoWorkflowRequestCount(user.getUID(),true,null);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("hasDone",createCount);
|
||||
dataMap.put("qsgwlds",handleCount);
|
||||
dataMap.put("totalOverTime",todoCount);
|
||||
|
||||
dataMap.put("overTimePercent",0);
|
||||
dataMap.put("totalWilloverTime",0);
|
||||
|
||||
JSONObject dataJson = new JSONObject();
|
||||
double wcl = 0.0;
|
||||
if(todoCount+handleCount > 0){
|
||||
wcl = handleCount/((todoCount+handleCount)*1.0)*100;
|
||||
}
|
||||
BigDecimal bigDecimal = new BigDecimal(wcl);
|
||||
bigDecimal = bigDecimal.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
dataMap.put("bjl",bigDecimal.doubleValue()+"%");
|
||||
|
||||
dataJson.put("data",dataMap);
|
||||
dataJson.put("code","200");
|
||||
|
||||
%>
|
||||
|
||||
<%=dataJson.toJSONString() %>
|
||||
|
||||
<%!
|
||||
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
package com.api.bmj.web;
|
||||
|
||||
import com.engine.bmj.web.MaterialCreateAction;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/bmj/material")
|
||||
public class MaterialDownloadActionApi extends MaterialCreateAction {
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.api.secret.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/secret/authority/change")
|
||||
public class AuthorityChangeController extends com.engine.secret.web.AuthorityChangeController{
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.api.secret.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/secret/auto/number")
|
||||
public class AutoGenerateNumberController extends com.engine.secret.web.AutoGenerateNumberController{
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package com.api.secret.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
|
||||
@Path("/secret/demand")
|
||||
public class QualificationApplicationController extends com.engine.secret.web.QualificationApplicationController {
|
||||
}
|
||||
|
|
@ -1,227 +0,0 @@
|
|||
package com.engine.bmj.cmd;
|
||||
|
||||
import com.engine.bmj.utils.DocCreateUtil;
|
||||
import com.engine.bmj.utils.WordTemplateUtil;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.secret.util.ConfigUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class MaterialCreateCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public MaterialCreateCmd(Map<String,Object> params, User user) {
|
||||
this.params = params;
|
||||
this.user = user;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
|
||||
int newDocid = -1;
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
DocCreateUtil docCreateUtil = new DocCreateUtil();
|
||||
BaseBean bb = new BaseBean();
|
||||
String docid = Util.null2String(params.get("docid"));
|
||||
bb.writeLog("MaterialCreateCmd-client:"+docid);
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
if(StringUtils.isNotEmpty(docid)){
|
||||
|
||||
String imagefileid = "";
|
||||
String imageFileName = "";
|
||||
String fileRealPath = "";
|
||||
String sql = " select t1.imagefileid,t1.imageFileName,t1.fileRealPath,t2.imagefilename as realname from ImageFile t1 inner join DocImageFile t2 on t1.imagefileid = t2.imagefileid where t1.docid = " + docid;
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.execute(sql);
|
||||
if (rs.next())
|
||||
{
|
||||
imageFileName = Util.null2String(rs.getString("realname"));
|
||||
if (imageFileName.equals("")) {
|
||||
imageFileName = Util.null2String(rs.getString("imageFileName"));
|
||||
}
|
||||
imagefileid = Util.null2String(rs.getString("imagefileid"));
|
||||
fileRealPath = Util.null2String(rs.getString("fileRealPath"));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(imagefileid) && StringUtils.isNotBlank(imageFileName) && StringUtils.isNotBlank(fileRealPath)){
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String saveMaterialPath = "";
|
||||
if(StringUtils.isNotBlank(fileRealPath)){
|
||||
saveMaterialPath = fileRealPath.substring(0,fileRealPath.indexOf("filesystem"))+File.separator+"material"+File.separator+System.currentTimeMillis();
|
||||
}
|
||||
|
||||
boolean result = false;
|
||||
File parentFile = new File(saveMaterialPath);
|
||||
if (!parentFile.exists()) {
|
||||
result = parentFile.mkdirs();
|
||||
}else{
|
||||
result = true;
|
||||
}
|
||||
|
||||
if(result){
|
||||
InputStream inputstream = ImageFileManager.getInputStreamById(Util.getIntValue(imagefileid));
|
||||
|
||||
WordTemplateUtil wordTemplateUtil = null;
|
||||
try {
|
||||
wordTemplateUtil = new WordTemplateUtil(inputstream);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
wordTemplateUtil.replaceDocument(dataMap);
|
||||
|
||||
String outpath = saveMaterialPath + File.separator + new File(imageFileName);
|
||||
File outputFile = new File(outpath);
|
||||
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(outputFile);
|
||||
wordTemplateUtil.getDocument().write(fileOutputStream);
|
||||
|
||||
if(outputFile.exists()){
|
||||
|
||||
String docsubject = imageFileName;
|
||||
String attachfilename = imageFileName;
|
||||
String filepath = outputFile.getPath();
|
||||
long attachlength = outputFile.length();
|
||||
int creater = user.getUID();
|
||||
int seccategory = Util.getIntValue(ConfigUtil.getConfig("material.seccategory")) ;
|
||||
String tempcomids = "";
|
||||
newDocid = docCreateUtil.createMaterialDoc(docsubject,attachfilename,filepath,attachlength,creater,seccategory,tempcomids);
|
||||
}
|
||||
|
||||
fileOutputStream.close();
|
||||
inputstream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
bb.writeLog("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
|
||||
}catch (IOException e) {
|
||||
bb.writeLog("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
if(fileOutputStream != null){
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if(inputstream != null){
|
||||
try {
|
||||
inputstream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apidatas.put("docid",newDocid);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String,Object> getDocLabelData(String requestid,String shry) throws Exception
|
||||
{
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
Map<String, Object> wordDataMap = new HashMap<>();
|
||||
|
||||
Map<String, Object> parametersMap = new HashMap<>();
|
||||
parametersMap.put("shry",shry);
|
||||
|
||||
String formTable = "";
|
||||
String sql = " select abs(k.formid) as formid from workflow_requestbase t inner join workflow_base k on k.id = t.workflowid " +
|
||||
" where t.requestid = "+requestid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
formTable = "formtable_main_"+Util.null2String(rs.getString("formid"));
|
||||
}
|
||||
|
||||
String mainid = "";
|
||||
if(StringUtils.isNotBlank(formTable)){
|
||||
sql = " select mainid from "+formTable+" where requestid = "+requestid;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
mainid = Util.null2String(rs.getString("mainid"));
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String,Object>> table1List = new ArrayList<Map<String,Object>>();
|
||||
List<Map<String,Object>> table2List = new ArrayList<Map<String,Object>>();
|
||||
List<Map<String,Object>> table3List = new ArrayList<Map<String,Object>>();
|
||||
|
||||
if(StringUtils.isNotBlank(mainid)){
|
||||
|
||||
sql = " select * from "+formTable+"_dt1 where mainid = "+mainid;
|
||||
rs.executeQuery(sql);
|
||||
while(rs.next()){
|
||||
String glscx = Util.null2String(rs.getString("glscx"));
|
||||
String scx = Util.null2String(rs.getString("scx"));
|
||||
String scjg = Util.null2String(rs.getString("scjg"));
|
||||
String pdjg = Util.null2String(rs.getString("pdjg"));
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("glscx",glscx);
|
||||
map.put("scx",scx);
|
||||
map.put("scjg",scjg);
|
||||
map.put("pdjg",pdjg);
|
||||
table1List.add(map);
|
||||
}
|
||||
|
||||
sql = " select * from "+formTable+"_dt2 where mainid = "+mainid;
|
||||
rs.executeQuery(sql);
|
||||
while(rs.next()){
|
||||
String glscx = Util.null2String(rs.getString("glscx"));
|
||||
String scx = Util.null2String(rs.getString("scx"));
|
||||
String scjg = Util.null2String(rs.getString("scjg"));
|
||||
String pdjg = Util.null2String(rs.getString("pdjg"));
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("glscx",glscx);
|
||||
map.put("scx",scx);
|
||||
map.put("scjg",scjg);
|
||||
map.put("pdjg",pdjg);
|
||||
table2List.add(map);
|
||||
}
|
||||
|
||||
sql = " select * from "+formTable+"_dt3 where mainid = "+mainid;
|
||||
rs.executeQuery(sql);
|
||||
while(rs.next()){
|
||||
String glscx = Util.null2String(rs.getString("glscx"));
|
||||
String scx = Util.null2String(rs.getString("scx"));
|
||||
String scjg = Util.null2String(rs.getString("scjg"));
|
||||
String pdjg = Util.null2String(rs.getString("pdjg"));
|
||||
String pdbz = Util.null2String(rs.getString("pdbz"));
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("glscx",glscx);
|
||||
map.put("scx",scx);
|
||||
map.put("scjg",scjg);
|
||||
map.put("pdjg",pdjg);
|
||||
table3List.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
wordDataMap.put("parametersMap", parametersMap);
|
||||
wordDataMap.put("table1", table1List);
|
||||
wordDataMap.put("table2", table2List);
|
||||
wordDataMap.put("table3", table3List);
|
||||
|
||||
return wordDataMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package com.engine.bmj.service;
|
||||
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface MaterialCreateService {
|
||||
|
||||
Map<String,Object> createDocByMaterial(Map<String,Object> paramMap,User user);
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.engine.bmj.service.impl;
|
||||
|
||||
import com.engine.bmj.service.MaterialCreateService;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.bmj.cmd.MaterialCreateCmd;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MaterialCreateServiceImpl extends Service implements MaterialCreateService {
|
||||
@Override
|
||||
public Map<String, Object> createDocByMaterial(Map<String, Object> apidatas, User user) {
|
||||
return commandExecutor.execute(new MaterialCreateCmd(apidatas,user));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,269 +0,0 @@
|
|||
package com.engine.bmj.utils;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.docs.category.SecCategoryComInfo;
|
||||
import weaver.docs.docs.*;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
|
||||
public class DocCreateUtil {
|
||||
|
||||
public int createMaterialDoc(String docsubject,String attachfilename,String filepath,long attachlength,int creater,int seccategory,String tempcomids){
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
int docid = -1;
|
||||
try{
|
||||
String doccontent = "";
|
||||
docid = createDoc(docsubject,doccontent,creater,seccategory,tempcomids);
|
||||
if(docid > 0) {
|
||||
createImageFile(docid+"",attachfilename,filepath,attachlength,true);
|
||||
}
|
||||
}catch (Exception e){
|
||||
bb.writeLog("e:"+e);
|
||||
}
|
||||
|
||||
return docid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文档
|
||||
* @param title 文档标题
|
||||
* @param content 文档内容
|
||||
* @param creater 创建人
|
||||
* @param seccategory 子目录
|
||||
* @param tempcomids
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int createDoc(String title,String content,int creater,int seccategory,String tempcomids){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
|
||||
String createdate = TimeUtil.getCurrentDateString();
|
||||
String createtime = TimeUtil.getOnlyCurrentTimeString();
|
||||
String modifieddate = createdate;
|
||||
String modifiedtime = createtime;
|
||||
String pubishdate = createdate;
|
||||
String publishtime = createtime;
|
||||
|
||||
int docLanguage = 7 ;
|
||||
ResourceComInfo r = new ResourceComInfo();
|
||||
int departmentid = Integer.parseInt(r.getDepartmentID(creater+""));
|
||||
|
||||
SecCategoryComInfo secCategoryComInfo = new SecCategoryComInfo();
|
||||
|
||||
DocComInfo docComInfo=new DocComInfo();
|
||||
DocManager docManager=new DocManager();
|
||||
DocViewer docViewer=new DocViewer();
|
||||
|
||||
RecordSet recordSet = new RecordSet();
|
||||
int newDocId = docManager.getNextDocId(recordSet);
|
||||
|
||||
docManager.setId(newDocId);
|
||||
docManager.setDocsubject(title);
|
||||
docManager.setSeccategory(seccategory);
|
||||
docManager.setLanguageid(docLanguage);
|
||||
docManager.setDocstatus("1");
|
||||
|
||||
docManager.setDoccreaterid(creater);
|
||||
docManager.setDocdepartmentid(departmentid);
|
||||
docManager.setDocCreaterType("1"); //内部用户
|
||||
docManager.setUsertype("1");
|
||||
docManager.setOwnerid(creater);
|
||||
docManager.setOwnerType("1");
|
||||
docManager.setDoclastmoduserid(creater);
|
||||
docManager.setDocLastModUserType("1");
|
||||
docManager.setDoccreatedate(createdate);
|
||||
docManager.setDoccreatetime(createtime);
|
||||
docManager.setDoclastmoddate(modifieddate);
|
||||
docManager.setDoclastmodtime(modifiedtime);
|
||||
docManager.setDocPubDate(pubishdate);
|
||||
docManager.setDocPubTime(publishtime);
|
||||
docManager.setDoclangurage(docLanguage);
|
||||
docManager.setKeyword(title);
|
||||
docManager.setIsapprover("0");
|
||||
docManager.setDocreplyable("1");
|
||||
docManager.setAccessorycount(0);
|
||||
docManager.setSecretLevel(3);
|
||||
docManager.setOrderable(secCategoryComInfo.getSecOrderable(seccategory)+"");
|
||||
docManager.setUserid(1);
|
||||
docManager.setIsreply("0");
|
||||
|
||||
DocCoder docCoder = new DocCoder();
|
||||
docManager.setDocCode(docCoder.getDocCoder(""+seccategory));
|
||||
docManager.setDocEditionId(docManager.getNextEditionId(recordSet));
|
||||
docManager.setDocEdition(1);
|
||||
|
||||
docManager.setDoccontent(content);
|
||||
docManager.setDocType(1);
|
||||
|
||||
docManager.setDocextendname("html");
|
||||
docManager.setDocValidUserType("0");
|
||||
docManager.AddDocInfo();
|
||||
|
||||
docComInfo.addDocInfoCache("" + newDocId);
|
||||
|
||||
docViewer.setDocShareByDoc("" + newDocId);
|
||||
docManager.AddShareInfo();
|
||||
|
||||
rs.execute("select subcompanyid1 from HrmResource where id="+creater);
|
||||
rs.next();
|
||||
String subcompanyid1 = com.weaver.general.Util.null2String(rs.getString("subcompanyid1"));
|
||||
|
||||
rs.execute("update docshare set userid="+creater+" where docid="+newDocId+" and sharetype in (80,84)");
|
||||
|
||||
String sharesql=" insert into ShareinnerDoc (sourceid,type,content,seclevel,sharelevel,srcfrom,opuser,sharesource,downloadlevel,SECLEVELMAX)" +
|
||||
" values('"+newDocId+"',1,1,0,1,80,"+creater+",0,1,255)";
|
||||
rs.execute(sharesql);
|
||||
|
||||
if(!"".equals(subcompanyid1)){
|
||||
sharesql="insert into ShareinnerDoc (sourceid,type,content,seclevel,sharelevel,srcfrom,opuser,sharesource,downloadlevel,SECLEVELMAX)" +
|
||||
" values('"+newDocId+"',2,"+subcompanyid1+",0,1,2,"+subcompanyid1+",0,1,255)";
|
||||
rs.execute(sharesql);
|
||||
}
|
||||
|
||||
if(!"".equals(tempcomids))
|
||||
{
|
||||
String[] tempcomidArray = tempcomids.split(",");
|
||||
for(int i=0;i<tempcomidArray.length;i++)
|
||||
{
|
||||
int tempcomid = com.weaver.general.Util.getIntValue(tempcomidArray[i]);
|
||||
if(tempcomid!=0)
|
||||
{
|
||||
sharesql=" insert into ShareinnerDoc (sourceid,type,content,seclevel,sharelevel,srcfrom,opuser,sharesource,downloadlevel,SECLEVELMAX)" +
|
||||
" values('"+newDocId+"',2,"+tempcomid+",1,1,2,"+tempcomid+",0,0,255)";
|
||||
rs.execute(sharesql);
|
||||
}else
|
||||
{
|
||||
sharesql=" insert into ShareinnerDoc (sourceid,type,content,seclevel,sharelevel,srcfrom,opuser,sharesource,downloadlevel,SECLEVELMAX)" +
|
||||
" values('"+newDocId+"',5,1,1,1,1,1,0,0,255)";
|
||||
// bs.writeLog("sharesql:"+sharesql);
|
||||
rs.execute(sharesql);
|
||||
}
|
||||
}
|
||||
}
|
||||
bb.writeLog("newDocId:"+newDocId);
|
||||
return newDocId;
|
||||
}
|
||||
catch(Exception e){
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public void createImageFile(String docid,String attachfilename,String filepath,long attachlength,boolean maindoc) {
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
String doctype = getFileExt(attachfilename);
|
||||
String docfiletype = "";
|
||||
if (doctype.equalsIgnoreCase("doc")) {
|
||||
docfiletype = "3";
|
||||
} else if (doctype.equalsIgnoreCase("xls")) {
|
||||
docfiletype = "4";
|
||||
} else if (doctype.equalsIgnoreCase("ppt")) {
|
||||
docfiletype = "5";
|
||||
} else if (doctype.equalsIgnoreCase("wps")) {
|
||||
docfiletype = "6";
|
||||
} else if (doctype.equalsIgnoreCase("docx")) {
|
||||
docfiletype = "7";
|
||||
} else if (doctype.equalsIgnoreCase("xlsx")) {
|
||||
docfiletype = "8";
|
||||
} else if (doctype.equalsIgnoreCase("pptx")) {
|
||||
docfiletype = "9";
|
||||
} else {
|
||||
docfiletype = "2";
|
||||
}
|
||||
|
||||
String imagefiletype = "";
|
||||
if (doctype.equalsIgnoreCase("doc")) {
|
||||
imagefiletype = "application/msword";
|
||||
} else if (doctype.equalsIgnoreCase("xls")) {
|
||||
imagefiletype = "application/vnd.ms-excel";
|
||||
} else if (doctype.equalsIgnoreCase("ppt")) {
|
||||
imagefiletype = "application/vnd.ms-powerpoint";
|
||||
} else if (doctype.equalsIgnoreCase("wps")) {
|
||||
} else if (doctype.equalsIgnoreCase("docx")) {
|
||||
imagefiletype = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
} else if (doctype.equalsIgnoreCase("xlsx")) {
|
||||
imagefiletype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
} else if (doctype.equalsIgnoreCase("pptx")) {
|
||||
imagefiletype = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
||||
} else if (doctype.equalsIgnoreCase("pdf")) {
|
||||
imagefiletype = "application/octet-stream";
|
||||
} else if ("jpg".equals(doctype) || "png".equals(doctype)) {
|
||||
imagefiletype = "image/jpeg";
|
||||
} else if (doctype.equalsIgnoreCase("zip")) {
|
||||
imagefiletype = "application/zip";
|
||||
} else {
|
||||
imagefiletype = "application/octet-stream";
|
||||
}
|
||||
|
||||
ImageFileIdUpdate im = new ImageFileIdUpdate();
|
||||
int imagefileid = im.getImageFileNewId();
|
||||
|
||||
String docSet = "";
|
||||
String mainimagefile = "null";
|
||||
if (maindoc) {
|
||||
mainimagefile = "1";
|
||||
docSet = ",maindoc=" + imagefileid;
|
||||
}
|
||||
|
||||
String sql = " insert into ImageFile (imagefileid,imagefilename,imagefiletype,imagefileused,filerealpath,iszip,isencrypt,fileSize,secretlevel,mainimagefile) " +
|
||||
" values(" + imagefileid + ",'" + attachfilename + "','" + imagefiletype + "',1,'" + filepath + "',0,0,'" + attachlength + "',3," + mainimagefile + ")";
|
||||
rs.executeUpdate(sql);
|
||||
|
||||
DocImageManager dm = new DocImageManager();
|
||||
VersionIdUpdate versionIdUpdate = new VersionIdUpdate();
|
||||
|
||||
int versionid = versionIdUpdate.getVersionNewId();
|
||||
|
||||
sql = " insert into DocImageFile (id,docid,imagefileid,imagefilename,imagefilewidth,imagefileheight,imagefielsize,docfiletype,versionid)" +
|
||||
" values(" + dm.getNextDocImageFileId() + "," + docid + "," + imagefileid + ",'" + attachfilename + "','0','0','0','" + docfiletype + "'," + versionid + ")";
|
||||
rs.executeUpdate(sql);
|
||||
|
||||
sql = " select count(1) as cou from DocImageFile where docid=" + docid;
|
||||
rs.execute(sql);
|
||||
rs.next();
|
||||
int count = com.weaver.general.Util.getIntValue(com.weaver.general.Util.null2String(rs.getString("cou")));
|
||||
|
||||
sql = " update docdetail set accessorycount=" + count + docSet + " where id=" + docid;
|
||||
bb.writeLog("sql:" + sql);
|
||||
rs.executeUpdate(sql);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 得到文件的扩展名
|
||||
*
|
||||
* @param file
|
||||
* 文件全名
|
||||
* @return 文件的扩展名
|
||||
*/
|
||||
public static String getFileExt(String file) {
|
||||
if (file == null || file.trim().equals("")) {
|
||||
return "";
|
||||
} else {
|
||||
int idx = file.lastIndexOf(".");
|
||||
if (idx == -1) {
|
||||
return "";
|
||||
} else {
|
||||
if (idx + 1 >= file.length()) {
|
||||
return "";
|
||||
} else {
|
||||
return file.substring(idx + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,612 +0,0 @@
|
|||
package com.engine.bmj.utils;
|
||||
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class WordTemplateUtil {
|
||||
|
||||
private XWPFDocument document;
|
||||
|
||||
public XWPFDocument getDocument() {
|
||||
return document;
|
||||
}
|
||||
|
||||
public void setDocument(XWPFDocument document) {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化模板内容
|
||||
*
|
||||
* @author Juveniless
|
||||
* @date 2017年11月27日 下午3:59:22
|
||||
* @param inputStream
|
||||
* 模板的读取流(docx文件)
|
||||
* @throws IOException
|
||||
*
|
||||
*/
|
||||
public WordTemplateUtil(InputStream inputStream) throws IOException {
|
||||
document = new XWPFDocument(inputStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将处理后的内容写入到输出流中
|
||||
*
|
||||
* @param outputStream
|
||||
* @throws IOException
|
||||
*/
|
||||
public void write(OutputStream outputStream) throws IOException {
|
||||
document.write(outputStream);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据dataMap对word文件中的标签进行替换; <br><br>
|
||||
* !!!!***需要注意dataMap的数据格式***!!!! <br><br>
|
||||
* 对于需要替换的普通标签数据标签(不需要循环)-----必须在dataMap中存储一个key为parametersMap的map,
|
||||
* 来存储这些不需要循环生成的数据,比如:表头信息,日期,制表人等。 <br><br>
|
||||
* 对于需要循环生成的表格数据------key自定义,value为 --ArrayList<Map<String, String>>
|
||||
* @author Juveniless
|
||||
* @date 2017年11月27日 下午3:29:27
|
||||
* @param dataMap
|
||||
*
|
||||
*/
|
||||
public void replaceDocument(Map<String, Object> dataMap) {
|
||||
|
||||
if (!dataMap.containsKey("parametersMap")) {
|
||||
System.out.println("数据源错误--数据源(parametersMap)缺失");
|
||||
return;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> parametersMap = (Map<String, Object>) dataMap
|
||||
.get("parametersMap");
|
||||
|
||||
List<IBodyElement> bodyElements = document.getBodyElements();// 所有对象(段落+表格)
|
||||
int templateBodySize = bodyElements.size();// 标记模板文件(段落+表格)总个数
|
||||
|
||||
int curT = 0;// 当前操作表格对象的索引
|
||||
int curP = 0;// 当前操作段落对象的索引
|
||||
for (int a = 0; a < templateBodySize; a++) {
|
||||
IBodyElement body = bodyElements.get(a);
|
||||
if (BodyElementType.TABLE.equals(body.getElementType())) {// 处理表格
|
||||
XWPFTable table = body.getBody().getTableArray(curT);
|
||||
|
||||
List<XWPFTable> tables = body.getBody().getTables();
|
||||
table = tables.get(curT);
|
||||
if (table != null) {
|
||||
|
||||
// 处理表格
|
||||
// List<XWPFTableCell> tableCells = table.getRows().get(0).getTableCells(); // 获取到模板表格第一行,用来判断表格类型
|
||||
List<XWPFTableRow> tableRowsList = table.getRows();
|
||||
List<XWPFTableCell> tableCells = tableRowsList.get(0).getTableCells();
|
||||
|
||||
String tableText = table.getText();// 表格中的所有文本
|
||||
|
||||
if (tableText.indexOf("##{foreach") > -1) {
|
||||
// 查找到##{foreach标签,该表格需要处理循环
|
||||
if (tableCells.size() != 2
|
||||
|| tableCells.get(0).getText().indexOf("##{foreach") < 0
|
||||
|| tableCells.get(0).getText().trim().length() == 0) {
|
||||
System.out.println("文档中第"
|
||||
+ (curT + 1)
|
||||
+ "个表格模板错误,模板表格第一行需要设置2个单元格,"
|
||||
+ "第一个单元格存储表格类型(##{foreachTable}## 或者 ##{foreachTableRow}##),第二个单元格定义数据源。");
|
||||
return;
|
||||
}
|
||||
|
||||
String tableType = tableCells.get(0).getText();
|
||||
String dataSource = tableCells.get(1).getText();
|
||||
System.out.println("读取到数据源:"+dataSource);
|
||||
if (!dataMap.containsKey(dataSource)) {
|
||||
System.out.println("文档中第" + (curT + 1) + "个表格模板数据源缺失");
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> tableDataList = (List<Map<String, Object>>) dataMap
|
||||
.get(dataSource);
|
||||
if ("##{foreachTable}##".equals(tableType)) {
|
||||
// System.out.println("循环生成表格");
|
||||
addTableInDocFooter(table, tableDataList, parametersMap, 1);
|
||||
|
||||
} else if ("##{foreachTableRow}##".equals(tableType)) {
|
||||
// System.out.println("循环生成表格内部的行");
|
||||
addTableInDocFooter(table, tableDataList, parametersMap, 2);
|
||||
}
|
||||
|
||||
} else if (tableText.indexOf("{") > -1) {
|
||||
// 没有查找到##{foreach标签,查找到了普通替换数据的{}标签,该表格只需要简单替换
|
||||
addTableInDocFooter(table, null, parametersMap, 3);
|
||||
} else {
|
||||
// 没有查找到任何标签,该表格是一个静态表格,仅需要复制一个即可。
|
||||
addTableInDocFooter(table, null, null, 0);
|
||||
}
|
||||
curT++;
|
||||
|
||||
}
|
||||
} else if (BodyElementType.PARAGRAPH.equals(body.getElementType())) {// 处理段落
|
||||
// System.out.println("获取到段落");
|
||||
XWPFParagraph ph = body.getBody().getParagraphArray(curP);
|
||||
if (ph != null) {
|
||||
// htmlText = htmlText+readParagraphX(ph);
|
||||
addParagraphInDocFooter(ph, null, parametersMap, 0);
|
||||
|
||||
curP++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 处理完毕模板,删除文本中的模板内容
|
||||
for (int a = 0; a < templateBodySize; a++) {
|
||||
document.removeBodyElement(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据 模板表格 和 数据list 在word文档末尾生成表格
|
||||
* @author Juveniless
|
||||
* @date 2017年12月6日 上午10:12:05
|
||||
* @param templateTable 模板表格
|
||||
* @param list 循环数据集
|
||||
* @param parametersMap 不循环数据集
|
||||
* @param flag (0为静态表格,1为表格整体循环,2为表格内部行循环,3为表格不循环仅简单替换标签即可)
|
||||
*
|
||||
*/
|
||||
public void addTableInDocFooter(XWPFTable templateTable, List<Map<String, Object>> list,
|
||||
Map<String, Object> parametersMap, int flag) {
|
||||
|
||||
if (flag == 1) {// 表格整体循环
|
||||
for (Map<String, Object> map : list) {
|
||||
List<XWPFTableRow> templateTableRows = templateTable.getRows();// 获取模板表格所有行
|
||||
XWPFTable newCreateTable = document.createTable();// 创建新表格,默认一行一列
|
||||
for (int i = 1; i < templateTableRows.size(); i++) {
|
||||
XWPFTableRow newCreateRow = newCreateTable.createRow();
|
||||
CopyTableRow(newCreateRow, templateTableRows.get(i));// 复制模板行文本和样式到新行
|
||||
}
|
||||
newCreateTable.removeRow(0);// 移除多出来的第一行
|
||||
document.createParagraph();// 添加回车换行
|
||||
replaceTable(newCreateTable, map);//替换标签
|
||||
}
|
||||
|
||||
} else if (flag == 2) {// 表格表格内部行循环
|
||||
XWPFTable newCreateTable = document.createTable();// 创建新表格,默认一行一列
|
||||
List<XWPFTableRow> TempTableRows = templateTable.getRows();// 获取模板表格所有行
|
||||
int tagRowsIndex = 0;// 标签行indexs
|
||||
for (int i = 0, size = TempTableRows.size(); i < size; i++) {
|
||||
String rowText = TempTableRows.get(i).getCell(0).getText();// 获取到表格行的第一个单元格
|
||||
if (rowText.indexOf("##{foreachRows}##") > -1) {
|
||||
tagRowsIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 复制模板行和标签行之前的行 */
|
||||
for (int i = 1; i < tagRowsIndex; i++) {
|
||||
XWPFTableRow newCreateRow = newCreateTable.createRow();
|
||||
CopyTableRow(newCreateRow, TempTableRows.get(i));// 复制行
|
||||
replaceTableRow(newCreateRow, parametersMap);// 处理不循环标签的替换
|
||||
}
|
||||
|
||||
/* 循环生成模板行 */
|
||||
XWPFTableRow tempRow = TempTableRows.get(tagRowsIndex + 1);// 获取到模板行
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
XWPFTableRow newCreateRow = newCreateTable.createRow();
|
||||
CopyTableRow(newCreateRow, tempRow);// 复制模板行
|
||||
replaceTableRow(newCreateRow, list.get(i));// 处理标签替换
|
||||
}
|
||||
|
||||
/* 复制模板行和标签行之后的行 */
|
||||
for (int i = tagRowsIndex + 2; i < TempTableRows.size(); i++) {
|
||||
XWPFTableRow newCreateRow = newCreateTable.createRow();
|
||||
CopyTableRow(newCreateRow, TempTableRows.get(i));// 复制行
|
||||
replaceTableRow(newCreateRow, parametersMap);// 处理不循环标签的替换
|
||||
}
|
||||
newCreateTable.removeRow(0);// 移除多出来的第一行
|
||||
document.createParagraph();// 添加回车换行
|
||||
|
||||
} else if (flag == 3) {
|
||||
//表格不循环仅简单替换标签
|
||||
List<XWPFTableRow> templateTableRows = templateTable.getRows();// 获取模板表格所有行
|
||||
XWPFTable newCreateTable = document.createTable();// 创建新表格,默认一行一列
|
||||
for (int i = 0; i < templateTableRows.size(); i++) {
|
||||
XWPFTableRow newCreateRow = newCreateTable.createRow();
|
||||
CopyTableRow(newCreateRow, templateTableRows.get(i));// 复制模板行文本和样式到新行
|
||||
}
|
||||
newCreateTable.removeRow(0);// 移除多出来的第一行
|
||||
document.createParagraph();// 添加回车换行
|
||||
replaceTable(newCreateTable, parametersMap);
|
||||
|
||||
} else if (flag == 0) {
|
||||
List<XWPFTableRow> templateTableRows = templateTable.getRows();// 获取模板表格所有行
|
||||
XWPFTable newCreateTable = document.createTable();// 创建新表格,默认一行一列
|
||||
for (int i = 0; i < templateTableRows.size(); i++) {
|
||||
XWPFTableRow newCreateRow = newCreateTable.createRow();
|
||||
CopyTableRow(newCreateRow, templateTableRows.get(i));// 复制模板行文本和样式到新行
|
||||
}
|
||||
newCreateTable.removeRow(0);// 移除多出来的第一行
|
||||
document.createParagraph();// 添加回车换行
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 模板段落 和 数据 在文档末尾生成段落
|
||||
*
|
||||
* @author Juveniless
|
||||
* @date 2017年11月27日 上午11:49:42
|
||||
* @param templateParagraph
|
||||
* 模板段落
|
||||
* @param list
|
||||
* 循环数据集
|
||||
* @param parametersMap
|
||||
* 不循环数据集
|
||||
* @param flag
|
||||
* (0为不循环替换,1为循环替换)
|
||||
*
|
||||
*/
|
||||
public void addParagraphInDocFooter(XWPFParagraph templateParagraph,
|
||||
List<Map<String, String>> list, Map<String, Object> parametersMap, int flag) {
|
||||
|
||||
if (flag == 0) {
|
||||
XWPFParagraph createParagraph = document.createParagraph();
|
||||
// 设置段落样式
|
||||
createParagraph.getCTP().setPPr(templateParagraph.getCTP().getPPr());
|
||||
// 移除原始内容
|
||||
for (int pos = 0; pos < createParagraph.getRuns().size(); pos++) {
|
||||
createParagraph.removeRun(pos);
|
||||
}
|
||||
// 添加Run标签
|
||||
List<XWPFRun> runsList = templateParagraph.getRuns();
|
||||
for (XWPFRun s : runsList) {
|
||||
XWPFRun targetrun = createParagraph.createRun();
|
||||
CopyRun(targetrun, s);
|
||||
}
|
||||
|
||||
replaceParagraph(createParagraph, parametersMap);
|
||||
|
||||
} else if (flag == 1) {
|
||||
// 暂无实现
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据map替换段落元素内的{**}标签
|
||||
* @author Juveniless
|
||||
* @date 2017年12月4日 下午3:09:00
|
||||
* @param xWPFParagraph
|
||||
* @param parametersMap
|
||||
*
|
||||
*/
|
||||
public void replaceParagraph(XWPFParagraph xWPFParagraph, Map<String, Object> parametersMap) {
|
||||
List<XWPFRun> runs = xWPFParagraph.getRuns();
|
||||
String xWPFParagraphText = xWPFParagraph.getText();
|
||||
String regEx = "\\{.+?\\}";
|
||||
Pattern pattern = Pattern.compile(regEx);
|
||||
Matcher matcher = pattern.matcher(xWPFParagraphText);//正则匹配字符串{****}
|
||||
|
||||
if (matcher.find()) {
|
||||
// 查找到有标签才执行替换
|
||||
int beginRunIndex = xWPFParagraph.searchText("{", new PositionInParagraph()).getBeginRun();// 标签开始run位置
|
||||
int endRunIndex = xWPFParagraph.searchText("}", new PositionInParagraph()).getEndRun();// 结束标签
|
||||
StringBuffer key = new StringBuffer();
|
||||
|
||||
if (beginRunIndex == endRunIndex) {
|
||||
// {**}在一个run标签内
|
||||
XWPFRun beginRun = runs.get(beginRunIndex);
|
||||
String beginRunText = beginRun.text();
|
||||
|
||||
int beginIndex = beginRunText.indexOf("{");
|
||||
int endIndex = beginRunText.indexOf("}");
|
||||
int length = beginRunText.length();
|
||||
|
||||
if (beginIndex == 0 && endIndex == length - 1) {
|
||||
// 该run标签只有{**}
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(beginRunIndex);
|
||||
insertNewRun.getCTR().setRPr(beginRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
key.append(beginRunText.substring(1, endIndex));
|
||||
insertNewRun.setText(getValueBykey(key.toString(),parametersMap));
|
||||
xWPFParagraph.removeRun(beginRunIndex + 1);
|
||||
} else {
|
||||
// 该run标签为**{**}** 或者 **{**} 或者{**}**,替换key后,还需要加上原始key前后的文本
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(beginRunIndex);
|
||||
insertNewRun.getCTR().setRPr(beginRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
key.append(beginRunText.substring(beginRunText.indexOf("{")+1, beginRunText.indexOf("}")));
|
||||
String textString=beginRunText.substring(0, beginIndex) + getValueBykey(key.toString(),parametersMap)
|
||||
+ beginRunText.substring(endIndex + 1);
|
||||
insertNewRun.setText(textString);
|
||||
xWPFParagraph.removeRun(beginRunIndex + 1);
|
||||
}
|
||||
|
||||
}else {
|
||||
// {**}被分成多个run
|
||||
|
||||
//先处理起始run标签,取得第一个{key}值
|
||||
XWPFRun beginRun = runs.get(beginRunIndex);
|
||||
String beginRunText = beginRun.text();
|
||||
int beginIndex = beginRunText.indexOf("{");
|
||||
if (beginRunText.length()>1 ) {
|
||||
key.append(beginRunText.substring(beginIndex+1));
|
||||
}
|
||||
ArrayList<Integer> removeRunList = new ArrayList<>();//需要移除的run
|
||||
//处理中间的run
|
||||
for (int i = beginRunIndex + 1; i < endRunIndex; i++) {
|
||||
XWPFRun run = runs.get(i);
|
||||
String runText = run.text();
|
||||
key.append(runText);
|
||||
removeRunList.add(i);
|
||||
}
|
||||
|
||||
// 获取endRun中的key值
|
||||
XWPFRun endRun = runs.get(endRunIndex);
|
||||
String endRunText = endRun.text();
|
||||
int endIndex = endRunText.indexOf("}");
|
||||
//run中**}或者**}**
|
||||
if (endRunText.length()>1 && endIndex!=0) {
|
||||
key.append(endRunText.substring(0,endIndex));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*******************************************************************
|
||||
//取得key值后替换标签
|
||||
|
||||
//先处理开始标签
|
||||
if (beginRunText.length()==2 ) {
|
||||
// run标签内文本{
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(beginRunIndex);
|
||||
insertNewRun.getCTR().setRPr(beginRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
insertNewRun.setText(getValueBykey(key.toString(),parametersMap));
|
||||
xWPFParagraph.removeRun(beginRunIndex + 1);//移除原始的run
|
||||
}else {
|
||||
// 该run标签为**{**或者 {** ,替换key后,还需要加上原始key前的文本
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(beginRunIndex);
|
||||
insertNewRun.getCTR().setRPr(beginRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
String textString=beginRunText.substring(0,beginRunText.indexOf("{"))+getValueBykey(key.toString(),parametersMap);
|
||||
insertNewRun.setText(textString);
|
||||
xWPFParagraph.removeRun(beginRunIndex + 1);//移除原始的run
|
||||
}
|
||||
|
||||
//处理结束标签
|
||||
if (endRunText.length()==1 ) {
|
||||
// run标签内文本只有}
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(endRunIndex);
|
||||
insertNewRun.getCTR().setRPr(endRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
insertNewRun.setText("");
|
||||
xWPFParagraph.removeRun(endRunIndex + 1);//移除原始的run
|
||||
|
||||
}else {
|
||||
// 该run标签为**}**或者 }** 或者**},替换key后,还需要加上原始key后的文本
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(endRunIndex);
|
||||
insertNewRun.getCTR().setRPr(endRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
String textString=endRunText.substring(endRunText.indexOf("}")+1);
|
||||
insertNewRun.setText(textString);
|
||||
xWPFParagraph.removeRun(endRunIndex + 1);//移除原始的run
|
||||
}
|
||||
|
||||
//处理中间的run标签
|
||||
for (int i = 0; i < removeRunList.size(); i++) {
|
||||
XWPFRun xWPFRun = runs.get(removeRunList.get(i));//原始run
|
||||
XWPFRun insertNewRun = xWPFParagraph.insertNewRun(removeRunList.get(i));
|
||||
insertNewRun.getCTR().setRPr(xWPFRun.getCTR().getRPr());
|
||||
insertNewRun.setText("");
|
||||
xWPFParagraph.removeRun(removeRunList.get(i) + 1);//移除原始的run
|
||||
}
|
||||
|
||||
}// 处理${**}被分成多个run
|
||||
|
||||
replaceParagraph( xWPFParagraph, parametersMap);
|
||||
|
||||
}//if 有标签
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 复制表格行XWPFTableRow格式
|
||||
*
|
||||
* @param target
|
||||
* 待修改格式的XWPFTableRow
|
||||
* @param source
|
||||
* 模板XWPFTableRow
|
||||
*/
|
||||
private void CopyTableRow(XWPFTableRow target, XWPFTableRow source) {
|
||||
|
||||
int tempRowCellsize = source.getTableCells().size();// 模板行的列数
|
||||
for (int i = 0; i < tempRowCellsize - 1; i++) {
|
||||
target.addNewTableCell();// 为新添加的行添加与模板表格对应行行相同个数的单元格
|
||||
}
|
||||
// 复制样式
|
||||
target.getCtRow().setTrPr(source.getCtRow().getTrPr());
|
||||
// 复制单元格
|
||||
for (int i = 0; i < target.getTableCells().size(); i++) {
|
||||
copyTableCell(target.getCell(i), source.getCell(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 复制单元格XWPFTableCell格式
|
||||
*
|
||||
* @author Juveniless
|
||||
* @date 2017年11月27日 下午3:41:02
|
||||
* @param newTableCell
|
||||
* 新创建的的单元格
|
||||
* @param templateTableCell
|
||||
* 模板单元格
|
||||
*
|
||||
*/
|
||||
private void copyTableCell(XWPFTableCell newTableCell, XWPFTableCell templateTableCell) {
|
||||
// 列属性
|
||||
newTableCell.getCTTc().setTcPr(templateTableCell.getCTTc().getTcPr());
|
||||
// 删除目标 targetCell 所有文本段落
|
||||
for (int pos = 0; pos < newTableCell.getParagraphs().size(); pos++) {
|
||||
newTableCell.removeParagraph(pos);
|
||||
}
|
||||
// 添加新文本段落
|
||||
|
||||
List<XWPFParagraph> paragraphsList = templateTableCell.getParagraphs();
|
||||
for (XWPFParagraph sp : paragraphsList) {
|
||||
XWPFParagraph targetP = newTableCell.addParagraph();
|
||||
copyParagraph(targetP, sp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文本段落XWPFParagraph格式
|
||||
*
|
||||
* @author Juveniless
|
||||
* @date 2017年11月27日 下午3:43:08
|
||||
* @param newParagraph
|
||||
* 新创建的的段落
|
||||
* @param templateParagraph
|
||||
* 模板段落
|
||||
*
|
||||
*/
|
||||
private void copyParagraph(XWPFParagraph newParagraph, XWPFParagraph templateParagraph) {
|
||||
// 设置段落样式
|
||||
newParagraph.getCTP().setPPr(templateParagraph.getCTP().getPPr());
|
||||
// 添加Run标签
|
||||
for (int pos = 0; pos < newParagraph.getRuns().size(); pos++) {
|
||||
newParagraph.removeRun(pos);
|
||||
|
||||
}
|
||||
|
||||
List<XWPFRun> runs = templateParagraph.getRuns();
|
||||
for (XWPFRun s : runs) {
|
||||
XWPFRun targetrun = newParagraph.createRun();
|
||||
CopyRun(targetrun, s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文本节点run
|
||||
* @author Juveniless
|
||||
* @date 2017年11月27日 下午3:47:17
|
||||
* @param newRun
|
||||
* 新创建的的文本节点
|
||||
* @param templateRun
|
||||
* 模板文本节点
|
||||
*
|
||||
*/
|
||||
private void CopyRun(XWPFRun newRun, XWPFRun templateRun) {
|
||||
newRun.getCTR().setRPr(templateRun.getCTR().getRPr());
|
||||
// 设置文本
|
||||
newRun.setText(templateRun.text());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据参数parametersMap对表格的一行进行标签的替换
|
||||
*
|
||||
* @author Juveniless
|
||||
* @date 2017年11月23日 下午2:09:24
|
||||
* @param tableRow
|
||||
* 表格行
|
||||
* @param parametersMap
|
||||
* 参数map
|
||||
*
|
||||
*/
|
||||
public void replaceTableRow(XWPFTableRow tableRow, Map<String, Object> parametersMap) {
|
||||
|
||||
List<XWPFTableCell> tableCells = tableRow.getTableCells();
|
||||
for (XWPFTableCell xWPFTableCell : tableCells) {
|
||||
List<XWPFParagraph> paragraphs = xWPFTableCell.getParagraphs();
|
||||
for (XWPFParagraph xwpfParagraph : paragraphs) {
|
||||
|
||||
replaceParagraph(xwpfParagraph, parametersMap);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据map替换表格中的{key}标签
|
||||
* @author Juveniless
|
||||
* @date 2017年12月4日 下午2:47:36
|
||||
* @param xwpfTable
|
||||
* @param parametersMap
|
||||
*
|
||||
*/
|
||||
public void replaceTable(XWPFTable xwpfTable,Map<String, Object> parametersMap){
|
||||
List<XWPFTableRow> rows = xwpfTable.getRows();
|
||||
for (XWPFTableRow xWPFTableRow : rows ) {
|
||||
List<XWPFTableCell> tableCells = xWPFTableRow.getTableCells();
|
||||
for (XWPFTableCell xWPFTableCell : tableCells ) {
|
||||
List<XWPFParagraph> paragraphs2 = xWPFTableCell.getParagraphs();
|
||||
for (XWPFParagraph xWPFParagraph : paragraphs2) {
|
||||
replaceParagraph(xWPFParagraph, parametersMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getValueBykey(String key, Map<String, Object> map) {
|
||||
String returnValue="";
|
||||
if (key != null) {
|
||||
try {
|
||||
returnValue=map.get(key)!=null ? map.get(key).toString() : "";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
System.out.println("key:"+key+"***"+e);
|
||||
returnValue="";
|
||||
}
|
||||
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.engine.bmj.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.bmj.service.MaterialCreateService;
|
||||
import com.engine.bmj.service.impl.MaterialCreateServiceImpl;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
public class MaterialCreateAction {
|
||||
|
||||
public MaterialCreateService getService(){
|
||||
return (MaterialCreateService) ServiceUtil.getService(MaterialCreateServiceImpl.class);
|
||||
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/createDocByMaterial")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String createDocByMaterial(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
|
||||
Map<String,Object> apidatas = new HashMap<String,Object>();
|
||||
try{
|
||||
Map<String,Object> dataMap = ParamUtil.request2Map(request);
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
apidatas.putAll(getService().createDocByMaterial(dataMap,user));
|
||||
}catch (Exception e){
|
||||
apidatas.put("api_status",false);
|
||||
apidatas.put("api_errormsg","exception:"+e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.engine.secret.entity.autonumber;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AcceptanceNumber {
|
||||
private Integer id;
|
||||
private Integer year;
|
||||
private Integer month;
|
||||
private Integer monthlySerial;
|
||||
private Integer globalSerial;
|
||||
private Integer secretType;
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ApplicationResource {
|
||||
private String id;
|
||||
private String aid;
|
||||
private String fid;
|
||||
private String rid;
|
||||
private String createdTime;
|
||||
private String isDelete;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class CheckFields {
|
||||
private String name;
|
||||
private String fields;
|
||||
private String formFields;
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class DataConfig {
|
||||
private String id;
|
||||
private String mainTableName;
|
||||
private String relatedField;
|
||||
private String detailTableName;
|
||||
private String rootPath;
|
||||
List<DataConfig> childDataConfig;
|
||||
List<DataConfigDetail> detailList;
|
||||
List<FileConfig> fileList;
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import com.engine.secret.util.ModeUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class DataConfigDetail {
|
||||
private String fieldName;
|
||||
private String path;
|
||||
private String condition;
|
||||
private String convertSql;
|
||||
|
||||
public String getConvertSql() {
|
||||
if (StringUtils.isBlank(convertSql)) {
|
||||
return "";
|
||||
}
|
||||
return ModeUtil.ToDBC(convertSql);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FileConfig {
|
||||
private String fieldName;
|
||||
private String fileId;
|
||||
private String isFilled;
|
||||
private String fixedValue;
|
||||
private String attachments;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ResourceInfo {
|
||||
private String id;
|
||||
private String fileName;
|
||||
private String filePath;
|
||||
private String fileSuffix;
|
||||
private String virtualPath;
|
||||
private String createdTime;
|
||||
private String updatedTime;
|
||||
private String isDelete;
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.engine.secret.entity.unpack;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/30
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class UnpackParam {
|
||||
private String docId;
|
||||
private String requestId;
|
||||
private boolean isCorrection;
|
||||
private List<CheckFields> checkFields;
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package com.engine.secret.enums;
|
||||
|
||||
/**
|
||||
* 申请类别
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum ApplicationCategory {
|
||||
// 涉密信息系统集成资质、国家秘密载体印制资质、武器装备科研生产单位保密资质、涉密军事设施建设保密资质
|
||||
CLASSIFIED_INFO_SYSTEM_INTEGRATION_QUALIFICATION("涉密信息系统集成资质", 0),
|
||||
NATIONAL_SECRET_CARRIER_PRINTING_QUALIFICATION("国家秘密载体印制资质", 1),
|
||||
WEAPON_EQUIPMENT_RESEARCH_SECURITY_QUALIFICATION("武器装备科研生产单位保密资质", 2),
|
||||
CLASSIFIED_MILITARY_FACILITY_CONSTRUCTION_QUALIFICATION("涉密军事设施建设保密资质", 3);
|
||||
|
||||
ApplicationCategory(String name, Integer value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private String name;
|
||||
private Integer value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package com.engine.secret.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface CategoryValue {
|
||||
/**
|
||||
* 获取值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getSelectValue();
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
package com.engine.secret.enums;
|
||||
|
||||
/**
|
||||
* 集成资质
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum IntegrateCategory implements CategoryValue {
|
||||
// 总体集成、系统咨询、软件开发、安防监控、屏蔽室建设、运行维护、数据恢复、工程监理
|
||||
SYSTEM_INTEGRATION("总体集成", 0),
|
||||
SYSTEM_CONSULTING("系统咨询", 1),
|
||||
SOFTWARE_DEVELOPMENT("软件开发", 2),
|
||||
SECURITY_SURVEILLANCE("安防监控", 3),
|
||||
SHIELDED_ROOM_CONSTRUCTION("屏蔽室建设", 4),
|
||||
OPERATION_MAINTENANCE("运行维护", 5),
|
||||
DATA_RECOVERY("数据恢复", 6),
|
||||
PROJECT_SUPERVISION("工程监理", 7);
|
||||
|
||||
IntegrateCategory(String name, Integer value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private String name;
|
||||
private Integer value;
|
||||
|
||||
public static IntegrateCategory getValue(String name) {
|
||||
for (IntegrateCategory item : IntegrateCategory.values()) {
|
||||
if (item.name.equalsIgnoreCase(name)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
//throw new RuntimeException("不支持的操作类型");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSelectValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.engine.secret.enums;
|
||||
|
||||
/**
|
||||
* 印制资质
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum PrintCategory implements CategoryValue {
|
||||
// 涉密文件资料、国家统一考试试卷、涉密防伪票据证书、涉密光电磁介质、涉密档案数字化加工
|
||||
CLASSIFIED_DOCUMENTS("涉密文件资料", 0),
|
||||
NATIONAL_EXAM_PAPERS("国家统一考试试卷", 1),
|
||||
CLASSIFIED_VOUCHERS("涉密防伪票据证书", 2),
|
||||
SECURE_ELECTRONIC_STORAGE("涉密光电磁介质", 3),
|
||||
CLASSIFIED_DIGITIZATION("涉密档案数字化加工", 4);
|
||||
|
||||
PrintCategory(String name, Integer value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private String name;
|
||||
private Integer value;
|
||||
|
||||
public static PrintCategory getValue(String name) {
|
||||
for (PrintCategory item : PrintCategory.values()) {
|
||||
if (item.name.equalsIgnoreCase(name)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
//throw new RuntimeException("不支持的操作类型");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSelectValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.engine.secret.exception;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2023/2/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class CustomizeRunTimeException extends RuntimeException{
|
||||
|
||||
public CustomizeRunTimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CustomizeRunTimeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public CustomizeRunTimeException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
package com.engine.secret.instance;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.engine.secret.entity.autonumber.AcceptanceNumber;
|
||||
import com.engine.secret.exception.CustomizeRunTimeException;
|
||||
import com.engine.secret.util.ModeUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.formmode.IgnoreCaseHashMap;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class AutoGenerateNumberInstance {
|
||||
private static final String TABLE_NAME = "uf_sldh";
|
||||
private static final String RECORD_TABLE_NAME = "uf_sldh_dt1";
|
||||
|
||||
private static final AutoGenerateNumberInstance INSTANCE = new AutoGenerateNumberInstance();
|
||||
|
||||
private AutoGenerateNumberInstance() {
|
||||
// 私有化构造方法
|
||||
}
|
||||
|
||||
public static AutoGenerateNumberInstance getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 集成、印制受理编号
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public synchronized String getAcceptanceNumber(User user, Map<String, Object> param) {
|
||||
RecordSetTrans rs = new RecordSetTrans();
|
||||
rs.setAutoCommit(false);
|
||||
try {
|
||||
Integer secretType = Convert.toInt(param.get("secretType"));
|
||||
String requestId = Util.null2String(param.get("requestId"));
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
int year = now.getYear();
|
||||
int currentMonth = now.getMonthValue();
|
||||
|
||||
|
||||
AcceptanceNumber yearNumber;
|
||||
rs.executeQuery("select * from uf_sldh where secret_type= ? and year = ? and month = 0 FOR UPDATE", secretType, year);
|
||||
if (rs.next()) {
|
||||
yearNumber = getSelectNum(rs);
|
||||
} else {
|
||||
yearNumber = buildNewNum(year, 0, secretType);
|
||||
}
|
||||
yearNumber.setGlobalSerial(yearNumber.getGlobalSerial() + 1);
|
||||
// 更新年度流水号
|
||||
saveNum(rs, yearNumber);
|
||||
|
||||
AcceptanceNumber monthNumber;
|
||||
rs.executeQuery("select * from uf_sldh where secret_type= ? and year = ? and month = ? FOR UPDATE", secretType, year, currentMonth);
|
||||
if (rs.next()) {
|
||||
monthNumber = getSelectNum(rs);
|
||||
} else {
|
||||
monthNumber = buildNewNum(year, currentMonth, secretType);
|
||||
}
|
||||
monthNumber.setMonthlySerial(monthNumber.getMonthlySerial() + 1);
|
||||
// 更新月度、流水号
|
||||
saveNum(rs, monthNumber);
|
||||
|
||||
// 生成编号
|
||||
String formattedYear = String.format("%04d", year);
|
||||
String formattedMonth = String.format("%02d", monthNumber.getMonth());
|
||||
String formattedMonthlySerial = String.format("%02d", monthNumber.getMonthlySerial());
|
||||
String formattedGlobalSerial = String.format("%03d", yearNumber.getGlobalSerial());
|
||||
|
||||
String num = formattedYear + formattedMonth + formattedMonthlySerial + formattedGlobalSerial;
|
||||
rs.writeLog("requestId===" + requestId + ",secretType===" + secretType + ",num===" + num);
|
||||
insertGenerateRecord(rs, requestId, num, user.getUID());
|
||||
// 插入编号生成记录
|
||||
rs.commit();
|
||||
return num;
|
||||
} catch (Exception e) {
|
||||
rs.rollback();
|
||||
rs.writeLog(e);
|
||||
throw new CustomizeRunTimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 军工受理单号
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public synchronized String getWarIndustryAcceptanceNumber(User user, Map<String, Object> param) {
|
||||
RecordSetTrans rs = new RecordSetTrans();
|
||||
rs.setAutoCommit(false);
|
||||
try {
|
||||
Integer secretType = Convert.toInt(param.get("secretType"));
|
||||
String requestId = Util.null2String(param.get("requestId"));
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
int year = now.getYear();
|
||||
|
||||
|
||||
AcceptanceNumber yearNumber;
|
||||
rs.executeQuery("select * from uf_sldh where secret_type= ? and year = ? and month = 0 FOR UPDATE", secretType, year);
|
||||
if (rs.next()) {
|
||||
yearNumber = getSelectNum(rs);
|
||||
} else {
|
||||
yearNumber = buildNewNum(year, 0, secretType);
|
||||
}
|
||||
yearNumber.setGlobalSerial(yearNumber.getGlobalSerial() + 1);
|
||||
// 更新年度流水号
|
||||
saveNum(rs, yearNumber);
|
||||
|
||||
// 生成编号
|
||||
String formattedYear = String.format("%04d", year);
|
||||
String formattedGlobalSerial = String.format("%03d", yearNumber.getGlobalSerial());
|
||||
|
||||
String num = "JS" + formattedYear + formattedGlobalSerial;
|
||||
rs.writeLog("requestId===" + requestId + ",secretType===" + secretType + ",num===" + num);
|
||||
insertGenerateRecord(rs, requestId, num, user.getUID());
|
||||
rs.commit();
|
||||
return num;
|
||||
} catch (Exception e) {
|
||||
rs.rollback();
|
||||
rs.writeLog(e);
|
||||
throw new CustomizeRunTimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询对象
|
||||
*
|
||||
* @param rs
|
||||
* @return
|
||||
*/
|
||||
private AcceptanceNumber getSelectNum(RecordSetTrans rs) {
|
||||
return AcceptanceNumber.builder()
|
||||
.id(rs.getInt("id"))
|
||||
.year(rs.getInt("year"))
|
||||
.month(rs.getInt("month"))
|
||||
.monthlySerial(rs.getInt("monthly_serial"))
|
||||
.globalSerial(rs.getInt("global_serial"))
|
||||
.secretType(rs.getInt("secret_type"))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建新对象
|
||||
*
|
||||
* @param year
|
||||
* @param currentMonth
|
||||
* @param secretType
|
||||
* @return
|
||||
*/
|
||||
private AcceptanceNumber buildNewNum(Integer year, Integer currentMonth, Integer secretType) {
|
||||
return AcceptanceNumber.builder()
|
||||
.year(year)
|
||||
.month(currentMonth)
|
||||
.monthlySerial(0)
|
||||
.globalSerial(0)
|
||||
.secretType(secretType)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存编号数据
|
||||
*
|
||||
* @param rs
|
||||
* @param number
|
||||
* @throws Exception
|
||||
*/
|
||||
private void saveNum(RecordSetTrans rs, AcceptanceNumber number) throws Exception {
|
||||
if (null == number.getId()) {
|
||||
Map<String, Object> insertMap = buildSaveMap(number);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
insertMap.put("modeuuid", uuid);
|
||||
int formModeId = ModeUtil.getModeIdByTableName(TABLE_NAME);
|
||||
insertMap.put("formmodeid", formModeId);
|
||||
ModeUtil.buildModeInsertFields(insertMap, 1);
|
||||
ModeUtil.insertData(rs, insertMap, TABLE_NAME);
|
||||
ModeUtil.refreshRight(uuid, TABLE_NAME, formModeId, 1);
|
||||
} else {
|
||||
Map<String, Object> updateMap = buildSaveMap(number);
|
||||
ModeUtil.buildModeUpdateFields(updateMap, 1);
|
||||
ModeUtil.updateDataById(rs, updateMap, TABLE_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建数据库映射关系
|
||||
*
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
private IgnoreCaseHashMap<String, Object> buildSaveMap(AcceptanceNumber number) {
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
if (null != number.getId()) {
|
||||
dataMap.put("id", number.getId());
|
||||
}
|
||||
dataMap.put("year", number.getYear());
|
||||
dataMap.put("month", number.getMonth());
|
||||
dataMap.put("monthly_serial", number.getMonthlySerial());
|
||||
dataMap.put("global_serial", number.getGlobalSerial());
|
||||
dataMap.put("secret_type", number.getSecretType());
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入编号生成记录
|
||||
*
|
||||
* @param requestId
|
||||
* @param num
|
||||
* @param userId
|
||||
*/
|
||||
private void insertGenerateRecord(RecordSetTrans rs, String requestId, String num, int userId) throws Exception {
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
dataMap.put("request_id", requestId);
|
||||
dataMap.put("num", num);
|
||||
dataMap.put("operate_user", userId);
|
||||
dataMap.put("operate_time", DateUtil.getFullDate());
|
||||
ModeUtil.insertData(rs, dataMap, RECORD_TABLE_NAME);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
package com.engine.secret.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface AuthorityChangeService {
|
||||
|
||||
/**
|
||||
* 将审批事权移交至省级
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> delegateToProvincialAuthority(Map<String, Object> param);
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.engine.secret.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface AutoGenerateNumberService {
|
||||
/**
|
||||
* 获取受理单号
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
String getAcceptanceNumber(Map<String, Object> param) ;
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.engine.secret.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface QualificationApplicationService {
|
||||
|
||||
/**
|
||||
* 解析文件
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> parsingFiles(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 删除已经解析的数据
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> deleteParsedData(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package com.engine.secret.service;
|
||||
|
||||
import com.engine.secret.entity.unpack.UnpackParam;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import net.lingala.zip4j.ZipFile;
|
||||
import net.lingala.zip4j.model.FileHeader;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface UnpackZipService {
|
||||
|
||||
/**
|
||||
* 材料收件
|
||||
*
|
||||
* @param unpackParam
|
||||
* @param rootNode
|
||||
* @param imageFileMap
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Map<String, Object> registerAcceptance(ZipFile zipFile, UnpackParam unpackParam, JsonNode rootNode, Map<String, FileHeader> imageFileMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 材料补正
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> reviewResubmittedMaterials(ZipFile zipFile, String requestId, JsonNode rootNode, Map<String, FileHeader> imageFileMap);
|
||||
|
||||
/**
|
||||
* 删除文件解析数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> deleteParsedData(Map<String, Object> param);
|
||||
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
package com.engine.secret.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.secret.exception.CustomizeRunTimeException;
|
||||
import com.engine.secret.service.AuthorityChangeService;
|
||||
import com.engine.secret.util.FlowUtil;
|
||||
import com.engine.secret.util.ModeUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class AuthorityChangeServiceImpl extends Service implements AuthorityChangeService {
|
||||
@Override
|
||||
public Map<String, Object> delegateToProvincialAuthority(Map<String, Object> param) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String ids = Util.null2String(param.get("ids"));
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
throw new CustomizeRunTimeException("请至少选择一条数据");
|
||||
}
|
||||
String customId = Util.null2String(param.get("customId"));
|
||||
if (StringUtils.isBlank(customId)) {
|
||||
throw new CustomizeRunTimeException("未获取到查询列表ID");
|
||||
}
|
||||
String modeTableName = ModeUtil.getTableNameByCustomId(customId);
|
||||
rs.writeLog("ids==" + ids);
|
||||
rs.writeLog("customId==" + customId);
|
||||
rs.writeLog("modeTableName==" + modeTableName);
|
||||
String options = user.getLastname() + "-自动提交流程-";
|
||||
|
||||
// 查询对应的流程,并更新
|
||||
String[] split = ids.split(",");
|
||||
for (String s : split) {
|
||||
rs.writeLog("id==" + s);
|
||||
// 更新事权类别为省级事权
|
||||
rs.executeUpdate("update " + modeTableName + " set bmzzzgsqlb = ?,tjdqjd = ? where id =? ", 0, 1, s);
|
||||
// 查询对应的requestId
|
||||
rs.executeQuery("select requestId from " + modeTableName + " where id = ?", s);
|
||||
if (rs.next()) {
|
||||
String requestId = rs.getString("requestId");
|
||||
rs.writeLog("requestId==" + requestId);
|
||||
List<Integer> currentUserIds = FlowUtil.getCurrentUserIds(requestId);
|
||||
if (CollectionUtils.isEmpty(currentUserIds)) {
|
||||
throw new CustomizeRunTimeException("requestId[" + requestId + "],流程提交失败,未获取到当前节点处理人");
|
||||
}
|
||||
|
||||
String submitResult = FlowUtil.submitWorkflowRequest(requestId, currentUserIds.get(0), options + DateUtil.getFullDate());
|
||||
if (!"success".equals(submitResult)) {
|
||||
throw new CustomizeRunTimeException("requestId[" + requestId + "],流程提交失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package com.engine.secret.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.secret.exception.CustomizeRunTimeException;
|
||||
import com.engine.secret.instance.AutoGenerateNumberInstance;
|
||||
import com.engine.secret.service.AutoGenerateNumberService;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class AutoGenerateNumberServiceImpl extends Service implements AutoGenerateNumberService {
|
||||
|
||||
@Override
|
||||
public String getAcceptanceNumber(Map<String, Object> param) {
|
||||
Integer secretType = Convert.toInt(param.get("secretType"));
|
||||
Integer requestId = Convert.toInt(param.get("requestId"));
|
||||
if (null == secretType) {
|
||||
throw new CustomizeRunTimeException("未获取到[保密资质(资格)类型],请检查表单数据");
|
||||
}
|
||||
// 查询当前请求是否已经生成单号,如已生成过,直接取原来单号,不重新生成
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select num from uf_sldh_dt1 where request_id = ? ", requestId);
|
||||
if (rs.next()) {
|
||||
return rs.getString("num");
|
||||
}
|
||||
|
||||
AutoGenerateNumberInstance instance = AutoGenerateNumberInstance.getInstance();
|
||||
if (0 == secretType || 1 == secretType) {
|
||||
// 集成、印制
|
||||
return instance.getAcceptanceNumber(user, param);
|
||||
} else {
|
||||
// 军工
|
||||
return instance.getWarIndustryAcceptanceNumber(user, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,242 +0,0 @@
|
|||
package com.engine.secret.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.secret.entity.unpack.CheckFields;
|
||||
import com.engine.secret.entity.unpack.UnpackParam;
|
||||
import com.engine.secret.exception.CustomizeRunTimeException;
|
||||
import com.engine.secret.service.QualificationApplicationService;
|
||||
import com.engine.secret.service.UnpackZipService;
|
||||
import com.engine.secret.util.ConfigUtil;
|
||||
import com.engine.secret.util.ModeUtil;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wbi.util.Util;
|
||||
import net.lingala.zip4j.ZipFile;
|
||||
import net.lingala.zip4j.model.FileHeader;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.docs.docs.DocImageManager;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class QualificationApplicationServiceImpl extends Service implements QualificationApplicationService {
|
||||
|
||||
|
||||
public static final String CONFIG_TABLE_NAME = "uf_config_package";
|
||||
public static final String CONFIG_DETAIL_TABLE_NAME = "uf_config_package_dt1";
|
||||
public static final String FILE_DETAIL_TABLE_NAME = "uf_config_package_dt2";
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
Map<String, FileHeader> fileHeaderMap;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> parsingFiles(Map<String, Object> param) {
|
||||
try {
|
||||
Map<String, Object> returnMap;
|
||||
|
||||
String docId = Util.null2String(param.get("docId"));
|
||||
String requestId = Util.null2String(param.get("requestId"));
|
||||
String isCorrection = Util.null2String(param.get("isCorrection"));
|
||||
String checkFields = Util.null2String(param.get("checkFields"));
|
||||
if (StringUtils.isBlank(docId)) {
|
||||
throw new CustomizeRunTimeException("文件获取失败,请确认文件是否上传");
|
||||
}
|
||||
baseBean.writeLog("docId==" + docId);
|
||||
|
||||
if (StringUtils.isBlank(requestId)) {
|
||||
throw new CustomizeRunTimeException("流程关联失败,未获取到流程ID,请保存后重试");
|
||||
}
|
||||
|
||||
baseBean.writeLog("requestId==" + requestId);
|
||||
List<CheckFields> checkFieldsList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(checkFields)) {
|
||||
checkFieldsList = JSON.parseObject(checkFields, new TypeReference<List<CheckFields>>() {});
|
||||
}
|
||||
|
||||
UnpackParam unpackParam = UnpackParam.builder()
|
||||
.docId(docId)
|
||||
.requestId(requestId)
|
||||
.isCorrection(Boolean.parseBoolean(isCorrection))
|
||||
.checkFields(checkFieldsList)
|
||||
.build();
|
||||
|
||||
|
||||
// docId 转为换imageFileId
|
||||
DocImageManager imgManger = new DocImageManager();
|
||||
imgManger.setDocid(Integer.parseInt(docId));
|
||||
imgManger.selectDocImageInfo();
|
||||
imgManger.next();
|
||||
String imageFileId = imgManger.getImagefileid();
|
||||
baseBean.writeLog("imageFileId==" + imageFileId);
|
||||
if (StringUtils.isBlank(imageFileId) || "-1".equals(imageFileId)) {
|
||||
throw new CustomizeRunTimeException("文件获取失败,请确认文件是否上传,imageFileId=[" + imageFileId + "]");
|
||||
}
|
||||
|
||||
|
||||
// 初始化配置
|
||||
String unzipPwd = ConfigUtil.getConfig("UNZIP_PWD");
|
||||
baseBean.writeLog("unzipPwd==" + unzipPwd);
|
||||
|
||||
|
||||
// 根据文件id获取文件流
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(Integer.parseInt(imageFileId));
|
||||
manager.getImageFileName();
|
||||
InputStream inputStream = manager.getInputStream();
|
||||
|
||||
Path fixedDir = Paths.get(GCONST.getRootPath() + "filesystem" + File.separatorChar + "downloadBatchTemp");
|
||||
Files.createDirectories(fixedDir);
|
||||
Path tempZipFile = Files.createTempFile(fixedDir, "offline_temp_", ".zip");
|
||||
baseBean.writeLog("tempZipFile==" + tempZipFile.toString());
|
||||
Files.copy(inputStream, tempZipFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
//解压文件,处理压缩包
|
||||
baseBean.writeLog("开始解压文件,处理压缩包");
|
||||
returnMap = unzipWithPassword(tempZipFile, Paths.get("output"), unzipPwd, unpackParam);
|
||||
baseBean.writeLog("压缩包处理完成");
|
||||
return returnMap;
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog(e);
|
||||
throw new CustomizeRunTimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> deleteParsedData(Map<String, Object> param) {
|
||||
|
||||
UnpackZipService unpackZipService = ServiceUtil.getService(OfflineZipUnpackServiceImpl.class, user);
|
||||
return unpackZipService.deleteParsedData(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压ZIP文件
|
||||
*
|
||||
* @param zipFilePath
|
||||
* @param outputDir
|
||||
* @param password
|
||||
*/
|
||||
private Map<String, Object> unzipWithPassword(Path zipFilePath, Path outputDir, String password, UnpackParam unpackParam) {
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(zipFilePath.toFile());
|
||||
if (zipFile.isEncrypted()) {
|
||||
zipFile.setPassword(password.toCharArray());
|
||||
}
|
||||
// 遍历并解压所有文件
|
||||
zipFile.extractAll(outputDir.toString());
|
||||
baseBean.writeLog("已解压所有文件");
|
||||
|
||||
// 遍历 ZIP 内文件(可选)
|
||||
List<FileHeader> fileHeaders = zipFile.getFileHeaders();
|
||||
|
||||
//imageFileMap = new HashMap<>();
|
||||
fileHeaderMap = new HashMap<>();
|
||||
for (FileHeader header : fileHeaders) {
|
||||
if (header.isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
String fullPath = header.getFileName();
|
||||
int lastSlashIndex = fullPath.lastIndexOf('/');
|
||||
String fileName = (lastSlashIndex != -1)
|
||||
? fullPath.substring(lastSlashIndex + 1)
|
||||
: fullPath;
|
||||
fileHeaderMap.put(fileName, header);
|
||||
}
|
||||
|
||||
|
||||
baseBean.writeLog("fileHeaders.size==" + fileHeaders.size());
|
||||
baseBean.writeLog("fileHeaderMap.size==" + fileHeaderMap.size());
|
||||
baseBean.writeLog("fileHeaderMap==" + JSON.toJSONString(fileHeaderMap));
|
||||
|
||||
|
||||
// 获取数据文件,用于后续数据解析
|
||||
String jsonFileName = "(database)data.json";
|
||||
if (unpackParam.isCorrection()) {
|
||||
jsonFileName = "(extra)data.json";
|
||||
}
|
||||
FileHeader fileHeader = fileHeaderMap.get(jsonFileName);
|
||||
int dataJsonImageId = generateImageFileId(zipFile, fileHeader, jsonFileName);
|
||||
|
||||
if (dataJsonImageId > 0) {
|
||||
// 离线端方式
|
||||
JsonNode rootNode = parseJsonContent(dataJsonImageId);
|
||||
OfflineZipUnpackServiceImpl offlineZipUnpackService = ServiceUtil.getService(OfflineZipUnpackServiceImpl.class, user);
|
||||
if (unpackParam.isCorrection()) {
|
||||
return offlineZipUnpackService.reviewResubmittedMaterials(zipFile, unpackParam.getRequestId(), rootNode, fileHeaderMap);
|
||||
}
|
||||
return offlineZipUnpackService.registerAcceptance(zipFile, unpackParam, rootNode, fileHeaderMap);
|
||||
}
|
||||
|
||||
// TODO 兼容其他方式
|
||||
|
||||
return new HashMap<>();
|
||||
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage().contains("Wrong password")) {
|
||||
throw new CustomizeRunTimeException("数据包解压失败,密码错误");
|
||||
} else {
|
||||
baseBean.writeLog(e);
|
||||
throw new CustomizeRunTimeException(e.getMessage(), e);
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
Files.deleteIfExists(zipFilePath);
|
||||
} catch (IOException e) {
|
||||
baseBean.writeLog(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取JSON文件内容
|
||||
*
|
||||
* @param imageFieldId
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static JsonNode parseJsonContent(Integer imageFieldId) throws IOException {
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(imageFieldId);
|
||||
InputStream inputStream = manager.getInputStream();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
return mapper.readTree(inputStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件 返回imageFileId
|
||||
*
|
||||
* @param zipFile
|
||||
* @param header
|
||||
* @return
|
||||
*/
|
||||
private int generateImageFileId(ZipFile zipFile, FileHeader header, String fileName) {
|
||||
try (InputStream is = zipFile.getInputStream(header)) {
|
||||
return ModeUtil.generateImageFileId(is, fileName);
|
||||
} catch (Exception e) {
|
||||
throw new CustomizeRunTimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.engine.secret.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/31
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ConfigUtil {
|
||||
public static String getConfig(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return "";
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select value from uf_config where name = ?",name.trim());
|
||||
if(rs.next()){
|
||||
return rs.getString("value").trim();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.engine.secret.util;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2023/2/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ExceptionUtil {
|
||||
public static String getRealMessage(Throwable e) {
|
||||
while (e != null) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause == null) {
|
||||
return e.getMessage();
|
||||
}
|
||||
e = cause;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
package com.engine.secret.util;
|
||||
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.validator.GenericValidator;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/02
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class FieldConvertUtil {
|
||||
|
||||
/**
|
||||
* 转换存入数据库的值
|
||||
*
|
||||
* @param formfield
|
||||
* @param value
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Object getReallyValue(Formfield formfield, String value) throws Exception {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
Object object = null;
|
||||
String type = Util.null2String(formfield.getType());
|
||||
switch (formfield.getFieldhtmltype()) {
|
||||
case "1":
|
||||
// INPUT
|
||||
if ("2".equals(type)) {
|
||||
object = new BigDecimal(value).intValue();
|
||||
} else if ("3".equals(type)) {
|
||||
object = new BigDecimal(value).floatValue();
|
||||
} else if ("1".equals(type)) {
|
||||
object = value;
|
||||
} else {
|
||||
try {
|
||||
object = new BigDecimal(value).toPlainString();
|
||||
} catch (NumberFormatException ignore) {
|
||||
object = value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "3":
|
||||
// BROWSER
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject();
|
||||
jsonObject.put("fieldhtmltype", formfield.getFieldhtmltype());
|
||||
jsonObject.put("type", type);
|
||||
jsonObject.put("fieldvalue", value);
|
||||
if ("161".equals(type) || "162".equals(type)) {
|
||||
jsonObject.put("dmlurl", formfield.getFielddbtype());
|
||||
} else {
|
||||
jsonObject.put("dmlurl", type);
|
||||
}
|
||||
|
||||
jsonObject.put("fieldid", 0);
|
||||
object = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
// 如果是日期,校验日期的合法性
|
||||
if ("2".equals(type)) {
|
||||
boolean isDate = GenericValidator.isDate(Util.null2String(object), "yyyy-MM-dd", true);
|
||||
if (!isDate) {
|
||||
rs.writeLog("日期格式校验失败,object==" + Util.null2String(object));
|
||||
object = "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "5":
|
||||
// 区分单选、复选、下拉框
|
||||
switch (type) {
|
||||
case "1":
|
||||
case "3":
|
||||
// 下拉框、单选框
|
||||
object = ModeUtil.getSelectValue(formfield, value);
|
||||
if (StringUtils.isBlank(Util.null2String(object))) {
|
||||
if (isNumberOrCommaSeparatedNumbers(value)) {
|
||||
object = value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
List<String> selectValues = new ArrayList<>();
|
||||
// 兼容分隔符
|
||||
String separator = ",";
|
||||
if (value.contains("、")) {
|
||||
separator = "、";
|
||||
}
|
||||
String[] split = value.split(separator);
|
||||
for (String s : split) {
|
||||
selectValues.add(ModeUtil.getSelectValue(formfield, s));
|
||||
}
|
||||
object = StringUtils.join(selectValues, ",");
|
||||
if (StringUtils.isBlank(Util.null2String(object))) {
|
||||
if (isNumberOrCommaSeparatedNumbers(value)) {
|
||||
object = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case "4":
|
||||
// CHECKBOX
|
||||
case "6":
|
||||
// FILEUPLOAD
|
||||
break;
|
||||
case "7":
|
||||
// TEXT
|
||||
case "2":
|
||||
// TEXTAREA
|
||||
default:
|
||||
object = value;
|
||||
break;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行转换SQL
|
||||
*
|
||||
* @param convertSql
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String executeConvertSql(String convertSql, String value) {
|
||||
RecordSet rs = new RecordSet();
|
||||
value = Util.null2String(value);
|
||||
long count = convertSql.chars().filter(c -> c == '?').count();
|
||||
List<String> paramsList = new ArrayList<>();
|
||||
for (int i = 0; i < count; i++) {
|
||||
paramsList.add(value);
|
||||
}
|
||||
rs.executeQuery(convertSql, paramsList);
|
||||
if (rs.next()) {
|
||||
return rs.getString(1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验字符串是否为纯数字或逗号分隔的数字
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static boolean isNumberOrCommaSeparatedNumbers(String str) {
|
||||
// 正则表达式匹配纯数字或逗号分隔的数字
|
||||
// 允许前后有空格,数字之间用逗号分隔
|
||||
String regex = "^\\s*\\d+(\\s*,\\s*\\d+)*\\s*$";
|
||||
return str.matches(regex);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
package com.engine.secret.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.workflow.webservices.WorkflowRequestInfo;
|
||||
import weaver.workflow.webservices.WorkflowServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class FlowUtil {
|
||||
|
||||
/**
|
||||
* 根据流程请求ID,获取对应流程的表名
|
||||
*
|
||||
* @param requestId
|
||||
* @return
|
||||
*/
|
||||
public static String getTableNameByRequestId(String requestId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select a.tablename from workflow_bill a join workflow_base b on a.id = b.formid where b.id = ( select workflowid from workflow_requestbase where requestid = ?)", requestId);
|
||||
if (rs.next()) {
|
||||
return rs.getString("tablename");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取流程的当前处理人
|
||||
*
|
||||
* @param requestId
|
||||
* @return
|
||||
*/
|
||||
public static List<Integer> getCurrentUserIds(String requestId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select * from workflow_currentoperator where isremark = '0' and usertype = 0 and requestid=? order by id asc";
|
||||
List<Integer> currentUserIds = new ArrayList();
|
||||
rs.executeQuery(sql, requestId);
|
||||
while (rs.next()) {
|
||||
currentUserIds.add(Util.getIntValue(Util.null2String(rs.getString("userid"))));
|
||||
}
|
||||
return currentUserIds;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交流程到下一节点
|
||||
*
|
||||
* @param requestId
|
||||
* @param creator
|
||||
* @param opinions
|
||||
* @return
|
||||
*/
|
||||
public static String submitWorkflowRequest(String requestId, int creator, String opinions) {
|
||||
BaseBean bean = new BaseBean();
|
||||
WorkflowServiceImpl workflowService = new WorkflowServiceImpl();
|
||||
WorkflowRequestInfo wri = workflowService.getWorkflowRequest(Util.getIntValue(requestId, 0), creator, 0);
|
||||
bean.writeLog("wri==" + JSON.toJSONString(wri));
|
||||
return workflowService.submitWorkflowRequest(wri, Util.getIntValue(requestId, 0), creator, "submit", opinions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交流程到下一节点(机器人节点)
|
||||
*
|
||||
* @param requestId
|
||||
* @param opinions
|
||||
* @return
|
||||
*/
|
||||
public static String submitWorkflowRequest(String requestId, String opinions) {
|
||||
WorkflowServiceImpl workflowService = new WorkflowServiceImpl();
|
||||
return workflowService.submitWorkflowRequest(null, Util.getIntValue(requestId, 0), 0, "submit", opinions);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,477 +0,0 @@
|
|||
package com.engine.secret.util;
|
||||
|
||||
import com.engine.secret.exception.CustomizeRunTimeException;
|
||||
import com.weaver.formmodel.data.manager.FormInfoManager;
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.docs.docs.*;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.formmode.IgnoreCaseHashMap;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/03/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ModeUtil {
|
||||
|
||||
/**
|
||||
* 生成附件ID
|
||||
*
|
||||
* @param inputStream
|
||||
* @param filename
|
||||
* @return
|
||||
*/
|
||||
public static int generateImageFileId(InputStream inputStream, String filename) {
|
||||
int imageFileId;
|
||||
try {
|
||||
byte[] bytes = IOUtils.toByteArray(inputStream);
|
||||
ImageFileManager ifm = new ImageFileManager();
|
||||
ifm.setData(bytes);
|
||||
ifm.setImagFileName(filename);
|
||||
imageFileId = ifm.saveImageFile();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return imageFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件imageFieldId生成docId
|
||||
*
|
||||
* @param secCategory
|
||||
* @param imageFieldId
|
||||
* @param user
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static int createDocId(int secCategory, int imageFieldId, User user) throws Exception {
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(imageFieldId);
|
||||
String filenameqc = manager.getImageFileName();
|
||||
String filenamebc = filenameqc.substring(0, filenameqc.lastIndexOf("."));
|
||||
RecordSet rs = new RecordSet();
|
||||
DocManager dm = new DocManager();
|
||||
DocImageManager imgManger = new DocImageManager();
|
||||
|
||||
imgManger.setDocfiletype("2");
|
||||
|
||||
int docId = dm.getNextDocId(rs);
|
||||
imgManger.setDocid(docId);
|
||||
imgManger.setImagefileid(imageFieldId);
|
||||
imgManger.setImagefilename(filenameqc);
|
||||
imgManger.setIsextfile("1");
|
||||
imgManger.AddDocImageInfo();
|
||||
|
||||
String date = TimeUtil.getCurrentDateString();
|
||||
String time = TimeUtil.getOnlyCurrentTimeString();
|
||||
dm.setId(docId);
|
||||
dm.setMaincategory(0);
|
||||
dm.setSubcategory(0);
|
||||
dm.setSeccategory(secCategory);
|
||||
dm.setLanguageid(user.getLanguage());
|
||||
|
||||
dm.setDocstatus("1");
|
||||
dm.setDocsubject(filenamebc);
|
||||
dm.setDoccreaterid(user.getUID());
|
||||
dm.setDocCreaterType(user.getLogintype());
|
||||
dm.setUsertype(user.getLogintype());
|
||||
dm.setOwnerid(user.getUID());
|
||||
dm.setOwnerType(user.getLogintype());
|
||||
dm.setDoclastmoduserid(user.getUID());
|
||||
dm.setDocLastModUserType(user.getLogintype());
|
||||
dm.setDoccreatedate(date);
|
||||
dm.setDoclastmoddate(date);
|
||||
dm.setDoccreatetime(time);
|
||||
dm.setDoclastmodtime(time);
|
||||
dm.setDoclangurage(user.getLanguage());
|
||||
dm.setKeyword(filenameqc);
|
||||
dm.setIsapprover("0");
|
||||
dm.setIsreply("");
|
||||
dm.setDocdepartmentid(user.getUserDepartment());
|
||||
dm.setDocreplyable("1");
|
||||
dm.setAccessorycount(1);
|
||||
dm.setParentids("" + docId);
|
||||
dm.setUserid(user.getUID());
|
||||
DocCoder docCoder = new DocCoder();
|
||||
dm.setDocCode(docCoder.getDocCoder("" + secCategory));
|
||||
dm.setDocEditionId(dm.getNextEditionId(rs));
|
||||
dm.setDocEdition(1);
|
||||
dm.AddDocInfo();
|
||||
dm.AddShareInfo();
|
||||
DocViewer DocViewer = new DocViewer();
|
||||
DocViewer.setDocShareByDoc("" + docId);
|
||||
DocComInfo dc = new DocComInfo();
|
||||
dc.addDocInfoCache("" + docId);
|
||||
return docId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个记录映射
|
||||
*
|
||||
* @param rs RecordSet
|
||||
* @return
|
||||
*/
|
||||
public static IgnoreCaseHashMap<String, Object> getSingleRecordMap(RecordSet rs) {
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
if (rs.next()) {
|
||||
String[] columnNames = rs.getColumnName();
|
||||
for (String columnName : columnNames) {
|
||||
dataMap.put(columnName, parseBlankToNull(rs.getString(columnName)));
|
||||
}
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> getRecordMapList(RecordSet rs) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String[] columnNames = rs.getColumnName();
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
for (String columnName : columnNames) {
|
||||
dataMap.put(columnName.toLowerCase(), parseBlankToNull(rs.getString(columnName)));
|
||||
}
|
||||
list.add(dataMap);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
* @param dataMap 数据集合
|
||||
* @param tableName 表名
|
||||
*/
|
||||
public static void insertData(Map<String, Object> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<String> dataList = new ArrayList<>();
|
||||
List<String> paramList = new ArrayList<>();
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
if (null != value) {
|
||||
String valueStr = String.valueOf(value);
|
||||
if (StringUtils.isNotBlank(valueStr)) {
|
||||
fieldList.add(key);
|
||||
dataList.add(valueStr);
|
||||
paramList.add("?");
|
||||
}
|
||||
}
|
||||
});
|
||||
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(insertSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
public static void insertData(RecordSetTrans rs,Map<String, Object> dataMap, String tableName) throws Exception {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<String> dataList = new ArrayList<>();
|
||||
List<String> paramList = new ArrayList<>();
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
if (null != value) {
|
||||
String valueStr = String.valueOf(value);
|
||||
if (StringUtils.isNotBlank(valueStr)) {
|
||||
fieldList.add(key);
|
||||
dataList.add(valueStr);
|
||||
paramList.add("?");
|
||||
}
|
||||
}
|
||||
});
|
||||
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
|
||||
rs.executeUpdate(insertSql, dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tableName
|
||||
*/
|
||||
public static void updateDataById(Map<String, Object> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
dataMap.remove("id");
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
});
|
||||
dataList.add(id);
|
||||
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tableName
|
||||
*/
|
||||
public static void updateDataById(RecordSetTrans rs,Map<String, Object> dataMap, String tableName) throws Exception {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
dataMap.remove("id");
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
});
|
||||
dataList.add(id);
|
||||
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tableName
|
||||
* @param whereSql
|
||||
*/
|
||||
public static void updateData(Map<String, Object> dataMap, String tableName, String whereSql) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
});
|
||||
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + whereSql;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param deleteSql
|
||||
*/
|
||||
public static void deleteData(String deleteSql) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(deleteSql);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建建模表基本数据
|
||||
*
|
||||
* @param mainDataMap 参数集合
|
||||
*/
|
||||
public static void buildModeInsertFields(Map<String, Object> mainDataMap, int userId) {
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
String[] dateSplit = dateTime.split(" ");
|
||||
mainDataMap.put("modedatacreater", userId);
|
||||
mainDataMap.put("modedatacreatedate", dateSplit[0]);
|
||||
mainDataMap.put("modedatacreatetime", dateSplit[1]);
|
||||
mainDataMap.put("modedatacreatertype", "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建建模表基本数据
|
||||
*
|
||||
* @param mainDataMap 参数集合
|
||||
*/
|
||||
public static void buildModeUpdateFields(Map<String, Object> mainDataMap, int userId) {
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
mainDataMap.put("modedatamodifier", userId);
|
||||
mainDataMap.put("modedatamodifydatetime", dateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 建模表数据权限重构
|
||||
*
|
||||
* @param uuid
|
||||
* @param modeTable
|
||||
* @param formModeId
|
||||
*/
|
||||
public static int refreshRight(String uuid, String modeTable, int formModeId, int creator) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from " + modeTable + " where modeuuid='" + uuid + "'");
|
||||
if (rs.next()) {
|
||||
//建模数据的id
|
||||
int bid = Util.getIntValue(rs.getString("id"));
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.setNewRight(true);
|
||||
//新建的时候添加共享
|
||||
modeRightInfo.editModeDataShare(creator, formModeId, bid);
|
||||
return bid;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转换空字符串为null
|
||||
*
|
||||
* @param str 字符串
|
||||
* @return 转换后的字符串
|
||||
*/
|
||||
public static Object parseBlankToNull(String str) {
|
||||
return StringUtils.isBlank(str) ? null : str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换空字符串为null
|
||||
*
|
||||
* @param obj 对象
|
||||
* @return 转换后的字符串
|
||||
*/
|
||||
public static String parseBlankToNull(Object obj) {
|
||||
return Objects.isNull(obj) ? null : StringUtils.isBlank(obj.toString()) ? null : obj.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据建模表名,获取建模ID
|
||||
*
|
||||
* @param modeTable
|
||||
* @return
|
||||
*/
|
||||
public static int getModeIdByTableName(String modeTable) {
|
||||
int formModeId = -1;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? ) and isdelete = 0 order by id", modeTable);
|
||||
if (rs.next()) {
|
||||
formModeId = rs.getInt("id");
|
||||
}
|
||||
return formModeId;
|
||||
}
|
||||
|
||||
public static List<Formfield> getFieldList(String tableName) {
|
||||
int formId = getFormIdByTableName(tableName);
|
||||
return FormInfoManager.getInstance().getAllField(formId);
|
||||
}
|
||||
|
||||
public static List<Formfield> getFieldList(int formId) {
|
||||
return FormInfoManager.getInstance().getAllField(formId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据表名,获取表单ID
|
||||
*
|
||||
* @param modeTable
|
||||
* @return
|
||||
*/
|
||||
public static int getFormIdByTableName(String modeTable) {
|
||||
int formId = -1;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from workflow_bill where tablename = ? ", modeTable);
|
||||
if (rs.next()) {
|
||||
formId = rs.getInt("id");
|
||||
}
|
||||
return formId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单下拉框展示文本
|
||||
*
|
||||
* @param formId 表单ID
|
||||
* @param fieldName 字段明湖曾
|
||||
* @param value 下拉框值
|
||||
* @return
|
||||
*/
|
||||
public static String getSelectName(String formId, String fieldName, String value) {
|
||||
String cancelReason = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select selectname from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectvalue = ?", formId, fieldName, value);
|
||||
if (rs.next()) {
|
||||
cancelReason = rs.getString("selectname");
|
||||
}
|
||||
return cancelReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单下拉框值
|
||||
*
|
||||
* @param formId 表单ID
|
||||
* @param fieldName 字段明湖曾
|
||||
* @param selectName 下拉框展示内容
|
||||
* @return
|
||||
*/
|
||||
public static String getSelectValue(String formId, String fieldName, String selectName) {
|
||||
String selectValue = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectname = ?", formId, fieldName, selectName);
|
||||
if (rs.next()) {
|
||||
selectValue = rs.getString("selectvalue");
|
||||
}
|
||||
return selectValue;
|
||||
}
|
||||
|
||||
public static String getSelectValue(Formfield formfield, String selectName) {
|
||||
String selectValue = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String detailTable = Util.null2String(formfield.getDetailtable());
|
||||
if (StringUtils.isNotBlank(detailTable)) {
|
||||
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? and detailtable = ? ) and selectname = ?", formfield.getBillid(), formfield.getFieldname(), Util.null2String(detailTable), selectName);
|
||||
} else {
|
||||
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? AND (detailtable IS NULL OR detailtable = '') ) and selectname = ?", formfield.getBillid(), formfield.getFieldname(), selectName);
|
||||
}
|
||||
if (rs.next()) {
|
||||
selectValue = rs.getString("selectvalue");
|
||||
}
|
||||
return selectValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 全角转半角
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String ToDBC(String input) {
|
||||
if (input == null) {
|
||||
input = "";
|
||||
}
|
||||
char[] c = input.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == 12288) {
|
||||
//全角空格为12288,半角空格为32
|
||||
c[i] = (char) 32;
|
||||
continue;
|
||||
}
|
||||
if (c[i] > 65280 && c[i] < 65375) {
|
||||
//其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
|
||||
c[i] = (char) (c[i] - 65248);
|
||||
}
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
public static String getTableNameByCustomId(String customId) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select tablename from workflow_bill where id = (select formid from mode_customsearch where id = ?)", customId);
|
||||
if (rs.next()) {
|
||||
return rs.getString("tablename");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
package com.engine.secret.util;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.core.exception.ECException;
|
||||
import com.engine.secret.exception.CustomizeRunTimeException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 请求执行器
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class ResponseResult<T, R> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final User user;
|
||||
|
||||
private final BaseBean baseBean = new BaseBean();
|
||||
|
||||
private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log"));
|
||||
|
||||
public ResponseResult(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一返回方法(自定义返回格式)
|
||||
*/
|
||||
public String customRun(Function<T, R> f, T t) {
|
||||
try {
|
||||
if (isLog) {
|
||||
log.info("run api , param {}", t);
|
||||
}
|
||||
return getJsonString(f.apply(t));
|
||||
} catch (com.engine.secret.exception.CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
log.error("api run fail", e);
|
||||
Throwable cause = e.getCause();
|
||||
return Error(cause.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("api run fail", e);
|
||||
return Error("系统异常!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一返回方法
|
||||
*/
|
||||
public String run(Function<T, R> f, T t) {
|
||||
try {
|
||||
if (isLog) {
|
||||
log.info("run api , param {}", t);
|
||||
}
|
||||
return Ok(f.apply(t));
|
||||
} catch (com.engine.secret.exception.CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
log.error("api run fail", e);
|
||||
Throwable cause = e.getCause();
|
||||
return Error(cause.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("api run fail", e);
|
||||
return Error("系统异常!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一返回方法(有参无返回)
|
||||
*/
|
||||
public String run(Consumer<T> f, T t) {
|
||||
try {
|
||||
if (isLog) {
|
||||
log.info("run api , param {}", t);
|
||||
}
|
||||
f.accept(t);
|
||||
return Ok();
|
||||
} catch (com.engine.secret.exception.CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(ExceptionUtil.getRealMessage(e));
|
||||
} catch (Exception e) {
|
||||
log.error("api run fail", e);
|
||||
return Error("系统异常!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统一返回方法(无参有返回)
|
||||
*/
|
||||
public String run(Supplier<R> f) {
|
||||
try {
|
||||
if (isLog) {
|
||||
log.info("run api");
|
||||
}
|
||||
return Ok(f.get());
|
||||
} catch (CustomizeRunTimeException e) {
|
||||
log.error("api run fail", e);
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
log.error("api run fail", e);
|
||||
Throwable cause = e.getCause();
|
||||
return Error(cause.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("api run fail", e);
|
||||
return Error("系统异常!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String getJsonString(Object apidatas) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
return mapper.writeValueAsString(apidatas);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成功返回
|
||||
*/
|
||||
private String Ok() {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
apidatas.put("api_status", true);
|
||||
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成功返回
|
||||
*/
|
||||
private String Ok(R r) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
apidatas.put("api_status", true);
|
||||
apidatas.put("data", r);
|
||||
String success = JSON.toJSONString(apidatas);
|
||||
if (isLog) {
|
||||
log.info("run salary api success return {}", success);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 失败返回
|
||||
*/
|
||||
private static String Error(String message) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("errormsg", message);
|
||||
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 系统异常失败返回
|
||||
*/
|
||||
private static String Error(String message, Exception e) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("errormsg", message);
|
||||
apidatas.put("error", e.getMessage());
|
||||
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package com.engine.secret.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.secret.service.AuthorityChangeService;
|
||||
import com.engine.secret.service.impl.AuthorityChangeServiceImpl;
|
||||
import com.engine.secret.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class AuthorityChangeController {
|
||||
public AuthorityChangeService getService(User user) {
|
||||
return ServiceUtil.getService(AuthorityChangeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/delegateToProvincialAuthority")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String delegateToProvincialAuthority(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::delegateToProvincialAuthority, params);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
package com.engine.secret.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.secret.service.AutoGenerateNumberService;
|
||||
import com.engine.secret.service.impl.AutoGenerateNumberServiceImpl;
|
||||
import com.engine.secret.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class AutoGenerateNumberController {
|
||||
public AutoGenerateNumberService getService(User user) {
|
||||
return ServiceUtil.getService(AutoGenerateNumberServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getAcceptanceNumber")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getAcceptanceNumber(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> param = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, String>(user).run(getService(user)::getAcceptanceNumber, param);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.engine.secret.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.secret.service.QualificationApplicationService;
|
||||
import com.engine.secret.service.impl.QualificationApplicationServiceImpl;
|
||||
import com.engine.secret.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class QualificationApplicationController {
|
||||
public QualificationApplicationService getService(User user) {
|
||||
return ServiceUtil.getService(QualificationApplicationServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/parsingFiles")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String parsingFiles(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::parsingFiles, params);
|
||||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/deleteParsedData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteParsedData(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::deleteParsedData, params);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
package weaver.interfaces.secret.action;
|
||||
|
||||
import com.engine.secret.util.FlowUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 审批复核 归档Action
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ApprovalReviewEndAction implements Action {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, String> mainDataMap = new HashMap<>();
|
||||
for (Property property : properties) {
|
||||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
// 获取主流程ID
|
||||
String mainRequestId = mainDataMap.get("zlcid");
|
||||
if (StringUtils.isBlank(mainRequestId)) {
|
||||
requestInfo.getRequestManager().setMessagecontent("未获取到主流程请求ID");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
// 获取审批复核结论
|
||||
String conclusion = mainDataMap.get("spfhjl");
|
||||
|
||||
// 更新主流程表单的审批复核结论
|
||||
String tableNameByRequestId = FlowUtil.getTableNameByRequestId(mainRequestId);
|
||||
if (StringUtils.isBlank(tableNameByRequestId)) {
|
||||
requestInfo.getRequestManager().setMessagecontent("主流程表单名称获取异常,请确认");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
String sql = "update " + tableNameByRequestId + " set spfhjl = ? where requestid = ?";
|
||||
|
||||
rs.writeLog("mainRequestId==" + mainRequestId);
|
||||
rs.writeLog("conclusion==" + conclusion);
|
||||
rs.writeLog("tableNameByRequestId==" + tableNameByRequestId);
|
||||
rs.writeLog("sql==" + sql);
|
||||
|
||||
rs.executeUpdate(sql, conclusion, mainRequestId);
|
||||
|
||||
// 更新完成后,自动提交流程到下一节点
|
||||
rs.writeLog("mainRequestId==" + mainRequestId);
|
||||
String options = requestInfo.getCreatorid() + "-自动提交流程-" + DateUtil.getFullDate();
|
||||
String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, options);
|
||||
if (!"success".equals(submitResult)) {
|
||||
requestInfo.getRequestManager().setMessagecontent("requestId[" + mainRequestId + "],流程提交失败");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
package weaver.interfaces.secret.action;
|
||||
|
||||
import com.engine.secret.util.ConfigUtil;
|
||||
import com.engine.secret.util.FlowUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class MeetingConveningEndAction implements Action {
|
||||
RecordSet rs = new RecordSet();
|
||||
private static final String MAIN_FLOW_TABLE = ConfigUtil.getConfig("xqxksqlc_table");
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
try {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
Map<String, String> mainDataMap = new HashMap<>();
|
||||
List<Map<String, String>> detailMapList = new ArrayList<>();
|
||||
for (Property property : properties) {
|
||||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable detailTable = detailTableInfo.getDetailTable(0);
|
||||
String detailTableName = detailTable.getTableDBName();
|
||||
String updateDetailSql = "update " + detailTableName + " set zlctjzt = ? where id = ?";
|
||||
Row[] rows = detailTable.getRow();
|
||||
for (Row row : rows) {
|
||||
Map<String, String> detailDataMap = new HashMap<>(mainDataMap);
|
||||
Cell[] cells = row.getCell();
|
||||
String detailId = row.getId();
|
||||
for (Cell cell : cells) {
|
||||
detailDataMap.put(cell.getName(), cell.getValue());
|
||||
}
|
||||
detailDataMap.put("detailId", detailId);
|
||||
detailMapList.add(detailDataMap);
|
||||
}
|
||||
|
||||
Set<String> errorMsg = new HashSet<>();
|
||||
if (CollectionUtils.isNotEmpty(detailMapList)) {
|
||||
for (Map<String, String> detail : detailMapList) {
|
||||
dealMainFlow(requestInfo, detail, updateDetailSql, errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据错误信息,返回提示
|
||||
if (CollectionUtils.isNotEmpty(errorMsg)) {
|
||||
requestInfo.getRequestManager().setMessagecontent(StringUtils.join(errorMsg, "<br/>"));
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交主流程
|
||||
*
|
||||
* @param requestInfo
|
||||
* @param detail
|
||||
* @param updateDetailSql
|
||||
* @param errorMsg
|
||||
*/
|
||||
private void dealMainFlow(RequestInfo requestInfo, Map<String, String> detail, String updateDetailSql, Set<String> errorMsg) {
|
||||
String mainId = detail.get("xzxksqdh");
|
||||
|
||||
|
||||
String conclusion = detail.get("spfhjl");
|
||||
String detailId = detail.get("detailId");
|
||||
String submitStatus = detail.get("zlctjzt");
|
||||
if ("1".equals(submitStatus)) {
|
||||
// 已经提交成功的流程,不重复处理
|
||||
return;
|
||||
}
|
||||
|
||||
String mainRequestId = "";
|
||||
rs.executeQuery("select requestid from " + MAIN_FLOW_TABLE + " where id = ?", mainId);
|
||||
if (rs.next()) {
|
||||
mainRequestId = rs.getString("requestid");
|
||||
}
|
||||
if (StringUtils.isBlank(mainRequestId)) {
|
||||
errorMsg.add("主流程ID[" + mainId + "],主流程requestId获取异常,请确认");
|
||||
rs.executeUpdate(updateDetailSql, "2", detailId);
|
||||
return;
|
||||
}
|
||||
|
||||
rs.writeLog("mainRequestId==" + mainRequestId);
|
||||
rs.writeLog("conclusion==" + conclusion);
|
||||
|
||||
rs.executeUpdate("update " + MAIN_FLOW_TABLE + " set spfhjl = ? where requestid = ?", conclusion, mainRequestId);
|
||||
|
||||
// 更新完成后,自动提交流程到下一节点
|
||||
rs.writeLog("mainRequestId==" + mainRequestId);
|
||||
String options = requestInfo.getCreatorid() + "-自动提交流程-" + DateUtil.getFullDate();
|
||||
String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, options);
|
||||
if (!"success".equals(submitResult)) {
|
||||
errorMsg.add("requestId[" + mainRequestId + "],流程提交失败");
|
||||
rs.executeUpdate(updateDetailSql, "2", detailId);
|
||||
} else {
|
||||
rs.executeUpdate(updateDetailSql, "1", detailId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
package weaver.interfaces.ythpt.workflow;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* 审批复核 归档Action
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class LegalReviewAction implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
int requestId = Util.getIntValue(requestInfo.getRequestid());
|
||||
String formTableName = requestInfo.getRequestManager().getBillTableName();
|
||||
User user = requestInfo.getRequestManager().getUser();
|
||||
String userId = String.valueOf(user.getUID());
|
||||
|
||||
String bdbh = "";
|
||||
String ay = "";
|
||||
int zlcid = 0;
|
||||
String dsr = "";
|
||||
String zfry = "";
|
||||
String bsrq = "";
|
||||
String jbqk = "";
|
||||
String nzcdjdyj = "";
|
||||
String shyj = "";
|
||||
String shr = "";
|
||||
String shrq = "";
|
||||
String mainId = "";
|
||||
String sql = "select * from " + formTableName + " where requestid=" + requestId;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
zlcid = Util.getIntValue(Util.null2String(rs.getString("zlcid")));
|
||||
bdbh = Util.null2String(rs.getString("bdbh"));
|
||||
ay = Util.null2String(rs.getString("ay"));
|
||||
dsr = Util.null2String(rs.getString("dsr"));
|
||||
zfry = Util.null2String(rs.getString("zfry"));
|
||||
bsrq = Util.null2String(rs.getString("bsrq"));
|
||||
jbqk = Util.null2String(rs.getString("jbqk"));
|
||||
nzcdjdyj = Util.null2String(rs.getString("nzcdjdyj"));
|
||||
shyj = Util.null2String(rs.getString("shyj"));
|
||||
shr = Util.null2String(rs.getString("shr"));
|
||||
shrq = Util.null2String(rs.getString("shrq"));
|
||||
mainId = Util.null2String(rs.getString("mainId"));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(mainId)){
|
||||
sql = " select * from "+formTableName+"_dt1 where mainid = "+mainId+" order by id";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String glscx = Util.null2String(rs.getString("glscx"));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
bb.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessageid("1111");
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,241 +0,0 @@
|
|||
package weaver.interfaces.ythpt.workflow;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.secret.util.ConfigUtil;
|
||||
import com.engine.workflow.biz.freeNode.FreeNodeBiz;
|
||||
import com.engine.workflow.constant.PAResponseCode;
|
||||
import com.engine.workflow.entity.publicApi.PAResponseEntity;
|
||||
import com.engine.workflow.entity.publicApi.ReqOperateRequestEntity;
|
||||
import com.engine.workflow.publicApi.WorkflowRequestOperatePA;
|
||||
import com.engine.workflow.publicApi.impl.WorkflowRequestOperatePAImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 审批复核 归档Action
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/04/09
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class WorkflowMonitorAction implements Action {
|
||||
private WorkflowRequestOperatePA getRequestOperatePA() {
|
||||
return (WorkflowRequestOperatePAImpl) ServiceUtil.getService(WorkflowRequestOperatePAImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
String ip = requestInfo.getRequestManager().getIp();
|
||||
int requestId = Util.getIntValue(requestInfo.getRequestid());
|
||||
String formTableName = requestInfo.getRequestManager().getBillTableName();
|
||||
User user = requestInfo.getRequestManager().getUser();
|
||||
String userId = String.valueOf(user.getUID());
|
||||
|
||||
|
||||
String spfhjl = "";
|
||||
String thgc = "";
|
||||
int zlcid = 0;
|
||||
String sql = "select spfhjl,zlcid,thgc from " + formTableName + " where requestid=" + requestId;
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
spfhjl = Util.null2String(rs.getString("spfhjl"));
|
||||
zlcid = Util.getIntValue(Util.null2String(rs.getString("zlcid")));
|
||||
thgc = Util.null2String(rs.getString("thgc"));
|
||||
}
|
||||
|
||||
if("2".equals(spfhjl)){
|
||||
WorkflowRequestOperatePA operatePA = getRequestOperatePA();
|
||||
String nodeId = "";
|
||||
if("0".equals(thgc)){
|
||||
nodeId = ConfigUtil.getConfig("smsc_nodeid");
|
||||
}else if("1".equals(thgc)){
|
||||
nodeId = ConfigUtil.getConfig("xcsc_nodeid");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(nodeId)){
|
||||
bb.writeLog("~~~~doIntervenor接口报文~~~~userId:"+user.getUID());
|
||||
if(zlcid > 0){
|
||||
ReqOperateRequestEntity reqOperateRequestEntity = intervenor2Entity(zlcid,ip,userId,nodeId);
|
||||
PAResponseEntity paResponseEntity = operatePA.doIntervenor(user,reqOperateRequestEntity);
|
||||
PAResponseCode paResponseCode = paResponseEntity.getCode();
|
||||
bb.writeLog("PAResponseCode:"+paResponseCode);
|
||||
if(paResponseCode.getStatusCode() == 1){
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
String xcscFormtable = ConfigUtil.getConfig("xcsc_formtable");
|
||||
sql = " select t.requestid " +
|
||||
" from "+xcscFormtable+" t " +
|
||||
" inner join workflow_requestbase k on k.requestid = t.requestid " +
|
||||
" where t.zlcid = "+zlcid +" and k.currentoperatortype in(0,1,2) ";
|
||||
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.executeQuery(sql);
|
||||
while(rs.next()){
|
||||
String requestid = Util.null2String(rs.getString("requestid"));
|
||||
list.add(requestid);
|
||||
}
|
||||
bb.writeLog("list:"+list.size());
|
||||
int errcount = 0;
|
||||
for(String lcid : list){
|
||||
bb.writeLog("lcid:"+lcid);
|
||||
|
||||
PAResponseEntity forceoverEntity = doForceOver(user,Integer.parseInt(lcid),ip);
|
||||
PAResponseCode pa_ResponseCode = forceoverEntity.getCode();
|
||||
bb.writeLog("code:"+pa_ResponseCode.getStatusCode());
|
||||
if(pa_ResponseCode.getStatusCode() != 1){
|
||||
errcount++;
|
||||
}
|
||||
}
|
||||
if(errcount > 0){
|
||||
requestInfo.getRequestManager().setMessageid("1111");
|
||||
requestInfo.getRequestManager().setMessagecontent("现场检查流程强制归档失败");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
}else{
|
||||
requestInfo.getRequestManager().setMessageid("1111");
|
||||
requestInfo.getRequestManager().setMessagecontent("干预行政许可主流程失败");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
bb.writeLog(e);
|
||||
requestInfo.getRequestManager().setMessageid("1111");
|
||||
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
public ReqOperateRequestEntity intervenor2Entity(int requestId,String ip,String userId,String nodeId) {
|
||||
ReqOperateRequestEntity operateRequestEntity = new ReqOperateRequestEntity();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
if(requestId > 0){
|
||||
|
||||
// 干预是否执行节点前附加操作
|
||||
boolean enableIntervenor = true;
|
||||
// 会签类型 0 :非会签 1:会签 2:依次逐个处理
|
||||
String SignType = "0";
|
||||
String remark = "";
|
||||
//干预节点接收人,多个人以","号隔开
|
||||
String Intervenorid = userId;
|
||||
// 目标节点ID
|
||||
int submitNodeId = Util.getIntValue(nodeId) ;
|
||||
|
||||
int workflowId = 0;
|
||||
String requestName = "";
|
||||
|
||||
// int userId = 0;
|
||||
// int forwardFlag = 0;
|
||||
// String forwardResourceIds = "";
|
||||
// int isremind = 0;
|
||||
|
||||
String sql = " select workflowid,requestname from workflow_requestbase where requestid = "+requestId ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
requestName = Util.null2String(rs.getString("requestname"));
|
||||
workflowId = Util.getIntValue(rs.getString("workflowid"));
|
||||
}
|
||||
|
||||
operateRequestEntity.setWorkflowId(workflowId);
|
||||
operateRequestEntity.setRequestId(requestId);
|
||||
operateRequestEntity.setRequestName(requestName);
|
||||
// operateRequestEntity.setUserId(userId);
|
||||
operateRequestEntity.setRemark(remark);
|
||||
// operateRequestEntity.setRequestLevel(requestLevel);
|
||||
// operateRequestEntity.setForwardFlag(forwardFlag);
|
||||
// operateRequestEntity.setForwardResourceIds(forwardResourceIds);
|
||||
operateRequestEntity.setClientIp(ip);
|
||||
// operateRequestEntity.setIsremind(isremind);
|
||||
//干预参数
|
||||
if (submitNodeId > 0 || FreeNodeBiz.isFreeNode(submitNodeId)) {
|
||||
operateRequestEntity.setSubmitNodeId(submitNodeId);
|
||||
operateRequestEntity.setEnableIntervenor(enableIntervenor);
|
||||
operateRequestEntity.setSignType(Util.getIntValue(Util.null2String(SignType), 0));
|
||||
operateRequestEntity.setIntervenorid(Util.null2String(Intervenorid));
|
||||
}
|
||||
bb.writeLog("workflowId:"+workflowId+" requestId:"+requestId+" requestName:"+requestName+"remark:"+remark+ " submitNodeId:"+submitNodeId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog(e);
|
||||
}
|
||||
return operateRequestEntity;
|
||||
}
|
||||
|
||||
|
||||
public PAResponseEntity doForceOver(User user, int requestId,String ip) {
|
||||
BaseBean bb = new BaseBean();
|
||||
WorkflowRequestOperatePA operatePA = getRequestOperatePA();
|
||||
bb.writeLog("~~~~doForceOver接口报文~~~~userId:"+user.getUID());
|
||||
PAResponseEntity paResponseEntity = operatePA.doForceOver(user, forceOver2Entity(requestId,ip));
|
||||
return paResponseEntity;
|
||||
}
|
||||
|
||||
|
||||
public ReqOperateRequestEntity forceOver2Entity(int requestId,String ip) {
|
||||
ReqOperateRequestEntity operateRequestEntity = new ReqOperateRequestEntity();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
if(requestId > 0){
|
||||
|
||||
String remark = "";
|
||||
int workflowId = 0;
|
||||
String requestName = "";
|
||||
String sql = " select workflowid,requestname from workflow_requestbase where requestid = "+requestId ;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
requestName = Util.null2String(rs.getString("requestname"));
|
||||
workflowId = Util.getIntValue(rs.getString("workflowid"));
|
||||
}
|
||||
|
||||
Map<String, Object> otherParams = new HashMap<String,Object>();
|
||||
otherParams.put("ismonitor","1");
|
||||
operateRequestEntity.setOtherParams(otherParams);
|
||||
|
||||
operateRequestEntity.setWorkflowId(workflowId);
|
||||
operateRequestEntity.setRequestId(requestId);
|
||||
operateRequestEntity.setRequestName(requestName);
|
||||
// operateRequestEntity.setUserId(userId);
|
||||
operateRequestEntity.setRemark(remark);
|
||||
// operateRequestEntity.setRequestLevel(requestLevel);
|
||||
// operateRequestEntity.setForwardFlag(forwardFlag);
|
||||
// operateRequestEntity.setForwardResourceIds(forwardResourceIds);
|
||||
operateRequestEntity.setClientIp(ip);
|
||||
// operateRequestEntity.setIsremind(isremind);
|
||||
|
||||
bb.writeLog("workflowId:"+workflowId+" requestId:"+requestId+" requestName:"+requestName+"remark:"+remark);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog(e);
|
||||
}
|
||||
return operateRequestEntity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,246 +0,0 @@
|
|||
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
|
||||
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.engine.kq.entity.TimeScopeEntity" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.time.temporal.ChronoUnit" %>
|
||||
<%@ page import="java.time.LocalDate" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="com.engine.kq.service.KQAttendanceEventService" %>
|
||||
<%@ page import="com.engine.kq.service.impl.KQAttendanceEventServiceImpl" %>
|
||||
<%@ page import="com.engine.common.util.ServiceUtil" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
||||
<%@ page import="java.text.DecimalFormat" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String resourceId = request.getParameter("resourceId");
|
||||
String newLeaveType = request.getParameter("newLeaveType");
|
||||
|
||||
String fromDate = request.getParameter("fromDate");
|
||||
String toDate = request.getParameter("toDate");
|
||||
String fromTime = request.getParameter("fromTime");
|
||||
String toTime = request.getParameter("toTime");
|
||||
|
||||
User user = HrmUserVarify.getUser (request , response) ;
|
||||
double total_duration =0.0;
|
||||
double total_workday = 0.0 ;
|
||||
JSONArray dayArray = new JSONArray();
|
||||
|
||||
if(StringUtils.isNotBlank(newLeaveType)){
|
||||
String minimumUnit = "";
|
||||
String sql = " select minimumUnit from kq_LeaveRules where (isDelete is null or isDelete!=1) and id = "+newLeaveType;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
minimumUnit = Util.null2String(rs.getString("minimumUnit"));
|
||||
}
|
||||
if("3".equals(minimumUnit)){
|
||||
if(fromDate.equals(toDate)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",fromDate);
|
||||
params.put("fromTime",fromTime);
|
||||
params.put("toDate",toDate);
|
||||
params.put("toTime",toTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
total_duration += duration;
|
||||
int workMins = 0 ;
|
||||
if(min_duration > 0){
|
||||
if(StringUtils.isNotBlank(resourceId) && StringUtils.isNotBlank(fromDate)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, fromDate);
|
||||
if(workTime !=null){
|
||||
workMins = workTime.getWorkMins();
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject dayJson = new JSONObject();
|
||||
dayJson.put("duration",duration);
|
||||
dayJson.put("min_duration",min_duration);
|
||||
dayJson.put("workMins",workMins);
|
||||
dayJson.put("total_workday",total_workday);
|
||||
dayArray.add(dayJson);
|
||||
}else{
|
||||
LocalDate qjksrq_date = LocalDate.parse(fromDate);
|
||||
LocalDate qjjsrq_date = LocalDate.parse(toDate);
|
||||
List<String> qjrqList = new ArrayList<String>();
|
||||
long numOfDaysBetween = ChronoUnit.DAYS.between(qjksrq_date, qjjsrq_date);
|
||||
for (int i = 0; i <= numOfDaysBetween; i++) {
|
||||
LocalDate date = qjksrq_date.plusDays(i);
|
||||
qjrqList.add(date.toString());
|
||||
}
|
||||
for(int i=0;i<qjrqList.size();i++){
|
||||
String kq_date = qjrqList.get(i);
|
||||
if(i==0){
|
||||
|
||||
if(StringUtils.isNotBlank(resourceId) && StringUtils.isNotBlank(kq_date)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
String endTime = "" ;
|
||||
if(workTime.getWorkTime() !=null){
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotBlank(endTime)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",kq_date);
|
||||
params.put("fromTime",fromTime);
|
||||
params.put("toDate",kq_date);
|
||||
params.put("toTime",endTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
|
||||
total_duration += duration;
|
||||
|
||||
if(min_duration > 0){
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
|
||||
JSONObject dayJson = new JSONObject();
|
||||
dayJson.put("duration",duration);
|
||||
dayJson.put("min_duration",min_duration);
|
||||
dayJson.put("workMins",workMins);
|
||||
dayJson.put("total_workday",total_workday);
|
||||
dayArray.add(dayJson);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else if(i==(qjrqList.size()-1)){
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kq_date);
|
||||
if(workTime !=null) {
|
||||
int workMins = workTime.getWorkMins();
|
||||
String beginTime = "";
|
||||
if(workTime.getWorkTime() !=null){
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(beginTime)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",kq_date);
|
||||
params.put("fromTime",beginTime);
|
||||
params.put("toDate",kq_date);
|
||||
params.put("toTime",toTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
|
||||
total_duration += duration;
|
||||
|
||||
if(min_duration > 0){
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
|
||||
JSONObject dayJson = new JSONObject();
|
||||
dayJson.put("duration",duration);
|
||||
dayJson.put("min_duration",min_duration);
|
||||
dayJson.put("workMins",workMins);
|
||||
dayJson.put("total_workday",total_workday);
|
||||
dayArray.add(dayJson);
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
|
||||
String beginTime = "";
|
||||
String endTime = "" ;
|
||||
if(workTime.getWorkTime() !=null){
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",kq_date);
|
||||
params.put("fromTime",beginTime);
|
||||
params.put("toDate",kq_date);
|
||||
params.put("toTime",endTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
|
||||
total_duration += duration;
|
||||
|
||||
if(min_duration > 0){
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
|
||||
JSONObject dayJson = new JSONObject();
|
||||
dayJson.put("duration",duration);
|
||||
dayJson.put("min_duration",min_duration);
|
||||
dayJson.put("workMins",workMins);
|
||||
dayJson.put("total_workday",total_workday);
|
||||
dayArray.add(dayJson);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
String total_days = df.format(total_workday);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("workday",total_days);
|
||||
jsonObject.put("total_duration",total_duration);
|
||||
jsonObject.put("dayArray",dayArray);
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
private KQAttendanceEventService getService(User user) {
|
||||
return (KQAttendanceEventServiceImpl) ServiceUtil.getService(KQAttendanceEventServiceImpl.class, user);
|
||||
}
|
||||
%>
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
|
@ -1,232 +0,0 @@
|
|||
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
|
||||
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.engine.kq.entity.TimeScopeEntity" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.time.temporal.ChronoUnit" %>
|
||||
<%@ page import="java.time.LocalDate" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
||||
<%@ page import="com.engine.kq.service.KQAttendanceEventService" %>
|
||||
<%@ page import="com.engine.kq.service.impl.KQAttendanceEventServiceImpl" %>
|
||||
<%@ page import="com.engine.common.util.ServiceUtil" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page import="java.text.DecimalFormat" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String resourceId = request.getParameter("resourceId");
|
||||
String newLeaveType = request.getParameter("newLeaveType");
|
||||
|
||||
String fromDate = request.getParameter("fromDate");
|
||||
String toDate = request.getParameter("toDate");
|
||||
String fromTime = request.getParameter("fromTime");
|
||||
String toTime = request.getParameter("toTime");
|
||||
out.print("resourceId:"+resourceId+"</br>");
|
||||
out.print("newLeaveType:"+newLeaveType+"</br>");
|
||||
out.print("fromDate:"+fromDate+"</br>");
|
||||
out.print("toDate:"+toDate+"</br>");
|
||||
out.print("fromTime:"+fromTime+"</br>");
|
||||
out.print("toTime:"+toTime+"</br>");
|
||||
|
||||
User user = HrmUserVarify.getUser (request , response) ;
|
||||
double total_workday =0.0;
|
||||
if(StringUtils.isNotBlank(newLeaveType)){
|
||||
String minimumUnit = "";
|
||||
String sql = " select minimumUnit from kq_LeaveRules where (isDelete is null or isDelete!=1) and id = "+newLeaveType;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
minimumUnit = Util.null2String(rs.getString("minimumUnit"));
|
||||
}
|
||||
out.print("minimumUnit:"+minimumUnit+"</br>");
|
||||
if("3".equals(minimumUnit)){
|
||||
if(fromDate.equals(toDate)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",fromDate);
|
||||
params.put("fromTime",fromTime);
|
||||
params.put("toDate",toDate);
|
||||
params.put("toTime",toTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
out.print("params1:"+ JSON.toJSON(params)+"</br>");
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
|
||||
out.print("duration:"+ duration+"</br>");
|
||||
out.print("min_duration:"+ min_duration +"</br>");
|
||||
|
||||
if(min_duration > 0){
|
||||
if(StringUtils.isNotBlank(resourceId) && StringUtils.isNotBlank(fromDate)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, fromDate);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
out.print("workMins1:"+ workMins +"</br>");
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
out.print("total_workday:"+ total_workday +"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
LocalDate qjksrq_date = LocalDate.parse(fromDate);
|
||||
LocalDate qjjsrq_date = LocalDate.parse(toDate);
|
||||
List<String> qjrqList = new ArrayList<String>();
|
||||
long numOfDaysBetween = ChronoUnit.DAYS.between(qjksrq_date, qjjsrq_date);
|
||||
for (int i = 0; i <= numOfDaysBetween; i++) {
|
||||
LocalDate date = qjksrq_date.plusDays(i);
|
||||
qjrqList.add(date.toString());
|
||||
}
|
||||
out.print("qjrqList:"+qjrqList.size()+"</br>");
|
||||
|
||||
for(int i=0;i<qjrqList.size();i++){
|
||||
String kq_date = qjrqList.get(i);
|
||||
out.print("kq_date:"+kq_date+"</br>");
|
||||
if(i==0){
|
||||
|
||||
if(StringUtils.isNotBlank(resourceId) && StringUtils.isNotBlank(kq_date)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
String endTime = "" ;
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
out.print("kq_date:"+kq_date+"</br>");
|
||||
if(StringUtils.isNotBlank(endTime)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",kq_date);
|
||||
params.put("fromTime",fromTime);
|
||||
params.put("toDate",kq_date);
|
||||
params.put("toTime",endTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
out.print("params2:"+ JSON.toJSON(params)+"</br>");
|
||||
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
|
||||
out.print("duration:"+ duration+"</br>");
|
||||
out.print("min_duration:"+ min_duration +"</br>");
|
||||
out.print("workMins1:"+ workMins +"</br>");
|
||||
if(min_duration > 0 && workMins>0){
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
out.print("total_workday:"+ total_workday +"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else if(i==(qjrqList.size()-1)){
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kq_date);
|
||||
if(workTime !=null) {
|
||||
int workMins = workTime.getWorkMins();
|
||||
String beginTime = "";
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(beginTime)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",kq_date);
|
||||
params.put("fromTime",beginTime);
|
||||
params.put("toDate",kq_date);
|
||||
params.put("toTime",toTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
out.print("params3:"+ JSON.toJSON(params)+"</br>");
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
out.print("duration:"+ duration+"</br>");
|
||||
out.print("min_duration:"+ min_duration +"</br>");
|
||||
out.print("workMins1:"+ workMins +"</br>");
|
||||
if(min_duration > 0 && workMins >0){
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
out.print("total_workday:"+ total_workday +"</br>");
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
String beginTime = "";
|
||||
String endTime = "" ;
|
||||
if(workTime.getWorkTime() !=null){
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
|
||||
out.print("beginTime:"+beginTime);
|
||||
out.print("endTime:"+endTime);
|
||||
if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){
|
||||
Map<String, Object> params = new HashMap<String,Object>();
|
||||
params.put("newLeaveType",newLeaveType);
|
||||
params.put("resourceId",resourceId);
|
||||
params.put("fromDate",kq_date);
|
||||
params.put("fromTime",beginTime);
|
||||
params.put("toDate",kq_date);
|
||||
params.put("toTime",endTime);
|
||||
params.put("timestamp",System.currentTimeMillis());
|
||||
out.print("params4:"+ JSON.toJSON(params)+"</br>");
|
||||
Map<String, Object> apidatas = getService(user).getLeaveWorkDuration(params, user);
|
||||
double duration = Util.getDoubleValue(Util.null2String(apidatas.get("duration")));
|
||||
double min_duration = Util.getDoubleValue(Util.null2String(apidatas.get("min_duration")));
|
||||
out.print("workMins1:"+ workMins +"</br>");
|
||||
out.print("duration:"+ duration+"</br>");
|
||||
out.print("min_duration:"+ min_duration +"</br>");
|
||||
|
||||
if(min_duration > 0 && workMins >0){
|
||||
total_workday += (min_duration/(workMins*1.00));
|
||||
}
|
||||
out.print("total_workday:"+ total_workday +"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if(total_workMins > 0){
|
||||
// DecimalFormat df = new DecimalFormat("#.##");
|
||||
// workHour = df.format(leavetime/(total_workMins/60.00));
|
||||
// }
|
||||
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
String total_days = df.format(total_workday);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("workhour",total_days);
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
private KQAttendanceEventService getService(User user) {
|
||||
return (KQAttendanceEventServiceImpl) ServiceUtil.getService(KQAttendanceEventServiceImpl.class, user);
|
||||
}
|
||||
%>
|
||||
<%=jsonObject.toJSONString() %>
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
|
||||
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
|
||||
<%@ page import="java.text.DecimalFormat" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.engine.kq.entity.TimeScopeEntity" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.time.temporal.ChronoUnit" %>
|
||||
<%@ page import="java.time.LocalDate" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
RecordSet rs = new RecordSet();
|
||||
String userid = request.getParameter("userid");
|
||||
// String kq_date = request.getParameter("kq_date");
|
||||
String leaveid = request.getParameter("leaveid");
|
||||
double leavetime = Double.parseDouble(request.getParameter("leavetime"));
|
||||
String qjksrq = request.getParameter("qjksrq");
|
||||
String qjjsrq = request.getParameter("qjjsrq");
|
||||
String qjkssj = request.getParameter("qjkssj");
|
||||
String qjjssj = request.getParameter("qjjssj");
|
||||
out.print("userid:"+userid+"</br>");
|
||||
out.print("leaveid:"+leaveid+"</br>");
|
||||
out.print("leavetime:"+leavetime+"</br>");
|
||||
out.print("qjksrq:"+qjksrq+"</br>");
|
||||
out.print("qjjsrq:"+qjjsrq+"</br>");
|
||||
out.print("qjkssj:"+qjkssj+"</br>");
|
||||
out.print("qjjssj:"+qjjssj+"</br>");
|
||||
|
||||
|
||||
int total_workMins =0;
|
||||
|
||||
String workHour = String.valueOf(leavetime);
|
||||
String minimumUnit = "";
|
||||
String sql = " select minimumUnit from kq_LeaveRules where (isDelete is null or isDelete!=1) and id = "+leaveid;
|
||||
rs.executeQuery(sql);
|
||||
if(rs.next()){
|
||||
minimumUnit = Util.null2String(rs.getString("minimumUnit"));
|
||||
}
|
||||
|
||||
out.print("minimumUnit:"+minimumUnit+"</br>");
|
||||
|
||||
if("3".equals(minimumUnit)){
|
||||
if(qjksrq.equals(qjjsrq)){
|
||||
out.print("qjksrq:"+qjksrq+"</br>");
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userid, qjksrq);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
|
||||
String beginTime = "";
|
||||
String endTime = "" ;
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){
|
||||
if(qjkssj.compareTo(endTime) < 0){
|
||||
total_workMins+=workMins ;
|
||||
out.print("workMins:"+workMins+"</br>");
|
||||
out.print("workworkHour_:"+(workMins/60.00)+"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
LocalDate qjksrq_date = LocalDate.parse(qjksrq);
|
||||
LocalDate qjjsrq_date = LocalDate.parse(qjjsrq);
|
||||
List<String> qjrqList = new ArrayList<String>();
|
||||
long numOfDaysBetween = ChronoUnit.DAYS.between(qjksrq_date, qjjsrq_date);
|
||||
for (int i = 0; i <= numOfDaysBetween; i++) {
|
||||
LocalDate date = qjksrq_date.plusDays(i);
|
||||
qjrqList.add(date.toString());
|
||||
}
|
||||
|
||||
for(int i=0;i<qjrqList.size();i++){
|
||||
String kq_date = qjrqList.get(i);
|
||||
out.print("kq_date:"+kq_date+"</br>");
|
||||
if(i==0){
|
||||
if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(kq_date)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userid, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
String beginTime = "";
|
||||
String endTime = "" ;
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){
|
||||
if(qjkssj.compareTo(endTime) < 0){
|
||||
total_workMins+=workMins ;
|
||||
out.print("workMins:"+workMins+"</br>");
|
||||
out.print("workworkHour_:"+(workMins/60.00)+"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(i==qjrqList.size()){
|
||||
if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(kq_date)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userid, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
String beginTime = "";
|
||||
String endTime = "" ;
|
||||
List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
beginTime = timeScopeEntity.getBeginTime();
|
||||
endTime = timeScopeEntity.getEndTime();
|
||||
}
|
||||
if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){
|
||||
if(qjjssj.compareTo(beginTime) > 0){
|
||||
total_workMins+=workMins ;
|
||||
out.print("workMins:"+workMins+"</br>");
|
||||
out.print("workworkHour_:"+(workMins/60.00)+"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(kq_date)){
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userid, kq_date);
|
||||
if(workTime !=null){
|
||||
int workMins = workTime.getWorkMins();
|
||||
total_workMins+=workMins ;
|
||||
out.print("workMins:"+workMins+"</br>");
|
||||
out.print("workworkHour_:"+(workMins/60.00)+"</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.print("total_workMins:"+total_workMins+"</br>");
|
||||
out.print("total_workMins_:"+(total_workMins/60.00)+"</br>");
|
||||
// KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
// WorkTimeEntity workTime = kqWorkTime.getWorkTime(userid, kq_date);
|
||||
// if(workTime !=null){
|
||||
// out.println("SerialId:"+workTime.getSerialId()+"</br>");
|
||||
// out.println("WorkMins:"+workTime.getWorkMins()+"</br>");
|
||||
// out.println("GroupName:"+workTime.getGroupName()+"</br>");
|
||||
// int workMins = workTime.getWorkMins();
|
||||
// DecimalFormat df = new DecimalFormat("#.##");
|
||||
// String workHour = df.format(workMins/60.00);
|
||||
//
|
||||
// out.println("workHour1:"+(workMins/60.00)+"</br>");
|
||||
// out.println("workHour2:"+workHour+"</br>");
|
||||
// }
|
||||
// List<TimeScopeEntity> timeScopeEntityList = workTime.getWorkTime();
|
||||
// for(TimeScopeEntity timeScopeEntity : timeScopeEntityList){
|
||||
// out.println("BeginTime:"+timeScopeEntity.getBeginTime()+"</br>");
|
||||
// out.println("EndTime:"+timeScopeEntity.getEndTime()+"</br>");
|
||||
// out.println("WorkMins:"+timeScopeEntity.getWorkMins()+"</br>");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// int workmins = 0;
|
||||
// String serialid = "";
|
||||
// if("3".equals(minimumUnit)){
|
||||
// if(leavetime > 0){
|
||||
// if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(kq_date)){
|
||||
// KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
// WorkTimeEntity workTime = kqWorkTime.getWorkTime(userid, kq_date);
|
||||
// if(workTime !=null){
|
||||
// int workMins = workTime.getWorkMins();
|
||||
// DecimalFormat df = new DecimalFormat("#.##");
|
||||
// workHour = df.format(leavetime/(workMins/60.00));
|
||||
//
|
||||
// workmins = workTime.getWorkMins();
|
||||
//
|
||||
// serialid = workTime.getSerialId();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
workHour = df.format(leavetime/(total_workMins/60.00));
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("workhour",workHour);
|
||||
jsonObject.put("workmins",total_workMins);
|
||||
jsonObject.put("leavetime",leavetime);
|
||||
|
||||
%>
|
||||
<%=jsonObject.toJSONString() %>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 31acdace56260dc13abdef5c91b3d0b5504695a6
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#edc_uf_table160±íÄ£¿éid
|
||||
edc_formmodeid=52
|
||||
#uf_drztzbd±íÄ£¿éid
|
||||
uf_formmodeid=55
|
||||
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
## 得力云的key
|
||||
key=79e26d45aec2d152dba78419db2e622f
|
||||
|
||||
## 得力云的secret
|
||||
secret=hpgmkq03yzlujquiiovt2n63hqnb20d8
|
||||
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#员工关系更新提醒流程id
|
||||
workflowid=143
|
||||
|
||||
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
<%@ page import="okhttp3.OkHttpClient" %>
|
||||
<%@ page import="okhttp3.Request" %>
|
||||
<%@ page import="okhttp3.Response" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="com.engine.workflow.biz.NewRequestBiz" %>
|
||||
<%@ page import="weaver.workflow.workflow.WorkflowVersion" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="com.engine.workflow.entity.newRequest.WfType" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page import="com.engine.workflow.entity.newRequest.WfBean" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
BaseBean bb = new BaseBean();
|
||||
String pubkey = bb.getPropValue("CHATGPT","pubkey");
|
||||
RecordSet rs = new RecordSet();
|
||||
String userinfo = request.getParameter("userinfo") ;
|
||||
String query = request.getParameter("query");
|
||||
|
||||
out.print("userinfo:"+userinfo+"</br>");
|
||||
out.print("query:"+query+"</br>");
|
||||
|
||||
String host = bb.getPropValue("CHATGPT","host");
|
||||
String appid = bb.getPropValue("CHATGPT","appid");
|
||||
out.print("pubkey:"+pubkey+"</br>");
|
||||
out.print("host:"+host+"</br>");
|
||||
out.print("appid:"+appid+"</br>");
|
||||
String loginid = "" ;
|
||||
String userid = "";
|
||||
if(StringUtils.isNotBlank(userinfo)){
|
||||
String userSql = " select id,loginid from hrmresource where upper(md5(concat(loginid,'"+pubkey+"')))='"+userinfo.toUpperCase()+"'";
|
||||
out.print("userSql:"+userSql+"</br>");
|
||||
rs.executeQuery(userSql);
|
||||
if(rs.next()){
|
||||
loginid = Util.null2String(rs.getString("loginid"));
|
||||
userid = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
}
|
||||
out.print("loginid:"+loginid+"</br>");
|
||||
if(StringUtils.isNotBlank(loginid) && StringUtils.isNotBlank(appid)){
|
||||
String token = getToken(host,appid,loginid);
|
||||
out.print("token:"+token+"</br>");
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
||||
String[] workflowArray = query.split("\\$");
|
||||
|
||||
out.print("userid:"+userid+"</br>");
|
||||
User user = new User(Util.getIntValue(userid));
|
||||
out.print("user:"+user.getLastname()+"</br>");
|
||||
String inornot = "in";
|
||||
NewRequestBiz wfBiz = new NewRequestBiz(user);
|
||||
wfBiz.setNewRequestRange(WorkflowVersion.getAllVersionStringByWFIDs(""));
|
||||
wfBiz.setInornot(inornot);
|
||||
wfBiz.setIsmobile(false);
|
||||
wfBiz.setCustomSqlWhere("");//新建流程扩展条件
|
||||
List<WfType> wftypes = wfBiz.getWfInfo("");
|
||||
// out.print("wftypes:"+ JSON.toJSON(wftypes));
|
||||
for(WfType wfType : wftypes){
|
||||
List<WfBean> wfBeanList = wfType.getWfbeans();
|
||||
for(WfBean wfBean : wfBeanList){
|
||||
int count = 0;
|
||||
String wf_name = wfBean.getName();
|
||||
String workflowid = wfBean.getId();
|
||||
for(int i=0;i<workflowArray.length;i++) {
|
||||
String workflowname = workflowArray[i];
|
||||
if(!wf_name.contains(workflowname)){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
out.print("wf_name:"+ wf_name+"</br>");
|
||||
out.print("workflowid:"+ workflowid+"</br>");
|
||||
out.print("count:"+ count+"</br>");
|
||||
|
||||
if(count == 0){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("requestname",wf_name);
|
||||
jsonObject.put("pc_url","/workflow/request/CreateRequestForward.jsp?workflowid="+workflowid+"&ssoToken="+token);
|
||||
jsonObject.put("h5_url","/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid="+workflowid+"&ssoToken="+token);
|
||||
|
||||
jsonArray.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
out.print("jsonArray:"+ jsonArray.size()+"</br>");
|
||||
// String[] workflowArray = query.split("\\$");
|
||||
// for(int i=0;i<workflowArray.length;i++){
|
||||
// String workflowname = workflowArray[i];
|
||||
// out.print("workflowname:"+workflowname+"</br>");
|
||||
//// if(StringUtils.isNotBlank(workflowname)){
|
||||
//// String sql = " select id,workflowname from workflow_base where workflowname like '%"+workflowname+"%'" ;
|
||||
//// out.print("sql:"+sql+"</br>");
|
||||
//// rs.executeQuery(sql);
|
||||
//// while (rs.next()){
|
||||
//// String name = Util.null2String(rs.getString("workflowname"));
|
||||
//// String workflowid = Util.null2String(rs.getString("id"));
|
||||
////
|
||||
//// JSONObject jsonObject = new JSONObject();
|
||||
//// jsonObject.put("requestname",name);
|
||||
//// jsonObject.put("pc_url","/workflow/request/CreateRequestForward.jsp?workflowid="+workflowid+"&ssoToken="+token);
|
||||
//// jsonObject.put("h5_url","/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid="+workflowid+"&ssoToken="+token);
|
||||
//// jsonArray.add(jsonObject);
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
<%=jsonArray.toJSONString() %>
|
||||
|
||||
<%!
|
||||
|
||||
public String getToken(String host,String appid,String loginid){
|
||||
String token = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
Request request = new Request.Builder()
|
||||
.url(host+"/ssologin/getToken?appid="+appid+"&loginid="+loginid)
|
||||
.method("GET", null)
|
||||
.build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
if(code == 200){
|
||||
token = response.body().string();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
|
||||
|
||||
<%--
|
||||
User: wangj
|
||||
Design Ideas:
|
||||
数智-数据中心--通过手机号获取简历信息(姓名,性别,年龄,身份证号,民族,应聘企业,意向岗位)
|
||||
表名:edc_uf_table160
|
||||
需要:通过手机号获取简历信息(姓名,性别,年龄,身份证号,民族,应聘企业,意向岗位)
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
JSONObject res = new JSONObject();
|
||||
RecordSet rs = new RecordSet();
|
||||
String mobile = Util.null2String(request.getParameter("mobile"));
|
||||
boolean flag = false;
|
||||
String xm = "";
|
||||
String xb = "";
|
||||
String age = "";
|
||||
String cardno = "";
|
||||
String mz = "";
|
||||
String ypqy = "";
|
||||
String gw = "";
|
||||
|
||||
String sql = "select field001 as xm,field002 as xb,field008 as age,field004 as cardno,field013 as mz,field011 as ypqy,field007 as gw " +
|
||||
" from edc_uf_table160 where field005 = '"+mobile+"'";
|
||||
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
flag = true;
|
||||
xm = Util.null2String(rs.getString("xm"));
|
||||
xb = getFildName("edc_uf_table160","field002",Util.null2String(rs.getString("xb")));
|
||||
age = Util.null2String(rs.getString("age"));
|
||||
cardno = Util.null2String(rs.getString("cardno"));
|
||||
mz = getFildName("edc_uf_table160","field013",Util.null2String(rs.getString("mz")));
|
||||
ypqy = getFildName("edc_uf_table160","field011",Util.null2String(rs.getString("ypqy")));
|
||||
gw = Util.null2String(rs.getString("gw"));
|
||||
|
||||
res.put("xm",xm);
|
||||
res.put("xb",xb);
|
||||
res.put("age",age);
|
||||
res.put("cardno",cardno);
|
||||
res.put("mz",mz);
|
||||
res.put("ypqy",ypqy);
|
||||
res.put("gw",gw);
|
||||
}
|
||||
|
||||
|
||||
data.put("flag",flag);
|
||||
data.put("data",res);
|
||||
out.print(data.toJSONString());
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String getFildName(String tablename,String fieldname,String value){
|
||||
String selectname = "";
|
||||
if("".equals(value)){
|
||||
return selectname;
|
||||
}
|
||||
String sql = " select c.selectname from workflow_billfield a, workflow_bill b,workflow_selectitem c where a.billid=b.id and c.fieldid=a.id and b.tablename='"+tablename+"' and a.fieldname='"+fieldname+"' and c.selectvalue='" + value + "'";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
selectname = Util.null2String(rs.getString("selectname"));
|
||||
}
|
||||
return selectname;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,266 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="java.util.Scanner" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.Calendar" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String path = "/v2.0/employee/delete";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
String userid = request.getParameter("userid");
|
||||
try {
|
||||
String workcode = "";
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
String sql = " select workcode from hrmresource where id = ? and status=5 ";
|
||||
out.print("sql:"+sql+"</br>");
|
||||
rs.executeQuery(sql,new Object[]{userid});
|
||||
if(rs.next()){
|
||||
workcode = Util.null2String(rs.getString("workcode"));
|
||||
}
|
||||
}
|
||||
out.print("workcode:"+workcode+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(workcode)){
|
||||
// String key = "";
|
||||
// String sercet = "";
|
||||
// String sqlOr = "select dlkey,dlsercet from uf_dlkqdj where bs = 'DlKqGetDayNew'";
|
||||
// out.print("sqlOr:"+sqlOr+"</br>");
|
||||
// rs.executeQuery(sqlOr);
|
||||
// if (rs.next()) {
|
||||
// key = Util.null2String(rs.getString("dlkey"));
|
||||
// sercet = Util.null2String(rs.getString("dlsercet"));
|
||||
// }
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("employee_ext_id", workcode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
// bb.writeLog("headers:" + JSONObject.toJSONString(heads));
|
||||
// bb.writeLog("body:" + JSONObject.toJSONString(dataMap));
|
||||
|
||||
// String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
// bb.writeLog("response:" + back);
|
||||
// out.print("response:"+back+"</br>");
|
||||
// JSONObject backObj = JSONObject.parseObject(back);
|
||||
// String code = backObj.getString("code");
|
||||
// String data = backObj.getString("data");
|
||||
// out.print("code:"+code+"</br>");
|
||||
// if ("0".equals(code)) {
|
||||
// bb.writeLog("新接口调用成功");
|
||||
// JSONObject dataObj = JSONObject.parseObject(data);
|
||||
// out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
// } else {
|
||||
// bb.writeLog("接口调用失败");
|
||||
// out.print("接口调用失败");
|
||||
// }
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,290 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="java.util.Scanner" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.Calendar" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String path = "/v2.0/employee/delete";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
String userid = request.getParameter("userid");
|
||||
try {
|
||||
String workcode = "";
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
String sql = " select workcode from hrmresource where id = ? and status = 5 ";
|
||||
out.print("sql:"+sql+"</br>");
|
||||
rs.executeQuery(sql,new Object[]{userid});
|
||||
if(rs.next()){
|
||||
workcode = Util.null2String(rs.getString("workcode"));
|
||||
}
|
||||
}
|
||||
out.print("workcode:"+workcode+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(workcode)){
|
||||
// String key = "";
|
||||
// String sercet = "";
|
||||
// String sqlOr = "select dlkey,dlsercet from uf_dlkqdj where bs = 'DlKqGetDayNew'";
|
||||
// out.print("sqlOr:"+sqlOr+"</br>");
|
||||
// rs.executeQuery(sqlOr);
|
||||
// if (rs.next()) {
|
||||
// key = Util.null2String(rs.getString("dlkey"));
|
||||
// sercet = Util.null2String(rs.getString("dlsercet"));
|
||||
// }
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String all = path + sjc + key + secret;
|
||||
out.print("all:" + all+"</br>");
|
||||
out.print("sjc:" + sjc+"</br>");
|
||||
MD5 md5 = new MD5();
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
out.print("sig22:" + sig+"</br>");
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
String newStr = "";
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
newStr = newStr + c2;
|
||||
} else {
|
||||
newStr = newStr + c1;
|
||||
}
|
||||
}
|
||||
out.print("sigNew:" + newStr+"</br>");
|
||||
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", newStr);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("employee_ext_id", workcode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
// bb.writeLog("headers:" + JSONObject.toJSONString(heads));
|
||||
// bb.writeLog("body:" + JSONObject.toJSONString(dataMap));
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,478 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
String id = request.getParameter("id");
|
||||
String path = "/v2.0/department";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
try {
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
where = " and id in("+id+")" ;
|
||||
}
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
List<Map<String,String>> topSubcompanyList = getTopSubcompanyList(where);
|
||||
for(int i=0;i<topSubcompanyList.size();i++){
|
||||
Map<String,String> topSubcompanyMap = topSubcompanyList.get(i);
|
||||
String subcompanycode = topSubcompanyMap.get("subcompanycode");
|
||||
String subcompanyname = topSubcompanyMap.get("subcompanyname");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", subcompanycode);
|
||||
dataMap.put("name", subcompanyname);
|
||||
dataMap.put("p_ext_id", "");
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("top-subcompany-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<topSubcompanyList.size();i++) {
|
||||
Map<String,String> topSubcompanyMap = topSubcompanyList.get(i);
|
||||
String subcompanyid = topSubcompanyMap.get("subcompanyid");
|
||||
|
||||
List<Map<String,String>> childSubcompanyList = getSubcompanyListByParentid(subcompanyid);
|
||||
|
||||
for(int k=0;k<childSubcompanyList.size();k++){
|
||||
Map<String,String> childSubcompanyMap = childSubcompanyList.get(k);
|
||||
String subcompanycode = childSubcompanyMap.get("subcompanycode");
|
||||
String subcompanyname = childSubcompanyMap.get("subcompanyname");
|
||||
String supsubcompanycode = childSubcompanyMap.get("supsubcompanycode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", subcompanycode);
|
||||
dataMap.put("name", subcompanyname);
|
||||
dataMap.put("p_ext_id", supsubcompanycode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("Subcompany-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String,String>> topDepartmentList = getTopDeptList();
|
||||
for(int i=0;i<topDepartmentList.size();i++){
|
||||
Map<String,String> topDepartmentMap = topDepartmentList.get(i);
|
||||
String departmentcode = topDepartmentMap.get("departmentcode");
|
||||
String departmentname = topDepartmentMap.get("departmentname");
|
||||
String subcompanycode = topDepartmentMap.get("subcompanycode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", departmentcode);
|
||||
dataMap.put("name", departmentname);
|
||||
dataMap.put("p_ext_id", subcompanycode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("top-dept-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<topDepartmentList.size();i++) {
|
||||
Map<String,String> topDeptMap = topDepartmentList.get(i);
|
||||
String deptid = topDeptMap.get("deptid");
|
||||
|
||||
List<Map<String,String>> childDepartmentList = getDeptListByParentid(deptid);
|
||||
for(int k=0;k<childDepartmentList.size();k++){
|
||||
Map<String,String> childDepartmentMap = childDepartmentList.get(k);
|
||||
String departmentcode = childDepartmentMap.get("departmentcode");
|
||||
String departmentname = childDepartmentMap.get("departmentname");
|
||||
String supdeptcode = childDepartmentMap.get("supdeptcode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", departmentcode);
|
||||
dataMap.put("name", departmentname);
|
||||
dataMap.put("p_ext_id", supdeptcode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("dept-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getTopSubcompanyList(String where){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select id,subcompanycode,subcompanyname,subcompanydesc \n" +
|
||||
" from HrmSubCompany where supsubcomid = 0 \n" + where +
|
||||
" and (canceled is null or canceled = 0)" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String subcompanyid = rs.getString("id");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanyid",subcompanyid);
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getSubcompanyListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,subcompanyname,supsubcomid,subcompanycode,curlevel) as (\n" +
|
||||
" select id,subcompanyname,supsubcomid,subcompanycode,1 as level \n" +
|
||||
" from HrmSubCompany where id = " + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.subcompanyname,a.supsubcomid,a.subcompanycode,b.curlevel+1\n" +
|
||||
" from HrmSubCompany a \n" +
|
||||
" inner join tem_table b on (a.supsubcomid = b.id)\n" +
|
||||
" )\n" +
|
||||
" select l.*,k.subcompanycode as supsubcompanycode from tem_table l " +
|
||||
" left join HrmSubCompany k on l.supsubcomid = k.id where l.id <> "+supsubcomid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String sup_subcomid = rs.getString("supsubcomid");
|
||||
String supsubcompanycode = rs.getString("supsubcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
map.put("supsubcomid",sup_subcomid);
|
||||
map.put("supsubcompanycode",supsubcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Map<String,String>> getTopDeptList(){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select t.id,t.departmentcode,t.departmentname,t.subcompanyid1,h.subcompanycode\n" +
|
||||
" from HrmDepartment t\n" +
|
||||
" left join HrmSubCompany h on h.id = t.subcompanyid1\n" +
|
||||
" where t.supdepid = 0" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String deptid = rs.getString("id");
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("deptid",deptid);
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getDeptListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,departmentname,supdepid,departmentcode,curlevel) as(\n" +
|
||||
" select id,departmentname,supdepid,departmentcode,1 as level \n" +
|
||||
" from HrmDepartment where id =" + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.departmentname,a.supdepid,a.departmentcode,b.curlevel+1 \n" +
|
||||
" from HrmDepartment a \n" +
|
||||
" inner join tem_table b on (a.supdepid = b.id) \n" +
|
||||
" )\n" +
|
||||
" select p.*,k.departmentcode as supdeptcode from tem_table p\n" +
|
||||
" left join HrmDepartment k on p.supdepid = k.id where id <> "+supsubcomid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String sup_depid = rs.getString("supdepid");
|
||||
String supdeptcode = rs.getString("supdeptcode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("supdepid",sup_depid);
|
||||
map.put("supdeptcode",supdeptcode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,274 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
String path = "/v2.0/department";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
try {
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
List<Map<String,String>> list = getTopSubcompanyList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
Map<String,String> map = list.get(i);
|
||||
String subcompanyid = map.get("subcompanyid");
|
||||
String subcompanyname = map.get("subcompanyname");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", subcompanyid);
|
||||
dataMap.put("name", subcompanyname);
|
||||
dataMap.put("p_ext_id", "");
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
bb.writeLog("headers:" + JSONObject.toJSONString(heads));
|
||||
bb.writeLog("body:" + JSONObject.toJSONString(dataMap));
|
||||
|
||||
// String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
// bb.writeLog("response:" + back);
|
||||
// out.print("response:"+back+"</br>");
|
||||
// JSONObject backObj = JSONObject.parseObject(back);
|
||||
// String code = backObj.getString("code");
|
||||
// String data = backObj.getString("data");
|
||||
// out.print("code:"+code+"</br>");
|
||||
// if ("0".equals(code)) {
|
||||
// bb.writeLog("新接口调用成功");
|
||||
// JSONObject dataObj = JSONObject.parseObject(data);
|
||||
// out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
// } else {
|
||||
// bb.writeLog("接口调用失败");
|
||||
// out.print("接口调用失败");
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getTopSubcompanyList(){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select id,subcompanyname,subcompanydesc \n" +
|
||||
" from HrmSubCompany where supsubcomid = 0 \n" +
|
||||
" and (canceled is null or canceled = 0)" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanyid",id);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,478 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
String id = request.getParameter("id");
|
||||
String path = "/v2.0/department";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
try {
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
where = " and id in("+id+")" ;
|
||||
}
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
List<Map<String,String>> topSubcompanyList = getTopSubcompanyList(where);
|
||||
for(int i=0;i<topSubcompanyList.size();i++){
|
||||
Map<String,String> topSubcompanyMap = topSubcompanyList.get(i);
|
||||
String subcompanycode = topSubcompanyMap.get("subcompanycode");
|
||||
String subcompanyname = topSubcompanyMap.get("subcompanyname");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", subcompanycode);
|
||||
dataMap.put("name", subcompanyname);
|
||||
dataMap.put("p_ext_id", "");
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("top-subcompany-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<topSubcompanyList.size();i++) {
|
||||
Map<String,String> topSubcompanyMap = topSubcompanyList.get(i);
|
||||
String subcompanyid = topSubcompanyMap.get("subcompanyid");
|
||||
|
||||
List<Map<String,String>> childSubcompanyList = getSubcompanyListByParentid(subcompanyid);
|
||||
|
||||
for(int k=0;k<childSubcompanyList.size();k++){
|
||||
Map<String,String> childSubcompanyMap = childSubcompanyList.get(k);
|
||||
String subcompanycode = childSubcompanyMap.get("subcompanycode");
|
||||
String subcompanyname = childSubcompanyMap.get("subcompanyname");
|
||||
String supsubcompanycode = childSubcompanyMap.get("supsubcompanycode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", subcompanycode);
|
||||
dataMap.put("name", subcompanyname);
|
||||
dataMap.put("p_ext_id", supsubcompanycode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("Subcompany-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// List<Map<String,String>> topDepartmentList = getTopDeptList();
|
||||
// for(int i=0;i<topDepartmentList.size();i++){
|
||||
// Map<String,String> topDepartmentMap = topDepartmentList.get(i);
|
||||
// String departmentcode = topDepartmentMap.get("departmentcode");
|
||||
// String departmentname = topDepartmentMap.get("departmentname");
|
||||
// String subcompanycode = topDepartmentMap.get("subcompanycode");
|
||||
//
|
||||
// Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
// dataMap.put("department_ext_id", departmentcode);
|
||||
// dataMap.put("name", departmentname);
|
||||
// dataMap.put("p_ext_id", subcompanycode);
|
||||
//
|
||||
// out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
// out.print("top-dept-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
//
|
||||
// String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
// bb.writeLog("response:" + back);
|
||||
// out.print("response:"+back+"</br>");
|
||||
// JSONObject backObj = JSONObject.parseObject(back);
|
||||
// String code = backObj.getString("code");
|
||||
// String data = backObj.getString("data");
|
||||
// out.print("code:"+code+"</br>");
|
||||
// if ("0".equals(code)) {
|
||||
// bb.writeLog("新接口调用成功");
|
||||
// JSONObject dataObj = JSONObject.parseObject(data);
|
||||
// out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
// } else {
|
||||
// bb.writeLog("接口调用失败");
|
||||
// out.print("接口调用失败");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for(int i=0;i<topDepartmentList.size();i++) {
|
||||
// Map<String,String> topDeptMap = topDepartmentList.get(i);
|
||||
// String deptid = topDeptMap.get("deptid");
|
||||
//
|
||||
// List<Map<String,String>> childDepartmentList = getDeptListByParentid(deptid);
|
||||
// for(int k=0;k<childDepartmentList.size();i++){
|
||||
// Map<String,String> childDepartmentMap = childDepartmentList.get(i);
|
||||
// String departmentcode = childDepartmentMap.get("departmentcode");
|
||||
// String departmentname = childDepartmentMap.get("departmentname");
|
||||
// String supdeptcode = childDepartmentMap.get("supdeptcode");
|
||||
//
|
||||
// Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
// dataMap.put("department_ext_id", departmentcode);
|
||||
// dataMap.put("name", departmentname);
|
||||
// dataMap.put("p_ext_id", supdeptcode);
|
||||
//
|
||||
// out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
// out.print("dept-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
//
|
||||
// String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
// bb.writeLog("response:" + back);
|
||||
// out.print("response:"+back+"</br>");
|
||||
// JSONObject backObj = JSONObject.parseObject(back);
|
||||
// String code = backObj.getString("code");
|
||||
// String data = backObj.getString("data");
|
||||
// out.print("code:"+code+"</br>");
|
||||
// if ("0".equals(code)) {
|
||||
// bb.writeLog("新接口调用成功");
|
||||
// JSONObject dataObj = JSONObject.parseObject(data);
|
||||
// out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
// } else {
|
||||
// bb.writeLog("接口调用失败");
|
||||
// out.print("接口调用失败");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getTopSubcompanyList(String where){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select id,subcompanycode,subcompanyname,subcompanydesc \n" +
|
||||
" from HrmSubCompany where supsubcomid = 0 \n" + where +
|
||||
" and (canceled is null or canceled = 0)" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String subcompanyid = rs.getString("id");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanyid",subcompanyid);
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getSubcompanyListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,subcompanyname,supsubcomid,subcompanycode,curlevel) as (\n" +
|
||||
" select id,subcompanyname,supsubcomid,1 as level \n" +
|
||||
" from HrmSubCompany where id = " + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.subcompanyname,a.supsubcomid,subcompanycode,b.curlevel+1\n" +
|
||||
" from HrmSubCompany a \n" +
|
||||
" inner join tem_table b on (a.supsubcomid = b.id)\n" +
|
||||
" )\n" +
|
||||
" select l.*,k.subcompanycode as supsubcompanycode from tem_table l " +
|
||||
" left join HrmSubCompany k on l.supsubcomid = k.id where id <> "+supsubcomid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String sup_subcomid = rs.getString("supsubcomid");
|
||||
String supsubcompanycode = rs.getString("supsubcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
map.put("supsubcomid",sup_subcomid);
|
||||
map.put("supsubcompanycode",supsubcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Map<String,String>> getTopDeptList(){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select t.id,t.departmentcode,t.departmentname,t.subcompanyid1,h.subcompanycode\n" +
|
||||
" from HrmDepartment t\n" +
|
||||
" left join HrmSubCompany h on h.id = t.subcompanyid1\n" +
|
||||
" where t.supdepid = 0" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String deptid = rs.getString("id");
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("deptid",deptid);
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getDeptListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,departmentname,supdepid,departmentcode,curlevel) as(\n" +
|
||||
" select id,departmentname,supdepid,departmentcode,1 as level \n" +
|
||||
" from HrmDepartment where id =" + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.departmentname,a.supdepid,a.departmentcode,b.curlevel+1 \n" +
|
||||
" from HrmDepartment a \n" +
|
||||
" inner join tem_table b on (a.supdepid = b.id) \n" +
|
||||
" )\n" +
|
||||
" select p.*,k.departmentcode as supdeptcode from tem_table p\n" +
|
||||
" left join HrmDepartment k on p.supdepid = k.id where id <> "+supsubcomid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String sup_depid = rs.getString("supdepid");
|
||||
String supdeptcode = rs.getString("supdeptcode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("supdepid",sup_depid);
|
||||
map.put("supdeptcode",supdeptcode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,478 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
String id = request.getParameter("id");
|
||||
String path = "/v2.0/department";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
try {
|
||||
String where = "";
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
where = " and id in("+id+")" ;
|
||||
}
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
// List<Map<String,String>> topSubcompanyList = getTopSubcompanyList(where);
|
||||
// for(int i=0;i<topSubcompanyList.size();i++){
|
||||
// Map<String,String> topSubcompanyMap = topSubcompanyList.get(i);
|
||||
// String subcompanycode = topSubcompanyMap.get("subcompanycode");
|
||||
// String subcompanyname = topSubcompanyMap.get("subcompanyname");
|
||||
//
|
||||
// Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
// dataMap.put("department_ext_id", subcompanycode);
|
||||
// dataMap.put("name", subcompanyname);
|
||||
// dataMap.put("p_ext_id", "");
|
||||
//
|
||||
// out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
// out.print("top-subcompany-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
//
|
||||
// String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
// bb.writeLog("response:" + back);
|
||||
// out.print("response:"+back+"</br>");
|
||||
// JSONObject backObj = JSONObject.parseObject(back);
|
||||
// String code = backObj.getString("code");
|
||||
// String data = backObj.getString("data");
|
||||
// out.print("code:"+code+"</br>");
|
||||
// if ("0".equals(code)) {
|
||||
// bb.writeLog("新接口调用成功");
|
||||
// JSONObject dataObj = JSONObject.parseObject(data);
|
||||
// out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
// } else {
|
||||
// bb.writeLog("接口调用失败");
|
||||
// out.print("接口调用失败");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for(int i=0;i<topSubcompanyList.size();i++) {
|
||||
// Map<String,String> topSubcompanyMap = topSubcompanyList.get(i);
|
||||
// String subcompanyid = topSubcompanyMap.get("subcompanyid");
|
||||
//
|
||||
// List<Map<String,String>> childSubcompanyList = getSubcompanyListByParentid(subcompanyid);
|
||||
//
|
||||
// for(int k=0;k<childSubcompanyList.size();i++){
|
||||
// Map<String,String> childSubcompanyMap = childSubcompanyList.get(i);
|
||||
// String subcompanycode = childSubcompanyMap.get("subcompanycode");
|
||||
// String subcompanyname = childSubcompanyMap.get("subcompanyname");
|
||||
// String supsubcompanycode = childSubcompanyMap.get("supsubcompanycode");
|
||||
//
|
||||
// Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
// dataMap.put("department_ext_id", subcompanycode);
|
||||
// dataMap.put("name", subcompanyname);
|
||||
// dataMap.put("p_ext_id", supsubcompanycode);
|
||||
//
|
||||
// out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
// out.print("Subcompany-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
//
|
||||
// String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
// bb.writeLog("response:" + back);
|
||||
// out.print("response:"+back+"</br>");
|
||||
// JSONObject backObj = JSONObject.parseObject(back);
|
||||
// String code = backObj.getString("code");
|
||||
// String data = backObj.getString("data");
|
||||
// out.print("code:"+code+"</br>");
|
||||
// if ("0".equals(code)) {
|
||||
// bb.writeLog("新接口调用成功");
|
||||
// JSONObject dataObj = JSONObject.parseObject(data);
|
||||
// out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
// } else {
|
||||
// bb.writeLog("接口调用失败");
|
||||
// out.print("接口调用失败");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
List<Map<String,String>> topDepartmentList = getTopDeptList();
|
||||
for(int i=0;i<topDepartmentList.size();i++){
|
||||
Map<String,String> topDepartmentMap = topDepartmentList.get(i);
|
||||
String departmentcode = topDepartmentMap.get("departmentcode");
|
||||
String departmentname = topDepartmentMap.get("departmentname");
|
||||
String subcompanycode = topDepartmentMap.get("subcompanycode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", departmentcode);
|
||||
dataMap.put("name", departmentname);
|
||||
dataMap.put("p_ext_id", subcompanycode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("top-dept-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<topDepartmentList.size();i++) {
|
||||
Map<String,String> topDeptMap = topDepartmentList.get(i);
|
||||
String deptid = topDeptMap.get("deptid");
|
||||
|
||||
List<Map<String,String>> childDepartmentList = getDeptListByParentid(deptid);
|
||||
for(int k=0;k<childDepartmentList.size();k++){
|
||||
Map<String,String> childDepartmentMap = childDepartmentList.get(k);
|
||||
String departmentcode = childDepartmentMap.get("departmentcode");
|
||||
String departmentname = childDepartmentMap.get("departmentname");
|
||||
String supdeptcode = childDepartmentMap.get("supdeptcode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", departmentcode);
|
||||
dataMap.put("name", departmentname);
|
||||
dataMap.put("p_ext_id", supdeptcode);
|
||||
|
||||
out.print("headers:"+JSONObject.toJSONString(heads)+"</br>");
|
||||
out.print("dept-body:"+JSONObject.toJSONString(dataMap)+"</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("response:"+back+"</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("code:"+code+"</br>");
|
||||
if ("0".equals(code)) {
|
||||
bb.writeLog("新接口调用成功");
|
||||
JSONObject dataObj = JSONObject.parseObject(data);
|
||||
out.print("dataObj:"+dataObj.toJSONString()+"</br>");
|
||||
} else {
|
||||
bb.writeLog("接口调用失败");
|
||||
out.print("接口调用失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getTopSubcompanyList(String where){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select id,subcompanycode,subcompanyname,subcompanydesc \n" +
|
||||
" from HrmSubCompany where supsubcomid = 0 \n" + where +
|
||||
" and (canceled is null or canceled = 0)" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String subcompanyid = rs.getString("id");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanyid",subcompanyid);
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getSubcompanyListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,subcompanyname,supsubcomid,subcompanycode,curlevel) as (\n" +
|
||||
" select id,subcompanyname,supsubcomid,1 as level \n" +
|
||||
" from HrmSubCompany where id = " + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.subcompanyname,a.supsubcomid,subcompanycode,b.curlevel+1\n" +
|
||||
" from HrmSubCompany a \n" +
|
||||
" inner join tem_table b on (a.supsubcomid = b.id)\n" +
|
||||
" )\n" +
|
||||
" select l.*,k.subcompanycode as supsubcompanycode from tem_table l " +
|
||||
" left join HrmSubCompany k on l.supsubcomid = k.id where id <> "+supsubcomid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String sup_subcomid = rs.getString("supsubcomid");
|
||||
String supsubcompanycode = rs.getString("supsubcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
map.put("supsubcomid",sup_subcomid);
|
||||
map.put("supsubcompanycode",supsubcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Map<String,String>> getTopDeptList(){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql =" select t.id,t.departmentcode,t.departmentname,t.subcompanyid1,h.subcompanycode\n" +
|
||||
" from HrmDepartment t\n" +
|
||||
" left join HrmSubCompany h on h.id = t.subcompanyid1\n" +
|
||||
" where t.supdepid = 0" ;
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String deptid = rs.getString("id");
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("deptid",deptid);
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getDeptListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,departmentname,supdepid,departmentcode,curlevel) as(\n" +
|
||||
" select id,departmentname,supdepid,departmentcode,1 as level \n" +
|
||||
" from HrmDepartment where id =" + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.departmentname,a.supdepid,a.departmentcode,b.curlevel+1 \n" +
|
||||
" from HrmDepartment a \n" +
|
||||
" inner join tem_table b on (a.supdepid = b.id) \n" +
|
||||
" )\n" +
|
||||
" select p.*,k.departmentcode as supdeptcode from tem_table p\n" +
|
||||
" left join HrmDepartment k on p.supdepid = k.id where id <> "+supsubcomid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String sup_depid = rs.getString("supdepid");
|
||||
String supdeptcode = rs.getString("supdeptcode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("supdepid",sup_depid);
|
||||
map.put("supdeptcode",supdeptcode);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
@ -1,495 +0,0 @@
|
|||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.general.MD5" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpRequestBase" %>
|
||||
<%@ page import="org.apache.commons.collections.MapUtils" %>
|
||||
<%@ page import="java.io.IOException" %>
|
||||
<%@ page import="org.apache.http.client.methods.HttpPost" %>
|
||||
<%@ page import="org.apache.http.entity.StringEntity" %>
|
||||
<%@ page import="org.apache.http.Consts" %>
|
||||
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
|
||||
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
|
||||
<%@ page import="org.apache.http.HttpEntity" %>
|
||||
<%@ page import="org.apache.http.util.EntityUtils" %>
|
||||
<%@ page import="org.apache.http.StatusLine" %>
|
||||
<%@ page import="javax.net.ssl.SSLContext" %>
|
||||
<%@ page import="org.apache.http.conn.socket.ConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.config.Registry" %>
|
||||
<%@ page import="org.apache.http.config.RegistryBuilder" %>
|
||||
<%@ page import="org.apache.http.conn.socket.PlainConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.SSLConnectionSocketFactory" %>
|
||||
<%@ page import="org.apache.http.conn.ssl.NoopHostnameVerifier" %>
|
||||
<%@ page import="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" %>
|
||||
<%@ page import="org.apache.http.impl.client.HttpClients" %>
|
||||
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
||||
<%@ page import="java.security.KeyManagementException" %>
|
||||
<%@ page import="javax.net.ssl.X509TrustManager" %>
|
||||
<%@ page import="java.security.cert.CertificateException" %>
|
||||
<%@ page import="javax.net.ssl.TrustManager" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%
|
||||
BaseBean bb = new BaseBean();
|
||||
String path = "/v2.0/employee";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
String userid = request.getParameter("userid");
|
||||
try {
|
||||
|
||||
String key = bb.getPropValue("deliCloud","key");
|
||||
String secret = bb.getPropValue("deliCloud","secret");
|
||||
out.print("key:"+key+"</br>");
|
||||
out.print("secret:"+secret+"</br>");
|
||||
|
||||
if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(secret)){
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
out.print("sjc:"+sjc+"</br>");
|
||||
out.print("appSig:"+appSig+"</br>");
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
Map<String,String> userMap = getUserData(userid);
|
||||
String workcode = Util.null2String(userMap.get("workcode"));
|
||||
String lastname = Util.null2String(userMap.get("lastname"));
|
||||
String mobile = Util.null2String(userMap.get("mobile"));
|
||||
String deptcode = Util.null2String(userMap.get("departmentcode"));
|
||||
String deptname = Util.null2String(userMap.get("departmentname"));
|
||||
String deptid = Util.null2String(userMap.get("departmentid"));
|
||||
String subcompanyid1 = Util.null2String(userMap.get("subcompanyid1"));
|
||||
|
||||
out.print("workcode:"+workcode+ "</br>");
|
||||
out.print("lastname:"+lastname+ "</br>");
|
||||
out.print("mobile:"+mobile+ "</br>");
|
||||
|
||||
out.print("deptcode:"+deptcode+ "</br>");
|
||||
out.print("deptname:"+deptname+ "</br>");
|
||||
out.print("deptid:"+deptid+ "</br>");
|
||||
out.print("subcompanyid1:"+subcompanyid1+ "</br>");
|
||||
|
||||
int errorcount = 0;
|
||||
int errorcount1 = updateSubcompanyData(subcompanyid1,key,secret);
|
||||
errorcount = errorcount + errorcount1 ;
|
||||
out.print("errorcount1:"+errorcount1+"</br>");
|
||||
|
||||
int errorcount2 = updateDeptData(deptid,key,secret);
|
||||
errorcount = errorcount + errorcount2 ;
|
||||
out.print("errorcount2:"+errorcount2+"</br>");
|
||||
|
||||
if(errorcount == 0){
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("employee_ext_id", workcode);
|
||||
dataMap.put("name", lastname);
|
||||
dataMap.put("mobile", mobile);
|
||||
dataMap.put("employee_num", workcode);
|
||||
|
||||
List<Map<String, Object>> department_infolist = new ArrayList<Map<String, Object>>();
|
||||
Map<String, Object> department_infos = new HashMap<String, Object>();
|
||||
department_infos.put("ext_id",deptcode);
|
||||
department_infos.put("title",deptname);
|
||||
department_infolist.add(department_infos);
|
||||
dataMap.put("department_infos", department_infolist);
|
||||
|
||||
out.print("employee-headers:" + JSONObject.toJSONString(heads) + "</br>");
|
||||
out.print("employee-body:" + JSONObject.toJSONString(dataMap) + "</br>");
|
||||
|
||||
String back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
bb.writeLog("response:" + back);
|
||||
out.print("employee-response:" + back + "</br>");
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
out.print("employee-code:" + code + "</br>");
|
||||
if (!"0".equals(code)) {
|
||||
errorcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("数据异常!");
|
||||
bb.writeLog(e.getMessage());
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
|
||||
public List<Map<String,String>> getSubcompanyListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,subcompanyname,supsubcomid,subcompanycode,curlevel) as (\n" +
|
||||
" select id,subcompanyname,supsubcomid,1 as level \n" +
|
||||
" from HrmSubCompany where id = " + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.subcompanyname,a.supsubcomid,subcompanycode,b.curlevel+1\n" +
|
||||
" from HrmSubCompany a \n" +
|
||||
" inner join tem_table b on (a.id = b.supsubcomid)\n" +
|
||||
" )\n" +
|
||||
" select l.*,k.subcompanycode as supsubcompanycode from tem_table l " +
|
||||
" left join HrmSubCompany k on l.supsubcomid = k.id " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String subcompanyname = rs.getString("subcompanyname");
|
||||
String sup_subcomid = rs.getString("supsubcomid");
|
||||
String supsubcompanycode = rs.getString("supsubcompanycode");
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("subcompanycode",subcompanycode);
|
||||
map.put("subcompanyname",subcompanyname);
|
||||
map.put("supsubcomid",sup_subcomid);
|
||||
map.put("supsubcompanycode",supsubcompanycode);
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
if(list !=null && list.size() > 0){
|
||||
Collections.reverse(list);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getDeptListByParentid(String supsubcomid){
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String,String> map = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String sql =" with tem_table(id,departmentname,supdepid,departmentcode,subcompanyid1,curlevel) as(\n" +
|
||||
" select id,departmentname,supdepid,departmentcode,subcompanyid1,1 as level \n" +
|
||||
" from HrmDepartment where id =" + supsubcomid +
|
||||
" union all\n" +
|
||||
" select a.id,a.departmentname,a.supdepid,a.departmentcode,a.subcompanyid1,b.curlevel+1 \n" +
|
||||
" from HrmDepartment a \n" +
|
||||
" inner join tem_table b on (a.id = b.supdepid) \n" +
|
||||
" )\n" +
|
||||
" select p.*,k.departmentcode as supdeptcode,h.subcompanycode from tem_table p\n" +
|
||||
" left join HrmDepartment k on p.supdepid = k.id " +
|
||||
" left join hrmsubcompany h on h.id = p.subcompanyid1 " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()){
|
||||
String departmentcode = rs.getString("departmentcode");
|
||||
String subcompanycode = rs.getString("subcompanycode");
|
||||
String departmentname = rs.getString("departmentname");
|
||||
String sup_depid = rs.getString("supdepid");
|
||||
String supdeptcode = rs.getString("supdeptcode");
|
||||
if(StringUtils.isBlank(supdeptcode)){
|
||||
supdeptcode = subcompanycode;
|
||||
}
|
||||
map = new HashMap<String,String>();
|
||||
map.put("departmentcode",departmentcode);
|
||||
map.put("departmentname",departmentname);
|
||||
map.put("supdepid",sup_depid);
|
||||
map.put("supdeptcode",supdeptcode);
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
if(list !=null && list.size() > 0){
|
||||
Collections.reverse(list);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param path
|
||||
* @param key
|
||||
* @param sercet
|
||||
* @param sjc
|
||||
* @return
|
||||
*/
|
||||
public String getAppSigData(String path,String key,String sercet,String sjc){
|
||||
|
||||
String appSig = "";
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
MD5 md5 = new MD5();
|
||||
String all = path + sjc + key + sercet;
|
||||
String sig = md5.getMD5ofStr(all);
|
||||
bb.writeLog("sig:" + sig);
|
||||
Scanner sc = new Scanner(md5.getMD5ofStr(all));
|
||||
String str = sc.next();
|
||||
char[] arrays = str.toCharArray();
|
||||
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
char c1 = arrays[i];
|
||||
if (c1 >= 65 && c1 <= 90) {
|
||||
char c2 = toLowerCase(c1);//如果输入是大写 ,则调用toLowerCase方法
|
||||
appSig = appSig + c2;
|
||||
} else {
|
||||
appSig = appSig + c1;
|
||||
}
|
||||
}
|
||||
bb.writeLog("appSig:" + appSig);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return appSig;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param c1
|
||||
* @return
|
||||
*/
|
||||
public static char toLowerCase(char c1){
|
||||
int a = (int) c1;//将接收到的小写字符c1转换成int类型的数据给a
|
||||
int b =a+32; //a+32得出大写写对应小写的ascll数值
|
||||
char bb = (char)b;//最后将b转换成char类型字符给bb
|
||||
return bb; //返回bb;就是返回字母小写的字符
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void prepareHeaders(HttpRequestBase httpRequest, Map<String, String> headers) {
|
||||
if (!MapUtils.isEmpty(headers)) {
|
||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||
httpRequest.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJsonRequest(String url, Map<String, String> headers, String jsonStr) throws IOException {
|
||||
HttpPost httpost = new HttpPost(url);
|
||||
prepareHeaders(httpost, headers);
|
||||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8);
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpost.setEntity(entity);
|
||||
return sendRequest(httpost);
|
||||
}
|
||||
|
||||
|
||||
private static String sendRequest(HttpRequestBase httpRequest) throws IOException {
|
||||
String result = null;
|
||||
CloseableHttpClient httpclient = creteClient();
|
||||
try (CloseableHttpResponse resp = httpclient.execute(httpRequest)) {
|
||||
HttpEntity entity = resp.getEntity();
|
||||
result = (entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8));
|
||||
StatusLine statusLine = resp.getStatusLine();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
EntityUtils.consume(entity);
|
||||
// String errorMsg = Strings.lenientFormat("Http status abnormal-status code is %s, response is %s", resp.getStatusLine().getStatusCode(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static CloseableHttpClient creteClient() {
|
||||
//采用绕过验证的方式处理https请求
|
||||
try {
|
||||
SSLContext sslcontext = createIgnoreVerifySSL();
|
||||
// 设置协议http和https对应的处理socket链接工厂的对象
|
||||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.INSTANCE)
|
||||
.register("https", new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE))
|
||||
.build();
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
|
||||
HttpClients.custom().setConnectionManager(connManager);
|
||||
|
||||
//创建自定义的httpclient对象
|
||||
CloseableHttpClient client = HttpClients.custom().setConnectionManager(connManager).build();
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绕过验证
|
||||
*
|
||||
* @return
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws KeyManagementException
|
||||
*/
|
||||
public static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
|
||||
SSLContext sc = SSLContext.getInstance("SSLv3");
|
||||
|
||||
// 实现一个X509TrustManager接口,用于绕过验证,不用修改里面的方法
|
||||
X509TrustManager trustManager = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
|
||||
String paramString) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
sc.init(null, new TrustManager[]{trustManager}, null);
|
||||
return sc;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> getUserData(String userid){
|
||||
|
||||
Map<String,String> userMap = new HashMap<String,String>();
|
||||
String workcode = "";
|
||||
String departmentid = "";
|
||||
String subcompanyid1 = "";
|
||||
String departmentcode = "";
|
||||
String lastname = "";
|
||||
String mobile = "";
|
||||
String departmentname = "";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
|
||||
try{
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
String sql =" select t.workcode,t.departmentid,t.subcompanyid1,t.lastname,t.mobile,k.departmentcode,k.departmentname " +
|
||||
" from hrmresource t inner join hrmdepartment k on k.id = t.departmentid" +
|
||||
" where t.id = ? and t.status in (0,1,2,3) ";
|
||||
|
||||
rs.executeQuery(sql,new Object[]{userid});
|
||||
if(rs.next()){
|
||||
workcode = Util.null2String(rs.getString("workcode"));
|
||||
departmentid = Util.null2String(rs.getString("departmentid"));
|
||||
subcompanyid1 = Util.null2String(rs.getString("subcompanyid1"));
|
||||
departmentcode = Util.null2String(rs.getString("departmentcode"));
|
||||
lastname = Util.null2String(rs.getString("lastname"));
|
||||
mobile = Util.null2String(rs.getString("mobile"));
|
||||
|
||||
departmentname = Util.null2String(rs.getString("departmentname"));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
userMap.put("workcode",workcode);
|
||||
userMap.put("lastname",lastname);
|
||||
userMap.put("mobile",mobile);
|
||||
userMap.put("departmentcode",departmentcode);
|
||||
userMap.put("departmentname",departmentname);
|
||||
userMap.put("departmentid",departmentid);
|
||||
userMap.put("subcompanyid1",subcompanyid1);
|
||||
|
||||
return userMap;
|
||||
}
|
||||
|
||||
|
||||
public int updateSubcompanyData(String subcompanyid1,String key,String secret){
|
||||
|
||||
String path = "/v2.0/department";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
int errorcount = 0;
|
||||
List<Map<String,String>> childSubcompanyList = getSubcompanyListByParentid(subcompanyid1);
|
||||
for(int k=0;k<childSubcompanyList.size();k++) {
|
||||
Map<String, String> childSubcompanyMap = childSubcompanyList.get(k);
|
||||
String subcompanycode = childSubcompanyMap.get("subcompanycode");
|
||||
String subcompanyname = childSubcompanyMap.get("subcompanyname");
|
||||
String supsubcompanycode = childSubcompanyMap.get("supsubcompanycode");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", subcompanycode);
|
||||
dataMap.put("name", subcompanyname);
|
||||
dataMap.put("p_ext_id", supsubcompanycode);
|
||||
|
||||
String back = null;
|
||||
try {
|
||||
back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
if (!"0".equals(code)) {
|
||||
errorcount++;
|
||||
}
|
||||
}
|
||||
return errorcount;
|
||||
}
|
||||
|
||||
|
||||
public int updateDeptData(String deptid,String key,String secret){
|
||||
|
||||
String path = "/v2.0/department";
|
||||
String url = "http://v2-api.delicloud.com"+path;
|
||||
|
||||
String sjc = String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
String appSig = getAppSigData(path,key,secret,sjc);
|
||||
|
||||
|
||||
Map<String, String> heads = new HashMap<String, String>();
|
||||
heads.put("App-Key", key);
|
||||
heads.put("App-Timestamp", sjc);
|
||||
heads.put("App-Sig", appSig);
|
||||
heads.put("Api-Module", "CHECKIN");
|
||||
heads.put("Api-Cmd", "checkin_query");
|
||||
|
||||
int errorcount = 0;
|
||||
List<Map<String,String>> childDepartmentList = getDeptListByParentid(deptid);
|
||||
for(int k=0;k<childDepartmentList.size();k++){
|
||||
Map<String,String> childDepartmentMap = childDepartmentList.get(k);
|
||||
String departmentcode = childDepartmentMap.get("departmentcode");
|
||||
String departmentname = childDepartmentMap.get("departmentname");
|
||||
String supdeptcode = childDepartmentMap.get("supdeptcode");
|
||||
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
dataMap.put("department_ext_id", departmentcode);
|
||||
dataMap.put("name", departmentname);
|
||||
dataMap.put("p_ext_id", supdeptcode);
|
||||
|
||||
|
||||
String back = null;
|
||||
try {
|
||||
back = doPostJsonRequest(url, heads, JSON.toJSONString(dataMap));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
JSONObject backObj = JSONObject.parseObject(back);
|
||||
String code = backObj.getString("code");
|
||||
String data = backObj.getString("data");
|
||||
if (!"0".equals(code)) {
|
||||
errorcount++;
|
||||
}
|
||||
}
|
||||
return errorcount;
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package com.api.browser.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.BoolAttr;
|
||||
import com.api.browser.util.BrowserConstant;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.SplitTableUtil;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.util.ConditionType;
|
||||
|
||||
/**
|
||||
* 职务类别
|
||||
*
|
||||
* @author lvyi
|
||||
*
|
||||
*/
|
||||
public class JobActivitiesBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
String jobactivitymark = Util.null2String(params.get("jobactivitymark"));
|
||||
String jobactivityname = Util.null2String(params.get("jobactivityname"));
|
||||
String sqlwhere = "where 1 = 1 and a.jobgroupid = b.id ";
|
||||
String backfields = "";
|
||||
String fromSql = "";
|
||||
String orderby = "";
|
||||
if(!jobactivitymark.equals("")){
|
||||
sqlwhere += " and a.Jobactivitymark like '%";
|
||||
sqlwhere += Util.fromScreen2(jobactivitymark,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
if(!jobactivityname.equals("")){
|
||||
sqlwhere += " and a.jobactivityname like '%";
|
||||
sqlwhere += Util.fromScreen2(jobactivityname,user.getLanguage());
|
||||
sqlwhere += "%'";
|
||||
}
|
||||
|
||||
List<SplitTableColBean> cols = new ArrayList<SplitTableColBean>();
|
||||
backfields = " a.id,a.jobactivitymark,a.jobactivityname,b.jobgroupname ";
|
||||
fromSql = " HrmJobActivities a , HrmJobGroups b ";
|
||||
orderby = " a.id ";
|
||||
|
||||
cols.add(new SplitTableColBean("true", "id"));
|
||||
cols.add(new SplitTableColBean("25%", "子序列简称", "jobactivitymark", "jobactivitymark").setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("25%", "子序列全称", "jobactivityname", "jobactivityname"));
|
||||
cols.add(new SplitTableColBean("25%", "序列", "jobgroupname", "jobgroupname"));
|
||||
|
||||
|
||||
SplitTableBean tableBean = new SplitTableBean(backfields, fromSql, sqlwhere, orderby, "a.id", cols);
|
||||
|
||||
tableBean.setSqlsortway("ASC");
|
||||
tableBean.setSqlisdistinct("true");
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
List<SearchConditionItem> conditions = new ArrayList<SearchConditionItem>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 399, "jobactivitymark", true));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 15767, "jobactivityname"));
|
||||
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
package com.api.browser.service.impl;
|
||||
|
||||
import com.api.browser.bean.ListHeadBean;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SplitTableBean;
|
||||
import com.api.browser.bean.SplitTableColBean;
|
||||
import com.api.browser.service.BrowserService;
|
||||
import com.api.browser.util.*;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数智岗位浏览按钮二开
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class JobTitlesBrowserService extends BrowserService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
String jobtitlemark = Util.null2String(params.get("jobtitlemark"));
|
||||
String jobtitlename = Util.null2String(params.get("jobtitlename"));
|
||||
String jobtitlecode = Util.null2String(params.get("jobtitlecode"));
|
||||
String jobactivityname = Util.null2String(params.get("jobactivityname"));
|
||||
String sqlwhere = "where 1 = 1 ";
|
||||
String backfields;
|
||||
String fromSql;
|
||||
String orderby;
|
||||
List<SplitTableColBean> cols = new ArrayList<>();
|
||||
SplitTableBean tableBean;
|
||||
if ("278".equals(browserType)) {
|
||||
backfields = "c.id,c.jobtitlemark,c.jobtitlename,a.jobgroupname,a.jobgroupremark,b.jobactivitymark";
|
||||
fromSql = "from HrmJobTitles c left join HrmJobActivities b on b.id = c.jobactivityid left join HrmJobGroups a on a.id = b.jobgroupid";
|
||||
orderby = "c.id";
|
||||
sqlwhere = " where (c.canceled is null or c.canceled <> 1)";
|
||||
String jobgroupid = Util.null2String(params.get("jobgroupid"));
|
||||
String jobactivitieid = Util.null2String(params.get("jobactivitieid"));
|
||||
if (!"".equals(jobgroupid)) {
|
||||
sqlwhere += " and a.id =" + jobgroupid;
|
||||
}
|
||||
if (!"".equals(jobactivitieid)) {
|
||||
sqlwhere += " and b.id= " + jobactivitieid;
|
||||
}
|
||||
if (!"".equals(jobtitlemark)) {
|
||||
sqlwhere += " and c.jobtitlemark like '%" + Util.fromScreen2(jobtitlemark, user.getLanguage()) + "%' ";
|
||||
}
|
||||
if (!"".equals(jobtitlename)) {
|
||||
sqlwhere += " and c.jobtitlename like '%" + Util.fromScreen2(jobtitlename, user.getLanguage()) + "%' ";
|
||||
}
|
||||
if (!"".equals(jobtitlecode)) {
|
||||
sqlwhere += " and c.jobtitlecode like '%" + Util.fromScreen2(jobtitlecode, user.getLanguage()) + "%' ";
|
||||
}
|
||||
|
||||
cols.add(new SplitTableColBean("true", "id"));
|
||||
cols.add(new SplitTableColBean("35%", SystemEnv.getHtmlLabelName(6086, user.getLanguage()), "jobtitlemark", "jobtitlemark", 1).setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("35%", SystemEnv.getHtmlLabelName(1915, user.getLanguage()), "jobactivitymark", "jobactivitymark"));
|
||||
cols.add(new SplitTableColBean("30%", SystemEnv.getHtmlLabelName(805, user.getLanguage()), "jobgroupremark", "jobgroupremark"));
|
||||
tableBean = new SplitTableBean(backfields, fromSql, sqlwhere, orderby, "c.id", cols);
|
||||
} else {
|
||||
backfields = " a.id as id,a.jobtitlemark as jobtitlemark,a.jobtitlename as jobtitlename, b.jobactivityname as jobactivityname, b.jobactivitymark as jobactivitymark , a.jobtitlecode as jobtitlecode, c.jobgroupremark as jobgroupremark";
|
||||
fromSql = " from HrmJobTitles a left join HrmJobActivities b on a.jobactivityid=b.id left join hrmjobgroups c on b.jobgroupid =c.id";
|
||||
orderby = " a.id ";
|
||||
sqlwhere += " and (a.canceled is null or a.canceled <> 1)";
|
||||
if (!"".equals(jobtitlemark)) {
|
||||
sqlwhere += " and a.jobtitlemark like '%" + jobtitlemark + "%'";
|
||||
}
|
||||
|
||||
if (!"".equals(jobtitlename)) {
|
||||
sqlwhere += " and a.jobtitlename like '%" + jobtitlename + "%'";
|
||||
}
|
||||
|
||||
if (!"".equals(jobtitlecode)) {
|
||||
sqlwhere += " and a.jobtitlecode like '%" + jobtitlecode + "%'";
|
||||
}
|
||||
|
||||
if (!"".equals(jobactivityname)) {
|
||||
sqlwhere += " and jobactivityname like '%" + jobactivityname + "%'";
|
||||
}
|
||||
cols.add(new SplitTableColBean("true", "id"));
|
||||
cols.add(new SplitTableColBean("20%", "岗位简称", "jobtitlename", "jobtitlename"));
|
||||
cols.add(new SplitTableColBean("20%", "岗位全称", "jobtitlemark", "jobtitlemark").setIsInputCol(BoolAttr.TRUE));
|
||||
cols.add(new SplitTableColBean("20%", "岗位编号", "jobtitlecode", "jobtitlecode"));
|
||||
cols.add(new SplitTableColBean("20%", "子序列", "jobactivitymark", "jobactivitymark"));
|
||||
cols.add(new SplitTableColBean("20%", "序列", "jobgroupremark", "jobgroupremark"));
|
||||
tableBean = new SplitTableBean(backfields, fromSql, sqlwhere, orderby, "a.id", cols);
|
||||
}
|
||||
|
||||
tableBean.setSqlsortway("ASC");
|
||||
tableBean.setSqlisdistinct("true");
|
||||
apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserConditionInfo(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
List<SearchConditionItem> conditions = new ArrayList<>();
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_CONDITIONS, conditions);
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
if ("278".equals(browserType)) {
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 805, "jobgroupid", "281"));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.BROWSER, 15855, "jobactivitieid", "282"));
|
||||
}
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 15767, "jobtitlename"));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 399, "jobtitlemark", true));
|
||||
conditions.add(conditionFactory.createCondition(ConditionType.INPUT, 524944, "jobtitlecode"));
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMultBrowserDestData(Map<String, Object> params) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
List<Map<String, Object>> datas = new ArrayList<>();
|
||||
String selectids = Util.null2String(params.get(BrowserConstant.BROWSER_MULT_DEST_SELECTIDS));
|
||||
if (user == null || "".equals(selectids)) {
|
||||
return apidatas;
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
String tempSql = " select c.id,c.jobtitlemark,c.jobtitlename,a.jobgroupname,a.jobgroupremark,b.jobactivitymark " +
|
||||
" from HrmJobTitles c left join HrmJobActivities b on b.id = c.jobactivityid left join HrmJobGroups a on a.id = b.jobgroupid " +
|
||||
" where c.id in (" + selectids + ")" +
|
||||
" order by c.jobtitlemark ";
|
||||
rs.execute(tempSql);
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>(16);
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("jobtitlemark", Util.null2String(rs.getString("jobtitlemark")));
|
||||
item.put("jobactivitymark", Util.null2String(rs.getString("jobactivitymark")));
|
||||
item.put("jobgroupremark", Util.null2String(rs.getString("jobgroupremark")));
|
||||
datas.add(item);
|
||||
}
|
||||
|
||||
List<ListHeadBean> tableHeadColumns = new ArrayList<>();
|
||||
tableHeadColumns.add(new ListHeadBean("id", BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("jobtitlemark", "", 1, BoolAttr.TRUE));
|
||||
tableHeadColumns.add(new ListHeadBean("jobactivitymark", ""));
|
||||
tableHeadColumns.add(new ListHeadBean("jobgroupremark", ""));
|
||||
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_COLUMN, tableHeadColumns);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_DATA, datas);
|
||||
apidatas.put(BrowserConstant.BROWSER_RESULT_TYPE, BrowserDataType.LIST_ALL_DATA.getTypeid());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
String q = Util.null2String(request.getParameter("q"));
|
||||
List<String> sqlParams = new ArrayList<>();
|
||||
String keyword = "";
|
||||
if (q.length() > 0) {
|
||||
keyword = "%" + q + "%";
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
String sqlwhere = "where 1 = 1 ";
|
||||
String backfields = " a.id as id,a.jobtitlemark as jobtitlemark,a.jobtitlename as jobtitlename,a.jobtitlecode as jobtitlecode,b.jobactivityname as jobactivityname, b.jobactivitymark as jobactivitymark ";
|
||||
String fromSql = " from HrmJobTitles a left join HrmJobActivities b on a.jobactivityid=b.id ";
|
||||
String orderby = " order by a.id ";
|
||||
sqlwhere += " and (a.canceled is null or a.canceled <> 1)";
|
||||
if (!"".equals(keyword)) {
|
||||
sqlwhere += " and (a.jobtitlemark like ? or a.jobtitlename like ? or a.ecology_pinyin_search like ? )";
|
||||
sqlParams.add(keyword);
|
||||
sqlParams.add(keyword);
|
||||
sqlParams.add(keyword);
|
||||
}
|
||||
String sql = "select " + backfields + fromSql + sqlwhere + orderby;
|
||||
rs.executeQuery(sql, sqlParams);
|
||||
List<Map<String, String>> datas = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
Map<String, String> item = new HashMap<>();
|
||||
item.put("id", Util.null2String(rs.getString("id")));
|
||||
String name = Util.null2String(rs.getString("jobtitlemark"));
|
||||
String jobtitlecode = Util.null2String(rs.getString("jobtitlecode"));
|
||||
String title = name + "|" + jobtitlecode + "|" + Util.null2String(rs.getString("jobactivitymark"));
|
||||
item.put("name", name);
|
||||
item.put("title", title);
|
||||
datas.add(item);
|
||||
}
|
||||
apidatas.put("datas", datas);
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.api.shuzhi.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/06/02
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/shuzhi/mode")
|
||||
public class SzBatchExportController extends com.engine.shuzhi.web.SzBatchExportController{
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.api.shuzhi.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2023/6/26
|
||||
*/
|
||||
@Path("/shuzhi/datacenter")
|
||||
public class SzDataCenterController extends com.engine.shuzhi.web.SzDataCenterController {
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.api.shuzhi.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2023/6/26
|
||||
*/
|
||||
@Path("/shuzhi/resume")
|
||||
public class SzResumeController extends com.engine.shuzhi.web.SzResumeController {
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package com.customization.shuzhi;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_TableMap;
|
||||
import com.engine.core.cfg.annotation.CommandDynamicProxy;
|
||||
import com.engine.core.interceptor.AbstractCommandProxy;
|
||||
import com.engine.core.interceptor.Command;
|
||||
import com.engine.hrm.cmd.jobset.GetJobTitleListCmd;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 岗位列表表头信息调整
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/04/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@CommandDynamicProxy(target = GetJobTitleListCmd.class, desc = "调整表头信息")
|
||||
public class SzGetJobTitleListCmd extends AbstractCommandProxy<Map<String, Object>> {
|
||||
@Override
|
||||
public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
|
||||
Map<String, Object> result = (Map)this.nextExecute(targetCommand);
|
||||
String sessionKey = Util.null2String(result.get("sessionkey"));
|
||||
String tableString = Util_TableMap.getVal(sessionKey);
|
||||
tableString = tableString.replace("岗位简称", "岗位名称").replace("岗位全称", "职级名称").replace("所属职务", "职级代码").replace("职务类别", "序列");
|
||||
|
||||
try {
|
||||
Document document = DocumentHelper.parseText(tableString);
|
||||
Element rootElement = document.getRootElement();
|
||||
Element head = rootElement.element("head");
|
||||
List colList = head.elements();
|
||||
Element col = DocumentHelper.createElement("col");
|
||||
col.addAttribute("width", "20%");
|
||||
col.addAttribute("text", "标识");
|
||||
col.addAttribute("column", "id");
|
||||
col.addAttribute("orderkey", "id");
|
||||
colList.add(0, col);
|
||||
tableString = document.asXML();
|
||||
} catch (Exception var10) {
|
||||
var10.getMessage();
|
||||
}
|
||||
|
||||
Util_TableMap.setVal(sessionKey, tableString);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue