|
|
@@ -7,13 +7,16 @@ import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.mapper.SysConfigMapper;
|
|
|
import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
|
|
|
+import com.cyksj.mapper.shop.YhShopApplyRecordMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopMapper;
|
|
|
import com.cyksj.model.dto.YhShopInfo;
|
|
|
import com.cyksj.model.entity.SysConfig;
|
|
|
import com.cyksj.model.entity.YhShop;
|
|
|
+import com.cyksj.model.entity.YhShopApplyRecord;
|
|
|
import com.cyksj.service.shop.YhShopFrontService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/*
|
|
|
*项目名: yhlxj
|
|
|
@@ -26,11 +29,14 @@ import org.springframework.stereotype.Service;
|
|
|
public class YhShopServiceImpl implements YhShopFrontService {
|
|
|
private final YhShopMapper yhShopMapper;
|
|
|
|
|
|
+ private final YhShopApplyRecordMapper yhShopApplyRecordMapper;
|
|
|
+
|
|
|
private final SysConfigMapper sysConfigMapper;
|
|
|
|
|
|
private final UserDistributeMapper userDistributeMapper;
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
public void applyOpenShop(YhShop shopInfo) {
|
|
|
String customId = shopInfo.getCustomId();
|
|
|
String name = shopInfo.getName();
|
|
|
@@ -71,7 +77,14 @@ public class YhShopServiceImpl implements YhShopFrontService {
|
|
|
save.setName(name);
|
|
|
save.setUserId(userId);
|
|
|
save.setCustomId(customId);
|
|
|
+ save.setVerifyStatus(YhShop.Status.verify);
|
|
|
yhShopMapper.insert(save);
|
|
|
+
|
|
|
+ YhShopApplyRecord yhShopApplyRecord = new YhShopApplyRecord();
|
|
|
+ yhShopApplyRecord.setName(name);
|
|
|
+ yhShopApplyRecord.setCustomId(customId);
|
|
|
+ yhShopApplyRecord.setVerifyStatus(YhShopApplyRecord.Status.verify);
|
|
|
+ yhShopApplyRecordMapper.insert(yhShopApplyRecord);
|
|
|
} catch (Exception e) {
|
|
|
throw BusinessRuntimeException.getInstance("系统繁忙,请重试..");
|
|
|
}
|
|
|
@@ -92,7 +105,7 @@ public class YhShopServiceImpl implements YhShopFrontService {
|
|
|
String db_cId = is_open.getCustomId();
|
|
|
YhShop.Status verifyStatus = is_open.getVerifyStatus();
|
|
|
if (verifyStatus == YhShop.Status.verify) {
|
|
|
- throw BusinessRuntimeException.getInstance("您的开店申请再审核中.");
|
|
|
+ throw BusinessRuntimeException.getInstance("您的开店申请正在审核中.");
|
|
|
}
|
|
|
if (verifyStatus == YhShop.Status.success) {
|
|
|
throw BusinessRuntimeException.getInstance("您的开店申请已通过.");
|
|
|
@@ -112,6 +125,26 @@ public class YhShopServiceImpl implements YhShopFrontService {
|
|
|
.set(YhShop::getName, name)
|
|
|
.set(YhShop::getCustomId, customId)
|
|
|
.eq(YhShop::getId, is_open.getId()));
|
|
|
+
|
|
|
+ try {
|
|
|
+ int update = yhShopMapper.update(null, Wrappers.lambdaUpdate(YhShop.class)
|
|
|
+ .eq(YhShop::getId, is_open.getId())
|
|
|
+ .eq(YhShop::getVerifyStatus, YhShop.Status.fail)
|
|
|
+ .set(YhShop::getName, name)
|
|
|
+ .set(YhShop::getCustomId, customId)
|
|
|
+ .set(YhShop::getVerifyStatus, YhShop.Status.verify)
|
|
|
+ .set(YhShop::getReason, null));
|
|
|
+ if (update != 1) {
|
|
|
+ throw BusinessRuntimeException.getInstance("系统繁忙,请重试..");
|
|
|
+ }
|
|
|
+ YhShopApplyRecord yhShopApplyRecord = new YhShopApplyRecord();
|
|
|
+ yhShopApplyRecord.setName(name);
|
|
|
+ yhShopApplyRecord.setCustomId(customId);
|
|
|
+ yhShopApplyRecord.setVerifyStatus(YhShopApplyRecord.Status.verify);
|
|
|
+ yhShopApplyRecordMapper.insert(yhShopApplyRecord);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw BusinessRuntimeException.getInstance("系统繁忙,请重试..");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|