|
@@ -14,6 +14,10 @@ import com.kmall.admin.entity.kmall2eccs.KtoEccsEntity;
|
|
|
import com.kmall.admin.entity.mk.MkActivitiesEntity;
|
|
|
import com.kmall.admin.entity.shop.ShopErrorPriceRecordEntity;
|
|
|
import com.kmall.admin.haikong.client.HaiKongWarehouseTemplate;
|
|
|
+import com.kmall.admin.haikong.constant.Constants;
|
|
|
+import com.kmall.admin.haikong.dto.Criteria;
|
|
|
+import com.kmall.admin.haikong.dto.WareQueryStockParamDTO;
|
|
|
+import com.kmall.admin.haikong.dto.WareQueryStockResponseDTO;
|
|
|
import com.kmall.admin.haikong.vo.QueryGoodsVO;
|
|
|
import com.kmall.admin.service.*;
|
|
|
import com.kmall.admin.service.kmall2eccs.KtoEccsService;
|
|
@@ -24,10 +28,13 @@ import com.kmall.admin.service.shop.ShopErrorPriceRecordService;
|
|
|
import com.kmall.admin.utils.CalculateTax;
|
|
|
import com.kmall.admin.utils.GoodsUtils;
|
|
|
import com.kmall.admin.utils.ShiroUtils;
|
|
|
+import com.kmall.admin.utils.jackson.JacksonUtil;
|
|
|
import com.kmall.api.entity.exportpdf.PDFGoodsDto;
|
|
|
import com.kmall.common.constant.Dict;
|
|
|
import com.kmall.admin.fromcomm.entity.SysUserEntity;
|
|
|
import com.kmall.common.utils.*;
|
|
|
+import com.kmall.manager.manager.express.sf.ServiceException;
|
|
|
+import com.kmall.manager.manager.redis.JedisCacheManager;
|
|
|
import com.kmall.manager.manager.redis.JedisUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -1749,7 +1756,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String,Object> calculateGoodsDetail(String prodBarcode, String storeId,String sku) {
|
|
|
+ public synchronized Map<String,Object> calculateGoodsDetail(String prodBarcode, String storeId, String sku) {
|
|
|
/**
|
|
|
* 1.首先根据商品条码跟门店id查询是否有库存,没库存直接返回
|
|
|
*/
|
|
@@ -1762,38 +1769,68 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
* 2. 查询海仓仓库系统,判断库存是否足够
|
|
|
* TODO 测试的时候注释,海控仓库系统没有测试环境,上生产时放开注释
|
|
|
* */
|
|
|
- /*WareQueryStockParamDTO wareQueryStockParamDTO = new WareQueryStockParamDTO();
|
|
|
- List<Criteria> criteriaList = new ArrayList<>();
|
|
|
- Criteria criteria = new Criteria();
|
|
|
- criteria.setItemId(goods.getProdBarcode());
|
|
|
- criteria.setItemCode(goods.getSku());
|
|
|
- criteriaList.add(criteria);
|
|
|
- wareQueryStockParamDTO.setCriteriaList(criteriaList);
|
|
|
- String queryWarehouseStockResponse = haiKongWarehouseTemplate.queryWarehouseStock(wareQueryStockParamDTO);
|
|
|
- log.info("调用海控仓库系统,请求参数,门店:{}、商品条码:{}、商品编码:{},响应数据:{}", storeId, prodBarcode, sku, queryWarehouseStockResponse);
|
|
|
- if (org.springframework.util.StringUtils.isEmpty(queryWarehouseStockResponse)) {
|
|
|
- log.error("调用库存系统接口出现错误!返回结果为空!");
|
|
|
- throw new ServiceException("调用库存系统接口出现错误!");
|
|
|
- }
|
|
|
- WareQueryStockResponseDTO wareQueryStockResponseDTO = JacksonUtil.fromStringJson(queryWarehouseStockResponse, WareQueryStockResponseDTO.class);
|
|
|
- if (Objects.isNull(wareQueryStockResponseDTO)) {
|
|
|
- log.error("解析一步达库存系统响应数据出现错误!请求响应结果:{}", queryWarehouseStockResponse);
|
|
|
- throw new ServiceException("解析一步达库存系统响应数据出现错误!");
|
|
|
- }
|
|
|
- // 校验库存
|
|
|
- WareQueryStockResponseDTO.WareQueryStockResponseItemDTO itemDTO = wareQueryStockResponseDTO.getItems().get(0);
|
|
|
- // 仓库可用库存
|
|
|
- int wareQuantity = itemDTO.getQuantity() - itemDTO.getLockQuantity();
|
|
|
- // 海控展销店出区数
|
|
|
+ sku = org.springframework.util.StringUtils.isEmpty(sku) ? goods.getSku() : sku;
|
|
|
+ String wareStockNumberKey = storeId + sku + prodBarcode;
|
|
|
+ String warehouseStockMapKey = Constants.WAREHOUSE_STOCK_MAP_KEY + "_" + storeId;
|
|
|
+ String redisCacheWareQuantity = JedisUtil.hget(warehouseStockMapKey, wareStockNumberKey);
|
|
|
+ Integer wareQuantity = 0;
|
|
|
Integer exitRegionNumber = goods.getExitRegionNumber();
|
|
|
- // 门店库存
|
|
|
String stockNum = goods.getStockNum();
|
|
|
- // 扫码只会扫一件商品,保税仓库存 + 展销店库存 - 出区数 >= 购买数
|
|
|
- if (!((wareQuantity + Integer.parseInt(stockNum) - exitRegionNumber) >= 1)) {
|
|
|
+ Integer sellVolume = Objects.isNull(goods.getSellVolume()) ? 1 : goods.getSellVolume();
|
|
|
+ if (org.springframework.util.StringUtils.isEmpty(redisCacheWareQuantity)) {
|
|
|
+
|
|
|
+// WareQueryStockParamDTO wareQueryStockParamDTO = new WareQueryStockParamDTO();
|
|
|
+// List<Criteria> criteriaList = new ArrayList<>();
|
|
|
+// Criteria criteria = new Criteria();
|
|
|
+// criteria.setItemId(goods.getProdBarcode());
|
|
|
+// criteria.setItemCode(goods.getSku());
|
|
|
+// criteriaList.add(criteria);
|
|
|
+// wareQueryStockParamDTO.setCriteriaList(criteriaList);
|
|
|
+// String queryWarehouseStockResponse = haiKongWarehouseTemplate.queryWarehouseStock(wareQueryStockParamDTO);
|
|
|
+// log.info("调用海控仓库系统,请求参数,门店:{}、商品条码:{}、商品编码:{},响应数据:{}", storeId, prodBarcode, sku, queryWarehouseStockResponse);
|
|
|
+// if (org.springframework.util.StringUtils.isEmpty(queryWarehouseStockResponse)) {
|
|
|
+// log.error("调用库存系统接口出现错误!返回结果为空!");
|
|
|
+// throw new ServiceException("调用库存系统接口出现错误!");
|
|
|
+// }
|
|
|
+// WareQueryStockResponseDTO wareQueryStockResponseDTO = JacksonUtil.fromStringJson(queryWarehouseStockResponse, WareQueryStockResponseDTO.class);
|
|
|
+
|
|
|
+ /* -----------------↓--------------测试数据,生产请注释-------------------↓------------ */
|
|
|
+ WareQueryStockResponseDTO wareQueryStockResponseDTO = new WareQueryStockResponseDTO();
|
|
|
+ wareQueryStockResponseDTO.setCode("0");
|
|
|
+ wareQueryStockResponseDTO.setFlag("success");
|
|
|
+ wareQueryStockResponseDTO.setMessage("");
|
|
|
+ WareQueryStockResponseDTO.WareQueryStockResponseItemDTO wareQueryStockResponseItemDTO = new WareQueryStockResponseDTO.WareQueryStockResponseItemDTO();
|
|
|
+ wareQueryStockResponseItemDTO.setQuantity(3);
|
|
|
+ wareQueryStockResponseItemDTO.setItemCode(sku);
|
|
|
+ wareQueryStockResponseItemDTO.setProduceCode(prodBarcode);
|
|
|
+ List<WareQueryStockResponseDTO.WareQueryStockResponseItemDTO> wareQueryStockResponseItemDTOS = new ArrayList<>();
|
|
|
+ wareQueryStockResponseItemDTOS.add(wareQueryStockResponseItemDTO);
|
|
|
+ wareQueryStockResponseDTO.setItems(wareQueryStockResponseItemDTOS);
|
|
|
+ /* -----------------↑--------------测试数据,生产请注释------------------↑------------- */
|
|
|
+
|
|
|
+
|
|
|
+ if (Objects.isNull(wareQueryStockResponseDTO)) {
|
|
|
+// log.error("解析一步达库存系统响应数据出现错误!请求响应结果:{}", queryWarehouseStockResponse);
|
|
|
+ throw new ServiceException("解析一步达库存系统响应数据出现错误!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验库存
|
|
|
+ WareQueryStockResponseDTO.WareQueryStockResponseItemDTO itemDTO = wareQueryStockResponseDTO.getItems().get(0);
|
|
|
+ // 仓库可用库存
|
|
|
+ wareQuantity = itemDTO.getQuantity();
|
|
|
+ JedisUtil.hset(warehouseStockMapKey, wareStockNumberKey, String.valueOf(wareQuantity));
|
|
|
+ } else {
|
|
|
+ wareQuantity = Integer.parseInt(redisCacheWareQuantity);
|
|
|
+ }
|
|
|
+ // 保税仓库存 + 展销店库存 - 出区数 >= 购买数
|
|
|
+ if (!((wareQuantity + Integer.parseInt(stockNum) - exitRegionNumber) > sellVolume)) {
|
|
|
// 库存不足
|
|
|
- log.error("商品条码:【{}】,sku:【{}】,门店ID:【{}】,该商品库存不足!", prodBarcode, sku, storeId);
|
|
|
- throw new ServiceException(String.format("商品条码:【%s】,sku:【%s】,门店ID:【%s】,该商品库存不足!", prodBarcode, sku, storeId));
|
|
|
- }*/
|
|
|
+ log.error("商品条码:【{}】,sku:【{}】,门店库存:【{}】,保税仓库存:【{}】,出区数:【{}】,该商品仓库库存不足!", prodBarcode, sku, stockNum, wareQuantity, exitRegionNumber);
|
|
|
+ throw new ServiceException(String.format("商品条码:【%s】,sku:【%s】,门店库存:【%s】,保税仓库存:【%s】,出区数:【%s】,该商品仓库库存不足!", prodBarcode, sku, stockNum, wareQuantity, exitRegionNumber));
|
|
|
+ } else {
|
|
|
+ JedisUtil.hset(warehouseStockMapKey, wareStockNumberKey, String.valueOf(wareQuantity - sellVolume));
|
|
|
+ }
|
|
|
+
|
|
|
goods.setDiscountedPrice(new BigDecimal(0));
|
|
|
BigDecimal retailPrice = goods.getRetailPrice();
|
|
|
|
|
@@ -1801,252 +1838,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|
|
|
Map<String,Object> skuActivitiesMap = new HashMap<>();
|
|
|
|
|
|
-// /**
|
|
|
-// * 2.查询当前时间,该门店是否有活动,如果有活动,查询开启了哪些营销方式
|
|
|
-// * 参数: 当前时间 门店id
|
|
|
-// */
|
|
|
-// /*List<MkActivitiesEntity> mkActivitiesEntityList = mkActivitiesService.queryByNow(storeId,format.format(new Date()));
|
|
|
-//
|
|
|
-// if(mkActivitiesEntityList == null || mkActivitiesEntityList.size() == 0){
|
|
|
-// // 计算税费
|
|
|
-// GoodsEntity goodsEntity = goodsDao.queryByBarcodeAndSku(prodBarcode, goods.getGoodsSn());
|
|
|
-// BigDecimal tax = CalculateTax.calculateFinalTax(goodsEntity,goods.getActualPaymentAmount(),this).setScale(3,RoundingMode.HALF_UP);
|
|
|
-// goods.setGoodstaxes(tax.toString());
|
|
|
-// skuActivitiesMap.put("goods",goods);
|
|
|
-// return skuActivitiesMap;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// // 遍历活动集合,查询有哪些活动是开启的
|
|
|
-// boolean daily = false,coupon = false,combinationPrice = false
|
|
|
-// ,discount = false,fullGift = false,fullReduction = false
|
|
|
-// ,getOneFree = false,promotion = false,halfPrice = false;
|
|
|
-//
|
|
|
-// List<String> topicList = new ArrayList<>(); // 记录有哪些营销活动的topic
|
|
|
-// Map<String,String> mkaIdMap = new HashMap<>(); // 记录topic跟mkaId的关系
|
|
|
-// // 将所有的营销活动新增到list中
|
|
|
-// for(MkActivitiesEntity mkActivitiesEntity : mkActivitiesEntityList){
|
|
|
-// topicList.add(mkActivitiesEntity.getMkaTopic());
|
|
|
-// String mkaId = mkaIdMap.putIfAbsent(mkActivitiesEntity.getMkaTopic(), mkActivitiesEntity.getMkaId()+"");
|
|
|
-// if(StringUtils.isNotEmpty(mkaId)){
|
|
|
-//// mkaId = "'"+mkaId + "','" + mkActivitiesEntity.getMkaId()+"'";
|
|
|
-// mkaId += String.format(",%s",mkActivitiesEntity.getMkaId());
|
|
|
-// mkaIdMap.put(mkActivitiesEntity.getMkaTopic(),mkaId);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // 判断有哪些营销活动
|
|
|
-// if(topicList.contains("zhjsp")) // 组合价
|
|
|
-// combinationPrice = true;
|
|
|
-// if(topicList.contains("dz")) // 打折
|
|
|
-// discount = true;
|
|
|
-// if(topicList.contains("mz")) //满赠
|
|
|
-// fullGift = true;
|
|
|
-// if(topicList.contains("mj")) // 满减
|
|
|
-// fullReduction = true;
|
|
|
-// if(topicList.contains("mysy")) // 买一送一
|
|
|
-// getOneFree = true;
|
|
|
-// if(topicList.contains("rchd")) // 日常活动
|
|
|
-// daily = true;
|
|
|
-// if(topicList.contains("yhq")) // 优惠券
|
|
|
-// coupon = true;
|
|
|
-// if(topicList.contains("lscx")) // 临时促销
|
|
|
-// promotion = true;
|
|
|
-// if(topicList.contains("drjbj"))
|
|
|
-// halfPrice = true;
|
|
|
-//
|
|
|
-//
|
|
|
-// // 获取未优惠前的商品价格
|
|
|
-// retailPrice = goods.getRetailPrice();
|
|
|
-//
|
|
|
-//
|
|
|
-// // 根据条码查询商品品牌名称 mall_brand mall_product_store_rela mall_goods
|
|
|
-// String brandName = goods.getBrand();
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 优先级:临时促销 》买一送一=满赠 》 组合价=日常活动 》 打折=满减 》 优惠券
|
|
|
-// *//*
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 组合价的做法就是将参与组合的条码带到收银端
|
|
|
-// * 现根据营销活动id跟条形码,查询有哪些参与该条码组合的商品
|
|
|
-// *
|
|
|
-// *
|
|
|
-// * TODO
|
|
|
-// *//*
|
|
|
-// if(combinationPrice){
|
|
|
-// String mkaId = mkaIdMap.get("zhjsp");
|
|
|
-// Map<String,Object> param = new HashMap<>();
|
|
|
-// param.put("mkaId",mkaId);
|
|
|
-// param.put("prodBarcode",prodBarcode);
|
|
|
-// List<MkActivitiesCombinationPriceEntity> combinationPriceList = combinationPriceService.queryList(param);
|
|
|
-// if(combinationPriceList != null && combinationPriceList.size() > 0) {
|
|
|
-// Map<String, List<MkActivitiesCombinationPriceEntity>> collect =
|
|
|
-// combinationPriceList.stream().collect(Collectors.groupingBy(MkActivitiesCombinationPriceEntity::getCombinationType));
|
|
|
-//
|
|
|
-// skuActivitiesMap.put("zhjsp",collect);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-// String nowTime = format.format(new Date());
|
|
|
-// *//**
|
|
|
-// * 满减可能是跟着条码,也可能跟着品牌
|
|
|
-// * 根据商品品牌跟商品条码去查询是否有优惠金额
|
|
|
-// *
|
|
|
-// * 满足金额 购买商品条码 赠品条码
|
|
|
-// *
|
|
|
-// *//*
|
|
|
-// Map<String,Object> fullReductionMap = new HashMap<>();
|
|
|
-// if(fullReduction){
|
|
|
-// String mkaId = mkaIdMap.get("mj");
|
|
|
-// MkActivitiesFullReductionEntity fullReductionEntity = fullReductionService.queryByCodeOrBrand(mkaId,prodBarcode,brandName,nowTime);
|
|
|
-// if(fullReductionEntity != null) {
|
|
|
-// if(!StringUtils.isNullOrEmpty(fullReductionEntity.getProductBrand())){
|
|
|
-// // 跟着品牌走
|
|
|
-// fullReductionMap.put(brandName,fullReductionEntity);
|
|
|
-// }else{
|
|
|
-// // 跟着条码走
|
|
|
-// fullReductionMap.put(fullReductionEntity.getBarcode(), fullReductionEntity);
|
|
|
-// }
|
|
|
-// skuActivitiesMap.put("mj",fullReductionMap);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 满赠可能是跟着条码,也可能跟着品牌
|
|
|
-// * 根据商品品牌跟商品条码去查询是否有满赠
|
|
|
-// * 1.先扫买的商品,然后查询出赠送的商品条码
|
|
|
-// * 2.先扫赠的商品,然后查询出符合条件的商品条码或者品牌
|
|
|
-// * 满足的金额 购买的商品条码或者品牌 赠送的商品条码
|
|
|
-// * TODO
|
|
|
-// *//*
|
|
|
-// Map<String,Object> fullGiftMap = new HashMap<>();
|
|
|
-// if(fullGift){
|
|
|
-// String mkaId = mkaIdMap.get("mz");
|
|
|
-// MkActivitiesFullGiftEntity giftEntity = fullGiftService.queryByCodeOrBrand(mkaId,prodBarcode,brandName,nowTime);
|
|
|
-// if(giftEntity != null) {
|
|
|
-// if(giftEntity.getProductBrand() != null){
|
|
|
-// // 跟着品牌走
|
|
|
-// fullGiftMap.put(brandName,giftEntity);
|
|
|
-// }else{
|
|
|
-// // 跟着条码走
|
|
|
-// fullGiftMap.put(giftEntity.getBarcode(), giftEntity);
|
|
|
-// }
|
|
|
-// skuActivitiesMap.put("mz",fullGiftMap);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 买一送一可能是跟着条码,也可能跟着品牌
|
|
|
-// * 根据商品品牌跟商品条码去查询是否有送的商品
|
|
|
-// * 有两个场景
|
|
|
-// * 1.先扫买的商品,然后查询出赠送的商品条码
|
|
|
-// * 2.先扫赠的商品,然后查询出符合条件的商品条码或者品牌
|
|
|
-// * 所以就需要一个map
|
|
|
-// * key为购买的商品条码或者商品品牌 value为赠送的商品条码
|
|
|
-// * 但是品牌是根据条码查询的,所以最终map里面的结构是
|
|
|
-// * key 商品条码 value 赠品条码
|
|
|
-// *//*
|
|
|
-// if(getOneFree){
|
|
|
-// String mkaId = mkaIdMap.get("mysy");
|
|
|
-// MkActivitiesGetOneFreeGoodsEntity getOneFreeGoodsEntity = getOneFreeGoodsService.queryByCodeOrBrand(mkaId,prodBarcode,brandName);
|
|
|
-// if(getOneFreeGoodsEntity != null){
|
|
|
-// if("无".equals(getOneFreeGoodsEntity.getProductBrand())){
|
|
|
-// getOneFreeGoodsEntity.setBrand(false);
|
|
|
-// skuActivitiesMap.put("mysy",getOneFreeGoodsEntity);
|
|
|
-// }else{
|
|
|
-// getOneFreeGoodsEntity.setBrand(true);
|
|
|
-// skuActivitiesMap.put("mysy",getOneFreeGoodsEntity);
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// // 第二份半价
|
|
|
-// if(halfPrice){
|
|
|
-// String mkaId = mkaIdMap.get("drjbj");
|
|
|
-// MkActivitiesHalfPriceEntity activitiesHalfPriceEntity = halfPriceService.queryByCodeOrBrand(mkaId,prodBarcode);
|
|
|
-// if(activitiesHalfPriceEntity != null){
|
|
|
-// skuActivitiesMap.put("drjbj",activitiesHalfPriceEntity);
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// // --------------------------------------------------------------------------------------
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 优惠券跟着条形码走,一般是设置一个标识,然后最后输入优惠券码后,减扣对应的标识,所以返回一个map数组
|
|
|
-// *//*
|
|
|
-//
|
|
|
-// if(coupon){
|
|
|
-// String mkaId = mkaIdMap.get("yhq");
|
|
|
-// MkActivitiesCouponEntity couponEntity = couponService.queryByBarCode(mkaId,prodBarcode,nowTime);
|
|
|
-// if(couponEntity != null){ // 优惠券码,优惠金额
|
|
|
-// Map<String,Object> returnMap = new HashMap<>();
|
|
|
-// returnMap.put(couponEntity.getCouponSn() , couponEntity.getCouponPrice());
|
|
|
-// skuActivitiesMap.put("yhq",returnMap);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 打折的价格是与条形码对应的,所以需要根据条形码和营销方式id去查询活动价格
|
|
|
-// *//*
|
|
|
-//
|
|
|
-// if(discount){
|
|
|
-// String mkaId = mkaIdMap.get("dz");
|
|
|
-// MkActivitiesDiscountEntity discountEntity = discountService.queryByBarCode(mkaId,prodBarcode);
|
|
|
-// // TODO 可能会直接替代产品价格
|
|
|
-// if (discountEntity != null) {
|
|
|
-// goods.setActualPaymentAmount(discountEntity.getActivityPrice());
|
|
|
-// goods.setRetailPrice(discountEntity.getActivityPrice());
|
|
|
-//
|
|
|
-// goods.setActivity("打折");
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 日常活动跟着条形码走,优先级比临时促销低,但是高于正常价格
|
|
|
-// *//*
|
|
|
-// if(daily){
|
|
|
-// String mkaId = mkaIdMap.get("rchd");
|
|
|
-// MkDailyActivitiesEntity dailyActivitiesEntity = dailyActivitiesService.queryByBarCode(mkaId,prodBarcode);
|
|
|
-// if(dailyActivitiesEntity != null){
|
|
|
-// goods.setActualPaymentAmount(dailyActivitiesEntity.getActivityPrice());
|
|
|
-// goods.setRetailPrice(dailyActivitiesEntity.getActivityPrice());
|
|
|
-//
|
|
|
-// goods.setActivity("日常活动");
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// *//**
|
|
|
-// * 临时促销跟着条形码走,优先级应该最高,所以排到了最下面
|
|
|
-// *//*
|
|
|
-// if(promotion){
|
|
|
-// String mkaId = mkaIdMap.get("lscx");
|
|
|
-// MkActivitiesPromotionEntity promotionEntity = promotionService.queryByBarCode(mkaId,prodBarcode);
|
|
|
-// // 如果该商品存在临时促销,直接替换活动价格
|
|
|
-// if(promotionEntity != null){
|
|
|
-// goods.setActualPaymentAmount(promotionEntity.getActivityPrice());
|
|
|
-// goods.setRetailPrice(promotionEntity.getActivityPrice());
|
|
|
-//
|
|
|
-// goods.setActivity("临时促销");
|
|
|
-//
|
|
|
-// }
|
|
|
-// }*/
|
|
|
-
|
|
|
// 计算税费
|
|
|
GoodsEntity goodsEntity = goodsDao.queryByBarcodeAndSku(prodBarcode, goods.getGoodsSn());
|
|
|
- BigDecimal tax = CalculateTax.calculateFinalTax(goodsEntity,goods.getActualPaymentAmount(),this).setScale(3,RoundingMode.HALF_UP);
|
|
|
+ BigDecimal tax = CalculateTax.calculateFinalTax(goodsEntity, goods.getActualPaymentAmount(),this).setScale(3,RoundingMode.HALF_UP);
|
|
|
goods.setGoodstaxes(tax.toString());
|
|
|
goods.setSellVolume(1);
|
|
|
|