parent
1dd16c3e52
commit
74dcdc7c2a
11 changed files with 902 additions and 0 deletions
@ -0,0 +1,45 @@ |
|||||||
|
package org.springblade.desk.quality.constant; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批常量 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
public interface DispatchConfigApprovalConst { |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态-草稿 |
||||||
|
*/ |
||||||
|
Integer STATUS_DRAFT = 0; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态-审批中 |
||||||
|
*/ |
||||||
|
Integer STATUS_APPROVING = 1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态-审批通过 |
||||||
|
*/ |
||||||
|
Integer STATUS_APPROVED = 2; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态-审批驳回 |
||||||
|
*/ |
||||||
|
Integer STATUS_REJECTED = 3; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态-已撤销 |
||||||
|
*/ |
||||||
|
Integer STATUS_CANCELLED = 4; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批结果-通过 |
||||||
|
*/ |
||||||
|
Integer AUDIT_RESULT_PASS = 1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批结果-驳回 |
||||||
|
*/ |
||||||
|
Integer AUDIT_RESULT_REJECT = 2; |
||||||
|
} |
||||||
@ -0,0 +1,69 @@ |
|||||||
|
package org.springblade.desk.quality.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批实体类 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@TableName("QA_DISPATCH_CONFIG_APPROVAL") |
||||||
|
@Schema(description = "分派配置审批实体") |
||||||
|
public class DispatchConfigApproval extends BaseEntity { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 主键ID |
||||||
|
*/ |
||||||
|
@TableId(value = "ID", type = IdType.ASSIGN_ID) |
||||||
|
@Schema(description = "主键ID") |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请单号 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请单号") |
||||||
|
private String applicationNo; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请人ID |
||||||
|
*/ |
||||||
|
@Schema(description = "申请人ID") |
||||||
|
private Long applicantId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请人姓名 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请人姓名") |
||||||
|
private String applicantName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请时间 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请时间") |
||||||
|
private Date applicationTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请描述/备注 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请描述/备注") |
||||||
|
private String remark; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态: 0-草稿, 1-审批中, 2-审批通过, 3-审批驳回, 4-已撤销 |
||||||
|
*/ |
||||||
|
@Schema(description = "状态: 0-草稿, 1-审批中, 2-审批通过, 3-审批驳回, 4-已撤销") |
||||||
|
private Integer status; |
||||||
|
} |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
package org.springblade.desk.quality.pojo.request; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull; |
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审核请求DTO |
||||||
|
* |
||||||
|
* @author qyl |
||||||
|
* @since 2026-05-13 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Schema(description = "审核请求DTO") |
||||||
|
public class AuditRequest implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@NotNull(message = "模板ID不能为空") |
||||||
|
@Schema(description = "模板ID") |
||||||
|
private Long id; |
||||||
|
|
||||||
|
@NotNull(message = "审核结果不能为空") |
||||||
|
@Schema(description = "审核结果: 1-通过, 2-不通过") |
||||||
|
private Integer result; |
||||||
|
|
||||||
|
@Schema(description = "审核意见(不通过时必填)") |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,47 @@ |
|||||||
|
package org.springblade.desk.quality.pojo.request; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank; |
||||||
|
import jakarta.validation.constraints.NotNull; |
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批请求DTO |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Schema(description = "分派配置审批请求DTO") |
||||||
|
public class DispatchConfigApprovalRequest implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 主键ID(修改时必填) |
||||||
|
*/ |
||||||
|
@Schema(description = "主键ID(修改时必填)") |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请描述/备注 |
||||||
|
*/ |
||||||
|
@NotBlank(message = "申请描述不能为空") |
||||||
|
@Schema(description = "申请描述/备注", required = true) |
||||||
|
private String remark; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批结果: 1-通过, 2-驳回 |
||||||
|
*/ |
||||||
|
@NotNull(message = "审批结果不能为空") |
||||||
|
@Schema(description = "审批结果: 1-通过, 2-驳回", required = true) |
||||||
|
private Integer auditResult; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批意见 |
||||||
|
*/ |
||||||
|
@Schema(description = "审批意见") |
||||||
|
private String auditRemark; |
||||||
|
} |
||||||
@ -0,0 +1,115 @@ |
|||||||
|
package org.springblade.desk.quality.pojo.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
import org.springblade.desk.quality.pojo.entity.DispatchConfigApproval; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批VO类 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@Schema(description = "分派配置审批VO") |
||||||
|
public class DispatchConfigApprovalVO extends BaseEntity { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 主键ID |
||||||
|
*/ |
||||||
|
@Schema(description = "主键ID") |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请单号 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请单号") |
||||||
|
private String applicationNo; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请人ID |
||||||
|
*/ |
||||||
|
@Schema(description = "申请人ID") |
||||||
|
private Long applicantId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请人姓名 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请人姓名") |
||||||
|
private String applicantName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请时间 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请时间") |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||||
|
private Date applicationTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请描述/备注 |
||||||
|
*/ |
||||||
|
@Schema(description = "申请描述/备注") |
||||||
|
private String remark; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态: 0-草稿, 1-审批中, 2-审批通过, 3-审批驳回, 4-已撤销 |
||||||
|
*/ |
||||||
|
@Schema(description = "状态: 0-草稿, 1-审批中, 2-审批通过, 3-审批驳回, 4-已撤销") |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态名称 |
||||||
|
*/ |
||||||
|
@Schema(description = "状态名称") |
||||||
|
private String statusName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 从实体转换为VO |
||||||
|
*/ |
||||||
|
public static DispatchConfigApprovalVO fromEntity(DispatchConfigApproval entity) { |
||||||
|
if (entity == null) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
DispatchConfigApprovalVO vo = new DispatchConfigApprovalVO(); |
||||||
|
vo.setId(entity.getId()); |
||||||
|
vo.setApplicationNo(entity.getApplicationNo()); |
||||||
|
vo.setApplicantId(entity.getApplicantId()); |
||||||
|
vo.setApplicantName(entity.getApplicantName()); |
||||||
|
vo.setApplicationTime(entity.getApplicationTime()); |
||||||
|
vo.setRemark(entity.getRemark()); |
||||||
|
vo.setStatus(entity.getStatus()); |
||||||
|
vo.setStatusName(getStatusName(entity.getStatus())); |
||||||
|
return vo; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取状态名称 |
||||||
|
*/ |
||||||
|
private static String getStatusName(Integer status) { |
||||||
|
if (status == null) { |
||||||
|
return "未知"; |
||||||
|
} |
||||||
|
switch (status) { |
||||||
|
case 0: |
||||||
|
return "草稿"; |
||||||
|
case 1: |
||||||
|
return "审批中"; |
||||||
|
case 2: |
||||||
|
return "审批通过"; |
||||||
|
case 3: |
||||||
|
return "审批驳回"; |
||||||
|
case 4: |
||||||
|
return "已撤销"; |
||||||
|
default: |
||||||
|
return "未知"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,202 @@ |
|||||||
|
package org.springblade.desk.quality.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
import jakarta.validation.Valid; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.excel.util.ExcelUtil; |
||||||
|
import org.springblade.core.log.annotation.ApiLog; |
||||||
|
import org.springblade.core.mp.support.Condition; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.DateUtil; |
||||||
|
import org.springblade.desk.quality.constant.QAModuleConst; |
||||||
|
import org.springblade.desk.quality.excel.DispatchConfigApprovalExcel; |
||||||
|
import org.springblade.desk.quality.pojo.entity.DispatchConfigApproval; |
||||||
|
import org.springblade.desk.quality.pojo.request.DispatchConfigApprovalRequest; |
||||||
|
import org.springblade.desk.quality.pojo.vo.DispatchConfigApprovalVO; |
||||||
|
import org.springblade.desk.quality.service.IDispatchConfigApprovalService; |
||||||
|
import org.springblade.desk.quality.wrapper.DispatchConfigApprovalWrapper; |
||||||
|
import org.springframework.http.ResponseEntity; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 控制器 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping(QAModuleConst.CONTROLLER_PREFIX + "/DispatchConfigApproval") |
||||||
|
@Data |
||||||
|
@AllArgsConstructor |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@Slf4j |
||||||
|
@Tag(name = "[分派配置审批]", description = "[分派配置审批]接口") |
||||||
|
public class DispatchConfigApprovalController extends BladeController { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private IDispatchConfigApprovalService service; |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 详情 |
||||||
|
*/ |
||||||
|
@GetMapping("/detail") |
||||||
|
@ApiOperationSupport(order = 10) |
||||||
|
@Operation(summary = "详情", description = "传入DispatchConfigApproval Obj") |
||||||
|
public R<DispatchConfigApprovalVO> detail(DispatchConfigApproval dispatchConfigApproval) { |
||||||
|
QueryWrapper<DispatchConfigApproval> qw = Condition.getQueryWrapper(dispatchConfigApproval); |
||||||
|
DispatchConfigApproval detail = service.getOne(qw); |
||||||
|
DispatchConfigApprovalVO detailVO = DispatchConfigApprovalWrapper.build().entityVO(detail); |
||||||
|
return R.data(detailVO); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] list分页 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
@ApiOperationSupport(order = 20) |
||||||
|
@Operation(summary = "list分页", description = "传入DispatchConfigApproval Obj") |
||||||
|
public R<IPage<DispatchConfigApprovalVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> dispatchConfigApproval, |
||||||
|
Query query) { |
||||||
|
QueryWrapper<DispatchConfigApproval> qw = Condition.getQueryWrapper(dispatchConfigApproval, DispatchConfigApproval.class); |
||||||
|
IPage<DispatchConfigApproval> pages = service.page(Condition.getPage(query), qw); |
||||||
|
IPage<DispatchConfigApprovalVO> pagesVO = DispatchConfigApprovalWrapper.build().pageVO(pages); |
||||||
|
return R.data(pagesVO); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] page分页 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
@ApiOperationSupport(order = 21) |
||||||
|
@Operation(summary = "page分页", description = "传入DispatchConfigApproval Obj") |
||||||
|
public R<IPage<DispatchConfigApprovalVO>> page(DispatchConfigApprovalVO dispatchConfigApproval, Query query) { |
||||||
|
IPage<DispatchConfigApprovalVO> pagesVO = service.selectDispatchConfigApprovalPage( |
||||||
|
Condition.getPage(query), dispatchConfigApproval |
||||||
|
); |
||||||
|
return R.data(pagesVO); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] list下拉选择 |
||||||
|
*/ |
||||||
|
@GetMapping("/listForSelect") |
||||||
|
@ApiOperationSupport(order = 22) |
||||||
|
@Operation(summary = "list下拉选择", description = "") |
||||||
|
public R<List<DispatchConfigApprovalVO>> listForSelect() { |
||||||
|
List<DispatchConfigApproval> list = service.list(); |
||||||
|
List<DispatchConfigApprovalVO> listVO = DispatchConfigApprovalWrapper.build().listVO(list); |
||||||
|
return R.data(listVO); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 新增一条 |
||||||
|
*/ |
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperationSupport(order = 30) |
||||||
|
@ApiLog("新增分派配置审批") |
||||||
|
@Operation(summary = "新增一条", description = "传入DispatchConfigApproval Obj") |
||||||
|
public R save(@Valid @RequestBody DispatchConfigApproval addOne) { |
||||||
|
return service.saveDispatchConfigApproval(addOne); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 新增批量 |
||||||
|
*/ |
||||||
|
@PostMapping("/saveBat") |
||||||
|
@ApiOperationSupport(order = 31) |
||||||
|
@ApiLog("新增分派配置审批") |
||||||
|
@Operation(summary = "新增批量", description = "传入DispatchConfigApproval List") |
||||||
|
public R saveBat(@Valid @RequestBody List<DispatchConfigApproval> addList) { |
||||||
|
addList.forEach(one -> { |
||||||
|
one.setId(null); |
||||||
|
}); |
||||||
|
return R.status(service.saveBatch(addList)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 修改一条 |
||||||
|
*/ |
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperationSupport(order = 40) |
||||||
|
@ApiLog("修改分派配置审批") |
||||||
|
@Operation(summary = "修改一条", description = "传入DispatchConfigApproval Obj") |
||||||
|
public R update(@Valid @RequestBody DispatchConfigApproval updateOne) { |
||||||
|
return service.updateDispatchConfigApproval(updateOne); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 删除 |
||||||
|
*/ |
||||||
|
@PostMapping("/remove") |
||||||
|
@ApiOperationSupport(order = 50) |
||||||
|
@ApiLog("删除分派配置审批") |
||||||
|
@Operation(summary = "删除", description = "传入主键集合") |
||||||
|
public R remove(@RequestParam List<Long> ids) { |
||||||
|
return service.removeDispatchConfigApproval(ids); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 导出 |
||||||
|
*/ |
||||||
|
@GetMapping("/export") |
||||||
|
@ApiOperationSupport(order = 60) |
||||||
|
@ApiLog("导出分派配置审批") |
||||||
|
@Operation(summary = "导出", description = "传入DispatchConfigApproval Obj") |
||||||
|
public void export(DispatchConfigApproval dispatchConfigApproval, HttpServletResponse response) { |
||||||
|
List<DispatchConfigApprovalExcel> list = service.exportDispatchConfigApproval( |
||||||
|
DispatchConfigApprovalWrapper.build().entityVO(dispatchConfigApproval) |
||||||
|
); |
||||||
|
ExcelUtil.export(response, "分派配置审批数据" + DateUtil.time(), "分派配置审批数据表", list, DispatchConfigApprovalExcel.class); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 提交审批 |
||||||
|
*/ |
||||||
|
@PostMapping("/submitApproval") |
||||||
|
@ApiOperationSupport(order = 70) |
||||||
|
@ApiLog("提交分派配置审批") |
||||||
|
@Operation(summary = "提交审批", description = "传入主键ID") |
||||||
|
public R submitApproval(@Parameter(description = "主键ID", required = true) @RequestParam Long id) { |
||||||
|
return service.submitApproval(id); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 审批(待实现) |
||||||
|
*/ |
||||||
|
@PostMapping("/audit") |
||||||
|
@ApiOperationSupport(order = 80) |
||||||
|
@ApiLog("审批分派配置") |
||||||
|
@Operation(summary = "审批", description = "审批功能待实现") |
||||||
|
public R audit(@Parameter(description = "主键ID", required = true) @RequestParam Long id, |
||||||
|
@Parameter(description = "审批结果: 1-通过, 2-驳回", required = true) @RequestParam Integer result, |
||||||
|
@Parameter(description = "审批意见") @RequestParam(required = false) String remark) { |
||||||
|
return service.audit(id, result, remark); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* [分派配置审批] 查询审批历史 |
||||||
|
*/ |
||||||
|
@GetMapping("/auditHistory/{id}") |
||||||
|
@ApiOperationSupport(order = 90) |
||||||
|
@Operation(summary = "查询审批历史", description = "传入主键ID") |
||||||
|
public R<DispatchConfigApprovalVO> getAuditHistory(@Parameter(description = "主键ID", required = true) @PathVariable Long id) { |
||||||
|
return R.data(service.getAuditHistory(id)); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
package org.springblade.desk.quality.excel; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批Excel类 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DispatchConfigApprovalExcel implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ExcelProperty("申请单号") |
||||||
|
@ColumnWidth(20) |
||||||
|
private String applicationNo; |
||||||
|
|
||||||
|
@ExcelProperty("申请人") |
||||||
|
@ColumnWidth(15) |
||||||
|
private String applicantName; |
||||||
|
|
||||||
|
@ExcelProperty("申请时间") |
||||||
|
@ColumnWidth(20) |
||||||
|
private Date applicationTime; |
||||||
|
|
||||||
|
@ExcelProperty("申请描述") |
||||||
|
@ColumnWidth(40) |
||||||
|
private String remark; |
||||||
|
|
||||||
|
@ExcelProperty("状态") |
||||||
|
@ColumnWidth(15) |
||||||
|
private String statusName; |
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
package org.springblade.desk.quality.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.springblade.desk.quality.pojo.entity.DispatchConfigApproval; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批Mapper接口 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
public interface DispatchConfigApprovalMapper extends BaseMapper<DispatchConfigApproval> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,86 @@ |
|||||||
|
package org.springblade.desk.quality.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.desk.basic.service.en.EnBaseService; |
||||||
|
import org.springblade.desk.quality.excel.DispatchConfigApprovalExcel; |
||||||
|
import org.springblade.desk.quality.pojo.entity.DispatchConfigApproval; |
||||||
|
import org.springblade.desk.quality.pojo.vo.DispatchConfigApprovalVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批服务接口 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
public interface IDispatchConfigApprovalService extends EnBaseService<DispatchConfigApproval> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页查询 |
||||||
|
* |
||||||
|
* @param page 分页参数 |
||||||
|
* @param entity 查询条件 |
||||||
|
* @return 分页结果 |
||||||
|
*/ |
||||||
|
IPage<DispatchConfigApprovalVO> selectDispatchConfigApprovalPage(IPage<DispatchConfigApproval> page, DispatchConfigApprovalVO entity); |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出数据 |
||||||
|
* |
||||||
|
* @param entity 查询条件 |
||||||
|
* @return Excel数据列表 |
||||||
|
*/ |
||||||
|
List<DispatchConfigApprovalExcel> exportDispatchConfigApproval(DispatchConfigApprovalVO entity); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增分派配置审批 |
||||||
|
* |
||||||
|
* @param entity 分派配置审批实体 |
||||||
|
* @return 操作结果 |
||||||
|
*/ |
||||||
|
R saveDispatchConfigApproval(DispatchConfigApproval entity); |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改分派配置审批 |
||||||
|
* |
||||||
|
* @param entity 分派配置审批实体 |
||||||
|
* @return 操作结果 |
||||||
|
*/ |
||||||
|
R updateDispatchConfigApproval(DispatchConfigApproval entity); |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除分派配置审批 |
||||||
|
* |
||||||
|
* @param ids 主键ID列表 |
||||||
|
* @return 操作结果 |
||||||
|
*/ |
||||||
|
R removeDispatchConfigApproval(List<Long> ids); |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交审批 |
||||||
|
* |
||||||
|
* @param id 主键ID |
||||||
|
* @return 操作结果 |
||||||
|
*/ |
||||||
|
R submitApproval(Long id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批(待实现) |
||||||
|
* |
||||||
|
* @param id 主键ID |
||||||
|
* @param result 审批结果: 1-通过, 2-驳回 |
||||||
|
* @param remark 审批意见 |
||||||
|
* @return 操作结果 |
||||||
|
*/ |
||||||
|
R audit(Long id, Integer result, String remark); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询审批历史 |
||||||
|
* |
||||||
|
* @param id 主键ID |
||||||
|
* @return 审批历史信息 |
||||||
|
*/ |
||||||
|
DispatchConfigApprovalVO getAuditHistory(Long id); |
||||||
|
} |
||||||
@ -0,0 +1,230 @@ |
|||||||
|
package org.springblade.desk.quality.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.desk.basic.service.en.impl.EnBaseServiceImpl; |
||||||
|
import org.springblade.desk.quality.constant.DispatchConfigApprovalConst; |
||||||
|
import org.springblade.desk.quality.excel.DispatchConfigApprovalExcel; |
||||||
|
import org.springblade.desk.quality.mapper.DispatchConfigApprovalMapper; |
||||||
|
import org.springblade.desk.quality.pojo.entity.DispatchConfigApproval; |
||||||
|
import org.springblade.desk.quality.pojo.request.DispatchConfigApprovalRequest; |
||||||
|
import org.springblade.desk.quality.pojo.vo.DispatchConfigApprovalVO; |
||||||
|
import org.springblade.desk.quality.service.IDispatchConfigApprovalService; |
||||||
|
import org.springblade.desk.quality.wrapper.DispatchConfigApprovalWrapper; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批服务实现类 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class DispatchConfigApprovalServiceImpl extends EnBaseServiceImpl<DispatchConfigApprovalMapper, DispatchConfigApproval> implements IDispatchConfigApprovalService { |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<DispatchConfigApprovalVO> selectDispatchConfigApprovalPage(IPage<DispatchConfigApproval> page, DispatchConfigApprovalVO entity) { |
||||||
|
QueryWrapper<DispatchConfigApproval> queryWrapper = new QueryWrapper<>(); |
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
if (entity != null) { |
||||||
|
if (StrUtil.isNotBlank(entity.getApplicationNo())) { |
||||||
|
queryWrapper.like("APPLICATION_NO", entity.getApplicationNo()); |
||||||
|
} |
||||||
|
if (StrUtil.isNotBlank(entity.getApplicantName())) { |
||||||
|
queryWrapper.like("APPLICANT_NAME", entity.getApplicantName()); |
||||||
|
} |
||||||
|
if (entity.getStatus() != null) { |
||||||
|
queryWrapper.eq("STATUS", entity.getStatus()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 按创建时间降序
|
||||||
|
queryWrapper.orderByDesc("CREATE_TIME"); |
||||||
|
|
||||||
|
IPage<DispatchConfigApproval> pages = baseMapper.selectPage( |
||||||
|
page, |
||||||
|
queryWrapper |
||||||
|
); |
||||||
|
return DispatchConfigApprovalWrapper.build().pageVO(pages); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<DispatchConfigApprovalExcel> exportDispatchConfigApproval(DispatchConfigApprovalVO entity) { |
||||||
|
QueryWrapper<DispatchConfigApproval> queryWrapper = new QueryWrapper<>(); |
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
if (entity != null) { |
||||||
|
if (StrUtil.isNotBlank(entity.getApplicationNo())) { |
||||||
|
queryWrapper.like("APPLICATION_NO", entity.getApplicationNo()); |
||||||
|
} |
||||||
|
if (StrUtil.isNotBlank(entity.getApplicantName())) { |
||||||
|
queryWrapper.like("APPLICANT_NAME", entity.getApplicantName()); |
||||||
|
} |
||||||
|
if (entity.getStatus() != null) { |
||||||
|
queryWrapper.eq("STATUS", entity.getStatus()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
queryWrapper.orderByDesc("CREATE_TIME"); |
||||||
|
List<DispatchConfigApproval> list = list(queryWrapper); |
||||||
|
|
||||||
|
List<DispatchConfigApprovalExcel> excelList = new ArrayList<>(); |
||||||
|
for (DispatchConfigApproval item : list) { |
||||||
|
DispatchConfigApprovalExcel excel = new DispatchConfigApprovalExcel(); |
||||||
|
BeanUtils.copyProperties(item, excel); |
||||||
|
excel.setStatusName(getStatusName(item.getStatus())); |
||||||
|
excelList.add(excel); |
||||||
|
} |
||||||
|
|
||||||
|
return excelList; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public R saveDispatchConfigApproval(DispatchConfigApproval entity) { |
||||||
|
// 生成申请单号
|
||||||
|
String applicationNo = generateApplicationNo(); |
||||||
|
entity.setApplicationNo(applicationNo); |
||||||
|
|
||||||
|
// 设置申请人信息
|
||||||
|
entity.setApplicantId(AuthUtil.getUserId()); |
||||||
|
entity.setApplicantName(AuthUtil.getUserName()); |
||||||
|
entity.setApplicationTime(new Date()); |
||||||
|
|
||||||
|
// 设置初始状态为草稿
|
||||||
|
entity.setStatus(DispatchConfigApprovalConst.STATUS_DRAFT); |
||||||
|
|
||||||
|
return R.status(save(entity)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public R updateDispatchConfigApproval(DispatchConfigApproval entity) { |
||||||
|
// 检查是否存在
|
||||||
|
DispatchConfigApproval existing = getById(entity.getId()); |
||||||
|
if (existing == null) { |
||||||
|
return R.fail("记录不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
// 只有草稿状态可以修改
|
||||||
|
if (!DispatchConfigApprovalConst.STATUS_DRAFT.equals(existing.getStatus())) { |
||||||
|
return R.fail("只有草稿状态的记录可以修改"); |
||||||
|
} |
||||||
|
|
||||||
|
return R.status(updateById(entity)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public R removeDispatchConfigApproval(List<Long> ids) { |
||||||
|
if (ids == null || ids.isEmpty()) { |
||||||
|
return R.fail("请选择要删除的记录"); |
||||||
|
} |
||||||
|
|
||||||
|
// 检查状态,只有草稿状态可以删除
|
||||||
|
for (Long id : ids) { |
||||||
|
DispatchConfigApproval entity = getById(id); |
||||||
|
if (entity != null && !DispatchConfigApprovalConst.STATUS_DRAFT.equals(entity.getStatus())) { |
||||||
|
return R.fail("只有草稿状态的记录可以删除"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return R.status(removeByIds(ids)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public R submitApproval(Long id) { |
||||||
|
DispatchConfigApproval entity = getById(id); |
||||||
|
if (entity == null) { |
||||||
|
return R.fail("记录不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
// 只有草稿状态可以提交审批
|
||||||
|
if (!DispatchConfigApprovalConst.STATUS_DRAFT.equals(entity.getStatus())) { |
||||||
|
return R.fail("只有草稿状态的记录可以提交审批"); |
||||||
|
} |
||||||
|
|
||||||
|
// 更新状态为审批中
|
||||||
|
entity.setStatus(DispatchConfigApprovalConst.STATUS_APPROVING); |
||||||
|
updateById(entity); |
||||||
|
|
||||||
|
// TODO: 发送消息通知给审批人
|
||||||
|
|
||||||
|
return R.success("提交审批成功"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public R audit(Long id, Integer result, String remark) { |
||||||
|
// TODO: 审批功能逻辑待确认,暂时返回提示信息
|
||||||
|
return R.fail("审批功能待实现"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DispatchConfigApprovalVO getAuditHistory(Long id) { |
||||||
|
DispatchConfigApproval entity = getById(id); |
||||||
|
if (entity == null) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
return DispatchConfigApprovalVO.fromEntity(entity); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 生成申请单号 |
||||||
|
* 格式:YYYYMMDD + 3位序号 |
||||||
|
*/ |
||||||
|
private String generateApplicationNo() { |
||||||
|
String dateStr = cn.hutool.core.date.DateUtil.format(new Date(), "yyyyMMdd"); |
||||||
|
|
||||||
|
// 查询当天最大序号
|
||||||
|
QueryWrapper<DispatchConfigApproval> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.likeRight("APPLICATION_NO", dateStr) |
||||||
|
.orderByDesc("APPLICATION_NO") |
||||||
|
.last("LIMIT 1"); |
||||||
|
|
||||||
|
DispatchConfigApproval last = getOne(queryWrapper); |
||||||
|
int seq = 1; |
||||||
|
if (last != null && StrUtil.isNotBlank(last.getApplicationNo())) { |
||||||
|
String lastSeq = last.getApplicationNo().substring(8); |
||||||
|
seq = Integer.parseInt(lastSeq) + 1; |
||||||
|
} |
||||||
|
|
||||||
|
return dateStr + String.format("%03d", seq); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取状态名称 |
||||||
|
*/ |
||||||
|
private String getStatusName(Integer status) { |
||||||
|
if (status == null) { |
||||||
|
return "未知"; |
||||||
|
} |
||||||
|
switch (status) { |
||||||
|
case 0: |
||||||
|
return "草稿"; |
||||||
|
case 1: |
||||||
|
return "审批中"; |
||||||
|
case 2: |
||||||
|
return "审批通过"; |
||||||
|
case 3: |
||||||
|
return "审批驳回"; |
||||||
|
case 4: |
||||||
|
return "已撤销"; |
||||||
|
default: |
||||||
|
return "未知"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
package org.springblade.desk.quality.wrapper; |
||||||
|
|
||||||
|
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||||
|
import org.springblade.desk.quality.pojo.entity.DispatchConfigApproval; |
||||||
|
import org.springblade.desk.quality.pojo.vo.DispatchConfigApprovalVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分派配置审批包装类 |
||||||
|
* |
||||||
|
* @author AI |
||||||
|
* @since 2026-05-19 |
||||||
|
*/ |
||||||
|
public class DispatchConfigApprovalWrapper extends BaseEntityWrapper<DispatchConfigApproval, DispatchConfigApprovalVO> { |
||||||
|
|
||||||
|
public static DispatchConfigApprovalWrapper build() { |
||||||
|
return new DispatchConfigApprovalWrapper(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DispatchConfigApprovalVO entityVO(DispatchConfigApproval entity) { |
||||||
|
return DispatchConfigApprovalVO.fromEntity(entity); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue