Commit a2533840 by jianshuqin

调整尚品家居成本费用和头程成本同步逻辑

parent 9c6fa9c3
......@@ -437,8 +437,20 @@ public class OrderSyncJob extends PointJob {
if (dcBaseOmsOrder.getPlatformType().toUpperCase().equals(PlatformType.Marketing.value()) && ((dcBaseWarehouse != null && Constant.CONSUMABLES_WAREHOUSE.equals(dcBaseWarehouse.getHqType())) || dcBaseOmsOrder.getHasTransferOrder())) {
dcBaseOmsSku.setCostProduct(BigDecimal.ZERO);
} else {
if (dcBaseOmsSku.getCompanyId() == 28896) {
DcBaseCostFurnishingMapper costFurnishingMapper = SessionUtil.getSession().getMapper(DcBaseCostFurnishingMapper.class);
BigDecimal costProduct = costFurnishingMapper.selectSkuCostProduct(dcBaseOmsSku.getBailunSku(), dcBaseOmsSku.getCreateTime());
if (costProduct != null) {
dcBaseOmsSku.setCostProduct(costProduct);
totalSkuCostProduct = totalSkuCostProduct.add(costProduct.multiply(BigDecimal.valueOf(dcBaseOmsSku.getBailunSkuQuantityOrdered())));
} else {
totalSkuCostProduct = totalSkuCostProduct.add(bailunSkuStructure.getBailunSkuUnitPrice().multiply(BigDecimal.valueOf(dcBaseOmsSku.getBailunSkuQuantityOrdered())));
}
}
if (dcBaseOmsSku.getCostProduct() == null || dcBaseOmsSku.getCostProduct().compareTo(BigDecimal.ZERO) < 1) {
dcBaseOmsSku.setCostProduct(bailunSkuStructure.getBailunSkuUnitPrice());
}
}
dcBaseOmsSku.setCostPromotion(skuCostPromotion.divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
dcBaseOmsSku.setAmountSales(skuAmountSales.divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
dcBaseOmsSku.setAmountShipping(skuAmountShipping.divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
......@@ -642,9 +654,17 @@ public class OrderSyncJob extends PointJob {
}*/
DcBaseOmsConfigCostFirstMapper costFirstMapper = SessionUtil.getSession().getMapper(DcBaseOmsConfigCostFirstMapper.class);
DcBaseOmsConfigCostFirst omsConfigCostFirst = costFirstMapper.selectOneByExample(DcBaseOmsConfigCostFirstExample.newAndCreateCriteria().andCompanyIdEqualTo(dcBaseOmsSku.getCompanyId()).andBailunSkuEqualTo(dcBaseOmsSku.getBailunSku()).andWarehouseCodeEqualTo(dcBaseOmsSku.getWarehouseCode()).example());
DcBaseCostFurnishingMapper costFurnishingMapper = SessionUtil.getSession().getMapper(DcBaseCostFurnishingMapper.class);
//尚品头程费
if (dcBaseOmsSku.getCompanyId() == 28896){
BigDecimal costFirst = costFurnishingMapper.selectSkuCostFirst(dcBaseOmsSku.getBailunSku(), dcBaseOmsSku.getCreateTime());
if (costFirst != null) {
dcBaseOmsSku.setCostFirst(costFirst);
}
}
if (omsConfigCostFirst != null) {
dcBaseOmsSku.setCostFirst(bailunSkuStructure.getBailunSkuWeight().multiply(omsConfigCostFirst.getPrice()).setScale(5, RoundingMode.HALF_EVEN));
} else {
} else if (dcBaseOmsSku.getCompanyId() != 28896 || dcBaseOmsSku.getCostFirst() == null || dcBaseOmsSku.getCostFirst().compareTo(BigDecimal.ZERO) < 1) {
DcMidCostFirstMapper mapper = SessionUtil.getSession().getMapper(DcMidCostFirstMapper.class);
DcMidCostFirst dcMidCostFirst = mapper.selectOneByExample(DcMidCostFirstExample.newAndCreateCriteria()
.andBailunSkuEqualTo(dcBaseOmsSku.getBailunSku())
......@@ -682,8 +702,10 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsSku.setCostProduct(BigDecimal.ZERO);
} else {
BigDecimal bailunSkuQuantityOrdered = BigDecimal.valueOf(dcBaseOmsSku.getBailunSkuQuantityOrdered());
if (dcBaseOmsSku.getCompanyId() != 28896) {
totalSkuCostProduct = totalSkuCostProduct.add(bailunSkuStructure.getBailunSkuUnitPrice().multiply(bailunSkuQuantityOrdered));
}
}
return totalSkuCostProduct;
}
......
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseCostFurnishing;
import com.bailuntec.domain.example.DcBaseCostFurnishingExample;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface DcBaseCostFurnishingMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
long countByExample(DcBaseCostFurnishingExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int deleteByExample(DcBaseCostFurnishingExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int insert(DcBaseCostFurnishing record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int insertSelective(DcBaseCostFurnishing record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcBaseCostFurnishing selectOneByExample(DcBaseCostFurnishingExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
List<DcBaseCostFurnishing> selectByExample(DcBaseCostFurnishingExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
DcBaseCostFurnishing selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcBaseCostFurnishing record, @Param("example") DcBaseCostFurnishingExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcBaseCostFurnishing record, @Param("example") DcBaseCostFurnishingExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcBaseCostFurnishing record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
*/
int updateByPrimaryKey(DcBaseCostFurnishing record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcBaseCostFurnishing record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_cost_furnishing
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseCostFurnishing record);
BigDecimal selectSkuCostFirst(@Param("skuCode") String skuCode, @Param("createTime") LocalDateTime createTime);
BigDecimal selectSkuCostProduct(@Param("skuCode") String skuCode, @Param("createTime") LocalDateTime createTime);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment