|
@@ -19,6 +19,7 @@ import com.hwrj.cloud.admin.dto.PmsProductResult;
|
|
|
import com.hwrj.cloud.admin.mapper.*;
|
|
|
import com.hwrj.cloud.admin.model.*;
|
|
|
import com.hwrj.cloud.admin.service.PmsProductService;
|
|
|
+import com.hwrj.cloud.admin.util.CurrUserUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -82,6 +83,11 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|
|
//创建商品
|
|
|
PmsProduct product = productParam;
|
|
|
product.setId(null);
|
|
|
+ long compId = CurrUserUtil.getCompId();
|
|
|
+ if(StringUtils.isEmpty(compId)){
|
|
|
+ throw new RuntimeException("没有绑定供应商无法新增!");
|
|
|
+ }
|
|
|
+ productParam.setCompId(compId);
|
|
|
productMapper.insertSelective(product);
|
|
|
//根据促销类型设置价格:会员价格、阶梯价格、满减价格
|
|
|
Long productId = product.getId();
|
|
@@ -150,14 +156,26 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|
|
updateInfo.setPrefrenceAreaProductRelationList(relationInputs);
|
|
|
return updateInfo;
|
|
|
}
|
|
|
-
|
|
|
+ public void check(PmsProductParam productParam){
|
|
|
+ long compId = CurrUserUtil.getCompId();
|
|
|
+ if(StringUtils.isEmpty(compId)){
|
|
|
+ throw new RuntimeException("没有绑定供应商无法修改!");
|
|
|
+ }
|
|
|
+ Long productcompId = productParam.getCompId();
|
|
|
+ if(!productcompId.equals(compId)){
|
|
|
+ throw new RuntimeException("你不能修改别的供应商数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int update(Long id, PmsProductParam productParam) {
|
|
|
+ //检验供应商
|
|
|
+ check(productParam);
|
|
|
int count;
|
|
|
//更新商品信息
|
|
|
PmsProduct product = productParam;
|
|
|
product.setId(id);
|
|
|
+ product.setCompId(CurrUserUtil.getCompId());
|
|
|
productMapper.updateByPrimaryKeySelective(product);
|
|
|
//会员价格
|
|
|
PmsMemberPriceExample pmsMemberPriceExample = new PmsMemberPriceExample();
|
|
@@ -234,10 +252,15 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|
|
|
|
|
@Override
|
|
|
public List<PmsProduct> list(PmsProductQueryParam productQueryParam, Integer pageSize, Integer pageNum) {
|
|
|
+
|
|
|
+ long compId = CurrUserUtil.getCompId();
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
PmsProductExample productExample = new PmsProductExample();
|
|
|
PmsProductExample.Criteria criteria = productExample.createCriteria();
|
|
|
criteria.andDeleteStatusEqualTo(0);
|
|
|
+ if(!StringUtils.isEmpty(compId)){
|
|
|
+ criteria.andCompIdEqualTo(compId);
|
|
|
+ }
|
|
|
if (productQueryParam.getPublishStatus() != null) {
|
|
|
criteria.andPublishStatusEqualTo(productQueryParam.getPublishStatus());
|
|
|
}
|
|
@@ -310,6 +333,7 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|
|
|
|
|
@Override
|
|
|
public int updateDeleteStatus(List<Long> ids, Integer deleteStatus) {
|
|
|
+
|
|
|
PmsProduct record = new PmsProduct();
|
|
|
record.setDeleteStatus(deleteStatus);
|
|
|
PmsProductExample example = new PmsProductExample();
|
|
@@ -372,7 +396,7 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|
|
private PmsProductExcelDao productExcelDao;
|
|
|
|
|
|
@Override
|
|
|
- public List<BigDataListVo> bigDataList(BigDataListParam bigDataListParam) {
|
|
|
+ public List<BigDataListInfoVo> bigDataList(BigDataListParam bigDataListParam) {
|
|
|
PageHelper.startPage(bigDataListParam.getPageNum(), bigDataListParam.getPageSize());
|
|
|
return productExcelDao.bigDataList(bigDataListParam);
|
|
|
}
|