Explorar o código

Merge remote-tracking branch 'origin/master'

SheepHy hai 1 semana
pai
achega
2feffbd409
Modificáronse 12 ficheiros con 581 adicións e 61 borrados
  1. 22 0
      national-motion-base-core/src/main/java/org/jeecg/config/SchedulingConfiguration.java
  2. 2 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/stadium/StadiumController.java
  3. 18 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/StadiumFindById.java
  4. 83 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJob.java
  5. 178 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJobService.java
  6. 188 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/utils/HolidayUtil.java
  7. 5 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppCourses.java
  8. 11 13
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSite.java
  9. 2 2
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSitePriceRules.java
  10. 6 6
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml
  11. 36 38
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSitePlaceServiceImpl.java
  12. 30 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

+ 22 - 0
national-motion-base-core/src/main/java/org/jeecg/config/SchedulingConfiguration.java

@@ -0,0 +1,22 @@
+package org.jeecg.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+/**
+ * @author DM
+ * @date 2025/7/15 11:24
+ * @description
+ */
+@Configuration
+@EnableScheduling
+public class SchedulingConfiguration {
+    @Bean
+    public Executor taskScheduler() {
+        return Executors.newScheduledThreadPool(10);
+    }
+}

+ 2 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/stadium/StadiumController.java

@@ -8,6 +8,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.app.service.IDetailService;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
 import org.jeecg.modules.app.vo.stadium.StadiumConcertsVO;
+import org.jeecg.modules.app.vo.stadium.StadiumFindById;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,7 +35,7 @@ public class StadiumController {
      **/
     @GetMapping("/getPlaceInfo")
     @Operation(summary = "场次详情查询-缺少已定状态和可预约数逻辑 ")
-    public Result<List<StadiumConcertsVO>> findConcerts(){
+    public Result<List<StadiumConcertsVO>> findConcerts(StadiumFindById stadiumFindById){
         String site_id = "1942781931946946561";
         String category_id = "1942391828774895617";
         return iDetailService.findConcerts(site_id,category_id);

+ 18 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/StadiumFindById.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.app.vo.stadium;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="体育馆场次请求")
+public class StadiumFindById {
+    @Schema(description = "场所id")
+    private String siteId;
+    @Schema(description = "运动类型id")
+    private String categoryId;
+
+}

+ 83 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJob.java

@@ -0,0 +1,83 @@
+package org.jeecg.modules.quartz.job;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.system.app.service.IAppSiteService;
+import org.jeecg.modules.system.app.service.IAppTeachingTimeService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * @author wzq
+ * @date 2025/7/14 15:20
+ * @description 是否教学日自动生成-定时任务
+ */
+@AllArgsConstructor
+@Slf4j
+public class OrTeachingJob implements Job {
+
+    private final IAppTeachingTimeService appTeachingTimeService;
+
+    private final IAppSiteService appSiteService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        log.info(" Job Execution key:"+jobExecutionContext.getJobDetail().getKey());
+
+        int year = DateUtils.getYear();
+
+//        // 设置开始日期和结束日期
+//        LocalDate beginDate = LocalDate.of(year + 1, 1, 1);
+//        LocalDate endDate = LocalDate.of(year + 1, 12, 31);
+//
+//        // 获取开始日期和结束日期之间的所有日期
+//        List<LocalDate> dateList = HolidayUtil.getDatesBetween(beginDate, endDate);
+//
+//        //部门、场地、教学日(teaching)、
+//        //1、查询所有的学校
+//        LambdaQueryWrapper<AppSite> wrapper = Wrappers.<AppSite>lambdaQuery().eq(AppSite::getType, 0).eq(AppSite::getStatus, 0);
+//
+//        List<AppSite> appSiteList = appSiteService.list(wrapper);
+//
+//        //教学日列表
+//        List<AppTeachingTime> appteachingList = new ArrayList<>();
+//
+//        //2、遍历查询所有的学校
+//        for (AppSite site : appSiteList) {
+//
+//            // 遍历生成一对多教学时段
+//            for (LocalDate localDate : dateList) {
+//
+//                AppTeachingTime appTeachingTime = new AppTeachingTime();
+//
+//                appTeachingTime
+//                        .setTenantId(site.getTenantId())
+//                        //localDate 转 Date
+//                        .setDay(Date.from(localDate.atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant()))
+//                        .setOrgCode(site.getOrgCode())
+//                ;
+//
+//                //格式‘yyyy-MM-dd’
+//                String yearHoliday = null;
+//                try {
+//                    yearHoliday = HolidayUtil.isWorkingDay(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+//                } catch (ParseException e) {
+//                    throw new RuntimeException(e);
+//                }
+//                if("0".equals(yearHoliday)){
+//                    log.info("是教学日");
+//                    appTeachingTime.setIsTeaching(0);
+//                }else{
+//                    log.info("非教学日");
+//                    appTeachingTime.setIsTeaching(1);
+//                }
+//
+//                appteachingList.add(appTeachingTime);
+//            }
+//                appTeachingTimeService.saveBatch(appteachingList);
+//        }
+//        log.info( String.format("welcome %s! 是否教学日自动生成-定时任务 OrTeachingJob !   时间:" + DateUtils.now()));
+    }
+}

+ 178 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJobService.java

@@ -0,0 +1,178 @@
+package org.jeecg.modules.quartz.job;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.quartz.utils.HolidayUtil;
+import org.jeecg.modules.system.app.entity.AppSite;
+import org.jeecg.modules.system.app.entity.AppSitePlace;
+import org.jeecg.modules.system.app.entity.AppSitePriceRules;
+import org.jeecg.modules.system.app.entity.AppTeachingTime;
+import org.jeecg.modules.system.app.service.IAppSitePlaceService;
+import org.jeecg.modules.system.app.service.IAppSitePriceRulesService;
+import org.jeecg.modules.system.app.service.IAppSiteService;
+import org.jeecg.modules.system.app.service.IAppTeachingTimeService;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author DM
+ * @date 2025/7/15 10:28
+ * @description
+ */
+@Slf4j
+@AllArgsConstructor
+@Component
+public class OrTeachingJobService {
+
+    private final IAppSitePriceRulesService appSitePriceRulesService;
+
+    private final IAppTeachingTimeService appTeachingTimeService;
+
+    private final IAppSitePlaceService appSitePlaceService;
+
+    private final IAppSiteService appSiteService;
+
+    //表示每天8时30分0秒执行
+    @Scheduled(cron = "0 00 14 ? * *")
+    @Transactional(rollbackFor = Exception.class)
+    public void execute() throws ParseException {
+
+        log.info("开始执行定时任务");
+
+//        int year = DateUtils.getYear();
+        int year = 2024;
+
+        Map<String, List<String>> HolidayMap = HolidayUtil.getYearHoliday(String.valueOf(year));
+
+        // 设置开始日期和结束日期
+        Date beginDate = DateUtils.str2Date((year + 1) + "-01-01 00:00:00", new SimpleDateFormat("yyyy-MM-dd"));
+        Date endDate = DateUtils.str2Date((year + 1) + "-12-31 00:00:00", new SimpleDateFormat("yyyy-MM-dd"));
+
+        // 获取开始日期和结束日期之间的所有日期
+        List<Date> dateList = HolidayUtil.getDaysBetweenDates(beginDate, endDate);
+        log.info("所有日期:{}",dateList);
+
+        //部门、场地、教学日(teaching)、
+        //1、查询所有的学校
+        LambdaQueryWrapper<AppSite> wrapper = Wrappers.<AppSite>lambdaQuery().eq(AppSite::getType, 0).eq(AppSite::getStatus, 0);
+
+        List<AppSite> appSiteList = appSiteService.list(wrapper);
+
+        log.info("学校数量:{}",appSiteList.size());
+
+        List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
+
+        if(!appSiteList.isEmpty()){
+            //教学日列表
+            List<AppTeachingTime> appteachingList = new ArrayList<>();
+
+            //2、遍历查询所有的学校
+            for (AppSite site : appSiteList) {
+
+                //根据学校查询场地
+                AppSitePlace appSitePlace = appSitePlaceService.getOne(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getTenantId, site.getTenantId()));
+
+                // 遍历生成一对多教学时段
+                for (Date localDate : dateList) {
+
+                    AppTeachingTime appTeachingTime = new AppTeachingTime();
+
+                    appTeachingTime
+                            .setTenantId(site.getTenantId())
+                            //localDate 转 Date
+                            .setDay(localDate)
+                            .setOrgCode(site.getOrgCode())
+                    ;
+
+                    //格式‘yyyy-MM-dd’
+                    String yearHoliday = null;
+                    try {
+                        List<String> holiday = HolidayMap.get("holiday");
+                        List<String> extraWorkDay = HolidayMap.get("extraWorkDay");
+                        yearHoliday = HolidayUtil.isWorkingDay(DateUtils.formatDate(localDate, "yyyy-MM-dd"),holiday,extraWorkDay);
+                    } catch (ParseException e) {
+                        throw new RuntimeException(e);
+                    }
+                    if("0".equals(yearHoliday)){
+                        log.info("是教学日");
+                        appTeachingTime.setIsTeaching(0);
+                    }else{
+                        log.info("非教学日");
+                        appTeachingTime.setIsTeaching(1);
+                    }
+
+                    //添加到集合中
+                    appteachingList.add(appTeachingTime);
+
+                    //如果开放时段列表不为空(教学日/非教学日),根据开放时段批量存储,开放时段记录
+                    if (ObjectUtils.isNotEmpty(site.getTeachingDay())){
+
+                        //解析Json 数据
+                        site.getTeachingDay().forEach(item -> {
+
+                            String startTime = String.valueOf(item.get("startTime"));
+                            String endTime = String.valueOf(item.get("endTime"));
+
+                            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                            appSitePriceRules
+                                    .setOrgCode(site.getOrgCode())
+                                    .setTenantId(site.getTenantId())
+                                    .setSitePlaceId(appSitePlace.getId())
+                                    .setType(0)
+                                    .setDateOfSale(localDate)
+                                    .setStartTime(DateUtils.str2Date(startTime, new SimpleDateFormat("HH:mm:ss")))
+                                    .setEndTime(DateUtils.str2Date(endTime, new SimpleDateFormat("HH:mm:ss")))
+                                    .setDayOfWeek(HolidayUtil.getWeekOfDate(localDate))
+                                    .setIsTeaching(appTeachingTime.getIsTeaching())
+                            ;
+
+                            appSitePriceRulesList.add(appSitePriceRules);
+                        });
+
+                    }
+                    if (ObjectUtils.isNotEmpty(site.getNoTeachingDay())){
+
+                        site.getTeachingDay().forEach(item -> {
+
+                            String startTime = String.valueOf(item.get("startTime"));
+                            String endTime = String.valueOf(item.get("endTime"));
+
+                            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                            appSitePriceRules
+                                    .setOrgCode(site.getOrgCode())
+                                    .setTenantId(site.getTenantId())
+                                    .setSitePlaceId(appSitePlace.getId())
+                                    .setType(0)
+                                    .setDateOfSale(localDate)
+                                    .setStartTime(DateUtils.str2Date(startTime, new SimpleDateFormat("HH:mm:ss")))
+                                    .setEndTime(DateUtils.str2Date(endTime, new SimpleDateFormat("HH:mm:ss")))
+                                    .setDayOfWeek(HolidayUtil.getWeekOfDate(localDate))
+                                    .setIsTeaching(appTeachingTime.getIsTeaching())
+                            ;
+                            appSitePriceRulesList.add(appSitePriceRules);
+                        });
+                    }
+                }
+
+                //存放集合
+                appTeachingTimeService.saveBatch(appteachingList);
+
+                //存放开放时段列表
+                appSitePriceRulesService.saveBatch(appSitePriceRulesList);
+            }
+        }
+
+    }
+}

+ 188 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/utils/HolidayUtil.java

@@ -0,0 +1,188 @@
+package org.jeecg.modules.quartz.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @author wzq
+ * @date 2025/7/14 15:29
+ * @description 判断今天是工作日/周末/节假日 工具类
+ * 0上班 1周末 2节假日
+ */
+public class HolidayUtil {
+
+    //判断是否为节假日
+    /**
+     * @param time 日期参数 格式‘yyyy-MM-dd’,不传参则默认当前日期
+     * @return
+     */
+    public static String isWorkingDay(String time,List<String> holiday,List<String> extraWorkDay) throws ParseException {
+        Date parse = null;
+        //为空则返回当前时间
+        if (StringUtils.isNotBlank(time)) {
+            SimpleDateFormat getYearFormat = new SimpleDateFormat("yyyy-MM-dd");
+            parse = getYearFormat.parse(time);
+        } else {
+            parse = new Date();
+        }
+        String newDate = new SimpleDateFormat("yyyy").format(parse);
+
+        //判断key是否有参数年份
+//        if (!holiday.containsKey(newDate)) {
+//            String holiday = getYearHoliday(newDate);
+//            if ("No!".equals(holiday)) {
+//                return "该年份未分配日期安排!";
+//            }
+//        }
+
+        //得到日期是星期几
+        String format = "yyyy-MM-dd";
+        DateFormat df = new SimpleDateFormat(format);
+        Date baseTime;
+        try {
+            baseTime = df.parse(time);
+        } catch (Exception e) {
+            return null;
+        }
+
+        //获取日期的中国式星期几(1-7分别代表周一至周日)
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(baseTime);
+        int weekday = getDayOfWeek(calendar);
+
+        //是否节假日
+        if (holiday.contains(time)) {
+            return "2";
+        } else if (extraWorkDay.contains(time)) {//是否为调休
+            return "0";
+        } else if (weekday == Calendar.SATURDAY || weekday == Calendar.FRIDAY) {//是否为周末
+            return "1";
+        } else {
+            return "0";
+        }
+    }
+
+    /**
+     * @param date 日期参数 格式‘yyyy’,不传参则默认当前日期
+     * @return
+     */
+    public static Map<String,List<String>> getYearHoliday(String date) throws ParseException {
+
+        HashMap<String , List<String>> map = new HashMap<>();
+
+        //获取免费api地址
+        String httpUrl = "https://timor.tech/api/holiday/year/" + date;
+        BufferedReader reader = null;
+        String result = null;
+        StringBuffer sbf = new StringBuffer();
+
+        try {
+            URL url = new URL(httpUrl);
+            URLConnection connection = url.openConnection();
+            //connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            connection.setRequestProperty("User-Agent", "Mozilla/4.76");
+            //使用Get方式请求数据
+            //connection.setRequestMethod("GET");
+            //connection.connect();
+            InputStream is = connection.getInputStream();
+            reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+            String strRead = null;
+            while ((strRead = reader.readLine()) != null) {
+                sbf.append(strRead);
+                sbf.append("\r\n");
+            }
+            reader.close();
+
+            //字符串转json
+            JSONObject json = JSON.parseObject(sbf.toString());
+            //根据holiday字段获取jsonObject内容
+            JSONObject holiday = json.getJSONObject("holiday");
+            if (holiday.size() == 0) {
+                return null;
+            }
+            List hoList = new ArrayList<>();
+            List extraList = new ArrayList<>();
+            for (Map.Entry<String, Object> entry : holiday.entrySet()) {
+                String value = entry.getValue().toString();
+                JSONObject jsonObject = JSONObject.parseObject(value);
+                String hoBool = jsonObject.getString("holiday");
+                String extra = jsonObject.getString("date");
+                //判断不是假期后调休的班
+                if (hoBool.equals("true")) {
+                    hoList.add(extra);
+                } else {
+                    extraList.add(extra);
+                }
+            }
+            map.put("holiday", hoList);
+            map.put("extraWorkDay", extraList);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return map;
+    }
+
+    /**
+     * 获得本日星期数,星期一:1,星期日:7 如果传入null则默认为本日
+     *
+     * @return
+     */
+    public static int getDayOfWeek(Calendar calendar) {
+        int today;
+        if (calendar != null) {
+            today = calendar.get(Calendar.DAY_OF_WEEK);
+        } else {
+            today = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
+        }
+        if (today == 1)
+            return 7;
+        else
+            return today - 1;
+    }
+
+    public static List<Date> getDaysBetweenDates(Date startDate, Date endDate) {
+        List<Date> dates = new ArrayList<Date>();
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(startDate);
+
+        while (calendar.getTime().before(endDate)) {
+            Date result = calendar.getTime();
+            dates.add(result);
+            calendar.add(Calendar.DATE, 1);
+        }
+        return dates;
+    }
+
+    /**
+     * 获取当前日期是星期几<br>
+     *
+     * @param dt
+     * @return 当前日期是星期几
+     */
+    public static String getWeekOfDate(Date dt) {
+        String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(dt);
+
+        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
+        if (w < 0)
+            w = 0;
+
+        return weekDays[w];
+    }
+
+
+}

+ 5 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppCourses.java

@@ -60,9 +60,13 @@ public class AppCourses implements Serializable {
     @Schema(description = "费用类型;0 精品 1免费 仅课程")
     private java.lang.Integer priceType;
     /**上课场地*/
+    @Excel(name = "门店信息ID", width = 15)
+    @Schema(description = "门店信息ID")
+    private java.lang.String siteId;
+    /**上课场地*/
     @Excel(name = "上课场地", width = 15)
     @Schema(description = "上课场地")
-    private java.lang.String siteId;
+    private java.lang.String addressSiteId;
     /**保险id;可能有多个险种*/
     @Excel(name = "保险id;可能有多个险种", width = 15)
     @Schema(description = "保险id;可能有多个险种")

+ 11 - 13
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSite.java

@@ -1,23 +1,21 @@
 package org.jeecg.modules.system.app.entity;
 
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.util.Date;
-import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableLogic;
-import org.jeecg.common.constant.ProvinceCityArea;
-import org.jeecg.common.util.SpringContextUtils;
-import lombok.Data;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.jeecg.common.aspect.annotation.Dict;
+import com.fasterxml.jackson.databind.JsonNode;
 import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @Description: 门店信息拓展表
@@ -161,9 +159,9 @@ public class AppSite implements Serializable {
     /**非教学日*/
     @Excel(name = "非教学日", width = 15)
     @Schema(description = "非教学日")
-    private String noTeachingDay;
+    private JsonNode noTeachingDay;
     /**教学日*/
     @Excel(name = "教学日", width = 15)
     @Schema(description = "教学日")
-    private String teachingDay;
+    private JsonNode teachingDay;
 }

+ 2 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSitePriceRules.java

@@ -99,8 +99,8 @@ public class AppSitePriceRules implements Serializable {
     @Schema(description = "销售日期")
     private Date createTime;
     /**创建时间;创建时间*/
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
     @Schema(description = "创建时间;创建时间")
     private Date dateOfSale;
     /**更新人;更新人*/

+ 6 - 6
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -87,13 +87,13 @@
              ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
-        LEFT JOIN nm_site e on e.id = b.site_id
+        LEFT JOIN nm_site e on e.id = b.address_site_id
         where 1=1
         <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
             and  b.user_id=#{courseRequestVo.instructorId}
         </if>
         <if test="courseRequestVo.siteId != null and courseRequestVo.siteId !=''">
-            and  b.site_id=#{courseRequestVo.siteId}
+            and  b.address_site_id=#{courseRequestVo.siteId}
         </if>
         <if test="courseRequestVo.priceType != null">
             and  b.price_type=#{courseRequestVo.priceType}
@@ -109,13 +109,13 @@
                    ) /1000 AS km
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
-        LEFT JOIN nm_site e on e.id = b.site_id
+        LEFT JOIN nm_site e on e.id = b.address_site_id
         where 1=1
         <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
             and  b.user_id=#{courseRequestVo.instructorId}
         </if>
         <if test="courseRequestVo.siteId != null and courseRequestVo.siteId !=''">
-            and  b.site_id=#{courseRequestVo.siteId}
+            and  b.address_site_id=#{courseRequestVo.siteId}
         </if>
         <if test="courseRequestVo.priceType != null">
             and  b.price_type=#{courseRequestVo.priceType}
@@ -139,13 +139,13 @@
         ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
-        LEFT JOIN nm_site e on e.id = b.site_id
+        LEFT JOIN nm_site e on e.id = b.address_site_id
         where 1=1
         <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
             and  b.user_id=#{courseRequestVo.instructorId}
         </if>
         <if test="courseRequestVo.siteId != null and courseRequestVo.siteId !=''">
-            and  b.site_id=#{courseRequestVo.siteId}
+            and  b.address_site_id=#{courseRequestVo.siteId}
         </if>
         <if test="courseRequestVo.priceType != null">
             and  b.price_type=#{courseRequestVo.priceType}

+ 36 - 38
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSitePlaceServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
@@ -19,11 +20,8 @@ import org.jeecg.modules.system.app.mapper.AppSiteMapper;
 import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper;
 import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper;
 import org.jeecg.modules.system.app.service.IAppSitePlaceService;
-import org.jeecg.modules.system.app.utils.TimeRangeFinder;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
@@ -63,41 +61,41 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
         appSitePlace.setTenantId(site.getTenantId());
         appSitePlace.setSiteId(site.getId());
         appSitePlace.setType(SitePlaceTypeEnum.SCHOOL.getCode());
-        //时间段提取拼接
-        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
-
-        List<String> teachingDay = new ArrayList<>();
-        List<String> noTeachingDay = new ArrayList<>();
-        if (!siteRuleDTOS.isEmpty()) {
-            siteRuleDTOS.forEach(dto -> {
-                if (dto.getIsTeaching() == 0) {
-                    teachingDay.add(dto.getStartTime() + "-" + dto.getEndTime());
-                } else {
-                    noTeachingDay.add(dto.getStartTime() + "-" + dto.getEndTime());
-                }
-            });
-        }
-        site.setTeachingDay(String.join(",", teachingDay));
-        site.setNoTeachingDay(String.join(",", noTeachingDay));
-        int updateById = appSiteMapper.updateById(site);
-        if (updateById < 1) {
-            throw new JeecgBootException("学校补充信息更新失败");
-        }
-        int insert = baseMapper.insert(appSitePlace);
-        if (insert < 1) {
-            throw new JeecgBootException("学校场所信息保存失败");
-        }
-        siteRuleDTOS.forEach(rule -> {
-            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
-            BeanUtils.copyProperties(rule, appSitePriceRules);
-            appSitePriceRules.setSitePlaceId(appSitePlace.getId());
-            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
-            appSitePriceRules.setTenantId(appSitePlace.getTenantId());
-            int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
-            if (savePriceResult < 1) {
-                throw new JeecgBootException("场所价格规则保存失败", SC_INTERNAL_SERVER_ERROR_500);
-            }
-        });
+//        //时间段提取拼接
+//        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
+//
+//        List<String> teachingDay = new ArrayList<>();
+//        List<String> noTeachingDay = new ArrayList<>();
+//        if (!siteRuleDTOS.isEmpty()) {
+//            siteRuleDTOS.forEach(dto -> {
+//                if (dto.getIsTeaching() == 0) {
+//                    teachingDay.add(dto.getStartTime() + "-" + dto.getEndTime());
+//                } else {
+//                    noTeachingDay.add(dto.getStartTime() + "-" + dto.getEndTime());
+//                }
+//            });
+//        }
+//        site.setTeachingDay(String.join(",", teachingDay));
+//        site.setNoTeachingDay(String.join(",", noTeachingDay));
+//        int updateById = appSiteMapper.updateById(site);
+//        if (updateById < 1) {
+//            throw new JeecgBootException("学校补充信息更新失败");
+//        }
+//        int insert = baseMapper.insert(appSitePlace);
+//        if (insert < 1) {
+//            throw new JeecgBootException("学校场所信息保存失败");
+//        }
+//        siteRuleDTOS.forEach(rule -> {
+//            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+//            BeanUtils.copyProperties(rule, appSitePriceRules);
+//            appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+//            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+//            appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+//            int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
+//            if (savePriceResult < 1) {
+//                throw new JeecgBootException("场所价格规则保存失败", SC_INTERNAL_SERVER_ERROR_500);
+//            }
+//        });
 
         return Boolean.TRUE;
     }

+ 30 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

@@ -25,6 +25,10 @@ import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
 import org.jeecg.modules.system.app.dto.merchant.AddMerchantRequestDTO;
 import org.jeecg.modules.system.app.dto.merchant.FindByMerchantIdResponseDTO;
 import org.jeecg.modules.system.app.dto.merchant.FindMerchantResponseDTO;
+import org.jeecg.modules.system.app.entity.AppSite;
+import org.jeecg.modules.system.app.entity.AppSitePlace;
+import org.jeecg.modules.system.app.mapper.AppSiteMapper;
+import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper;
 import org.jeecg.modules.system.entity.*;
 import org.jeecg.modules.system.mapper.*;
 import org.jeecg.modules.system.model.DepartIdModel;
@@ -67,6 +71,10 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
 	private SysUserMapper sysUserMapper;
 	@Autowired
 	private SysDepartMapper departMapper;
+	@Autowired
+	private AppSiteMapper appSiteMapper;
+	@Autowired
+	private AppSitePlaceMapper appSitePlaceMapper;
 
 	@Override
 	public List<SysDepartTreeModel> queryMyDeptTreeList(String departIds) {
@@ -215,6 +223,28 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
 				}
 			}
 			this.save(sysDepart);
+
+			//若为学校或体育馆
+			if (Objects.equals(sysDepart.getOrgCategory(), "2") || Objects.equals(sysDepart.getOrgCategory(), "3")){
+				//创建学校或体育馆的扩展信息内容
+				AppSite site = new AppSite();
+				site
+						.setTenantId(sysDepart.getId())
+						.setOrgCode(sysDepart.getOrgCode())
+						.setName(sysDepart.getDepartName())
+						.setType(sysDepart.getOrgCategory().equals("2")?0:1);
+				appSiteMapper.insert(site);
+				//创建学校或体育馆的场地表
+				AppSitePlace place = new AppSitePlace();
+				place
+						.setTenantId(sysDepart.getId())
+						.setOrgCode(sysDepart.getOrgCode())
+						.setSiteId(site.getId())
+						.setName(sysDepart.getDepartName())
+						.setType(sysDepart.getOrgCategory().equals("2")?0:sysDepart.getOrgCategory().equals("3")?1:2);
+				appSitePlaceMapper.insert(place);
+			}
+
             //update-begin---author:wangshuai ---date:20220307  for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理
 			//新增部门的时候新增负责部门
             if(oConvertUtils.isNotEmpty(sysDepart.getDirectorUserIds())){