feat:系统建店审核

This commit is contained in:
guohb
2024-04-23 18:11:46 +08:00
parent aa3b67a091
commit ea8fc0db0c
3 changed files with 71 additions and 7 deletions

View File

@@ -0,0 +1,28 @@
package com.cool.store.enums;
public enum AuditTypeEnum {
VISUAL_ACCEPTANCE(0, "视觉验收"),
TRAINING_REGISTRATION_APPROVAL(1, "培训登记审批"),
OPENING_OPERATION_PLAN(2, "开业运营方案"),
LICENSE_APPROVAL(3, "证照审批"),
SYS_BUILD(4, "系统建店"),
;
private Integer code;
private String name;
private AuditTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}

View File

@@ -19,7 +19,7 @@ public class ShopAuditInfoDO {
* 0-视觉验收 1-培训登记审批 2-开业运营方案 3-证照审批
*/
@Column(name = "audit_type")
private Byte auditType;
private Integer auditType;
/**
* 提交人ID
@@ -37,7 +37,7 @@ public class ShopAuditInfoDO {
* 结果类型 0通过,1拒绝
*/
@Column(name = "result_type")
private Byte resultType;
private Integer resultType;
/**
* 通过原因
@@ -111,7 +111,7 @@ public class ShopAuditInfoDO {
*
* @return audit_type - 0-视觉验收 1-培训登记审批 2-开业运营方案 3-证照审批
*/
public Byte getAuditType() {
public Integer getAuditType() {
return auditType;
}
@@ -120,7 +120,7 @@ public class ShopAuditInfoDO {
*
* @param auditType 0-视觉验收 1-培训登记审批 2-开业运营方案 3-证照审批
*/
public void setAuditType(Byte auditType) {
public void setAuditType(Integer auditType) {
this.auditType = auditType;
}
@@ -165,7 +165,7 @@ public class ShopAuditInfoDO {
*
* @return result_type - 结果类型 0通过,1拒绝
*/
public Byte getResultType() {
public Integer getResultType() {
return resultType;
}
@@ -174,7 +174,7 @@ public class ShopAuditInfoDO {
*
* @param resultType 结果类型 0通过,1拒绝
*/
public void setResultType(Byte resultType) {
public void setResultType(Integer resultType) {
this.resultType = resultType;
}

View File

@@ -6,6 +6,7 @@ import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.entity.*;
import com.cool.store.enums.AuditEnum;
import com.cool.store.enums.AuditTypeEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.prepare.newStore.BusinessDistrictEnum;
@@ -20,6 +21,7 @@ import com.cool.store.request.SysStoreAppRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.SysStoreAppResponse;
import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.SysStoreAppService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.poi.constant.Constants;
@@ -61,6 +63,12 @@ public class SysStoreAppServiceImpl implements SysStoreAppService,AuditResultSer
@Resource
UserAuthMappingService userAuthMappingService;
@Resource
PreparationService preparationService;
@Resource
ShopAuditInfoMapper shopAuditInfoMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public ResponseResult submitSysBuildStore(SysStoreAppRequest request) {
@@ -353,7 +361,35 @@ public class SysStoreAppServiceImpl implements SysStoreAppService,AuditResultSer
@Override
public Boolean auditResult(AuditResultRequest request) {
String kdzBusinessId = request.getKdzBusinessId();
Long shopId = getShopId(kdzBusinessId);
ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO();
//1.成功/失败原因
try {
shopAuditInfoDO.setShopId(shopId);
shopAuditInfoDO.setAuditType(AuditTypeEnum.SYS_BUILD.getCode());
LoginUserInfo user = CurrentUserHolder.getUser();
shopAuditInfoDO.setSubmittedUserId(user.getUserId());
shopAuditInfoDO.setSubmittedUserName(user.getName());
if (request.getAuditResult() == 0){
shopAuditInfoDO.setResultType(1);
shopAuditInfoDO.setRejectReason(request.getCause());
}else if (request.getAuditResult() == 1){
shopAuditInfoDO.setResultType(0);
shopAuditInfoDO.setPassReason(request.getCause());
}
shopAuditInfoMapper.insertSelective(shopAuditInfoDO);
}catch (Exception e){
throw new ServiceException(ErrorCodeEnum.UNKNOWN);
}finally {
//2.校验建店与加盟签约合同是否完成 并初始化后续流程数据
preparationService.contractAndBuildStoreCompletion(shopId);
}
return true;
}
return null;
private Long getShopId(String kdzBusinessId) {
String shopId = kdzBusinessId.substring(kdzBusinessId.indexOf("_") + 1,kdzBusinessId.lastIndexOf("_"));
return Long.valueOf(shopId);
}
}