qmj 2 недель назад
Родитель
Сommit
f631ea44f5

+ 7 - 47
ruoyi-admin/src/main/java/com/ruoyi/app/mendian/PosStoreController.java

@@ -32,6 +32,7 @@ import com.ruoyi.system.service.*;
 import com.ruoyi.system.utils.Auth;
 import com.ruoyi.system.utils.JwtUtil;
 import io.swagger.models.auth.In;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
@@ -190,53 +191,12 @@ public class PosStoreController extends BaseController {
             list = posCollectService.list(queryWrapper);
         }
         PosStore posStore = posStoreService.getById(id);
-        JSONObject org = new JSONObject();
-        org.put("id", posStore.getId());
-        org.put("posName", posStore.getPosName());
-        org.put("image", posStore.getImage());
-        org.put("posPrice", posStore.getPosPrice());
-        org.put("area", posStore.getArea());
-        org.put("address", posStore.getAddress());
-        org.put("longitude", posStore.getLongitude());
-        org.put("latitude", posStore.getLatitude());
-        org.put("briefIntroduction", posStore.getBriefIntroduction());
-        org.put("type", posStore.getType());
-        org.put("hygienePermit", posStore.getHygienePermit());
-        org.put("hygieneLicence", posStore.getHygieneLicence());
-        org.put("openBusiness", posStore.getOpenBusiness());
-        org.put("windingUp", posStore.getWindingUp());
-        org.put("sort", posStore.getSort());
-        org.put("userId", posStore.getUserId());
-        org.put("juli", posStore.getJuli());
-        org.put("cretim", posStore.getCretim());
-        org.put("zhitsj", posStore.getJuli());
-        org.put("tgpaixv", posStore.getCretim());
-        org.put("state", posStore.getState());
-        org.put("serverType", posStore.getServerType());
-        org.put("telephone", posStore.getTelephone());
-        org.put("Collect", !list.isEmpty() ? 1 : 0);
-        org.put("logo", posStore.getLogo());
-        org.put("isNightMarket", posStore.getIsNightMarket());
-        org.put("nightMarketId", posStore.getNightMarketId());
-
-        QueryWrapper<OperatingHours> wrapper = new QueryWrapper<>();
-        wrapper.eq("md_id", posStore.getId());
-        List<OperatingHours> hourslist = operatingHoursService.list(wrapper);
-        DateUtil dateUtil = new DateUtil();
-        Boolean dayang = false;
-        //在营业时间范围内返回true
-        for (int i = 0; i < hourslist.size(); i++) {
-            Boolean sbsj = dateUtil.isLegalTime(hourslist.get(i).getStartTime(), hourslist.get(i).getEndTime());
-            if (sbsj == true) {
-                dayang = true;
-            }
-        }
-        //不在时间范围内标识为打烊
-        if (dayang == false) {
-            org.put("state", 1);
-        }
-        org.put("businessHours", hourslist);
-        return success(org);
+        List<PosStore> stores=new ArrayList<>();
+        stores.add(posStore);
+        posStoreEnrichService.enrichStoreList(stores);
+        StoreOutput storeOutput = new StoreOutput();
+        BeanUtils.copyProperties(stores.getFirst(), storeOutput);
+        return success(storeOutput);
 
     }