|
|
@@ -30,8 +30,11 @@ import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.DataAccessException;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.core.StatementCallback;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
@@ -41,6 +44,9 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.sql.ResultSet;
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.sql.Statement;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
@@ -76,6 +82,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
public ReleaseProductByBatch save(ReleaseProductByBatch releaseProductByBatch) {
|
|
|
return releaseProductByBatch;
|
|
|
@@ -802,7 +811,23 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
@Override
|
|
|
public String publishByBatch(String batch) {
|
|
|
Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
- String num = releaseProductByBatchDao.callPublishByBatch(enterprise.getUu(), enterprise.getEnName(), batch);
|
|
|
+ final Object [] obj = new Object[]{enterprise.getUu(), enterprise.getEnName(), batch};
|
|
|
+ String sql = "/*#mycat:db_type=master*/ set @enuu = %s; set @enName = '%s'; set @batch = '%s'; call product_release_batch_publish(@enuu, @enName, @batch, @out)";
|
|
|
+ final String updateSql = String.format(sql, obj);
|
|
|
+ String num = jdbcTemplate.execute(new StatementCallback<String>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String doInStatement(Statement stmt) throws SQLException, DataAccessException {
|
|
|
+ stmt.executeUpdate(updateSql);
|
|
|
+ stmt.execute("select @out");
|
|
|
+ ResultSet rs = stmt.getResultSet();
|
|
|
+ if (null != rs) {
|
|
|
+ rs.next();
|
|
|
+ return rs.getString(1);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ });
|
|
|
if(!"0".equals(num)) {
|
|
|
List<Goods> goodsList = goodsDao.findByBatchid(batch);
|
|
|
Set<String> uuids = new HashSet<String>();
|