添加了各级进行审核的功能模块
This commit is contained in:
parent
c1523b22ec
commit
1c1bc5b7d9
@ -91,4 +91,16 @@ public class ProductController {
|
||||
}
|
||||
return productService.selectProductReviewType(sysUserEntity.getId(),productCity,productCounty,reviewType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 各级进行审核的操作
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateReviewType")
|
||||
public String updateReviewType(@RequestBody Map map){
|
||||
Integer productId = (Integer) map.get("productId");
|
||||
String reviewType = (String) map.get("reviewType");
|
||||
return productService.updateReviewType(productId,reviewType);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.xkrs.dao;
|
||||
import com.xkrs.model.entity.ProductEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -20,10 +22,28 @@ public interface ProductDao extends JpaRepository<ProductEntity,Long>, JpaSpecif
|
||||
ProductEntity findByProductName(String productName);
|
||||
|
||||
/**
|
||||
* 商家查看商品信息
|
||||
* @param businessId
|
||||
* 修改审核状态
|
||||
* @param productId
|
||||
* @param reviewType
|
||||
*/
|
||||
@Modifying(clearAutomatically=true)
|
||||
@Query(value = "update product set review_type = ?2 where id = ?1",nativeQuery = true)
|
||||
void updateReviewType(Integer productId,String reviewType);
|
||||
|
||||
/**
|
||||
* 修改上架的状态
|
||||
* @param productId
|
||||
* @param shelfType
|
||||
* @param productTime
|
||||
*/
|
||||
@Modifying(clearAutomatically=true)
|
||||
@Query(value = "update product set shelf_type = ?2,product_time = ?3 where id = ?1",nativeQuery = true)
|
||||
void updateShelfType(Integer productId,String shelfType,String productTime);
|
||||
|
||||
/**
|
||||
* 根据id查询商品信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<ProductEntity> findAllByBusinessIdAndAndShelfType(Integer businessId,String shelfType);
|
||||
ProductEntity findById(Integer id);
|
||||
}
|
||||
|
@ -34,4 +34,12 @@ public interface ProductService {
|
||||
* @return
|
||||
*/
|
||||
String selectProductReviewType(Integer businessId, String productCity, String productCounty, String reviewType);
|
||||
|
||||
/**
|
||||
* 商品审核
|
||||
* @param productId
|
||||
* @param reviewType
|
||||
* @return
|
||||
*/
|
||||
String updateReviewType(Integer productId,String reviewType);
|
||||
}
|
||||
|
@ -135,4 +135,28 @@ public class ProductServiceImpl implements ProductService {
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,productEntities,locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品审核
|
||||
* @param productId
|
||||
* @param reviewType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String updateReviewType(Integer productId, String reviewType) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
ProductEntity byId = productDao.findById(productId);
|
||||
if(byId == null){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该商品的信息!",locale);
|
||||
}
|
||||
if(reviewType.equals(byId.getReviewType()) || reviewType.compareTo(byId.getReviewType()) < 0){
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"操作错误!",locale);
|
||||
}
|
||||
if(reviewType.equals("3")){
|
||||
String dateTimeToString = DateTimeUtil.dateTimeToString(LocalDateTime.now());
|
||||
productDao.updateShelfType(productId,"1",dateTimeToString);
|
||||
}
|
||||
productDao.updateReviewType(productId,reviewType);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功!",locale);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user