From d30f51ef23798fea6e83859684267cbb133fed9c Mon Sep 17 00:00:00 2001 From: heheng <heheng@123456> Date: 星期一, 20 一月 2025 10:17:31 +0800 Subject: [PATCH] 特种作业非煤缴费版本 --- exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailRepDto.java | 2 exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayTypeEditReqDto.java | 50 ++ exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayCategoryReqDto.java | 5 exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalCategory.java | 32 + exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayStudentReqDto.java | 44 ++ exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayStudent.java | 18 exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayCategoryServiceImpl.java | 4 exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java | 112 +++++ exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayCategoryRepDto.java | 6 exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayService.java | 18 exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml | 220 +++++++++-- exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayStudentDetailRepDto.java | 46 ++ exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml | 99 +++- exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailH5RepDto.java | 36 + exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayStudentService.java | 8 exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayCategoryService.java | 2 exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java | 140 ++++++ exam-system/src/main/resources/mapper/pay/NonCoalPayCategoryMapper.xml | 5 exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java | 146 +++++++ exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayCategory.java | 13 exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayMapper.java | 27 + exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml | 94 +++- exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayPageRepDto.java | 34 + exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java | 8 24 files changed, 1,035 insertions(+), 134 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java b/exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java index 53d99cb..5fed10f 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java @@ -1,17 +1,28 @@ package com.gkhy.exam.pay.controller; +import com.gkhy.exam.pay.dto.rep.NonCoalPayPageRepDto; import com.gkhy.exam.pay.dto.req.NonCoalPayReqDto; +import com.gkhy.exam.pay.dto.req.NonCoalPayStudentReqDto; +import com.gkhy.exam.pay.dto.req.NonCoalPayTypeEditReqDto; import com.gkhy.exam.pay.entity.NonCoalPay; +import com.gkhy.exam.pay.entity.NonCoalPayStudent; import com.gkhy.exam.pay.service.NonCoalPayService; +import com.gkhy.exam.pay.service.NonCoalPayStudentService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.poi.ExcelUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -29,6 +40,9 @@ @Autowired private NonCoalPayService nonCoalPayService; + @Autowired + private NonCoalPayStudentService nonCoalPayStudentService; + /** * 查询非煤缴费管理列表 */ @@ -36,7 +50,8 @@ @ApiOperation(value = "查询非煤缴费管理列表") public TableDataInfo list(NonCoalPay nonCoalPay) { startPage(); - List<NonCoalPay> list = nonCoalPayService.selectNonCoalPayList(nonCoalPay); + + List<NonCoalPayPageRepDto> list = nonCoalPayService.selectNonCoalPayList(nonCoalPay); return getDataTable(list); } @@ -55,17 +70,26 @@ * 获取非煤缴费管理详细信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/getInfo/{id}") @ApiOperation(value = "获取非煤缴费管理详细信息", httpMethod = "GET") @ApiImplicitParam(name = "id", dataTypeClass = Long.class, value = "id", required = true) public AjaxResult getInfo(@PathVariable("id") Long id) { return success(nonCoalPayService.selectNonCoalPayById(id)); } + @GetMapping(value = "/getNonCoalPayStudentByPayId/{id}") + @ApiOperation(value = "获取非煤缴费管理学员相关详细信息", httpMethod = "GET") + @ApiImplicitParam(name = "id", dataTypeClass = Long.class, value = "id", required = true) + public AjaxResult getNonCoalPayStudentByPayId(@PathVariable("id") Long id) { + return success(nonCoalPayService.getNonCoalPayStudentByPayId(id)); + } + + /** * 新增非煤缴费管理 */ @PostMapping("/add") + @PreAuthorize("@ss.hasPermi('noncoal:nonpay:add')") @ApiOperation(value = "新增非煤缴费管理") public AjaxResult add(@Validated @RequestBody NonCoalPayReqDto nonCoalPay) { return toAjax(nonCoalPayService.insertNonCoalPay(nonCoalPay)); @@ -81,12 +105,90 @@ return toAjax(nonCoalPayService.updateNonCoalPay(nonCoalPay)); } + @PostMapping("/editPayTypeInfo") + @ApiOperation(value = "修改非煤缴费类型管理信息") + public AjaxResult updateNonCoalPayType(@Validated @RequestBody NonCoalPayTypeEditReqDto nonCoalPay) { + return toAjax(nonCoalPayService.updateNonCoalPayType(nonCoalPay)); + } + + @GetMapping("/editPayTypeStatus") + @ApiOperation(value = "修改非煤缴费类型状态") + @ApiImplicitParams({ + @ApiImplicitParam(name = "payPersonType", dataTypeClass = Integer.class, value = "缴费类型1个人2团体", required = true), + @ApiImplicitParam(name = "id", dataTypeClass = Long.class, value = "id", required = true), + }) + public AjaxResult updateNonCoalPayTypeStatus(@RequestParam("payPersonType") Integer payPersonType, @RequestParam("id") Long id) { + return toAjax(nonCoalPayService.updateNonCoalPayTypeStatus(payPersonType, id)); + } + /** * 删除非煤缴费管理 */ - @DeleteMapping("/{ids}") + @DeleteMapping("/id") @ApiOperation(value = "删除非煤缴费管理") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(nonCoalPayService.deleteNonCoalPayByIds(ids)); + @ApiImplicitParam(name = "id", dataTypeClass = Long.class, value = "id", required = true) + public AjaxResult remove(@PathVariable Long id) { + return toAjax(nonCoalPayService.deleteNonCoalPayById(id)); } + + + /** + * 新增【请填写功能名称】 + */ + @PostMapping("/addNonCoalStu") + @ApiOperation(value = "新增非煤缴费学员") + public AjaxResult addNonCoalStu(@Validated @RequestBody NonCoalPayStudent nonCoalPayStudent) { + return toAjax(nonCoalPayStudentService.insertNonCoalPayStudent(nonCoalPayStudent)); + } + + /** + * 修改【请填写功能名称】 + */ + @PostMapping("/editNonCoalStu") + @ApiOperation(value = "修改非煤缴费学员") + public AjaxResult editNonCoalStu(@RequestBody NonCoalPayStudent nonCoalPayStudent) { + return toAjax(nonCoalPayStudentService.updateNonCoalPayStudent(nonCoalPayStudent)); + } + + /** + * 删除【请填写功能名称】 + */ + @DeleteMapping("/delNonCalStu/id") + @ApiOperation(value = "删除非煤缴费学员") + @ApiImplicitParam(name = "id", dataTypeClass = Long.class, value = "id", required = true) + public AjaxResult delNonCalStu(@PathVariable Long id) { + return toAjax(nonCoalPayStudentService.deleteNonCoalPayStudentById(id)); + } + + + @PostMapping("/stuImportData") + public AjaxResult importData(MultipartFile file, Long nonCoalPayId) throws Exception { + ExcelUtil<NonCoalPayStudent> util = new ExcelUtil<NonCoalPayStudent>(NonCoalPayStudent.class); + List<NonCoalPayStudent> nonCoalPayStudents = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = nonCoalPayStudentService.importData(nonCoalPayStudents, operName, nonCoalPayId); + return success(message); + } + + @PostMapping("/updateNonCoalStu") + @ApiOperation(value = "更新财政缴款码") + @Anonymous + public AjaxResult updateNonCoalStu(@RequestBody NonCoalPayStudentReqDto nonCoalPayStudent) { + return toAjax(nonCoalPayStudentService.updateNonCoalStu(nonCoalPayStudent)); + } + + + @GetMapping("/nonCoalSelectH5") + @ApiOperation(value = "H5查询缴费信息") + @Anonymous + @ApiImplicitParams({ + @ApiImplicitParam(name = "phone", dataTypeClass = String.class, value = "电话", required = true), + @ApiImplicitParam(name = "idCard", dataTypeClass = String.class, value = "idCard", required = true), + }) + @RepeatSubmit + public AjaxResult nonCoalSelectH5(@RequestParam("phone") String phone, @RequestParam("idCard") String idCard) { + return success(nonCoalPayService.selectNonCoalPayByStu(phone, idCard)); + } + + } diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayCategoryRepDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayCategoryRepDto.java index a1c485e..6e442f9 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayCategoryRepDto.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayCategoryRepDto.java @@ -5,6 +5,7 @@ import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** @@ -37,7 +38,7 @@ private Long categoryId; @ApiModelProperty("类别名称") - private String categoryName; + private String subjectName; /** * 类别1理论2实操 @@ -45,5 +46,8 @@ @ApiModelProperty("类别类型id") private Long categoryType; + @ApiModelProperty("缴费金额") + private BigDecimal categoryAmount; + } \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailH5RepDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailH5RepDto.java new file mode 100644 index 0000000..abf6597 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailH5RepDto.java @@ -0,0 +1,36 @@ +package com.gkhy.exam.pay.dto.rep; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 【请填写功能名称】对象 non_coal_pay + * + * @author hh + * @date 2025-01-16 + */ +@ApiModel(value = "非煤缴费管理对象H5详情", description = "非煤缴费管理对象H5详情") +@Data +public class NonCoalPayDetailH5RepDto extends NonCoalPayDetailRepDto { + private static final long serialVersionUID = 1L; + + + /** + * + */ + @ApiModelProperty("交款人数据id") + private Long nonCoalStudentId; + + @ApiModelProperty("缴费人电话") + private String phone; + + @ApiModelProperty("缴费人身份证号") + private String idCard; + + + @ApiModelProperty("缴费人名称") + private String studentName; + +} \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayRepDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailRepDto.java similarity index 96% rename from exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayRepDto.java rename to exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailRepDto.java index 0a84667..5a4196e 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayRepDto.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayDetailRepDto.java @@ -17,7 +17,7 @@ */ @ApiModel(value = "非煤缴费管理对象详情", description = "非煤缴费管理对象详情") @Data -public class NonCoalPayRepDto implements Serializable { +public class NonCoalPayDetailRepDto implements Serializable { private static final long serialVersionUID = 1L; /** diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayPageRepDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayPageRepDto.java new file mode 100644 index 0000000..94e904e --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayPageRepDto.java @@ -0,0 +1,34 @@ +package com.gkhy.exam.pay.dto.rep; + +import com.gkhy.exam.pay.entity.NonCoalPay; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 【请填写功能名称】对象 non_coal_pay + * + * @author hh + * @date 2025-01-16 + */ +@ApiModel(value = "非煤缴费管理对象列表", description = "非煤缴费管理对象列表") +@Data +public class NonCoalPayPageRepDto extends NonCoalPay { + private static final long serialVersionUID = 1L; + + + @ApiModelProperty("考试点名称") + private String deptName; + + + @ApiModelProperty("地州名称") + private String districtName; + + @ApiModelProperty("总数量") + private Integer totalNum; + + @ApiModelProperty("未缴费数量") + private Integer havePayNum; + +} \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayStudentDetailRepDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayStudentDetailRepDto.java new file mode 100644 index 0000000..6163ca3 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/rep/NonCoalPayStudentDetailRepDto.java @@ -0,0 +1,46 @@ +package com.gkhy.exam.pay.dto.rep; + +import com.gkhy.exam.pay.entity.NonCoalPayStudent; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + + +/** + * 【请填写功能名称】对象 non_coal_pay + * + * @author hh + * @date 2025-01-16 + */ +@ApiModel(value = "非煤缴费管理学员对象详情", description = "非煤缴费管理学员对象详情") +@Data +public class NonCoalPayStudentDetailRepDto extends NonCoalPayDetailRepDto { + private static final long serialVersionUID = 1L; + + + @ApiModelProperty("已缴费数量") + private Integer payCount; + + @ApiModelProperty("未缴费数量") + private Integer unPayCount; + + @ApiModelProperty("总计数量") + private Integer totalCount; + + @ApiModelProperty("已缴费费用") + private BigDecimal payCountFee; + + @ApiModelProperty("未缴费费用") + private BigDecimal unPayCountFee; + + @ApiModelProperty("总计费用") + private BigDecimal totalCountFee; + + + @ApiModelProperty("非煤学员") + private List<NonCoalPayStudent> nonCoalPayStudentList; + +} \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayCategoryReqDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayCategoryReqDto.java index 54755eb..c917562 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayCategoryReqDto.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayCategoryReqDto.java @@ -6,6 +6,7 @@ import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.math.BigDecimal; /** @@ -46,5 +47,9 @@ @ApiModelProperty("类别类型id") private Long categoryType; + @ApiModelProperty("金额") + @NotNull(message = "金额不能为空") + private BigDecimal categoryAmount; + } \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayStudentReqDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayStudentReqDto.java new file mode 100644 index 0000000..6ceaacf --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayStudentReqDto.java @@ -0,0 +1,44 @@ +package com.gkhy.exam.pay.dto.req; + +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + + +/** + * 非煤缴费管理学员对象 non_coal_pay_student + * + * @author hh + * @date 2025-01-16 + */ +@Data +@ApiModel(value = "非煤缴费管理学员缴费回调更新对象", description = "非煤缴费管理学员缴费回调更新对象") +public class NonCoalPayStudentReqDto extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + @NotNull + private Long id; + + @ApiModelProperty("缴费管理id") + private Long nonCoalPayId; + + /** + * 财政缴款码 + */ + @ApiModelProperty("财政缴款码") + private String payCode; + +// /** +// * 是否缴款0否1是 +// */ +// @ApiModelProperty("是否缴款0否1是") +// private Long payStatus; + + +} \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayTypeEditReqDto.java b/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayTypeEditReqDto.java new file mode 100644 index 0000000..57c30db --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/pay/dto/req/NonCoalPayTypeEditReqDto.java @@ -0,0 +1,50 @@ +package com.gkhy.exam.pay.dto.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + + +/** + * 【请填写功能名称】对象 non_coal_pay + * + * @author hh + * @date 2025-01-16 + */ +@ApiModel(value = "非煤缴费修改缴费类型", description = "非煤缴费修改缴费类型") +@Data +public class NonCoalPayTypeEditReqDto implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + @NotNull(message = "参数不能为空") + private Long id; + + /** + * 交款人类型1个人2团体 + */ + @NotNull(message = "交款人类型不能为空") + @ApiModelProperty("交款人类型") + private Integer payPersonType; + + /** + * 缴款单位名称 + */ + @ApiModelProperty("缴款单位证件号") + @NotBlank(message = "缴款单位证件号不能为空") + private String payCompanyName; + + /** + * 缴款单位证件号 + */ + @ApiModelProperty("缴款单位证件号") + @NotBlank(message = "缴款单位证件号不能为空") + private String payCompanyCard; + +} \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalCategory.java b/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalCategory.java index b6dde96..36dc1f9 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalCategory.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalCategory.java @@ -1,6 +1,7 @@ package com.gkhy.exam.pay.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.Excel; @@ -124,6 +125,29 @@ @ApiModelProperty(value = "删除标志", hidden = true) private Integer delFlag; + + @TableField(exist = false) + private String operateTypeName; + + @TableField(exist = false) + private String districtName; + + public String getDistrictName() { + return districtName; + } + + public void setDistrictName(String districtName) { + this.districtName = districtName; + } + + public String getOperateTypeName() { + return operateTypeName; + } + + public void setOperateTypeName(String operateTypeName) { + this.operateTypeName = operateTypeName; + } + public void setId(Long id) { this.id = id; } @@ -172,11 +196,11 @@ return amount; } - public void setBussinessCode(String bussinessCode) { - this.businessCode = bussinessCode; + public void setBusinessCode(String businessCode) { + this.businessCode = businessCode; } - public String getBussinessCode() { + public String getBusinessCode() { return businessCode; } @@ -237,7 +261,7 @@ .append("subjectName", getSubjectName()) .append("operateTypeId", getOperateTypeId()) .append("amount", getAmount()) - .append("bussinessCode", getBussinessCode()) + .append("businessCode", getBusinessCode()) .append("companyCode", getCompanyCode()) .append("drawer", getDrawer()) .append("reviewer", getReviewer()) diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayCategory.java b/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayCategory.java index f01adef..b4fb938 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayCategory.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayCategory.java @@ -11,6 +11,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; import javax.validation.constraints.NotNull; +import java.math.BigDecimal; /** @@ -54,11 +55,23 @@ @ApiModelProperty("类别类型id") private Long categoryType; + @Excel(name = "金额") + @ApiModelProperty("金额") + @NotNull(message = "金额不能为空") + private BigDecimal categoryAmount; /** * 删除标志(0代表存在2代表删除) */ private Integer delFlag; + public BigDecimal getCategoryAmount() { + return categoryAmount; + } + + public void setCategoryAmount(BigDecimal categoryAmount) { + this.categoryAmount = categoryAmount; + } + public void setId(Long id) { this.id = id; } diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayStudent.java b/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayStudent.java index 090264d..2da67a1 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayStudent.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/entity/NonCoalPayStudent.java @@ -34,7 +34,6 @@ /** * 缴费id */ - @Excel(name = "缴费id") @NotNull(message = "参数不能为空") @ApiModelProperty("缴费管理id") private Long nonCoalPayId; @@ -66,23 +65,24 @@ /** * 0男 1女 2未知 */ - @Excel(name = "0男 1女 2未知") - @ApiModelProperty("性别") + @Excel(name = "性别") + @ApiModelProperty("性别 0男1女2未知") private Long sex; /** * 财政缴款码 */ - @Excel(name = "财政缴款码") @ApiModelProperty("财政缴款码") private String payCode; /** * 是否缴款0否1是 */ - @Excel(name = "是否缴款0否1是") @ApiModelProperty("是否缴款") private Long payStatus; + + @ApiModelProperty("缴费类型1个人 2团体") + private Long payType; /** * 删除标志(0代表存在2代表删除) @@ -179,4 +179,12 @@ .append("delFlag", getDelFlag()) .toString(); } + + public Long getPayType() { + return payType; + } + + public void setPayType(Long payType) { + this.payType = payType; + } } \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayMapper.java b/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayMapper.java index 803cbd2..7af9957 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayMapper.java @@ -1,7 +1,11 @@ package com.gkhy.exam.pay.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.exam.pay.dto.rep.NonCoalPayDetailH5RepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayDetailRepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayPageRepDto; import com.gkhy.exam.pay.entity.NonCoalPay; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -12,8 +16,7 @@ * @author hh * @date 2025-01-16 */ -public interface NonCoalPayMapper extends BaseMapper<NonCoalPay> -{ +public interface NonCoalPayMapper extends BaseMapper<NonCoalPay> { /** * 查询【请填写功能名称】 * @@ -23,12 +26,30 @@ public NonCoalPay selectNonCoalPayById(Long id); /** + * 获取详情 + * + * @return + */ + NonCoalPayDetailRepDto getNonCoalPayById(Long id); + + /** + * H5查询 + * + * @param phone + * @param idCard + * @return + */ + NonCoalPayDetailH5RepDto selectNonCoalPayByParam(@Param("phone") String phone, @Param("idCard") String idCard); + + /** * 查询【请填写功能名称】列表 * * @param nonCoalPay 【请填写功能名称】 * @return 【请填写功能名称】集合 */ public List<NonCoalPay> selectNonCoalPayList(NonCoalPay nonCoalPay); + + List<NonCoalPayPageRepDto> getNonCoalPayList(NonCoalPay nonCoalPay); /** * 新增【请填写功能名称】 @@ -52,7 +73,7 @@ * @param id 【请填写功能名称】主键 * @return 结果 */ - public int deleteNonCoalPayById(Long id); + public int deleteNonCoalPayById(@Param("id") Long id, @Param("updateBy") String updateBy); /** * 批量删除【请填写功能名称】 diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java b/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java index fae957e..bbd6c53 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/mapper/NonCoalPayStudentMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.pay.entity.NonCoalPayStudent; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -12,8 +13,7 @@ * @author hh * @date 2025-01-16 */ -public interface NonCoalPayStudentMapper extends BaseMapper<NonCoalPayStudent> -{ +public interface NonCoalPayStudentMapper extends BaseMapper<NonCoalPayStudent> { /** * 查询【请填写功能名称】 * @@ -46,13 +46,15 @@ */ public int updateNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent); + int updateNonCoalPayStudentType(@Param("id") Long id, @Param("updateBy") String updateBy); + /** * 删除【请填写功能名称】 * * @param id 【请填写功能名称】主键 * @return 结果 */ - public int deleteNonCoalPayStudentById(Long id); + public int deleteNonCoalPayStudentById(@Param("id") Long id, @Param("updateBy") String updateBy); /** * 批量删除【请填写功能名称】 diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayCategoryService.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayCategoryService.java index e4e0f78..2207e05 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayCategoryService.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayCategoryService.java @@ -20,7 +20,7 @@ */ public NonCoalPayCategory selectNonCoalPayCategoryById(Long id); - int saveBacth(List<NonCoalPayCategory> list); + boolean saveBatchData(List<NonCoalPayCategory> list); /** * 查询非煤缴费种类关联列表 diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayService.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayService.java index 2e3f4f4..4eef09d 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayService.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayService.java @@ -1,7 +1,12 @@ package com.gkhy.exam.pay.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.pay.dto.rep.NonCoalPayDetailH5RepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayDetailRepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayPageRepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayStudentDetailRepDto; import com.gkhy.exam.pay.dto.req.NonCoalPayReqDto; +import com.gkhy.exam.pay.dto.req.NonCoalPayTypeEditReqDto; import com.gkhy.exam.pay.entity.NonCoalPay; import java.util.List; @@ -19,7 +24,10 @@ * @param id 【请填写功能名称】主键 * @return 【请填写功能名称】 */ - public NonCoalPay selectNonCoalPayById(Long id); + public NonCoalPayDetailRepDto selectNonCoalPayById(Long id); + + + NonCoalPayDetailH5RepDto selectNonCoalPayByStu(String phone, String idCard); /** * 查询【请填写功能名称】列表 @@ -27,7 +35,9 @@ * @param nonCoalPay 【请填写功能名称】 * @return 【请填写功能名称】集合 */ - public List<NonCoalPay> selectNonCoalPayList(NonCoalPay nonCoalPay); + public List<NonCoalPayPageRepDto> selectNonCoalPayList(NonCoalPay nonCoalPay); + + NonCoalPayStudentDetailRepDto getNonCoalPayStudentByPayId(Long id); /** * 新增【请填写功能名称】 @@ -45,6 +55,10 @@ */ public int updateNonCoalPay(NonCoalPayReqDto nonCoalPay); + public int updateNonCoalPayType(NonCoalPayTypeEditReqDto nonCoalPay); + + public int updateNonCoalPayTypeStatus(int payPersonType, Long id); + /** * 批量删除【请填写功能名称】 * diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayStudentService.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayStudentService.java index 65b4097..79d879f 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayStudentService.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/NonCoalPayStudentService.java @@ -1,6 +1,7 @@ package com.gkhy.exam.pay.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.pay.dto.req.NonCoalPayStudentReqDto; import com.gkhy.exam.pay.entity.NonCoalPayStudent; import java.util.List; @@ -19,6 +20,7 @@ * @return 【请填写功能名称】 */ public NonCoalPayStudent selectNonCoalPayStudentById(Long id); + /** * 查询【请填写功能名称】列表 @@ -44,6 +46,10 @@ */ public int updateNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent); + int updateNonCoalStu(NonCoalPayStudentReqDto nonCoalPayStudent); + + void checkHavePayData(Long nonPayId); + /** * 批量删除【请填写功能名称】 * @@ -59,4 +65,6 @@ * @return 结果 */ public int deleteNonCoalPayStudentById(Long id); + + public String importData(List<NonCoalPayStudent> nonCoalPayStudents, String operName, Long nonCoalPayId); } \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayCategoryServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayCategoryServiceImpl.java index 8582e0f..f0a5c28 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayCategoryServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayCategoryServiceImpl.java @@ -34,8 +34,8 @@ } @Override - public int saveBacth(List<NonCoalPayCategory> list) { - return saveBacth(list); + public boolean saveBatchData(List<NonCoalPayCategory> list) { + return saveBatch(list); } /** diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java index c0f46c7..30bf5de 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java @@ -1,13 +1,23 @@ package com.gkhy.exam.pay.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.pay.dto.rep.NonCoalPayDetailH5RepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayDetailRepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayPageRepDto; +import com.gkhy.exam.pay.dto.rep.NonCoalPayStudentDetailRepDto; import com.gkhy.exam.pay.dto.req.NonCoalPayCategoryReqDto; import com.gkhy.exam.pay.dto.req.NonCoalPayReqDto; +import com.gkhy.exam.pay.dto.req.NonCoalPayTypeEditReqDto; import com.gkhy.exam.pay.entity.NonCoalPay; import com.gkhy.exam.pay.entity.NonCoalPayCategory; +import com.gkhy.exam.pay.entity.NonCoalPayStudent; import com.gkhy.exam.pay.mapper.NonCoalPayMapper; +import com.gkhy.exam.pay.mapper.NonCoalPayStudentMapper; import com.gkhy.exam.pay.service.NonCoalPayCategoryService; import com.gkhy.exam.pay.service.NonCoalPayService; +import com.gkhy.exam.pay.service.NonCoalPayStudentService; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.bean.BeanUtils; @@ -15,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -31,6 +42,10 @@ private NonCoalPayMapper nonCoalPayMapper; @Resource private NonCoalPayCategoryService nonCoalPayCategoryService; + @Resource + private NonCoalPayStudentService nonCoalPayStudentService; + @Resource + private NonCoalPayStudentMapper nonCoalPayStudentMapper; /** * 查询【请填写功能名称】 @@ -39,8 +54,13 @@ * @return 【请填写功能名称】 */ @Override - public NonCoalPay selectNonCoalPayById(Long id) { - return nonCoalPayMapper.selectNonCoalPayById(id); + public NonCoalPayDetailRepDto selectNonCoalPayById(Long id) { + return nonCoalPayMapper.getNonCoalPayById(id); + } + + @Override + public NonCoalPayDetailH5RepDto selectNonCoalPayByStu(String phone, String idCard) { + return nonCoalPayMapper.selectNonCoalPayByParam(phone, idCard); } @@ -51,8 +71,46 @@ * @return 【请填写功能名称】 */ @Override - public List<NonCoalPay> selectNonCoalPayList(NonCoalPay nonCoalPay) { - return nonCoalPayMapper.selectNonCoalPayList(nonCoalPay); + public List<NonCoalPayPageRepDto> selectNonCoalPayList(NonCoalPay nonCoalPay) { + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { + nonCoalPay.setDistrictCode(SecurityUtils.getDeptDistrictCode()); + } + return nonCoalPayMapper.getNonCoalPayList(nonCoalPay); + } + + @Override + public NonCoalPayStudentDetailRepDto getNonCoalPayStudentByPayId(Long id) { + NonCoalPayDetailRepDto nonCoalPayById = nonCoalPayMapper.getNonCoalPayById(id); + NonCoalPayStudentDetailRepDto data = new NonCoalPayStudentDetailRepDto(); + if (nonCoalPayById != null) { + BeanUtils.copyProperties(nonCoalPayById, data); + NonCoalPayStudent student = new NonCoalPayStudent(); + student.setNonCoalPayId(nonCoalPayById.getId()); + List<NonCoalPayStudent> nonCoalPayStudents = nonCoalPayStudentService.selectNonCoalPayStudentList(student); + data.setNonCoalPayStudentList(nonCoalPayStudents); + if (nonCoalPayStudents != null && !nonCoalPayStudents.isEmpty()) { + int payCount = (int) nonCoalPayStudents.stream() + .filter(stu -> stu.getPayStatus() == 1) + .count(); + int size = nonCoalPayStudents.size(); + data.setPayCount(payCount); + data.setUnPayCount(size - payCount); + data.setTotalCount(size); + data.setPayCountFee(new BigDecimal(payCount).multiply(data.getAmount())); + data.setUnPayCountFee(new BigDecimal(size - payCount).multiply(data.getAmount())); + data.setTotalCountFee(new BigDecimal(size).multiply(data.getAmount())); + } else { + data.setPayCount(0); + data.setUnPayCount(0); + data.setTotalCount(0); + data.setPayCountFee(new BigDecimal(0)); + data.setUnPayCountFee(new BigDecimal(0)); + data.setTotalCountFee(new BigDecimal(0)); + } + + return data; + } + return null; } /** @@ -64,27 +122,46 @@ @Override @Transactional public int insertNonCoalPay(NonCoalPayReqDto nonCoalPay) { - //todo 校验 + checkData(nonCoalPay); NonCoalPay nonCoalPay1 = new NonCoalPay(); BeanUtils.copyProperties(nonCoalPay, nonCoalPay1); nonCoalPay1.setCreateBy(SecurityUtils.getUsername()); int i = nonCoalPayMapper.insertNonCoalPay(nonCoalPay1); if (i > 0) { - saveNonCoalPayCategory(nonCoalPay.getNonCoalPayCategoryList()); + saveNonCoalPayCategory(nonCoalPay.getNonCoalPayCategoryList(), nonCoalPay1.getId()); } return i; } - private void saveNonCoalPayCategory(List<NonCoalPayCategoryReqDto> nonCoalPayCategoryList) { + private void saveNonCoalPayCategory(List<NonCoalPayCategoryReqDto> nonCoalPayCategoryList, Long id) { List<NonCoalPayCategory> nonCoalPayCategories = new ArrayList<>(); for (NonCoalPayCategoryReqDto nonCoalPayCategory : nonCoalPayCategoryList) { NonCoalPayCategory nonCoalPayCategory1 = new NonCoalPayCategory(); BeanUtils.copyProperties(nonCoalPayCategory, nonCoalPayCategory1); + nonCoalPayCategory1.setNonCoalPayId(id); nonCoalPayCategory1.setCreateBy(SecurityUtils.getUsername()); nonCoalPayCategories.add(nonCoalPayCategory1); } - nonCoalPayCategoryService.saveBacth(nonCoalPayCategories); + boolean b = nonCoalPayCategoryService.saveBatchData(nonCoalPayCategories); + if (!b) { + throw new ServiceException("保存失败"); + } + } + + + private void checkData(NonCoalPayReqDto nonCoalPay) { + LambdaQueryWrapper<NonCoalPay> lambdaQueryWrapper = Wrappers.<NonCoalPay>lambdaQuery() + .eq(NonCoalPay::getDistrictCode, nonCoalPay.getDistrictCode()) + .eq(NonCoalPay::getBatchName, nonCoalPay.getBatchName()) + .eq(NonCoalPay::getDelFlag, 0); + if (nonCoalPay.getId() == null) { + lambdaQueryWrapper.ne(NonCoalPay::getId, nonCoalPay.getId()); + } + Long l = baseMapper.selectCount(lambdaQueryWrapper); + if (l > 0) { + throw new ServiceException("该批次已存在"); + } } /** @@ -96,7 +173,8 @@ @Override @Transactional public int updateNonCoalPay(NonCoalPayReqDto nonCoalPay) { - //todo 校验 + checkData(nonCoalPay); + checkHavePay(nonCoalPay.getId()); NonCoalPay nonCoalPay1 = new NonCoalPay(); BeanUtils.copyProperties(nonCoalPay, nonCoalPay1); nonCoalPay1.setUpdateBy(SecurityUtils.getUsername()); @@ -106,7 +184,37 @@ if (i1 < 1) { throw new ServiceException("更新失败"); } - saveNonCoalPayCategory(nonCoalPay.getNonCoalPayCategoryList()); + saveNonCoalPayCategory(nonCoalPay.getNonCoalPayCategoryList(), nonCoalPay1.getId()); + } + return i; + } + + @Override + public int updateNonCoalPayType(NonCoalPayTypeEditReqDto nonCoalPay) { + NonCoalPay nonCoalPay1 = new NonCoalPay(); + BeanUtils.copyProperties(nonCoalPay, nonCoalPay1); + nonCoalPay1.setUpdateBy(SecurityUtils.getUsername()); + return nonCoalPayMapper.updateNonCoalPay(nonCoalPay1); + } + + @Override + @Transactional + public int updateNonCoalPayTypeStatus(int payPersonType, Long id) { + NonCoalPay byId = getById(id); + if (byId == null) { + throw new ServiceException("该数据不存在"); + } + if (byId.getPayPersonType() == 2) { + throw new ServiceException("已是团体缴费不可变更缴费方式!"); + } + NonCoalPay nonCoalPay1 = new NonCoalPay(); + nonCoalPay1.setPayPersonType(payPersonType); + nonCoalPay1.setId(id); + nonCoalPay1.setUpdateBy(SecurityUtils.getUsername()); + int i = nonCoalPayMapper.updateNonCoalPay(nonCoalPay1); + if (payPersonType == 2) { + //更新未缴费的为团体 + nonCoalPayStudentMapper.updateNonCoalPayStudentType(id, SecurityUtils.getUsername()); } return i; } @@ -130,6 +238,16 @@ */ @Override public int deleteNonCoalPayById(Long id) { - return nonCoalPayMapper.deleteNonCoalPayById(id); + NonCoalPay byId = getById(id); + if (byId == null) { + throw new ServiceException("该数据不存在"); + } + //验证是否有学员已缴费 + checkHavePay(id); + return nonCoalPayMapper.deleteNonCoalPayById(id, SecurityUtils.getUsername()); + } + + private void checkHavePay(Long id) { + nonCoalPayStudentService.checkHavePayData(id); } } \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java index 86af351..5ca08df 100644 --- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java @@ -1,14 +1,23 @@ package com.gkhy.exam.pay.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.pay.dto.req.NonCoalPayStudentReqDto; import com.gkhy.exam.pay.entity.NonCoalPayStudent; import com.gkhy.exam.pay.mapper.NonCoalPayStudentMapper; import com.gkhy.exam.pay.service.NonCoalPayStudentService; -import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** @@ -33,6 +42,7 @@ return nonCoalPayStudentMapper.selectNonCoalPayStudentById(id); } + /** * 查询【请填写功能名称】列表 * @@ -52,7 +62,8 @@ */ @Override public int insertNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent) { - nonCoalPayStudent.setCreateTime(DateUtils.getNowDate()); + checkSameData(nonCoalPayStudent); + nonCoalPayStudent.setCreateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.insertNonCoalPayStudent(nonCoalPayStudent); } @@ -64,9 +75,63 @@ */ @Override public int updateNonCoalPayStudent(NonCoalPayStudent nonCoalPayStudent) { - nonCoalPayStudent.setUpdateTime(DateUtils.getNowDate()); + checkData(nonCoalPayStudent.getId()); + checkSameData(nonCoalPayStudent); + nonCoalPayStudent.setUpdateBy(SecurityUtils.getUsername()); return nonCoalPayStudentMapper.updateNonCoalPayStudent(nonCoalPayStudent); } + + @Override + public int updateNonCoalStu(NonCoalPayStudentReqDto nonCoalPayStudent) { + + if (nonCoalPayStudent.getId() != null) { + NonCoalPayStudent nonCoalPayStudent1 = selectNonCoalPayStudentById(nonCoalPayStudent.getId()); + if (nonCoalPayStudent1 != null) { + nonCoalPayStudent1.setPayCode(nonCoalPayStudent.getPayCode()); + nonCoalPayStudent1.setPayStatus(1L); + nonCoalPayStudent1.setUpdateBy(SecurityUtils.getUsername()); + } else { + log.error("修改缴费学员失败,该缴费学员不存在:" + nonCoalPayStudent.getId()); + } + } else { + if (nonCoalPayStudent.getNonCoalPayId() != null) { + baseMapper.update(null, Wrappers.<NonCoalPayStudent>lambdaUpdate() + .set(NonCoalPayStudent::getUpdateBy, SecurityUtils.getUsername()) + .set(NonCoalPayStudent::getPayCode, nonCoalPayStudent.getPayCode()) + .set(NonCoalPayStudent::getPayStatus, 1L) + .eq(NonCoalPayStudent::getNonCoalPayId, nonCoalPayStudent.getNonCoalPayId()) + .eq(NonCoalPayStudent::getPayStatus, 0L).eq(NonCoalPayStudent::getDelFlag, 0)); + } + } + return 0; + } + + private void checkSameData(NonCoalPayStudent nonCoalPay) { + LambdaQueryWrapper<NonCoalPayStudent> lambdaQueryWrapper = Wrappers.<NonCoalPayStudent>lambdaQuery() + .eq(NonCoalPayStudent::getNonCoalPayId, nonCoalPay.getNonCoalPayId()) + .eq(NonCoalPayStudent::getIdCard, nonCoalPay.getIdCard()) + .eq(NonCoalPayStudent::getDelFlag, 0); + if (nonCoalPay.getId() == null) { + lambdaQueryWrapper.ne(NonCoalPayStudent::getId, nonCoalPay.getId()); + } + Long l = baseMapper.selectCount(lambdaQueryWrapper); + if (l > 0) { + throw new ServiceException("该缴费学员已存在"); + } + } + + @Override + public void checkHavePayData(Long nonPayId) { + LambdaQueryWrapper<NonCoalPayStudent> lambdaQueryWrapper = Wrappers.<NonCoalPayStudent>lambdaQuery() + .eq(NonCoalPayStudent::getNonCoalPayId, nonPayId) + .eq(NonCoalPayStudent::getDelFlag, 0).eq(NonCoalPayStudent::getPayStatus, 1L); + + Long l = baseMapper.selectCount(lambdaQueryWrapper); + if (l > 0) { + throw new ServiceException("已开始缴费不可修改"); + } + } + /** * 批量删除【请填写功能名称】 @@ -87,6 +152,79 @@ */ @Override public int deleteNonCoalPayStudentById(Long id) { - return nonCoalPayStudentMapper.deleteNonCoalPayStudentById(id); + checkData(id); + return nonCoalPayStudentMapper.deleteNonCoalPayStudentById(id, SecurityUtils.getUsername()); + } + + @Override + public String importData(List<NonCoalPayStudent> nonCoalPayStudents, String operName, Long nonCoalPayId) { + if (StringUtils.isNull(nonCoalPayStudents) || nonCoalPayStudents.isEmpty()) { + throw new ServiceException("导入数据不能为空!"); + } + + Set<String> collect = nonCoalPayStudents.stream() + .map(NonCoalPayStudent::getIdCard) + .collect(Collectors.toSet()); + if (collect.size() != nonCoalPayStudents.size()) { + throw new ServiceException("导入数据不能有重复身份证号!"); + } + Map<String, String> idCardToNameMap = new HashMap<>(); + NonCoalPayStudent student = new NonCoalPayStudent(); + student.setNonCoalPayId(nonCoalPayId); + + List<NonCoalPayStudent> nonCoalPayStudents1 = nonCoalPayStudentMapper.selectNonCoalPayStudentList(student); + if (nonCoalPayStudents1 != null && !nonCoalPayStudents1.isEmpty()) { + idCardToNameMap = nonCoalPayStudents1.stream() + .collect(Collectors.toMap( + NonCoalPayStudent::getIdCard, + NonCoalPayStudent::getIdCard + )); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (NonCoalPayStudent stu : nonCoalPayStudents) { + try { + if (idCardToNameMap.get(stu.getIdCard().trim()) != null) { + failureMsg.append("<br/>" + failureNum + "、身份证号: " + stu.getIdCard() + " 数据已存在"); + } else { + stu.setPayType(1L); + stu.setPayStatus(0L); + stu.setNonCoalPayId(nonCoalPayId); + save(stu); + successNum++; + successMsg.append("<br/>" + successNum + "、身份证号 " + stu.getIdCard() + " 导入成功"); + idCardToNameMap.put(stu.getIdCard(), stu.getIdCard()); + } + + } catch (Exception e) { + failureNum++; + String msg = "<br/>" + failureNum + "、身份证号 " + stu.getIdCard() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } else { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } + + private NonCoalPayStudent checkData(Long id) { + NonCoalPayStudent byId = getById(id); + if (byId == null) { + throw new RuntimeException("该数据不存在"); + } + if (byId.getDelFlag() == 2) { + throw new RuntimeException("该数据已删除"); + } + if (byId.getPayStatus() == 1) { + throw new RuntimeException("该数据已缴费,不可操作"); + } + return byId; } } \ No newline at end of file diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml index 4d36750..f44bd8b 100644 --- a/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml +++ b/exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml @@ -21,6 +21,13 @@ <result property="updateTime" column="update_time"/> <result property="createBy" column="create_by"/> <result property="createTime" column="create_time"/> + <result property="operateTypeName" column="operate_type_name"/> + <result property="districtName" column="district_name"/> + </resultMap> + + <resultMap type="NonCoalCategory" id="NonCoalCategoryResultVO" extends="NonCoalCategoryResult"> + <result property="operateTypeName" column="operate_type_name"/> + </resultMap> <sql id="selectNonCoalCategoryVo"> @@ -30,38 +37,90 @@ subject_name, operate_type_id, amount, - bussiness_code, + business_code, company_code, drawer, reviewer, - invoicing_company_code, describe, update_by, update_time, create_by, create_time + invoicing_company_code, + `describe`, + update_by, + update_time, + create_by, + create_time from non_coal_category </sql> <select id="selectNonCoalCategoryList" parameterType="NonCoalCategory" resultMap="NonCoalCategoryResult"> - <include refid="selectNonCoalCategoryVo"/> + select a.id, + a.district_code, + a.category_type, + a.subject_name, + a.operate_type_id, + a.amount, + a.business_code, + a.company_code, + a.drawer, + a.reviewer, + a.invoicing_company_code, + a.`describe`, + a.update_by, + a.update_time, + a.create_by, + a.create_time, + (SELECT GROUP_CONCAT(name SEPARATOR '/') FROM sys_operate_type + WHERE FIND_IN_SET(id, (SELECT ancestors FROM sys_operate_type WHERE id = a.operate_type_id)) or id = + a.operate_type_id ) operate_type_name, + b.name district_name + from non_coal_category a + left join sys_district b on a.district_code = b.code <where> - <if test="districtCode != null and districtCode != ''">and district_code = #{districtCode}</if> - <if test="categoryType != null ">and category_type = #{categoryType}</if> - <if test="subjectName != null and subjectName != ''">and subject_name like concat('%', #{subjectName}, + and a.del_flag = 0 + <if test="districtCode != null and districtCode != ''">and a.district_code = #{districtCode}</if> + <if test="categoryType != null ">and a.category_type = #{categoryType}</if> + <if test="subjectName != null and subjectName != ''">and a.subject_name like concat('%', #{subjectName}, '%') </if> - <if test="operateTypeId != null ">and operate_type_id = #{operateTypeId}</if> - <if test="amount != null ">and amount = #{amount}</if> - <if test="bussinessCode != null and bussinessCode != ''">and bussiness_code = #{bussinessCode}</if> - <if test="companyCode != null and companyCode != ''">and company_code = #{companyCode}</if> - <if test="drawer != null and drawer != ''">and drawer = #{drawer}</if> - <if test="reviewer != null and reviewer != ''">and reviewer = #{reviewer}</if> - <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">and invoicing_company_code = + <if test="operateTypeId != null ">and a.operate_type_id = #{operateTypeId}</if> + <if test="amount != null ">and a.amount = #{amount}</if> + <if test="bussinessCode != null and bussinessCode != ''">and a.business_code = #{bussinessCode}</if> + <if test="companyCode != null and companyCode != ''">and a.company_code = #{companyCode}</if> + <if test="drawer != null and drawer != ''">and a.drawer = #{drawer}</if> + <if test="reviewer != null and reviewer != ''">and a.reviewer = #{reviewer}</if> + <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">and a.invoicing_company_code = #{invoicingCompanyCode} </if> - <if test="describe != null and describe != ''">and describe = #{describe}</if> + <if test="describe != null and describe != ''">and a.`describe` = #{describe}</if> </where> + order by create_time desc </select> <select id="selectNonCoalCategoryById" parameterType="Long" resultMap="NonCoalCategoryResult"> - <include refid="selectNonCoalCategoryVo"/> - where id = #{id} + select a.id, + a.district_code, + a.category_type, + a.subject_name, + a.operate_type_id, + a.amount, + a.business_code, + a.company_code, + a.drawer, + a.reviewer, + a.invoicing_company_code, + a.`describe`, + a.update_by, + a.update_time, + a.create_by, + a.create_time, + (SELECT GROUP_CONCAT(name SEPARATOR '/') + FROM sys_operate_type + WHERE FIND_IN_SET(id, (SELECT ancestors FROM sys_operate_type WHERE id = a.operate_type_id)) + or id = + a.operate_type_id) operate_type_name, + b.name district_name + from non_coal_category a + left join sys_district b on a.district_code = b.code + + where a.id = #{id} </select> <insert id="insertNonCoalCategory" parameterType="NonCoalCategory" useGeneratedKeys="true" keyProperty="id"> @@ -72,12 +131,12 @@ <if test="subjectName != null and subjectName != ''">subject_name,</if> <if test="operateTypeId != null">operate_type_id,</if> <if test="amount != null">amount,</if> - <if test="bussinessCode != null and bussinessCode != ''">bussiness_code,</if> + <if test="bussinessCode != null and bussinessCode != ''">business_code,</if> <if test="companyCode != null and companyCode != ''">company_code,</if> <if test="drawer != null and drawer != ''">drawer,</if> <if test="reviewer != null and reviewer != ''">reviewer,</if> <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">invoicing_company_code,</if> - <if test="describe != null">describe,</if> + <if test="describe != null">`describe`,</if> <if test="updateBy != null">update_by,</if> <if test="updateTime != null">update_time,</if> <if test="createBy != null">create_by,</if> @@ -112,14 +171,14 @@ <if test="subjectName != null and subjectName != ''">subject_name = #{subjectName},</if> <if test="operateTypeId != null">operate_type_id = #{operateTypeId},</if> <if test="amount != null">amount = #{amount},</if> - <if test="bussinessCode != null and bussinessCode != ''">bussiness_code = #{bussinessCode},</if> + <if test="bussinessCode != null and bussinessCode != ''">business_code = #{bussinessCode},</if> <if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if> <if test="drawer != null and drawer != ''">drawer = #{drawer},</if> <if test="reviewer != null and reviewer != ''">reviewer = #{reviewer},</if> <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">invoicing_company_code = #{invoicingCompanyCode}, </if> - <if test="describe != null">describe = #{describe},</if> + <if test="describe != null">`describe` = #{describe},</if> <if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateTime != null">update_time = #{updateTime},</if> <if test="createBy != null">create_by = #{createBy},</if> diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalPayCategoryMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalPayCategoryMapper.xml index abe1aa5..c836dcc 100644 --- a/exam-system/src/main/resources/mapper/pay/NonCoalPayCategoryMapper.xml +++ b/exam-system/src/main/resources/mapper/pay/NonCoalPayCategoryMapper.xml @@ -9,6 +9,7 @@ <result property="nonCoalPayId" column="non_coal_pay_id"/> <result property="categoryId" column="category_id"/> <result property="categoryType" column="category_type"/> + <result property="categoryAmount" column="category_amount"/> <result property="updateBy" column="update_by"/> <result property="updateTime" column="update_time"/> <result property="createBy" column="create_by"/> @@ -21,6 +22,7 @@ non_coal_pay_id, category_id, category_type, + category_amount, update_by, update_time, create_by, @@ -50,6 +52,7 @@ <if test="nonCoalPayId != null">non_coal_pay_id,</if> <if test="categoryId != null">category_id,</if> <if test="categoryType != null">category_type,</if> + <if test="categoryAmount != null">category_amount,</if> <if test="updateBy != null">update_by,</if> <if test="updateTime != null">update_time,</if> <if test="createBy != null">create_by,</if> @@ -61,6 +64,7 @@ <if test="nonCoalPayId != null">#{nonCoalPayId},</if> <if test="categoryId != null">#{categoryId},</if> <if test="categoryType != null">#{categoryType},</if> + <if test="categoryAmount != null">#{categoryAmount},</if> <if test="updateBy != null">#{updateBy},</if> <if test="updateTime != null">#{updateTime},</if> <if test="createBy != null">#{createBy},</if> @@ -75,6 +79,7 @@ <if test="nonCoalPayId != null">non_coal_pay_id = #{nonCoalPayId},</if> <if test="categoryId != null">category_id = #{categoryId},</if> <if test="categoryType != null">category_type = #{categoryType},</if> + <if test="categoryAmount != null">category_amount = #{categoryAmount},</if> <if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateTime != null">update_time = #{updateTime},</if> <if test="createBy != null">create_by = #{createBy},</if> diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml index 3016cea..1452f5f 100644 --- a/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml +++ b/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml @@ -1,52 +1,189 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.pay.mapper.NonCoalPayMapper"> - + <resultMap type="NonCoalPay" id="NonCoalPayResult"> - <result property="id" column="id" /> - <result property="batchName" column="batch_name" /> - <result property="deptId" column="dept_id" /> - <result property="districtCode" column="district_code" /> - <result property="payType" column="pay_type" /> - <result property="amount" column="amount" /> - <result property="year" column="year" /> - <result property="quarter" column="quarter" /> - <result property="payPersonType" column="pay_person_type" /> - <result property="payCompanyName" column="pay_company_name" /> - <result property="payCompanyCard" column="pay_company_card" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="delFlag" column="del_flag" /> + <result property="id" column="id"/> + <result property="batchName" column="batch_name"/> + <result property="deptId" column="dept_id"/> + <result property="districtCode" column="district_code"/> + <result property="payType" column="pay_type"/> + <result property="amount" column="amount"/> + <result property="year" column="year"/> + <result property="quarter" column="quarter"/> + <result property="payPersonType" column="pay_person_type"/> + <result property="payCompanyName" column="pay_company_name"/> + <result property="payCompanyCard" column="pay_company_card"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="delFlag" column="del_flag"/> + </resultMap> + <resultMap id="NonCoalPayPageResult" type="com.gkhy.exam.pay.dto.rep.NonCoalPayPageRepDto" + extends="NonCoalPayResult"> + <result property="deptName" column="dept_name"/> + <result property="districtName" column="district_name"/> + <result property="totalNum" column="total_num"/> + <result property="havePayNum" column="have_pay_num"/> </resultMap> + <resultMap type="com.gkhy.exam.pay.dto.rep.NonCoalPayDetailRepDto" id="getNonCoalPayResult"> + <result property="id" column="id"/> + <result property="batchName" column="batch_name"/> + <result property="deptId" column="dept_id"/> + <result property="deptName" column="dept_name"/> + <result property="districtCode" column="district_code"/> + <result property="districtName" column="district_name"/> + <result property="payType" column="pay_type"/> + <result property="amount" column="amount"/> + <result property="year" column="year"/> + <result property="quarter" column="quarter"/> + <collection property="nonCoalPayCategoryList" javaType="java.util.List" resultMap="nonCoalPayCategoryList"/> + </resultMap> + <resultMap id="nonCoalPayCategoryList" type="com.gkhy.exam.pay.dto.rep.NonCoalPayCategoryRepDto"> + <result property="id" column="non_category_id"/> + <result property="nonCoalPayId" column="non_coal_pay_id"/> + <result property="categoryId" column="category_id"/> + <result property="subjectName" column="subject_name"/> + <result property="categoryType" column="category_type"/> + <result property="categoryAmount" column="category_amount"/> + </resultMap> + + <resultMap id="getNonCoalPayResultH5" type="com.gkhy.exam.pay.dto.rep.NonCoalPayDetailH5RepDto"> + <result property="nonCoalStudentId" column="non_coal_student_id"/> + <result property="phone" column="phone"/> + <result property="idCard" column="id_card"/> + <result property="studentName" column="student_name"/> + + </resultMap> + + <sql id="selectNonCoalPayVo"> - select id, batch_name, dept_id, district_code, pay_type, amount, year, quarter, pay_person_type, pay_company_name, pay_company_card, update_by, update_time, create_by, create_time, del_flag from non_coal_pay + select id, + batch_name, + dept_id, + district_code, + pay_type, + amount, year, quarter, pay_person_type, pay_company_name, pay_company_card, update_by, update_time, create_by, create_time, del_flag + from non_coal_pay </sql> <select id="selectNonCoalPayList" parameterType="NonCoalPay" resultMap="NonCoalPayResult"> <include refid="selectNonCoalPayVo"/> - <where> - <if test="batchName != null and batchName != ''"> and batch_name like concat('%', #{batchName}, '%')</if> - <if test="deptId != null "> and dept_id = #{deptId}</if> - <if test="districtCode != null and districtCode != ''"> and district_code = #{districtCode}</if> - <if test="payType != null "> and pay_type = #{payType}</if> - <if test="amount != null "> and amount = #{amount}</if> - <if test="year != null and year != ''"> and year = #{year}</if> - <if test="quarter != null "> and quarter = #{quarter}</if> - <if test="payPersonType != null "> and pay_person_type = #{payPersonType}</if> - <if test="payCompanyName != null and payCompanyName != ''"> and pay_company_name like concat('%', #{payCompanyName}, '%')</if> - <if test="payCompanyCard != null and payCompanyCard != ''"> and pay_company_card = #{payCompanyCard}</if> + <where> + <if test="batchName != null and batchName != ''">and batch_name like concat('%', #{batchName}, '%')</if> + <if test="deptId != null ">and dept_id = #{deptId}</if> + <if test="districtCode != null and districtCode != ''">and district_code = #{districtCode}</if> + <if test="payType != null ">and pay_type = #{payType}</if> + <if test="amount != null ">and amount = #{amount}</if> + <if test="year != null and year != ''">and year = #{year}</if> + <if test="quarter != null ">and quarter = #{quarter}</if> + <if test="payPersonType != null ">and pay_person_type = #{payPersonType}</if> + <if test="payCompanyName != null and payCompanyName != ''">and pay_company_name like concat('%', + #{payCompanyName}, '%') + </if> + <if test="payCompanyCard != null and payCompanyCard != ''">and pay_company_card = #{payCompanyCard}</if> </where> </select> - + + + <select id="getNonCoalPayList" parameterType="NonCoalPay" resultMap="NonCoalPayPageResult"> + select a.id, + a.batch_name, + a.dept_id, + a.district_code, + d.dept_name , + d2.name as district_name, + a.pay_type, + a.amount, a.year, a.quarter, a.pay_person_type, a.pay_company_name, a.pay_company_card, a.update_by, + a.update_time, a.create_by, a.create_time, (select count(id) from non_coal_pay_student where a.id = + non_coal_pay_id) as total_num, + (select count(id) from non_coal_pay_student where a.id = non_coal_pay_id and pay_status = 1) as have_pay_num + from non_coal_pay a + left join sys_dept d on a.dept_id = d.dept_id + left join sys_district d2 on a.district_code = d2.code + where 1=1 and a.del_flag = 0 + <if test="batchName != null and batchName != ''">and a.batch_name like concat('%', #{batchName}, '%')</if> + <if test="deptId != null ">and a.dept_id = #{deptId}</if> + <if test="districtCode != null and districtCode != ''">and a.district_code = #{districtCode}</if> + <if test="payType != null ">and a.pay_type = #{payType}</if> + <if test="amount != null ">and a.amount = #{amount}</if> + <if test="year != null and year != ''">and a.year = #{year}</if> + <if test="quarter != null ">and a.quarter = #{quarter}</if> + <if test="payPersonType != null ">and a.pay_person_type = #{payPersonType}</if> + <if test="payCompanyName != null and payCompanyName != ''">and a.pay_company_name like concat('%', + #{payCompanyName}, '%') + </if> + + <if test="payCompanyCard != null and payCompanyCard != ''">and a.pay_company_card = #{payCompanyCard}</if> + order by a.create_time desc + </select> + <select id="selectNonCoalPayById" parameterType="Long" resultMap="NonCoalPayResult"> <include refid="selectNonCoalPayVo"/> where id = #{id} </select> + + + <select id="getNonCoalPayById" parameterType="Long" resultMap="getNonCoalPayResult"> + select a.id, + a.batch_name, + a.dept_id, + d2.name as district_name, + d.dept_name, + a.district_code, + a.pay_type, + a.amount, + a.year, + a.quarter, + b.id as non_category_id, + b.category_id, + c.subject_name, + c.category_type, + b.category_amount + from non_coal_pay a + inner join non_coal_pay_category b on a.id = b.non_coal_pay_id and b.del_flag = 0 + left join non_coal_category c on b.category_id = c.id and c.del_flag = 0 + left join sys_dept d on a.dept_id = d.dept_id + left join sys_district d2 on a.district_code = d2.code + where a.id = #{id} + </select> + + <select id="selectNonCoalPayByParam" resultMap="getNonCoalPayResultH5"> + select a.id, + a.batch_name, + a.dept_id, + d2.name as district_name, + d.dept_name, + a.district_code, + a.pay_type, + a.amount, + a.year, + a.quarter, + b.id as non_category_id, + b.category_id, + c.subject_name, + c.category_type, + b.category_amount, + t.id as non_coal_student_id, + t.phone, + t.id_card, + t.name as student_name + 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 + inner join non_coal_pay_category b on a.id = b.non_coal_pay_id and b.del_flag = 0 + left join non_coal_category c on b.category_id = c.id and c.del_flag = 0 + left join sys_dept d on a.dept_id = d.dept_id + left join sys_district d2 on a.district_code = d2.code + where a.del_flag = 0 + and t.pay_status = 0 + and t.phone = #{phone} + and t.id_card = #{idCard} limit 1 + </select> + <insert id="insertNonCoalPay" parameterType="NonCoalPay" useGeneratedKeys="true" keyProperty="id"> insert into non_coal_pay @@ -66,7 +203,7 @@ <if test="createBy != null">create_by,</if> <if test="createTime != null">create_time,</if> <if test="delFlag != null">del_flag,</if> - </trim> + </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="batchName != null and batchName != ''">#{batchName},</if> <if test="deptId != null">#{deptId},</if> @@ -83,7 +220,7 @@ <if test="createBy != null">#{createBy},</if> <if test="createTime != null">#{createTime},</if> <if test="delFlag != null">#{delFlag},</if> - </trim> + </trim> </insert> <update id="updateNonCoalPay" parameterType="NonCoalPay"> @@ -108,14 +245,17 @@ where id = #{id} </update> - <delete id="deleteNonCoalPayById" parameterType="Long"> - delete from non_coal_pay where id = #{id} - </delete> + <update id="deleteNonCoalPayById" parameterType="Long"> + update non_coal_pay + set del_flag = 2, + update_by = #{updateBy} non_coal_pay + where id = #{id} + </update> - <delete id="deleteNonCoalPayByIds" parameterType="String"> - delete from non_coal_pay where id in + <update id="deleteNonCoalPayByIds"> + update non_coal_pay set del_flag = 2 set where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> - </delete> + </update> </mapper> \ No newline at end of file diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml index 6bccdb1..b609a23 100644 --- a/exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml +++ b/exam-system/src/main/resources/mapper/pay/NonCoalPayStudentMapper.xml @@ -1,42 +1,60 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.pay.mapper.NonCoalPayStudentMapper"> - + <resultMap type="NonCoalPayStudent" id="NonCoalPayStudentResult"> - <result property="id" column="id" /> - <result property="nonCoalPayId" column="non_coal_pay_id" /> - <result property="name" column="name" /> - <result property="idCard" column="id_card" /> - <result property="phone" column="phone" /> - <result property="sex" column="sex" /> - <result property="payCode" column="pay_code" /> - <result property="payStatus" column="pay_status" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="delFlag" column="del_flag" /> + <result property="id" column="id"/> + <result property="nonCoalPayId" column="non_coal_pay_id"/> + <result property="name" column="name"/> + <result property="idCard" column="id_card"/> + <result property="phone" column="phone"/> + <result property="sex" column="sex"/> + <result property="payCode" column="pay_code"/> + <result property="payStatus" column="pay_status"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="delFlag" column="del_flag"/> + <result property="payType" column="pay_type"/> </resultMap> <sql id="selectNonCoalPayStudentVo"> - select id, non_coal_pay_id, name, id_card, phone, sex, pay_code, pay_status, update_by, update_time, create_by, create_time, del_flag from non_coal_pay_student + select id, + non_coal_pay_id, + name, + id_card, + phone, + sex, + pay_code, + pay_status, + update_by, + update_time, + create_by, + create_time, + del_flag, + pay_type + from non_coal_pay_student </sql> <select id="selectNonCoalPayStudentList" parameterType="NonCoalPayStudent" resultMap="NonCoalPayStudentResult"> <include refid="selectNonCoalPayStudentVo"/> - <where> - <if test="nonCoalPayId != null "> and non_coal_pay_id = #{nonCoalPayId}</if> - <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> - <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if> - <if test="phone != null and phone != ''"> and phone = #{phone}</if> - <if test="sex != null "> and sex = #{sex}</if> - <if test="payCode != null and payCode != ''"> and pay_code = #{payCode}</if> - <if test="payStatus != null "> and pay_status = #{payStatus}</if> + <where> + and del_flag = 0 + <if test="nonCoalPayId != null ">and non_coal_pay_id = #{nonCoalPayId}</if> + <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> + <if test="idCard != null and idCard != ''">and id_card = #{idCard}</if> + <if test="phone != null and phone != ''">and phone = #{phone}</if> + <if test="sex != null ">and sex = #{sex}</if> + <if test="payCode != null and payCode != ''">and pay_code = #{payCode}</if> + <if test="payStatus != null ">and pay_status = #{payStatus}</if> + <if test="payType != null ">and pay_type = #{payType}</if> </where> + order by create_time desc </select> - + <select id="selectNonCoalPayStudentById" parameterType="Long" resultMap="NonCoalPayStudentResult"> <include refid="selectNonCoalPayStudentVo"/> where id = #{id} @@ -52,13 +70,14 @@ <if test="phone != null and phone != ''">phone,</if> <if test="sex != null">sex,</if> <if test="payCode != null">pay_code,</if> + <if test="payType != null">pay_type,</if> <if test="payStatus != null">pay_status,</if> <if test="updateBy != null">update_by,</if> <if test="updateTime != null">update_time,</if> <if test="createBy != null">create_by,</if> <if test="createTime != null">create_time,</if> <if test="delFlag != null">del_flag,</if> - </trim> + </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <if test="nonCoalPayId != null">#{nonCoalPayId},</if> @@ -67,15 +86,22 @@ <if test="phone != null and phone != ''">#{phone},</if> <if test="sex != null">#{sex},</if> <if test="payCode != null">#{payCode},</if> + <if test="payType != null">#{payType},</if> <if test="payStatus != null">#{payStatus},</if> <if test="updateBy != null">#{updateBy},</if> <if test="updateTime != null">#{updateTime},</if> <if test="createBy != null">#{createBy},</if> <if test="createTime != null">#{createTime},</if> <if test="delFlag != null">#{delFlag},</if> - </trim> + </trim> </insert> + <update id="updateNonCoalPayStudentType"> + update non_coal_pay_student + set pay_type = 2, + update_by = #{updateBy} + where non_coal_pay_id = #{id} + </update> <update id="updateNonCoalPayStudent" parameterType="NonCoalPayStudent"> update non_coal_pay_student <trim prefix="SET" suffixOverrides=","> @@ -84,6 +110,7 @@ <if test="idCard != null and idCard != ''">id_card = #{idCard},</if> <if test="phone != null and phone != ''">phone = #{phone},</if> <if test="sex != null">sex = #{sex},</if> + <if test="payType != null">pay_type = #{payType},</if> <if test="payCode != null">pay_code = #{payCode},</if> <if test="payStatus != null">pay_status = #{payStatus},</if> <if test="updateBy != null">update_by = #{updateBy},</if> @@ -95,12 +122,15 @@ where id = #{id} </update> - <delete id="deleteNonCoalPayStudentById" parameterType="Long"> - delete from non_coal_pay_student where id = #{id} - </delete> + <update id="deleteNonCoalPayStudentById"> + update non_coal_pay_student + set del_flag = 2, + update_by = #{updateBy} + where id = #{id} + </update> <delete id="deleteNonCoalPayStudentByIds" parameterType="String"> - delete from non_coal_pay_student where id in + delete from non_coal_pay_student where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> -- Gitblit v1.9.2