pioneer
2 years ago
commit
575e4d4c65
12 changed files with 698 additions and 0 deletions
@ -0,0 +1,6 @@
|
||||
# open-JSD-10390 |
||||
|
||||
JSD-10390 审批流推送定制开发\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。 |
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<plugin> |
||||
<id>com.eco.plugin.xx.audit.cbd1</id> |
||||
<name><![CDATA[xx审批插件]]></name> |
||||
<active>yes</active> |
||||
<version>1.0.3</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2021-02-10</jartime> |
||||
<vendor>fr.open</vendor> |
||||
<main-package>com.fr.plugin</main-package> |
||||
<!--用来记录这个任务的创建时间--> |
||||
<description><![CDATA[ |
||||
|
||||
]]></description> |
||||
<!--任务ID: 10390--> |
||||
<create-day>2022-6-14 19:10:52</create-day> |
||||
<extra-decision> |
||||
<HttpHandlerProvider class="com.fr.plugin.http.CBD1HttpHandler"/> |
||||
<URLAliasProvider class="com.fr.plugin.http.CBD1UrlAliasProvider"/> |
||||
</extra-decision> |
||||
<lifecycle-monitor class="com.fr.plugin.CBD1LifeCycleMonitor"/> |
||||
<function-recorder class="com.fr.plugin.FunctionRecoder"/> |
||||
</plugin> |
@ -0,0 +1,57 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.config.*; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
|
||||
@Visualization(category = "xx审批插件配置") |
||||
public class CBD1Config extends DefaultConfiguration { |
||||
|
||||
private static volatile CBD1Config config = null; |
||||
|
||||
public static CBD1Config getInstance() { |
||||
if (config == null) { |
||||
config = ConfigContext.getConfigInstance(CBD1Config.class); |
||||
} |
||||
return config; |
||||
} |
||||
@Identifier(value = "aName", name = "审批的账号", description = "审批的账号", status = Status.SHOW) |
||||
private Conf<String> aName = Holders.simple("xx"); |
||||
@Identifier(value = "aPwd", name = "审批的密码", description = "审批接口地址", status = Status.SHOW) |
||||
private Conf<String> aPwd = Holders.simple("xx"); |
||||
|
||||
@Identifier(value = "apiUrl", name = "审批接口地址", description = "审批接口地址", status = Status.SHOW) |
||||
private Conf<String> apiUrl = Holders.simple("http:xx/api/km-review/kmReviewRestService/addReview"); |
||||
public String getApiUrl() { |
||||
return apiUrl.get(); |
||||
} |
||||
public void setApiUrl(String apiUrl) { |
||||
this.apiUrl.set(apiUrl); |
||||
} |
||||
|
||||
public String getaName() { |
||||
return aName.get(); |
||||
} |
||||
|
||||
public void setaName( String aName) { |
||||
this.aName .set(aName); |
||||
} |
||||
|
||||
public String getaPwd() { |
||||
return aPwd.get(); |
||||
} |
||||
|
||||
public void setaPwd( String aPwd) { |
||||
this.aPwd .set(aPwd); |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
CBD1Config cloned = (CBD1Config) super.clone(); |
||||
cloned.apiUrl = (Conf<String>) this.apiUrl.clone(); |
||||
cloned.aName = (Conf<String>) this.aName.clone(); |
||||
cloned.aPwd = (Conf<String>) this.aPwd.clone(); |
||||
return cloned; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||
import com.fr.stable.fun.Authorize; |
||||
|
||||
@Authorize |
||||
public class CBD1LifeCycleMonitor extends AbstractPluginLifecycleMonitor { |
||||
@Override |
||||
public void afterRun(PluginContext pluginContext) { |
||||
CBD1Config.getInstance(); |
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop(PluginContext pluginContext) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.plugin; |
||||
|
||||
import com.fr.plugin.transform.ExecuteFunctionRecord; |
||||
import com.fr.plugin.transform.FunctionRecorder; |
||||
|
||||
@FunctionRecorder |
||||
public class FunctionRecoder { |
||||
@ExecuteFunctionRecord |
||||
public void exe(){ |
||||
System.out.println("插件功能埋点,虽然不会执行,除非上架应用"); |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.plugin.http; |
||||
|
||||
import com.fr.decision.fun.HttpHandler; |
||||
import com.fr.decision.fun.impl.AbstractHttpHandlerProvider; |
||||
import com.fr.plugin.http.handler.*; |
||||
|
||||
public class CBD1HttpHandler extends AbstractHttpHandlerProvider { |
||||
HttpHandler[] actions = new HttpHandler[]{ |
||||
new POSTAddReview1Handler(), |
||||
new ALLAuditCallback2Handler(), |
||||
}; |
||||
|
||||
@Override |
||||
public HttpHandler[] registerHandlers() { |
||||
return actions; |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.plugin.http; |
||||
|
||||
import com.fr.decision.fun.impl.AbstractURLAliasProvider; |
||||
import com.fr.decision.webservice.url.alias.URLAlias; |
||||
import com.fr.decision.webservice.url.alias.URLAliasFactory; |
||||
|
||||
public class CBD1UrlAliasProvider extends AbstractURLAliasProvider { |
||||
@Override |
||||
public URLAlias[] registerAlias() { |
||||
return new URLAlias[]{ |
||||
URLAliasFactory.createPluginAlias("/addReview", "/addReview", false), |
||||
URLAliasFactory.createPluginAlias("/auditCallback", "/auditCallback", true), |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,137 @@
|
||||
package com.fr.plugin.http.handler; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.utils.DBUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.Cookie; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.BufferedReader; |
||||
|
||||
public class ALLAuditCallback2Handler extends BaseHttpHandler { |
||||
@Override |
||||
public RequestMethod getMethod() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return "/auditCallback" ; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isPublic() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { |
||||
String requestBody = getRequestBody(req); |
||||
LogKit.info("收到对方的JSON:{}",requestBody); |
||||
DBUtils dbUtils = new DBUtils(); |
||||
|
||||
JSONObject jsonObject = new JSONObject(requestBody); |
||||
|
||||
String sql="UPDATE VCM_BILL_SHZT\n" + |
||||
"SET AUDIT_STATUS = ?,AUDIT_TIME = ? ,AUDIT_NAME = ?\n" + |
||||
"WHERE\n" + |
||||
" BILL_CODE = ? "; |
||||
dbUtils.exSqlUpdate(sql,jsonObject.getString("isAudit"), |
||||
jsonObject.getString("time") |
||||
,jsonObject.getString("member"), |
||||
jsonObject.getString("fd_order_number")); |
||||
String sql2="UPDATE VCM_BILL_JGDA \n" + |
||||
"SET CBD_INCOME_PROPORTION_PRICE = '1' \n" + |
||||
"WHERE\n" + |
||||
" BILL_CODE = ? \n" + |
||||
" AND ITEM_SPEC = ? \n" + |
||||
" AND ITEM_PRICE = ?"; |
||||
//如果选中了中杯
|
||||
String fd_Product_rice_med = jsonObject.getString("fd_Product_price_med"); |
||||
if (StringUtils.isNotBlank(fd_Product_rice_med)) { |
||||
dbUtils.exSqlUpdate(sql2, jsonObject.getString("fd_order_number"), "中杯", fd_Product_rice_med); |
||||
} |
||||
String fd_Product_price_big = jsonObject.getString("fd_Product_price_big"); |
||||
if (StringUtils.isNotBlank(fd_Product_price_big)) { |
||||
dbUtils.exSqlUpdate(sql2, jsonObject.getString("fd_order_number"), "大杯", fd_Product_price_big); |
||||
} |
||||
String fd_Product_price_ven = jsonObject.getString("fd_Product_price_ven"); |
||||
if (StringUtils.isNotBlank(fd_Product_price_ven)) { |
||||
dbUtils.exSqlUpdate(sql2, jsonObject.getString("fd_order_number"), "超大杯", fd_Product_price_ven); |
||||
} |
||||
JSONObject entries = new JSONObject(); |
||||
entries.put("success" , "true"); |
||||
WebUtils.printAsJSON(res, entries); |
||||
} |
||||
/** |
||||
* 获取请求体 |
||||
* |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static String getRequestBody(HttpServletRequest req) { |
||||
StringBuffer sb = new StringBuffer(); |
||||
String line = null; |
||||
try { |
||||
BufferedReader reader = req.getReader(); |
||||
while ((line = reader.readLine()) != null) |
||||
sb.append(line); |
||||
} catch (Exception e) { |
||||
} |
||||
|
||||
return sb.toString(); |
||||
} |
||||
/** |
||||
* 根据key获取cookie |
||||
* |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static String getCookieByKey(HttpServletRequest req, String key) { |
||||
Cookie[] cookies = req.getCookies(); |
||||
String cookie = "" ; |
||||
|
||||
if (cookies == null || cookies.length <= 0) { |
||||
return "" ; |
||||
} |
||||
|
||||
for (int i = 0; i < cookies.length; i++) { |
||||
Cookie item = cookies[i]; |
||||
if (item.getName().equalsIgnoreCase(key)) { |
||||
cookie = item.getValue(); |
||||
} |
||||
} |
||||
|
||||
LogKit.info("cookie:" + cookie); |
||||
|
||||
return cookie; |
||||
} |
||||
|
||||
private String deleteCookieByName(HttpServletRequest request, HttpServletResponse response, String name) { |
||||
Cookie[] cookies = request.getCookies(); |
||||
if (null == cookies) { |
||||
FineLoggerFactory.getLogger().debug("没有cookie"); |
||||
} else { |
||||
for (Cookie cookie : cookies) { |
||||
if (cookie.getName().equals(name)) { |
||||
String cookieValue = cookie.getValue(); |
||||
//设置值为null
|
||||
cookie.setValue(null); |
||||
//立即销毁cookie
|
||||
cookie.setMaxAge(0); |
||||
cookie.setPath("/"); |
||||
FineLoggerFactory.getLogger().debug("被删除的cookie名字为:{}" , cookie.getName(), cookieValue); |
||||
response.addCookie(cookie); |
||||
return cookieValue; |
||||
} |
||||
} |
||||
} |
||||
return "" ; |
||||
} |
||||
} |
@ -0,0 +1,111 @@
|
||||
package com.fr.plugin.http.handler; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.net.http.HttpKit; |
||||
import com.fr.decision.authority.data.User; |
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.CBD1Config; |
||||
import com.fr.third.springframework.http.*; |
||||
import com.fr.third.springframework.util.LinkedMultiValueMap; |
||||
import com.fr.third.springframework.util.MultiValueMap; |
||||
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||
import com.fr.third.springframework.web.client.RestTemplate; |
||||
import com.fr.web.utils.WebUtils; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import javax.servlet.http.Cookie; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.BufferedReader; |
||||
import java.util.Base64; |
||||
import java.util.HashMap; |
||||
|
||||
public class POSTAddReview1Handler extends BaseHttpHandler { |
||||
@Override |
||||
public RequestMethod getMethod() { |
||||
return RequestMethod.POST; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return "/addReview"; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isPublic() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { |
||||
User user = UserService.getInstance().getUserByRequestCookie(req); |
||||
String userName = user.getUserName(); |
||||
String docSubject = req.getParameter("docSubject"); |
||||
String docContent = req.getParameter("docContent"); |
||||
String formJson = req.getParameter("formJson"); |
||||
String respJSON = postData(docSubject, docContent, userName, formJson); |
||||
res.setContentType("application/json"); |
||||
WebUtils.printAsString(res, respJSON); |
||||
} |
||||
|
||||
/** |
||||
* 多层级的VO对象,且包含上传功能的样例 |
||||
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"] |
||||
*/ |
||||
public static String postData(String docSubject,String docContent,String userName,String formJson) throws Exception{ |
||||
RestTemplate yourRestTemplate = new RestTemplate(); |
||||
CBD1Config config = CBD1Config.getInstance(); |
||||
String url = config.getApiUrl(); |
||||
//把SysNewsParamterForm转换成MultiValueMap
|
||||
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>(); |
||||
wholeForm.add("docSubject", docSubject ); |
||||
wholeForm.add("docCreator", "{\"LoginName\":\""+userName+"\"}"); |
||||
wholeForm.add("docContent", docContent ); |
||||
wholeForm.add("docStatus", "20");//文档状态,可以为草稿("10")或者待审("20")两种状态,默认为待审,允许为空
|
||||
wholeForm.add("fdTemplateId", "xxxxxx"); |
||||
wholeForm.add("formValues", formJson ); |
||||
//注意附件列表的key是一样的
|
||||
|
||||
HttpHeaders headers = new HttpHeaders(); |
||||
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
|
||||
addAuth(headers,config.getaName()+":"+config.getaPwd()); |
||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA); |
||||
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
|
||||
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers); |
||||
|
||||
//有返回值的情况 VO可以替换成具体的JavaBean
|
||||
ResponseEntity<String> obj = yourRestTemplate.exchange(url, HttpMethod.POST, entity, String.class); |
||||
String body = obj.getBody(); |
||||
LogKit.info("请求接口:{} 参数:{} 响应:{}",url,wholeForm,body); |
||||
|
||||
return body; |
||||
} |
||||
|
||||
private static void addAuth(HttpHeaders headers, String users) { |
||||
String encode = Base64.getEncoder().encodeToString(users.getBytes()); |
||||
headers.add("Authorization", "Basic "+encode); |
||||
} |
||||
|
||||
/** |
||||
* 获取请求体 |
||||
* |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static String getRequestBody(HttpServletRequest req) { |
||||
StringBuffer sb = new StringBuffer(); |
||||
String line = null; |
||||
try { |
||||
BufferedReader reader = req.getReader(); |
||||
while ((line = reader.readLine()) != null) |
||||
sb.append(line); |
||||
} catch (Exception e) { |
||||
} |
||||
|
||||
return sb.toString(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,192 @@
|
||||
package com.fr.plugin.utils; |
||||
|
||||
import com.fanruan.api.data.ConnectionKit; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.log.FineLoggerProvider; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.sql.*; |
||||
import java.util.*; |
||||
|
||||
public class DBUtils { |
||||
String db_name = ""; |
||||
|
||||
private static FineLoggerProvider logger = FineLoggerFactory.getLogger(); |
||||
|
||||
public DBUtils() { |
||||
this.db_name = "DJDB"; |
||||
} |
||||
|
||||
public com.fr.data.impl.Connection getDbConnect() { |
||||
return ConnectionKit.getConnection(db_name); |
||||
} |
||||
|
||||
public List<Map<String, Object>> select(String sql, Object... params) { |
||||
logger.info("query data by sql:" + sql + Arrays.toString(params)); |
||||
try { |
||||
com.fr.data.impl.Connection dbConnect = getDbConnect(); |
||||
Connection con = dbConnect.createConnection(); |
||||
PreparedStatement preparedStatement = con.prepareStatement(sql); |
||||
setParams(preparedStatement, params); |
||||
ResultSet rs = preparedStatement.executeQuery(sql); |
||||
// 获得记录的详细信息,然后获得总列数
|
||||
ResultSetMetaData resMetaData = rs.getMetaData(); |
||||
int colNum = resMetaData.getColumnCount(); |
||||
// 用对象保存数据
|
||||
String name = ""; |
||||
String value = ""; |
||||
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); |
||||
while (rs.next()) { |
||||
Map<String, Object> cells = new HashMap<String, Object>(); |
||||
for (int i = 0; i < colNum; i++) { |
||||
name = resMetaData.getColumnLabel(i); |
||||
if (cells.get(name) != null) { |
||||
name = resMetaData.getColumnLabel(i); |
||||
} |
||||
if (rs.getObject(i) != null && resMetaData.getColumnTypeName(i).equals("DATETIME") || resMetaData.getColumnTypeName(i).equals("TIMESTAMP")) { |
||||
value = rs.getObject(i).toString(); |
||||
cells.put(name, value.substring(0, value.length() - 2)); |
||||
} else { |
||||
cells.put(name, rs.getString(i)); |
||||
} |
||||
} |
||||
list.add(cells); |
||||
} |
||||
// 释放数据库资源
|
||||
rs.close(); |
||||
preparedStatement.close(); |
||||
con.close(); |
||||
return list; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public int exec(String sql, String date) throws Exception { |
||||
logger.info("query data by sql:{} 时间:{}", sql, date); |
||||
Connection con = null; |
||||
CallableStatement call = null; |
||||
try { |
||||
com.fr.data.impl.Connection dbConnect = getDbConnect(); |
||||
con = dbConnect.createConnection(); |
||||
call = con.prepareCall(sql); |
||||
call.registerOutParameter(1, Types.INTEGER); |
||||
call.execute(); |
||||
Integer ret = call.getInt(1); |
||||
return ret; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
throw e; |
||||
} finally { |
||||
if (call != null) { |
||||
call.close(); |
||||
} |
||||
if (con != null) { |
||||
con.close(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public Map<String, Object> findOneRow(String sql, Object... params) { |
||||
List<Map<String, Object>> select = select(sql, params); |
||||
if (select != null) { |
||||
if (!select.isEmpty()) { |
||||
return select.get(0); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public boolean checkExist(String sql, Object... params) throws Exception { |
||||
Connection connection = getDbConnect().createConnection(); |
||||
PreparedStatement pstmt = connection.prepareStatement(sql); |
||||
setParams(pstmt, params); |
||||
try { |
||||
ResultSet resultSet = pstmt.executeQuery(); |
||||
if (resultSet.next()) { |
||||
return resultSet.getInt(1) > 0; |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} finally { |
||||
connection.close(); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
private void setParams(PreparedStatement pstmt, Object... params) throws SQLException { |
||||
if (params.length > 0) { |
||||
int length = params.length; |
||||
for (int i = 1; i <= length; i++) { |
||||
pstmt.setObject(i, params[i - 1]); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public int exSqlUpdate(String sql, Object... params) throws Exception { |
||||
logger.info("update data by sql:" + sql + " params " + Arrays.toString(params)); |
||||
PreparedStatement pstmt = null; |
||||
Connection connection = null; |
||||
try { |
||||
com.fr.data.impl.Connection dbConnect = getDbConnect(); |
||||
connection = dbConnect.createConnection(); |
||||
pstmt = connection.prepareStatement(sql); |
||||
setParams(pstmt, params); |
||||
int i = pstmt.executeUpdate(); |
||||
return i; |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error("执行更新SQL报错: sql:{}", e, sql); |
||||
} finally { |
||||
if (pstmt != null) { |
||||
pstmt.close(); |
||||
} |
||||
if (connection != null) { |
||||
connection.close(); |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
/** |
||||
* 取查询结果集字段 |
||||
* |
||||
* @param sql |
||||
* @param params |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
public List<Map<String, String>> exQuery(String sql, Object... params) throws Exception { |
||||
logger.info("query data by sql:" + sql + " params " + Arrays.toString(params)); |
||||
com.fr.data.impl.Connection dbConnect = getDbConnect(); |
||||
Connection connection = dbConnect.createConnection(); |
||||
PreparedStatement pstmt = connection.prepareStatement(sql); |
||||
setParams(pstmt, params); |
||||
ResultSet resultSet = pstmt.executeQuery(); |
||||
ResultSetMetaData resMetaData = resultSet.getMetaData(); |
||||
int columnCount = resMetaData.getColumnCount(); |
||||
List<Map<String, String>> arrs = new ArrayList<Map<String, String>>(); |
||||
while (resultSet.next()) { |
||||
String name; |
||||
String value; |
||||
Map<String, String> one = new HashMap<String, String>(); |
||||
for (int i = 1; i <= columnCount; i++) { |
||||
name = resMetaData.getColumnLabel(i); |
||||
if (one.get(name) != null) { |
||||
name = resMetaData.getColumnLabel(i); |
||||
} |
||||
if (resultSet.getObject(i) != null && resMetaData.getColumnTypeName(i).equals("DATETIME") || resMetaData.getColumnTypeName(i).equals("TIMESTAMP")) { |
||||
value = resultSet.getObject(i).toString(); |
||||
one.put(name, value.substring(0, value.length() - 2)); |
||||
} else { |
||||
one.put(name, resultSet.getString(i)); |
||||
} |
||||
} |
||||
arrs.add(one); |
||||
} |
||||
pstmt.close(); |
||||
connection.close(); |
||||
return arrs; |
||||
} |
||||
} |
@ -0,0 +1,110 @@
|
||||
//fd_med_tab 分隔
|
||||
var fd_med_tab=[]; |
||||
var zbwlmc1=ZBWLMC.split(","); |
||||
var zbpfdw1=ZBPFDW.split(","); |
||||
var zbpfdwjg1=ZBPFDWJG.split(","); |
||||
var zbpfyl1=ZBPFYL.split(","); |
||||
var zbje1=ZBJE.split(","); |
||||
|
||||
for(var i=0;i<zbwlmc1.length;i++){ |
||||
var zbwlmc2=zbwlmc1[i]; |
||||
var zbpfdw2=zbpfdw1[i]; |
||||
var zbpfdwjg2=zbpfdwjg1[i]; |
||||
var zbpfyl2=zbpfyl1[i]; |
||||
var zbje2=zbje1[i]; |
||||
fd_med_tab.push({ |
||||
"fd_med_tab.fd_material_med": zbwlmc2, |
||||
"fd_med_tab.fd_unit_med": zbpfdw2, |
||||
"fd_med_tab.fd_Unit_price_med": zbpfdwjg2, |
||||
"fd_med_tab.fd_consumption_med": zbpfyl2, |
||||
"fd_med_tab.fd_amount_med": zbje2 |
||||
}) |
||||
} |
||||
alert("调试:" + JSON.stringify(fd_med_tab)) |
||||
//
|
||||
|
||||
var formValue = { |
||||
"fd_order_number": DDBM, |
||||
"fd_Commodity_code": SPBM, |
||||
"fd_Commodity_name": SPMC, |
||||
// "fd_Commodity_type": "类型",
|
||||
"fd_Recipe_ver_med": "中杯", |
||||
"fd_Product_price1_med": ZBSPSJY, |
||||
"fd_Product_price2_med": ZBSPSJE, |
||||
"fd_Product_price3_med": ZBSPSJS, |
||||
"fd_Store_cost_med": ZBMDCB, |
||||
"fd_Store_front1_med": ZBMDMLLY, |
||||
"fd_Store_front2_med": ZBMDMLLE, |
||||
"fd_Store_front3_med": ZBMDMLLS, |
||||
"fd_income_med": ZBCBDSR, |
||||
"fd_CBD_front_med": ZBCBDMLL, |
||||
"fd_CBD_revenue1_med": ZBCBDZBY, |
||||
"fd_CBD_revenue2_med": ZBCBDZBE, |
||||
"fd_CBD_revenue3_med": ZBCBDZBS, |
||||
"fd_Recipe_ver_big": "大杯", |
||||
"fd_Product_price1_big": DBSPSJY, |
||||
"fd_Product_price2_big": DBSPSJE, |
||||
"fd_Product_price3_big": DBSPSJS, |
||||
"fd_Store_cost_big": DBMDCB, |
||||
"fd_Store_front1_big": DBMDMLLY, |
||||
"fd_Store_front2_big": DBMDMLLE, |
||||
"fd_Store_front3_big": DBMDMLLS, |
||||
"fd_income_big": DBCBDSR, |
||||
"fd_CBD_front_big": DBCBDMLL, |
||||
"fd_CBD_revenue1_big": DBCBDZBY, |
||||
"fd_CBD_revenue2_big": DBCBDZBE, |
||||
"fd_CBD_revenue3_big": DBCBDZBS, |
||||
"fd_Recipe_ver_ven": "超大杯", |
||||
"fd_Product_price1_ven": CDBSPSJY, |
||||
"fd_Product_price2_ven": CDBSPSJE, |
||||
"fd_Product_price3_ven": CDBSPSJS, |
||||
"fd_Store_cost_ven": CDBMDCB, |
||||
"fd_Store_front1_ven": CDBMDMLLY, |
||||
"fd_Store_front2_ven": CDBMDMLLE, |
||||
"fd_Store_front3_ven": CDBMDMLLS, |
||||
"fd_income_ven": CDBCBDSR, |
||||
"fd_CBD_front_ven": CDBCBDMLL, |
||||
"fd_CBD_revenue1_ven": CDBCBDZBY, |
||||
"fd_CBD_revenue2_ven": CDBCBDZBE, |
||||
"fd_CBD_revenue3_ven": CDBCBDZBS, |
||||
"fd_med_tab": fd_med_tab, |
||||
"fd_big_tab": [{ |
||||
"fd_big_tab.fd_material_big": "配方原料明细-大杯", |
||||
"fd_big_tab.fd_unit_big": "配方单位-大杯", |
||||
"fd_big_tab.fd_Unit_price_big": "配方单位价格-大杯", |
||||
"fd_big_tab.fd_consumption_big": "配方用量-大杯", |
||||
"fd_big_tab.fd_amount_big": "金额-大杯" |
||||
}], |
||||
"fd_ven_tab": [{ |
||||
"fd_ven_tab.fd_material_ven": "配方原料明细-超大杯", |
||||
"fd_ven_tab.fd_unit_ven": "配方单位-超大杯", |
||||
"fd_ven_tab.fd_Unit_price_ven": "配方单位价格-超大杯", |
||||
"fd_ven_tab.fd_consumption_ven": "配方用量-超大杯", |
||||
"fd_ven_tab.fd_amount_ven": "金额-超大杯" |
||||
}, { |
||||
"fd_ven_tab.fd_material_ven": "配方原料明细-超大杯", |
||||
"fd_ven_tab.fd_unit_ven": "配方单位-超大杯", |
||||
"fd_ven_tab.fd_Unit_price_ven": "配方单位价格-超大杯", |
||||
"fd_ven_tab.fd_consumption_ven": "配方用量-超大杯", |
||||
"fd_ven_tab.fd_amount_ven": "金额-超大杯" |
||||
}] |
||||
} |
||||
var data = { |
||||
docSubject: "测试审批", |
||||
docContent: "请领导审批。", |
||||
formJson: JSON.stringify(formValue) |
||||
} |
||||
$.post("/webroot/decision/url/addReview", data, function (res) { |
||||
alert("响应:" + JSON.stringify(res)) |
||||
}) |
||||
|
||||
//回调接口
|
||||
var p={ |
||||
"fd_order_number": "xxxx", |
||||
"isAudit": "通过", |
||||
"member": "某某某", |
||||
"time": "2022-06-22 09:28:15", |
||||
"fd_Product_rice_med": "15", |
||||
"fd_Product_price_big": "17", |
||||
"fd_Product_price_ven": "20" |
||||
} |
Loading…
Reference in new issue