Parcourir la source

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

大数据与最优化研究所 il y a 1 an
Parent
commit
57affc6084

+ 3 - 0
src/main/java/com/xjrsoft/module/room/dto/DistributeRoomBedDto.java

@@ -24,4 +24,7 @@ public class DistributeRoomBedDto implements Serializable {
     @ApiModelProperty("寝室ids")
     private List<Long> roomIds;
 
+    @ApiModelProperty("是否需要混合寝室(0:否 1:是")
+    private Integer isNeedMaxRoom = 0;
+
 }

+ 19 - 2
src/main/java/com/xjrsoft/module/room/service/impl/RoomBedServiceImpl.java

@@ -270,8 +270,11 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
     public Boolean distributeRoomBed(DistributeRoomBedDto dto) {
         List<Room> roomList = roomMapper.selectList(new QueryWrapper<Room>().lambda().in(Room::getId, dto.getRoomIds()));
         Set<String> genderSet = new HashSet<>();
+        //存入每个寝室已经入住的班级id
+        Map<Long, Long> roomClassMaps = new HashMap<>();
         for (Room room : roomList) {
             genderSet.add(room.getGender());
+            roomClassMaps.put(room.getId(), null);
         }
 
         Date modifyDate = new Date();
@@ -285,6 +288,7 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         for (StudentPayStatusVo payStatus : studentPayStatus) {
             payStatusMap.put(payStatus.getId(), (payStatus.getPayStatus() == null?0:payStatus.getPayStatus()));
         }
+        //按照性别分组分配
         for (String genderNumber : genderSet) {
             int i = 0;
             //根据性别查询出所有空床位信息
@@ -298,8 +302,9 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
                 .eq(RoomBed::getIsCheckIn, 0)
                 .in(RoomBed::getRoomId, dto.getRoomIds())
             );
-
+            //按照班级分配
             for (Long classId : dto.getClassIds()) {
+                //先查询出班上的在读住校生
                 List<BaseStudent> studentList = baseStudentMapper.selectList(
                     MPJWrappers.<BaseStudent>lambdaJoin()
                     .select(BaseStudent::getUserId)
@@ -327,6 +332,16 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
                         studentOrderList.add(baseStudent);
                     }
                 }
+                //判断生成策略,是否需要混合寝室
+                if(dto.getIsNeedMaxRoom() == 0 && i <= bedInfoList.size()){
+                    //预先查看下一个床位所属寝室是否已经有其他班级入住,有就直接跳过
+                    for (int j = i; j < bedInfoList.size(); j ++) {
+                        if(roomClassMaps.get(bedInfoList.get(j).getRoomId()) != null && !classId.equals(roomClassMaps.get(bedInfoList.get(j).getRoomId())) ){
+                            i ++;
+                        }
+                    }
+                }
+                //执行床位分配
                 for (BaseStudent studentInfoVo : studentOrderList) {
                     if(i >= bedInfoList.size()){
                         continue;
@@ -338,6 +353,8 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
                     roomBedMapper.updateById(roomBed);
                     i ++;
                     distributeBedNumber ++;
+                    //分配好一个学生之后,将这个寝室已入住的班级存入
+                    roomClassMaps.putIfAbsent(roomBed.getRoomId(), classId);
                 }
                 classDistributeBedNumber.put(classId, distributeBedNumber);
                 classStudent.put(classId, studentList.size());
@@ -354,7 +371,7 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         Integer maxSortCode = roomBedRecordMapper.getMaxSortCode();
         for (Long classId : classGradeMap.keySet()) {
             maxSortCode ++;
-            Integer studentCount = classStudent.get(classId);
+//            Integer studentCount = classStudent.get(classId);
             RoomBedRecord record = new RoomBedRecord();
             record.setClassId(classId);
             record.setGradeId(classGradeMap.get(classId));

+ 19 - 0
src/main/java/com/xjrsoft/module/student/controller/ConsumptionController.java

@@ -2,24 +2,33 @@ package com.xjrsoft.module.student.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.stp.StpUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
+import com.xjrsoft.module.student.dto.PbVXssfdetailExcelDto;
 import com.xjrsoft.module.student.dto.PbVXssfdetailPageDto;
 import com.xjrsoft.module.student.service.IPbVXssfdetailService;
 import com.xjrsoft.module.student.service.IStudentManagerService;
+import com.xjrsoft.module.student.vo.PbVXssfdetailExcelVo;
 import com.xjrsoft.module.student.vo.PbVXssfdetailPageVo;
 import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.io.ByteArrayOutputStream;
+import java.util.List;
 
 /**
 * @title: 学生职务设置
@@ -50,4 +59,14 @@ public class ConsumptionController {
         PageOutput<PbVXssfdetailPageVo> pageOutput = ConventPage.getPageOutput(page, PbVXssfdetailPageVo.class);
         return RT.ok(pageOutput);
     }
+
+    @PostMapping("/export")
+    @ApiOperation(value = "导出")
+    public ResponseEntity<byte[]> exportData(@Valid PbVXssfdetailExcelDto dto) {
+        List<PbVXssfdetailExcelVo> dataList = pbVXssfdetailService.getList(dto);
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        EasyExcel.write(bot, PbVXssfdetailExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
+
+        return RT.fileStream(bot.toByteArray(), "PbVXssfdetailExcelVo" + ExcelTypeEnum.XLSX.getValue());
+    }
 }

+ 47 - 0
src/main/java/com/xjrsoft/module/student/dto/PbVXssfdetailExcelDto.java

@@ -0,0 +1,47 @@
+package com.xjrsoft.module.student.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+
+/**
+* @title: 分页查询入参
+* @Author dzx
+* @Date: 2024-03-13
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PbVXssfdetailExcelDto extends PageInput {
+
+    @ApiModelProperty("学期Id")
+    private Long semesterId;
+
+    @ApiModelProperty("收费项目")
+    private String feeitemname;
+
+    @ApiModelProperty("学生姓名")
+    private String name;
+
+    @ApiModelProperty("学生学号")
+    private String studentId;
+
+    @ApiModelProperty("订单号")
+    private String payorder;
+
+    @ApiModelProperty("支付时间-开始")
+    private String startDate;
+
+    @ApiModelProperty("支付时间-结束")
+    private String endDate;
+
+    @ApiModelProperty("缴费类型(-1:退费 1:缴费)")
+    private Integer category;
+
+    @ApiModelProperty("订单号")
+    private List<Long> payorders;
+}

+ 7 - 0
src/main/java/com/xjrsoft/module/student/mapper/PbVXssfdetailMapper.java

@@ -2,10 +2,15 @@ package com.xjrsoft.module.student.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.dto.PbVXssfdetailExcelDto;
 import com.xjrsoft.module.student.dto.PbVXssfdetailPageDto;
 import com.xjrsoft.module.student.entity.PbVXssfdetail;
+import com.xjrsoft.module.student.vo.PbVXssfdetailExcelVo;
 import com.xjrsoft.module.student.vo.PbVXssfdetailPageVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
 * @title: 
@@ -23,4 +28,6 @@ public interface PbVXssfdetailMapper extends MPJBaseMapper<PbVXssfdetail> {
      * @return
      */
     Page<PbVXssfdetailPageVo> getPage(Page<PbVXssfdetailPageVo> page, PbVXssfdetailPageDto dto);
+
+    List<PbVXssfdetailExcelVo> getList(@Param("dto") PbVXssfdetailExcelDto dto);
 }

+ 11 - 0
src/main/java/com/xjrsoft/module/student/service/IPbVXssfdetailService.java

@@ -2,10 +2,14 @@ package com.xjrsoft.module.student.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.dto.PbVXssfdetailExcelDto;
 import com.xjrsoft.module.student.dto.PbVXssfdetailPageDto;
 import com.xjrsoft.module.student.entity.PbVXssfdetail;
+import com.xjrsoft.module.student.vo.PbVXssfdetailExcelVo;
 import com.xjrsoft.module.student.vo.PbVXssfdetailPageVo;
 
+import java.util.List;
+
 /**
 * @title: 
 * @Author dzx
@@ -22,4 +26,11 @@ public interface IPbVXssfdetailService extends MPJBaseService<PbVXssfdetail> {
      * @return
      */
     Page<PbVXssfdetailPageVo> getPage(Page<PbVXssfdetailPageVo> page, PbVXssfdetailPageDto dto);
+
+    /**
+     * 分页查询
+     * @param dto
+     * @return
+     */
+    List<PbVXssfdetailExcelVo> getList(PbVXssfdetailExcelDto dto);
 }

+ 9 - 0
src/main/java/com/xjrsoft/module/student/service/impl/PbVXssfdetailServiceImpl.java

@@ -2,14 +2,18 @@ package com.xjrsoft.module.student.service.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.dto.PbVXssfdetailExcelDto;
 import com.xjrsoft.module.student.dto.PbVXssfdetailPageDto;
 import com.xjrsoft.module.student.entity.PbVXssfdetail;
 import com.xjrsoft.module.student.mapper.PbVXssfdetailMapper;
 import com.xjrsoft.module.student.service.IPbVXssfdetailService;
+import com.xjrsoft.module.student.vo.PbVXssfdetailExcelVo;
 import com.xjrsoft.module.student.vo.PbVXssfdetailPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
 * @title: 
 * @Author dzx
@@ -34,4 +38,9 @@ public class PbVXssfdetailServiceImpl extends MPJBaseServiceImpl<PbVXssfdetailMa
         }
         return voPage;
     }
+
+    @Override
+    public List<PbVXssfdetailExcelVo> getList(PbVXssfdetailExcelDto dto) {
+        return pbVXssfdetailMapper.getList(dto);
+    }
 }

+ 19 - 0
src/main/java/com/xjrsoft/module/student/service/impl/PbVXsxxsfytbServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xjrsoft.module.student.service.impl;
+
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.entity.PbVXsxxsfytb;
+import com.xjrsoft.module.student.mapper.PbVXsxxsfytbMapper;
+import com.xjrsoft.module.student.service.IPbVXsxxsfytbService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+* @title: 
+* @Author dzx
+* @Date: 2024-03-13
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class PbVXsxxsfytbServiceImpl extends MPJBaseServiceImpl<PbVXsxxsfytbMapper, PbVXsxxsfytb> implements IPbVXsxxsfytbService {
+}

+ 66 - 0
src/main/java/com/xjrsoft/module/student/vo/PbVXssfdetailExcelVo.java

@@ -0,0 +1,66 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 分页列表出参
+* @Author dzx
+* @Date: 2024-03-13
+* @Version 1.0
+*/
+@Data
+public class PbVXssfdetailExcelVo {
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学号")
+    @ApiModelProperty("学号")
+    private String studentId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生姓名")
+    @ApiModelProperty("学生姓名")
+    private String name;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("性别中文")
+    @ApiModelProperty("性别中文")
+    private String genderCn;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学期")
+    @ApiModelProperty("学期")
+    private String semesterName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("收费项目")
+    @ApiModelProperty("收费项目")
+    private String feeitemname;
+    @ContentStyle(dataFormat = 49)
+
+    @ExcelProperty("类型")
+    @ApiModelProperty("类型")
+    private String category;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("支付金额")
+    @ApiModelProperty("支付金额")
+    private Double mny;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("支付类型")
+    @ApiModelProperty("支付类型")
+    private String paytype;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("支付时间")
+    @ApiModelProperty("支付时间")
+    private String paydate;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("订单号")
+    @ApiModelProperty("订单号")
+    private String payorder;
+}

+ 1 - 1
src/main/java/com/xjrsoft/module/student/vo/PbVXssfdetailPageVo.java

@@ -33,7 +33,7 @@ public class PbVXssfdetailPageVo {
     @ApiModelProperty("支付类型")
     private String paytype;
 
-    @ApiModelProperty("订单号")
+    @ApiModelProperty("订单号(唯一主键)")
     private String payorder;
 
     @ApiModelProperty("支付时间")

+ 43 - 0
src/main/resources/mapper/student/PbVXssfdetailMapper.xml

@@ -38,4 +38,47 @@
             </if>
         </if>
     </select>
+    <select id="getList" parameterType="com.xjrsoft.module.student.dto.PbVXssfdetailExcelDto" resultType="com.xjrsoft.module.student.vo.PbVXssfdetailExcelVo">
+        SELECT t2.user_id,t2.student_id,t1.name,t4.name AS gender_cn,t6.name AS semester_name,t3.feeitemname,t3.paytype,t3.paydate,t3.payorder,t3.mny FROM xjr_user t1
+        INNER JOIN base_student t2 ON t1.id = t2.user_id
+        INNER JOIN pb_v_xssfdetail t3 ON t1.credential_number = t3.personalid
+        LEFT JOIN xjr_dictionary_detail t4 ON t1.gender = t4.code AND t4.item_id = 2023000000000000004
+        LEFT JOIN pb_semester_config t5 ON t3.beltcode = t5.beltcode AND t5.delete_mark = 0
+        LEFT JOIN base_semester t6 ON t6.id = t5.base_semester_id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        <if test="dto.payorders == null">
+            <if test="dto.name != null and dto.name != ''">
+                and t1.name like concat('%', #{dto.name},'%')
+            </if>
+            <if test="dto.semesterId != null">
+                and t6.id = #{dto.semesterId}
+            </if>
+            <if test="dto.feeitemname != null and dto.feeitemname != ''">
+                and t3.feeitemname like concat('%', #{dto.feeitemname},'%')
+            </if>
+            <if test="dto.studentId != null and dto.studentId != ''">
+                and t2.student_id like concat('%', #{dto.studentId},'%')
+            </if>
+            <if test="dto.payorder != null and dto.payorder != ''">
+                and t3.payorder like concat('%', #{dto.payorder},'%')
+            </if>
+            <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
+                and t3.paydate between #{dto.startDate} and #{dto.endDate}
+            </if>
+            <if test="dto.category != null">
+                <if test="dto.category == 1">
+                    and t3.mny > 0
+                </if>
+                <if test="dto.category == -1">
+                    and 0 > t3.mny
+                </if>
+            </if>
+        </if>
+        <if test="dto.payorders != null">
+            and t3.payorder in
+            <foreach item="payorder" index="index" collection="dto.payorders" open="(" close=")" separator=",">
+                #{payorder}
+            </foreach>
+        </if>
+    </select>
 </mapper>