creat:生成核销二维码
This commit is contained in:
1 parent
4f4055f9e5
commit
3a4bd07819
29 files changed
+662
-202
No files matched your search
+14
-14
@@ -221,18 +221,18 @@ CREATE TABLE wallet_recharge_import
|
||||
CREATE INDEX idx_dept_id ON wallet_recharge_import (user_id);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for wallet_stride_dept
|
||||
-- Table structure for wallet_stride
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS wallet_stride;
|
||||
CREATE TABLE wallet_stride
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
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 '申请数量',
|
||||
process_status varchar(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',
|
||||
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 '创建时间',
|
||||
@@ -245,19 +245,19 @@ CREATE TABLE wallet_stride
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='跨单位就餐';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for wallet_recharge_import
|
||||
-- Table structure for wallet_foreign
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS wallet_foreign;
|
||||
CREATE TABLE wallet_foreign
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
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 '申请数量',
|
||||
process_status varchar(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 '创建人',
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.flow.task.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TaskCheckStatusEnum {
|
||||
|
||||
PADDING("1", "审核中"),
|
||||
RESULT("2", "审核通过"),
|
||||
REJECT("3", "审核拒绝"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
public static TaskCheckStatusEnum descOf(String description) {
|
||||
return Arrays.stream(TaskCheckStatusEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package hardware.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 硬件订单类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardOrderTypeEnum {
|
||||
BELOW(1, "线下购买"),
|
||||
RESERVE(2, "线上订餐"),
|
||||
FOREIGN_TICKET(3, "外来人员"),
|
||||
STRIDE_DEPT(4, "跨单位"),
|
||||
;
|
||||
private final Integer type;
|
||||
private final String description;
|
||||
|
||||
public static HardOrderTypeEnum valueOfByType(Integer type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package hardware.constant;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 硬件订单支付方式
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardPayTypeEnum {
|
||||
WALLET_DEFAULT(1, "普通钱包支付"),
|
||||
WALLET_QR_CODE(2, "钱包二维码支付"),
|
||||
WALLET_CARD(3, "钱包饭卡支付"),
|
||||
FACE(4, "人脸识别支付"),
|
||||
STRIDE_DEPT_QR_CODE(5, "跨单位二维码支付"),
|
||||
FOREIGN_TICKET_QR_CODE(6, "外来人员二维码支付"),
|
||||
RESERVE_QR_CODE(7, "线上订餐二维码支付"),
|
||||
CASH(8, "现金支付"),
|
||||
;
|
||||
private final Integer type;
|
||||
private final String description;
|
||||
|
||||
public static HardPayTypeEnum valueOfByType(Integer type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* @author pigx archetype
|
||||
* <p>
|
||||
* 常量和枚举定义
|
||||
*/
|
||||
package hardware.constant;
|
||||
Whitespace-only changes.
@@ -0,0 +1,39 @@
|
||||
package hardware.dto.code;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class QRCodeDto {
|
||||
// 总id
|
||||
private Long id;
|
||||
|
||||
// 子id
|
||||
private Long itemId;
|
||||
|
||||
// 类型id 比如钱包类型
|
||||
private Long typeId;
|
||||
|
||||
// 用户id
|
||||
private Long userId;
|
||||
|
||||
// 订单类型
|
||||
private Integer orderType;
|
||||
|
||||
// 支付类型
|
||||
private Integer payType;
|
||||
|
||||
// 过期时间 -1 代表没有限制
|
||||
private Long exceedTime;
|
||||
|
||||
/**
|
||||
* 额外的用户信息json
|
||||
* @see QRCodeExtraDto
|
||||
*/
|
||||
private String extra;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* @author pigx archetype
|
||||
* <p>
|
||||
* DTO 存放目录
|
||||
*/
|
||||
package hardware.dto;
|
||||
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* @author pigx archetype
|
||||
* <p>
|
||||
* 实体 存放目录
|
||||
*/
|
||||
package hardware.entity;
|
||||
@@ -0,0 +1,44 @@
|
||||
package hardware.utils;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import hardware.dto.code.QRCodeDto;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class HardUtil {
|
||||
|
||||
public Pair<String, String> generate(QRCodeDto dto) {
|
||||
String fileName = "qrcode";
|
||||
if (ObjectUtil.isEmpty(dto.getId())) {
|
||||
fileName += "_unknown";
|
||||
} else {
|
||||
fileName += "_" + dto.getId().toString();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(dto.getItemId())) {
|
||||
fileName += "_unknown";
|
||||
} else {
|
||||
fileName += "_" + dto.getItemId().toString();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(dto.getUserId())) {
|
||||
fileName += "_unknown";
|
||||
} else {
|
||||
fileName += "_" + dto.getUserId().toString();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(dto.getOrderType())) {
|
||||
fileName += "_unknown";
|
||||
} else {
|
||||
fileName += "_" + dto.getOrderType().toString();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(dto.getPayType())) {
|
||||
fileName += "_unknown";
|
||||
} else {
|
||||
fileName += "_" + dto.getPayType().toString();
|
||||
}
|
||||
String coeContent = Base64.encode(JSONUtil.toJsonStr(dto));
|
||||
return new Pair<>(fileName, coeContent);
|
||||
}
|
||||
|
||||
}
|
||||
+9
-1
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.admin.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -24,9 +25,16 @@ public interface RemoteFileService {
|
||||
Response getFile(@RequestParam String fileName);
|
||||
|
||||
|
||||
@PostMapping(value = "/sys-file/upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@PostMapping(value = "/sys-file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
R upload(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "dir", required = false) String dir,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "type", required = false) String type);
|
||||
|
||||
@NoToken
|
||||
@PostMapping(value = "/sys-file/inner-upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
R innerUpload(@RequestPart("file") MultipartFile file,
|
||||
@RequestParam(value = "dir", required = false) String dir,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "type", required = false) String type);
|
||||
}
|
||||
+137
-115
@@ -57,131 +57,153 @@ import java.util.Objects;
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class SysFileController {
|
||||
|
||||
private final SysFileService sysFileService;
|
||||
private final SysFileService sysFileService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param sysFile 文件管理
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getSysFilePage(@ParameterObject Page page, @ParameterObject SysFile sysFile) {
|
||||
LambdaQueryWrapper<SysFile> wrapper = Wrappers.<SysFile>lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(sysFile.getType()), SysFile::getType, sysFile.getType())
|
||||
.eq(Objects.nonNull(sysFile.getGroupId()), SysFile::getGroupId, sysFile.getGroupId())
|
||||
.like(StrUtil.isNotBlank(sysFile.getOriginal()), SysFile::getOriginal, sysFile.getOriginal());
|
||||
return R.ok(sysFileService.page(page, wrapper));
|
||||
}
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
/**
|
||||
* 通过id删除文件管理
|
||||
* @param ids id 列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除文件管理", description = "通过id删除文件管理")
|
||||
@SysLog("删除文件管理")
|
||||
@DeleteMapping
|
||||
@HasPermission("sys_file_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
sysFileService.deleteFile(id);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
@Inner
|
||||
@PostMapping(value = "/inner-upload")
|
||||
public R innerUpload(@RequestPart("file") MultipartFile file, @RequestParam(value = "dir", required = false) String dir,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "type", required = false) String type) {
|
||||
return sysFileService.innerUpload(file, dir, groupId, type);
|
||||
}
|
||||
|
||||
@PutMapping("/rename")
|
||||
public R rename(@RequestBody SysFile sysFile) {
|
||||
return R.ok(sysFileService.updateById(sysFile));
|
||||
}
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
/**
|
||||
* 上传文件 文件名采用uuid,避免原始文件名中带"-"符号导致下载的时候解析出现异常
|
||||
* @param file 资源
|
||||
* @param dir 文件夹
|
||||
* @return R(/ admin / bucketName / filename)
|
||||
*/
|
||||
@PostMapping(value = "/upload")
|
||||
public R upload(@RequestPart("file") MultipartFile file, @RequestParam(value = "dir", required = false) String dir,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "type", required = false) String type) {
|
||||
return sysFileService.uploadFile(file, dir, groupId, type);
|
||||
}
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param sysFile 文件管理
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getSysFilePage(@ParameterObject Page page, @ParameterObject SysFile sysFile) {
|
||||
LambdaQueryWrapper<SysFile> wrapper = Wrappers.<SysFile>lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(sysFile.getType()), SysFile::getType, sysFile.getType())
|
||||
.eq(Objects.nonNull(sysFile.getGroupId()), SysFile::getGroupId, sysFile.getGroupId())
|
||||
.like(StrUtil.isNotBlank(sysFile.getOriginal()), SysFile::getOriginal, sysFile.getOriginal());
|
||||
return R.ok(sysFileService.page(page, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件
|
||||
* @param fileName 文件空间/名称
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@Inner(false)
|
||||
@GetMapping("/oss/file")
|
||||
public void file(String fileName, HttpServletResponse response) {
|
||||
sysFileService.getFile(fileName, response);
|
||||
}
|
||||
/**
|
||||
* 通过id删除文件管理
|
||||
*
|
||||
* @param ids id 列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除文件管理", description = "通过id删除文件管理")
|
||||
@SysLog("删除文件管理")
|
||||
@DeleteMapping
|
||||
@HasPermission("sys_file_del")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
sysFileService.deleteFile(id);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地(resources)文件
|
||||
* @param fileName 文件名称
|
||||
* @param response 本地文件
|
||||
*/
|
||||
@SneakyThrows
|
||||
@GetMapping("/local/file/{fileName}")
|
||||
public void localFile(@PathVariable String fileName, HttpServletResponse response) {
|
||||
ClassPathResource resource = new ClassPathResource("file/" + fileName);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IoUtil.copy(resource.getInputStream(), response.getOutputStream());
|
||||
}
|
||||
@PutMapping("/rename")
|
||||
public R rename(@RequestBody SysFile sysFile) {
|
||||
return R.ok(sysFileService.updateById(sysFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件组列表
|
||||
* @param fileGroup SysFileGroup对象,用于筛选条件
|
||||
* @return 包含文件组列表的R对象
|
||||
*/
|
||||
@GetMapping("/group/list")
|
||||
public R listGroup(SysFileGroup fileGroup) {
|
||||
return R.ok(sysFileService.listFileGroup(fileGroup));
|
||||
}
|
||||
/**
|
||||
* 上传文件 文件名采用uuid,避免原始文件名中带"-"符号导致下载的时候解析出现异常
|
||||
*
|
||||
* @param file 资源
|
||||
* @param dir 文件夹
|
||||
* @return R(/ admin / bucketName / filename)
|
||||
*/
|
||||
@PostMapping(value = "/upload")
|
||||
public R upload(@RequestPart("file") MultipartFile file, @RequestParam(value = "dir", required = false) String dir,
|
||||
@RequestParam(value = "groupId", required = false) Long groupId,
|
||||
@RequestParam(value = "type", required = false) String type) {
|
||||
return sysFileService.uploadFile(file, dir, groupId, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文件组
|
||||
* @param fileGroup SysFileGroup对象,要添加的文件组信息
|
||||
* @return 包含添加结果的R对象
|
||||
*/
|
||||
@PostMapping("/group/add")
|
||||
public R addGroup(@RequestBody SysFileGroup fileGroup) {
|
||||
return R.ok(sysFileService.saveOrUpdateGroup(fileGroup));
|
||||
}
|
||||
/**
|
||||
* 获取文件
|
||||
*
|
||||
* @param fileName 文件空间/名称
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@Inner(false)
|
||||
@GetMapping("/oss/file")
|
||||
public void file(String fileName, HttpServletResponse response) {
|
||||
sysFileService.getFile(fileName, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件组
|
||||
* @param fileGroup SysFileGroup对象,要更新的文件组信息
|
||||
* @return 包含更新结果的R对象
|
||||
*/
|
||||
@PutMapping("/group/update")
|
||||
public R updateGroup(@RequestBody SysFileGroup fileGroup) {
|
||||
return R.ok(sysFileService.saveOrUpdateGroup(fileGroup));
|
||||
}
|
||||
/**
|
||||
* 获取本地(resources)文件
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param response 本地文件
|
||||
*/
|
||||
@SneakyThrows
|
||||
@GetMapping("/local/file/{fileName}")
|
||||
public void localFile(@PathVariable String fileName, HttpServletResponse response) {
|
||||
ClassPathResource resource = new ClassPathResource("file/" + fileName);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IoUtil.copy(resource.getInputStream(), response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件组
|
||||
* @param id 待删除文件组的ID
|
||||
* @return 包含删除结果的R对象
|
||||
*/
|
||||
@DeleteMapping("/group/delete/{id}")
|
||||
public R updateGroup(@PathVariable Long id) {
|
||||
return R.ok(sysFileService.deleteGroup(id));
|
||||
}
|
||||
/**
|
||||
* 查询文件组列表
|
||||
*
|
||||
* @param fileGroup SysFileGroup对象,用于筛选条件
|
||||
* @return 包含文件组列表的R对象
|
||||
*/
|
||||
@GetMapping("/group/list")
|
||||
public R listGroup(SysFileGroup fileGroup) {
|
||||
return R.ok(sysFileService.listFileGroup(fileGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动文件组
|
||||
* @param fileGroupDTO SysFileGroupDTO对象,要移动的文件组信息
|
||||
* @return 包含移动结果的R对象
|
||||
*/
|
||||
@PutMapping("/group/move")
|
||||
public R moveFileGroup(@RequestBody SysFileGroupDTO fileGroupDTO) {
|
||||
return R.ok(sysFileService.moveFileGroup(fileGroupDTO));
|
||||
}
|
||||
/**
|
||||
* 添加文件组
|
||||
*
|
||||
* @param fileGroup SysFileGroup对象,要添加的文件组信息
|
||||
* @return 包含添加结果的R对象
|
||||
*/
|
||||
@PostMapping("/group/add")
|
||||
public R addGroup(@RequestBody SysFileGroup fileGroup) {
|
||||
return R.ok(sysFileService.saveOrUpdateGroup(fileGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件组
|
||||
*
|
||||
* @param fileGroup SysFileGroup对象,要更新的文件组信息
|
||||
* @return 包含更新结果的R对象
|
||||
*/
|
||||
@PutMapping("/group/update")
|
||||
public R updateGroup(@RequestBody SysFileGroup fileGroup) {
|
||||
return R.ok(sysFileService.saveOrUpdateGroup(fileGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件组
|
||||
*
|
||||
* @param id 待删除文件组的ID
|
||||
* @return 包含删除结果的R对象
|
||||
*/
|
||||
@DeleteMapping("/group/delete/{id}")
|
||||
public R updateGroup(@PathVariable Long id) {
|
||||
return R.ok(sysFileService.deleteGroup(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动文件组
|
||||
*
|
||||
* @param fileGroupDTO SysFileGroupDTO对象,要移动的文件组信息
|
||||
* @return 包含移动结果的R对象
|
||||
*/
|
||||
@PutMapping("/group/move")
|
||||
public R moveFileGroup(@RequestBody SysFileGroupDTO fileGroupDTO) {
|
||||
return R.ok(sysFileService.moveFileGroup(fileGroupDTO));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -46,6 +46,8 @@ public interface SysFileService extends IService<SysFile> {
|
||||
*/
|
||||
R uploadFile(MultipartFile file, String dir, Long groupId, String type);
|
||||
|
||||
R innerUpload(MultipartFile file, String dir, Long groupId, String type);
|
||||
|
||||
/**
|
||||
* 读取文件
|
||||
* @param fileName 文件名称
|
||||
@@ -87,5 +89,4 @@ public interface SysFileService extends IService<SysFile> {
|
||||
* @return 移动成功返回true,否则返回false
|
||||
*/
|
||||
Boolean moveFileGroup(SysFileGroupDTO fileGroupDTO);
|
||||
|
||||
}
|
||||
+15
@@ -99,6 +99,21 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
||||
return R.ok(resultMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R innerUpload(MultipartFile file, String dir, Long groupId, String type) {
|
||||
String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename());
|
||||
Map<String, String> resultMap = new HashMap<>(4);
|
||||
resultMap.put("bucketName", properties.getBucketName());
|
||||
resultMap.put("fileName", fileName);
|
||||
resultMap.put("url", String.format("/admin/sys-file/oss/file?fileName=%s", fileName));
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
fileTemplate.putObject(properties.getBucketName(), dir, fileName, inputStream, file.getContentType());
|
||||
} catch (Exception e) {
|
||||
return R.failed(e.getLocalizedMessage());
|
||||
}
|
||||
return R.ok(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件
|
||||
*
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.wallet.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WalletCodeBizEnum {
|
||||
STRIDE("1", "跨单位"),
|
||||
FOREIGN("2", "外来人员"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
public static WalletCodeBizEnum descOf(String description) {
|
||||
return Arrays.stream(WalletCodeBizEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
}
|
||||
}
|
||||
+5
@@ -3,6 +3,11 @@ package com.bsd.pjcloud.wallet.api.dto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WalletCodeUseDto extends WalletCodeUseEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
}
|
||||
+4
-2
@@ -3,8 +3,7 @@ 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 +13,9 @@ import java.time.LocalDateTime;
|
||||
* @author dzc
|
||||
* @date 2025-01-02 16:26:10
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_code_use")
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class WalletForeignEntity extends Model<WalletForeignEntity> {
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private Integer processStatus;
|
||||
private String processStatus;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class WalletStrideEntity extends Model<WalletStrideEntity> {
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private Integer processStatus;
|
||||
private String processStatus;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
|
||||
+12
-1
@@ -1,8 +1,19 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletCodeUseVo extends WalletCodeUseEntity {
|
||||
public class WalletCodeUseVo extends WalletCodeUseEntity implements BaseUserInterface {
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
}
|
||||
@@ -102,6 +102,12 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-flow-task-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-hardware-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
+22
-1
@@ -11,8 +11,12 @@ 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.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletForeignService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
@@ -40,10 +44,11 @@ import java.util.List;
|
||||
public class WalletForeignController {
|
||||
|
||||
private final WalletForeignService walletForeignService;
|
||||
private final WalletCodeUseService walletCodeUseService;
|
||||
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
@Inner
|
||||
@Inner(value = false)
|
||||
@PostMapping("/apply-callback")
|
||||
public void applyCallback(@RequestBody ProcessNodeRecordAssignUserParamDto dto) {
|
||||
walletForeignService.applyCallback(dto);
|
||||
@@ -66,6 +71,22 @@ public class WalletForeignController {
|
||||
return R.ok(walletForeignService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "二维码列表", description = "二维码列表")
|
||||
@GetMapping("/code-list")
|
||||
public R codeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
|
||||
dto.setBizType(WalletCodeBizEnum.FOREIGN.getCode());
|
||||
return R.ok(walletCodeUseService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app二维码列表", description = "app二维码列表")
|
||||
@GetMapping("/app/code-list")
|
||||
public R appCodeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
dto.setUserId(loginUser.getId());
|
||||
dto.setBizType(WalletCodeBizEnum.FOREIGN.getCode());
|
||||
return R.ok(walletCodeUseService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_view')")
|
||||
|
||||
+50
-29
@@ -6,14 +6,18 @@ 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.feign.annotation.NoToken;
|
||||
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.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
|
||||
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.WalletCodeUseService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletStrideService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
@@ -35,27 +39,28 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wallet-stride" )
|
||||
@Tag(description = "wallet-stride" , name = "跨单位就餐管理" )
|
||||
@RequestMapping("/wallet-stride")
|
||||
@Tag(description = "wallet-stride", name = "跨单位就餐管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletStrideController {
|
||||
|
||||
private final WalletStrideService walletStrideService;
|
||||
private final WalletCodeUseService walletCodeUseService;
|
||||
|
||||
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
@Inner
|
||||
@PostMapping("/apply-callback" )
|
||||
@Inner(value = false)
|
||||
@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')" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')")
|
||||
public R getWalletStridePage(@ParameterObject Page page, @ParameterObject WalletStrideEntity walletStride) {
|
||||
LambdaQueryWrapper<WalletStrideEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletStrideService.page(page, wrapper));
|
||||
@@ -68,23 +73,39 @@ public class WalletStrideController {
|
||||
return R.ok(walletStrideService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "二维码列表", description = "二维码列表")
|
||||
@GetMapping("/code-list")
|
||||
public R codeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
|
||||
dto.setBizType(WalletCodeBizEnum.STRIDE.getCode());
|
||||
return R.ok(walletCodeUseService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app二维码列表", description = "app二维码列表")
|
||||
@GetMapping("/app/code-list")
|
||||
public R appCodeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
dto.setUserId(loginUser.getId());
|
||||
dto.setBizType(WalletCodeBizEnum.STRIDE.getCode());
|
||||
return R.ok(walletCodeUseService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletStrideService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("新增跨单位就餐" )
|
||||
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
|
||||
@SysLog("新增跨单位就餐")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_add')")
|
||||
public R save(@RequestBody WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("新增跨单位就餐" )
|
||||
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
|
||||
@SysLog("新增跨单位就餐")
|
||||
@PostMapping("/app")
|
||||
public R appSave(@RequestBody WalletStrideDto dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
@@ -92,41 +113,41 @@ public class WalletStrideController {
|
||||
return R.ok(walletStrideService.create(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("admin申请" )
|
||||
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
|
||||
@SysLog("admin申请")
|
||||
@PostMapping("/apply")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_apply')" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_apply')")
|
||||
public R apply(@RequestBody WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.apply(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
|
||||
@SysLog("app申请" )
|
||||
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
|
||||
@SysLog("app申请")
|
||||
@PostMapping("/app-apply")
|
||||
public R appApply(@RequestBody WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.apply(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改跨单位就餐" , description = "修改跨单位就餐" )
|
||||
@SysLog("修改跨单位就餐" )
|
||||
@Operation(summary = "修改跨单位就餐", description = "修改跨单位就餐")
|
||||
@SysLog("修改跨单位就餐")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_edit')")
|
||||
public R updateById(@RequestBody WalletStrideEntity walletStride) {
|
||||
return R.ok(walletStrideService.updateById(walletStride));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除跨单位就餐" , description = "通过id删除跨单位就餐" )
|
||||
@SysLog("通过id删除跨单位就餐" )
|
||||
@Operation(summary = "通过id删除跨单位就餐", description = "通过id删除跨单位就餐")
|
||||
@SysLog("通过id删除跨单位就餐")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_del')" )
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletStrideService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_export')" )
|
||||
public List<WalletStrideEntity> export(WalletStrideEntity walletStride,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_export')")
|
||||
public List<WalletStrideEntity> export(WalletStrideEntity walletStride, Long[] ids) {
|
||||
return walletStrideService.list(Wrappers.lambdaQuery(walletStride).in(ArrayUtil.isNotEmpty(ids), WalletStrideEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+18
@@ -1,11 +1,29 @@
|
||||
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.WalletCodeUseDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletCodeUseVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface WalletCodeUseMapper extends PjcloudBaseMapper<WalletCodeUseEntity> {
|
||||
|
||||
|
||||
default Page<WalletCodeUseVo> pageJoin(Page page, WalletCodeUseDto dto) {
|
||||
MPJLambdaWrapper<WalletCodeUseEntity> wrapper = new MPJLambdaWrapper<WalletCodeUseEntity>()
|
||||
.selectAll(WalletCodeUseEntity.class)
|
||||
.eqIfExists(WalletCodeUseEntity::getUserId, dto.getUserId())
|
||||
.eqIfExists(WalletCodeUseEntity::getBizId, dto.getBizId())
|
||||
.eqIfExists(WalletCodeUseEntity::getBizType, dto.getBizType())
|
||||
.eqIfExists(WalletCodeUseEntity::getStatus, dto.getStatus())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletCodeUseEntity::getUserId, dto.getUserIds());
|
||||
return selectJoinPage(page, WalletCodeUseVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+8
@@ -1,8 +1,16 @@
|
||||
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.wallet.api.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletCodeUseVo;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public interface WalletCodeUseService extends IService<WalletCodeUseEntity> {
|
||||
|
||||
void generate(@NotNull Long id, @NotNull Long userId, @NotNull WalletCodeBizEnum walletCodeBizEnum, @NotNull Integer count);
|
||||
|
||||
Page<WalletCodeUseVo> pageJoin(Page page, WalletCodeUseDto dto);
|
||||
}
|
||||
+86
@@ -1,16 +1,102 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteFileService;
|
||||
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.QRCodeImageGenerator;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletCodeUseVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletCodeUseMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
|
||||
import hardware.constant.HardOrderTypeEnum;
|
||||
import hardware.constant.HardPayTypeEnum;
|
||||
import hardware.dto.code.QRCodeDto;
|
||||
import hardware.utils.HardUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 二维码使用表
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2025-01-02 16:26:10
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, WalletCodeUseEntity> implements WalletCodeUseService {
|
||||
|
||||
static private final String TAG = "二维码使用管理";
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteFileService remoteFileService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void generate(Long id, Long userId, WalletCodeBizEnum biz, Integer count) {
|
||||
if (count == 0) return;
|
||||
HardOrderTypeEnum orderType = HardOrderTypeEnum.FOREIGN_TICKET;
|
||||
HardPayTypeEnum payType = HardPayTypeEnum.FOREIGN_TICKET_QR_CODE;
|
||||
if (biz == WalletCodeBizEnum.STRIDE) {
|
||||
orderType = HardOrderTypeEnum.STRIDE_DEPT;
|
||||
payType = HardPayTypeEnum.STRIDE_DEPT_QR_CODE;
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
WalletCodeUseEntity item = WalletCodeUseEntity.builder().bizId(id).userId(userId).bizType(biz.getCode()).build();
|
||||
int insert = baseMapper.insert(item);
|
||||
if (insert > 0) {
|
||||
QRCodeDto dto = QRCodeDto.builder().id(id).itemId(item.getId()).userId(item.getUserId()).orderType(orderType.getType()).payType(payType.getType()).exceedTime(-1L).build();
|
||||
try {
|
||||
Pair<String, String> code = HardUtil.generate(dto);
|
||||
byte[] bytes = QRCodeImageGenerator.generateQrCodeImage(code.getValue(), 1024);
|
||||
MultipartFile multipartFile = new MockMultipartFile("file", code.getKey() + ".png", "image/png", new ByteArrayInputStream(bytes));
|
||||
R upload = remoteFileService.innerUpload(multipartFile, null, null, null);
|
||||
Map data = (Map) upload.getData();
|
||||
String url = (String) data.get("url");
|
||||
// 更新
|
||||
WalletCodeUseEntity updateObj = WalletCodeUseEntity.builder().code(url).codeContent(code.getValue()).build();
|
||||
baseMapper.updateById(updateObj);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|生成使用二维码,生成收款码错误dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletCodeUseVo> pageJoin(Page page, WalletCodeUseDto dto) {
|
||||
Page<WalletCodeUseVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletCodeUseVo::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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+32
-5
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -13,18 +14,19 @@ 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.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -43,9 +45,13 @@ import java.util.Map;
|
||||
@Service
|
||||
public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, WalletForeignEntity> implements WalletForeignService {
|
||||
|
||||
static private final String TAG = "外来人员电子餐券表";
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
|
||||
private final WalletCodeUseServiceImpl walletCodeUseService;
|
||||
|
||||
private final FlowUtil flowUtil;
|
||||
|
||||
@Override
|
||||
@@ -60,11 +66,11 @@ public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, W
|
||||
throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
}
|
||||
dto.setDeptId(userData.getData().getSysUser().getDeptId());
|
||||
dto.setProcessStatus(NodeStatusEnum.WKS.getCode());
|
||||
dto.setProcessStatus(TaskCheckStatusEnum.PADDING.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());
|
||||
baseMapper.updateById(WalletForeignEntity.builder().id(dto.getId()).processId(processId).build());
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@@ -89,13 +95,34 @@ public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, W
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
|
||||
if (!flowUtil.checkCallback(dto)) return;
|
||||
String processId = dto.getProcessInstanceId();
|
||||
WalletForeignEntity detail = baseMapper.selectOne(new LambdaQueryWrapper<WalletForeignEntity>()
|
||||
.eq(WalletForeignEntity::getProcessId, processId)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(detail)) return;
|
||||
try {
|
||||
Boolean isConsent = flowUtil.isConsent(dto);
|
||||
String processStatus = isConsent ? TaskCheckStatusEnum.RESULT.getCode() : TaskCheckStatusEnum.REJECT.getCode();
|
||||
baseMapper.updateById(WalletForeignEntity.builder().id(detail.getId()).processStatus(processStatus).build());
|
||||
// 创建券
|
||||
if (isConsent) {
|
||||
walletCodeUseService.generate(detail.getId(), detail.getUserId(), WalletCodeBizEnum.FOREIGN, detail.getCount());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
|
||||
}
|
||||
// 创建券
|
||||
walletCodeUseService.generate(detail.getId(), detail.getUserId(), WalletCodeBizEnum.FOREIGN, detail.getCount());
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletForeignEntity>()
|
||||
.eq(WalletForeignEntity::getUserId, walletId)
|
||||
.eq(WalletForeignEntity::getProcessStatus, NodeStatusEnum.JXZ.getCode())
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
+27
-8
@@ -11,16 +11,15 @@ 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.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.flow.task.vo.ProcessVO;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletStrideVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletStrideMapper;
|
||||
@@ -35,7 +34,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 跨单位就餐
|
||||
@@ -55,6 +53,8 @@ public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, Wal
|
||||
private final RemoteDeptService deptService;
|
||||
private final RemoteFlowApiFlowService flowApiFlowService;
|
||||
|
||||
private final WalletCodeUseServiceImpl walletCodeUseService;
|
||||
|
||||
private final FlowUtil flowUtil;
|
||||
|
||||
@Override
|
||||
@@ -75,11 +75,11 @@ public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, Wal
|
||||
throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
}
|
||||
dto.setDeptId(userData.getData().getSysUser().getDeptId());
|
||||
dto.setProcessStatus(NodeStatusEnum.WKS.getCode());
|
||||
dto.setProcessStatus(TaskCheckStatusEnum.PADDING.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());
|
||||
baseMapper.updateById(WalletStrideEntity.builder().id(dto.getId()).processId(processId).build());
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@@ -110,13 +110,32 @@ public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, Wal
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
|
||||
if (!flowUtil.checkCallback(dto)) return;
|
||||
String processId = dto.getProcessInstanceId();
|
||||
WalletStrideEntity detail = baseMapper.selectOne(new LambdaQueryWrapper<WalletStrideEntity>()
|
||||
.eq(WalletStrideEntity::getProcessId, processId)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(detail)) return;
|
||||
try {
|
||||
Boolean isConsent = flowUtil.isConsent(dto);
|
||||
String processStatus = isConsent ? TaskCheckStatusEnum.RESULT.getCode() : TaskCheckStatusEnum.REJECT.getCode();
|
||||
baseMapper.updateById(WalletStrideEntity.builder().id(detail.getId()).processStatus(processStatus).build());
|
||||
// 创建券
|
||||
if (isConsent) {
|
||||
walletCodeUseService.generate(detail.getId(), detail.getUserId(), WalletCodeBizEnum.STRIDE, detail.getCount());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletStrideEntity>()
|
||||
.eq(WalletStrideEntity::getUserId, walletId)
|
||||
.eq(WalletStrideEntity::getProcessStatus, NodeStatusEnum.JXZ.getCode())
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
+19
-5
@@ -4,12 +4,15 @@ 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.alibaba.fastjson.JSONObject;
|
||||
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.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.flow.task.entity.Process;
|
||||
import com.bsd.pjcloud.flow.task.vo.FormItemVO;
|
||||
import com.bsd.pjcloud.flow.task.vo.ProcessVO;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -22,6 +25,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@@ -43,7 +47,7 @@ public class FlowUtil {
|
||||
throw new RuntimeException("请配置跨单位审批流程ID");
|
||||
}
|
||||
R<ProcessVO> detail = flowApiFlowService.getDetail(defaultRole);
|
||||
if (!ObjectUtil.isAllNotEmpty(detail, detail.getData(), detail.getData().getId())) {
|
||||
if (Optional.of(detail.getData()).map(Process::getId).isEmpty()) {
|
||||
log.error("|{}|未查询到该审批流程;userId:|{}|businessId:|{}|", TAG, user.getUserId(), businessId);
|
||||
throw new RuntimeException("未查询到该审批流程");
|
||||
}
|
||||
@@ -54,10 +58,6 @@ public class FlowUtil {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -81,4 +81,18 @@ public class FlowUtil {
|
||||
}
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
// 检查回调是否正确
|
||||
public Boolean checkCallback(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
if (!ObjectUtil.isAllNotEmpty(dto, dto.getFlowId())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 是否同意
|
||||
public Boolean isConsent(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
if (!ObjectUtil.isAllNotEmpty(dto, dto.getNodeId())) return false;
|
||||
String statusKey = dto.getNodeId() + "_approve_condition";
|
||||
JSONObject jsonObject = JSON.parseObject(dto.getData());
|
||||
return Boolean.parseBoolean(jsonObject.get(statusKey).toString());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user