|
|
@@ -1041,7 +1041,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
|
|
|
List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList);
|
|
|
// TODO 什么接口
|
|
|
- String result = restTemplate.postForEntity("/update", products, String.class).getBody();
|
|
|
+ String result = restTemplate.postForEntity("http://192.168.253.12:24000/product/update", products, String.class).getBody();
|
|
|
List<Long> productIds = JSON.parseArray(result, Long.class);
|
|
|
// 默认为b2c Enable开启
|
|
|
List<ProductPrivate> productPrivates = new ArrayList<>();
|
|
|
@@ -1136,24 +1136,46 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
|
|
|
@Override
|
|
|
public String publishByBatchPerson(String batch) {
|
|
|
- User user = SystemSession.getUser();
|
|
|
- Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
- final Object[] obj = new Object[]{enterprise.getUu(), user.getUserUU(), enterprise.getEnName(), batch};
|
|
|
- String sql = "/*#mycat:db_type=master*/ set @enuu = %s; set @useruu = %s; set @enName = '%s'; set @batch = '%s'; call RELEASE_TO_PRODUCT_PERSON_V1(@enuu, @useruu, @enName, @batch)";
|
|
|
- final String updateSql = String.format(sql, obj);
|
|
|
- jdbcTemplate.execute(new StatementCallback<String>() {
|
|
|
+ List<ReleaseProductByBatch> releaseProductByBatchList =
|
|
|
+ releaseProductByBatchDao.findByRelbatchid(batch);
|
|
|
+ if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
|
|
|
+ List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList);
|
|
|
+ // TODO 什么接口
|
|
|
+ String result = restTemplate.postForEntity("/update", products, String.class).getBody();
|
|
|
+ List<Long> productIds = JSON.parseArray(result, Long.class);
|
|
|
+ // 默认为b2c Enable开启
|
|
|
+ List<ProductPrivate> productPrivates = new ArrayList<>();
|
|
|
+ for (Long prId : productIds) {
|
|
|
+ ProductPrivate productPrivate = productPrivateDao.findByPrId(prId);
|
|
|
+ if (null == productPrivate) {
|
|
|
+ productPrivate = new ProductPrivate();
|
|
|
+ }
|
|
|
+ productPrivate.setB2cEnabled(IntegerConstant.YES_SHORT);
|
|
|
+ // 统计现在有多少在售信息
|
|
|
+ int batchCount = goodsDao.findCountByProductid(prId);
|
|
|
+ productPrivate.setBatchCount(batchCount);
|
|
|
+ }
|
|
|
+ productPrivateDao.save(productPrivates);
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public String doInStatement(Statement stmt) throws SQLException, DataAccessException {
|
|
|
- stmt.executeQuery(updateSql);
|
|
|
- ResultSet rs = stmt.getResultSet();
|
|
|
- if (null != rs) {
|
|
|
- rs.next();
|
|
|
- return rs.getString(1);
|
|
|
- }
|
|
|
- return "0";
|
|
|
- }
|
|
|
- });
|
|
|
+// User user = SystemSession.getUser();
|
|
|
+// Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
+// final Object[] obj = new Object[]{enterprise.getUu(), user.getUserUU(), enterprise.getEnName(), batch};
|
|
|
+// String sql = "/*#mycat:db_type=master*/ set @enuu = %s; set @useruu = %s; set @enName = '%s'; set @batch = '%s'; call RELEASE_TO_PRODUCT_PERSON_V1(@enuu, @useruu, @enName, @batch)";
|
|
|
+// final String updateSql = String.format(sql, obj);
|
|
|
+// jdbcTemplate.execute(new StatementCallback<String>() {
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public String doInStatement(Statement stmt) throws SQLException, DataAccessException {
|
|
|
+// stmt.executeQuery(updateSql);
|
|
|
+// ResultSet rs = stmt.getResultSet();
|
|
|
+// if (null != rs) {
|
|
|
+// rs.next();
|
|
|
+// return rs.getString(1);
|
|
|
+// }
|
|
|
+// return "0";
|
|
|
+// }
|
|
|
+// });
|
|
|
return null;
|
|
|
}
|
|
|
}
|