|
@@ -27,6 +27,7 @@ import com.kmall.common.constant.Dict;
|
|
import com.kmall.admin.fromcomm.entity.SysUserEntity;
|
|
import com.kmall.admin.fromcomm.entity.SysUserEntity;
|
|
import com.kmall.common.utils.*;
|
|
import com.kmall.common.utils.*;
|
|
import com.kmall.manager.manager.redis.JedisUtil;
|
|
import com.kmall.manager.manager.redis.JedisUtil;
|
|
|
|
+import io.swagger.models.auth.In;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -2132,13 +2133,65 @@ public class GoodsServiceImpl implements GoodsService {
|
|
return goodsDao.queryObjectBySn(goodsSn);
|
|
return goodsDao.queryObjectBySn(goodsSn);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 全量拉取
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void syncOmsHsCodeTask() {
|
|
|
|
+ syncOmsHsCodeSegment(goodsDao.queryNonSyncOmsHsCodeSkuList());
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 全量计算
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void syncGoodsRateTask() {
|
|
|
|
+ // 查询出所有商品
|
|
|
|
+ List<GoodsEntity> allGoodsList = goodsDao.queryAllList(null,null);
|
|
|
|
+ syncGoodsRate(allGoodsList);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 选择拉取
|
|
|
|
+ * @param ids
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void syncOmsHsCodeGoode(List<Integer> ids) {
|
|
|
|
+ syncOmsHsCodeSegment(goodsDao.syncOmsHsCodeGoode(ids));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 选择计算
|
|
|
|
+ * @param ids
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
|
|
+ public void syncGoodsRateGoode(List<Integer> ids) {
|
|
|
|
+ syncGoodsRate(goodsDao.syncGoodsRateGoode(ids));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void syncOmsHsCodeSegment(List<String> skuList) {
|
|
|
|
+ int segmentLimitSize = 300;
|
|
|
|
+ if (skuList.size() < segmentLimitSize) {
|
|
|
|
+ this.syncOmsHsCode(skuList);
|
|
|
|
+ } else {
|
|
|
|
+ int segmentSize = skuList.size() % segmentLimitSize == 0 ? skuList.size() / segmentLimitSize : (skuList.size() / segmentLimitSize) + 1;
|
|
|
|
+ List<List<String>> segment = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < segmentSize; i++) {
|
|
|
|
+ int end = (i == segmentSize - 1) ? skuList.size() : i * segmentLimitSize + segmentLimitSize;
|
|
|
|
+ segment.add(new ArrayList<>(skuList.subList(i * segmentLimitSize, end)));
|
|
|
|
+ }
|
|
|
|
+ for (List<String> tmp : segment) {
|
|
|
|
+ this.syncOmsHsCode(tmp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
- public void syncOmsHsCode() {
|
|
|
|
- List<String> skuList = goodsDao.queryNonSyncOmsHsCodeSkuList();
|
|
|
|
|
|
+ public void syncOmsHsCode(List<String> skuList) {
|
|
if (Objects.nonNull(skuList) && skuList.size()>0){
|
|
if (Objects.nonNull(skuList) && skuList.size()>0){
|
|
String result = HttpUtil.get("https://oms.ds-bay.com/oms-controller-mgt/pdProductRecord/hsCodeMapBySkuList?skuList=" + skuList);
|
|
String result = HttpUtil.get("https://oms.ds-bay.com/oms-controller-mgt/pdProductRecord/hsCodeMapBySkuList?skuList=" + skuList);
|
|
|
|
+ //String result = HttpUtil.get("http://183.3.221.143:8080/oms-controller-mgt/pdProductRecord/hsCodeMapBySkuList?skuList=" + skuList);
|
|
|
|
+ //String result = HttpUtil.get("http://127.0.0.1:8080/oms-controller-mgt/pdProductRecord/hsCodeMapBySkuList?skuList=" + skuList);
|
|
Map<String,Map> map = JSON.parseObject(result, Map.class);
|
|
Map<String,Map> map = JSON.parseObject(result, Map.class);
|
|
|
|
|
|
for (String sku : skuList) {
|
|
for (String sku : skuList) {
|
|
@@ -2177,31 +2230,13 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional
|
|
|
|
- public void syncOmsGoodsRate() {
|
|
|
|
- List<GoodsEntity> list = goodsDao.queryNonSyncOmsGoodsRateSkuList();
|
|
|
|
- if (Objects.nonNull(list) && list.size()>0){
|
|
|
|
- String result = HttpUtil.get("https://oms.ds-bay.com/oms-controller-mgt/taxBill/queryGoodsRate?thirdPartyMerchCode=CW001");
|
|
|
|
- Map<String,String> map = JSON.parseObject(result, Map.class);
|
|
|
|
- for (GoodsEntity goodsEntity : list) {
|
|
|
|
- String goodsRate = map.get(goodsEntity.getHsCode());
|
|
|
|
- if (StringUtils.isNotEmpty(goodsRate)){
|
|
|
|
- goodsEntity.setIsSyncGoodsRate("1");
|
|
|
|
- goodsEntity.setGoodsRate(new BigDecimal(goodsRate));
|
|
|
|
- goodsDao.update(goodsEntity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
- public void syncGoodsRate() {
|
|
|
|
|
|
+ public void syncGoodsRate(List<GoodsEntity> allGoodsList) {
|
|
String storeId = "163"; // 市场部说所有门店价格一致,并且活动一致,可直接取其中一个门店价格进行计算税率
|
|
String storeId = "163"; // 市场部说所有门店价格一致,并且活动一致,可直接取其中一个门店价格进行计算税率
|
|
- // 查询出所有商品
|
|
|
|
- List<GoodsEntity> allGoodsList = goodsDao.queryAllList(null,null);
|
|
|
|
|
|
+
|
|
for (GoodsEntity goodsEntity : allGoodsList) {
|
|
for (GoodsEntity goodsEntity : allGoodsList) {
|
|
// 同步过海关商品编码才可以算税率
|
|
// 同步过海关商品编码才可以算税率
|
|
if ("1".equals(goodsEntity.getIsSyncHsCode())) {
|
|
if ("1".equals(goodsEntity.getIsSyncHsCode())) {
|
|
@@ -2214,6 +2249,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
// BigDecimal goodsRate = calculateTax.divide(actualPaymentAmount, 4, BigDecimal.ROUND_HALF_UP);
|
|
// BigDecimal goodsRate = calculateTax.divide(actualPaymentAmount, 4, BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal goodsRate =CalculateTax.calculateGoodsRate(goodsEntity);
|
|
BigDecimal goodsRate =CalculateTax.calculateGoodsRate(goodsEntity);
|
|
goodsEntity.setGoodsRate(goodsRate);
|
|
goodsEntity.setGoodsRate(goodsRate);
|
|
|
|
+ goodsEntity.setIsSyncHsCode("0");
|
|
goodsDao.update(goodsEntity);
|
|
goodsDao.update(goodsEntity);
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
@@ -2269,6 +2305,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|
return goodsDao.queryAllList(page,pageSize);
|
|
return goodsDao.queryAllList(page,pageSize);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
private void calculeatePromotion(SysUserEntity user, GoodsEntity goods, List<Map<String, String>> errorPriceSkuList, List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
|
|
private void calculeatePromotion(SysUserEntity user, GoodsEntity goods, List<Map<String, String>> errorPriceSkuList, List<ShopErrorPriceRecordEntity> shopErrorPriceRecordEntities) {
|
|
String prodBarcode = goods.getProdBarcode();
|
|
String prodBarcode = goods.getProdBarcode();
|
|
String storeId = goods.getStoreId()+"";
|
|
String storeId = goods.getStoreId()+"";
|