Browse Source

Merge remote-tracking branch 'origin/dev' into dev

大数据与最优化研究所 2 days ago
parent
commit
20dbf1bfd4

+ 2 - 1
src/main/java/com/xjrsoft/module/classtime/controller/ClassTimeStatisticsController.java

@@ -76,6 +76,7 @@ public class ClassTimeStatisticsController {
                 .orderByDesc(ClassTimeStatistics::getId)
                 .eq(dto.getYear() != null, ClassTimeStatistics::getYear, dto.getYear())
                 .eq(dto.getMonth() != null, ClassTimeStatistics::getMonth, dto.getMonth())
+                .eq(ClassTimeStatistics::getCategory, 1)
                 .select(ClassTimeStatistics.class,x -> VoToColumnUtil.fieldsToColumns(ClassTimeStatisticsPageVo.class).contains(x.getProperty()));
         IPage<ClassTimeStatistics> page = classTimeStatisticsService.page(ConventPage.getPage(dto), queryWrapper);
         PageOutput<ClassTimeStatisticsPageVo> pageOutput = ConventPage.getPageOutput(page, ClassTimeStatisticsPageVo.class);
@@ -152,7 +153,7 @@ public class ClassTimeStatisticsController {
     @SaCheckPermission("classtimestatisticsset:detail")
     public RT<LocalDate> lastInfo(){
         List<ClassTimeStatistics> list = classTimeStatisticsService.list(
-                new QueryWrapper<ClassTimeStatistics>().lambda().orderByDesc(ClassTimeStatistics::getEndDate)
+                new QueryWrapper<ClassTimeStatistics>().lambda().eq(ClassTimeStatistics::getCategory, 1).orderByDesc(ClassTimeStatistics::getEndDate)
         );
         if (list.isEmpty()) {
             return RT.ok();

+ 178 - 0
src/main/java/com/xjrsoft/module/classtime/controller/CourseClassTimeStatisticsController.java

@@ -0,0 +1,178 @@
+package com.xjrsoft.module.classtime.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.xjrsoft.common.exception.MyException;
+import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.activity.dto.ChangeStatusDto;
+import com.xjrsoft.module.classtime.dto.AddClassTimeStatisticsDto;
+import com.xjrsoft.module.classtime.dto.ClassTimeStatisticsPageDto;
+import com.xjrsoft.module.classtime.dto.RefreshStatisticsDto;
+import com.xjrsoft.module.classtime.dto.UpdateClassTimeStatisticsDto;
+import com.xjrsoft.module.classtime.entity.ClassTimeStatistics;
+import com.xjrsoft.module.classtime.entity.ClassTimeStatisticsSet;
+import com.xjrsoft.module.classtime.service.IClassTimeStatisticsService;
+import com.xjrsoft.module.classtime.service.IClassTimeStatisticsSetService;
+import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsPageVo;
+import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsRecordVo;
+import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsVo;
+import com.xjrsoft.module.classtime.vo.CourseClassTimeStatisticsRecordVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+
+/**
+* @title: 课时统计
+* @Author dzx
+* @Date: 2024年11月19日
+* @Version 1.0
+*/
+@RestController
+@RequestMapping("/courseClasstime" + "/classTimeStatistics")
+@Api(value = "/courseClasstime"  + "/classTimeStatistics",tags = "课表课时统计代码")
+@AllArgsConstructor
+public class CourseClassTimeStatisticsController {
+
+    private final IClassTimeStatisticsSetService statisticsSetService;
+    private final IClassTimeStatisticsService classTimeStatisticsService;
+
+    @GetMapping(value = "/page")
+    @ApiOperation(value="课时统计列表(分页)")
+    @SaCheckPermission("classtimestatistics:detail")
+    public RT<PageOutput<ClassTimeStatisticsPageVo>> page(@Valid ClassTimeStatisticsPageDto dto){
+
+        LambdaQueryWrapper<ClassTimeStatistics> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper
+                .orderByDesc(ClassTimeStatistics::getId)
+                .eq(dto.getYear() != null, ClassTimeStatistics::getYear, dto.getYear())
+                .eq(dto.getMonth() != null, ClassTimeStatistics::getMonth, dto.getMonth())
+                .eq(ClassTimeStatistics::getCategory, 2)
+                .select(ClassTimeStatistics.class,x -> VoToColumnUtil.fieldsToColumns(ClassTimeStatisticsPageVo.class).contains(x.getProperty()));
+        IPage<ClassTimeStatistics> page = classTimeStatisticsService.page(ConventPage.getPage(dto), queryWrapper);
+        PageOutput<ClassTimeStatisticsPageVo> pageOutput = ConventPage.getPageOutput(page, ClassTimeStatisticsPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/info")
+    @ApiOperation(value="根据id查询课时统计信息")
+    @SaCheckPermission("classtimestatistics:detail")
+    public RT<ClassTimeStatisticsVo> info(@RequestParam Long id){
+        ClassTimeStatistics classTimeStatistics = classTimeStatisticsService.getByIdDeep(id);
+        if (classTimeStatistics == null) {
+           return RT.error("找不到此数据!");
+        }
+        return RT.ok(BeanUtil.toBean(classTimeStatistics, ClassTimeStatisticsVo.class));
+    }
+
+    @PostMapping
+    @ApiOperation(value = "新增课时统计")
+    @SaCheckPermission("classtimestatistics:add")
+    public RT<Boolean> add(@Valid @RequestBody AddClassTimeStatisticsDto dto){
+        boolean isSuccess = classTimeStatisticsService.addCourse(dto);
+        return RT.ok(isSuccess);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改课时统计")
+    @SaCheckPermission("classtimestatistics:edit")
+    public RT<Boolean> update(@Valid @RequestBody UpdateClassTimeStatisticsDto dto){
+        ClassTimeStatistics classTimeStatistics = BeanUtil.toBean(dto, ClassTimeStatistics.class);
+        return RT.ok(classTimeStatisticsService.update(classTimeStatistics));
+    }
+
+    @DeleteMapping
+    @ApiOperation(value = "删除课时统计")
+    @SaCheckPermission("classtimestatistics:delete")
+    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        return RT.ok(classTimeStatisticsService.delete(ids));
+
+    }
+
+    @PostMapping(value = "/change-status")
+    @ApiOperation(value="修改状态")
+    @SaCheckPermission("classtimestatistics:detail")
+    public RT<Boolean> changeStatus(@Valid @RequestBody ChangeStatusDto dto) throws Exception {
+        ClassTimeStatistics statistics = classTimeStatisticsService.getById(dto.getId());
+        if(statistics == null){
+            throw new MyException("未能查到数据");
+        }
+        statistics.setStatus(dto.getStatus());
+        classTimeStatisticsService.updateById(statistics);
+        if(dto.getStatus() != null && dto.getStatus() == 3){
+            classTimeStatisticsService.lockData(dto.getId());
+        }
+        return RT.ok(true);
+    }
+
+    @GetMapping(value = "/last-date")
+    @ApiOperation(value="查询最新统计的结束日期")
+    @SaCheckPermission("classtimestatisticsset:detail")
+    public RT<LocalDate> lastInfo(){
+        List<ClassTimeStatistics> list = classTimeStatisticsService.list(
+                new QueryWrapper<ClassTimeStatistics>().lambda().eq(ClassTimeStatistics::getCategory, 2).orderByDesc(ClassTimeStatistics::getEndDate)
+        );
+        if (list.isEmpty()) {
+            return RT.ok();
+        }
+        ClassTimeStatistics result = list.get(0);
+        return RT.ok(result.getEndDate());
+    }
+
+    @PostMapping("/refresh-statistics")
+    @ApiOperation(value = "刷新课表课时统计")
+    @SaCheckPermission("classtimestatistics:detail")
+    public RT<Boolean> refreshStatistics(@Valid @RequestBody RefreshStatisticsDto dto){
+
+        ClassTimeStatistics classTimeStatistics = classTimeStatisticsService.getById(dto.getId());
+        classTimeStatistics.setStatus(0);
+        classTimeStatistics.setModifyDate(new Date());
+
+        //查询最新权重并保存到统计中
+        Integer category = 3;
+        List<ClassTimeStatisticsSet> list = statisticsSetService.list(
+                new QueryWrapper<ClassTimeStatisticsSet>().lambda()
+                        .eq(ClassTimeStatisticsSet::getCategory, category)
+                        .orderByDesc(ClassTimeStatisticsSet::getCreateDate)
+        );
+        if(list.isEmpty()){
+            throw new MyException("请先设置权重并进行保存");
+        }
+        classTimeStatistics.setWeightSetJson(list.get(0).getJsonContent());
+
+        classTimeStatistics.setCostSetJson(list.get(0).getJsonContent());
+        Boolean aBoolean = classTimeStatisticsService.updateById(classTimeStatistics);
+
+        classTimeStatisticsService.refreshCourseRecord(classTimeStatistics);
+
+        return RT.ok(aBoolean);
+    }
+
+
+    @GetMapping(value = "/record-list")
+    @ApiOperation(value="课程课时统计详情列表")
+    @SaCheckPermission("classtimestatistics:detail")
+    public RT<List<CourseClassTimeStatisticsRecordVo>> recordPage(@Valid RefreshStatisticsDto dto){
+        List<CourseClassTimeStatisticsRecordVo> recordList = classTimeStatisticsService.getCourseRecordList(dto.getId());
+        return RT.ok(recordList);
+    }
+
+}

+ 1 - 1
src/main/java/com/xjrsoft/module/classtime/dto/AddClassTimeStatisticsSetDto.java

@@ -26,7 +26,7 @@ public class AddClassTimeStatisticsSetDto implements Serializable {
     /**
     * 类别(1:权重 2:费用设置)
     */
-    @ApiModelProperty("类别(1:权重 2:费用设置)")
+    @ApiModelProperty("类别(1:权重 2:费用设置 3:课时量权重)")
     private Integer category;
 
 }

+ 2 - 1
src/main/java/com/xjrsoft/module/classtime/entity/ClassTimeStatistics.java

@@ -127,5 +127,6 @@ public class ClassTimeStatistics implements Serializable {
     @ApiModelProperty("权重json")
     private String costSetJson;
 
-
+    @ApiModelProperty("课时统计类型(1:全课时 2:课表课时)")
+    private Integer category;
 }

+ 7 - 7
src/main/java/com/xjrsoft/module/classtime/entity/ClassTimeStatisticsRecord.java

@@ -112,32 +112,32 @@ public class ClassTimeStatisticsRecord implements Serializable {
     /**
     * 教研会
     */
-    @ApiModelProperty("教研会")
-    private Double classTime1;
+    @ApiModelProperty("总周次")
+    private Integer classTime1;
     /**
     * 督导听课
     */
-    @ApiModelProperty("督导听课")
+    @ApiModelProperty("周平均课时")
     private Double classTime2;
     /**
     * 临近三年退休政策
     */
-    @ApiModelProperty("临近三年退休政策")
+    @ApiModelProperty("行政工作量")
     private Double classTime3;
     /**
     * 出题
     */
-    @ApiModelProperty("出题")
+    @ApiModelProperty("总平均课时")
     private Double classTime4;
     /**
     * 阅卷
     */
-    @ApiModelProperty("阅卷")
+    @ApiModelProperty("工作量得分")
     private Double classTime5;
     /**
     * 周末培优
     */
-    @ApiModelProperty("周末培优")
+    @ApiModelProperty("超工作量得分")
     private Double classTime6;
     /**
     * 早自习

+ 1 - 1
src/main/java/com/xjrsoft/module/classtime/entity/ClassTimeStatisticsSet.java

@@ -77,7 +77,7 @@ public class ClassTimeStatisticsSet implements Serializable {
     /**
     * 类别(1:权重 2:费用设置)
     */
-    @ApiModelProperty("类别(1:权重 2:费用设置)")
+    @ApiModelProperty("类别(1:权重 2:费用设置 3:课时量权重)")
     private Integer category;
 
 

+ 3 - 0
src/main/java/com/xjrsoft/module/classtime/mapper/ClassTimeStatisticsMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.classtime.entity.ClassTimeStatistics;
 import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsRecordVo;
+import com.xjrsoft.module.classtime.vo.CourseClassTimeStatisticsRecordVo;
 import com.xjrsoft.module.classtime.vo.CourseListVo;
 import com.xjrsoft.module.classtime.vo.TeacherListVo;
 import com.xjrsoft.module.oa.entity.WfTeacherCourseTime;
@@ -50,4 +51,6 @@ public interface ClassTimeStatisticsMapper extends MPJBaseMapper<ClassTimeStatis
      * @return
      */
     List<CourseListVo> getHolidayReplaceCourseList(@Param("dto") ClassTimeStatistics dto);
+
+    List<CourseClassTimeStatisticsRecordVo> getCourseRecordList(@Param("id") Long id);
 }

+ 12 - 0
src/main/java/com/xjrsoft/module/classtime/service/IClassTimeStatisticsService.java

@@ -4,6 +4,7 @@ import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.classtime.dto.AddClassTimeStatisticsDto;
 import com.xjrsoft.module.classtime.entity.ClassTimeStatistics;
 import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsRecordVo;
+import com.xjrsoft.module.classtime.vo.CourseClassTimeStatisticsRecordVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.io.IOException;
@@ -25,6 +26,12 @@ public interface IClassTimeStatisticsService extends MPJBaseService<ClassTimeSta
     */
     Boolean add(ClassTimeStatistics classTimeStatistics);
 
+
+    /**
+     * 新增,只统计课表课时
+     */
+    Boolean addCourse(AddClassTimeStatisticsDto dto);
+
     /**
     * 更新
     *
@@ -59,10 +66,15 @@ public interface IClassTimeStatisticsService extends MPJBaseService<ClassTimeSta
 
     List<ClassTimeStatisticsRecordVo> getRecordList(@Param("id") Long id);
 
+    List<CourseClassTimeStatisticsRecordVo> getCourseRecordList(@Param("id") Long id);
+
     /**
      * 导出明细
      * @param id
      * @return
      */
     byte[] recordExport(Long id) throws IOException;
+
+
+    Boolean refreshCourseRecord(ClassTimeStatistics statistics);
 }

+ 40 - 2
src/main/java/com/xjrsoft/module/classtime/service/impl/ClassTimeStatisticsServiceImpl.java

@@ -26,6 +26,7 @@ import com.xjrsoft.module.classtime.service.IClassTimeDeleteService;
 import com.xjrsoft.module.classtime.service.IClassTimeStatisticsService;
 import com.xjrsoft.module.classtime.service.IClassTimeStatisticsSetService;
 import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsRecordVo;
+import com.xjrsoft.module.classtime.vo.CourseClassTimeStatisticsRecordVo;
 import com.xjrsoft.module.classtime.vo.CourseListVo;
 import com.xjrsoft.module.classtime.vo.TeacherListVo;
 import com.xjrsoft.module.classtime.vo.WeekTimeRangeVo;
@@ -90,6 +91,34 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
         return true;
     }
 
+    @Override
+    public Boolean addCourse(AddClassTimeStatisticsDto dto) {
+        ClassTimeStatistics classTimeStatistics = BeanUtil.toBean(dto, ClassTimeStatistics.class);
+        classTimeStatistics.setStatus(0);
+        classTimeStatistics.setCategory(2);
+        classTimeStatistics.setCreateDate(new Date());
+
+        //查询最新权重并保存到统计中
+        Integer category = 3;
+        List<ClassTimeStatisticsSet> list = statisticsSetService.list(
+                new QueryWrapper<ClassTimeStatisticsSet>().lambda()
+                        .eq(ClassTimeStatisticsSet::getCategory, category)
+                        .orderByDesc(ClassTimeStatisticsSet::getCreateDate)
+        );
+        if(list.isEmpty()){
+            throw new MyException("请先设置权重并进行保存");
+        }
+        classTimeStatistics.setWeightSetJson(list.get(0).getJsonContent());
+
+        this.save(classTimeStatistics);
+
+        CompletableFuture.runAsync(() -> {
+            refreshCourseRecord(classTimeStatistics);
+        });
+
+        return true;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean update(ClassTimeStatistics classTimeStatistics) {
@@ -111,6 +140,7 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
     public Boolean add(AddClassTimeStatisticsDto dto) {
         ClassTimeStatistics classTimeStatistics = BeanUtil.toBean(dto, ClassTimeStatistics.class);
         classTimeStatistics.setStatus(0);
+        classTimeStatistics.setCategory(1);
         classTimeStatistics.setCreateDate(new Date());
 
         //查询最新权重并保存到统计中
@@ -539,10 +569,13 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
         return this.baseMapper.getRecordList(id);
     }
 
+    @Override
+    public List<CourseClassTimeStatisticsRecordVo> getCourseRecordList(Long id) {
+        return this.baseMapper.getCourseRecordList(id);
+    }
+
     /**
      * 导出课时统计明细
-     * @param id
-     * @return
      */
     @Override
     public byte[] recordExport(Long id) {
@@ -698,6 +731,11 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
         }
     }
 
+    @Override
+    public Boolean refreshCourseRecord(ClassTimeStatistics statistics) {
+        return null;
+    }
+
     /**
      * 生成第二行表头
      * 前端固定表头:序号、工号、姓名、教研会、督导听课、临近三年退休政策、出题、阅卷、周末培优、早自习、正课(含调顶课时)、晚辅(含调顶课时)、顶课、调课

+ 68 - 0
src/main/java/com/xjrsoft/module/classtime/vo/CourseClassTimeStatisticsRecordVo.java

@@ -0,0 +1,68 @@
+package com.xjrsoft.module.classtime.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 课时统计-教师详情表单出参
+* @Author dzx
+* @Date: 2024-09-26
+* @Version 1.0
+*/
+@Data
+public class CourseClassTimeStatisticsRecordVo {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+    /**
+    * 课时统计(class_time_statistics)
+    */
+    @ApiModelProperty("姓名")
+    private String name;
+    /**
+    * 教师id(xjr_user)
+    */
+    @ApiModelProperty("工号")
+    private String userName;
+    /**
+    * 聘用类型
+    */
+    @ApiModelProperty("聘用类型")
+    private String employTypeCn;
+    /**
+    * 总课时
+    */
+    @ApiModelProperty("总课时")
+    private String allClassTime;
+
+    @ApiModelProperty("总周次")
+    private Integer classTime1;
+
+    @ApiModelProperty("周平均课时")
+    private String classTime2;
+
+    @ApiModelProperty("行政工作量")
+    private String classTime3;
+
+    @ApiModelProperty("总平均课时")
+    private String classTime4;
+
+    @ApiModelProperty("工作量得分")
+    private String classTime5;
+
+    @ApiModelProperty("超工作量得分")
+    private String classTime6;
+
+    @ApiModelProperty("早自习")
+    private String classTime7;
+
+    @ApiModelProperty("正课")
+    private String classTime8;
+
+    @ApiModelProperty("晚辅")
+    private String classTime9;
+
+}

+ 9 - 0
src/main/resources/mapper/classtime/ClassTimeStatisticsMapper.xml

@@ -79,5 +79,14 @@
         LEFT JOIN xjr_dictionary_detail t3 ON t1.employ_type = t3.code
         WHERE t1.delete_mark = 0 AND t1.class_time_statistics_id = #{id}
     </select>
+    <select id="getCourseRecordList" resultType="com.xjrsoft.module.classtime.vo.CourseClassTimeStatisticsRecordVo">
+        SELECT t1.id,t2.user_name,t2.name,t3.name AS employ_type_cn,t1.week_data,
+               t1.class_time1,t1.class_time2,t1.class_time3,t1.class_time4,t1.class_time5,
+               t1.class_time6,t1.class_time7,t1.class_time8,t1.class_time9,t1.class_time10,t1.class_time11,course_time_type_data,
+               t1.all_class_time,t1.total_amount,t1.class_time_amount,t1.beyond_class_time_amount FROM class_time_statistics_record t1
+                                                                                                           INNER JOIN xjr_user t2 ON t1.user_id = t2.id
+                                                                                                           LEFT JOIN xjr_dictionary_detail t3 ON t1.employ_type = t3.code
+        WHERE t1.delete_mark = 0 AND t1.class_time_statistics_id = #{id}
+    </select>
 
 </mapper>