|
|
@@ -5,29 +5,31 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.cyksj.common.EnvCommonService;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.SmsUtil;
|
|
|
import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
-import com.cyksj.mapper.shop.YhShopDistributeMoneyApplyMapper;
|
|
|
+import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
|
|
|
+import com.cyksj.mapper.shop.YhShopApplyRecordMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopDistributeWaitingSendPointsMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopMapper;
|
|
|
import com.cyksj.model.entity.User;
|
|
|
+import com.cyksj.model.entity.UserDistribute;
|
|
|
import com.cyksj.model.entity.YhShop;
|
|
|
+import com.cyksj.model.entity.YhShopApplyRecord;
|
|
|
import com.cyksj.model.request.YhShopApplyMoneyReq;
|
|
|
import com.cyksj.model.views.YhShopBrokenLineCpsUserWMoneyView;
|
|
|
import com.cyksj.model.views.YhShopUserWMoneyStatisticsDataView;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.mail.MailService;
|
|
|
import com.cyksj.service.pay.TransferFuncService;
|
|
|
-import com.cyksj.service.user.UserBenefitsService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/*
|
|
|
*项目名: yhlxj
|
|
|
@@ -48,13 +50,11 @@ public class YhShopManageServiceImpl implements YhShopManageService{
|
|
|
|
|
|
private final TransferFuncService transferFuncService;
|
|
|
|
|
|
- private final UserBenefitsService userBenefitsService;
|
|
|
-
|
|
|
private final YhShopDistributeWaitingSendPointsMapper yhShopDistributeWaitingSendPointsMapper;
|
|
|
|
|
|
- private final YhShopDistributeMoneyApplyMapper yhShopDistributeMoneyApplyMapper;
|
|
|
+ private final YhShopApplyRecordMapper yhShopApplyRecordMapper;
|
|
|
|
|
|
- private final EnvCommonService envCommonService;
|
|
|
+ private final UserDistributeMapper userDistributeMapper;
|
|
|
|
|
|
@Override
|
|
|
public void getLoginCode(Integer type, String login, Integer cid) {
|
|
|
@@ -186,4 +186,35 @@ public class YhShopManageServiceImpl implements YhShopManageService{
|
|
|
}
|
|
|
return today;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
+ public void addUserShop(YhShop yhShop) {
|
|
|
+ Long userId = yhShop.getUserId();
|
|
|
+ Integer count = yhShopMapper.selectCount(Wrappers.lambdaQuery(YhShop.class)
|
|
|
+ .eq(YhShop::getUserId, userId));
|
|
|
+ if (count > 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ yhShop.setVerifyStatus(YhShop.Status.success);
|
|
|
+ Optional.ofNullable(userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class)
|
|
|
+ .eq(UserDistribute::getUserId, userId)
|
|
|
+ .eq(UserDistribute::getDeleted, 1)
|
|
|
+ .last("limit 1"))).ifPresent(e->{
|
|
|
+ yhShop.setBusinessId(e.getBusinessId());
|
|
|
+ });
|
|
|
+ if (yhShop.getBusinessId() != null) {
|
|
|
+ yhShop.setBusinessBindTime(DateTime.now());
|
|
|
+ }
|
|
|
+
|
|
|
+ yhShopMapper.insert(yhShop);
|
|
|
+
|
|
|
+ YhShopApplyRecord yhShopApplyRecord = new YhShopApplyRecord();
|
|
|
+ yhShopApplyRecord.setName(yhShop.getName());
|
|
|
+ yhShopApplyRecord.setUserId(userId);
|
|
|
+ yhShopApplyRecord.setCustomId(yhShop.getCustomId());
|
|
|
+ yhShopApplyRecord.setVerifyStatus(YhShopApplyRecord.Status.success);
|
|
|
+ yhShopApplyRecord.setBusinessId(yhShop.getBusinessId());
|
|
|
+ yhShopApplyRecordMapper.insert(yhShopApplyRecord);
|
|
|
+ }
|
|
|
}
|