From f89cb7190649dd0dbb728f6e62340077bba0eb9e Mon Sep 17 00:00:00 2001
From: yanghui <2536613402@qq.com>
Date: 星期六, 22 十月 2022 00:29:32 +0800
Subject: [PATCH] Merge branch 'local_20221014' into haucheng_panzhihua
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java | 56 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
index 6ca64de..7c20dff 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -3,25 +3,14 @@
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
-import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
-import java.util.UUID;
import javax.annotation.Resource;
-import com.panzhihua.common.model.dtos.community.microCommercialStreet.LoginWithPhoneDTO;
-import com.panzhihua.common.model.dtos.community.microCommercialStreet.PutUserInfoDTO;
-import com.panzhihua.common.model.vos.community.microCommercialStreet.IndexTopStatisticsVO;
-import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO;
-import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO;
-import com.panzhihua.service_community.dao.McsInformationDAO;
-import com.panzhihua.service_community.util.NearbyUtil;
-import com.spatial4j.core.shape.Rectangle;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@@ -35,18 +24,26 @@
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.dtos.community.convenient.DisableOrEnableConvenientMerchantDTO;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO;
+import com.panzhihua.common.model.dtos.community.microCommercialStreet.LoginWithPhoneDTO;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsMerchantDTO;
+import com.panzhihua.common.model.dtos.community.microCommercialStreet.PutUserInfoDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.community.microCommercialStreet.IndexTopStatisticsVO;
+import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO;
+import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.service_community.dao.McsConfigDAO;
import com.panzhihua.service_community.dao.McsGameDAO;
+import com.panzhihua.service_community.dao.McsInformationDAO;
import com.panzhihua.service_community.dao.McsMerchantDAO;
+import com.panzhihua.service_community.dao.McsOrderDao;
import com.panzhihua.service_community.entity.McsConfig;
import com.panzhihua.service_community.entity.McsMerchant;
+import com.panzhihua.service_community.entity.McsOrder;
import com.panzhihua.service_community.service.McsMerchantService;
/**
@@ -61,6 +58,7 @@
private static final String MERCHANT_PUBLISH_LIMIT_KEY = "MERCHANT_PUBLISH_LIMIT";
private static final String DEFAULT_IMAGE_URL = "https://www.psciio.com//idcard/91313573d071436ab1f934231b31c6e5.jpg";
private static final int DEFAULT_PUBLISH_LIMIT = 2;
+ private static final String CUSTOMER_SERVICE_CONTACT_NUM="CUSTOMER_SERVICE_CONTACT_NUM";
@Resource
private UserService userService;
@@ -72,6 +70,8 @@
private McsInformationDAO mcsInformationDAO;
@Resource
private StringRedisTemplate stringRedisTemplate;
+ @Resource
+ private McsOrderDao mcsOrderDao;
/**
* 新增数字商业街商家
@@ -173,7 +173,10 @@
return R.fail("商家不存在");
}
mcsMerchant.setIsDel(true);
- this.baseMapper.updateById(mcsMerchant);
+ int num = this.baseMapper.updateById(mcsMerchant);
+ if (num > 0) {
+ this.baseMapper.enableUserStatus(mcsMerchant.getUserId());
+ }
return R.ok();
}
@@ -231,19 +234,28 @@
return R.fail("账号不存在");
}
retrieveMerchantSurplusLitDays(merchantVO);
+ McsConfig mcsConfig=mcsConfigDAO.selectOne(new QueryWrapper<McsConfig>().lambda().eq(McsConfig::getKey,CUSTOMER_SERVICE_CONTACT_NUM));
+ if(mcsConfig!=null){
+ merchantVO.setCustomPhone(mcsConfig.getValue());
+ }
+
return R.ok(merchantVO);
}
/**
* 完成订单更新/新增商家信息
*
- * @param merchantName
+ * @param orderNo
* @param configId
* @param userId
* @return
*/
@Override
- public R updateOrAddMcsMerchantAfterOrder(String merchantName, Long configId, Long userId) {
+ public R updateOrAddMcsMerchantAfterOrder(String orderNo, Long configId, Long userId) {
+ McsOrder mcsOrder = mcsOrderDao.selectOne(new QueryWrapper<McsOrder>().lambda().eq(McsOrder::getOrderNo, orderNo));
+ if (isNull(mcsOrder)) {
+ return R.fail("订单不存在");
+ }
McsMerchant mcsMerchant = this.baseMapper.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId));
McsConfig mcsConfig = mcsConfigDAO.selectById(configId);
if (isNull(mcsConfig) || isBlank(mcsConfig.getValue())) {
@@ -254,6 +266,7 @@
return R.fail("配置有误");
}
Integer litDays = (Integer)packageObject.get("day");
+ String merchantName = mcsOrder.getMerchantName();
Date nowDate = new Date();
int num;
if (isNull(mcsMerchant)) {
@@ -273,6 +286,9 @@
mcsMerchant.setUserId(userId);
mcsMerchant.setCreatedBy(userId);
mcsMerchant.setUpdatedBy(userId);
+ mcsMerchant.setAddress(mcsOrder.getAddress());
+ mcsMerchant.setLat(mcsOrder.getLat());
+ mcsMerchant.setLon(mcsOrder.getLon());
num = this.baseMapper.insert(mcsMerchant);
McsMerchantDTO mcsMerchantDTO = new McsMerchantDTO();
mcsMerchantDTO.setName(mcsMerchant.getName());
@@ -366,17 +382,7 @@
Page page = new Page<>();
page.setSize(pageMcsMerchantDTO.getPageSize());
page.setCurrent(pageMcsMerchantDTO.getPageNum());
- String lat = pageMcsMerchantDTO.getLat();
- String lon = pageMcsMerchantDTO.getLon();
- Integer distance = pageMcsMerchantDTO.getDistance();
- IPage<McsMerchantVO> mcsMerchants;
- if (isNotEmpty(lat) && isNotEmpty(lon) && nonNull(distance)) {
- Rectangle rectangle = new NearbyUtil().getRectangle(distance, Double.parseDouble(lon), Double.parseDouble(lat));
- mcsMerchants = this.baseMapper.pageH5McsMerchant(page, rectangle.getMinX(), rectangle.getMaxX(),
- rectangle.getMinY(), rectangle.getMaxY(), pageMcsMerchantDTO);
- } else {
- mcsMerchants = this.baseMapper.pageH5McsMerchant(page, null, null, null, null, pageMcsMerchantDTO);
- }
+ IPage<McsMerchantVO> mcsMerchants = this.baseMapper.pageH5McsMerchant(page, pageMcsMerchantDTO);
return R.ok(mcsMerchants);
}
--
Gitblit v1.7.1