|
|
@@ -61,6 +61,7 @@ import java.time.format.DateTimeFormatterBuilder;
|
|
|
import java.time.temporal.ChronoField;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -163,6 +164,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
private final LifeRefundOrderMapper lifeRefundOrderMapper;
|
|
|
|
|
|
private final LifeUserMapper lifeUserMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 门店详情
|
|
|
*
|
|
|
@@ -172,8 +174,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
public StoreMainInfoVo getDetail(Integer id) {
|
|
|
|
|
|
StoreInfo storeInfo = storeInfoMapper.selectById(id);
|
|
|
- if(storeInfo == null){
|
|
|
- return null;
|
|
|
+ if (storeInfo == null) {
|
|
|
+ return null;
|
|
|
}
|
|
|
StoreMainInfoVo storeMainInfoVo = storeInfoMapper.getStoreInfo(id);
|
|
|
//存入门店地址、
|
|
|
@@ -335,13 +337,13 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// 获取当前时间
|
|
|
LocalDate nowDay = LocalDate.now();
|
|
|
//经营许可证到期状态筛选 0 查询食品经营许可证已到期
|
|
|
- if(CommonConstant.FOOD_LICENCE_EXPIRE_STATUS.equals(foodLicenceWhetherExpiredStatus)){
|
|
|
- queryWrapper.lt("a.food_licence_expiration_time",nowDay);
|
|
|
- } else if(CommonConstant.FOOD_LICENCE_ABOUT_TO_EXPIRE_STATUS.equals(foodLicenceWhetherExpiredStatus)){//经营许可证筛选状态 1 查询食品经营许可证即将到期 距离到期时间30天内
|
|
|
- queryWrapper.lt("a.food_licence_expiration_time",nowDay.plusDays(31))
|
|
|
- .ge("a.food_licence_expiration_time",nowDay);
|
|
|
- }else if(CommonConstant.FOOD_LICENCE_NOT_EXPIRED_STATUS.equals(foodLicenceWhetherExpiredStatus)){//经营许可证筛选状态 2 查询食品经营许可证未到期 距离到期时间大于30天以上
|
|
|
- queryWrapper.gt("a.food_licence_expiration_time",nowDay.plusDays(31));
|
|
|
+ if (CommonConstant.FOOD_LICENCE_EXPIRE_STATUS.equals(foodLicenceWhetherExpiredStatus)) {
|
|
|
+ queryWrapper.lt("a.food_licence_expiration_time", nowDay);
|
|
|
+ } else if (CommonConstant.FOOD_LICENCE_ABOUT_TO_EXPIRE_STATUS.equals(foodLicenceWhetherExpiredStatus)) {//经营许可证筛选状态 1 查询食品经营许可证即将到期 距离到期时间30天内
|
|
|
+ queryWrapper.lt("a.food_licence_expiration_time", nowDay.plusDays(31))
|
|
|
+ .ge("a.food_licence_expiration_time", nowDay);
|
|
|
+ } else if (CommonConstant.FOOD_LICENCE_NOT_EXPIRED_STATUS.equals(foodLicenceWhetherExpiredStatus)) {//经营许可证筛选状态 2 查询食品经营许可证未到期 距离到期时间大于30天以上
|
|
|
+ queryWrapper.gt("a.food_licence_expiration_time", nowDay.plusDays(31));
|
|
|
}
|
|
|
IPage<StoreInfoVo> storeInfoVoPage = storeInfoMapper.getStoreInfoVoPage(iPage, queryWrapper);
|
|
|
List<StoreInfoVo> records = storeInfoVoPage.getRecords();
|
|
|
@@ -411,20 +413,20 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
|
// 处理经营许可证到期时间回显状态 根据经营许可证筛选状态筛选
|
|
|
Date foodDate = record.getFoodLicenceExpirationTime();
|
|
|
- if(foodDate != null){
|
|
|
+ if (foodDate != null) {
|
|
|
// 获取当前时间
|
|
|
LocalDate nowLocal = LocalDate.now();
|
|
|
LocalDate localDate = foodDate.toInstant() // Date -> Instant(UTC时间戳)
|
|
|
.atZone(ZoneId.systemDefault()) // Instant -> ZonedDateTime(系统默认时区)
|
|
|
.toLocalDate();
|
|
|
long remainingDays = ChronoUnit.DAYS.between(nowLocal, localDate);
|
|
|
- if(remainingDays == -1){
|
|
|
+ if (remainingDays == -1) {
|
|
|
record.setFoodLicenceRemainingDays("0天");
|
|
|
record.setFoodLicenceExpireStatus("已到期");
|
|
|
- }else if(remainingDays >= 0 && remainingDays <= 30){
|
|
|
+ } else if (remainingDays >= 0 && remainingDays <= 30) {
|
|
|
record.setFoodLicenceRemainingDays(remainingDays + "天");
|
|
|
record.setFoodLicenceExpireStatus("即将到期");
|
|
|
- }else if(remainingDays > 30){
|
|
|
+ } else if (remainingDays > 30) {
|
|
|
record.setFoodLicenceRemainingDays(remainingDays + "天");
|
|
|
record.setFoodLicenceExpireStatus("未到期");
|
|
|
}
|
|
|
@@ -623,14 +625,14 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
String userAccount = storeInfoDto.getUserAccount();
|
|
|
StoreUser storeUser = storeUserMapper.selectById(userAccount);
|
|
|
storeUser.setStoreId(storeInfo.getId());
|
|
|
- if(StringUtils.isNotEmpty(storeInfoDto.getStoreContact())){
|
|
|
+ if (StringUtils.isNotEmpty(storeInfoDto.getStoreContact())) {
|
|
|
storeUser.setName(storeInfoDto.getStoreContact());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(storeInfoDto.getIdCard())){
|
|
|
+ if (StringUtils.isNotEmpty(storeInfoDto.getIdCard())) {
|
|
|
storeUser.setIdCard(storeInfoDto.getIdCard());
|
|
|
}
|
|
|
storeUserMapper.updateById(storeUser);
|
|
|
- StoreInfoUserMiddle storeInfoUserMiddle = new StoreInfoUserMiddle();
|
|
|
+ StoreInfoUserMiddle storeInfoUserMiddle = new StoreInfoUserMiddle();
|
|
|
storeInfoUserMiddle.setStoreId(storeInfo.getId());
|
|
|
storeInfoUserMiddle.setUserId(storeUser.getId());
|
|
|
storeInfoUserMiddleMapper.insert(storeInfoUserMiddle);
|
|
|
@@ -646,7 +648,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
storeImgMapper.insert(storeImg);
|
|
|
}
|
|
|
//存入店铺合同图片
|
|
|
- if(!CollectionUtils.isEmpty(storeInfoDto.getContractImageList())){
|
|
|
+ if (!CollectionUtils.isEmpty(storeInfoDto.getContractImageList())) {
|
|
|
List<String> contractImageList = storeInfoDto.getContractImageList();
|
|
|
//先移除此前数据
|
|
|
storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 15));
|
|
|
@@ -662,14 +664,14 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
|
|
|
|
//存入店铺经营许可证图片
|
|
|
- if(StringUtils.isNotEmpty(storeInfoDto.getFoodLicenceUrl())){
|
|
|
- StoreImg storeImg = new StoreImg();
|
|
|
- storeImg.setStoreId(storeInfo.getId());
|
|
|
- storeImg.setImgType(25);
|
|
|
- storeImg.setImgSort(0);
|
|
|
- storeImg.setImgDescription("经营许可证审核通过图片");
|
|
|
- storeImg.setImgUrl(storeInfoDto.getFoodLicenceUrl());
|
|
|
- storeImgMapper.insert(storeImg);
|
|
|
+ if (StringUtils.isNotEmpty(storeInfoDto.getFoodLicenceUrl())) {
|
|
|
+ StoreImg storeImg = new StoreImg();
|
|
|
+ storeImg.setStoreId(storeInfo.getId());
|
|
|
+ storeImg.setImgType(25);
|
|
|
+ storeImg.setImgSort(0);
|
|
|
+ storeImg.setImgDescription("经营许可证审核通过图片");
|
|
|
+ storeImg.setImgUrl(storeInfoDto.getFoodLicenceUrl());
|
|
|
+ storeImgMapper.insert(storeImg);
|
|
|
}
|
|
|
|
|
|
//初始化标签数据
|
|
|
@@ -677,7 +679,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
tagStoreRelationLambdaQueryWrapper.eq(TagStoreRelation::getStoreId, storeInfo.getId());
|
|
|
tagStoreRelationLambdaQueryWrapper.eq(TagStoreRelation::getDeleteFlag, 0);
|
|
|
int tagStoreCount = tagStoreRelationMapper.selectCount(tagStoreRelationLambdaQueryWrapper);
|
|
|
- if(tagStoreCount == 0){
|
|
|
+ if (tagStoreCount == 0) {
|
|
|
TagStoreRelation tagStoreRelation = new TagStoreRelation();
|
|
|
tagStoreRelation.setStoreId(storeInfo.getId());
|
|
|
tagStoreRelation.setDeleteFlag(0);
|
|
|
@@ -688,7 +690,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// 发送通知
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String commonDate = simpleDateFormat.format(new Date());
|
|
|
- String text = "您在"+commonDate+"提交的入驻店铺申请,平台已受理,1-3个工作日将审核结果发送至应用内的消息-通知中,请注意查收。";
|
|
|
+ String text = "您在" + commonDate + "提交的入驻店铺申请,平台已受理,1-3个工作日将审核结果发送至应用内的消息-通知中,请注意查收。";
|
|
|
com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
jsonObject.put("message", text);
|
|
|
LifeNotice lifeMessage = new LifeNotice();
|
|
|
@@ -826,7 +828,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
storeUserMapper.updateById(storeUser);
|
|
|
BeanUtils.copyProperties(storeInfoDto, result);
|
|
|
//存入店铺营业执照图片
|
|
|
- if(!CollectionUtils.isEmpty(storeInfoDto.getBusinessLicenseAddress())){
|
|
|
+ if (!CollectionUtils.isEmpty(storeInfoDto.getBusinessLicenseAddress())) {
|
|
|
List<String> businessLicenseAddress = storeInfoDto.getBusinessLicenseAddress();
|
|
|
//先移除此前数据
|
|
|
storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 14));
|
|
|
@@ -855,7 +857,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
storeImgMapper.insert(storeImg);
|
|
|
}
|
|
|
//存入店铺经营许可证图片
|
|
|
- if(StringUtils.isNotEmpty(storeInfoDto.getFoodLicenceUrl())){
|
|
|
+ if (StringUtils.isNotEmpty(storeInfoDto.getFoodLicenceUrl())) {
|
|
|
//先移除此前数据 type:25 审核通过后的图片
|
|
|
storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 25));
|
|
|
//先移除此前数据 type:24 审核前的或者审核拒绝的图片
|
|
|
@@ -1109,10 +1111,10 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
));
|
|
|
if (!collect.isEmpty()) {
|
|
|
List<LifeUserOrderVo> quanCount = lifeUserOrderMapper.getQuanCount(new QueryWrapper<LifeUserOrderVo>()
|
|
|
- .eq("luo.store_id",storeId)
|
|
|
+ .eq("luo.store_id", storeId)
|
|
|
.eq("luo.coupon_type", CouponTypeEnum.COUPON.getCode())
|
|
|
- .eq("luo.delete_flag",0)
|
|
|
- .in("ocm.status",excludeStatuses)
|
|
|
+ .eq("luo.delete_flag", 0)
|
|
|
+ .in("ocm.status", excludeStatuses)
|
|
|
.groupBy("ocm.coupon_id"));
|
|
|
quanList.forEach(a -> {
|
|
|
LifeCouponVo lifeCouponVo = new LifeCouponVo();
|
|
|
@@ -1195,21 +1197,21 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// 获取店铺动态列表
|
|
|
QueryWrapper<LifeUserDynamics> dynamicsWrapper = new QueryWrapper<>();
|
|
|
dynamicsWrapper.eq("phone_id", "store_" + result.getStorePhone()).orderByDesc("lud.created_time");
|
|
|
- dynamicsWrapper.eq("lud.delete_flag",0);
|
|
|
+ dynamicsWrapper.eq("lud.delete_flag", 0);
|
|
|
//List<LifeUserDynamicsVo> storeDynamicslist = lifeUserDynamicsMapper.getStoreDynamicslist(userId, dynamicsWrapper);
|
|
|
List<LifeUserDynamicsVo> storeDynamicslist = lifeUserDynamicsMapper.getStoreDynamicslist(userId, "store_" + result.getStorePhone());
|
|
|
|
|
|
List<String> followList = new ArrayList<>();
|
|
|
List<String> fansList = new ArrayList<>();
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(userId)){
|
|
|
+ if (StringUtils.isNotEmpty(userId)) {
|
|
|
LifeUser lifeUser = lifeUserMapper.selectById(userId);
|
|
|
- if(lifeUser!=null && StringUtils.isNotEmpty(lifeUser.getUserPhone())){
|
|
|
+ if (lifeUser != null && StringUtils.isNotEmpty(lifeUser.getUserPhone())) {
|
|
|
// 查询我的关注信息,构建关注者ID列表
|
|
|
LambdaQueryWrapper<LifeFans> lifeFansWrapper = new LambdaQueryWrapper<>();
|
|
|
lifeFansWrapper.eq(LifeFans::getFansId, "user_" + result.getStorePhone());
|
|
|
List<LifeFans> lifeFansList = lifeFansMapper.selectList(lifeFansWrapper);
|
|
|
- if(!CollectionUtils.isEmpty(lifeFansList)){
|
|
|
+ if (!CollectionUtils.isEmpty(lifeFansList)) {
|
|
|
followList = lifeFansList.stream().map(LifeFans::getFollowedId).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@@ -1217,7 +1219,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
lifeFansWrapper = new LambdaQueryWrapper<>();
|
|
|
lifeFansWrapper.eq(LifeFans::getFollowedId, "user_" + result.getStorePhone());
|
|
|
lifeFansList = lifeFansMapper.selectList(lifeFansWrapper);
|
|
|
- if(!CollectionUtils.isEmpty(lifeFansList)){
|
|
|
+ if (!CollectionUtils.isEmpty(lifeFansList)) {
|
|
|
fansList = lifeFansList.stream().map(LifeFans::getFansId).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|
|
|
@@ -1247,7 +1249,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
result.setStoreBusinessInfo(storeBusinessInfos.get(0));
|
|
|
result.setStoreBusinessInfos(storeBusinessInfos);
|
|
|
//StoreBusinessInfo storeBusinessInfo = result.getStoreBusinessInfo();
|
|
|
- StoreBusinessInfo storeBusinessInfo = result.getStoreBusinessInfos().stream().filter(item -> item.getBusinessType() == 1).findFirst().orElse(null) ;
|
|
|
+ StoreBusinessInfo storeBusinessInfo = result.getStoreBusinessInfos().stream().filter(item -> item.getBusinessType() == 1).findFirst().orElse(null);
|
|
|
if (ObjectUtils.isNotEmpty(storeBusinessInfo)) {
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); // 获取Calendar实例
|
|
|
@@ -1307,9 +1309,9 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
|
|
|
com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
if (2 == approvalStatus) {
|
|
|
- jsonObject.put("message", "您在"+createDate+"提交的入驻店铺申请,审核失败。失败原因:"+reason+"。");
|
|
|
+ jsonObject.put("message", "您在" + createDate + "提交的入驻店铺申请,审核失败。失败原因:" + reason + "。");
|
|
|
} else {
|
|
|
- jsonObject.put("message", "您在"+createDate+"提交的入驻店铺申请,已通过审核,欢迎您的加入。");
|
|
|
+ jsonObject.put("message", "您在" + createDate + "提交的入驻店铺申请,已通过审核,欢迎您的加入。");
|
|
|
}
|
|
|
lifeNotice.setContext(jsonObject.toJSONString());
|
|
|
lifeNotice.setNoticeType(1); // 系统通知
|
|
|
@@ -1658,7 +1660,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// 构建查询优惠券的条件对象
|
|
|
LambdaUpdateWrapper<LifeCoupon> quanWrapper = new LambdaUpdateWrapper<>();
|
|
|
// 添加门店ID筛选条件
|
|
|
- quanWrapper.in(ObjectUtils.isNotEmpty(storeIds),LifeCoupon::getStoreId, storeIds)
|
|
|
+ quanWrapper.in(ObjectUtils.isNotEmpty(storeIds), LifeCoupon::getStoreId, storeIds)
|
|
|
// 添加优惠券状态筛选条件
|
|
|
.eq(LifeCoupon::getStatus, CouponStatusEnum.ONGOING.getCode())
|
|
|
// 按照创建时间降序排序
|
|
|
@@ -1668,7 +1670,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// 构建查询团购套餐条件对象
|
|
|
LambdaUpdateWrapper<LifeGroupBuyMain> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
// 添加门店ID筛选条件
|
|
|
- lambdaUpdateWrapper.in(ObjectUtils.isNotEmpty(storeIds),LifeGroupBuyMain::getStoreId, storeIds)
|
|
|
+ lambdaUpdateWrapper.in(ObjectUtils.isNotEmpty(storeIds), LifeGroupBuyMain::getStoreId, storeIds)
|
|
|
// 添加团购套餐状态筛选条件
|
|
|
.eq(LifeGroupBuyMain::getStatus, 5)
|
|
|
.orderByDesc(LifeGroupBuyMain::getCreatedTime);
|
|
|
@@ -1848,102 +1850,102 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
// 查询状态为待使用的
|
|
|
List<Integer> status = new ArrayList<>();
|
|
|
status.add(OrderStatusEnum.WAIT_USE.getStatus());
|
|
|
- selectWrapper.in("luo.id", "SELECT distinct order_id FROM order_coupon_middle WHERE status in ( "+String.join(",", status.stream().map(String::valueOf).collect(Collectors.toList()))+")");
|
|
|
+ selectWrapper.in("luo.id", "SELECT distinct order_id FROM order_coupon_middle WHERE status in ( " + String.join(",", status.stream().map(String::valueOf).collect(Collectors.toList())) + ")");
|
|
|
List<LifeUserOrderVo> orderList = lifeUserOrderMapper.selectRefundList(selectWrapper);
|
|
|
if (!orderList.isEmpty()) {
|
|
|
for (LifeUserOrderVo order : orderList) {
|
|
|
- // 过滤出退款的券列表
|
|
|
- List<OrderCouponMiddle> orderCouponMiddleList = order.getOrderCouponMiddleList();
|
|
|
- List<OrderCouponMiddle> refundList = orderCouponMiddleList.stream().filter(x -> x.getStatus() == OrderStatusEnum.WAIT_USE.getStatus() || x.getStatus() == OrderStatusEnum.REFUND_FAILED.getStatus()).collect(Collectors.toList());
|
|
|
- List<OrderCouponMiddle> refundedList = orderCouponMiddleList.stream().filter(x -> x.getStatus() == OrderStatusEnum.REFUND.getStatus()).collect(Collectors.toList());
|
|
|
- List<Integer> collect = refundList.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
- if (!refundList.isEmpty()) {
|
|
|
- // 调用退款接口
|
|
|
- // 统计退款金额
|
|
|
- BigDecimal totalRefundAmount = refundList.stream().map(x -> x.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- // 判断本次是否是全退 执行退款
|
|
|
- String refundResult = null;
|
|
|
- if (refundList.size() == orderCouponMiddleList.size()) {
|
|
|
- // 全退
|
|
|
- refundResult = aliApi.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "店铺注销自动退", "");
|
|
|
+ // 过滤出退款的券列表
|
|
|
+ List<OrderCouponMiddle> orderCouponMiddleList = order.getOrderCouponMiddleList();
|
|
|
+ List<OrderCouponMiddle> refundList = orderCouponMiddleList.stream().filter(x -> x.getStatus() == OrderStatusEnum.WAIT_USE.getStatus() || x.getStatus() == OrderStatusEnum.REFUND_FAILED.getStatus()).collect(Collectors.toList());
|
|
|
+ List<OrderCouponMiddle> refundedList = orderCouponMiddleList.stream().filter(x -> x.getStatus() == OrderStatusEnum.REFUND.getStatus()).collect(Collectors.toList());
|
|
|
+ List<Integer> collect = refundList.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
+ if (!refundList.isEmpty()) {
|
|
|
+ // 调用退款接口
|
|
|
+ // 统计退款金额
|
|
|
+ BigDecimal totalRefundAmount = refundList.stream().map(x -> x.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ // 判断本次是否是全退 执行退款
|
|
|
+ String refundResult = null;
|
|
|
+ if (refundList.size() == orderCouponMiddleList.size()) {
|
|
|
+ // 全退
|
|
|
+ refundResult = aliApi.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "店铺注销自动退", "");
|
|
|
+ } else {
|
|
|
+ // TODO 本次部分退款
|
|
|
+ String partialRefundCode = UniqueRandomNumGenerator.generateUniqueCode(12);
|
|
|
+ refundResult = aliApi.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "店铺注销自动退", partialRefundCode);
|
|
|
+ }
|
|
|
+ if ("调用成功".equals(refundResult)) {
|
|
|
+ // 1.更新中间表状态
|
|
|
+ int updateNum = orderCouponMiddleMapper.update(null, new LambdaUpdateWrapper<OrderCouponMiddle>()
|
|
|
+ .set(OrderCouponMiddle::getStatus, OrderStatusEnum.REFUND.getStatus())
|
|
|
+ .in(OrderCouponMiddle::getId, collect));
|
|
|
+ if (updateNum != collect.size()) {
|
|
|
+ log.error("expiredRefundTask更新中间表状态失败");
|
|
|
+ throw new RuntimeException("expiredRefundTask更新中间表状态失败");
|
|
|
+ }
|
|
|
+ // 2.过期后更新库存
|
|
|
+ if (1 == order.getCouponType()) {
|
|
|
+ // 代金券
|
|
|
+ // 恢复库存
|
|
|
+ lifeCouponMapper.update(null, new LambdaUpdateWrapper<LifeCoupon>()
|
|
|
+ .setSql("single_qty=single_qty+" + updateNum)
|
|
|
+ .eq(LifeCoupon::getId, order.getCouponId()));
|
|
|
} else {
|
|
|
- // TODO 本次部分退款
|
|
|
- String partialRefundCode = UniqueRandomNumGenerator.generateUniqueCode(12);
|
|
|
- refundResult = aliApi.processRefund(order.getOrderNo(), totalRefundAmount.toString(), "店铺注销自动退",partialRefundCode);
|
|
|
+ // 团购
|
|
|
+ lifeGroupBuyMainMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyMain>()
|
|
|
+ .setSql("inventory_num=inventory_num+" + updateNum)
|
|
|
+ .eq(LifeGroupBuyMain::getId, order.getCouponId()));
|
|
|
}
|
|
|
- if ("调用成功".equals(refundResult)) {
|
|
|
- // 1.更新中间表状态
|
|
|
- int updateNum = orderCouponMiddleMapper.update(null, new LambdaUpdateWrapper<OrderCouponMiddle>()
|
|
|
- .set(OrderCouponMiddle::getStatus, OrderStatusEnum.REFUND.getStatus())
|
|
|
- .in(OrderCouponMiddle::getId, collect));
|
|
|
- if (updateNum != collect.size()) {
|
|
|
- log.error("expiredRefundTask更新中间表状态失败");
|
|
|
- throw new RuntimeException("expiredRefundTask更新中间表状态失败");
|
|
|
- }
|
|
|
- // 2.过期后更新库存
|
|
|
- if (1 == order.getCouponType()) {
|
|
|
- // 代金券
|
|
|
- // 恢复库存
|
|
|
- lifeCouponMapper.update(null, new LambdaUpdateWrapper<LifeCoupon>()
|
|
|
- .setSql("single_qty=single_qty+" + updateNum)
|
|
|
- .eq(LifeCoupon::getId, order.getCouponId()));
|
|
|
- } else {
|
|
|
- // 团购
|
|
|
- lifeGroupBuyMainMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyMain>()
|
|
|
- .setSql("inventory_num=inventory_num+" + updateNum)
|
|
|
- .eq(LifeGroupBuyMain::getId, order.getCouponId()));
|
|
|
- }
|
|
|
- // 3.更新订单状态 退款+已退 = 全部券则更新总订单状态
|
|
|
- if (refundList.size() + refundedList.size() == orderCouponMiddleList.size()) {
|
|
|
- lifeUserOrderMapper.update(null, new LambdaUpdateWrapper<LifeUserOrder>()
|
|
|
- .set(LifeUserOrder::getStatus, OrderStatusEnum.REFUND.getStatus())
|
|
|
- .eq(LifeUserOrder::getId, order.getId()));
|
|
|
- if (null != order.getQuanId()) {
|
|
|
- // 更新优惠券状态
|
|
|
- lifeDiscountCouponUserMapper.update(null, new LambdaUpdateWrapper<LifeDiscountCouponUser>()
|
|
|
- .set(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue())
|
|
|
- .eq(LifeDiscountCouponUser::getId, order.getQuanId()));
|
|
|
- }
|
|
|
- }else {
|
|
|
- // 累计退券个数+当前退券个数!=总个数 且 当前退券数量 = 可退券数
|
|
|
- lifeUserOrderMapper.update(null,new UpdateWrapper<LifeUserOrder>().eq("id",order.getId())
|
|
|
- .set("status",OrderStatusEnum.COMPLETE.getStatus())
|
|
|
- .set("finish_time",now));
|
|
|
- }
|
|
|
- // 4.添加退款记录
|
|
|
- LifeRefundOrder refundOrder = new LifeRefundOrder()
|
|
|
- .setOrderId(order.getId())
|
|
|
- .setUserId(order.getUserId())
|
|
|
- .setOrderId(order.getId())
|
|
|
- .setRefundCouponAmount(updateNum)
|
|
|
- .setReason("店铺注销自动退")
|
|
|
- .setApplicationTime(now)
|
|
|
- .setRefundTime(now)
|
|
|
- .setStatus(0)
|
|
|
- .setRefundMoney(totalRefundAmount.toString());
|
|
|
- if (lifeRefundOrderMapper.insert(refundOrder) > 0) {
|
|
|
- // TODO 是否发送通知
|
|
|
- // 发送通知
|
|
|
- LifeNotice lifeMessage = new LifeNotice();
|
|
|
- LifeUser lifeUser = lifeUserMapper.selectById(order.getUserId());
|
|
|
- lifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
|
|
|
- String text = "您的编号为" + order.getOrderNo() + "的订单店铺注销自动退款,退款金额为" + totalRefundAmount.toString() + "元";
|
|
|
- lifeMessage.setContext(text);
|
|
|
- lifeMessage.setSenderId("system");
|
|
|
- lifeMessage.setIsRead(0);
|
|
|
- lifeMessage.setNoticeType(2);
|
|
|
- lifeNoticeMapper.insert(lifeMessage);
|
|
|
+ // 3.更新订单状态 退款+已退 = 全部券则更新总订单状态
|
|
|
+ if (refundList.size() + refundedList.size() == orderCouponMiddleList.size()) {
|
|
|
+ lifeUserOrderMapper.update(null, new LambdaUpdateWrapper<LifeUserOrder>()
|
|
|
+ .set(LifeUserOrder::getStatus, OrderStatusEnum.REFUND.getStatus())
|
|
|
+ .eq(LifeUserOrder::getId, order.getId()));
|
|
|
+ if (null != order.getQuanId()) {
|
|
|
+ // 更新优惠券状态
|
|
|
+ lifeDiscountCouponUserMapper.update(null, new LambdaUpdateWrapper<LifeDiscountCouponUser>()
|
|
|
+ .set(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue())
|
|
|
+ .eq(LifeDiscountCouponUser::getId, order.getQuanId()));
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 累计退券个数+当前退券个数!=总个数 且 当前退券数量 = 可退券数
|
|
|
+ lifeUserOrderMapper.update(null, new UpdateWrapper<LifeUserOrder>().eq("id", order.getId())
|
|
|
+ .set("status", OrderStatusEnum.COMPLETE.getStatus())
|
|
|
+ .set("finish_time", now));
|
|
|
}
|
|
|
- } else {
|
|
|
- // 更新中间表状态
|
|
|
- // 1.更新中间表状态
|
|
|
+ // 4.添加退款记录
|
|
|
+ LifeRefundOrder refundOrder = new LifeRefundOrder()
|
|
|
+ .setOrderId(order.getId())
|
|
|
+ .setUserId(order.getUserId())
|
|
|
+ .setOrderId(order.getId())
|
|
|
+ .setRefundCouponAmount(updateNum)
|
|
|
+ .setReason("店铺注销自动退")
|
|
|
+ .setApplicationTime(now)
|
|
|
+ .setRefundTime(now)
|
|
|
+ .setStatus(0)
|
|
|
+ .setRefundMoney(totalRefundAmount.toString());
|
|
|
+ if (lifeRefundOrderMapper.insert(refundOrder) > 0) {
|
|
|
+ // TODO 是否发送通知
|
|
|
+ // 发送通知
|
|
|
+ LifeNotice lifeMessage = new LifeNotice();
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(order.getUserId());
|
|
|
+ lifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
|
|
|
+ String text = "您的编号为" + order.getOrderNo() + "的订单店铺注销自动退款,退款金额为" + totalRefundAmount.toString() + "元";
|
|
|
+ lifeMessage.setContext(text);
|
|
|
+ lifeMessage.setSenderId("system");
|
|
|
+ lifeMessage.setIsRead(0);
|
|
|
+ lifeMessage.setNoticeType(2);
|
|
|
+ lifeNoticeMapper.insert(lifeMessage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 更新中间表状态
|
|
|
+ // 1.更新中间表状态
|
|
|
// int updateNum = orderCouponMiddleMapper.update(null, new LambdaUpdateWrapper<OrderCouponMiddle>()
|
|
|
// .set(OrderCouponMiddle::getStatus, OrderStatusEnum.REFUND_FAILED.getStatus())
|
|
|
// .in(OrderCouponMiddle::getId, collect));
|
|
|
- log.error("注销自动退款失败");
|
|
|
- throw new RuntimeException("注销自动退款失败");
|
|
|
- }
|
|
|
+ log.error("注销自动退款失败");
|
|
|
+ throw new RuntimeException("注销自动退款失败");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (num > 0) {
|
|
|
@@ -2003,7 +2005,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
lifeMessage.setReceiverId("store_" + storeInfo.getStorePhone());
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String storeDate = simpleDateFormat.format(new Date());
|
|
|
- String text = "您在"+storeDate+"撤销了注销账号,所有数据均已保留,您可继续在平台使用。";
|
|
|
+ String text = "您在" + storeDate + "撤销了注销账号,所有数据均已保留,您可继续在平台使用。";
|
|
|
com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
jsonObject.put("message", text);
|
|
|
lifeMessage.setContext(jsonObject.toJSONString());
|
|
|
@@ -2046,56 +2048,119 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
@Override
|
|
|
public int saveOrUpdateStoreInfo(StoreInfoDto storeInfodto) {
|
|
|
if (storeInfodto.getId() != null) {
|
|
|
- //效验当前店铺存在未完成的订单及正在销售的商品
|
|
|
+ // 校验当前店铺存在未完成的订单及正在销售的商品
|
|
|
verificationStoreInfoStatus(storeInfodto);
|
|
|
|
|
|
- //获取经营板块id
|
|
|
+ // 1. 处理经营板块及经营种类
|
|
|
Integer businessSection = storeInfodto.getBusinessSection();
|
|
|
- //查询经营板块名称
|
|
|
- StoreDictionary businessSectionName = storeDictionaryMapper.selectOne(new LambdaQueryWrapper<StoreDictionary>().eq(StoreDictionary::getDictId, businessSection).eq(StoreDictionary::getTypeName, "business_section"));
|
|
|
- //查询经营种类
|
|
|
+ StoreDictionary businessSectionDict = null;
|
|
|
List<String> businessTypeNames = new ArrayList<>();
|
|
|
+
|
|
|
+ // 查询经营板块(非空判断,避免后续空指针)
|
|
|
+ if (Objects.nonNull(businessSection)) {
|
|
|
+ businessSectionDict = storeDictionaryMapper.selectOne(
|
|
|
+ new LambdaQueryWrapper<StoreDictionary>()
|
|
|
+ .eq(StoreDictionary::getDictId, businessSection)
|
|
|
+ .eq(StoreDictionary::getTypeName, "business_section")
|
|
|
+ );
|
|
|
+ // 若经营板块不存在,可根据业务抛出异常或默认处理
|
|
|
+ if (Objects.isNull(businessSectionDict)) {
|
|
|
+ throw new IllegalArgumentException("经营板块不存在:" + businessSection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量查询经营种类(替代循环查询,解决N+1问题)
|
|
|
List<String> businessTypes = storeInfodto.getBusinessTypes();
|
|
|
- if (!CollectionUtils.isEmpty(businessTypes)) {
|
|
|
- //获取经营种类名称
|
|
|
- for (String businessType : businessTypes) {
|
|
|
- StoreDictionary storeDictionary = storeDictionaryMapper.selectOne(new LambdaQueryWrapper<StoreDictionary>().eq(StoreDictionary::getDictId, businessType).eq(StoreDictionary::getParentId, businessSectionName.getId()));
|
|
|
- businessTypeNames.add(storeDictionary.getDictDetail());
|
|
|
+ if (Objects.nonNull(businessSectionDict) && !CollectionUtils.isEmpty(businessTypes)) {
|
|
|
+ // 一次查询所有符合条件的经营种类
|
|
|
+ List<StoreDictionary> typeDicts = storeDictionaryMapper.selectList(
|
|
|
+ new LambdaQueryWrapper<StoreDictionary>()
|
|
|
+ .in(StoreDictionary::getDictId, businessTypes) // 批量匹配id
|
|
|
+ .eq(StoreDictionary::getParentId, businessSectionDict.getId())
|
|
|
+ );
|
|
|
+ // 转为Map<dictId, StoreDictionary>,方便快速获取
|
|
|
+ Map<String, StoreDictionary> typeDictMap = typeDicts.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ dict -> dict.getDictId().toString(), // 假设dictId是字符串类型,若为数字需转换
|
|
|
+ Function.identity(),
|
|
|
+ (existing, replacement) -> existing // 处理重复id(理论上不会有)
|
|
|
+ ));
|
|
|
+ // 提取经营种类名称
|
|
|
+ for (String typeId : businessTypes) {
|
|
|
+ StoreDictionary dict = typeDictMap.get(typeId);
|
|
|
+ if (Objects.nonNull(dict)) {
|
|
|
+ businessTypeNames.add(dict.getDictDetail());
|
|
|
+ } else {
|
|
|
+ // 可选:记录无效的经营种类id,便于排查
|
|
|
+ log.warn("无效的经营种类id:" + typeId + "(所属板块:" + businessSectionDict.getDictDetail() + ")");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 2. 构建StoreInfo对象
|
|
|
StoreInfo storeInfo = new StoreInfo();
|
|
|
BeanUtils.copyProperties(storeInfodto, storeInfo);
|
|
|
|
|
|
- //存入经纬度
|
|
|
- if (StringUtils.isEmpty(storeInfodto.getStorePositionLongitude()) || StringUtils.isEmpty(storeInfodto.getStorePositionLatitude())) {
|
|
|
- StoreInfo storeIn = storeInfoMapper.selectById(storeInfodto.getId());
|
|
|
- storeInfo.setStorePosition(storeIn.getStorePosition());
|
|
|
+ // 3. 处理经纬度
|
|
|
+ String longitude = storeInfodto.getStorePositionLongitude();
|
|
|
+ String latitude = storeInfodto.getStorePositionLatitude();
|
|
|
+ if (StringUtils.isEmpty(longitude) || StringUtils.isEmpty(latitude)) {
|
|
|
+ // 经纬度为空时,复用原数据
|
|
|
+ StoreInfo oldStore = storeInfoMapper.selectById(storeInfodto.getId());
|
|
|
+ if (Objects.nonNull(oldStore)) {
|
|
|
+ storeInfo.setStorePosition(oldStore.getStorePosition());
|
|
|
+ }
|
|
|
} else {
|
|
|
- storeInfo.setStorePosition(storeInfodto.getStorePositionLongitude() + "," + storeInfodto.getStorePositionLatitude());
|
|
|
+ // 拼接经纬度
|
|
|
+ storeInfo.setStorePosition(longitude + "," + latitude);
|
|
|
}
|
|
|
|
|
|
- //存入门店状态
|
|
|
+ // 4. 设置门店状态、经营板块及类型
|
|
|
storeInfo.setStoreStatus(storeInfodto.getStoreStatus());
|
|
|
- //板块及类型
|
|
|
- storeInfo.setBusinessSection(businessSection);
|
|
|
- storeInfo.setBusinessSectionName(businessSectionName.getDictDetail());
|
|
|
+ // 经营板块(非空时才设置)
|
|
|
+ if (Objects.nonNull(businessSection)) {
|
|
|
+ storeInfo.setBusinessSection(businessSection);
|
|
|
+ }
|
|
|
+ // 经营板块名称(非空时才设置)
|
|
|
+ if (Objects.nonNull(businessSectionDict)) {
|
|
|
+ storeInfo.setBusinessSectionName(businessSectionDict.getDictDetail());
|
|
|
+ }
|
|
|
+ // 经营种类及名称(非空时拼接)
|
|
|
if (!CollectionUtils.isEmpty(businessTypes) && !CollectionUtils.isEmpty(businessTypeNames)) {
|
|
|
storeInfo.setBusinessTypes(String.join(",", businessTypes));
|
|
|
storeInfo.setBusinessTypesName(String.join(",", businessTypeNames));
|
|
|
}
|
|
|
- //处理一下行政区域信息
|
|
|
- EssentialCityCode essentialCityCode1 = essentialCityCodeMapper.selectOne(new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, storeInfo.getAdministrativeRegionProvinceAdcode()));
|
|
|
- storeInfo.setAdministrativeRegionProvinceName(essentialCityCode1.getAreaName());
|
|
|
- EssentialCityCode essentialCityCode2 = essentialCityCodeMapper.selectOne(new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, storeInfo.getAdministrativeRegionCityAdcode()));
|
|
|
- storeInfo.setAdministrativeRegionCityName(essentialCityCode2.getAreaName());
|
|
|
- EssentialCityCode essentialCityCode3 = essentialCityCodeMapper.selectOne(new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, storeInfo.getAdministrativeRegionDistrictAdcode()));
|
|
|
- storeInfo.setAdministrativeRegionDistrictName(essentialCityCode3.getAreaName());
|
|
|
- int num = storeInfoMapper.updateById(storeInfo);
|
|
|
- if (!StringUtils.isEmpty(storeInfodto.getStorePositionLongitude()) && !StringUtils.isEmpty(storeInfodto.getStorePositionLatitude())) {
|
|
|
- nearMeService.inGeolocation(new Point(Double.parseDouble(storeInfodto.getStorePositionLongitude()), Double.parseDouble(storeInfodto.getStorePositionLatitude())), storeInfo.getId().toString(), Boolean.TRUE);
|
|
|
+
|
|
|
+ // 5. 处理行政区域信息(抽取为方法,减少重复) 不存在单独查的情况
|
|
|
+ if (!Objects.isNull(storeInfo.getAdministrativeRegionProvinceAdcode())) {
|
|
|
+
|
|
|
+ storeInfo.setAdministrativeRegionProvinceName(
|
|
|
+ getAreaName(storeInfo.getAdministrativeRegionProvinceAdcode())
|
|
|
+ );
|
|
|
+ storeInfo.setAdministrativeRegionCityName(
|
|
|
+ getAreaName(storeInfo.getAdministrativeRegionCityAdcode())
|
|
|
+ );
|
|
|
+ storeInfo.setAdministrativeRegionDistrictName(
|
|
|
+ getAreaName(storeInfo.getAdministrativeRegionDistrictAdcode())
|
|
|
+ );
|
|
|
}
|
|
|
- return num;
|
|
|
|
|
|
+ // 6. 执行更新
|
|
|
+ int updateNum = storeInfoMapper.updateById(storeInfo);
|
|
|
+
|
|
|
+ // 7. 更新地理位置信息(处理经纬度解析异常)
|
|
|
+ if (!StringUtils.isEmpty(longitude) && !StringUtils.isEmpty(latitude)) {
|
|
|
+ try {
|
|
|
+ double lon = Double.parseDouble(longitude);
|
|
|
+ double lat = Double.parseDouble(latitude);
|
|
|
+ nearMeService.inGeolocation(new Point(lon, lat), storeInfo.getId().toString(), Boolean.TRUE);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("经纬度解析失败:longitude=" + longitude + ", latitude=" + latitude);
|
|
|
+ // 可选:根据业务是否抛出异常,或忽略
|
|
|
+ // throw new IllegalArgumentException("经纬度格式错误", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return updateNum;
|
|
|
} else {
|
|
|
StoreInfo storeInfo = new StoreInfo();
|
|
|
BeanUtils.copyProperties(storeInfodto, storeInfo);
|
|
|
@@ -2104,6 +2169,17 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 抽取:根据区域编码查询区域名称(通用方法)
|
|
|
+ private String getAreaName(String areaCode) {
|
|
|
+ if (StringUtils.isEmpty(areaCode)) {
|
|
|
+ return ""; // 或返回null,根据业务定义
|
|
|
+ }
|
|
|
+ EssentialCityCode cityCode = essentialCityCodeMapper.selectOne(
|
|
|
+ new LambdaQueryWrapper<EssentialCityCode>().eq(EssentialCityCode::getAreaCode, areaCode)
|
|
|
+ );
|
|
|
+ return Objects.nonNull(cityCode) ? cityCode.getAreaName() : "";
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, String> storeInfoVerification(int id) {
|
|
|
Map<String, String> storeInfoMap = new HashMap<>();
|
|
|
@@ -2119,7 +2195,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, -4);
|
|
|
Date startDay = calendar.getTime();
|
|
|
String startDayS = sdf.format(startDay);
|
|
|
- JSONObject jsonObject =storeIncomeDetailsRecordService.noYetPayment(id, 0, 0,startDayS,formattedDate, 1, 10);
|
|
|
+ JSONObject jsonObject = storeIncomeDetailsRecordService.noYetPayment(id, 0, 0, startDayS, formattedDate, 1, 10);
|
|
|
String moneyNew = jsonObject.getString("money");
|
|
|
if (storeInfo != null) {
|
|
|
Map<String, Object> map = storeIncomeDetailsRecordService.accountBalance(id);
|
|
|
@@ -2142,7 +2218,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
//判断店铺存在正在售卖的商品 0:未通过 1:通过 storeGoodsStatus 代金券 storeGroupStatus 团购
|
|
|
List<LifeGroupBuyMain> lifeGroupBuyMainList = lifeGroupBuyMainMapper.selectList(new LambdaQueryWrapper<LifeGroupBuyMain>().eq(LifeGroupBuyMain::getStoreId, id).eq(LifeGroupBuyMain::getStatus, 5).eq(LifeGroupBuyMain::getDeleteFlag, 0));
|
|
|
List<LifeCoupon> lifeCoupons = lifeCouponMapper.selectList(new LambdaQueryWrapper<LifeCoupon>().in(LifeCoupon::getStatus, 5).and(qw -> qw.gt(LifeCoupon::getSingleQty, 0)).eq(LifeCoupon::getStoreId, id).eq(LifeCoupon::getType, 1).eq(LifeCoupon::getDeleteFlag, 0));
|
|
|
- if (!CollectionUtils.isEmpty(lifeCoupons) ) {
|
|
|
+ if (!CollectionUtils.isEmpty(lifeCoupons)) {
|
|
|
storeInfoMap.put("storeGoodsStatus", "0");
|
|
|
} else {
|
|
|
storeInfoMap.put("storeGoodsStatus", "1");
|
|
|
@@ -2164,8 +2240,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
StoreInfo storeInfo = storeInfoMapper.selectOne(queryWrapper);
|
|
|
if (storeInfo != null && storeInfo.getStoreStatus() == -1) {
|
|
|
storeInfoMapper.deleteById(id);
|
|
|
- StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId,id));
|
|
|
- if(storeUser!= null){
|
|
|
+ StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, id));
|
|
|
+ if (storeUser != null) {
|
|
|
UpdateWrapper<StoreUser> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.eq("id", storeUser.getId());
|
|
|
updateWrapper.set("store_id", null);
|
|
|
@@ -2181,7 +2257,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
int value = storeId.orElse(0);
|
|
|
int num = 0;
|
|
|
//先清除数据
|
|
|
- storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType,22).eq(StoreImg::getStoreId,value));
|
|
|
+ storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 22).eq(StoreImg::getStoreId, value));
|
|
|
for (StoreImg renewContract : storeImgList) {
|
|
|
StoreImg storeImg = new StoreImg();
|
|
|
storeImg.setStoreId(renewContract.getStoreId());
|
|
|
@@ -2204,15 +2280,15 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
|
|
|
@Override
|
|
|
public int uploadfoodLicence(StoreImg storeImg) {
|
|
|
- storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType,24).eq(StoreImg::getStoreId,storeImg.getStoreId()));
|
|
|
- storeImg.setImgType(24);
|
|
|
- storeImg.setImgDescription("经营许可证审核通过前图片");
|
|
|
- storeImgMapper.insert(storeImg);
|
|
|
- //更新店铺
|
|
|
- StoreInfo storeInfo = new StoreInfo();
|
|
|
- storeInfo.setFoodLicenceStatus(2);
|
|
|
- storeInfo.setId(storeImg.getStoreId());
|
|
|
- storeInfo.setUpdateFoodLicenceTime(new Date());
|
|
|
+ storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 24).eq(StoreImg::getStoreId, storeImg.getStoreId()));
|
|
|
+ storeImg.setImgType(24);
|
|
|
+ storeImg.setImgDescription("经营许可证审核通过前图片");
|
|
|
+ storeImgMapper.insert(storeImg);
|
|
|
+ //更新店铺
|
|
|
+ StoreInfo storeInfo = new StoreInfo();
|
|
|
+ storeInfo.setFoodLicenceStatus(2);
|
|
|
+ storeInfo.setId(storeImg.getStoreId());
|
|
|
+ storeInfo.setUpdateFoodLicenceTime(new Date());
|
|
|
return storeInfoMapper.updateById(storeInfo);
|
|
|
}
|
|
|
|
|
|
@@ -2253,10 +2329,10 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
|
//食品经营许可证照片列表
|
|
|
List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 24).eq(StoreImg::getStoreId, id));
|
|
|
- if (!CollectionUtils.isEmpty(storeImgList)) {
|
|
|
- map.put("foodLicenceImgList", storeImgList);
|
|
|
- } else {
|
|
|
- map.put("foodLicenceImgList", "");
|
|
|
+ if (!CollectionUtils.isEmpty(storeImgList)) {
|
|
|
+ map.put("foodLicenceImgList", storeImgList);
|
|
|
+ } else {
|
|
|
+ map.put("foodLicenceImgList", "");
|
|
|
}
|
|
|
if (storeInfo.getFoodLicenceReason() != null) {
|
|
|
map.put("foodLicenceReason", storeInfo.getFoodLicenceReason());
|
|
|
@@ -2277,7 +2353,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, id).eq(StoreImg::getImgType, 22));
|
|
|
List<Integer> imgList = storeImgList.stream().map(StoreImg::getId).collect(Collectors.toList());
|
|
|
LambdaUpdateWrapper<StoreImg> lambdaUpdateWrapper = new LambdaUpdateWrapper();
|
|
|
- lambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 15).set(StoreImg::getImgDescription,"合同图片");
|
|
|
+ lambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 15).set(StoreImg::getImgDescription, "合同图片");
|
|
|
int num = storeImgMapper.update(null, lambdaUpdateWrapper);
|
|
|
return num;
|
|
|
}
|
|
|
@@ -2288,20 +2364,20 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
LambdaUpdateWrapper<StoreImg> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
lambdaUpdateWrapper.eq(StoreImg::getStoreId, id);
|
|
|
lambdaUpdateWrapper.eq(StoreImg::getImgType, 25);
|
|
|
- lambdaUpdateWrapper.set(StoreImg::getDeleteFlag,1);
|
|
|
- storeImgMapper.update(null,lambdaUpdateWrapper);
|
|
|
+ lambdaUpdateWrapper.set(StoreImg::getDeleteFlag, 1);
|
|
|
+ storeImgMapper.update(null, lambdaUpdateWrapper);
|
|
|
//修改续签合同类型为合同类型
|
|
|
List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, id).eq(StoreImg::getImgType, 24));
|
|
|
List<Integer> imgList = storeImgList.stream().map(StoreImg::getId).collect(Collectors.toList());
|
|
|
LambdaUpdateWrapper<StoreImg> imgLambdaUpdateWrapper = new LambdaUpdateWrapper();
|
|
|
- imgLambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 25).set(StoreImg::getImgDescription,"经营许可证审核通过图片");
|
|
|
+ imgLambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 25).set(StoreImg::getImgDescription, "经营许可证审核通过图片");
|
|
|
int num = storeImgMapper.update(null, imgLambdaUpdateWrapper);
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
void verificationStoreInfoStatus(StoreInfoDto storeInfo) {
|
|
|
//营业状态 0:正常营业, 1:暂停营业, 2:筹建中, 99:永久关门
|
|
|
- if (storeInfo.getBusinessStatus() == 99) {
|
|
|
+ if (!Objects.isNull(storeInfo.getBusinessStatus()) && storeInfo.getBusinessStatus() == 99) {
|
|
|
//判断店铺有未完成的订单
|
|
|
List<LifeUserOrder> lifeUserOrders = lifeUserOrderMapper.selectList(new LambdaQueryWrapper<LifeUserOrder>().in(LifeUserOrder::getStatus, 0, 3).eq(LifeUserOrder::getStoreId, storeInfo.getId()).eq(LifeUserOrder::getDeleteFlag, 0));
|
|
|
if (!CollectionUtils.isEmpty(lifeUserOrders)) {
|