main
黄海 2 months ago
parent 05b51039c8
commit b7eefaffd1

@ -2,9 +2,11 @@ package com.dsideal.aiSupport;
import com.dsideal.aiSupport.Index.IndexController;
import com.dsideal.aiSupport.Interceptor.*;
import com.dsideal.aiSupport.Plugin.RocketMQPlugin;
import com.dsideal.aiSupport.Plugin.YamlProp;
import com.dsideal.aiSupport.Util.FileUtil;
import com.dsideal.aiSupport.Util.LogBackLogFactory;
import com.dsideal.aiSupport.Util.RocketMqKit;
import com.jfinal.config.*;
import com.jfinal.kit.Prop;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
@ -13,10 +15,13 @@ import com.jfinal.plugin.druid.DruidPlugin;
import com.jfinal.plugin.redis.RedisPlugin;
import com.jfinal.server.undertow.UndertowServer;
import com.jfinal.template.Engine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
public class AiSupportApplication extends JFinalConfig {
private static final Logger logger = LoggerFactory.getLogger(AiSupportApplication.class);
public static String getEnvPrefix() {
String myEnvVar = System.getenv("WORKING_ENV");
@ -88,10 +93,15 @@ public class AiSupportApplication extends JFinalConfig {
}
//加载
me.add(arp);
// 用于缓存模块的redis服务
RedisPlugin redis = new RedisPlugin("Redis", PropKit.get("redis.ip"), PropKit.getInt("redis.port"), 10 * 1000, PropKit.get("redis.password"));
//启动redis组件
me.add(redis);
//加载RocketMq插件
RocketMQPlugin rocketMq = new RocketMQPlugin();
me.add(rocketMq);
}
/**

@ -0,0 +1,29 @@
package com.dsideal.aiSupport.Plugin;
import com.dsideal.aiSupport.Util.RocketMqKit;
import com.jfinal.plugin.IPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RocketMQPlugin implements IPlugin {
private static final Logger logger = LoggerFactory.getLogger(RocketMQPlugin.class);
@Override
public boolean start() {
try {
// 初始化时获取一次实例,确保启动成功
RocketMqKit.getProducer();
RocketMqKit.getConsumer();
logger.info("RocketMq插件加载成功。");
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
public boolean stop() {
RocketMqKit.shutdown();
return true;
}
}

@ -1,125 +1,16 @@
package com.dsideal.aiSupport.Util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@SuppressWarnings("unchecked")
public class CommonUtil {
//在独立的main函数中使用下面的方式进行声明logback对象
private static final Logger log = LoggerFactory.getLogger(CommonUtil.class);
/**
*
* @param size
* @return
*/
public static String formatFileSize(long size) {
String[] units = new String[] { "B", "KB", "MB", "GB", "TB" };
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return String.format("%.1f %s", size / Math.pow(1024, digitGroups), units[digitGroups]);
}
public static void main(String[] args) {
long fileSizeInBytes = 1234567890L; // 假设这是你的文件大小
String formattedSize = formatFileSize(fileSizeInBytes);
System.out.println(formattedSize); // 输出格式化后的文件大小
}
/**
*
*
* 2019-01-03
*
* @param tempPath
*/
public static void clearFile(String tempPath) {
File file = new File(tempPath);
File[] tempList = file.listFiles();
if (tempList != null) {
for (int i = 0; i < tempList.length; i++) {
if (tempList[i].isFile()) {
tempList[i].delete();
}
}
}
}
/**
*
*
* 2018-12-20
*
* @param str
* @return
*/
public static boolean isValidDate(String str) {
boolean convertSuccess = true;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
format.setLenient(false);
format.parse(str);
} catch (ParseException e) {
convertSuccess = false;
}
return convertSuccess;
}
/**
*
*
* 2018-12-12
*
* @return
*/
public static Page<?> ConvertLoginRs(Page<?> page) {
List<Record> list = new ArrayList<>();
for (int i = 0; i < page.getList().size(); i++) {
Record record = (Record) page.getList().get(i);
String original_pwd = record.get("original_pwd");
String database_pwd = record.get("pwd");
//将明文密码加密
String pwd = CommonUtil.getLdapPassword(original_pwd);
if (!pwd.equals(database_pwd)) {
record.set("original_pwd", "用户已修改");
}
record.remove("pwd");
list.add(record);
}
Page<Record> pageRecords = new Page(list, page.getPageNumber(), page.getPageSize(), page.getTotalPage(), page.getTotalRow());
return pageRecords;
}
/**
* JSONArray
*
* :2018-12-12
*
* @param content
* @return
*/
public static boolean isJsonArray(String content) {
try {
JSONArray.parseArray(content);
return true;
} catch (Exception e) {
return false;
}
}
/**
* +
@ -135,64 +26,6 @@ public class CommonUtil {
return nowTime;
}
/**
*
*
* @param map
* @return
*/
public static String Sign(Map<String, Object> map, String signKey) {
if (map == null) {
return null;
}
List<String> keyList = new ArrayList<>(map.keySet());
Collections.sort(keyList);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < keyList.size(); i++) {
String key = keyList.get(i);
Object value = map.get(key);
sb.append(key + "=" + value + "&");
}
String signStr = sb.substring(0, sb.length() - 1) + signKey;
String md5Str = DigestUtils.md5Hex(signStr);
return md5Str;
}
/**
* layUI
*/
public static Map<String, Object> renderJsonForLayUI(List<Record> list, int count) {
Map<String, Object> result = new HashMap<>();
result.put("code", 0);
result.put("msg", "");
result.put("count", count);
result.put("data", list);
return result;
}
public static Map<String, Object> renderJsonForLayUI(List<Record> list) {
Map<String, Object> result = new HashMap<>();
result.put("code", 0);
result.put("msg", "");
result.put("count", list.size());
result.put("data", list);
return result;
}
/**
* layUI
*
* @param dataPage
* @return
*/
public static Map<String, Object> renderJsonForLayUI(Page<?> dataPage) {
Map<String, Object> result = new HashMap<>();
result.put("code", 0);
result.put("msg", "");
result.put("count", dataPage.getTotalRow());
result.put("data", dataPage.getList());
return result;
}
/**
*
@ -220,228 +53,5 @@ public class CommonUtil {
}
/**
* json
*
* 2018-11-06
*
* @param result
* @param message
*/
public static Map returnMessageJson(boolean result, String message) {
Map map = new HashMap();
map.put("success", result);
map.put("message", message);
return map;
}
public static Map returnMessageJson(boolean result, JSONObject jo) {
Map map = new HashMap();
map.put("success", result);
map.put("result", jo);
return map;
}
public static Map returnMessageJson(boolean result, List<Record> list) {
Map map = new HashMap();
map.put("success", result);
map.put("result", list);
return map;
}
/**
* md5
*
* 2018-11-06
*
* @param target
* @return
*/
public static String md5(String target) {
return DigestUtils.md5Hex(target);
}
//算法:将密码经过 MD5 运算,得到 32 字节的字符串然后每2个字节压缩成一个十六进制字符
// 这样得到16字节的字符串最后经过Base64编码。
public static String getLdapPassword(String password) {
try {
String md5pass = md5(password);
byte[] baKeyword = new byte[md5pass.length() / 2];
for (int i = 0; i < baKeyword.length; i++) {
try {
baKeyword[i] = (byte) (0xff & Integer.parseInt(md5pass.substring(i * 2, i * 2 + 2), 16));
} catch (Exception e) {
log.error("======================错误密码:" + md5pass);
e.printStackTrace();
}
}
String newstr = Base64.encodeBase64String(baKeyword);
return newstr;
} catch (Exception err) {
log.error("出错的密码:" + password);
return null;
}
}
/**
* 6
*
* 2018-11-27
*
* @return
*/
public static String getSixRandom() {
String sources = "0123456789";
Random rand = new Random();
StringBuffer flag = new StringBuffer();
for (int j = 0; j < 6; j++) {
flag.append(sources.charAt(rand.nextInt(9)) + "");
}
return flag.toString();
}
/**
*
*
* 2018-11-27
* 13+
* 15+4
* 18+14
* 17+9
* 147
*
* @param phoneNum
* @return
*/
public static boolean getIsPhoneLegal(String phoneNum) {
try {
String regExp = "^((13[0-9])|(19[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
Pattern p = Pattern.compile(regExp);
Matcher m = p.matcher(phoneNum);
return m.matches();
} catch (Exception e) {
return false;
}
}
/**
*
*
* 2018-11-27
*
* @param eMail
* @return
*/
public static boolean getIsEmailLegal(String eMail) {
try {
String regExp = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
Pattern p = Pattern.compile(regExp);
Matcher m = p.matcher(eMail);
return m.matches();
} catch (Exception e) {
return false;
}
}
/**
*
*
* 2018-12-07
*
* @param date
* @return
*/
public static boolean getIsDateLegal(String date) {
if (date == null || StrKit.isBlank(date)) return false;
try {
String regExp = "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))";
Pattern p = Pattern.compile(regExp);
Matcher m = p.matcher(date);
return m.matches();
} catch (Exception e) {
return false;
}
}
/**
*
*
* 2018-12-07
*
* @param xb
* @return
*/
public static boolean getXbCorrectRange(String xb) {
String[] stageArr = new String[]{"1", "2"};
for (String s : stageArr) {
if (s.equals(xb)) {
return true;
}
}
return false;
}
/**
*
*
* 2018-12-07
*
* @param mz
* @return
*/
public static boolean getMzCorrectRange(String mz) {
String[] stageArr = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "97", "98"};
for (String s : stageArr) {
if (s.equals(mz)) {
return true;
}
}
return false;
}
/**
*
*
* 2019-01-05
*
* @param zzmm
* @return
*/
public static boolean getZzmmCorrectRange(String zzmm) {
String[] stageArr = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13"};
for (String s : stageArr) {
if (s.equals(zzmm)) {
return true;
}
}
return false;
}
/***
* delete CRLF; delete empty line ;delete blank lines
*
* @param input
* @return
*/
private static String deleteCRLFOnce(String input) {
return input.replaceAll("((\r\n)|\n)[\\s\t ]*(\\1)+", "$1");
}
public static boolean checkPass(String pass) {
//注释掉必须要有符号这个要求:&& pass.matches(".*[~!@#$%^&*\\.?]{1,}.*")
// if (pass.matches(".*[a-z]{1,}.*") && pass.matches(".*[A-Z]{1,}.*") && pass.matches(".*\\d{1,}.*") && pass.length()>=7 ) {
// return true;
// }
// return false;
return true;
}
public static boolean isBase64(String str) {
String base64Rule = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$";
return Pattern.matches(base64Rule, str);
}
}

@ -17,7 +17,12 @@ import java.util.List;
* RocketMQ
*
*/
public class RocketMQUtil {
public class RocketMqKit {
private static volatile DefaultMQProducer producer;
private static volatile DefaultLitePullConsumer consumer;
private static final Object producerLock = new Object();
private static final Object consumerLock = new Object();
// RocketMQ服务器地址
private final static String nameServer = AiSupportApplication.PropKit.get("RocketMq.nameServer");
// 生产者组名
@ -27,6 +32,66 @@ public class RocketMQUtil {
// 主题名称
private final static String topic = AiSupportApplication.PropKit.get("RocketMq.topic");
// 获取Producer实例
public static DefaultMQProducer getProducer() {
if (producer == null) {
synchronized (producerLock) {
if (producer == null) {
producer = new DefaultMQProducer(producerGroup);
producer.setNamesrvAddr(nameServer);
try {
producer.start();
} catch (Exception e) {
throw new RuntimeException("初始化Producer失败", e);
}
}
}
}
return producer;
}
// 获取Consumer实例
public static DefaultLitePullConsumer getConsumer() {
if (consumer == null) {
synchronized (consumerLock) {
if (consumer == null) {
consumer = new DefaultLitePullConsumer(consumerGroup);
consumer.setNamesrvAddr(nameServer);
consumer.setAutoCommit(false);
try {
consumer.subscribe(topic, "*");
consumer.setPullBatchSize(20);
consumer.start();
} catch (Exception e) {
throw new RuntimeException("初始化Consumer失败", e);
}
}
}
}
return consumer;
}
// 关闭资源的方法
public static void shutdown() {
if (producer != null) {
producer.shutdown();
}
if (consumer != null) {
consumer.shutdown();
}
}
// 发送消息的方法
public static SendResult sendMessage(String tag, String key, String body) throws Exception {
Message msg = new Message(topic, tag, key, body.getBytes(RemotingHelper.DEFAULT_CHARSET));
return getProducer().send(msg);
}
// 消费消息的方法
public static List<MessageExt> pullMessages() {
return getConsumer().poll();
}
/**
*
*
@ -163,16 +228,4 @@ public class RocketMQUtil {
}
}
}
public static void main(String[] args) throws IOException, InterruptedException {
// 测试同步发送
//syncSend();
// 测试顺序消息
//orderSend();
// 注意:以下方法在实际使用时应该分开测试
asyncSend(); // 异步发送测试
// consumerPull(); // 消费者测试
}
}

@ -1,16 +0,0 @@
# 官网
https://docmee.cn/
# 用户名与密码
18686619970
密码:手机验证码
# 体验
https://www.veasion.cn/AiPPT/
# 充值
https://open.docmee.cn/open/workspace/top-up
未充值
# 模板选择【展示】
https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202505131336410.png

@ -1 +0,0 @@
https://help.aliyun.com/zh/model-studio/emo-api?spm=a2c4g.11186623.help-menu-2400256.d_2_3_4_1.7d8a5f84mfOU9j

@ -1,9 +0,0 @@
# 可灵AI使用指南图片生成
https://docs.qingque.cn/d/home/eZQApd0EZqQHWXBEi7lL16_lD?identityId=26L1FFNIZ7r#section=h.60mmflz96wnl
# 可灵控制台
https://console-cn.klingai.com/console/expense-center/resource-pack-manage
# 登录
18686619970
获取验证码登录

@ -1,39 +0,0 @@
# 官网
https://www.liblib.art/apis
# 账号
18686619970
手机验证码登录
# 访问凭证
AK: sOCtVLVTNOZkRMajlhzCmg
SK: PUe8QTRG9i0G9EbpedHmIpLQ0FyxoYY9
# 接口文档
https://liblibai.feishu.cn/wiki/UAMVw67NcifQHukf8fpccgS5n6d
计划
API试用计划
到期时间
2025/05/22 23:59:59
剩余积分
500
购买积分
并发任务数
1个
# LiblibAI工作流
社区商用工作流和个人本地工作流均可支持调用。工作流挑选和商用查询可至https://www.liblib.art/workflows
# - 星流Star-3 Alpha适合对AI生图参数不太了解或不想复杂控制的用户。搭载自带LoRA推荐算法对自然语言的精准响应提供极致的图像质量能够生成具有照片级真实感的视觉效果不能自由添加LoRA仅支持部分ControlNet。生图效果可至星流官网https://xingliu.art/体验。
# - LiblibAI自定义模型若需要特定LoRA和ControlNet只能选此模式适合高度自由、精准控制和特定风格的场景基于F.1/XL/v3/v1.5等基础算法支持自定义调用LiblibAI内全量30万+可商用模型和任意私有模型。最新开源模型和插件第一时间更新。模型挑选和商用查询可至本文档3.1或https://www.liblib.art/。
# 参考文档
https://liblibai.feishu.cn/wiki/UAMVw67NcifQHukf8fpccgS5n6d
https://www.liblib.art/workflows

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 KiB

@ -1,3 +0,0 @@
https://goapi.gptnb.ai/account/profile
littlehb
mdcija780522
Loading…
Cancel
Save