记得上下班打卡 | git大法好,push需谨慎

Commit 3d54d865 authored by 姜秀龙's avatar 姜秀龙

Merge branch 'jxl-kuaidi100' into test

parents a40e7afb b7aeb05f
...@@ -53,13 +53,19 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService { ...@@ -53,13 +53,19 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
public boolean updateStoreMgtConfig(String uid, String storeId, Map<String, String> confMap) { public boolean updateStoreMgtConfig(String uid, String storeId, Map<String, String> confMap) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
List<GoblinStoreConfigVo> storeConfigVos = goblinRedisUtils.getStoreConfigVos(storeId); List<GoblinStoreConfigVo> storeConfigVos = goblinRedisUtils.getStoreConfigVos(storeId);
if (storeConfigVos == null) {
storeConfigVos = ObjectUtil.getGoblinStoreConfigVoArrayList();
}
log.info("店铺管理:店铺设置:编辑[UID={},storeId={},BEF={}]", uid, storeId, JsonUtils.toJson(confMap)); log.info("店铺管理:店铺设置:编辑[UID={},storeId={},BEF={}]", uid, storeId, JsonUtils.toJson(confMap));
List<GoblinStoreConfigVo> updateStoreConfigVoList = ObjectUtil.getGoblinStoreConfigVoArrayList(); List<GoblinStoreConfigVo> updateStoreConfigVoList = ObjectUtil.getGoblinStoreConfigVoArrayList();
List<GoblinStoreConfigVo> insertStoreConfigVoList = ObjectUtil.getGoblinStoreConfigVoArrayList();
boolean toUpdateStoreStatusFlg = false; boolean toUpdateStoreStatusFlg = false;
java.util.HashSet<String> existingKeys = new java.util.HashSet<>();
for (GoblinStoreConfigVo configVo : storeConfigVos) { for (GoblinStoreConfigVo configVo : storeConfigVos) {
existingKeys.add(configVo.getConfigKey());
String updateConfVal = confMap.get(configVo.getConfigKey()); String updateConfVal = confMap.get(configVo.getConfigKey());
if (configVo.getConfigKey().equals(GoblinStoreConf.BUSINESS_STATUS.name())) { if (configVo.getConfigKey().equals(GoblinStoreConf.BUSINESS_STATUS.name())) {
toUpdateStoreStatusFlg = !configVo.getConfigVal().equals(updateConfVal); toUpdateStoreStatusFlg = updateConfVal != null && !configVo.getConfigVal().equals(updateConfVal);
} }
if (StringUtils.isNotEmpty(updateConfVal)) { if (StringUtils.isNotEmpty(updateConfVal)) {
configVo.setConfigVal(updateConfVal); configVo.setConfigVal(updateConfVal);
...@@ -68,48 +74,80 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService { ...@@ -68,48 +74,80 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
updateStoreConfigVoList.add(configVo); updateStoreConfigVoList.add(configVo);
} }
} }
if (!CollectionUtils.isEmpty(updateStoreConfigVoList) && goblinMongoUtils.updateStoreConfigVos(updateStoreConfigVoList)) { // 白名单内、店铺尚无的配置:首次保存直接 insert(不再依赖开店模板/刷数)
log.info("店铺管理:店铺设置:编辑[UID={},storeId={},AFT={}]", uid, storeId, JsonUtils.toJson(confMap)); for (Map.Entry<String, String> entry : confMap.entrySet()) {
goblinRedisUtils.delStoreConfigVos(storeId); if (existingKeys.contains(entry.getKey()) || StringUtils.isEmpty(entry.getValue())) {
continue;
}
GoblinStoreConfigVo insertVo = GoblinStoreConfigVo.getNew();
insertVo.setStoreId(storeId);
insertVo.setConfigKey(entry.getKey());
insertVo.setConfigName(entry.getKey());
insertVo.setConfigVal(entry.getValue());
insertVo.setCreatedBy(uid);
insertVo.setCreatedAt(now);
insertStoreConfigVoList.add(insertVo);
}
boolean mongoOk = false;
if (!CollectionUtils.isEmpty(updateStoreConfigVoList)) {
mongoOk = goblinMongoUtils.updateStoreConfigVos(updateStoreConfigVoList);
}
if (!CollectionUtils.isEmpty(insertStoreConfigVoList)) {
mongoOk = goblinMongoUtils.insertStoreConfigVos(insertStoreConfigVoList) || mongoOk;
}
if (!mongoOk) {
return false;
}
LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr(); log.info("店铺管理:店铺设置:编辑[UID={},storeId={},AFT={}]", uid, storeId, JsonUtils.toJson(confMap));
LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr(); goblinRedisUtils.delStoreConfigVos(storeId);
if (toUpdateStoreStatusFlg) {
String status = confMap.get(GoblinStoreConf.BUSINESS_STATUS.name());
GoblinStoreInfoVo updateStoreInfoVo = goblinRedisUtils.getStoreInfoVo(storeId); LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
updateStoreInfoVo.setStatus(status); LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
updateStoreInfoVo.setUpdatedBy(uid); if (toUpdateStoreStatusFlg) {
updateStoreInfoVo.setUpdatedAt(now); String status = confMap.get(GoblinStoreConf.BUSINESS_STATUS.name());
goblinMongoUtils.updateStoreInfoVo(updateStoreInfoVo);
goblinRedisUtils.delStoreInfoVo(storeId);
goblinMongoUtils.updateGoodsInfoVoAppear(storeId, status.equals("4") ? "1" : "0", now, uid); GoblinStoreInfoVo updateStoreInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
updateStoreInfoVo.setStatus(status);
updateStoreInfoVo.setUpdatedBy(uid);
updateStoreInfoVo.setUpdatedAt(now);
goblinMongoUtils.updateStoreInfoVo(updateStoreInfoVo);
goblinRedisUtils.delStoreInfoVo(storeId);
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法 goblinMongoUtils.updateGoodsInfoVoAppear(storeId, status.equals("4") ? "1" : "0", now, uid);
List<String> spuIdList = goblinMongoUtils.getMgtGoodsSpuIds(storeId); goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
updateStoreInfoObjs.add(new Object[]{updateStoreInfoVo.getStatus(), uid, now, storeId}); List<String> spuIdList = goblinMongoUtils.getMgtGoodsSpuIds(storeId);
updateGoodsInfoObjs.add(new Object[]{status.equals("4") ? "1" : "0", uid, now, storeId}); spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
}
updateStoreInfoObjs.add(new Object[]{updateStoreInfoVo.getStatus(), uid, now, storeId});
updateGoodsInfoObjs.add(new Object[]{status.equals("4") ? "1" : "0", uid, now, storeId});
}
if (!CollectionUtils.isEmpty(updateStoreConfigVoList)) {
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_store_config.update")); toMqSqls.add(SqlMapping.get("goblin_store_config.update"));
LinkedList<Object[]> updateStoreConfigVoObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> updateStoreConfigVoObjs = CollectionUtil.linkedListObjectArr();
updateStoreConfigVoList.forEach(uc -> updateStoreConfigVoObjs.add(new Object[]{ updateStoreConfigVoList.forEach(uc -> updateStoreConfigVoObjs.add(new Object[]{
uc.getConfigVal(), uc.getUpdatedBy(), uc.getUpdatedAt(), uc.getStoreId(), uc.getConfigKey()})); uc.getConfigVal(), uc.getUpdatedBy(), uc.getUpdatedAt(), uc.getStoreId(), uc.getConfigKey()}));
toMqSqls.add(SqlMapping.get("goblin_store_info.update_by_setting")); toMqSqls.add(SqlMapping.get("goblin_store_info.update_by_setting"));
// LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_status")); toMqSqls.add(SqlMapping.get("goblin_goods.update_by_status"));
// LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.gets(toMqSqls, updateStoreConfigVoObjs, updateStoreInfoObjs, updateGoodsInfoObjs)); SqlMapping.gets(toMqSqls, updateStoreConfigVoObjs, updateStoreInfoObjs, updateGoodsInfoObjs));
return true;
} }
return false; if (!CollectionUtils.isEmpty(insertStoreConfigVoList)) {
LinkedList<String> insertSqls = CollectionUtil.linkedListString();
insertSqls.add(SqlMapping.get("goblin_store_config.insert"));
LinkedList<Object[]> insertObjs = CollectionUtil.linkedListObjectArr();
insertStoreConfigVoList.forEach(ic -> insertObjs.add(new Object[]{
ic.getStoreId(), ic.getConfigName(), ic.getConfigKey(), ic.getConfigVal(),
ic.getCreatedBy(), ic.getCreatedAt()}));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.gets(insertSqls, insertObjs));
}
return true;
} }
@Override @Override
......
...@@ -436,6 +436,14 @@ public class GoblinMongoUtils { ...@@ -436,6 +436,14 @@ public class GoblinMongoUtils {
GoblinStoreConfigVo.class, GoblinStoreConfigVo.class.getSimpleName()); GoblinStoreConfigVo.class, GoblinStoreConfigVo.class.getSimpleName());
} }
public boolean insertStoreConfigVos(List<GoblinStoreConfigVo> vos) {
if (CollectionUtils.isEmpty(vos)) {
return false;
}
mongoTemplate.insert(vos, GoblinStoreConfigVo.class.getSimpleName());
return true;
}
public boolean updateStoreConfigVos(List<GoblinStoreConfigVo> vos) { public boolean updateStoreConfigVos(List<GoblinStoreConfigVo> vos) {
List<WriteModel<Document>> list = ObjectUtil.getWriteModelDocumentArrayList(); List<WriteModel<Document>> list = ObjectUtil.getWriteModelDocumentArrayList();
vos.forEach(r -> { vos.forEach(r -> {
......
...@@ -12,6 +12,7 @@ goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET ...@@ -12,6 +12,7 @@ goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET
goblin_store_certification.update_by_del=UPDATE goblin_store_certification SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=? goblin_store_certification.update_by_del=UPDATE goblin_store_certification SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=?
#---- \u5E97\u94FA\u914D\u7F6E\u4FE1\u606F #---- \u5E97\u94FA\u914D\u7F6E\u4FE1\u606F
goblin_store_config.update=UPDATE goblin_store_config SET config_val=?,updated_by=?,updated_at=? WHERE store_id=? AND config_key=? goblin_store_config.update=UPDATE goblin_store_config SET config_val=?,updated_by=?,updated_at=? WHERE store_id=? AND config_key=?
goblin_store_config.insert=INSERT INTO goblin_store_config (store_id,config_name,config_key,config_val,created_by,created_at)VALUES(?,?,?,?,?,?)
goblin_store_erp_config.upsert=REPLACE INTO goblin_store_erp_config (store_id,sid,appKey,appSecret,shopNo,updated_by,updated_at)VALUES(?,?,?,?,?,?,sysdate()) goblin_store_erp_config.upsert=REPLACE INTO goblin_store_erp_config (store_id,sid,appKey,appSecret,shopNo,updated_by,updated_at)VALUES(?,?,?,?,?,?,sysdate())
#---- \u5E97\u94FA\u516C\u544A\u4FE1\u606F #---- \u5E97\u94FA\u516C\u544A\u4FE1\u606F
goblin_store_notice.insert=INSERT INTO goblin_store_notice (notice_id,store_id,content,release_time,long_lasting,cancell_time,status,created_by,created_at)VALUES(?,?,?,?,?,?,?,?,?) goblin_store_notice.insert=INSERT INTO goblin_store_notice (notice_id,store_id,content,release_time,long_lasting,cancell_time,status,created_by,created_at)VALUES(?,?,?,?,?,?,?,?,?)
......
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