Procházet zdrojové kódy

学生消费导出

dzx před 1 rokem
rodič
revize
5048da2625

+ 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("缴费类型(-1:退费 1:缴费)")
+    private List<Long> id;
+}

+ 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;
+}

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

@@ -38,4 +38,39 @@
             </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.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>
+    </select>
 </mapper>