Commit 63e5a440 by jianshuqin

修改头程费逻辑

parent b6f37f38
#EVENT_RDB_STORAGE_DRIVER=com.mysql.jdbc.Driver
EVENT_RDB_STORAGE_URL=jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?useUnicode=true&characterEncoding=utf-8
EVENT_RDB_STORAGE_URL=jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&useSSL=false
#EVENT_RDB_STORAGE_USERNAME=root
#EVENT_RDB_STORAGE_PASSWORD=123456
......
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.job.SyncCostFirstFinishJob;
import com.bailuntec.job.SyncCostFirstJob;
import org.junit.jupiter.api.Test;
......@@ -10,8 +11,17 @@ public class SyncCostFirstTest {
public void test() {
SyncCostFirstJob syncCostFirstJob = new SyncCostFirstJob();
JobPointLog jobPointLog = new JobPointLog("base-sync-cost-first", 1, 1, 1, 1,
LocalDateTime.of(2020,8,1,0,0,0),
LocalDateTime.of(2020,9,10,0,0,0));
LocalDateTime.of(2021,12,8,15,40,0),
LocalDateTime.of(2021,12,8,15,50,0));
syncCostFirstJob.executeJob(null, jobPointLog);
}
@Test
public void test2() {
SyncCostFirstFinishJob syncCostFirstFinishJob = new SyncCostFirstFinishJob();
JobPointLog jobPointLog = new JobPointLog("base-sync-cost-first-finish", 1, 1, 1, 1,
LocalDateTime.of(2022,01,18,2,00,0),
LocalDateTime.of(2022,01,18,2,01,0));
syncCostFirstFinishJob.executeJob(null, jobPointLog);
}
}
......@@ -9,7 +9,7 @@ public class SyncSkuTest {
@Test
public void test() {
CrmRefundSyncJob crmRefundSyncJob = new CrmRefundSyncJob();
crmRefundSyncJob.executeJob(null, new JobPointLog("base-sku",1 ,100,1,1, LocalDateTime.now(),LocalDateTime.now()));
crmRefundSyncJob.executeJob(null, new JobPointLog("base-sku",1 ,100,1,1, LocalDateTime.of(2023,3,26,0,0,0),LocalDateTime.of(2023,4,5,0,0,0)));
}
@Test
public void test1() {
......
......@@ -652,16 +652,19 @@ public class OrderSyncJob extends PointJob {
return dcBaseOmsOrder1.getCostFirst();
}
}*/
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);
DcBaseProfitCostFirstMapper profitCostFirstMapper = SessionUtil.getSession().getMapper(DcBaseProfitCostFirstMapper.class);
DcBaseProfitCostFirst profitCostFirst = profitCostFirstMapper.selectOneByExample(DcBaseProfitCostFirstExample.newAndCreateCriteria().andBailunSkuEqualTo(dcBaseOmsSku.getBailunSku()).andWarehouseCodeEqualTo(dcBaseOmsSku.getWarehouseCode()).example());
if (profitCostFirst == null ) {
//尚品头程费
if (dcBaseOmsSku.getCompanyId() == 28896){
DcBaseCostFurnishingMapper costFurnishingMapper = SessionUtil.getSession().getMapper(DcBaseCostFurnishingMapper.class);
BigDecimal costFirst = costFurnishingMapper.selectSkuCostFirst(dcBaseOmsSku.getBailunSku(), dcBaseOmsSku.getCreateTime());
if (costFirst != null) {
dcBaseOmsSku.setCostFirst(costFirst);
}
}
DcBaseOmsConfigCostFirstMapper costFirstMapper = SessionUtil.getSession().getMapper(DcBaseOmsConfigCostFirstMapper.class);
DcBaseOmsConfigCostFirst omsConfigCostFirst = costFirstMapper.selectOneByExample(DcBaseOmsConfigCostFirstExample.newAndCreateCriteria().andCompanyIdEqualTo(dcBaseOmsSku.getCompanyId()).andBailunSkuEqualTo(dcBaseOmsSku.getBailunSku()).andWarehouseCodeEqualTo(dcBaseOmsSku.getWarehouseCode()).example());
if (omsConfigCostFirst != null) {
dcBaseOmsSku.setCostFirst(bailunSkuStructure.getBailunSkuWeight().multiply(omsConfigCostFirst.getPrice()).setScale(5, RoundingMode.HALF_EVEN));
} else if (dcBaseOmsSku.getCompanyId() != 28896 || dcBaseOmsSku.getCostFirst() == null || dcBaseOmsSku.getCostFirst().compareTo(BigDecimal.ZERO) < 1) {
......@@ -692,6 +695,13 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsOrder.setCostFirst(BigDecimal.ZERO);
}
}
} else {
DcBaseOmsSkuMapper baseOmsSkuMapper = SessionUtil.getSession().getMapper(DcBaseOmsSkuMapper.class);
DcBaseOmsSku baseOmsSku = baseOmsSkuMapper.selectOneByExample(DcBaseOmsSkuExample.newAndCreateCriteria().andOriginOrderIdEqualTo(dcBaseOmsSku.getOriginOrderId()).andBailunAccountIdEqualTo(dcBaseOmsSku.getBailunAccountId()).andBailunSkuEqualTo(dcBaseOmsSku.getBailunSku()).example());
if (baseOmsSku != null) {
dcBaseOmsSku.setCostFirst(baseOmsSku.getCostFirst());
}
}
totalCostFirst = totalCostFirst.add(dcBaseOmsSku.getCostFirst().multiply(BigDecimal.valueOf(dcBaseOmsSku.getBailunSkuQuantityShipped())));
}
return totalCostFirst;
......
package com.bailuntec.domain.entity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
@Data
public class DcBaseProfitCostFirst {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.bailun_sku
*
* @mbg.generated
*/
private String bailunSku;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.warehouse_code
*
* @mbg.generated
*/
private String warehouseCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.cost_time
*
* @mbg.generated
*/
private LocalDateTime costTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.cost_freight
*
* @mbg.generated
*/
private BigDecimal costFreight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.cost_first
*
* @mbg.generated
*/
private BigDecimal costFirst;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.quantity
*
* @mbg.generated
*/
private Integer quantity;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.accumulate_quantity
*
* @mbg.generated
*/
private Integer accumulateQuantity;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.gmt_create
*
* @mbg.generated
*/
private LocalDateTime gmtCreate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_profit_cost_first.gmt_modified
*
* @mbg.generated
*/
private LocalDateTime gmtModified;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", bailunSku=").append(bailunSku);
sb.append(", warehouseCode=").append(warehouseCode);
sb.append(", costTime=").append(costTime);
sb.append(", costFreight=").append(costFreight);
sb.append(", costFirst=").append(costFirst);
sb.append(", quantity=").append(quantity);
sb.append(", accumulateQuantity=").append(accumulateQuantity);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DcBaseProfitCostFirst other = (DcBaseProfitCostFirst) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getBailunSku() == null ? other.getBailunSku() == null : this.getBailunSku().equals(other.getBailunSku()))
&& (this.getWarehouseCode() == null ? other.getWarehouseCode() == null : this.getWarehouseCode().equals(other.getWarehouseCode()))
&& (this.getCostTime() == null ? other.getCostTime() == null : this.getCostTime().equals(other.getCostTime()))
&& (this.getCostFreight() == null ? other.getCostFreight() == null : this.getCostFreight().equals(other.getCostFreight()))
&& (this.getCostFirst() == null ? other.getCostFirst() == null : this.getCostFirst().equals(other.getCostFirst()))
&& (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
&& (this.getAccumulateQuantity() == null ? other.getAccumulateQuantity() == null : this.getAccumulateQuantity().equals(other.getAccumulateQuantity()))
&& (this.getGmtCreate() == null ? other.getGmtCreate() == null : this.getGmtCreate().equals(other.getGmtCreate()))
&& (this.getGmtModified() == null ? other.getGmtModified() == null : this.getGmtModified().equals(other.getGmtModified()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getBailunSku() == null) ? 0 : getBailunSku().hashCode());
result = prime * result + ((getWarehouseCode() == null) ? 0 : getWarehouseCode().hashCode());
result = prime * result + ((getCostTime() == null) ? 0 : getCostTime().hashCode());
result = prime * result + ((getCostFreight() == null) ? 0 : getCostFreight().hashCode());
result = prime * result + ((getCostFirst() == null) ? 0 : getCostFirst().hashCode());
result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
result = prime * result + ((getAccumulateQuantity() == null) ? 0 : getAccumulateQuantity().hashCode());
result = prime * result + ((getGmtCreate() == null) ? 0 : getGmtCreate().hashCode());
result = prime * result + ((getGmtModified() == null) ? 0 : getGmtModified().hashCode());
return result;
}
}
\ No newline at end of file
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseProfitCostFirst;
import com.bailuntec.domain.example.DcBaseProfitCostFirstExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface DcBaseProfitCostFirstMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
long countByExample(DcBaseProfitCostFirstExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int deleteByExample(DcBaseProfitCostFirstExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int insert(DcBaseProfitCostFirst record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int insertSelective(DcBaseProfitCostFirst record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcBaseProfitCostFirst selectOneByExample(DcBaseProfitCostFirstExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
List<DcBaseProfitCostFirst> selectByExample(DcBaseProfitCostFirstExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
DcBaseProfitCostFirst selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcBaseProfitCostFirst record, @Param("example") DcBaseProfitCostFirstExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcBaseProfitCostFirst record, @Param("example") DcBaseProfitCostFirstExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcBaseProfitCostFirst record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
*/
int updateByPrimaryKey(DcBaseProfitCostFirst record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcBaseProfitCostFirst record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_profit_cost_first
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseProfitCostFirst record);
}
\ No newline at end of file
table-name=dc_base_transfer_plan
table-name=dc_base_profit_cost_first
......@@ -13,7 +13,7 @@ NAME_SPACE=data-center
#JOB_NAME_WEEK=show-auto-turnover-week
#JOB_NAME_WEEK=0 0 10 ? * MON
JOB_NAME=show-auto-turnover84
JOB_NAME=show-auto-turnover85
JOB_CRON=0 0 3 * * ?
#JOB_CRON=0 0 11 * * ?
......@@ -21,7 +21,7 @@ SHARDING_TOTAL_COUNT=8
JOB_NAME_NE_NORMAL=show-auto-turnover-ne-normal
JOB_CRON_NE_NORMAL=0 0 10 ? * MON
JOB_NAME_INCREMENT=show-auto-turnover-increment10
JOB_NAME_INCREMENT=show-auto-turnover-increment12
JOB_CRON_INCREMENT=0 30 13 * * ?
#JOB_CRON_INCREMENT=0 55 14 * * ?
......
......@@ -75,7 +75,7 @@ public class AutoTurnoverTest {
DcBaseStock dcBaseStock = null;
try {
DcBaseStockMapper mapper = SessionUtil.getSession().getMapper(DcBaseStockMapper.class);
dcBaseStock = mapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo("953872601").andWarehouseCodeEqualTo("GZBLWH").example());
dcBaseStock = mapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo("900001085003").andWarehouseCodeEqualTo("GZBLWH").example());
} catch (Exception e) {
e.printStackTrace();
} finally {
......
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