|
|
|
|
@ -147,6 +147,8 @@ public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, ProductEn |
|
|
|
|
CatalogEntity catalogOne = catalogService.getById(catalogTwo.getParentId()); |
|
|
|
|
vo.setCatalogOne(catalogOne.getName()); |
|
|
|
|
vo.setCatalogTwo(catalogTwo.getName()); |
|
|
|
|
vo.setCatalogOneId(catalogOne.getId()); |
|
|
|
|
vo.setCatalogTwoId(catalogTwo.getId()); |
|
|
|
|
listVO.add(vo); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@ -154,53 +156,52 @@ public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, ProductEn |
|
|
|
|
IPage<ProductVO> pagesVO = Condition.getPage(query); |
|
|
|
|
pagesVO.setRecords(listVO); |
|
|
|
|
pagesVO.setSize(listVO.size()); |
|
|
|
|
if(user.getRoleName().equals("administrator")){ |
|
|
|
|
// 迭代器去添加元素。
|
|
|
|
|
ListIterator<ProductVO> it = pagesVO.getRecords().listIterator(); |
|
|
|
|
while (it.hasNext()) { |
|
|
|
|
ProductVO vo1 = it.next(); |
|
|
|
|
// 默认
|
|
|
|
|
vo1.setBizType(ProductConst.BIZ_TYPE_PRICE_STANDARD); |
|
|
|
|
// TYPE_PRICE_CUSTOM 数据是拼接上的
|
|
|
|
|
LambdaQueryWrapper<BizPriceEntity> wrapper = new LambdaQueryWrapper(); |
|
|
|
|
wrapper.eq(BizPriceEntity::getProductId,vo1.getId()); |
|
|
|
|
if(customerId != null){ |
|
|
|
|
wrapper.eq(BizPriceEntity::getCustomerId,customerId); |
|
|
|
|
} |
|
|
|
|
long count = bizPriceService.count(wrapper); |
|
|
|
|
if (count != 0L) { |
|
|
|
|
List<BizPriceEntity> listBP = bizPriceService.listByProductId(vo1.getId(),customerId); |
|
|
|
|
listBP.forEach(bp -> { |
|
|
|
|
ProductVO vo2 = new ProductVO(); |
|
|
|
|
BeanUtils.copyProperties(vo1, vo2); |
|
|
|
|
BeanUtils.copyProperties(bp, vo2); |
|
|
|
|
vo2.setId(vo1.getId()); |
|
|
|
|
// 特定价
|
|
|
|
|
vo2.setBizType(ProductConst.BIZ_TYPE_PRICE_CUSTOM); |
|
|
|
|
vo2.setBizPriceId(bp.getId()); |
|
|
|
|
vo2.setStandardPrice(bp.getBizPrice()); |
|
|
|
|
//
|
|
|
|
|
CustomerEntity customer = customerService.getById(bp.getCustomerId()); |
|
|
|
|
if (customer != null) { |
|
|
|
|
String countryValue = dictService.getValue(ContactConst.DICT_CUSTOMER_COUNTRY, customer.getCountry()); |
|
|
|
|
String sbRemark = |
|
|
|
|
countryValue + |
|
|
|
|
customer.getCompanyName() + |
|
|
|
|
"专用"; |
|
|
|
|
vo2.setBizRemark(sbRemark); |
|
|
|
|
vo2.setCustomerCompanyName(customer.getCompanyName()); |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
User u = userService.getById(vo2.getSaleUserId()); |
|
|
|
|
if (u != null) { |
|
|
|
|
vo2.setSaleUserRealName(u.getRealName()); |
|
|
|
|
} |
|
|
|
|
// 迭代器去添加元素。
|
|
|
|
|
ListIterator<ProductVO> it = pagesVO.getRecords().listIterator(); |
|
|
|
|
while (it.hasNext()) { |
|
|
|
|
ProductVO vo1 = it.next(); |
|
|
|
|
// 默认
|
|
|
|
|
vo1.setBizType(ProductConst.BIZ_TYPE_PRICE_STANDARD); |
|
|
|
|
// TYPE_PRICE_CUSTOM 数据是拼接上的
|
|
|
|
|
LambdaQueryWrapper<BizPriceEntity> wrapper = new LambdaQueryWrapper(); |
|
|
|
|
wrapper.eq(BizPriceEntity::getProductId,vo1.getId()); |
|
|
|
|
if(customerId != null){ |
|
|
|
|
wrapper.eq(BizPriceEntity::getCustomerId,customerId); |
|
|
|
|
} |
|
|
|
|
long count = bizPriceService.count(wrapper); |
|
|
|
|
if (count != 0L) { |
|
|
|
|
it.remove(); |
|
|
|
|
List<BizPriceEntity> listBP = bizPriceService.listByProductId(vo1.getId(),customerId); |
|
|
|
|
listBP.forEach(bp -> { |
|
|
|
|
ProductVO vo2 = new ProductVO(); |
|
|
|
|
BeanUtils.copyProperties(vo1, vo2); |
|
|
|
|
BeanUtils.copyProperties(bp, vo2); |
|
|
|
|
vo2.setId(vo1.getId()); |
|
|
|
|
// 特定价
|
|
|
|
|
vo2.setBizType(ProductConst.BIZ_TYPE_PRICE_CUSTOM); |
|
|
|
|
vo2.setBizPriceId(bp.getId()); |
|
|
|
|
vo2.setStandardPrice(bp.getBizPrice()); |
|
|
|
|
//
|
|
|
|
|
CustomerEntity customer = customerService.getById(bp.getCustomerId()); |
|
|
|
|
if (customer != null) { |
|
|
|
|
String countryValue = dictService.getValue(ContactConst.DICT_CUSTOMER_COUNTRY, customer.getCountry()); |
|
|
|
|
String sbRemark = |
|
|
|
|
countryValue + |
|
|
|
|
customer.getCompanyName() + |
|
|
|
|
"专用"; |
|
|
|
|
vo2.setBizRemark(sbRemark); |
|
|
|
|
vo2.setCustomerCompanyName(customer.getCompanyName()); |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
User u = userService.getById(vo2.getSaleUserId()); |
|
|
|
|
if (u != null) { |
|
|
|
|
vo2.setSaleUserRealName(u.getRealName()); |
|
|
|
|
} |
|
|
|
|
it.add(vo2); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
log.info("not contain."); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
it.add(vo2); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
log.info("not contain."); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|