|
|
@@ -610,12 +610,13 @@ public class ProductServiceImpl implements ProductService {
|
|
|
final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
ProductStoreStatus status = productStoreStatusDao.findByEnuu(enUU);
|
|
|
if (status != null) {
|
|
|
- if (status.getStatus().equals(Status.RUNNING.value())) {// 有人正在操作这张单据,不能进行操作
|
|
|
+ // 有人正在操作这张单据,不能进行操作
|
|
|
+ if (status.getStatus().equals(Status.RUNNING.value())) {
|
|
|
Date date = new Date();
|
|
|
long l = date.getTime() - status.getDate().getTime();
|
|
|
- if(l > 600000) {
|
|
|
+ if (l > 600000) {
|
|
|
status.setStatus(Status.FINISH.value());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return new ResultMap(CodeType.NOT_PERMIT, "当前有人正在进行匹配操作,无法进行匹配");
|
|
|
}
|
|
|
} else {
|
|
|
@@ -633,24 +634,22 @@ public class ProductServiceImpl implements ProductService {
|
|
|
|
|
|
int total = productDao.getCountByEnuuAndStatusAndEnabled(enUU, ShortConstant.NO_SHORT, IntegerConstant.YES_SHORT);
|
|
|
int success = 0;
|
|
|
- int fail = 0 ;
|
|
|
-
|
|
|
- success = (Integer) jdbcTemplate.execute(
|
|
|
- new CallableStatementCreator() {
|
|
|
- public CallableStatement createCallableStatement(java.sql.Connection con) throws SQLException {
|
|
|
- String sp = "{call PRODUCT_MATCHES_TEST(?,?,?)}";
|
|
|
- CallableStatement cs = con.prepareCall(sp);
|
|
|
- cs.setLong(1, enUU);
|
|
|
- cs.setLong(2, uu);
|
|
|
- cs.registerOutParameter(3, OracleType.STYLE_INT);
|
|
|
- return cs;
|
|
|
- }
|
|
|
- }, new CallableStatementCallback() {
|
|
|
- public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
|
|
|
- cs.execute();
|
|
|
- return cs.getInt(3);
|
|
|
- }
|
|
|
- });
|
|
|
+ int fail = 0;
|
|
|
+
|
|
|
+ String sql = "/*#mycat:db_type=master*/ call PRODUCT_MATCHES_TEST(%s, %s, @out); select @out";
|
|
|
+ final String formatSql = String.format(sql, enUU, uu);
|
|
|
+ success = jdbcTemplate.execute(new StatementCallback<Integer>() {
|
|
|
+ @Override
|
|
|
+ public Integer doInStatement(Statement statement) throws SQLException, DataAccessException {
|
|
|
+ statement.execute(formatSql);
|
|
|
+ ResultSet rs = statement.getResultSet();
|
|
|
+ if (null != rs) {
|
|
|
+ rs.next();
|
|
|
+ return rs.getInt(1);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
fail = total - success;
|
|
|
|
|
|
status.setStatus(Status.FINISH.value());
|
|
|
@@ -880,8 +879,8 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @param goods
|
|
|
* @param historyByBatch
|
|
|
*/
|
|
|
- private void updateBrowsingHistory(Goods goods, List<GoodsBrowsingHistory> historyByBatch){
|
|
|
- for (GoodsBrowsingHistory gb : historyByBatch){
|
|
|
+ private void updateBrowsingHistory(Goods goods, List<GoodsBrowsingHistory> historyByBatch) {
|
|
|
+ for (GoodsBrowsingHistory gb : historyByBatch) {
|
|
|
gb.setCode(goods.getCode());
|
|
|
gb.setKindNameCn(goods.getKindNameCn());
|
|
|
gb.setBrandNameCn(goods.getBrandNameCn());
|
|
|
@@ -893,8 +892,8 @@ public class ProductServiceImpl implements ProductService {
|
|
|
/**
|
|
|
* 更新GoodsHistory信息
|
|
|
*/
|
|
|
- private void updateGoodsHistoryInfo(Goods goods, List<GoodsHistory> history){
|
|
|
- for (GoodsHistory gh : history){
|
|
|
+ private void updateGoodsHistoryInfo(Goods goods, List<GoodsHistory> history) {
|
|
|
+ for (GoodsHistory gh : history) {
|
|
|
gh.setCode(goods.getCode());
|
|
|
gh.setUuid(goods.getUuid());
|
|
|
gh.setKindNameCn(goods.getKindNameCn());
|
|
|
@@ -914,7 +913,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @param goods
|
|
|
* @param cartList
|
|
|
*/
|
|
|
- private void updateCartsInfo(Goods goods, List<Cart> cartList){
|
|
|
+ private void updateCartsInfo(Goods goods, List<Cart> cartList) {
|
|
|
for (Cart cart : cartList){
|
|
|
cart.setCode(goods.getCode());
|
|
|
cart.setBrName(goods.getBrandNameEn());
|
|
|
@@ -926,8 +925,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
/**
|
|
|
* 更新在售信息
|
|
|
*/
|
|
|
- private void updateGoodsInfo(Goods goods, Product product){
|
|
|
+ private void updateGoodsInfo(Goods goods, Product product) {
|
|
|
goods.setProductid(product.getId());
|
|
|
+ goods.setProdNum(product.getProdNum());
|
|
|
goods.setUuid(product.getCmpUuId());
|
|
|
goods.setCode(product.getPcmpcode());
|
|
|
goods.setImg(product.getCmpImg());
|