package com.web.pda.lyt.lytPda.service.internal; import com.app.base.data.ApiResponseResult; import com.web.pda.lyt.lytPda.service.PQCInputService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.CallableStatementCallback; import org.springframework.jdbc.core.CallableStatementCreator; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service(value = "PQCInputService") @Transactional(propagation = Propagation.REQUIRED) public class PQCInputlmpl extends AppUtills implements PQCInputService { @Autowired private JdbcTemplate jdbcTemplate; /** * 获取批号下拉数据源 **/ public ApiResponseResult getBatchNum(String factory, String company, String ftype, String procno, String modelno, String keyword) throws Exception { List list = getBatchNumPrc(factory, company, ftype, procno, modelno, keyword); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success().data(list.get(2)); } /** * 获取批号数据源 **/ public ApiResponseResult getBatchNumInfo(String factory, String company, String userNo, String lineType,String procNo, String lotNo, String classNo) throws Exception { List list = getBatchNumInfoPrc(factory, company, userNo, lineType,procNo, lotNo, classNo); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("cursor1", list.get(2)); map.put("cursor2", list.get(3)); return ApiResponseResult.success().data(map); } public List getBatchNumInfoPrc(String factory, String company, String userNo, String lineType,String procNo, String lotNo, String classNo) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_insert(?,?,?,?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, lineType); cs.setString(5, procNo); cs.setString(6, lotNo); cs.setString(7, classNo); cs.registerOutParameter(8, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(9, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(10, -10);// 输出参数 追溯数据 cs.registerOutParameter(11, -10);// 输出参数 追溯数据 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); List> l_2 = new ArrayList(); cs.execute(); result.add(cs.getInt(8)); result.add(cs.getString(9)); if (cs.getString(8).toString().equals("0")) { // 游标处理 ResultSet rs = (ResultSet) cs.getObject(10); ResultSet rs2 = (ResultSet) cs.getObject(11); try { l = fitMap(rs); l_2 = fitMap(rs2); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } result.add(l); result.add(l_2); } System.out.println(l); System.out.println(l_2); return result; } }); return resultList; } /** * 外观一键合格处理 **/ public ApiResponseResult setOK(String factory, String company, String userNo, String checkId) throws Exception { List list = setOKPrc(factory, company, userNo, checkId); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } public List setOKPrc(String factory, String company, String userNo, String checkId) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_insert_value_all(?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, checkId); cs.registerOutParameter(5, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(6, java.sql.Types.VARCHAR);// 输出参数 返回标识 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(5)); result.add(cs.getString(6)); return result; } }); return resultList; } /** * 提交处理/撤回提交/删除提交 **/ public ApiResponseResult submitInfo(String factory, String company, String userNo, String checkId, String operaType, String remarks) throws Exception { // String opera=""; // if (operaType == "1") { // opera = "提交"; // } else if (operaType == "2") { // opera = "撤销提交"; // } else if (operaType == "3") { // opera = "删除"; // } List list = dealSubmitPrc(factory, company, userNo, checkId, operaType, remarks); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } /** * 处理提交相关/撤回提交/删除提交 **/ public List dealSubmitPrc(String factory, String company, String userNo, String checkId, String operaType, String remarks) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_submit(?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, checkId); cs.setString(4, userNo); cs.setString(5, operaType); cs.setString(6, remarks); cs.registerOutParameter(7, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(8, java.sql.Types.VARCHAR);// 输出参数 返回标识 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(7)); result.add(cs.getString(8)); return result; } }); return resultList; } /** * 获取从表检验项目明细及丛丛表检验值明细 **/ public ApiResponseResult getItemInfo(String factory, String company, String checkId, String itemId) throws Exception { List list = getItemInfoPrc(factory, company, checkId, itemId); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("DA", list.get(2)); map.put("INFO", list.get(3)); return ApiResponseResult.success().data(map); } public List getItemInfoPrc(String factory, String company, String checkId, String itemId) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_getitem(?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, checkId); cs.setString(4, itemId); cs.registerOutParameter(5, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(6, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(7, -10);// 输出参数 cs.registerOutParameter(8, -10);// 输出参数 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); List> l_2 = new ArrayList(); cs.execute(); result.add(cs.getInt(5)); result.add(cs.getString(6)); if (cs.getString(5).toString().equals("0")) { // 游标处理 ResultSet rs = (ResultSet) cs.getObject(7); ResultSet rs2 = (ResultSet) cs.getObject(8); try { l = fitMap(rs); l_2 = fitMap(rs2); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } result.add(l); result.add(l_2); } System.out.println(l); System.out.println(l_2); return result; } }); return resultList; } /** * 检验值录入 **/ public ApiResponseResult checkValueInput(String factory, String company, String userNo, String checkId, String checkItemId, String testValue, String ptype, String checkValueId) throws Exception { List list = checkValueInputPrc(factory, company, userNo, checkId, checkItemId, testValue, ptype, checkValueId); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("checkItemID", list.get(2).toString()); if (list.get(3) != null) { map.put("checkResult", list.get(3).toString()); } return ApiResponseResult.success().data(map); } public List checkValueInputPrc(String factory, String company, String userNo, String checkId, String checkItemId, String testValue, String ptype, String checkValueId) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_insert_value(?,?,?,?,?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, checkId); cs.setString(5, checkItemId); cs.setString(6, testValue); cs.setString(7, ptype); cs.setString(8, checkValueId); cs.registerOutParameter(9, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(10, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(11, java.sql.Types.INTEGER);// 输出参数 cs.registerOutParameter(12, java.sql.Types.VARCHAR);// 输出参数 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(9)); result.add(cs.getString(10)); if (cs.getString(9).toString().equals("0")) { result.add(cs.getInt(11)); result.add(cs.getString(12)); } return result; } }); return resultList; } /** * 检验值修改-其他值 **/ public ApiResponseResult checkValueFieldInput(String factory, String company, String userNo, String checkId, String tableName, String changeName, String changeValue) throws Exception { List list = checkValueFieldInputPrc(factory, company, userNo, checkId, tableName, changeName, changeValue); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success("修改成功!"); } public List checkValueFieldInputPrc(String factory, String company, String userNo, String checkId, String tableName, String changeName, String changeValue) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_insert_value_field(?,?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, checkId); cs.setString(5, tableName); cs.setString(6, changeName); cs.setString(7, changeValue); cs.registerOutParameter(8, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(9, java.sql.Types.VARCHAR);// 输出参数 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(8)); result.add(cs.getString(9)); return result; } }); return resultList; } /** * 非量化项目的检验值 **/ public ApiResponseResult nonQulCheckVal(String factory, String company, String proc, String prodNo, String prodType, String checkItem) throws Exception { List list = nonQulCheckValPrc(factory, company, proc, prodNo, prodType, checkItem); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success().data(list.get(2)); } public List nonQulCheckValPrc(String factory, String company, String proc, String prodNo, String prodType, String checkItem) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_checkval(?,?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, proc); cs.setString(4, prodNo); cs.setString(5, prodType); cs.setString(6, checkItem); cs.registerOutParameter(7, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(8, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(9, -10);// 输出参数 追溯数据 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(7)); result.add(cs.getString(8)); if (cs.getString(7).toString().equals("0")) { // 游标处理 ResultSet rs = (ResultSet) cs.getObject(9); try { l = fitMap(rs); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } result.add(l); } System.out.println(l); return result; } }); return resultList; } /** * PQC值修改 **/ public ApiResponseResult modifyPQCValue(String factory, String company, String userNo, String mid, String tableName, String changeName, String changeValue) throws Exception { List list = modifyPQCValuePrc(factory, company, userNo, mid, tableName, changeName, changeValue); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } /** * PQC值修改-有返回值 **/ public ApiResponseResult modifyPQCValue1(String factory, String company, String userNo, String mid, String tableName, String changeName, String changeValue) throws Exception { List list = modifyPQCValuePrc1(factory, company, userNo, mid, tableName, changeName, changeValue); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success().data(list.get(2)); } /** * 信息查看权限设置 **/ public ApiResponseResult getAuthority(String factory, String company, String procNo) throws Exception { List list = getAuthorityPrc(factory, company, procNo); if (!list.get(0).toString().equals("0")) { return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success().data(list.get(2)); } public List getAuthorityPrc(String factory, String company, String procNo) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_getinfo(?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, procNo); cs.registerOutParameter(4, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(5, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(6, -10);// 输出参数 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(4)); result.add(cs.getString(5)); if (cs.getString(4).toString().equals("0")) { // 游标处理 ResultSet rs = (ResultSet) cs.getObject(6); try { l = fitMap(rs); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } result.add(l); } System.out.println(l); return result; } }); return resultList; } public ApiResponseResult setXieGang(String factory, String company, String userNo, String pid) throws Exception { List list = setXieGangPrc(factory, company, userNo, pid); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } public List setXieGangPrc(String factory, String company, String userNo, String pid) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_insert_xiegang(?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, pid);// 输出参数 cs.registerOutParameter(5, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(6, java.sql.Types.VARCHAR);// 输出参数 返回标识 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); cs.execute(); result.add(cs.getInt(5)); result.add(cs.getString(6)); return result; } }); return resultList; } /** * 获取从表检验项目明细及丛丛表检验值明细 按钮【上一项】和【下一项】显示 **/ public ApiResponseResult goNextItem(String factory, String company, String ftype, String mid, String pid) throws Exception { List list = goNextItemPrc(factory, company, ftype, mid, pid); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("DA", list.get(2)); map.put("INFO", list.get(3)); return ApiResponseResult.success().data(map); } public List goNextItemPrc(String factory, String company, String ftype, String mid, String pid) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_nextitem(?,?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, ftype); cs.setString(4, mid); cs.setString(5, pid); cs.registerOutParameter(6, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(7, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(8, -10);// 输出参数 cs.registerOutParameter(9, -10);// 输出参数 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); List> l_2 = new ArrayList(); cs.execute(); result.add(cs.getInt(6)); result.add(cs.getString(7)); if (cs.getString(6).toString().equals("0")) { // 游标处理 ResultSet rs = (ResultSet) cs.getObject(8); ResultSet rs2 = (ResultSet) cs.getObject(9); try { l = fitMap(rs); l_2 = fitMap(rs2); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } result.add(l); result.add(l_2); } System.out.println(l); System.out.println(l_2); return result; } }); return resultList; } /** * PQC首检-功能 获取PQC首检-列表数据 **/ public ApiResponseResult getPQCItemList(String factory, String company, String userNo, String keyword, int page, int size) throws Exception { List list = getPQCItemListPrc(factory, company, userNo, keyword, page, size); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success().data(list.get(2)); } public List getPQCItemListPrc(String factory, String company, String userNo, String keyword, int page, int size) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_nosubmit(?,?,?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, keyword); cs.setInt(5, page); cs.setInt(6, size); cs.registerOutParameter(7, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(8, java.sql.Types.VARCHAR);// 输出参数 返回标识 cs.registerOutParameter(9, -10);// 输出参数 追溯数据 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(7)); result.add(cs.getString(8)); if (cs.getString(7).toString().equals("0")) { // 游标处理 ResultSet rs = (ResultSet) cs.getObject(9); try { l = fitMap(rs); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } result.add(l); } System.out.println(l); return result; } }); return resultList; } /** * PQC首检-功能 修改PQC首检项目-列表 **/ public ApiResponseResult sumbitPQCItem(String factory, String company, String mid, String userNo, String operaType) throws Exception { List list = sumbitPQCItemPrc(factory, company, mid, userNo, operaType); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } public List sumbitPQCItemPrc(String factory, String company, String mid, String userNo, String operaType) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_firstbill_submit(?,?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, mid); cs.setString(4, userNo); cs.setString(5, operaType); cs.registerOutParameter(6, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(7, java.sql.Types.VARCHAR);// 输出参数 返回标识 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); cs.execute(); result.add(cs.getInt(6)); result.add(cs.getString(7)); return result; } }); return resultList; } // 获取合格结果 public ApiResponseResult getOkResult(String factory, String company, String userNo, String mid) throws Exception { List list = getOkResultPrc(factory, company, userNo, mid); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } /** * 获取首检记录 **/ public ApiResponseResult getRecordList(String factory, String company,String user, String ftype,String mid, String keyword,int size,int page)throws Exception { List list = getRecordListPrc(factory, company, user, ftype,mid ,keyword, size,page); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("MAIN", list.get(2));//主表数据 map.put("SUB", list.get(3));//从表数据 return ApiResponseResult.success().data(map); } /** * 一键符合要求 **/ public ApiResponseResult updateRequisito(String factory, String company, String userNo, String checkId) throws Exception { List list = updateRequisitoPrc(factory, company, userNo, checkId); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } @Override public ApiResponseResult getChecker(String checkTask) throws Exception { List list = getCheckerPrc(checkTask); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("cursor1", list.get(2));//主表数据 return ApiResponseResult.success().data(map); } @Override public ApiResponseResult updataChecker(String id, String status, String billNo) throws Exception { List list = updataCheckerPrc(id, status, billNo); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } return ApiResponseResult.success(); } @Override public ApiResponseResult getBillReturn(String billNo) throws Exception { List list = getBillReturnPrc(billNo); if (!list.get(0).toString().equals("0")) {// 存储过程调用失败 //判断返回游标 return ApiResponseResult.failure(list.get(1).toString()); } Map map = new HashMap(); map.put("MAIN", list.get(2));//主表数据 map.put("SUB", list.get(3));//从表数据 return ApiResponseResult.success().data(map); } public List updataCheckerPrc(String id, String status, String billNo) { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call Prc_Pqc_Checker_Update(?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, id); cs.setString(2, status); cs.setString(3, billNo); cs.registerOutParameter(4, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(5, java.sql.Types.VARCHAR);// 输出参数 返回标识 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(4)); result.add(cs.getString(5)); return result; } }); return resultList; } public List updateRequisitoPrc(String factory, String company, String userNo, String checkId) throws Exception { List resultList = (List) jdbcTemplate.execute(new CallableStatementCreator() { @Override public CallableStatement createCallableStatement(Connection con) throws SQLException { String storedProc = "{call sp_pqc_app_insert_value_fuhe(?,?,?,?,?,?)}";// 调用的sql CallableStatement cs = con.prepareCall(storedProc); cs.setString(1, factory); cs.setString(2, company); cs.setString(3, userNo); cs.setString(4, checkId); cs.registerOutParameter(5, java.sql.Types.INTEGER);// 输出参数 返回标识 cs.registerOutParameter(6, java.sql.Types.VARCHAR);// 输出参数 返回标识 return cs; } }, new CallableStatementCallback() { public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { List result = new ArrayList<>(); List> l = new ArrayList(); cs.execute(); result.add(cs.getInt(5)); result.add(cs.getString(6)); return result; } }); return resultList; } }