diff --git a/eladmin/eladmin-tools/pom.xml b/eladmin/eladmin-tools/pom.xml deleted file mode 100644 index ae15c55..0000000 --- a/eladmin/eladmin-tools/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - eladmin - me.zhengjie - 1.1 - - 4.0.0 - - eladmin-tools - 工具模块 - - - 1.4.7 - 7.9.3 - 4.38.4.ALL - - - - - - me.zhengjie - eladmin-logging - 1.1 - - - - - javax.mail - mail - ${mail.version} - - - - - com.qiniu - qiniu-java-sdk - ${qiniu.version} - - - - - com.alipay.sdk - alipay-sdk-java - ${alipay.version} - - - diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/AlipayConfig.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/AlipayConfig.java deleted file mode 100644 index 15c3e41..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/AlipayConfig.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 支付宝配置类 - * @author Tz - * @date 2018-12-31 - */ -@Data -@TableName("tool_alipay_config") -public class AlipayConfig implements Serializable { - - @TableId("config_id") - private Long id; - - @NotBlank - @ApiModelProperty(value = "应用ID") - private String appId; - - @NotBlank - @ApiModelProperty(value = "商户私钥") - private String privateKey; - - @NotBlank - @ApiModelProperty(value = "支付宝公钥") - private String publicKey; - - @ApiModelProperty(value = "签名方式") - private String signType="RSA2"; - - @ApiModelProperty(value = "支付宝开放安全地址", hidden = true) - private String gatewayUrl = "https://openapi.alipaydev.com/gateway.do"; - - @ApiModelProperty(value = "编码", hidden = true) - private String charset= "utf-8"; - - @NotBlank - @ApiModelProperty(value = "异步通知地址") - private String notifyUrl; - - @NotBlank - @ApiModelProperty(value = "订单完成后返回的页面") - private String returnUrl; - - @ApiModelProperty(value = "类型") - private String format="JSON"; - - @NotBlank - @ApiModelProperty(value = "商户号") - private String sysServiceProviderId; - -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/EmailConfig.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/EmailConfig.java deleted file mode 100644 index f39f85f..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/EmailConfig.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 邮件配置类,数据存覆盖式存入数据存 - * @author Tz - * @date 2018-12-26 - */ -@Data -@TableName("tool_email_config") -public class EmailConfig implements Serializable { - - @TableId("config_id") - private Long id; - - @NotBlank - @ApiModelProperty(value = "邮件服务器SMTP地址") - private String host; - - @NotBlank - @ApiModelProperty(value = "邮件服务器 SMTP 端口") - private String port; - - @NotBlank - @ApiModelProperty(value = "发件者用户名") - private String user; - - @NotBlank - @ApiModelProperty(value = "密码") - private String pass; - - @NotBlank - @ApiModelProperty(value = "收件人") - private String fromUser; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/LocalStorage.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/LocalStorage.java deleted file mode 100644 index db0c03d..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/LocalStorage.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModelProperty; -import lombok.*; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import me.zhengjie.base.BaseEntity; -import java.io.Serializable; - -/** -* @author Tz -* @date 2019-09-05 -*/ -@Getter -@Setter -@NoArgsConstructor -@TableName("tool_local_storage") -public class LocalStorage extends BaseEntity implements Serializable { - - @TableId(value = "storage_id", type = IdType.AUTO) - @ApiModelProperty(value = "ID", hidden = true) - private Long id; - - @ApiModelProperty(value = "真实文件名") - private String realName; - - @ApiModelProperty(value = "文件名") - private String name; - - @ApiModelProperty(value = "后缀") - private String suffix; - - @ApiModelProperty(value = "路径") - private String path; - - @ApiModelProperty(value = "类型") - private String type; - - @ApiModelProperty(value = "大小") - private String size; - - public LocalStorage(String realName,String name, String suffix, String path, String type, String size) { - this.realName = realName; - this.name = name; - this.suffix = suffix; - this.path = path; - this.type = type; - this.size = size; - } - - public void copy(LocalStorage source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} \ No newline at end of file diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuConfig.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuConfig.java deleted file mode 100644 index fa57213..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 七牛云对象存储配置类 - * @author Tz - * @date 2018-12-31 - */ -@Data -@TableName("tool_qiniu_config") -public class QiniuConfig implements Serializable { - - @TableId("config_id") - private Long id; - - @NotBlank - @ApiModelProperty(value = "accessKey") - private String accessKey; - - @NotBlank - @ApiModelProperty(value = "secretKey") - private String secretKey; - - @NotBlank - @ApiModelProperty(value = "存储空间名称作为唯一的 Bucket 识别符") - private String bucket; - - /** - * Zone表示与机房的对应关系 - * 华东 Zone.zone0() - * 华北 Zone.zone1() - * 华南 Zone.zone2() - * 北美 Zone.zoneNa0() - * 东南亚 Zone.zoneAs0() - */ - @NotBlank - @ApiModelProperty(value = "Zone表示与机房的对应关系") - private String zone; - - @NotBlank - @ApiModelProperty(value = "外链域名,可自定义,需在七牛云绑定") - private String host; - - @ApiModelProperty(value = "空间类型:公开/私有") - private String type = "公开"; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuContent.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuContent.java deleted file mode 100644 index 7d64c55..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/QiniuContent.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * 上传成功后,存储结果 - * @author Tz - * @date 2018-12-31 - */ -@Data -@TableName("tool_qiniu_content") -public class QiniuContent implements Serializable { - - @TableId(value = "content_id", type = IdType.AUTO) - @ApiModelProperty(value = "ID", hidden = true) - private Long id; - - @TableField("name") - @ApiModelProperty(value = "文件名") - private String key; - - @ApiModelProperty(value = "空间名") - private String bucket; - - @ApiModelProperty(value = "大小") - private String size; - - @ApiModelProperty(value = "文件地址") - private String url; - - @ApiModelProperty(value = "文件类型") - private String suffix; - - @ApiModelProperty(value = "空间类型:公开/私有") - private String type = "公开"; - - @TableField(fill = FieldFill.INSERT_UPDATE) - @ApiModelProperty(value = "创建或更新时间") - private Timestamp updateTime; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/EmailDto.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/EmailDto.java deleted file mode 100644 index 8141893..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/EmailDto.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import java.util.List; - -/** - * 发送邮件时,接收参数的类 - * @author 郑杰 - * @date 2018/09/28 12:02:14 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class EmailDto { - - @NotEmpty - @ApiModelProperty(value = "收件人") - private List tos; - - @NotBlank - @ApiModelProperty(value = "主题") - private String subject; - - @NotBlank - @ApiModelProperty(value = "内容") - private String content; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/LocalStorageQueryCriteria.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/LocalStorageQueryCriteria.java deleted file mode 100644 index a9c0b33..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/LocalStorageQueryCriteria.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.sql.Timestamp; -import java.util.List; - -/** -* @author Tz -* @date 2019-09-05 -*/ -@Data -public class LocalStorageQueryCriteria{ - - @ApiModelProperty(value = "模糊查询") - private String blurry; - - @ApiModelProperty(value = "创建时间") - private List createTime; - - @ApiModelProperty(value = "页码", example = "1") - private Integer page = 1; - - @ApiModelProperty(value = "每页数据量", example = "10") - private Integer size = 10; -} \ No newline at end of file diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/QiniuQueryCriteria.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/QiniuQueryCriteria.java deleted file mode 100644 index e8b8432..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/QiniuQueryCriteria.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.sql.Timestamp; -import java.util.List; - -/** - * @author Tz - * @date 2019-6-4 09:54:37 - */ -@Data -public class QiniuQueryCriteria{ - - @ApiModelProperty(value = "名称查询") - private String key; - - @ApiModelProperty(value = "创建时间") - private List createTime; - - @ApiModelProperty(value = "页码", example = "1") - private Integer page = 1; - - @ApiModelProperty(value = "每页数据量", example = "10") - private Integer size = 10; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/TradeDto.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/TradeDto.java deleted file mode 100644 index 654dac1..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/dto/TradeDto.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import javax.validation.constraints.NotBlank; -import java.sql.Date; -import java.sql.Timestamp; - -/** - * 交易详情,按需应该存入数据库,这里存入数据库,仅供临时测试 - * @author Tz - * @date 2018-12-31 - */ -@Data -public class TradeDto { - - @NotBlank - @ApiModelProperty(value = "商品描述") - private String body; - - @NotBlank - @ApiModelProperty(value = "商品名称") - private String subject; - - @ApiModelProperty(value = "商户订单号", hidden = true) - private String outTradeNo; - - @ApiModelProperty(value = "第三方订单号", hidden = true) - private String tradeNo; - - @NotBlank - @ApiModelProperty(value = "价格") - private String totalAmount; - - @ApiModelProperty(value = "订单状态,已支付,未支付,作废", hidden = true) - private String state; - - @ApiModelProperty(value = "创建时间", hidden = true) - private Timestamp createTime; - - @ApiModelProperty(value = "作废时间", hidden = true) - private Date cancelTime; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/enums/AliPayStatusEnum.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/enums/AliPayStatusEnum.java deleted file mode 100644 index 6ebb1af..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/domain/enums/AliPayStatusEnum.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.domain.enums; - -/** - * 支付状态 - * @author zhengjie - * @date 2018/08/01 16:45:43 - */ -public enum AliPayStatusEnum { - - /** 交易成功 */ - FINISHED("TRADE_FINISHED"), - - /** 支付成功 */ - SUCCESS("TRADE_SUCCESS"), - - /** 交易创建 */ - BUYER_PAY("WAIT_BUYER_PAY"), - - /** 交易关闭 */ - CLOSED("TRADE_CLOSED"); - - private final String value; - - AliPayStatusEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/AliPayConfigMapper.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/AliPayConfigMapper.java deleted file mode 100644 index 5f46c51..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/AliPayConfigMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import me.zhengjie.domain.AlipayConfig; -import org.apache.ibatis.annotations.Mapper; - -/** - * @author Tz - * @description - * @date 2023-06-14 - **/ -@Mapper -public interface AliPayConfigMapper extends BaseMapper { - -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/EmailConfigMapper.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/EmailConfigMapper.java deleted file mode 100644 index 661b6fc..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/EmailConfigMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import me.zhengjie.domain.EmailConfig; -import org.apache.ibatis.annotations.Mapper; - -/** - * @author Tz - * @description - * @date 2023-06-14 - **/ -@Mapper -public interface EmailConfigMapper extends BaseMapper { - -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/LocalStorageMapper.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/LocalStorageMapper.java deleted file mode 100644 index f9836f9..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/LocalStorageMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import me.zhengjie.domain.LocalStorage; -import me.zhengjie.domain.dto.LocalStorageQueryCriteria; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import java.util.List; - -/** - * @author Tz - * @description - * @date 2023-06-14 - **/ -@Mapper -public interface LocalStorageMapper extends BaseMapper { - - IPage findAll(@Param("criteria") LocalStorageQueryCriteria criteria, Page page); - - List findAll(@Param("criteria") LocalStorageQueryCriteria criteria); -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/QiniuConfigMapper.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/QiniuConfigMapper.java deleted file mode 100644 index 0dd4546..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/QiniuConfigMapper.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import me.zhengjie.domain.EmailConfig; -import me.zhengjie.domain.QiniuConfig; -import org.apache.ibatis.annotations.Mapper; - -/** - * @author Tz - * @description - * @date 2023-06-14 - **/ -@Mapper -public interface QiniuConfigMapper extends BaseMapper { - -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/QiniuContentMapper.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/QiniuContentMapper.java deleted file mode 100644 index 2c62e57..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/mapper/QiniuContentMapper.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import me.zhengjie.domain.QiniuContent; -import me.zhengjie.domain.dto.QiniuQueryCriteria; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * @author Tz - * @description - * @date 2023-06-14 - **/ -@Mapper -public interface QiniuContentMapper extends BaseMapper { - - QiniuContent findByKey(@Param("name") String name); - - IPage findAll(@Param("criteria") QiniuQueryCriteria criteria, Page page); - - List findAll(QiniuQueryCriteria criteria); -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java deleted file mode 100644 index e7f0704..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import me.zhengjie.annotation.rest.AnonymousAccess; -import me.zhengjie.annotation.Log; -import me.zhengjie.annotation.rest.AnonymousGetMapping; -import me.zhengjie.domain.dto.TradeDto; -import me.zhengjie.domain.AlipayConfig; -import me.zhengjie.domain.enums.AliPayStatusEnum; -import me.zhengjie.utils.AlipayUtils; -import me.zhengjie.service.AliPayService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.nio.charset.StandardCharsets; -import java.util.Map; - -/** - * @author Tz - * @date 2018-12-31 - */ -@Slf4j -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/aliPay") -@Api(tags = "工具:支付宝管理") -public class AliPayController { - - private final AlipayUtils alipayUtils; - private final AliPayService alipayService; - - @GetMapping - public ResponseEntity queryAliConfig() { - return new ResponseEntity<>(alipayService.find(), HttpStatus.OK); - } - - @Log("配置支付宝") - @ApiOperation("配置支付宝") - @PutMapping - public ResponseEntity updateAliPayConfig(@Validated @RequestBody AlipayConfig alipayConfig) { - alipayService.config(alipayConfig); - return new ResponseEntity<>(HttpStatus.OK); - } - - @Log("支付宝PC网页支付") - @ApiOperation("PC网页支付") - @PostMapping(value = "/toPayAsPC") - public ResponseEntity toPayAsPc(@Validated @RequestBody TradeDto trade) throws Exception { - AlipayConfig aliPay = alipayService.find(); - trade.setOutTradeNo(alipayUtils.getOrderCode()); - String payUrl = alipayService.toPayAsPc(aliPay, trade); - return ResponseEntity.ok(payUrl); - } - - @Log("支付宝手机网页支付") - @ApiOperation("手机网页支付") - @PostMapping(value = "/toPayAsWeb") - public ResponseEntity toPayAsWeb(@Validated @RequestBody TradeDto trade) throws Exception { - AlipayConfig alipay = alipayService.find(); - trade.setOutTradeNo(alipayUtils.getOrderCode()); - String payUrl = alipayService.toPayAsWeb(alipay, trade); - return ResponseEntity.ok(payUrl); - } - - @ApiIgnore - @AnonymousGetMapping("/return") - @ApiOperation("支付之后跳转的链接") - public ResponseEntity returnPage(HttpServletRequest request, HttpServletResponse response) { - AlipayConfig alipay = alipayService.find(); - response.setContentType("text/html;charset=" + alipay.getCharset()); - //内容验签,防止黑客篡改参数 - if (alipayUtils.rsaCheck(request, alipay)) { - //商户订单号 - String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - //支付宝交易号 - String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - System.out.println("商户订单号" + outTradeNo + " " + "第三方交易号" + tradeNo); - - // 根据业务需要返回数据,这里统一返回OK - return new ResponseEntity<>("payment successful", HttpStatus.OK); - } else { - // 根据业务需要返回数据 - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - } - - @ApiIgnore - @RequestMapping("/notify") - @AnonymousAccess - @ApiOperation("支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理") - public ResponseEntity notify(HttpServletRequest request) { - AlipayConfig alipay = alipayService.find(); - Map parameterMap = request.getParameterMap(); - //内容验签,防止黑客篡改参数 - if (alipayUtils.rsaCheck(request, alipay)) { - //交易状态 - String tradeStatus = new String(request.getParameter("trade_status").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - // 商户订单号 - String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - //支付宝交易号 - String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - //付款金额 - String totalAmount = new String(request.getParameter("total_amount").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - //验证 - if (tradeStatus.equals(AliPayStatusEnum.SUCCESS.getValue()) || tradeStatus.equals(AliPayStatusEnum.FINISHED.getValue())) { - // 验证通过后应该根据业务需要处理订单 - } - return new ResponseEntity<>(HttpStatus.OK); - } - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java deleted file mode 100644 index f286e87..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/EmailController.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import me.zhengjie.annotation.Log; -import me.zhengjie.domain.dto.EmailDto; -import me.zhengjie.domain.EmailConfig; -import me.zhengjie.service.EmailService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -/** - * 发送邮件 - * @author 郑杰 - * @date 2018/09/28 6:55:53 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("api/email") -@Api(tags = "工具:邮件管理") -public class EmailController { - - private final EmailService emailService; - - @GetMapping - public ResponseEntity queryEmailConfig(){ - return new ResponseEntity<>(emailService.find(),HttpStatus.OK); - } - - @Log("配置邮件") - @PutMapping - @ApiOperation("配置邮件") - public ResponseEntity updateEmailConfig(@Validated @RequestBody EmailConfig emailConfig) throws Exception { - emailService.config(emailConfig, emailService.find()); - return new ResponseEntity<>(HttpStatus.OK); - } - - @Log("发送邮件") - @PostMapping - @ApiOperation("发送邮件") - public ResponseEntity sendEmail(@Validated @RequestBody EmailDto emailDto){ - emailService.send(emailDto,emailService.find()); - return new ResponseEntity<>(HttpStatus.OK); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java deleted file mode 100644 index 6dc782e..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.rest; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import me.zhengjie.annotation.Log; -import me.zhengjie.domain.LocalStorage; -import me.zhengjie.exception.BadRequestException; -import me.zhengjie.service.LocalStorageService; -import me.zhengjie.domain.dto.LocalStorageQueryCriteria; -import me.zhengjie.utils.FileUtil; -import me.zhengjie.utils.PageResult; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** -* @author Tz -* @date 2019-09-05 -*/ -@RestController -@RequiredArgsConstructor -@Api(tags = "工具:本地存储管理") -@RequestMapping("/api/localStorage") -public class LocalStorageController { - - private final LocalStorageService localStorageService; - - @GetMapping - @ApiOperation("查询文件") - @PreAuthorize("@el.check('storage:list')") - public ResponseEntity> queryFile(LocalStorageQueryCriteria criteria){ - Page page = new Page<>(criteria.getPage(), criteria.getSize()); - return new ResponseEntity<>(localStorageService.queryAll(criteria,page),HttpStatus.OK); - } - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('storage:list')") - public void exportFile(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException { - localStorageService.download(localStorageService.queryAll(criteria), response); - } - - @PostMapping - @ApiOperation("上传文件") - @PreAuthorize("@el.check('storage:add')") - public ResponseEntity createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){ - localStorageService.create(name, file); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - @ApiOperation("上传图片") - @PostMapping("/pictures") - public ResponseEntity uploadPicture(@RequestParam MultipartFile file){ - // 判断文件是否为图片 - String suffix = FileUtil.getExtensionName(file.getOriginalFilename()); - if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){ - throw new BadRequestException("只能上传图片"); - } - LocalStorage localStorage = localStorageService.create(null, file); - return new ResponseEntity<>(localStorage, HttpStatus.OK); - } - - @PutMapping - @Log("修改文件") - @ApiOperation("修改文件") - @PreAuthorize("@el.check('storage:edit')") - public ResponseEntity updateFile(@Validated @RequestBody LocalStorage resources){ - localStorageService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除文件") - @DeleteMapping - @ApiOperation("多选删除") - public ResponseEntity deleteFile(@RequestBody Long[] ids) { - localStorageService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java deleted file mode 100644 index 2fe41e9..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.rest; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import me.zhengjie.annotation.Log; -import me.zhengjie.domain.QiniuConfig; -import me.zhengjie.domain.QiniuContent; -import me.zhengjie.service.QiNiuConfigService; -import me.zhengjie.domain.dto.QiniuQueryCriteria; -import me.zhengjie.service.QiniuContentService; -import me.zhengjie.utils.PageResult; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -/** - * 发送邮件 - * @author 郑杰 - * @date 2018/09/28 6:55:53 - */ -@Slf4j -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/qiNiuContent") -@Api(tags = "工具:七牛云存储管理") -public class QiniuController { - - private final QiniuContentService qiniuContentService; - private final QiNiuConfigService qiNiuConfigService; - - @GetMapping(value = "/config") - public ResponseEntity queryQiNiuConfig(){ - return new ResponseEntity<>(qiNiuConfigService.getConfig(), HttpStatus.OK); - } - - @Log("配置七牛云存储") - @ApiOperation("配置七牛云存储") - @PutMapping(value = "/config") - public ResponseEntity updateQiNiuConfig(@Validated @RequestBody QiniuConfig qiniuConfig){ - qiNiuConfigService.saveConfig(qiniuConfig); - qiNiuConfigService.updateType(qiniuConfig.getType()); - return new ResponseEntity<>(HttpStatus.OK); - } - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - public void exportQiNiu(HttpServletResponse response, QiniuQueryCriteria criteria) throws IOException { - qiniuContentService.downloadList(qiniuContentService.queryAll(criteria), response); - } - - @ApiOperation("查询文件") - @GetMapping - public ResponseEntity> queryQiNiu(QiniuQueryCriteria criteria){ - Page page = new Page<>(criteria.getPage(), criteria.getSize()); - return new ResponseEntity<>(qiniuContentService.queryAll(criteria, page),HttpStatus.OK); - } - - @ApiOperation("上传文件") - @PostMapping - public ResponseEntity uploadQiNiu(@RequestParam MultipartFile file){ - QiniuContent qiniuContent = qiniuContentService.upload(file, qiNiuConfigService.getConfig()); - Map map = new HashMap<>(3); - map.put("id",qiniuContent.getId()); - map.put("errno",0); - map.put("data",new String[]{qiniuContent.getUrl()}); - return new ResponseEntity<>(map,HttpStatus.OK); - } - - @Log("同步七牛云数据") - @ApiOperation("同步七牛云数据") - @PostMapping(value = "/synchronize") - public ResponseEntity synchronizeQiNiu(){ - qiniuContentService.synchronize(qiNiuConfigService.getConfig()); - return new ResponseEntity<>(HttpStatus.OK); - } - - @Log("下载文件") - @ApiOperation("下载文件") - @GetMapping(value = "/download/{id}") - public ResponseEntity downloadQiNiu(@PathVariable Long id){ - Map map = new HashMap<>(1); - map.put("url", qiniuContentService.download(qiniuContentService.getById(id), qiNiuConfigService.getConfig())); - return new ResponseEntity<>(map,HttpStatus.OK); - } - - @Log("删除文件") - @ApiOperation("删除文件") - @DeleteMapping(value = "/{id}") - public ResponseEntity deleteQiNiu(@PathVariable Long id){ - qiniuContentService.delete(qiniuContentService.getById(id), qiNiuConfigService.getConfig()); - return new ResponseEntity<>(HttpStatus.OK); - } - - @Log("删除多张图片") - @ApiOperation("删除多张图片") - @DeleteMapping - public ResponseEntity deleteAllQiNiu(@RequestBody Long[] ids) { - qiniuContentService.deleteAll(ids, qiNiuConfigService.getConfig()); - return new ResponseEntity<>(HttpStatus.OK); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/AliPayService.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/AliPayService.java deleted file mode 100644 index 55b3ff8..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/AliPayService.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import me.zhengjie.domain.dto.TradeDto; -import me.zhengjie.domain.AlipayConfig; - -/** - * @author Tz - * @date 2018-12-31 - */ -public interface AliPayService extends IService { - - /** - * 查询配置 - * @return AlipayConfig - */ - AlipayConfig find(); - - /** - * 更新配置 - * @param alipayConfig 支付宝配置 - * @return AlipayConfig - */ - AlipayConfig config(AlipayConfig alipayConfig); - - /** - * 处理来自PC的交易请求 - * @param alipay 支付宝配置 - * @param trade 交易详情 - * @return String - * @throws Exception 异常 - */ - String toPayAsPc(AlipayConfig alipay, TradeDto trade) throws Exception; - - /** - * 处理来自手机网页的交易请求 - * @param alipay 支付宝配置 - * @param trade 交易详情 - * @return String - * @throws Exception 异常 - */ - String toPayAsWeb(AlipayConfig alipay, TradeDto trade) throws Exception; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/EmailService.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/EmailService.java deleted file mode 100644 index 2735354..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/EmailService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import me.zhengjie.domain.dto.EmailDto; -import me.zhengjie.domain.EmailConfig; - -/** - * @author Tz - * @date 2018-12-26 - */ -public interface EmailService extends IService { - - /** - * 更新邮件配置 - * @param emailConfig 邮箱配置 - * @param old / - * @return / - * @throws Exception / - */ - EmailConfig config(EmailConfig emailConfig, EmailConfig old) throws Exception; - - /** - * 查询配置 - * @return EmailConfig 邮件配置 - */ - EmailConfig find(); - - /** - * 发送邮件 - * @param emailDto 邮件发送的内容 - * @param emailConfig 邮件配置 - */ - void send(EmailDto emailDto, EmailConfig emailConfig); -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java deleted file mode 100644 index c568c24..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import me.zhengjie.domain.LocalStorage; -import me.zhengjie.domain.dto.LocalStorageQueryCriteria; -import me.zhengjie.utils.PageResult; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; - -/** -* @author Tz -* @date 2019-09-05 -*/ -public interface LocalStorageService extends IService { - - /** - * 分页查询 - * - * @param criteria 条件 - * @param page 分页参数 - * @return / - */ - PageResult queryAll(LocalStorageQueryCriteria criteria, Page page); - - /** - * 查询全部数据 - * @param criteria 条件 - * @return / - */ - List queryAll(LocalStorageQueryCriteria criteria); - - /** - * 上传 - * @param name 文件名称 - * @param file 文件 - * @return / - */ - LocalStorage create(String name, MultipartFile file); - - String createFile(String name, MultipartFile multipartFile); - - /** - * 编辑 - * @param resources 文件信息 - */ - void update(LocalStorage resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 导出数据 - * @param localStorages 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List localStorages, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiNiuConfigService.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiNiuConfigService.java deleted file mode 100644 index 2ea1390..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiNiuConfigService.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import me.zhengjie.domain.QiniuConfig; - -/** - * @author Tz - * @date 2018-12-31 - */ -public interface QiNiuConfigService extends IService { - - /** - * 查询配置 - * @return QiniuConfig - */ - QiniuConfig getConfig(); - - /** - * 保存 - * @param type 类型 - */ - void saveConfig(QiniuConfig type); - - /** - * 更新 - * @param type 类型 - */ - void updateType(String type); -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiniuContentService.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiniuContentService.java deleted file mode 100644 index ac2e12b..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/QiniuContentService.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import me.zhengjie.domain.QiniuConfig; -import me.zhengjie.domain.QiniuContent; -import me.zhengjie.domain.dto.QiniuQueryCriteria; -import me.zhengjie.utils.PageResult; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; - -/** - * @author Tz - * @date 2018-12-31 - */ -public interface QiniuContentService extends IService { - - /** - * 分页查询 - * - * @param criteria 条件 - * @param page 分页参数 - * @return / - */ - PageResult queryAll(QiniuQueryCriteria criteria, Page page); - - /** - * 查询全部 - * @param criteria 条件 - * @return / - */ - List queryAll(QiniuQueryCriteria criteria); - - /** - * 上传文件 - * @param file 文件 - * @param qiniuConfig 配置 - * @return QiniuContent - */ - QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig); - - /** - * 下载文件 - * @param content 文件信息 - * @param config 配置 - * @return String - */ - String download(QiniuContent content, QiniuConfig config); - - /** - * 删除文件 - * @param content 文件 - * @param config 配置 - */ - void delete(QiniuContent content, QiniuConfig config); - - /** - * 同步数据 - * @param config 配置 - */ - void synchronize(QiniuConfig config); - - /** - * 删除文件 - * @param ids 文件ID数组 - * @param config 配置 - */ - void deleteAll(Long[] ids, QiniuConfig config); - - /** - * 导出数据 - * @param queryAll / - * @param response / - * @throws IOException / - */ - void downloadList(List queryAll, HttpServletResponse response) throws IOException; -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/AliPayServiceImpl.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/AliPayServiceImpl.java deleted file mode 100644 index aef4a6d..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/AliPayServiceImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service.impl; - -import com.alipay.api.AlipayClient; -import com.alipay.api.DefaultAlipayClient; -import com.alipay.api.request.AlipayTradePagePayRequest; -import com.alipay.api.request.AlipayTradeWapPayRequest; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; -import me.zhengjie.domain.dto.TradeDto; -import me.zhengjie.domain.AlipayConfig; -import me.zhengjie.exception.BadRequestException; -import me.zhengjie.mapper.AliPayConfigMapper; -import me.zhengjie.service.AliPayService; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CachePut; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author Tz - * @date 2018-12-31 - */ -@Service -@RequiredArgsConstructor -@CacheConfig(cacheNames = "aliPay") -public class AliPayServiceImpl extends ServiceImpl implements AliPayService { - - @Override - @Cacheable(key = "'config'") - public AlipayConfig find() { - AlipayConfig alipayConfig = getById(1L); - return alipayConfig == null ? new AlipayConfig() : alipayConfig; - } - - @Override - @CachePut(key = "'config'") - @Transactional(rollbackFor = Exception.class) - public AlipayConfig config(AlipayConfig alipayConfig) { - alipayConfig.setId(1L); - saveOrUpdate(alipayConfig); - return alipayConfig; - } - - @Override - public String toPayAsPc(AlipayConfig alipay, TradeDto trade) throws Exception { - - if(alipay.getId() == null){ - throw new BadRequestException("请先添加相应配置,再操作"); - } - AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); - - // 创建API对应的request(电脑网页版) - AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); - - // 订单完成后返回的页面和异步通知地址 - request.setReturnUrl(alipay.getReturnUrl()); - request.setNotifyUrl(alipay.getNotifyUrl()); - // 填充订单参数 - request.setBizContent("{" + - " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + - " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + - " \"total_amount\":"+trade.getTotalAmount()+"," + - " \"subject\":\""+trade.getSubject()+"\"," + - " \"body\":\""+trade.getBody()+"\"," + - " \"extend_params\":{" + - " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + - " }"+ - " }");//填充业务参数 - // 调用SDK生成表单, 通过GET方式,口可以获取url - return alipayClient.pageExecute(request, "GET").getBody(); - - } - - @Override - public String toPayAsWeb(AlipayConfig alipay, TradeDto trade) throws Exception { - if(alipay.getId() == null){ - throw new BadRequestException("请先添加相应配置,再操作"); - } - AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); - - double money = Double.parseDouble(trade.getTotalAmount()); - double maxMoney = 5000; - if(money <= 0 || money >= maxMoney){ - throw new BadRequestException("测试金额过大"); - } - // 创建API对应的request(手机网页版) - AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); - request.setReturnUrl(alipay.getReturnUrl()); - request.setNotifyUrl(alipay.getNotifyUrl()); - request.setBizContent("{" + - " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + - " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + - " \"total_amount\":"+trade.getTotalAmount()+"," + - " \"subject\":\""+trade.getSubject()+"\"," + - " \"body\":\""+trade.getBody()+"\"," + - " \"extend_params\":{" + - " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + - " }"+ - " }"); - return alipayClient.pageExecute(request, "GET").getBody(); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java deleted file mode 100644 index 22b1662..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service.impl; - -import cn.hutool.extra.mail.Mail; -import cn.hutool.extra.mail.MailAccount; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; -import me.zhengjie.domain.EmailConfig; -import me.zhengjie.domain.dto.EmailDto; -import me.zhengjie.exception.BadRequestException; -import me.zhengjie.mapper.EmailConfigMapper; -import me.zhengjie.service.EmailService; -import me.zhengjie.utils.EncryptUtils; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CachePut; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author Tz - * @date 2018-12-26 - */ -@Service -@RequiredArgsConstructor -@CacheConfig(cacheNames = "email") -public class EmailServiceImpl extends ServiceImpl implements EmailService { - - @Override - @CachePut(key = "'config'") - @Transactional(rollbackFor = Exception.class) - public EmailConfig config(EmailConfig emailConfig, EmailConfig old) throws Exception { - emailConfig.setId(1L); - if(!emailConfig.getPass().equals(old.getPass())){ - // 对称加密 - emailConfig.setPass(EncryptUtils.desEncrypt(emailConfig.getPass())); - } - saveOrUpdate(emailConfig); - return emailConfig; - } - - @Override - @Cacheable(key = "'config'") - public EmailConfig find() { - EmailConfig emailConfig = getById(1L); - return emailConfig == null ? new EmailConfig() : emailConfig; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void send(EmailDto emailDto, EmailConfig emailConfig){ - if(emailConfig.getId() == null){ - throw new BadRequestException("请先配置,再操作"); - } - // 封装 - MailAccount account = new MailAccount(); - // 设置用户 - String user = emailConfig.getFromUser().split("@")[0]; - account.setUser(user); - account.setHost(emailConfig.getHost()); - account.setPort(Integer.parseInt(emailConfig.getPort())); - account.setAuth(true); - try { - // 对称解密 - account.setPass(EncryptUtils.desDecrypt(emailConfig.getPass())); - } catch (Exception e) { - throw new BadRequestException(e.getMessage()); - } - account.setFrom(emailConfig.getUser()+"<"+emailConfig.getFromUser()+">"); - // ssl方式发送 - account.setSslEnable(true); - // 使用STARTTLS安全连接 - account.setStarttlsEnable(true); - // 解决jdk8之后默认禁用部分tls协议,导致邮件发送失败的问题 - account.setSslProtocols("TLSv1 TLSv1.1 TLSv1.2"); - String content = emailDto.getContent(); - // 发送 - try { - int size = emailDto.getTos().size(); - Mail.create(account) - .setTos(emailDto.getTos().toArray(new String[size])) - .setTitle(emailDto.getSubject()) - .setContent(content) - .setHtml(true) - //关闭session - .setUseGlobalSession(false) - .send(); - }catch (Exception e){ - throw new BadRequestException(e.getMessage()); - } - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java deleted file mode 100644 index 665a6ba..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; -import me.zhengjie.config.properties.FileProperties; -import me.zhengjie.domain.LocalStorage; -import me.zhengjie.domain.dto.LocalStorageQueryCriteria; -import me.zhengjie.exception.BadRequestException; -import me.zhengjie.mapper.LocalStorageMapper; -import me.zhengjie.utils.*; -import me.zhengjie.service.LocalStorageService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; - -/** -* @author Tz -* @date 2019-09-05 -*/ -@Service -@RequiredArgsConstructor -public class LocalStorageServiceImpl extends ServiceImpl implements LocalStorageService { - - private final LocalStorageMapper localStorageMapper; - private final FileProperties properties; - - @Override - public PageResult queryAll(LocalStorageQueryCriteria criteria, Page page){ - return PageUtil.toPage(localStorageMapper.findAll(criteria, page)); - } - - @Override - public List queryAll(LocalStorageQueryCriteria criteria){ - return localStorageMapper.findAll(criteria); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public LocalStorage create(String name, MultipartFile multipartFile) { - FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); - String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); - String type = FileUtil.getFileType(suffix); - File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); - if(ObjectUtil.isNull(file)){ - throw new BadRequestException("上传失败"); - } - try { - name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name; - LocalStorage localStorage = new LocalStorage( - file.getName(), - name, - suffix, - file.getPath(), - type, - FileUtil.getSize(multipartFile.getSize()) - ); - save(localStorage); - return localStorage; - }catch (Exception e){ - FileUtil.del(file); - throw e; - } - } - - @Override - public String createFile(String name, MultipartFile multipartFile) { - String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); - String type = FileUtil.getFileType(suffix); - File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); - if(ObjectUtil.isNull(file)){ - throw new BadRequestException("上传失败"); - } - return file.getName(); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(LocalStorage resources) { - LocalStorage localStorage = getById(resources.getId()); - localStorage.copy(resources); - saveOrUpdate(localStorage); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - for (Long id : ids) { - LocalStorage storage = getById(id); - FileUtil.del(storage.getPath()); - removeById(storage); - } - } - - @Override - public void download(List queryAll, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (LocalStorage localStorage : queryAll) { - Map map = new LinkedHashMap<>(); - map.put("文件名", localStorage.getRealName()); - map.put("备注名", localStorage.getName()); - map.put("文件类型", localStorage.getType()); - map.put("文件大小", localStorage.getSize()); - map.put("创建者", localStorage.getCreateBy()); - map.put("创建日期", localStorage.getCreateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuConfigServiceImpl.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuConfigServiceImpl.java deleted file mode 100644 index 4e2a23b..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuConfigServiceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.RequiredArgsConstructor; -import me.zhengjie.domain.QiniuConfig; -import me.zhengjie.exception.BadRequestException; -import me.zhengjie.mapper.QiniuConfigMapper; -import me.zhengjie.service.QiNiuConfigService; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author Tz - * @date 2018-12-31 - */ -@Service -@RequiredArgsConstructor -@CacheConfig(cacheNames = "qiNiu") -public class QiNiuConfigServiceImpl extends ServiceImpl implements QiNiuConfigService { - - @Override - @Cacheable(key = "'config'") - public QiniuConfig getConfig() { - QiniuConfig qiniuConfig = getById(1L); - return qiniuConfig == null ? new QiniuConfig() : qiniuConfig; - } - - @Override - @CacheEvict(key = "'config'") - @Transactional(rollbackFor = Exception.class) - public void saveConfig(QiniuConfig qiniuConfig) { - qiniuConfig.setId(1L); - String http = "http://", https = "https://"; - if (!(qiniuConfig.getHost().toLowerCase().startsWith(http)||qiniuConfig.getHost().toLowerCase().startsWith(https))) { - throw new BadRequestException("外链域名必须以http://或者https://开头"); - } - saveOrUpdate(qiniuConfig); - } - - @Override - @CacheEvict(key = "'config'") - @Transactional(rollbackFor = Exception.class) - public void updateType(String type) { - QiniuConfig qiniuConfig = getById(1L); - qiniuConfig.setType(type); - saveOrUpdate(qiniuConfig); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiniuContentServiceImpl.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiniuContentServiceImpl.java deleted file mode 100644 index 1e61964..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiniuContentServiceImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.service.impl; - -import com.alibaba.fastjson2.JSON; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.qiniu.common.QiniuException; -import com.qiniu.http.Response; -import com.qiniu.storage.BucketManager; -import com.qiniu.storage.Configuration; -import com.qiniu.storage.UploadManager; -import com.qiniu.storage.model.DefaultPutRet; -import com.qiniu.storage.model.FileInfo; -import com.qiniu.util.Auth; -import lombok.RequiredArgsConstructor; -import me.zhengjie.domain.QiniuConfig; -import me.zhengjie.domain.QiniuContent; -import me.zhengjie.mapper.QiniuContentMapper; -import me.zhengjie.domain.dto.QiniuQueryCriteria; -import me.zhengjie.utils.PageResult; -import me.zhengjie.utils.QiNiuUtil; -import me.zhengjie.exception.BadRequestException; -import me.zhengjie.service.QiniuContentService; -import me.zhengjie.utils.FileUtil; -import me.zhengjie.utils.PageUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.*; - -/** - * @author Tz - * @date 2018-12-31 - */ -@Service -@RequiredArgsConstructor -@CacheConfig(cacheNames = "qiNiu") -public class QiniuContentServiceImpl extends ServiceImpl implements QiniuContentService { - - private final QiniuContentMapper qiniuContentMapper; - - @Value("${qiniu.max-size}") - private Long maxSize; - - @Override - public PageResult queryAll(QiniuQueryCriteria criteria, Page page){ - return PageUtil.toPage(qiniuContentMapper.findAll(criteria, page)); - } - - @Override - public List queryAll(QiniuQueryCriteria criteria) { - return qiniuContentMapper.findAll(criteria); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig) { - FileUtil.checkSize(maxSize, file.getSize()); - if(qiniuConfig.getId() == null){ - throw new BadRequestException("请先添加相应配置,再操作"); - } - // 构造一个带指定Zone对象的配置类 - Configuration cfg = new Configuration(QiNiuUtil.getRegion(qiniuConfig.getZone())); - UploadManager uploadManager = new UploadManager(cfg); - Auth auth = Auth.create(qiniuConfig.getAccessKey(), qiniuConfig.getSecretKey()); - String upToken = auth.uploadToken(qiniuConfig.getBucket()); - try { - String key = file.getOriginalFilename(); - if(qiniuContentMapper.findByKey(key) != null) { - key = QiNiuUtil.getKey(key); - } - Response response = uploadManager.put(file.getBytes(), key, upToken); - //解析上传成功的结果 - DefaultPutRet putRet = JSON.parseObject(response.bodyString(), DefaultPutRet.class); - QiniuContent content = qiniuContentMapper.findByKey(FileUtil.getFileNameNoEx(putRet.key)); - if(content == null){ - //存入数据库 - QiniuContent qiniuContent = new QiniuContent(); - qiniuContent.setSuffix(FileUtil.getExtensionName(putRet.key)); - qiniuContent.setBucket(qiniuConfig.getBucket()); - qiniuContent.setType(qiniuConfig.getType()); - qiniuContent.setKey(FileUtil.getFileNameNoEx(putRet.key)); - qiniuContent.setUrl(qiniuConfig.getHost() + "/" + putRet.key); - qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(String.valueOf(file.getSize())))); - save(qiniuContent); - } - return content; - } catch (Exception e) { - throw new BadRequestException(e.getMessage()); - } - } - - @Override - public String download(QiniuContent content,QiniuConfig config){ - String finalUrl; - String type = "公开"; - if(type.equals(content.getType())){ - finalUrl = content.getUrl(); - } else { - Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); - // 1小时,可以自定义链接过期时间 - long expireInSeconds = 3600; - finalUrl = auth.privateDownloadUrl(content.getUrl(), expireInSeconds); - } - return finalUrl; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(QiniuContent content, QiniuConfig config) { - //构造一个带指定Zone对象的配置类 - Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); - Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); - BucketManager bucketManager = new BucketManager(auth, cfg); - try { - bucketManager.delete(content.getBucket(), content.getKey() + "." + content.getSuffix()); - } catch (QiniuException ex) { - log.error("七牛云删除文件失败", ex); - } finally { - removeById(content); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void synchronize(QiniuConfig config) { - if(config.getId() == null){ - throw new BadRequestException("请先添加相应配置,再操作"); - } - //构造一个带指定Zone对象的配置类 - Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); - Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey()); - BucketManager bucketManager = new BucketManager(auth, cfg); - //文件名前缀 - String prefix = ""; - //每次迭代的长度限制,最大1000,推荐值 1000 - int limit = 1000; - //指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串 - String delimiter = ""; - //列举空间文件列表 - BucketManager.FileListIterator fileListIterator = bucketManager.createFileListIterator(config.getBucket(), prefix, limit, delimiter); - while (fileListIterator.hasNext()) { - //处理获取的file list结果 - QiniuContent qiniuContent; - FileInfo[] items = fileListIterator.next(); - for (FileInfo item : items) { - if(qiniuContentMapper.findByKey(FileUtil.getFileNameNoEx(item.key)) == null){ - qiniuContent = new QiniuContent(); - qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(String.valueOf(item.fsize)))); - qiniuContent.setSuffix(FileUtil.getExtensionName(item.key)); - qiniuContent.setKey(FileUtil.getFileNameNoEx(item.key)); - qiniuContent.setType(config.getType()); - qiniuContent.setBucket(config.getBucket()); - qiniuContent.setUrl(config.getHost()+"/"+item.key); - save(qiniuContent); - } - } - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids, QiniuConfig config) { - for (Long id : ids) { - delete(getById(id), config); - } - } - - @Override - public void downloadList(List queryAll, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (QiniuContent content : queryAll) { - Map map = new LinkedHashMap<>(); - map.put("文件名", content.getKey()); - map.put("文件类型", content.getSuffix()); - map.put("空间名称", content.getBucket()); - map.put("文件大小", content.getSize()); - map.put("空间类型", content.getType()); - map.put("创建日期", content.getUpdateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/AlipayUtils.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/AlipayUtils.java deleted file mode 100644 index a780179..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/AlipayUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.utils; - -import com.alipay.api.AlipayApiException; -import com.alipay.api.internal.util.AlipaySignature; -import me.zhengjie.domain.AlipayConfig; -import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletRequest; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 支付宝工具类 - * @author zhengjie - * @date 2018/09/30 14:04:35 - */ -@Component -public class AlipayUtils { - - /** - * 生成订单号 - * @return String - */ - public String getOrderCode() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - int a = (int)(Math.random() * 9000.0D) + 1000; - System.out.println(a); - Date date = new Date(); - String str = sdf.format(date); - String[] split = str.split("-"); - String s = split[0] + split[1] + split[2]; - String[] split1 = s.split(" "); - String s1 = split1[0] + split1[1]; - String[] split2 = s1.split(":"); - return split2[0] + split2[1] + split2[2] + a; - } - - /** - * 校验签名 - * @param request HttpServletRequest - * @param alipay 阿里云配置 - * @return boolean - */ - public boolean rsaCheck(HttpServletRequest request, AlipayConfig alipay){ - - // 获取支付宝POST过来反馈信息 - Map params = new HashMap<>(1); - Map requestParams = request.getParameterMap(); - for (Object o : requestParams.keySet()) { - String name = (String) o; - String[] values = requestParams.get(name); - String valueStr = ""; - for (int i = 0; i < values.length; i++) { - valueStr = (i == values.length - 1) ? valueStr + values[i] - : valueStr + values[i] + ","; - } - params.put(name, valueStr); - } - - try { - return AlipaySignature.rsaCheckV1(params, - alipay.getPublicKey(), - alipay.getCharset(), - alipay.getSignType()); - } catch (AlipayApiException e) { - return false; - } - } -} diff --git a/eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/QiNiuUtil.java b/eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/QiNiuUtil.java deleted file mode 100644 index 950a730..0000000 --- a/eladmin/eladmin-tools/src/main/java/me/zhengjie/utils/QiNiuUtil.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2019-2025 Tz - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package me.zhengjie.utils; - -import com.qiniu.storage.Region; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * 七牛云存储工具类 - * @author Tz - * @date 2018-12-31 - */ -public class QiNiuUtil { - - private static final String HUAD = "华东"; - - private static final String HUAB = "华北"; - - private static final String HUAN = "华南"; - - private static final String BEIM = "北美"; - - /** - * 得到机房的对应关系 - * @param zone 机房名称 - * @return Region - */ - public static Region getRegion(String zone){ - - if(HUAD.equals(zone)){ - return Region.huadong(); - } else if(HUAB.equals(zone)){ - return Region.huabei(); - } else if(HUAN.equals(zone)){ - return Region.huanan(); - } else if (BEIM.equals(zone)){ - return Region.beimei(); - // 否则就是东南亚 - } else { - return Region.qvmHuadong(); - } - } - - /** - * 默认不指定key的情况下,以文件内容的hash值作为文件名 - * @param file 文件名 - * @return String - */ - public static String getKey(String file){ - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); - Date date = new Date(); - return FileUtil.getFileNameNoEx(file) + "-" + - sdf.format(date) + - "." + - FileUtil.getExtensionName(file); - } -} diff --git a/eladmin/eladmin-tools/src/main/resources/mapper/LocalStorageMapper.xml b/eladmin/eladmin-tools/src/main/resources/mapper/LocalStorageMapper.xml deleted file mode 100644 index f0ffbb5..0000000 --- a/eladmin/eladmin-tools/src/main/resources/mapper/LocalStorageMapper.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - storage_id, real_name, name, suffix, size, type, create_time, update_time, create_by, update_by - - - - \ No newline at end of file diff --git a/eladmin/eladmin-tools/src/main/resources/mapper/QiniuContentMapper.xml b/eladmin/eladmin-tools/src/main/resources/mapper/QiniuContentMapper.xml deleted file mode 100644 index 67769d0..0000000 --- a/eladmin/eladmin-tools/src/main/resources/mapper/QiniuContentMapper.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - content_id, name, size, type, suffix, bucket, url, update_time - - - - - - \ No newline at end of file