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

Commit dac9d249 authored by 张国柄's avatar 张国柄

~API:店铺认证:+身份校验;

parent 441ba20b
package com.liquidnet.service.goblin.controller.manage;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.IdentityUtils;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
......@@ -46,13 +48,24 @@ public class GoblinStoreMgtCertificationController {
@ApiOperation(value = "店铺认证第一步:认证资料")
@PostMapping("fstep")
public ResponseDto<String> certificationFirstStep(@Valid @RequestBody GoblinStoreMgtCertificationParam certificationParam) {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(CurrentUtil.getCurrentUid());
String currentUid = CurrentUtil.getCurrentUid();
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(currentUid);
if (null != storeInfoVo && !ENABLE_CERT_STATUS.contains(storeInfoVo.getStatus())) {
log.warn("店铺认证:无效请求:店铺已认证,无需再次认证[UID={},storeId={},storeStatus={}]", CurrentUtil.getCurrentUid(), storeInfoVo.getStoreId(), storeInfoVo.getStatus());
log.warn("店铺认证:无效请求:店铺已认证,无需再次认证[UID={},storeId={},storeStatus={}]", currentUid, storeInfoVo.getStoreId(), storeInfoVo.getStatus());
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (log.isDebugEnabled()) {
log.debug("店铺认证[GoblinStoreMgtCertificationParam:{}]", JsonUtils.toJson(certificationParam));
log.debug("店铺认证[UID={},GoblinStoreMgtCertificationParam:{}]", currentUid, JsonUtils.toJson(certificationParam));
}
if (certificationParam.getPersonCertType().equals("1")) {
String personName = certificationParam.getPersonName();
String personCertCode = certificationParam.getPersonCertCode();
String respStr = IdentityUtils.aliThird(personName, personCertCode);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(String.valueOf(respJNode.get("error_code")))) {
log.info("###实名认证失败[UID={},name={},idcard={},respStr={}]", currentUid, personName, personCertCode, respStr);
return ResponseDto.failure(ErrorMapping.get("149004"));
}
}
storeInfoVo = goblinStoreMgtCertificationService.certificationInformationProcessing(certificationParam, storeInfoVo);
return ResponseDto.success(storeInfoVo.getStoreId());
......@@ -62,17 +75,18 @@ public class GoblinStoreMgtCertificationController {
@ApiOperation(value = "店铺认证第二步:完善信息")
@PostMapping("sstep")
public ResponseDto<Object> certificationSecondStep(@Valid @RequestBody GoblinStoreMgtCompleteParam completeParam) {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(CurrentUtil.getCurrentUid());
String currentUid = CurrentUtil.getCurrentUid();
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(currentUid);
if (null == storeInfoVo) {
log.warn("店铺认证:完善信息:店铺信息不存在,请按流程完成第一步:[UID={}]", CurrentUtil.getCurrentUid());
log.warn("店铺认证:完善信息:店铺信息不存在,请按流程完成第一步:[UID={}]", currentUid);
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (!ENABLE_CERT_STATUS.contains(storeInfoVo.getStatus())) {
log.warn("店铺认证:无效请求:店铺已认证,无需再次认证[UID={},storeId={},storeStatus={}]", CurrentUtil.getCurrentUid(), storeInfoVo.getStoreId(), storeInfoVo.getStatus());
log.warn("店铺认证:无效请求:店铺已认证,无需再次认证[UID={},storeId={},storeStatus={}]", currentUid, storeInfoVo.getStoreId(), storeInfoVo.getStatus());
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (log.isDebugEnabled()) {
log.debug("店铺认证[GoblinStoreMgtCompleteParam:{}]", JsonUtils.toJson(completeParam));
log.debug("店铺认证[UID={},GoblinStoreMgtCompleteParam:{}]", currentUid, JsonUtils.toJson(completeParam));
}
return ResponseDto.success(goblinStoreMgtCertificationService.certificationCompleteProcessing(completeParam, storeInfoVo));
}
......
......@@ -54,8 +54,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe
goblinMongoUtils.setStoreInfoVo(storeInfoVo);
goblinRedisUtils.addStoreId(uid, storeInfoVo.getStoreId());
// TODO: 2022/1/6 zhanggb redis
// goblinRedisUtils.setStoreInfoVo(storeInfoVo);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> initStoreInfoObjs = CollectionUtil.linkedListObjectArr();
......@@ -89,9 +87,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe
storeInfoVo.setCertificationVo(storeCertificationVo);
if (goblinMongoUtils.updateStoreInfoVo(storeInfoVo)) {
// TODO: 2022/1/6 zhanggb redis
// goblinRedisUtils.setStoreInfoVo(storeInfoVo);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_store_info.update_by_cert1"));
......@@ -124,8 +119,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe
storeInfoVo.setUpdatedAt(LocalDateTime.now());
storeInfoVo.setUpdatedBy(CurrentUtil.getCurrentUid());
if (goblinMongoUtils.updateStoreInfoVo(param.completeStoreInfoVo(storeInfoVo))) {
goblinRedisUtils.delStoreInfoVo(storeInfoVo.getStoreId());
// LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
// LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
// toMqSqls.add(SqlMapping.get("goblin_store_info.update_by_cert2"));
......
......@@ -500,6 +500,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
if (goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
if (goblinMongoUtils.updateGoodsSkuInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
List<String> skuIds = goblinMongoUtils.getMgtGoodsSkuIds(storeId, spuIdList);
skuIds.forEach(skuId -> goblinRedisUtils.delGoodsSkuInfoVo(skuId));
......@@ -528,6 +530,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
List<String> spuIdList = storeMgtGoodsActionParam.getSpuIdList();
if (goblinMongoUtils.delGoodsInfoVoBySpuIds(storeId, spuIdList, uid, now)) {
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
List<String> skuIdList = goblinMongoUtils.getMgtGoodsSkuIds(storeId, spuIdList);
skuIdList.forEach(skuId -> goblinRedisUtils.delGoodsSkuInfoVo(skuId));
......
......@@ -388,7 +388,7 @@ public class GoblinMongoUtils {
// SPU信息
public GoblinGoodsInfoVo getGoodsInfoVo(String spuId) {
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0").and("shelvesStatus").is("3")),
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0").and("shelvesStatus").is("3").and("spuAppear").is("0")),
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
}
......
......@@ -18,7 +18,7 @@
149001=无效操作
149002=无权操作该店铺,请核实
149003=处理失败,请联系客服
149004=
149004=身份认证失败,请核实
149005=
149006=添加商品失败,规格信息无效
149007=添加商品失败,商品名称重复
......
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