运行不起来了
This commit is contained in:
166
docs/bszx/controller/BszxBmController.java
Normal file
166
docs/bszx/controller/BszxBmController.java
Normal file
@@ -0,0 +1,166 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.service.CmsArticleService;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxBmService;
|
||||
import com.gxwebsoft.bszx.entity.BszxBm;
|
||||
import com.gxwebsoft.bszx.param.BszxBmParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 百色中学-报名记录控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-06 22:50:25
|
||||
*/
|
||||
@Tag(name = "百色中学-报名记录管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-bm")
|
||||
public class BszxBmController extends BaseController {
|
||||
@Resource
|
||||
private BszxBmService bszxBmService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private CmsArticleService cmsArticleService;
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:list')")
|
||||
@Operation(summary = "分页查询百色中学-报名记录")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxBm>> page(BszxBmParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxBmService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:list')")
|
||||
@Operation(summary = "查询全部百色中学-报名记录")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxBm>> list(BszxBmParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxBmService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:list')")
|
||||
@Operation(summary = "根据id查询百色中学-报名记录")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxBm> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxBmService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "申请报名生成邀请函")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxBm bszxBm) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (bszxBm.getName() == null) {
|
||||
return fail("请填写姓名");
|
||||
}
|
||||
if (loginUser != null) {
|
||||
bszxBm.setUserId(loginUser.getUserId());
|
||||
if (bszxBmService.count(new LambdaQueryWrapper<BszxBm>().eq(BszxBm::getUserId,loginUser.getUserId())) > 0) {
|
||||
return fail("您已经报名过了",null);
|
||||
}
|
||||
if (bszxBmService.save(bszxBm)) {
|
||||
cmsArticleService.saveInc(bszxBm.getFormId());
|
||||
return success("报名成功");
|
||||
}
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "修改报名信息")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxBm bszxBm) {
|
||||
final User loginUser = getLoginUser();
|
||||
if(loginUser == null){
|
||||
return fail("请先登录");
|
||||
}
|
||||
if (bszxBmService.updateById(bszxBm)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除报名记录")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxBmService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-报名记录")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxBm> list) {
|
||||
if (bszxBmService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-报名记录")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxBm> batchParam) {
|
||||
if (batchParam.update(bszxBmService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBm:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-报名记录")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxBmService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "查询我的报名记录")
|
||||
@GetMapping("/myPage")
|
||||
public ApiResult<PageResult<BszxBm>> myPage(BszxBmParam param) {
|
||||
// 使用关联查询
|
||||
if (getLoginUser() != null) {
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(bszxBmService.pageRel(param));
|
||||
}
|
||||
return fail("请先登录",null);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取海报地址")
|
||||
@GetMapping("/generatePoster")
|
||||
public ApiResult<?> generatePoster() throws Exception {
|
||||
if (getLoginUser() == null) {
|
||||
return fail("请先登录",null);
|
||||
}
|
||||
final BszxBm bm = bszxBmService.getOne(new LambdaQueryWrapper<BszxBm>().eq(BszxBm::getUserId, getLoginUser().getUserId()).last("limit 1"));
|
||||
return success("生成宣传海报",bszxBmService.generatePoster(bm));
|
||||
}
|
||||
|
||||
}
|
||||
121
docs/bszx/controller/BszxBranchController.java
Normal file
121
docs/bszx/controller/BszxBranchController.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxBranchService;
|
||||
import com.gxwebsoft.bszx.entity.BszxBranch;
|
||||
import com.gxwebsoft.bszx.param.BszxBranchParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 百色中学-分部控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-17 17:18:22
|
||||
*/
|
||||
@Tag(name = "百色中学-分部管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-branch")
|
||||
public class BszxBranchController extends BaseController {
|
||||
@Resource
|
||||
private BszxBranchService bszxBranchService;
|
||||
|
||||
@Operation(summary = "分页查询百色中学-分部")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxBranch>> page(BszxBranchParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxBranchService.pageRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部百色中学-分部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxBranch>> list(BszxBranchParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxBranchService.listRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询百色中学-分部")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxBranch> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxBranchService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBranch:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加百色中学-分部")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxBranch bszxBranch) {
|
||||
if (bszxBranchService.save(bszxBranch)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBranch:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改百色中学-分部")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxBranch bszxBranch) {
|
||||
if (bszxBranchService.updateById(bszxBranch)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBranch:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除百色中学-分部")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxBranchService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBranch:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-分部")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxBranch> list) {
|
||||
if (bszxBranchService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBranch:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-分部")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxBranch> batchParam) {
|
||||
if (batchParam.update(bszxBranchService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxBranch:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-分部")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxBranchService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
156
docs/bszx/controller/BszxClassController.java
Normal file
156
docs/bszx/controller/BszxClassController.java
Normal file
@@ -0,0 +1,156 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.bszx.entity.BszxBranch;
|
||||
import com.gxwebsoft.bszx.entity.BszxEra;
|
||||
import com.gxwebsoft.bszx.entity.BszxGrade;
|
||||
import com.gxwebsoft.bszx.param.BszxGradeParam;
|
||||
import com.gxwebsoft.bszx.service.BszxBranchService;
|
||||
import com.gxwebsoft.bszx.service.BszxEraService;
|
||||
import com.gxwebsoft.bszx.service.BszxGradeService;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxClassService;
|
||||
import com.gxwebsoft.bszx.entity.BszxClass;
|
||||
import com.gxwebsoft.bszx.param.BszxClassParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 百色中学-班级控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-06 22:50:25
|
||||
*/
|
||||
@Tag(name = "百色中学-班级管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-class")
|
||||
public class BszxClassController extends BaseController {
|
||||
@Resource
|
||||
private BszxClassService bszxClassService;
|
||||
@Resource
|
||||
private BszxGradeService bszxGradeService;
|
||||
@Resource
|
||||
private BszxBranchService bszxBranchService;
|
||||
|
||||
@Operation(summary = "分页查询百色中学-班级")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxClass>> page(BszxClassParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxClassService.pageRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部百色中学-班级")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxClass>> list(BszxClassParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxClassService.listRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询百色中学-班级")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxClass> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxClassService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "百色中学-年级班级数据")
|
||||
@GetMapping("/tree")
|
||||
public ApiResult<List<BszxBranch>> tree() {
|
||||
final List<BszxBranch> list = bszxBranchService.list();
|
||||
final BszxGradeParam bszxGradeParam = new BszxGradeParam();
|
||||
final List<BszxGrade> gradeList = bszxGradeService.listRel(bszxGradeParam);
|
||||
final BszxClassParam bszxClassParam = new BszxClassParam();
|
||||
final List<BszxClass> bszxClasseList = bszxClassService.listRel(bszxClassParam);
|
||||
final Map<Integer, List<BszxClass>> collectClass = bszxClasseList.stream().collect(Collectors.groupingBy(BszxClass::getGradeId));
|
||||
gradeList.forEach(d -> {
|
||||
d.setChildren(collectClass.get(d.getId()));
|
||||
});
|
||||
final Map<Integer, List<BszxGrade>> collectGrade = gradeList.stream().collect(Collectors.groupingBy(BszxGrade::getBranch));
|
||||
|
||||
list.forEach(d -> {
|
||||
d.setChildren(collectGrade.get(d.getId()));
|
||||
});
|
||||
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxClass:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加百色中学-班级")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxClass bszxClass) {
|
||||
if (bszxClassService.save(bszxClass)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxClass:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改百色中学-班级")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxClass bszxClass) {
|
||||
if (bszxClassService.updateById(bszxClass)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxClass:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除百色中学-班级")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxClassService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxClass:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-班级")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxClass> list) {
|
||||
if (bszxClassService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxClass:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-班级")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxClass> batchParam) {
|
||||
if (batchParam.update(bszxClassService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxClass:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-班级")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxClassService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
121
docs/bszx/controller/BszxEraController.java
Normal file
121
docs/bszx/controller/BszxEraController.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxEraService;
|
||||
import com.gxwebsoft.bszx.entity.BszxEra;
|
||||
import com.gxwebsoft.bszx.param.BszxEraParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 百色中学-年代控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-06 22:50:25
|
||||
*/
|
||||
@Tag(name = "百色中学-年代管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-era")
|
||||
public class BszxEraController extends BaseController {
|
||||
@Resource
|
||||
private BszxEraService bszxEraService;
|
||||
|
||||
@Operation(summary = "分页查询百色中学-年代")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxEra>> page(BszxEraParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxEraService.pageRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部百色中学-年代")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxEra>> list(BszxEraParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxEraService.listRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询百色中学-年代")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxEra> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxEraService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxEra:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加百色中学-年代")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxEra bszxEra) {
|
||||
if (bszxEraService.save(bszxEra)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxEra:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改百色中学-年代")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxEra bszxEra) {
|
||||
if (bszxEraService.updateById(bszxEra)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxEra:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除百色中学-年代")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxEraService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxEra:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-年代")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxEra> list) {
|
||||
if (bszxEraService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxEra:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-年代")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxEra> batchParam) {
|
||||
if (batchParam.update(bszxEraService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxEra:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-年代")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxEraService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
121
docs/bszx/controller/BszxGradeController.java
Normal file
121
docs/bszx/controller/BszxGradeController.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxGradeService;
|
||||
import com.gxwebsoft.bszx.entity.BszxGrade;
|
||||
import com.gxwebsoft.bszx.param.BszxGradeParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 百色中学-年级控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-06 22:50:25
|
||||
*/
|
||||
@Tag(name = "百色中学-年级管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-grade")
|
||||
public class BszxGradeController extends BaseController {
|
||||
@Resource
|
||||
private BszxGradeService bszxGradeService;
|
||||
|
||||
@Operation(summary = "分页查询百色中学-年级")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxGrade>> page(BszxGradeParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxGradeService.pageRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部百色中学-年级")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxGrade>> list(BszxGradeParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxGradeService.listRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询百色中学-年级")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxGrade> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxGradeService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxGrade:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加百色中学-年级")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxGrade bszxGrade) {
|
||||
if (bszxGradeService.save(bszxGrade)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxGrade:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改百色中学-年级")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxGrade bszxGrade) {
|
||||
if (bszxGradeService.updateById(bszxGrade)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxGrade:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除百色中学-年级")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxGradeService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxGrade:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-年级")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxGrade> list) {
|
||||
if (bszxGradeService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxGrade:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-年级")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxGrade> batchParam) {
|
||||
if (batchParam.update(bszxGradeService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxGrade:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-年级")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxGradeService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
91
docs/bszx/controller/BszxOrderController.java
Normal file
91
docs/bszx/controller/BszxOrderController.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.bszx.entity.BszxBm;
|
||||
import com.gxwebsoft.bszx.entity.BszxPay;
|
||||
import com.gxwebsoft.bszx.param.BszxPayParam;
|
||||
import com.gxwebsoft.bszx.service.BszxBmService;
|
||||
import com.gxwebsoft.bszx.service.BszxPayService;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.entity.ShopOrder;
|
||||
import com.gxwebsoft.shop.param.ShopOrderParam;
|
||||
import com.gxwebsoft.shop.service.ShopOrderService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 百色中学-订单管理
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-06 22:50:25
|
||||
*/
|
||||
@Tag(name = "百色中学-订单管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-order")
|
||||
public class BszxOrderController extends BaseController {
|
||||
@Resource
|
||||
private BszxPayService bszxPayService;
|
||||
@Resource
|
||||
private BszxBmService bszxBmService;
|
||||
@Resource
|
||||
private ShopOrderService shopOrderService;
|
||||
|
||||
@Operation(summary = "分页查询百色中学-订单列表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ShopOrder>> page(ShopOrderParam param) {
|
||||
// 使用关联查询
|
||||
final PageResult<ShopOrder> result = shopOrderService.pageRel(param);
|
||||
if(!CollectionUtils.isEmpty(result.getList())){
|
||||
final Set<Integer> userIds = result.getList().stream().map(ShopOrder::getUserId).collect(Collectors.toSet());
|
||||
final List<BszxBm> bmList = bszxBmService.list(new LambdaQueryWrapper<BszxBm>().in(BszxBm::getUserId, userIds).isNotNull(BszxBm::getName));
|
||||
final Map<Integer, List<BszxBm>> collect = bmList.stream().collect(Collectors.groupingBy(BszxBm::getUserId));
|
||||
final Set<String> orderNos = result.getList().stream().map(ShopOrder::getOrderNo).collect(Collectors.toSet());
|
||||
final BszxPayParam bszxPayParam = new BszxPayParam();
|
||||
bszxPayParam.setOrderNos(orderNos);
|
||||
final List<BszxPay> bszxPays = bszxPayService.listRel(bszxPayParam);
|
||||
final Map<String, List<BszxPay>> collectByOrderNo = bszxPays.stream().collect(Collectors.groupingBy(BszxPay::getOrderNo));
|
||||
|
||||
result.getList().forEach(d -> {
|
||||
final List<BszxPay> pays = collectByOrderNo.get(d.getOrderNo());
|
||||
if(!CollectionUtils.isEmpty(pays)){
|
||||
d.setDeliveryStatus(20);
|
||||
}
|
||||
final List<BszxBm> bmList1 = collect.get(d.getUserId());
|
||||
if(!CollectionUtils.isEmpty(bmList1)){
|
||||
final BszxBm bm = bmList1.get(0);
|
||||
d.setBm(bm);
|
||||
d.setRealName(bm.getName());
|
||||
if(bm.getPhone() != null){
|
||||
d.setPhone(bm.getPhone());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "统计订单总金额")
|
||||
@GetMapping("/total")
|
||||
public ApiResult<BigDecimal> total() {
|
||||
try {
|
||||
BigDecimal totalAmount = bszxPayService.total();
|
||||
return success(totalAmount);
|
||||
} catch (Exception e) {
|
||||
// 异常时返回0,保持接口稳定性
|
||||
return success(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
344
docs/bszx/controller/BszxPayController.java
Normal file
344
docs/bszx/controller/BszxPayController.java
Normal file
@@ -0,0 +1,344 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.bszx.entity.BszxBm;
|
||||
import com.gxwebsoft.bszx.service.BszxBmService;
|
||||
import com.wechat.pay.java.core.notification.*;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxPayService;
|
||||
import com.gxwebsoft.bszx.entity.BszxPay;
|
||||
import com.gxwebsoft.bszx.param.BszxPayParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.Payment;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.shop.entity.ShopOrder;
|
||||
import com.gxwebsoft.shop.service.ShopOrderService;
|
||||
import com.wechat.pay.java.core.notification.RequestParam;
|
||||
import com.wechat.pay.java.service.partnerpayments.jsapi.JsapiService;
|
||||
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 百色中学-捐款记录控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-06 22:50:25
|
||||
*/
|
||||
@Tag(name = "百色中学-捐款记录管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-pay")
|
||||
public class BszxPayController extends BaseController {
|
||||
public static JsapiService service;
|
||||
@Resource
|
||||
private BszxPayService bszxPayService;
|
||||
@Resource
|
||||
private BszxBmService bszxBmService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private ShopOrderService shopOrderService;
|
||||
@Resource
|
||||
private ConfigProperties conf;
|
||||
@Value("${spring.profiles.active}")
|
||||
String active;
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:list')")
|
||||
@Operation(summary = "分页查询百色中学-捐款记录")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxPay>> page(BszxPayParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxPayService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:list')")
|
||||
@Operation(summary = "查询全部百色中学-捐款记录")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxPay>> list(BszxPayParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxPayService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:list')")
|
||||
@Operation(summary = "根据id查询百色中学-捐款记录")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxPay> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxPayService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "活动捐款")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxPay bszxPay, HttpServletRequest request) {
|
||||
if (bszxPay.getPrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
return fail("金额不能为0");
|
||||
}
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
bszxPay.setUserId(loginUser.getUserId());
|
||||
// 微信openid(必填)
|
||||
if (StrUtil.isBlank(loginUser.getOpenid())) {
|
||||
return fail("微信openid(必填)");
|
||||
}
|
||||
final BszxBm bmInfo = bszxBmService.getByUserId(loginUser.getUserId());
|
||||
bszxPay.setName(bmInfo.getName());
|
||||
bszxPay.setSex(bmInfo.getSex());
|
||||
bszxPay.setPhone(bmInfo.getPhone());
|
||||
bszxPay.setBranchName(bmInfo.getBranchName());
|
||||
bszxPay.setGradeName(bmInfo.getGradeName());
|
||||
bszxPay.setClassName(bmInfo.getClassName());
|
||||
bszxPay.setAddress(bmInfo.getAddress());
|
||||
bszxPay.setWorkUnit(bmInfo.getWorkUnit());
|
||||
bszxPay.setPosition(bmInfo.getPosition());
|
||||
bszxPay.setAge(bmInfo.getAge());
|
||||
bszxPay.setNumber(bmInfo.getNumber());
|
||||
}
|
||||
if (bszxPayService.save(bszxPay)) {
|
||||
// 调起支付
|
||||
return success("下单成功", bszxPay);
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改百色中学-捐款记录")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxPay bszxPay) {
|
||||
if (bszxPayService.updateById(bszxPay)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除百色中学-捐款记录")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxPayService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-捐款记录")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxPay> list) {
|
||||
if (bszxPayService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-捐款记录")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxPay> batchParam) {
|
||||
if (batchParam.update(bszxPayService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPay:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-捐款记录")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxPayService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "查询我的报名记录")
|
||||
@GetMapping("/myPage")
|
||||
public ApiResult<PageResult<BszxPay>> myPage(BszxPayParam param) {
|
||||
// 使用关联查询
|
||||
if (getLoginUser() != null) {
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(bszxPayService.pageRel(param));
|
||||
}
|
||||
return fail("请先登录", null);
|
||||
}
|
||||
|
||||
@Operation(summary = "统计捐款总金额与人次")
|
||||
@GetMapping("/getCount")
|
||||
public ApiResult<?> getCount() {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
final LambdaQueryWrapper<BszxPay> wrapper = new LambdaQueryWrapper<>();
|
||||
final BigDecimal bigDecimal = bszxPayService.sumMoney(wrapper);
|
||||
Long count = (long) bszxPayService.count(new LambdaQueryWrapper<BszxPay>());
|
||||
map.put("numbers", count);
|
||||
map.put("totalMoney", bigDecimal);
|
||||
return success(map);
|
||||
}
|
||||
|
||||
@Schema(description = "异步通知")
|
||||
@PostMapping("/notify/{tenantId}")
|
||||
public String wxNotify(@RequestHeader Map<String, String> header, @RequestBody String body,HttpServletRequest request, @PathVariable("tenantId") Integer tenantId) {
|
||||
// 获取支付配置信息用于解密 - 优先使用 Payment:1* 格式
|
||||
String key = "Payment:11"; // 微信支付类型为1,使用 Payment:11 格式
|
||||
Payment payment = redisUtil.get(key, Payment.class);
|
||||
|
||||
// 如果 Payment:1* 格式不存在,尝试原有格式
|
||||
if (payment == null) {
|
||||
String fallbackKey = "Payment:1:".concat(tenantId.toString());
|
||||
payment = redisUtil.get(fallbackKey, Payment.class);
|
||||
}
|
||||
String uploadPath = conf.getUploadPath();
|
||||
|
||||
// 开发环境
|
||||
String mid = "1242289702";
|
||||
String apiV3Key = "0b2996803383c3e3391abd9183b54key";
|
||||
String serialNumber = "3B458EB14A28160DC094431A21C0508EFA712D1C";
|
||||
String privateKey = "/Users/gxwebsoft/JAVA/site-java/cert/bszx/apiclient_key.pem";
|
||||
String apiclientCert = "/Users/gxwebsoft/JAVA/site-java/cert/bszx/apiclient_cert.pem";
|
||||
String pubKey = "/Users/gxwebsoft/JAVA/site-java/cert/bszx/0f65a8517c284acb90aa83dd0c23e8f6.pem";
|
||||
String pubId = "PUB_KEY_ID_0112422897022025011300326200001208";
|
||||
// 生产环境
|
||||
if (ObjectUtil.isNotEmpty(payment)) {
|
||||
// 检查 payment 字段是否为空,并避免直接解析为数字
|
||||
mid = payment.getMchId();
|
||||
apiV3Key = payment.getApiKey();
|
||||
serialNumber = payment.getMerchantSerialNumber();
|
||||
// 生产环境使用容器证书路径 /www/wwwroot/file.ws
|
||||
privateKey = "/www/wwwroot/file.ws" + payment.getApiclientKey();
|
||||
apiclientCert = "/www/wwwroot/file.ws" + payment.getApiclientCert();
|
||||
pubKey = "/www/wwwroot/file.ws" + payment.getPubKey();
|
||||
pubId = payment.getPubKeyId();
|
||||
}
|
||||
RequestParam requestParam = new RequestParam.Builder()
|
||||
.serialNumber(header.get("wechatpay-serial"))
|
||||
.nonce(header.get("wechatpay-nonce"))
|
||||
.signature(header.get("wechatpay-signature"))
|
||||
.timestamp(header.get("wechatpay-timestamp"))
|
||||
.body(body)
|
||||
.build();
|
||||
|
||||
|
||||
// NotificationConfig config = new RSAPublicKeyConfig.Builder()
|
||||
// .merchantId(mid)
|
||||
// .publicKeyFromPath(pubKey)
|
||||
// .publicKeyId(pubId)
|
||||
// .privateKeyFromPath(privateKey)
|
||||
// .merchantSerialNumber(serialNumber)
|
||||
// .apiV3Key(apiV3Key)
|
||||
// .build();
|
||||
|
||||
NotificationConfig config = new RSAPublicKeyNotificationConfig.Builder()
|
||||
.publicKeyFromPath(pubKey)
|
||||
.publicKeyId(pubId)
|
||||
.apiV3Key(apiV3Key)
|
||||
.build();
|
||||
|
||||
|
||||
// 初始化 NotificationParser
|
||||
NotificationParser parser = new NotificationParser(config);
|
||||
|
||||
// 以支付通知回调为例,验签、解密并转换成 Transaction
|
||||
try {
|
||||
Transaction transaction = parser.parse(requestParam, Transaction.class);
|
||||
final String outTradeNo = transaction.getOutTradeNo();
|
||||
final String transactionId = transaction.getTransactionId();
|
||||
final Integer total = transaction.getAmount().getTotal();
|
||||
final String tradeStateDesc = transaction.getTradeStateDesc();
|
||||
final Transaction.TradeStateEnum tradeState = transaction.getTradeState();
|
||||
final Transaction.TradeTypeEnum tradeType = transaction.getTradeType();
|
||||
System.out.println("transaction = " + transaction);
|
||||
System.out.println("tradeStateDesc = " + tradeStateDesc);
|
||||
System.out.println("tradeType = " + tradeType);
|
||||
System.out.println("tradeState = " + tradeState);
|
||||
System.out.println("outTradeNo = " + outTradeNo);
|
||||
System.out.println("amount = " + total);
|
||||
|
||||
if (StrUtil.equals("支付成功", tradeStateDesc)) {
|
||||
// 1. 查询要处理的订单
|
||||
ShopOrder order = shopOrderService.getByOutTradeNo(outTradeNo);
|
||||
// 2. 已支付则跳过
|
||||
if (order.getPayStatus().equals(true)) {
|
||||
return "SUCCESS";
|
||||
}
|
||||
// 2. 未支付则处理更新订单状态
|
||||
if (order.getPayStatus().equals(false)) {
|
||||
// 5. TODO 处理订单状态
|
||||
order.setPayTime(DateUtil.date());
|
||||
order.setPayStatus(true);
|
||||
order.setTransactionId(transactionId);
|
||||
order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", total * 0.01)));
|
||||
order.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.YEAR, 10));
|
||||
System.out.println("实际付款金额 = " + order.getPayPrice());
|
||||
return "SUCCESS";
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
System.out.println($e.getMessage());
|
||||
System.out.println(Arrays.toString($e.getStackTrace()));
|
||||
}
|
||||
|
||||
return "fail";
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopOrder:update')")
|
||||
@Operation(summary = "修复订单")
|
||||
@PutMapping("/repair")
|
||||
public ApiResult<?> repair(@RequestBody ShopOrder shopOrder) {
|
||||
if (shopOrderService.queryOrderByOutTradeNo(shopOrder)) {
|
||||
if (bszxPayService.count(new LambdaQueryWrapper<BszxPay>().eq(BszxPay::getOrderNo, shopOrder.getOrderNo())) == 0) {
|
||||
final BszxPay bszxPay = new BszxPay();
|
||||
final BszxBm bm = shopOrder.getBm();
|
||||
if (ObjectUtil.isNotEmpty(bm)) {
|
||||
bszxPay.setName(bm.getName());
|
||||
bszxPay.setSex(bm.getSex());
|
||||
bszxPay.setClassName(bm.getClassName());
|
||||
bszxPay.setGradeName(bm.getGradeName());
|
||||
bszxPay.setAddress(bm.getAddress());
|
||||
bszxPay.setWorkUnit(bm.getWorkUnit());
|
||||
bszxPay.setPosition(bm.getPosition());
|
||||
bszxPay.setPrice(shopOrder.getPayPrice());
|
||||
bszxPay.setOrderNo(shopOrder.getOrderNo());
|
||||
bszxPay.setUserId(shopOrder.getUserId());
|
||||
bszxPay.setFormId(shopOrder.getFormId());
|
||||
bszxPay.setComments(shopOrder.getComments());
|
||||
bszxPayService.save(bszxPay);
|
||||
}
|
||||
}
|
||||
return success("修复成功");
|
||||
}
|
||||
return fail("修复失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "获取捐款证书")
|
||||
@GetMapping("/generatePayCert/{id}")
|
||||
public ApiResult<?> generatePayCert(@PathVariable("id") Integer id) throws Exception {
|
||||
return success("获取捐款证书", bszxPayService.generatePayCert(id));
|
||||
}
|
||||
}
|
||||
199
docs/bszx/controller/BszxPayRankingController.java
Normal file
199
docs/bszx/controller/BszxPayRankingController.java
Normal file
@@ -0,0 +1,199 @@
|
||||
package com.gxwebsoft.bszx.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.bszx.entity.BszxClass;
|
||||
import com.gxwebsoft.bszx.entity.BszxPay;
|
||||
import com.gxwebsoft.bszx.param.BszxClassParam;
|
||||
import com.gxwebsoft.bszx.service.BszxClassService;
|
||||
import com.gxwebsoft.bszx.service.BszxPayService;
|
||||
import com.gxwebsoft.cms.entity.CmsArticle;
|
||||
import com.gxwebsoft.cms.service.CmsArticleService;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.bszx.service.BszxPayRankingService;
|
||||
import com.gxwebsoft.bszx.entity.BszxPayRanking;
|
||||
import com.gxwebsoft.bszx.param.BszxPayRankingParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 百色中学-捐款排行控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-03-25 08:54:09
|
||||
*/
|
||||
@Tag(name = "百色中学-捐款排行管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/bszx/bszx-pay-ranking")
|
||||
public class BszxPayRankingController extends BaseController {
|
||||
@Resource
|
||||
private BszxPayRankingService bszxPayRankingService;
|
||||
@Resource
|
||||
private CmsArticleService cmsArticleService;
|
||||
@Resource
|
||||
private BszxPayService bszxPayService;
|
||||
@Resource
|
||||
private BszxClassService bszxClassService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:list')")
|
||||
@Operation(summary = "分页查询百色中学-捐款排行")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<BszxPayRanking>> page(BszxPayRankingParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxPayRankingService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:list')")
|
||||
@Operation(summary = "查询全部百色中学-捐款排行")
|
||||
@GetMapping()
|
||||
public ApiResult<List<BszxPayRanking>> list(BszxPayRankingParam param) {
|
||||
// 使用关联查询
|
||||
return success(bszxPayRankingService.listRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部百色中学-捐款排行榜")
|
||||
@GetMapping("/ranking")
|
||||
public ApiResult<List<BszxPayRanking>> ranking(BszxPayRankingParam param) {
|
||||
final ArrayList<BszxPayRanking> rankings = new ArrayList<>();
|
||||
final LambdaQueryWrapper<BszxPay> wrapper = new LambdaQueryWrapper<>();
|
||||
final List<CmsArticle> list = cmsArticleService.list(new LambdaQueryWrapper<CmsArticle>().eq(CmsArticle::getCategoryId, 2444));
|
||||
|
||||
list.forEach(item -> {
|
||||
final BszxPayRanking ranking = new BszxPayRanking();
|
||||
wrapper.clear();
|
||||
// 按时间段查询
|
||||
if(param.getCreateTimeStart() != null && param.getCreateTimeEnd() != null){
|
||||
final String timeStart = param.getCreateTimeStart();
|
||||
final String timeEnd = param.getCreateTimeEnd();
|
||||
wrapper.ge(BszxPay::getCreateTime, timeStart);
|
||||
wrapper.le(BszxPay::getCreateTime, timeEnd);
|
||||
}
|
||||
wrapper.eq(BszxPay::getFormId, item.getArticleId());
|
||||
ranking.setFormId(item.getArticleId());
|
||||
ranking.setFormName(item.getTitle());
|
||||
ranking.setNumber((long) bszxPayService.count(wrapper));
|
||||
ranking.setTotalPrice(bszxPayService.sumMoney(wrapper));
|
||||
rankings.add(ranking);
|
||||
});
|
||||
// totalPrice按大到小排序
|
||||
rankings.sort((o1, o2) -> o2.getTotalPrice().compareTo(o1.getTotalPrice()));
|
||||
return success(rankings);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "查询全部百色中学-千班万元")
|
||||
@GetMapping("/ranking2")
|
||||
public ApiResult<List<BszxClass>> ranking2(BszxClassParam param) {
|
||||
final LambdaQueryWrapper<BszxPay> wrapper = new LambdaQueryWrapper<>();
|
||||
final List<BszxClass> list = bszxClassService.listRel(param);
|
||||
|
||||
String key = "BSZX:UpdateRanking2";
|
||||
final String isTimeOut = redisUtil.get(key);
|
||||
if(StrUtil.isNotBlank(isTimeOut)){
|
||||
list.sort((o1, o2) -> o2.getTotalMoney().compareTo(o1.getTotalMoney()));
|
||||
return success(list);
|
||||
}
|
||||
list.forEach(item -> {
|
||||
System.out.println("item = " + item);
|
||||
wrapper.clear();
|
||||
wrapper.eq(BszxPay::getGradeName,item.getGradeName());
|
||||
wrapper.eq(BszxPay::getClassName, item.getName());
|
||||
item.setTotalMoney(bszxPayService.sumMoney(wrapper));
|
||||
bszxClassService.updateById(item);
|
||||
});
|
||||
// totalPrice按大到小排序
|
||||
list.sort((o1, o2) -> o2.getTotalMoney().compareTo(o1.getTotalMoney()));
|
||||
redisUtil.set(key, 1,1L, TimeUnit.DAYS);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:list')")
|
||||
@Operation(summary = "根据id查询百色中学-捐款排行")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<BszxPayRanking> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(bszxPayRankingService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加百色中学-捐款排行")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody BszxPayRanking bszxPayRanking) {
|
||||
if (bszxPayRankingService.save(bszxPayRanking)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改百色中学-捐款排行")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody BszxPayRanking bszxPayRanking) {
|
||||
if (bszxPayRankingService.updateById(bszxPayRanking)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除百色中学-捐款排行")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (bszxPayRankingService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加百色中学-捐款排行")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<BszxPayRanking> list) {
|
||||
if (bszxPayRankingService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改百色中学-捐款排行")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxPayRanking> batchParam) {
|
||||
if (batchParam.update(bszxPayRankingService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('bszx:bszxPayRanking:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除百色中学-捐款排行")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (bszxPayRankingService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user