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

Commit 8ea653fa authored by 张国柄's avatar 张国柄

+API:店铺认证删除;

parent 216da6a0
......@@ -13,60 +13,62 @@ import javax.validation.constraints.Pattern;
@Data
public class GoblinStoreMgtCertificationParam implements java.io.Serializable {
private static final long serialVersionUID = 6674618707269625280L;
@ApiModelProperty(position = 11, value = "认证类型[1-企业/公司|2-个体工商户]", allowableValues = "1,2", example = "2")
// @ApiModelProperty(position = 10, required = false, value = "店铺ID[编辑时必传]")
// private String storeId;
@ApiModelProperty(position = 11, required = true, value = "认证类型[1-企业/公司|2-个体工商户]", allowableValues = "1,2", example = "2")
@NotBlank(message = "认证类型不能为空")
@Pattern(regexp = "\\b(1|2)\\b", message = "认证类型无效")
private String certType;
@ApiModelProperty(position = 12, value = "证件类型[1-二代居民身份证]", allowableValues = "1", example = "1")
@ApiModelProperty(position = 12, required = true, value = "证件类型[1-二代居民身份证]", allowableValues = "1", example = "1")
@Pattern(regexp = "\\b(1)\\b", message = "证件类型无效")
private String personCertType;
@ApiModelProperty(position = 13, value = "证件姓名[32]", example = "张三")
@ApiModelProperty(position = 13, required = true, value = "证件姓名[32]", example = "张三")
private String personName;
@ApiModelProperty(position = 14, value = "证件号码[32]", example = "111111111111111111")
@ApiModelProperty(position = 14, required = true, value = "证件号码[32]", example = "111111111111111111")
private String personCertCode;
@ApiModelProperty(position = 15, value = "证件有效期[YYYY-MM-DD]", example = "2022-12-31")
@ApiModelProperty(position = 15, required = true, value = "证件有效期[YYYY-MM-DD]", example = "2022-12-31")
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "证件有效期格式有误")
private String personCertValidity;
@ApiModelProperty(position = 16, value = "证件是否长期有效[0-否|1-是]", example = "0")
@ApiModelProperty(position = 16, required = true, value = "证件是否长期有效[0-否|1-是]", example = "0")
@NotBlank(message = "证件是否长期有效不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "证件是否长期有效参数无效")
private String personCertLasting;
@ApiModelProperty(position = 17, value = "证件正面照[256]")
@ApiModelProperty(position = 17, required = true, value = "证件正面照[256]")
private String personCertFpic;
@ApiModelProperty(position = 18, value = "证件背面照[256]")
@ApiModelProperty(position = 18, required = true, value = "证件背面照[256]")
private String personCertBpic;
@ApiModelProperty(position = 19, value = "证件手持照[256]")
@ApiModelProperty(position = 19, required = true, value = "证件手持照[256]")
private String personCertSpic;
@ApiModelProperty(position = 19, value = "省ID[20]", example = "110000")
@ApiModelProperty(position = 19, required = false, value = "省ID[20]", example = "110000")
private String provinceId;
@ApiModelProperty(position = 20, value = "省名称[32]", example = "北京市")
@ApiModelProperty(position = 20, required = false, value = "省名称[32]", example = "北京市")
private String provinceName;
@ApiModelProperty(position = 21, value = "市ID[20]", example = "110100")
@ApiModelProperty(position = 21, required = false, value = "市ID[20]", example = "110100")
private String cityId;
@ApiModelProperty(position = 22, value = "市名称[32]", example = "北京")
@ApiModelProperty(position = 22, required = false, value = "市名称[32]", example = "北京")
private String cityName;
@ApiModelProperty(position = 23, value = "县ID[20]", example = "110105")
@ApiModelProperty(position = 23, required = false, value = "县ID[20]", example = "110105")
private String countyId;
@ApiModelProperty(position = 24, value = "县名称[32]", example = "朝阳区")
@ApiModelProperty(position = 24, required = false, value = "县名称[32]", example = "朝阳区")
private String countyName;
@ApiModelProperty(position = 25, value = "详细地址[128]", example = "XXXXX")
@ApiModelProperty(position = 25, required = false, value = "详细地址[128]", example = "XXXXX")
private String busAddress;
@ApiModelProperty(position = 26, value = "商户名称[64]", example = "北京XXX服装贸易有限公司")
@ApiModelProperty(position = 26, required = false, value = "商户名称[64]", example = "北京XXX服装贸易有限公司")
private String busName;
@ApiModelProperty(position = 27, value = "统一社会信用代码[64]", example = "90000000000000005")
@ApiModelProperty(position = 27, required = false, value = "统一社会信用代码[64]", example = "90000000000000005")
private String busCertCode;
@ApiModelProperty(position = 28, value = "营业执照有效期[YYYY-MM-DD]", example = "2022-12-31")
@ApiModelProperty(position = 28, required = false, value = "营业执照有效期[YYYY-MM-DD]", example = "2022-12-31")
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "营业执照有效期格式有误")
private String busCertValidity;
@ApiModelProperty(position = 29, value = "证件是否长期有效[0-否|1-是]", example = "0")
@ApiModelProperty(position = 29, required = false, value = "营业执照是否长期有效[0-否|1-是]", example = "0")
@NotBlank(message = "证件是否长期有效不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "证件是否长期有效参数无效")
private String busCertLasting;
@ApiModelProperty(position = 30, value = "营业执照照片[256]")
@ApiModelProperty(position = 30, required = false, value = "营业执照照片[256]")
private String busCertPic;
@ApiModelProperty(position = 31, value = "营业执照照片[256]")
@ApiModelProperty(position = 31, required = false, value = "资质证书照片[256]")
private String busQualityPic;
public GoblinStoreCertificationVo initStoreCertificationVo() {
......
......@@ -18,11 +18,12 @@ public class GoblinStoreMgtCompleteParam implements java.io.Serializable {
@ApiModelProperty(position = 14, value = "店铺介绍[500]")
private String introduce;
public void completeStoreInfoVo(GoblinStoreInfoVo vo) {
public GoblinStoreInfoVo completeStoreInfoVo(GoblinStoreInfoVo vo) {
vo.setStoreName(this.getStoreName());
vo.setLogoPic(this.getLogoPic());
vo.setBackgroundPic(this.getBackgroundPic());
vo.setIntroduce(this.getIntroduce());
vo.setStatus("1");
return vo;
}
}
......@@ -9,6 +9,7 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCertificationParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCompleteParam;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtCertificationService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -32,6 +33,8 @@ public class GoblinStoreMgtCertificationController {
@Autowired
IGoblinStoreMgtCertificationService goblinStoreMgtCertificationService;
@Autowired
GoblinMongoUtils goblinMongoUtils;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@ApiOperationSupport(order = 1)
......@@ -70,4 +73,18 @@ public class GoblinStoreMgtCertificationController {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(CurrentUtil.getCurrentUid());
return ResponseDto.success(null == storeInfoVo ? "-1" : storeInfoVo.getStatus());
}
@ApiOperationSupport(order = 3)
@ApiOperation(value = "店铺认证编辑中:删除店铺")
@PostMapping("cancel")
public ResponseDto<Object> certificationCancel(String storeId) {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
if (null != storeInfoVo) {
if (goblinMongoUtils.delStoreInfoVo(storeId)) {
goblinRedisUtils.delStoreIdByUid(CurrentUtil.getCurrentUid());
goblinRedisUtils.delStoreInfoVo(storeId);
}
}
return ResponseDto.success();
}
}
......@@ -6,40 +6,61 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCertificationParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCompleteParam;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtCertificationService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Slf4j
@Service
public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCertificationService {
@Autowired
private GoblinRedisUtils goblinRedisUtils;
@Autowired
private GoblinMongoUtils goblinMongoUtils;
@Override
public void certificationInformationProcessing(GoblinStoreMgtCertificationParam param) {
String uid = CurrentUtil.getCurrentUid();
LocalDateTime now = LocalDateTime.now();
GoblinStoreInfoVo vo = GoblinStoreInfoVo.getNew();
vo.setStoreId(IDGenerator.get32UUID());
vo.setUid(uid);
vo.setStatus("0");
vo.setCreatedAt(now);
vo.setCreatedBy(uid);
vo.setCertificationVo(param.initStoreCertificationVo());
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(uid);
if (null == storeInfoVo) {
storeInfoVo = GoblinStoreInfoVo.getNew();
storeInfoVo.setStoreId(IDGenerator.get32UUID());
storeInfoVo.setUid(uid);
storeInfoVo.setStatus("0");
storeInfoVo.setCreatedAt(now);
storeInfoVo.setCreatedBy(uid);
storeInfoVo.setUpdatedBy(uid);
storeInfoVo.setUpdatedAt(now);
storeInfoVo.setCertificationVo(param.initStoreCertificationVo());
goblinMongoUtils.setStoreInfoVo(storeInfoVo);
goblinRedisUtils.setStoreInfoVo(storeInfoVo);
} else {
storeInfoVo.setStatus("0");
storeInfoVo.setUpdatedBy(uid);
storeInfoVo.setUpdatedAt(now);
storeInfoVo.setCertificationVo(param.initStoreCertificationVo());
goblinRedisUtils.setStoreInfoVo(vo);
if (goblinMongoUtils.updateStoreInfoVo(storeInfoVo)) {
goblinRedisUtils.setStoreInfoVo(storeInfoVo);
}
}
}
@Override
public void certificationCompleteProcessing(GoblinStoreMgtCompleteParam param) {
String uid = CurrentUtil.getCurrentUid();
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(uid);
param.completeStoreInfoVo(storeInfoVo);
goblinRedisUtils.setStoreInfoVo(storeInfoVo);
if (null == storeInfoVo) {
log.warn("店铺认证:完善信息:店铺信息不存在,请按流程完成第一步:[UID={}]", uid);
return;
}
goblinRedisUtils.setStoreInfoVo(param.completeStoreInfoVo(storeInfoVo));
}
}
......@@ -55,6 +55,14 @@ public class GoblinMongoUtils {
GoblinStoreInfoVo.class, GoblinStoreInfoVo.class.getSimpleName()).getDeletedCount() > 0;
}
public boolean updateStoreInfoVo(GoblinStoreInfoVo vo) {
return mongoTemplate.getCollection(GoblinStoreInfoVo.class.getSimpleName())
.updateOne(
Query.query(Criteria.where("storeId").is(vo.getStoreId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0;
}
public GoblinStoreInfoVo getStoreInfoVo(String storeId) {
return mongoTemplate.findOne(Query.query(Criteria.where("storeId").is(storeId)),
GoblinStoreInfoVo.class, GoblinStoreInfoVo.class.getSimpleName());
......
......@@ -65,7 +65,7 @@ public class GoblinRedisUtils {
return redisUtil.set(GoblinRedisConst.TMP_UID_STORE.concat(uid), storeId);
}
private void delStoreIdByUid(String uid) {
public void delStoreIdByUid(String uid) {
redisUtil.del(GoblinRedisConst.TMP_UID_STORE.concat(uid));
}
......
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