教育训练处考试制证系统后端
“djh”
2025-03-06 6061c45849de0f3ac6d05fdfa2bac4b09c21179b
考试缴费统计修改
已修改20个文件
已添加5个文件
735 ■■■■■ 文件已修改
exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalCategoryController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalCategoryController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/CateGoryTheory.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/CategoryCount.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCategoryCount.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailH5RepDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/dto/req/CountReq.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCountCategoryReqDto.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/mapper/CoalCategoryMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalCategoryMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/CoalCategoryService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalCategoryService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalCategoryServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalCategoryServiceImpl.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/resources/mapper/pay/CoalCategoryMapper.xml 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/test/java/TextPay.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalCategoryController.java
@@ -1,9 +1,13 @@
package com.gkhy.exam.pay.controller;
import com.gkhy.exam.pay.dto.rep.CategoryCount;
import com.gkhy.exam.pay.dto.rep.NonCategoryCount;
import com.gkhy.exam.pay.dto.req.CountReq;
import com.gkhy.exam.pay.entity.CoalCategory;
import com.gkhy.exam.pay.entity.CoalTicket;
import com.gkhy.exam.pay.entity.NonCoalCategory;
import com.gkhy.exam.pay.service.CoalCategoryService;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -15,6 +19,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@Api(tags = "煤矿工种类别管理")
@@ -98,4 +103,27 @@
    public AjaxResult ticketList(){
        return success(coalCategoryService.ticketList());
    }
    /**
     * 工种缴费统计
     */
    @GetMapping("/count")
    @ApiOperation(value = "工种缴费统计")
    public TableDataInfo count(CountReq countReq){
        List<CategoryCount> categoryCounts = coalCategoryService.countCategory(countReq);
        int pageNum = countReq.getPageNum(); // 当前页码
        int pageSize = countReq.getPageSize(); // 每页大小
        List<CategoryCount> pagedList = categoryCounts.stream()
                .skip((pageNum - 1) * pageSize) // 跳过前面的数据
                .limit(pageSize) // 限制当前页的数据量
                .collect(Collectors.toList());
        // 封装分页结果
        TableDataInfo dataTable = new TableDataInfo();
        dataTable.setCode(HttpStatus.SUCCESS);
        dataTable.setMsg("查询成功");
        dataTable.setRows(pagedList); // 当前页数据
        dataTable.setTotal(categoryCounts.size()); // 总数据量
        return dataTable;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalCategoryController.java
@@ -1,7 +1,10 @@
package com.gkhy.exam.pay.controller;
import com.gkhy.exam.pay.dto.rep.NonCategoryCount;
import com.gkhy.exam.pay.dto.req.NonCountCategoryReqDto;
import com.gkhy.exam.pay.entity.NonCoalCategory;
import com.gkhy.exam.pay.service.NonCoalCategoryService;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -13,6 +16,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
@@ -89,4 +93,24 @@
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(nonCoalCategoryService.deleteNonCoalCategoryByIds(ids));
    }
    @GetMapping("/count")
    @ApiOperation(value = "非煤工种缴费统计")
    public TableDataInfo count(NonCountCategoryReqDto countCategoryReqDto){
        List<NonCategoryCount> nonCategoryCounts = nonCoalCategoryService.countCategory(countCategoryReqDto);
        int pageNum = countCategoryReqDto.getPageNum(); // 当前页码
        int pageSize = countCategoryReqDto.getPageSize(); // 每页大小
        List<NonCategoryCount> pagedList = nonCategoryCounts.stream()
                .skip((pageNum - 1) * pageSize) // 跳过前面的数据
                .limit(pageSize) // 限制当前页的数据量
                .collect(Collectors.toList());
        // 封装分页结果
        TableDataInfo dataTable = new TableDataInfo();
        dataTable.setCode(HttpStatus.SUCCESS);
        dataTable.setMsg("查询成功");
        dataTable.setRows(pagedList); // 当前页数据
        dataTable.setTotal(nonCategoryCounts.size()); // 总数据量
        return dataTable;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/CateGoryTheory.java
对比新文件
@@ -0,0 +1,42 @@
package com.gkhy.exam.pay.dto.rep;
import java.math.BigDecimal;
public class CateGoryTheory {
    private Integer payType;
    private String payTypeName;
    private Integer num;
    private BigDecimal amount;
    public Integer getPayType() {
        return payType;
    }
    public void setPayType(Integer payType) {
        this.payType = payType;
    }
    public String getPayTypeName() {
        return payTypeName;
    }
    public void setPayTypeName(String payTypeName) {
        this.payTypeName = payTypeName;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public BigDecimal getAmount() {
        return amount;
    }
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/CategoryCount.java
对比新文件
@@ -0,0 +1,99 @@
package com.gkhy.exam.pay.dto.rep;
import java.math.BigDecimal;
public class CategoryCount {
    private Long id;
    /**
     * 工种名称
     */
    private String subjectName;
    /**
     * 单价
     */
    private BigDecimal amount;
    /**
     * 工种类别
     */
    private Integer categoryType;
    /**
     * 人数
     */
    private Integer num;
    /**
     * 总额
     */
    private BigDecimal totalMoney;
    /**
     * 上缴中央
     */
    private BigDecimal turnContent;
    /**
     * 自治区级
     */
    private BigDecimal autonomy;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getSubjectName() {
        return subjectName;
    }
    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }
    public BigDecimal getAmount() {
        return amount;
    }
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
    public Integer getCategoryType() {
        return categoryType;
    }
    public void setCategoryType(Integer categoryType) {
        this.categoryType = categoryType;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public BigDecimal getTotalMoney() {
        return totalMoney;
    }
    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }
    public BigDecimal getTurnContent() {
        return turnContent;
    }
    public void setTurnContent(BigDecimal turnContent) {
        this.turnContent = turnContent;
    }
    public BigDecimal getAutonomy() {
        return autonomy;
    }
    public void setAutonomy(BigDecimal autonomy) {
        this.autonomy = autonomy;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCategoryCount.java
对比新文件
@@ -0,0 +1,112 @@
package com.gkhy.exam.pay.dto.rep;
import java.math.BigDecimal;
public class NonCategoryCount {
    private Long id;
    /**
     * 工种名称
     */
    private String subjectName;
    /**
     * 单价
     */
    private BigDecimal amount;
    /**
     * 工种类别
     */
    private Integer categoryType;
    /**
     * 人数
     */
    private Integer num;
    /**
     * 总额
     */
    private BigDecimal totalMoney;
    /**
     * 上缴中央
     */
    private BigDecimal turnContent;
    /**
     * 自治区级
     */
    private BigDecimal autonomy;
    /**
     * 地州
     */
    private BigDecimal prefecuture;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getSubjectName() {
        return subjectName;
    }
    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }
    public BigDecimal getAmount() {
        return amount;
    }
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
    public Integer getCategoryType() {
        return categoryType;
    }
    public void setCategoryType(Integer categoryType) {
        this.categoryType = categoryType;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public BigDecimal getTotalMoney() {
        return totalMoney;
    }
    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }
    public BigDecimal getTurnContent() {
        return turnContent;
    }
    public void setTurnContent(BigDecimal turnContent) {
        this.turnContent = turnContent;
    }
    public BigDecimal getAutonomy() {
        return autonomy;
    }
    public void setAutonomy(BigDecimal autonomy) {
        this.autonomy = autonomy;
    }
    public BigDecimal getPrefecuture() {
        return prefecuture;
    }
    public void setPrefecuture(BigDecimal prefecuture) {
        this.prefecuture = prefecuture;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailH5RepDto.java
@@ -1,6 +1,7 @@
package com.gkhy.exam.pay.dto.rep;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -46,6 +47,9 @@
    @ApiModelProperty("财政缴款编码")
    private String orderId;
    @ApiModelProperty("财政缴款码")
    private String payCode;
    @ApiModelProperty("填报时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
exam-system/src/main/java/com/gkhy/exam/pay/dto/req/CountReq.java
对比新文件
@@ -0,0 +1,51 @@
package com.gkhy.exam.pay.dto.req;
public class CountReq {
    private String year;
    private Integer quarter;
    private Long deptId;
    private Integer pageNum;
    private Integer pageSize;
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public Integer getQuarter() {
        return quarter;
    }
    public void setQuarter(Integer quarter) {
        this.quarter = quarter;
    }
    public Integer getPageNum() {
        return pageNum;
    }
    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public Long getDeptId() {
        return deptId;
    }
    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCountCategoryReqDto.java
对比新文件
@@ -0,0 +1,73 @@
package com.gkhy.exam.pay.dto.req;
public class NonCountCategoryReqDto {
    /**
     * 年份
     */
    private String year;
    /**
     * 季度
     */
    private Integer quarter;
    /**
     * 地州编码
     */
    private String districtCode;
    /**
     * 组织架构
     */
    private Long deptId;
    private Integer pageNum;
    private Integer pageSize;
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public Integer getQuarter() {
        return quarter;
    }
    public void setQuarter(Integer quarter) {
        this.quarter = quarter;
    }
    public String getDistrictCode() {
        return districtCode;
    }
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }
    public Long getDeptId() {
        return deptId;
    }
    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }
    public Integer getPageNum() {
        return pageNum;
    }
    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/mapper/CoalCategoryMapper.java
@@ -1,6 +1,9 @@
package com.gkhy.exam.pay.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.pay.dto.rep.CateGoryTheory;
import com.gkhy.exam.pay.dto.rep.CategoryCount;
import com.gkhy.exam.pay.dto.req.CountReq;
import com.gkhy.exam.pay.entity.CoalCategory;
import com.gkhy.exam.pay.entity.CoalTicket;
import org.springframework.stereotype.Repository;
@@ -28,4 +31,8 @@
    CoalTicket selectCoalTicket();
    List<CategoryCount> countCategory(CountReq countReq);
    List<CateGoryTheory> countThroey(CountReq countReq);
}
exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalCategoryMapper.java
@@ -1,6 +1,9 @@
package com.gkhy.exam.pay.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.pay.dto.rep.CateGoryTheory;
import com.gkhy.exam.pay.dto.rep.NonCategoryCount;
import com.gkhy.exam.pay.dto.req.NonCountCategoryReqDto;
import com.gkhy.exam.pay.entity.NonCoalCategory;
import java.util.List;
@@ -67,4 +70,8 @@
     * @return
     */
    int checkUnite(NonCoalCategory nonCoalCategory);
    List<NonCategoryCount> selectCountCategory(NonCountCategoryReqDto countCategoryReqDto);
    List<CateGoryTheory> selectCountTheory(NonCountCategoryReqDto countCategoryReqDto);
}
exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java
@@ -46,7 +46,7 @@
     */
    public int updateNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent);
    int updateNonCoalPayStudentType(@Param("id") Long id, @Param("updateBy") String updateBy);
    int updateNonCoalPayStudentType(@Param("id") Long id, @Param("updateBy") String updateBy, @Param("status") Integer status);
    /**
     * 删除【请填写功能名称】
exam-system/src/main/java/com/gkhy/exam/pay/service/CoalCategoryService.java
@@ -1,6 +1,8 @@
package com.gkhy.exam.pay.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.exam.pay.dto.rep.CategoryCount;
import com.gkhy.exam.pay.dto.req.CountReq;
import com.gkhy.exam.pay.entity.CoalCategory;
import com.gkhy.exam.pay.entity.CoalTicket;
@@ -23,4 +25,5 @@
    CoalTicket ticketList();
    List<CategoryCount> countCategory(CountReq countReq);
}
exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalCategoryService.java
@@ -2,6 +2,8 @@
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.exam.pay.dto.rep.NonCategoryCount;
import com.gkhy.exam.pay.dto.req.NonCountCategoryReqDto;
import com.gkhy.exam.pay.entity.NonCoalCategory;
/**
@@ -58,4 +60,6 @@
     * @return 结果
     */
    public int deleteNonCoalCategoryById(Long id);
    List<NonCategoryCount> countCategory(NonCountCategoryReqDto countCategoryReqDto);
}
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalCategoryServiceImpl.java
@@ -1,11 +1,15 @@
package com.gkhy.exam.pay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.pay.dto.rep.CateGoryTheory;
import com.gkhy.exam.pay.dto.rep.CategoryCount;
import com.gkhy.exam.pay.dto.req.CountReq;
import com.gkhy.exam.pay.entity.CoalCategory;
import com.gkhy.exam.pay.entity.CoalTicket;
import com.gkhy.exam.pay.mapper.CoalCategoryMapper;
import com.gkhy.exam.pay.service.CoalCategoryService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.SecurityUtils;
import io.swagger.annotations.ApiImplicitParam;
@@ -15,6 +19,7 @@
import org.springframework.web.bind.annotation.PathVariable;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
@@ -103,4 +108,31 @@
        return coalCategoryMapper.selectCoalTicket();
    }
    @Override
    public List<CategoryCount> countCategory(CountReq countReq) {
//        SysUser user = SecurityUtils.getLoginUser().getUser();
//        countReq.setDeptId(user.getDeptId());
        List<CategoryCount> categoryCounts = coalCategoryMapper.countCategory(countReq);
        List<CateGoryTheory> cateGoryTheories = coalCategoryMapper.countThroey(countReq);
        for (CateGoryTheory cateGoryTheory : cateGoryTheories) {
            CategoryCount categoryCount = new CategoryCount();
            categoryCount.setAmount(cateGoryTheory.getAmount());
            categoryCount.setCategoryType(1);
            categoryCount.setNum(cateGoryTheory.getNum());
            categoryCount.setSubjectName(cateGoryTheory.getPayTypeName());
            categoryCounts.add(categoryCount);
        }
        for (CategoryCount categoryCount : categoryCounts) {
            categoryCount.setTotalMoney(categoryCount.getAmount().multiply(BigDecimal.valueOf(categoryCount.getNum())));
            if (categoryCount.getCategoryType()==1){
                categoryCount.setTurnContent(BigDecimal.valueOf(categoryCount.getNum()*6));
                categoryCount.setAutonomy(categoryCount.getTotalMoney().subtract(categoryCount.getTurnContent()));
            }else {
                categoryCount.setTurnContent(BigDecimal.valueOf(categoryCount.getNum()*3));
                categoryCount.setAutonomy(categoryCount.getTotalMoney().subtract(categoryCount.getTurnContent()));
            }
        }
        return categoryCounts;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java
@@ -163,7 +163,7 @@
    @Override
    public AjaxResult deleteCoalPayByIds(Long[] ids) {
        for (Long id : ids) {
            List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayIdAndPayStatus(id, 1);
            List<CoalPayStudent> coalPayStudents = coalPayStudentService.selectByCoalPayId(id);
            if (!CollectionUtils.isEmpty(coalPayStudents)) {
                throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "已有学员完成缴费,请勿删除");
            }
@@ -223,6 +223,7 @@
            CoalPayStudent coalPayStudent = new CoalPayStudent();
            coalPayStudent.setCoalPayId(coalPayTypeReq.getCoalPayId());
            coalPayStudent.setPayType(2);
            coalPayStudent.setGovPayStatus(0);
            coalPayStudentService.updateByCoalPayId(coalPayStudent);
        }
        return i;
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalCategoryServiceImpl.java
@@ -1,6 +1,10 @@
package com.gkhy.exam.pay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.pay.dto.rep.CateGoryTheory;
import com.gkhy.exam.pay.dto.rep.CategoryCount;
import com.gkhy.exam.pay.dto.rep.NonCategoryCount;
import com.gkhy.exam.pay.dto.req.NonCountCategoryReqDto;
import com.gkhy.exam.pay.entity.NonCoalCategory;
import com.gkhy.exam.pay.mapper.NonCoalCategoryMapper;
import com.gkhy.exam.pay.service.NonCoalCategoryService;
@@ -9,6 +13,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
@@ -117,4 +122,39 @@
    public int deleteNonCoalCategoryById(Long id) {
        return nonCoalCategoryMapper.deleteNonCoalCategoryById(id);
    }
    @Override
    public List<NonCategoryCount> countCategory(NonCountCategoryReqDto countCategoryReqDto) {
//        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
//            if (!Constants.DIS_XINJIANG_CODE.equals(SecurityUtils.getDeptDistrictCode())) {
//                countCategoryReqDto.setDistrictCode(SecurityUtils.getDeptDistrictCode());
//            }
//
//        }
        List<NonCategoryCount> nonCategoryCounts = nonCoalCategoryMapper.selectCountCategory(countCategoryReqDto);
        List<CateGoryTheory> cateGoryTheories = nonCoalCategoryMapper.selectCountTheory(countCategoryReqDto);
        for (CateGoryTheory cateGoryTheory : cateGoryTheories) {
            NonCategoryCount nonCategoryCount = new NonCategoryCount();
            nonCategoryCount.setCategoryType(1);
            nonCategoryCount.setAmount(cateGoryTheory.getAmount());
            nonCategoryCount.setNum(cateGoryTheory.getNum());
            nonCategoryCount.setSubjectName(cateGoryTheory.getPayTypeName());
            nonCategoryCounts.add(nonCategoryCount);
        }
        for (NonCategoryCount categoryCount : nonCategoryCounts) {
            categoryCount.setTotalMoney(categoryCount.getAmount().multiply(BigDecimal.valueOf(categoryCount.getNum())));
            if (categoryCount.getCategoryType()==1){
                categoryCount.setTurnContent(BigDecimal.valueOf(categoryCount.getNum()*6));
                categoryCount.setAutonomy(BigDecimal.valueOf(categoryCount.getNum()*8));
                categoryCount.setPrefecuture(categoryCount.getTotalMoney().subtract(categoryCount.getTurnContent().add(categoryCount.getAutonomy())));
            }else {
                categoryCount.setTurnContent(BigDecimal.valueOf(categoryCount.getNum()*3));
                categoryCount.setAutonomy(BigDecimal.valueOf(categoryCount.getNum()*13));
                categoryCount.setPrefecuture(categoryCount.getTotalMoney().subtract(categoryCount.getTurnContent().add(categoryCount.getAutonomy())));
            }
        }
        return nonCategoryCounts;
    }
}
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java
@@ -228,7 +228,7 @@
        int i = nonCoalPayMapper.updateNonCoalPay(nonCoalPay1);
        if (payPersonType == 2) {
            //更新未缴费的为团体
            nonCoalPayStudentMapper.updateNonCoalPayStudentType(id, SecurityUtils.getUsername());
            nonCoalPayStudentMapper.updateNonCoalPayStudentType(id, SecurityUtils.getUsername(),0);
        }
        return i;
    }
@@ -257,7 +257,12 @@
            throw new ServiceException("该数据不存在");
        }
        //验证是否有学员已缴费
        checkHavePay(id);
        NonCoalPayStudent nonCoalPayStudent = new NonCoalPayStudent();
        nonCoalPayStudent.setNonCoalPayId(id);
        List<NonCoalPayStudent> nonCoalPayStudents = nonCoalPayStudentService.selectNonCoalPayStudentList(nonCoalPayStudent);
        if (nonCoalPayStudents.size()>0){
            throw new ServiceException("该批次存在学员,请勿删除");
        }
        return nonCoalPayMapper.deleteNonCoalPayById(id, SecurityUtils.getUsername());
    }
exam-system/src/main/resources/mapper/pay/CoalCategoryMapper.xml
@@ -137,5 +137,78 @@
    <select id="selectCoalTicket" resultType="com.gkhy.exam.pay.entity.CoalTicket">
            select id , ticket_company_name,ticket_company_code,drawer,`check`,company_code  from coal_ticket
    </select>
    <select id="countCategory" resultType="com.gkhy.exam.pay.dto.rep.CategoryCount">
        SELECT
            cc.id,
            cc.subject_name,
            cc.amount,
            cc.category_type,
            COUNT(cps.`name`) num
        FROM
            coal_category cc
                LEFT JOIN coal_pay_category cpc ON cc.id = cpc.coal_category_id
                LEFT JOIN coal_pay cp ON cpc.coal_pay_id = cp.id
                LEFT JOIN coal_pay_student cps on cp.id = cps.coal_pay_id
        <where>
            cc.del_flag = 0 and cp.del_flag = 0 and cps.del_flag = 0 and cc.category_type = 2 and cps.pay_status =1
            <if test="year !=null and year != ''">
                and cp.year = #{year}
            </if>
            <if test="quarter!=null">
                and cp.quarter = #{quarter}
            </if>
            <if test="deptId !=null">
                and cp.dept_id = #{deptId}
            </if>
        </where>
        GROUP BY cc.id
    </select>
    <select id="countThroey" resultType="com.gkhy.exam.pay.dto.rep.CateGoryTheory">
        WITH filtered_data AS (
        SELECT
        cp.id AS pay_id,
        cp.pay_type,
        cpc.coal_category_id AS category_id
        FROM
        coal_pay cp
        LEFT JOIN coal_pay_category cpc ON cp.id = cpc.coal_pay_id
        LEFT JOIN coal_category cc ON cpc.coal_category_id = cc.id
        WHERE
        cc.category_type = 1
        <if test="year !=null and year != ''">
            and cp.year = #{year}
        </if>
        <if test="quarter!=null">
            and cp.quarter = #{quarter}
        </if>
          <if test="deptId!=null">
              and cp.dept_id =#{deptId}
          </if>
        AND cp.del_flag = 0
        ),
        pay_type_data AS (
        SELECT
        CASE
        WHEN fd.pay_type IN (1, 3) THEN '初训理论'
        ELSE '复训理论'
        END AS pay_type_name,
        cps.id AS student_id,
        cc.amount
        FROM
        filtered_data fd
        LEFT JOIN coal_pay_student cps ON fd.pay_id = cps.coal_pay_id
        LEFT JOIN coal_category cc ON fd.category_id = cc.id
        WHERE
        cps.del_flag = 0 and cps.pay_status = 1
        )
        SELECT
        pay_type_name,
        COUNT(student_id) AS num,
        MAX(amount) AS amount  -- 假设需要汇总 amount
        FROM
        pay_type_data
        GROUP BY
        pay_type_name
    </select>
</mapper>
exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml
@@ -102,6 +102,7 @@
        update coal_pay_student
        <trim prefix="SET" suffixOverrides=",">
            <if test="payType != null">pay_type = #{payType},</if>
            <if test="govPayStatus!=null">gov_pay_status=#{govPayStatus},</if>
        </trim>
        where coal_pay_id = #{coalPayId} and pay_status = 0
    </update>
exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml
@@ -197,6 +197,85 @@
        and subject_name = #{subjectName}
        <if test="id != null ">and id != #{id}</if>
    </select>
    <select id="selectCountCategory" resultType="com.gkhy.exam.pay.dto.rep.NonCategoryCount">
        SELECT
            cc.id,
            sot.name as subject_name,
            cc.amount,
            cc.category_type,
            COUNT( cps.`name` ) num
        FROM
            non_coal_category cc
                LEFT JOIN sys_operate_type sot on cc.operate_type_id = sot.id
                LEFT JOIN non_coal_pay_category cpc ON cc.id = cpc.category_id
                LEFT JOIN non_coal_pay cp ON cpc.non_coal_pay_id = cp.id
                LEFT JOIN non_coal_pay_student cps ON cp.id = cps.non_coal_pay_id
        WHERE cc.category_type = 2 and cc.del_flag = 0 and cps.del_flag =0 and cp.del_flag = 0 and cps.pay_status = 1
        <if test="year!=null and year !=''">
            and cp.year =#{year}
        </if>
        <if test="quarter != null">
            and cp.quarter = #{quarter}
        </if>
        <if test="districtCode!=null and districtCode!=''">
            and cc.district_code =#{districtCode}
        </if>
        <if test="deptId!=null">
            and cp.dept_id =#{deptId}
        </if>
        GROUP BY
            cc.id
    </select>
    <select id="selectCountTheory" resultType="com.gkhy.exam.pay.dto.rep.CateGoryTheory">
        WITH filtered_data AS (
            SELECT
                cp.id AS pay_id,
                cp.pay_type,
                cpc.category_id AS category_id
            FROM
                non_coal_pay cp
                    LEFT JOIN non_coal_pay_category cpc ON cp.id = cpc.non_coal_pay_id
                    LEFT JOIN non_coal_category cc ON cpc.category_id = cc.id
            WHERE
                cc.category_type = 1
              AND cp.del_flag = 0
            <if test="year !=null and year!=''">
                and cp.year = #{year}
            </if>
            <if test="quarter!=null">
                and cp.quarter = #{quarter}
            </if>
            <if test="districtCode !=null and districtCode !=''">
                and cp.district_code = #{districtCode}
            </if>
            <if test="deptId!=null">
                and cp.dept_id =#{deptId}
            </if>
        ),
             pay_type_data AS (
                 SELECT
                     CASE
                         WHEN fd.pay_type IN (1, 3) THEN '初训理论'
                         ELSE '复训理论'
                         END AS pay_type_name,
                     cps.id AS student_id,
                     cc.amount
                 FROM
                     filtered_data fd
                         LEFT JOIN non_coal_pay_student cps ON fd.pay_id = cps.non_coal_pay_id
                         LEFT JOIN non_coal_category cc ON fd.category_id = cc.id
                 WHERE
                     cps.del_flag = 0 and cps.pay_status =1
             )
        SELECT
            pay_type_name,
            COUNT(student_id) AS num,
            MAX(amount) AS amount
        FROM
            pay_type_data
        GROUP BY
            pay_type_name
    </select>
    <update id="deleteNonCoalCategoryById" parameterType="Long">
        update non_coal_category
exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
@@ -64,6 +64,7 @@
        <result property="fileData" column="file_data"/>
        <result property="nonCoalPayType" column="non_coal_pay_type"/>
        <result property="orderId" column="order_id"/>
        <result property="payCode" column="pay_code"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
@@ -192,6 +193,7 @@
               t.file_data,
               t.pay_type as non_coal_pay_type,
               t.order_id,
               t.pay_code,
               t.create_time
        from non_coal_pay a
                 inner join non_coal_pay_student t on t.non_coal_pay_id = a.id and t.del_flag = 0
exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml
@@ -117,10 +117,10 @@
    <update id="updateNonCoalPayStudentType">
        update non_coal_pay_student
        set pay_type  = 2,
            gov_pay_status = #{status},
            update_by = #{updateBy}
        where non_coal_pay_id = #{id}
          and pay_status = 0
          and order_no is null
    </update>
    <update id="updateNonCoalPayStudent" parameterType="NonCoalPayStudent">
        update non_coal_pay_student
exam-system/src/test/java/TextPay.java
@@ -54,48 +54,49 @@
        PayReqData.Feedata feedatas = new PayReqData.Feedata();
        //订单编号 RandomUtil.generateOrderNumber(1L, "NC") NC202502170849287181
        //订单编号
        payReqData.setOrderNo(RandomUtil.generateOrderNumber(1L, "NC"));
        //订单总金额
        payReqData.setMoney(BigDecimal.valueOf(112));
        payReqData.setMoney(BigDecimal.valueOf(56));
        //子订单数目
        payReqData.setAmount(1);
        //缴费人姓名(单位填单位名称)阿克苏地区博安煤矿安全技术服务中心
        payReqData.setPayerName("阿克苏地区博安煤矿安全技术服务中心");
        payReqData.setPayerName("新疆新发展职业技能培训学校");
        //缴费人证件号(单位填同一信用代码)52652900789893140A
        payReqData.setCertNo("52652900789893140A");
        payReqData.setCertNo("52650104580244545T");
        //缴款人类型(1个人  2单位)
        payReqData.setPayerType(2);
        //开票单位社会信用代码12650000MB1A9612XD
        payReqData.setInvoiceSocialCode("11652300734487567J");
        payReqData.setInvoiceSocialCode("52650104580244545T");
        //开票人
        payReqData.setHandlingPerson("姜倩");
        payReqData.setHandlingPerson("王萌");
        //复核人
        payReqData.setChecker("薄晓洁");
        payReqData.setChecker("马楠");
        //单位编码547185129
        payReqData.setEnterCode("547185129");
        payReqData.setEnterCode("171280272");
        //订单描述(非必填)
        payReqData.setDesc("非煤安全作业理论考试-002002");
        payReqData.setDesc("非煤安全作业考试费_理论-012381");
        //订单明细
        List<PayReqData.Feedata> feedatas1 = new ArrayList<>();
        //数量
        feedatas.setAmount(2);
        feedatas.setAmount(1);
        //业务代码
        feedatas.setBusCode("DZ002002");
        feedatas.setBusCode("DZ012351");
        //单价
        feedatas.setPrice(BigDecimal.valueOf(112));
//        PayReqData.Feedata feedata = new PayReqData.Feedata();
//        feedata.setBusCode("DZ012402");
        feedatas.setPrice(BigDecimal.valueOf(56));
        PayReqData.Feedata feedata = new PayReqData.Feedata();
//        feedata.setBusCode("DZ011574");
//        feedata.setAmount(1);
//        feedata.setPrice(BigDecimal.valueOf(103));
        feedatas1.add(feedatas);
//        feedatas1.add(feedata);
        payReqData.setFeeDatas(feedatas1);
        log.info("请求参数:"+ JSONObject.toJSONString(payReqData));
        log.info("请求参数:" + JSONObject.toJSONString(payReqData));
        PayUtils payUtils = new PayUtils();
        ResultVo resultVo = payUtils.sendApiPost(payReqData);
//        ResultVo resultVo = payUtils.sendApiPost(payReqData);
        ResultVo resultVo = payUtils.faqiV2(payReqData);
        String jsonString = JSONObject.toJSONString(resultVo);
//        log.info("请求结果:"+jsonString);
        String fileData = resultVo.getRespdata().getFileData();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
@@ -37,7 +37,7 @@
    /**
     * 获取部门列表
     */
    @PreAuthorize("@ss.hasPermi('system:dept:list')")
    @PreAuthorize("permitAll()")
    @GetMapping("/list")
    public AjaxResult list(SysDept dept)
    {
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -55,6 +55,9 @@
        <if test="status != null and status != ''">
            AND status = #{status}
        </if>
        <if test="districtCode!=null">
            AND district_code = #{districtCode}
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
        order by d.parent_id, d.order_num