Browse Source

加入事务控制

yujia 7 years ago
parent
commit
1f5cee5664

+ 3 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -51,6 +51,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.StatementCallback;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.StringUtils;
 import org.springframework.web.client.RestTemplate;
@@ -1693,6 +1694,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		return releaseProductByBatchDao.findByPublisherUuAndRelbatchidAndFailCode(SystemSession.getUser().getUserUU(), batch, failCode);
 	}
 
+	@Transactional
 	@Override
 	public String publishByBatch(String batch, boolean isPcb) {
         if (StringUtils.isEmpty(batch)) {
@@ -1708,7 +1710,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			return "0";
 		}
 		try {
-			Thread.sleep(10000);
+			Thread.sleep(5000);
 		} catch (InterruptedException e) {
 			e.printStackTrace();
 		}