|
@@ -6,8 +6,10 @@ import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChainSettlement;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ItemCheck;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouSupplyChainMapper;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.mapper.MgsSupplyChainMapper;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.mapper.RocketSupplyChainMapper;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouSupplyChainService;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IMgsSupplyChainService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -16,6 +18,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -39,6 +44,10 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
|
|
|
private ISendMessageService sendMessageService;
|
|
|
@Autowired
|
|
|
private MgsSupplyChainMapper mgsSupplyChainMapper;
|
|
|
+ @Autowired
|
|
|
+ private MongoTemplate mongoTemplate;
|
|
|
+ @Autowired
|
|
|
+ private RocketSupplyChainMapper rocketSupplyChainMapper;
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
System.err.println(DateUtils.tempToLongDateStr(1706112000000L));
|
|
@@ -88,13 +97,17 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
|
|
|
return;
|
|
|
}
|
|
|
log.info("mgs当前数据条数:{}", list.size());
|
|
|
- List<KuaishouSupplyChain> supplyChains = new ArrayList<>();
|
|
|
+ List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
|
|
|
+ List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
|
|
|
+ List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
JSONObject jsonObject = list.getJSONObject(i);
|
|
|
KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
|
|
|
supplyChain.setOid(jsonObject.getLong("oid"));
|
|
|
JSONObject item = jsonObject.getJSONArray("itemList").getJSONObject(0);
|
|
|
+ Long itemId = null;
|
|
|
if (!Check.isNull(item)) {
|
|
|
+ itemId = item.getLong("itemId");
|
|
|
supplyChain.setItemId(item.getLong("itemId"));
|
|
|
supplyChain.setItemTitle(item.getString("itemTitle"));
|
|
|
supplyChain.setReservePrice(item.getLong("reservePrice"));
|
|
@@ -122,10 +135,40 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
|
|
|
supplyChain.setStatDate(DateUtils.tempToDate(jsonObject.getLong("orderCreateTime")));
|
|
|
supplyChain.setStatHour(DateUtils.getHour(jsonObject.getLong("orderCreateTime")));
|
|
|
supplyChain.setItemCommissionRate(itemMap.get(item.getLong("itemId")));
|
|
|
- supplyChains.add(supplyChain);
|
|
|
+
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
+ criteria = Criteria.where("_id").is(itemId);
|
|
|
+ Query query = new Query(criteria);
|
|
|
+ ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
|
|
|
+ if (Check.isNull(itemCheck)) {
|
|
|
+ mgsSupplyChains.add(supplyChain);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(itemCheck)) {
|
|
|
+ String ownership = itemCheck.getOwnership();
|
|
|
+ if ("ruixuan".equals(ownership)) {
|
|
|
+ ruixuanSupplyChains.add(supplyChain);
|
|
|
+ }
|
|
|
+ if ("miaogousi".equals(ownership)) {
|
|
|
+ mgsSupplyChains.add(supplyChain);
|
|
|
+ }
|
|
|
+ if ("rocket".equals(ownership)) {
|
|
|
+ rocketSupplyChains.add(supplyChain);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
try {
|
|
|
- mgsSupplyChainMapper.replace(supplyChains);
|
|
|
+ if (!Check.isNull(ruixuanSupplyChains)) {
|
|
|
+ rocketSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Check.isNull(mgsSupplyChains)) {
|
|
|
+ rocketSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Check.isNull(rocketSupplyChains)) {
|
|
|
+ rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|