feat:权限审批
This commit is contained in:
1 parent
54e3a20095
commit
4f4055f9e5
22 files changed
+740
-186
No files matched your search
+23
-19
@@ -226,18 +226,20 @@ CREATE INDEX idx_dept_id ON wallet_recharge_import (user_id);
|
||||
DROP TABLE IF EXISTS wallet_stride;
|
||||
CREATE TABLE wallet_stride
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
count int NOT NULL COMMENT '申请数量',
|
||||
use_count int NOT NULL COMMENT '使用数量',
|
||||
user_id bigint NOT NULL COMMENT '申请人id',
|
||||
remark varchar(1024) COMMENT '备注',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
process_id varchar(256) COMMENT '流程id',
|
||||
process_status int(10) NOT NULL COMMENT '审核状体',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
count int NOT NULL COMMENT '申请数量',
|
||||
use_count int DEFAULT 0 COMMENT '使用数量',
|
||||
user_id bigint NOT NULL COMMENT '申请人id',
|
||||
remark varchar(1024) COMMENT '备注',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='跨单位就餐';
|
||||
@@ -248,13 +250,15 @@ CREATE TABLE wallet_stride
|
||||
DROP TABLE IF EXISTS wallet_foreign;
|
||||
CREATE TABLE wallet_foreign
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
apply_start_time date NULL COMMENT '申请使用开始时间',
|
||||
apply_end_time date NULL COMMENT '申请使用结束时间',
|
||||
count int NOT NULL COMMENT '申请数量',
|
||||
use_count int NOT NULL COMMENT '使用数量',
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
process_id varchar(256) COMMENT '流程id',
|
||||
process_status int(10) NOT NULL COMMENT '审核状体',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
apply_start_time date NULL COMMENT '申请使用开始时间',
|
||||
apply_end_time date NULL COMMENT '申请使用结束时间',
|
||||
count int NOT NULL COMMENT '申请数量',
|
||||
use_count int DEFAULT 0 COMMENT '使用数量',
|
||||
remark VARCHAR(1024) COMMENT '申请备注',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ public class ProcessController {
|
||||
* @param flowId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getDetail")
|
||||
@GetMapping("/getDetail")
|
||||
public R<ProcessVO> getDetail(String flowId) {
|
||||
return processService.getDetail(flowId);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class ProcessController {
|
||||
* @param process
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("create")
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody Process process) {
|
||||
return processService.create(process);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class ProcessController {
|
||||
* @param type 类型 stop using delete
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("update/{flowId}")
|
||||
@PutMapping("/update/{flowId}")
|
||||
public R update(@PathVariable String flowId, @RequestParam String type,
|
||||
@RequestParam(required = false) Long groupId) {
|
||||
return processService.update(flowId, type, groupId);
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class ProcessInstanceController {
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
@PostMapping("startProcessInstance")
|
||||
@PostMapping("/startProcessInstance")
|
||||
public R startProcessInstance(@RequestBody ProcessInstanceParamDto processInstanceParamDto) {
|
||||
return processInstanceService.startProcessInstance(processInstanceParamDto);
|
||||
}
|
||||
|
||||
+2
@@ -5,6 +5,8 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.flow.task.entity.Process;
|
||||
import com.bsd.pjcloud.flow.task.vo.ProcessVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
|
||||
+2
@@ -259,4 +259,6 @@ public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> impl
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.wallet.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WalletForeignDto extends WalletForeignEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
|
||||
}
|
||||
+7
@@ -3,6 +3,13 @@ package com.bsd.pjcloud.wallet.api.dto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WalletStrideDto extends WalletStrideEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
}
|
||||
+78
-63
@@ -3,9 +3,9 @@ package com.bsd.pjcloud.wallet.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -15,6 +15,9 @@ import java.time.LocalDateTime;
|
||||
* @author dzc
|
||||
* @date 2025-01-02 16:26:48
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_foreign")
|
||||
@@ -23,94 +26,106 @@ import java.time.LocalDateTime;
|
||||
public class WalletForeignEntity extends Model<WalletForeignEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description="用户id")
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private Integer processStatus;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 申请使用开始时间
|
||||
*/
|
||||
@Schema(description="申请使用开始时间")
|
||||
/**
|
||||
* 申请使用开始时间
|
||||
*/
|
||||
@Schema(description = "申请使用开始时间")
|
||||
private LocalDate applyStartTime;
|
||||
|
||||
/**
|
||||
* 申请使用结束时间
|
||||
*/
|
||||
@Schema(description="申请使用结束时间")
|
||||
/**
|
||||
* 申请使用结束时间
|
||||
*/
|
||||
@Schema(description = "申请使用结束时间")
|
||||
private LocalDate applyEndTime;
|
||||
|
||||
/**
|
||||
* 申请数量
|
||||
*/
|
||||
@Schema(description="申请数量")
|
||||
/**
|
||||
* 申请数量
|
||||
*/
|
||||
@Schema(description = "申请数量")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
@Schema(description="使用数量")
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
@Schema(description = "使用数量")
|
||||
private Integer useCount;
|
||||
|
||||
/**
|
||||
* 申请备注
|
||||
*/
|
||||
@Schema(description="申请备注")
|
||||
/**
|
||||
* 申请备注
|
||||
*/
|
||||
@Schema(description = "申请备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+70
-55
@@ -3,9 +3,9 @@ package com.bsd.pjcloud.wallet.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -14,6 +14,9 @@ import java.time.LocalDateTime;
|
||||
* @author pjcloud
|
||||
* @date 2025-01-02 16:27:26
|
||||
*/
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_stride")
|
||||
@@ -22,82 +25,94 @@ import java.time.LocalDateTime;
|
||||
public class WalletStrideEntity extends Model<WalletStrideEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private Integer processStatus;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 申请数量
|
||||
*/
|
||||
@Schema(description="申请数量")
|
||||
/**
|
||||
* 申请数量
|
||||
*/
|
||||
@Schema(description = "申请数量")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
@Schema(description="使用数量")
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
@Schema(description = "使用数量")
|
||||
private Integer useCount;
|
||||
|
||||
/**
|
||||
* 申请人id
|
||||
*/
|
||||
@Schema(description="申请人id")
|
||||
/**
|
||||
* 申请人id
|
||||
*/
|
||||
@Schema(description = "申请人id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+17
-1
@@ -1,9 +1,25 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletForeignVo extends WalletForeignEntity {
|
||||
public class WalletForeignVo extends WalletForeignEntity implements BaseUserInterface, BaseDeptInterface {
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 部门相关
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
+16
-1
@@ -1,9 +1,24 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletStrideVo extends WalletStrideEntity {
|
||||
public class WalletStrideVo extends WalletStrideEntity implements BaseUserInterface, BaseDeptInterface {
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 部门相关
|
||||
*/
|
||||
private String deptName;
|
||||
}
|
||||
@@ -98,6 +98,10 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-flow-task-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package com.bsd.pjcloud.wallet.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletForeignService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 外来人员电子餐券表
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2025-01-02 16:26:48
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wallet-foreign")
|
||||
@Tag(description = "wallet-foreign", name = "外来人员电子餐券表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletForeignController {
|
||||
|
||||
private final WalletForeignService walletForeignService;
|
||||
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
@Inner
|
||||
@PostMapping("/apply-callback")
|
||||
public void applyCallback(@RequestBody ProcessNodeRecordAssignUserParamDto dto) {
|
||||
walletForeignService.applyCallback(dto);
|
||||
}
|
||||
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_view')")
|
||||
public R getWalletForeignPage(@ParameterObject Page page, @ParameterObject WalletForeignEntity walletForeign) {
|
||||
LambdaQueryWrapper<WalletForeignEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletForeignService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_view')")
|
||||
public R getWalletForeignPageJoin(@ParameterObject Page page, @ParameterObject WalletForeignDto dto) {
|
||||
return R.ok(walletForeignService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletForeignService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增外来人员电子餐券表", description = "新增外来人员电子餐券表")
|
||||
@SysLog("新增外来人员电子餐券表")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_add')")
|
||||
public R save(@RequestBody WalletForeignDto dto) {
|
||||
return R.ok(walletForeignService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "App新增外来人员电子餐券表", description = "App新增外来人员电子餐券表")
|
||||
@SysLog("App新增外来人员电子餐券表")
|
||||
@PostMapping("/app")
|
||||
public R appSave(@RequestBody WalletForeignDto dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
dto.setUserId(loginUser.getId());
|
||||
return R.ok(walletForeignService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改外来人员电子餐券表", description = "修改外来人员电子餐券表")
|
||||
@SysLog("修改外来人员电子餐券表")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_edit')")
|
||||
public R updateById(@RequestBody WalletForeignEntity walletForeign) {
|
||||
return R.ok(walletForeignService.updateById(walletForeign));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除外来人员电子餐券表
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除外来人员电子餐券表", description = "通过id删除外来人员电子餐券表")
|
||||
@SysLog("通过id删除外来人员电子餐券表")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletForeignService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_export')")
|
||||
public List<WalletForeignEntity> export(WalletForeignEntity walletForeign, Long[] ids) {
|
||||
return walletForeignService.list(Wrappers.lambdaQuery(walletForeign).in(ArrayUtil.isNotEmpty(ids), WalletForeignEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+51
-38
@@ -7,6 +7,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletStrideService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -20,7 +26,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 跨单位就餐
|
||||
@@ -30,19 +35,24 @@ import java.util.Objects;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/walletStride" )
|
||||
@Tag(description = "walletStride" , name = "跨单位就餐管理" )
|
||||
@RequestMapping("/wallet-stride" )
|
||||
@Tag(description = "wallet-stride" , name = "跨单位就餐管理" )
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletStrideController {
|
||||
|
||||
private final WalletStrideService walletStrideService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param walletStride 跨单位就餐
|
||||
* @return
|
||||
*/
|
||||
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
@Inner
|
||||
@PostMapping("/apply-callback" )
|
||||
public void applyCallback(@RequestBody ProcessNodeRecordAssignUserParamDto dto) {
|
||||
walletStrideService.applyCallback(dto);
|
||||
}
|
||||
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')" )
|
||||
@@ -51,12 +61,13 @@ public class WalletStrideController {
|
||||
return R.ok(walletStrideService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')")
|
||||
public R getWalletStrideJoin(@ParameterObject Page page, @ParameterObject WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询跨单位就餐
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')" )
|
||||
@@ -64,24 +75,38 @@ public class WalletStrideController {
|
||||
return R.ok(walletStrideService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增跨单位就餐
|
||||
* @param walletStride 跨单位就餐
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("新增跨单位就餐" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_add')" )
|
||||
public R save(@RequestBody WalletStrideEntity walletStride) {
|
||||
return R.ok(walletStrideService.save(walletStride));
|
||||
public R save(@RequestBody WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("新增跨单位就餐" )
|
||||
@PostMapping("/app")
|
||||
public R appSave(@RequestBody WalletStrideDto dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
dto.setUserId(loginUser.getId());
|
||||
return R.ok(walletStrideService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("admin申请" )
|
||||
@PostMapping("/apply")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_apply')" )
|
||||
public R apply(@RequestBody WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.apply(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("app申请" )
|
||||
@PostMapping("/app-apply")
|
||||
public R appApply(@RequestBody WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.apply(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改跨单位就餐
|
||||
* @param walletStride 跨单位就餐
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改跨单位就餐" , description = "修改跨单位就餐" )
|
||||
@SysLog("修改跨单位就餐" )
|
||||
@PutMapping
|
||||
@@ -90,11 +115,6 @@ public class WalletStrideController {
|
||||
return R.ok(walletStrideService.updateById(walletStride));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除跨单位就餐
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除跨单位就餐" , description = "通过id删除跨单位就餐" )
|
||||
@SysLog("通过id删除跨单位就餐" )
|
||||
@DeleteMapping
|
||||
@@ -103,13 +123,6 @@ public class WalletStrideController {
|
||||
return R.ok(walletStrideService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param walletStride 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_export')" )
|
||||
|
||||
+13
-1
@@ -1,10 +1,22 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletForeignVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface WalletForeignMapper extends PjcloudBaseMapper<WalletForeignEntity> {
|
||||
|
||||
|
||||
default Page<WalletForeignVo> pageJoin(Page page, WalletForeignDto dto) {
|
||||
MPJLambdaWrapper<WalletForeignEntity> wrapper = new MPJLambdaWrapper<WalletForeignEntity>()
|
||||
.selectAll(WalletForeignEntity.class)
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletForeignEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletForeignEntity::getUserId, dto.getUserIds());
|
||||
return selectJoinPage(page, WalletForeignVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+13
-1
@@ -1,11 +1,23 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.admin.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletStrideVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface WalletStrideMapper extends PjcloudBaseMapper<WalletStrideEntity> {
|
||||
|
||||
default Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto) {
|
||||
MPJLambdaWrapper<WalletStrideEntity> wrapper = new MPJLambdaWrapper<WalletStrideEntity>()
|
||||
.selectAll(WalletStrideEntity.class)
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletStrideEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletStrideEntity::getUserId, dto.getUserIds());
|
||||
return selectJoinPage(page, WalletStrideVo.class, wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -1,8 +1,17 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletForeignVo;
|
||||
|
||||
public interface WalletForeignService extends IService<WalletForeignEntity> {
|
||||
|
||||
Long create(WalletForeignDto dto);
|
||||
|
||||
Page<WalletForeignVo> pageJoin(Page page, WalletForeignDto dto);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
}
|
||||
+14
@@ -1,8 +1,22 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletStrideVo;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public interface WalletStrideService extends IService<WalletStrideEntity> {
|
||||
|
||||
Boolean apply(WalletStrideDto dto);
|
||||
|
||||
Long create(WalletStrideDto dto);
|
||||
|
||||
Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto);
|
||||
|
||||
WalletStrideVo detail(@NotNull Long id);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
}
|
||||
+85
-1
@@ -1,10 +1,35 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletForeignVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletForeignMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletForeignService;
|
||||
import com.bsd.pjcloud.wallet.utils.FlowUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 外来人员电子餐券表
|
||||
@@ -12,7 +37,66 @@ import org.springframework.stereotype.Service;
|
||||
* @author dzc
|
||||
* @date 2025-01-02 16:26:48
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, WalletForeignEntity> implements WalletForeignService {
|
||||
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
|
||||
private final FlowUtil flowUtil;
|
||||
|
||||
@Override
|
||||
public Long create(WalletForeignDto dto) {
|
||||
// 查询发起人
|
||||
R<UserInfo> userData = userService.getByUserId(dto.getUserId());
|
||||
if (ObjectUtil.isEmpty(userData.getData())) {
|
||||
throw new RuntimeException("发起人不存在");
|
||||
}
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(dto.getUserId())) {
|
||||
throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
}
|
||||
dto.setDeptId(userData.getData().getSysUser().getDeptId());
|
||||
dto.setProcessStatus(NodeStatusEnum.WKS.getCode());
|
||||
baseMapper.insert(dto);
|
||||
// 发起审批
|
||||
String processId = flowUtil.startFlow("TASK_STRIDE_FLOW", userData.getData().getSysUser(), dto.getId());
|
||||
baseMapper.updateById(WalletForeignEntity.builder().id(dto.getId()).processId(processId).processStatus(NodeStatusEnum.JXZ.getCode()).build());
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletForeignVo> pageJoin(Page page, WalletForeignDto dto) {
|
||||
Page<WalletForeignVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletForeignVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletForeignVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletForeignEntity>()
|
||||
.eq(WalletForeignEntity::getUserId, walletId)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -145,13 +145,13 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletManageVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletManageVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
return R.ok(list);
|
||||
|
||||
+107
@@ -1,16 +1,123 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.TaskStatusEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.flow.task.api.feign.RemoteFlowApiFlowService;
|
||||
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessInstanceParamDto;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.flow.task.vo.ProcessVO;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletStrideVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletStrideMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletStrideService;
|
||||
import com.bsd.pjcloud.wallet.utils.FlowUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 跨单位就餐
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2025-01-02 16:27:26
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, WalletStrideEntity> implements WalletStrideService {
|
||||
|
||||
static private final String TAG = "跨单位就餐";
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
private final RemoteFlowApiFlowService flowApiFlowService;
|
||||
|
||||
private final FlowUtil flowUtil;
|
||||
|
||||
@Override
|
||||
public Boolean apply(WalletStrideDto dto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create(WalletStrideDto dto) {
|
||||
// 查询发起人
|
||||
R<UserInfo> userData = userService.getByUserId(dto.getUserId());
|
||||
if (ObjectUtil.isEmpty(userData.getData())) {
|
||||
throw new RuntimeException("发起人不存在");
|
||||
}
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(dto.getUserId())) {
|
||||
throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
}
|
||||
dto.setDeptId(userData.getData().getSysUser().getDeptId());
|
||||
dto.setProcessStatus(NodeStatusEnum.WKS.getCode());
|
||||
baseMapper.insert(dto);
|
||||
// 发起审批
|
||||
String processId = flowUtil.startFlow("TASK_STRIDE_FLOW", userData.getData().getSysUser(), dto.getId());
|
||||
baseMapper.updateById(WalletStrideEntity.builder().id(dto.getId()).processId(processId).processStatus(NodeStatusEnum.JXZ.getCode()).build());
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto) {
|
||||
Page<WalletStrideVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletStrideVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletStrideVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletStrideVo detail(Long id) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletStrideEntity>()
|
||||
.eq(WalletStrideEntity::getUserId, walletId)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.bsd.pjcloud.wallet.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.flow.task.api.feign.RemoteFlowApiFlowService;
|
||||
import com.bsd.pjcloud.flow.task.constant.NodeUserTypeEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessInstanceParamDto;
|
||||
import com.bsd.pjcloud.flow.task.vo.FormItemVO;
|
||||
import com.bsd.pjcloud.flow.task.vo.ProcessVO;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class FlowUtil {
|
||||
|
||||
static private final String TAG = "钱包审批流工具类";
|
||||
|
||||
private final RemoteFlowApiFlowService flowApiFlowService;
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public String startFlow(String flowIdKey, SysUser user, Long businessId) {
|
||||
// 发起工作流
|
||||
String defaultRole = ParamResolver.getStr(flowIdKey);
|
||||
if (ObjectUtil.isEmpty(defaultRole)) {
|
||||
log.error("|{}|请配置跨单位审批流程ID;userId:|{}|businessId:|{}|", TAG, user.getUserId(), businessId);
|
||||
throw new RuntimeException("请配置跨单位审批流程ID");
|
||||
}
|
||||
R<ProcessVO> detail = flowApiFlowService.getDetail(defaultRole);
|
||||
if (!ObjectUtil.isAllNotEmpty(detail, detail.getData(), detail.getData().getId())) {
|
||||
log.error("|{}|未查询到该审批流程;userId:|{}|businessId:|{}|", TAG, user.getUserId(), businessId);
|
||||
throw new RuntimeException("未查询到该审批流程");
|
||||
}
|
||||
ProcessVO processVo = detail.getData();
|
||||
ProcessInstanceParamDto processDto = new ProcessInstanceParamDto();
|
||||
Map<String, Object> paramMap = readMap(processVo, user);
|
||||
processDto.setFlowId(processVo.getFlowId());
|
||||
processDto.setParamMap(paramMap);
|
||||
processDto.setStartUserId(String.valueOf(user.getUserId()));
|
||||
R<String> startVo = flowApiFlowService.startProcessInstance(processDto);
|
||||
if (!ObjectUtil.isAllNotEmpty(startVo, startVo.getData())) {
|
||||
log.error("|{}|发起审批流程错误;userId:|{}|businessId:|{}|", TAG, user.getUserId(), businessId);
|
||||
throw new RuntimeException("发起审批流程错误");
|
||||
}
|
||||
return startVo.getData();
|
||||
}
|
||||
|
||||
public Map<String, Object> readMap(ProcessVO vo, SysUser user) {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
Dict rootUser = Dict.create()
|
||||
.set("id", user.getUserId())
|
||||
.set("name", user.getUsername())
|
||||
.set("type", NodeUserTypeEnum.USER.getKey());
|
||||
paramMap.put("root", CollUtil.newArrayList(rootUser));
|
||||
try {
|
||||
List<FormItemVO> formItemVOList = objectMapper.readValue(vo.getFormItems(), new TypeReference<>() {
|
||||
});
|
||||
for (FormItemVO v : formItemVOList) {
|
||||
if (ObjectUtil.equals(v.getType(), "Layout")) continue;
|
||||
if (!ObjectUtil.isAllNotEmpty(v.getId(), v.getProps())) continue;
|
||||
paramMap.put(v.getId(), v.getProps().getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return paramMap;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user