SpecialBizController.java 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package com.yykj.sjnmtybt.controller;
  2. import com.yykj.sjnmtybt.common.ApiResponse;
  3. import com.yykj.sjnmtybt.common.PageResult;
  4. import com.yykj.sjnmtybt.dto.request.ApproveRequest;
  5. import com.yykj.sjnmtybt.dto.request.SpecialBizCreateRequest;
  6. import com.yykj.sjnmtybt.dto.response.SpecialBizVO;
  7. import com.yykj.sjnmtybt.enums.RefundProgressStageEnum;
  8. import com.yykj.sjnmtybt.enums.SpecialBizTypeEnum;
  9. import com.yykj.sjnmtybt.service.BizFlowService;
  10. import io.swagger.v3.oas.annotations.Operation;
  11. import io.swagger.v3.oas.annotations.Parameter;
  12. import io.swagger.v3.oas.annotations.tags.Tag;
  13. import org.springframework.validation.annotation.Validated;
  14. import org.springframework.web.bind.annotation.*;
  15. import java.util.Map;
  16. @Tag(name = "06-特殊业务", description = "流程图泳道:特殊业务申请(死亡预警/暂停恢复补发/调标)")
  17. @RestController
  18. @RequestMapping("/api/special-biz")
  19. public class SpecialBizController {
  20. private final BizFlowService flow;
  21. public SpecialBizController(BizFlowService flow) {
  22. this.flow = flow;
  23. }
  24. @Operation(summary = "分页查询特殊业务",
  25. description = "含丧葬、暂停、停止、恢复、调标差额补发、下月补发、多发退款、继承人变更等。"
  26. + "调标单人员可为空,对象列为街镇;关联村批见 relatedBatchIds。")
  27. @GetMapping("/page")
  28. public ApiResponse<PageResult<SpecialBizVO>> page(
  29. @Parameter(description = "关联统一批次号") @RequestParam(required = false) String batchNo,
  30. @Parameter(description = "业务类型") @RequestParam(required = false) SpecialBizTypeEnum bizType,
  31. @Parameter(description = "审批状态:待分管领导审批/已通过/已驳回") @RequestParam(required = false) String approveStatus,
  32. @Parameter(description = "街镇ID") @RequestParam(required = false) String townId,
  33. @Parameter(description = "页码,从 1 起") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
  34. @Parameter(description = "每页条数") @RequestParam(required = false, defaultValue = "20") Integer pageSize) {
  35. return ApiResponse.ok(flow.pageSpecial(bizType, approveStatus, pageNum, pageSize, townId));
  36. }
  37. @Operation(summary = "恢复发放补发预览",
  38. description = "按暂停月数×街镇月标估算补发金额与默认原因;创建 RESUME 前可调用。")
  39. @GetMapping("/resume-preview")
  40. public ApiResponse<Map<String, Object>> resumePreview(
  41. @Parameter(description = "人员ID", required = true) @RequestParam String personnelId) {
  42. return ApiResponse.ok(flow.previewResumeSupplement(personnelId));
  43. }
  44. @Operation(summary = "创建特殊业务(线上申请)",
  45. description = "丧葬/暂停/恢复等需选人。"
  46. + "STANDARD_ADJUST 调标差额补发:只传 townId(必填),可选 reason/fileUrls;"
  47. + "新旧土地标准与生效月从金额标准历史自动带出,不再手填;"
  48. + "按村生成业务号 YYYY99 补发批,进分管领导审批(审批以村批为准,非本单出盘)。")
  49. @PostMapping
  50. public ApiResponse<SpecialBizVO> create(@Validated @RequestBody SpecialBizCreateRequest req) {
  51. return ApiResponse.ok("特殊业务已创建,待分管领导审批", flow.createSpecial(req));
  52. }
  53. @Operation(summary = "分管领导线上审批特殊业务",
  54. description = "通过→业务部门可生成特殊业务出盘文件;驳回→退回业务部门修改。"
  55. + "调标差额补发的实质审批请走 POST /api/batches/leader-approve(各村补发批)。")
  56. @PostMapping("/leader-approve")
  57. public ApiResponse<SpecialBizVO> leaderApprove(@Validated @RequestBody ApproveRequest req) {
  58. return ApiResponse.ok("审批完成", flow.approveSpecial(req));
  59. }
  60. @Operation(summary = "生成特殊业务出盘文件",
  61. description = "分管领导审批通过后,业务部门导出出盘文件,进入线下签批与财政发放。"
  62. + "调标补发请用发放出盘接口且 adjustOnly=true;未通过/已出盘/调标单会返回 400。")
  63. @PostMapping("/{id}/export-disk")
  64. public ApiResponse<Map<String, String>> exportDisk(
  65. @Parameter(description = "特殊业务单ID", required = true) @PathVariable String id) {
  66. return ApiResponse.ok("特殊业务出盘文件已生成", flow.exportSpecialDisk(id));
  67. }
  68. @Operation(summary = "推进退款进度")
  69. @PostMapping("/{id}/refund-progress")
  70. public ApiResponse<SpecialBizVO> advanceRefundProgress(
  71. @PathVariable String id,
  72. @RequestBody Map<String, String> body) {
  73. RefundProgressStageEnum stage = RefundProgressStageEnum.valueOf(body.get("stage"));
  74. return ApiResponse.ok("进度已更新", flow.advanceRefundProgress(id, stage));
  75. }
  76. @Operation(summary = "退款进度统计")
  77. @GetMapping("/refund-stats")
  78. public ApiResponse<Map<String, Object>> refundStats() {
  79. return ApiResponse.ok(flow.refundStats());
  80. }
  81. }