|
|
@@ -37,7 +37,6 @@ import com.uas.platform.core.model.Type;
|
|
|
import com.uas.platform.core.persistence.criteria.LogicalExpression;
|
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
-import oracle.jdbc.oracore.OracleType;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -46,9 +45,8 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
-import org.springframework.jdbc.core.CallableStatementCallback;
|
|
|
-import org.springframework.jdbc.core.CallableStatementCreator;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.core.StatementCallback;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
@@ -58,9 +56,9 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
import java.lang.reflect.Field;
|
|
|
-import java.sql.CallableStatement;
|
|
|
-import java.sql.Connection;
|
|
|
+import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
|
+import java.sql.Statement;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
@@ -320,23 +318,26 @@ public class ProductServiceImpl implements ProductService {
|
|
|
|
|
|
@Override
|
|
|
public Integer matchAll() {
|
|
|
-// jdbcTemplate.execute("call TRADE_UPDATE_AVAILABLE_DAYS(" + SystemSession.getUser().getEnterprise().getUu() + ")");
|
|
|
- Integer updateCount = (Integer) jdbcTemplate.execute(
|
|
|
- new CallableStatementCreator() {
|
|
|
- public CallableStatement createCallableStatement(Connection con) throws SQLException {
|
|
|
- String sp = "{call vendor_match_products(?,?)}";
|
|
|
- CallableStatement cs = con.prepareCall(sp);
|
|
|
- cs.setLong(1, SystemSession.getUser().getEnterprise().getUu());
|
|
|
- cs.registerOutParameter(2, OracleType.STYLE_INT);
|
|
|
- return cs;
|
|
|
- }
|
|
|
- }, new CallableStatementCallback() {
|
|
|
- public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
|
|
|
- cs.execute();
|
|
|
- return cs.getInt(2);
|
|
|
+ Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ String sql = "/*#mycat:db_type=master*/ call vendor_match_products(%s, @out); select @out";
|
|
|
+ final String querySql = String.format(sql, enuu);
|
|
|
+ String updateCount = jdbcTemplate.execute(new StatementCallback<String>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String doInStatement(Statement stmt) throws SQLException, DataAccessException {
|
|
|
+ stmt.executeQuery(querySql);
|
|
|
+ ResultSet rs = stmt.getResultSet();
|
|
|
+ if (rs != null) {
|
|
|
+ rs.next();
|
|
|
+ return rs.getString(1);
|
|
|
}
|
|
|
- });
|
|
|
- return updateCount;
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (StringUtils.isEmpty(updateCount)) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return Integer.valueOf(updateCount);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -368,7 +369,11 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
Integer num = null;
|
|
|
if (flag) {
|
|
|
- String result = productDao.upateResultByEnuuForB2C(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ /**
|
|
|
+ * 目前 测试没有这个存储过程,暂时注释掉这个代码
|
|
|
+ */
|
|
|
+ //String result = productDao.upateResultByEnuuForB2C(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ String result = "0";
|
|
|
if (StringUtils.isEmpty(result)) {
|
|
|
map.put("size", 0);
|
|
|
map.put("redundance", 0);
|