|
@@ -4417,5 +4417,230 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<LifeCouponVo> getStoreCouponList(String storeId) {
|
|
|
|
|
+ // 获取店铺代金券列表
|
|
|
|
|
+ LambdaUpdateWrapper<LifeCoupon> quanWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
+ quanWrapper.eq(LifeCoupon::getStoreId, storeId).eq(LifeCoupon::getStatus, CouponStatusEnum.ONGOING.getCode()).eq(LifeCoupon::getType, 1);
|
|
|
|
|
+ List<LifeCoupon> quanList = lifeCouponMapper.selectList(quanWrapper);
|
|
|
|
|
+ List<LifeCouponVo> quanVoList = new ArrayList<>();
|
|
|
|
|
+ List<String> collect = quanList.stream().map(LifeCoupon::getId).collect(Collectors.toList());
|
|
|
|
|
+ // 设置已售数量
|
|
|
|
|
+ // 定义需要的订单状态集合
|
|
|
|
|
+ Set<Integer> excludeStatuses = new HashSet<>(Arrays.asList(
|
|
|
|
|
+ OrderStatusEnum.WAIT_PAY.getStatus(),
|
|
|
|
|
+ OrderStatusEnum.WAIT_USE.getStatus(),
|
|
|
|
|
+ OrderStatusEnum.USED.getStatus()
|
|
|
|
|
+ ));
|
|
|
|
|
+ if (!collect.isEmpty()) {
|
|
|
|
|
+ List<LifeUserOrderVo> quanCount = lifeUserOrderMapper.getQuanCount(new QueryWrapper<LifeUserOrderVo>()
|
|
|
|
|
+ .eq("luo.store_id", storeId)
|
|
|
|
|
+ .eq("luo.coupon_type", CouponTypeEnum.COUPON.getCode())
|
|
|
|
|
+ .eq("luo.delete_flag", 0)
|
|
|
|
|
+ .in("ocm.status", excludeStatuses)
|
|
|
|
|
+ .groupBy("ocm.coupon_id"));
|
|
|
|
|
+ quanList.forEach(a -> {
|
|
|
|
|
+ LifeCouponVo lifeCouponVo = new LifeCouponVo();
|
|
|
|
|
+ BeanUtils.copyProperties(a, lifeCouponVo);
|
|
|
|
|
+ quanCount.forEach(item -> {
|
|
|
|
|
+ if (a.getId().equals(item.getCouponId().toString())) {
|
|
|
|
|
+ lifeCouponVo.setCount(item.getCount());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ quanVoList.add(lifeCouponVo);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return quanVoList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public StoreInfoVo getNewStoreDetail(String storeId) {
|
|
|
|
|
+
|
|
|
|
|
+ StoreInfoVo result = new StoreInfoVo();
|
|
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
|
|
|
|
|
+ BeanUtils.copyProperties(storeInfo, result);
|
|
|
|
|
+ //将经营板块和种类拆分成集合
|
|
|
|
|
+ String businessTypes = storeInfo.getBusinessTypes();
|
|
|
|
|
+ if (StringUtils.isNotEmpty(businessTypes)) {
|
|
|
|
|
+ String[] split = businessTypes.split(",");
|
|
|
|
|
+ List<String> list = Arrays.asList(split);
|
|
|
|
|
+ result.setBusinessTypesList(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ //存入用户账户
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, storeId));
|
|
|
|
|
+ if (storeUser != null) {
|
|
|
|
|
+ result.setUserAccount(storeUser.getId().toString());
|
|
|
|
|
+ result.setStorePhone(storeUser.getPhone());
|
|
|
|
|
+ result.setStoreUserName(storeUser.getName());
|
|
|
|
|
+ result.setIdCard(storeUser.getIdCard());
|
|
|
|
|
+ }
|
|
|
|
|
+ //存入执照图片地址
|
|
|
|
|
+ List<StoreImg> storeImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 14));
|
|
|
|
|
+ List<String> storeImgPaths = new ArrayList<>();
|
|
|
|
|
+ for (StoreImg storeImg : storeImgs) {
|
|
|
|
|
+ storeImgPaths.add(storeImg.getImgUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setBusinessLicenseAddress(storeImgPaths);
|
|
|
|
|
+ //存入合同图片地址
|
|
|
|
|
+ List<StoreImg> storeContractImageImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 15));
|
|
|
|
|
+ List<String> storeContractImagePathImgs = new ArrayList<>();
|
|
|
|
|
+ for (StoreImg storeImg : storeContractImageImgs) {
|
|
|
|
|
+ storeContractImagePathImgs.add(storeImg.getImgUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setContractImageList(storeContractImagePathImgs);
|
|
|
|
|
+ //存入续签合同地址
|
|
|
|
|
+ List<StoreImg> renewContractImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 22));
|
|
|
|
|
+ List<String> renewContractImagePathImgs = new ArrayList<>();
|
|
|
|
|
+ for (StoreImg storeImg : renewContractImgs) {
|
|
|
|
|
+ renewContractImagePathImgs.add(storeImg.getImgUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setRenewContractImageList(renewContractImagePathImgs);
|
|
|
|
|
+ //存入经营许可证通过地址
|
|
|
|
|
+ List<StoreImg> foodLicenceImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 25));
|
|
|
|
|
+ List<String> foodLicenceImgsPathImgs = new ArrayList<>();
|
|
|
|
|
+ for (StoreImg storeImg : foodLicenceImgs) {
|
|
|
|
|
+ foodLicenceImgsPathImgs.add(storeImg.getImgUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setFoodLicenceImageList(foodLicenceImgsPathImgs);
|
|
|
|
|
+ //存入经营许可证未通过地址
|
|
|
|
|
+ List<StoreImg> notPassFoodLicenceImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 24));
|
|
|
|
|
+ List<String> notPassFoodLicenceList = new ArrayList<>();
|
|
|
|
|
+ for (StoreImg storeImg : notPassFoodLicenceImgs) {
|
|
|
|
|
+ notPassFoodLicenceList.add(storeImg.getImgUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ result.setNotPassFoodLicenceImageList(notPassFoodLicenceList);
|
|
|
|
|
+ // 存放商家入口图
|
|
|
|
|
+ List<StoreImg> storeEntranceImageImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 1));
|
|
|
|
|
+ if (!storeEntranceImageImgs.isEmpty()) {
|
|
|
|
|
+ result.setEntranceImage(storeEntranceImageImgs.get(0).getImgUrl());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.setEntranceImage("null");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 存放商家头像
|
|
|
|
|
+ List<StoreImg> storeImgs1 = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 10));
|
|
|
|
|
+ if (!storeImgs1.isEmpty()) {
|
|
|
|
|
+ result.setImgUrl(storeImgs1.get(0).getImgUrl());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.setImgUrl("null");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 店铺平均分
|
|
|
|
|
+ /*Map<Object, List<Map<String, Object>>> avgScoreMap = storeEvaluationMapper.allStoreAvgScore().stream().collect(Collectors.groupingBy(o -> o.get("store_id")));
|
|
|
|
|
+ if (avgScoreMap.containsKey(String.valueOf(result.getId()))) {
|
|
|
|
|
+ result.setScore(Double.parseDouble(avgScoreMap.get(String.valueOf(result.getId())).get(0).get("avg_score").toString()));
|
|
|
|
|
+ }*/
|
|
|
|
|
+
|
|
|
|
|
+// Map<String, Object> commitCountAndScore = storeCommentService.getCommitCountAndScore(null, 5, Integer.parseInt(storeId), null, null);
|
|
|
|
|
+// result.setScore(Double.parseDouble(commitCountAndScore.get("score").toString()));
|
|
|
|
|
+// result.setCommitCount(commitCountAndScore.get("commitCount").toString());
|
|
|
|
|
+//
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //营业时间
|
|
|
|
|
+ List<StoreBusinessInfo> storeBusinessInfos = storeBusinessInfoMapper.selectList(new LambdaQueryWrapper<StoreBusinessInfo>().eq(StoreBusinessInfo::getStoreId, storeId).eq(StoreBusinessInfo::getDeleteFlag, 0));
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(storeBusinessInfos)) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(storeBusinessInfo)) {
|
|
|
|
|
+
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance(); // 获取Calendar实例
|
|
|
|
|
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // 获取星期几,注意Calendar中的DAY_OF_WEEK是从1(代表星期天)开始的
|
|
|
|
|
+ String[] days = {"7", "1", "2", "3", "4", "5", "6"};
|
|
|
|
|
+ String day = days[dayOfWeek - 1];
|
|
|
|
|
+ if (storeBusinessInfo.getBusinessDate().contains(day)) {
|
|
|
|
|
+ if (StringUtils.isNotEmpty(storeBusinessInfo.getStartTime()) && StringUtils.isNotEmpty(storeBusinessInfo.getEndTime())) {
|
|
|
|
|
+ LocalTime now = LocalTime.now();
|
|
|
|
|
+ List<String> startList = Arrays.asList(storeBusinessInfo.getStartTime().split(":"));
|
|
|
|
|
+ List<String> endList = Arrays.asList(storeBusinessInfo.getEndTime().split(":"));
|
|
|
|
|
+ LocalTime start = LocalTime.of(Integer.parseInt(startList.get(0)), Integer.parseInt(startList.get(1)));
|
|
|
|
|
+ LocalTime end = LocalTime.of(Integer.parseInt(endList.get(0)), Integer.parseInt(startList.get(1)));
|
|
|
|
|
+ if (now.isAfter(start) && now.isBefore(end)) {
|
|
|
|
|
+ result.setYyFlag(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.setYyFlag(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ LambdaQueryWrapper<StoreDictionary> storeDictionaryLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ storeDictionaryLambdaQueryWrapper.eq(StoreDictionary::getTypeName, "businessStatus")
|
|
|
|
|
+ .eq(StringUtils.isNotEmpty(result.getBusinessStatus().toString()), StoreDictionary::getDictId, result.getBusinessStatus());
|
|
|
|
|
+ List<StoreDictionary> storeDictionaries = storeDictionaryMapper.selectList(storeDictionaryLambdaQueryWrapper);
|
|
|
|
|
+ if (!storeDictionaries.isEmpty()) {
|
|
|
|
|
+ result.setBusinessStatusStr(storeDictionaries.get(0).getDictDetail());
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public StoreInfoVo editNewStoreInfo(StoreInfoDto storeInfoDto) {
|
|
|
|
|
+
|
|
|
|
|
+ //获取经营板块id
|
|
|
|
|
+ Integer businessSection = storeInfoDto.getBusinessSection();
|
|
|
|
|
+ //查询经营板块名称
|
|
|
|
|
+ StoreDictionary businessSectionName = storeDictionaryMapper.selectOne(new LambdaQueryWrapper<StoreDictionary>().eq(StoreDictionary::getDictId, businessSection).eq(StoreDictionary::getTypeName, "business_section"));
|
|
|
|
|
+ //查询经营种类
|
|
|
|
|
+ List<String> businessTypes = storeInfoDto.getBusinessTypes();
|
|
|
|
|
+ List<String> businessTypeNames = new ArrayList<>();
|
|
|
|
|
+ //获取经营种类名称
|
|
|
|
|
+ for (String businessType : businessTypes) {
|
|
|
|
|
+ StoreDictionary storeDictionary = storeDictionaryMapper.selectOne(new LambdaQueryWrapper<StoreDictionary>().eq(StoreDictionary::getDictId, businessType).eq(StoreDictionary::getParentId, businessSectionName.getId()));
|
|
|
|
|
+ businessTypeNames.add(storeDictionary.getDictDetail());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ StoreInfoVo result = new StoreInfoVo();
|
|
|
|
|
+ StoreInfo storeInfo = new StoreInfo();
|
|
|
|
|
+ BeanUtils.copyProperties(storeInfoDto, storeInfo);
|
|
|
|
|
+// List<String> storeTypeList = storeInfoDto.getStoreTypeList();
|
|
|
|
|
+// String storeType = String.join(",", storeTypeList);
|
|
|
|
|
+ //存入营运类型
|
|
|
|
|
+// storeInfo.setStoreType(storeType);
|
|
|
|
|
+
|
|
|
|
|
+ //板块及类型
|
|
|
|
|
+ storeInfo.setBusinessSection(businessSection);
|
|
|
|
|
+ storeInfo.setBusinessSectionName(businessSectionName.getDictDetail());
|
|
|
|
|
+ storeInfo.setBusinessTypes(String.join(",", businessTypes));
|
|
|
|
|
+ storeInfo.setBusinessTypesName(String.join(",", businessTypeNames));
|
|
|
|
|
+
|
|
|
|
|
+ //处理分类信息
|
|
|
|
|
+ List<String> businessClassify = storeInfoDto.getBusinessClassify();
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(businessClassify)) {
|
|
|
|
|
+ List<String> businessClassifyNames = new ArrayList<>();
|
|
|
|
|
+ //批量查询分类名称
|
|
|
|
|
+ List<StoreDictionary> classifyDicts = storeDictionaryMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<StoreDictionary>()
|
|
|
|
|
+ .in(StoreDictionary::getDictId, businessClassify)
|
|
|
|
|
+ .eq(StoreDictionary::getTypeName, "business_classify")
|
|
|
|
|
+ .eq(StoreDictionary::getDeleteFlag, 0)
|
|
|
|
|
+ );
|
|
|
|
|
+ //转为Map方便快速获取
|
|
|
|
|
+ Map<String, StoreDictionary> classifyDictMap = classifyDicts.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ dict -> dict.getDictId().toString(),
|
|
|
|
|
+ Function.identity(),
|
|
|
|
|
+ (existing, replacement) -> existing
|
|
|
|
|
+ ));
|
|
|
|
|
+ //提取分类名称
|
|
|
|
|
+ for (String classifyId : businessClassify) {
|
|
|
|
|
+ StoreDictionary dict = classifyDictMap.get(classifyId);
|
|
|
|
|
+ if (Objects.nonNull(dict)) {
|
|
|
|
|
+ businessClassifyNames.add(dict.getDictDetail());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("无效的分类id:" + classifyId);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ storeInfo.setBusinessClassify(String.join(",", businessClassify));
|
|
|
|
|
+ storeInfo.setBusinessClassifyName(String.join(",", businessClassifyNames));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ storeInfoMapper.updateById(storeInfo);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|