diff --git a/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java b/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java index f223b25..d345d06 100644 --- a/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/ProductServiceImpl.java @@ -15,6 +15,7 @@ import com.xkrs.utils.DateTimeUtil; import com.xkrs.utils.Query; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDateTime; @@ -59,7 +60,7 @@ public class ProductServiceImpl implements ProductService { List productCover = productQo.getProductCover(); // 商品内容图片 List productContent = productQo.getProductContent(); - BusinessEntity byBusinessId = businessDao.findByBusinessId(business); + BusinessEntity byBusinessId = businessDao.findByBusinessIdAndBusinessType(business,"1"); if(byBusinessId == null){ return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"您还未入驻,请先入驻!",locale); } @@ -142,6 +143,7 @@ public class ProductServiceImpl implements ProductService { * @param reviewType * @return */ + @Transactional(rollbackFor=Exception.class) @Override public String updateReviewType(Integer productId, String reviewType) { Locale locale = LocaleContextHolder.getLocale(); @@ -152,7 +154,7 @@ public class ProductServiceImpl implements ProductService { if(reviewType.equals(byId.getReviewType()) || reviewType.compareTo(byId.getReviewType()) < 0){ return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"操作错误!",locale); } - if(reviewType.equals("3")){ + if("3".equals(reviewType)){ String dateTimeToString = DateTimeUtil.dateTimeToString(LocalDateTime.now()); productDao.updateShelfType(productId,"1",dateTimeToString); }