Commit 31576700 by wangqi

语音转文字

parent dc1bc2d1
...@@ -22,7 +22,7 @@ public class MimeTypeUtils ...@@ -22,7 +22,7 @@ public class MimeTypeUtils
public static final String[] FLASH_EXTENSION = { "swf", "flv" }; public static final String[] FLASH_EXTENSION = { "swf", "flv" };
public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
"asf", "rm", "rmvb" }; "asf", "rm", "rmvb", "aac" , "3gp", "m4a" };
public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" };
...@@ -37,7 +37,7 @@ public class MimeTypeUtils ...@@ -37,7 +37,7 @@ public class MimeTypeUtils
"mp4", "avi", "rmvb", "mp4", "avi", "rmvb",
// pdf // pdf
"pdf", "pdf",
"sgy","segy" }; "sgy","segy" , "mp3" , "wav", "wma","aac" , "3gp", "m4a"};
public static String getExtension(String prefix) public static String getExtension(String prefix)
{ {
......
...@@ -27,6 +27,38 @@ public class RuoYiConfig ...@@ -27,6 +27,38 @@ public class RuoYiConfig
/** 获取地址开关 */ /** 获取地址开关 */
private static boolean addressEnabled; private static boolean addressEnabled;
private static String dzysip;
private static String ypzlip;
private static String hyjyip;
public static String getDzysip() {
return dzysip;
}
public void setDzysip(String dzysip) {
RuoYiConfig.dzysip = dzysip;
}
public static String getYpzlip() {
return ypzlip;
}
public void setYpzlip(String ypzlip) {
RuoYiConfig.ypzlip = ypzlip;
}
public static String getHyjyip() {
return hyjyip;
}
public void setHyjyip(String hyjyip) {
RuoYiConfig.hyjyip = hyjyip;
}
public String getName() public String getName()
{ {
return name; return name;
......
...@@ -21,6 +21,9 @@ import com.ruoyi.framework.web.domain.AjaxResult; ...@@ -21,6 +21,9 @@ import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.framework.web.page.TableDataInfo;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import javax.annotation.Resource;
/** /**
* 会议信息Controller * 会议信息Controller
* *
...@@ -37,7 +40,6 @@ public class HyjyxxController extends BaseController ...@@ -37,7 +40,6 @@ public class HyjyxxController extends BaseController
/** /**
* 查询会议信息列表 * 查询会议信息列表
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxx:hyjyxx:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Hyjyxx hyjyxx) public TableDataInfo list(Hyjyxx hyjyxx)
{ {
...@@ -49,7 +51,6 @@ public class HyjyxxController extends BaseController ...@@ -49,7 +51,6 @@ public class HyjyxxController extends BaseController
/** /**
* 导出会议信息列表 * 导出会议信息列表
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxx:hyjyxx:export')")
@Log(title = "会议信息", businessType = BusinessType.EXPORT) @Log(title = "会议信息", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Hyjyxx hyjyxx) public void export(HttpServletResponse response, Hyjyxx hyjyxx)
...@@ -62,7 +63,6 @@ public class HyjyxxController extends BaseController ...@@ -62,7 +63,6 @@ public class HyjyxxController extends BaseController
/** /**
* 获取会议信息详细信息 * 获取会议信息详细信息
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxx:hyjyxx:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
...@@ -72,7 +72,6 @@ public class HyjyxxController extends BaseController ...@@ -72,7 +72,6 @@ public class HyjyxxController extends BaseController
/** /**
* 新增会议信息 * 新增会议信息
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxx:hyjyxx:add')")
@Log(title = "会议信息", businessType = BusinessType.INSERT) @Log(title = "会议信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Hyjyxx hyjyxx) public AjaxResult add(@RequestBody Hyjyxx hyjyxx)
...@@ -83,7 +82,6 @@ public class HyjyxxController extends BaseController ...@@ -83,7 +82,6 @@ public class HyjyxxController extends BaseController
/** /**
* 修改会议信息 * 修改会议信息
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxx:hyjyxx:edit')")
@Log(title = "会议信息", businessType = BusinessType.UPDATE) @Log(title = "会议信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody Hyjyxx hyjyxx) public AjaxResult edit(@RequestBody Hyjyxx hyjyxx)
...@@ -94,11 +92,33 @@ public class HyjyxxController extends BaseController ...@@ -94,11 +92,33 @@ public class HyjyxxController extends BaseController
/** /**
* 删除会议信息 * 删除会议信息
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxx:hyjyxx:remove')")
@Log(title = "会议信息", businessType = BusinessType.DELETE) @Log(title = "会议信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
{ {
return toAjax(hyjyxxService.deleteHyjyxxByIds(ids)); return toAjax(hyjyxxService.deleteHyjyxxByIds(ids));
} }
// 注入线程池
@Resource
private ThreadPoolTaskExecutor taskExecutor;
/**
* 会议转录
*/
@Log(title = "会议转录", businessType = BusinessType.UPDATE)
@PostMapping("/hyzl/{id}")
public AjaxResult hyzl(@PathVariable("id") Long id)
{
/* return toAjax(hyjyxxService.hyzl(id));*/
// 提交任务到线程池异步执行
taskExecutor.execute(() -> {
hyjyxxService.hyzl(id);
});
// 立即返回,告知前端任务已启动
return AjaxResult.success("会议转录任务已启动,请稍后查看结果");
}
} }
...@@ -37,7 +37,6 @@ public class HyjyxxMbController extends BaseController ...@@ -37,7 +37,6 @@ public class HyjyxxMbController extends BaseController
/** /**
* 查询会议模板列表 * 查询会议模板列表
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxxMb:hymb:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(HyjyxxMb hyjyxxMb) public TableDataInfo list(HyjyxxMb hyjyxxMb)
{ {
...@@ -49,7 +48,6 @@ public class HyjyxxMbController extends BaseController ...@@ -49,7 +48,6 @@ public class HyjyxxMbController extends BaseController
/** /**
* 导出会议模板列表 * 导出会议模板列表
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxxMb:hymb:export')")
@Log(title = "会议模板", businessType = BusinessType.EXPORT) @Log(title = "会议模板", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, HyjyxxMb hyjyxxMb) public void export(HttpServletResponse response, HyjyxxMb hyjyxxMb)
...@@ -62,7 +60,6 @@ public class HyjyxxMbController extends BaseController ...@@ -62,7 +60,6 @@ public class HyjyxxMbController extends BaseController
/** /**
* 获取会议模板详细信息 * 获取会议模板详细信息
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxxMb:hymb:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
...@@ -72,7 +69,6 @@ public class HyjyxxMbController extends BaseController ...@@ -72,7 +69,6 @@ public class HyjyxxMbController extends BaseController
/** /**
* 新增会议模板 * 新增会议模板
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxxMb:hymb:add')")
@Log(title = "会议模板", businessType = BusinessType.INSERT) @Log(title = "会议模板", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody HyjyxxMb hyjyxxMb) public AjaxResult add(@RequestBody HyjyxxMb hyjyxxMb)
...@@ -83,7 +79,6 @@ public class HyjyxxMbController extends BaseController ...@@ -83,7 +79,6 @@ public class HyjyxxMbController extends BaseController
/** /**
* 修改会议模板 * 修改会议模板
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxxMb:hymb:edit')")
@Log(title = "会议模板", businessType = BusinessType.UPDATE) @Log(title = "会议模板", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody HyjyxxMb hyjyxxMb) public AjaxResult edit(@RequestBody HyjyxxMb hyjyxxMb)
...@@ -94,11 +89,17 @@ public class HyjyxxMbController extends BaseController ...@@ -94,11 +89,17 @@ public class HyjyxxMbController extends BaseController
/** /**
* 删除会议模板 * 删除会议模板
*/ */
@PreAuthorize("@ss.hasPermi('hyjyxxMb:hymb:remove')")
@Log(title = "会议模板", businessType = BusinessType.DELETE) @Log(title = "会议模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
{ {
return toAjax(hyjyxxMbService.deleteHyjyxxMbByIds(ids)); return toAjax(hyjyxxMbService.deleteHyjyxxMbByIds(ids));
} }
@GetMapping("/selectHybm")
public TableDataInfo selectHybm(HyjyxxMb hyjyxxMb)
{
List<HyjyxxMb> list = hyjyxxMbService.selectHyjyxxMbList(hyjyxxMb);
return getDataTable(list);
}
} }
...@@ -9,7 +9,7 @@ import com.ruoyi.framework.web.domain.BaseEntity; ...@@ -9,7 +9,7 @@ import com.ruoyi.framework.web.domain.BaseEntity;
/** /**
* 会议信息对象 hyjyxx * 会议信息对象 hyjyxx
* *
* @author ruoyi * @author ruoyi
* @date 2025-09-17 * @date 2025-09-17
*/ */
...@@ -44,9 +44,9 @@ public class Hyjyxx extends BaseEntity ...@@ -44,9 +44,9 @@ public class Hyjyxx extends BaseEntity
@Excel(name = "会议纪要") @Excel(name = "会议纪要")
private String hyjy; private String hyjy;
/** 解析完成时间 */ /** 会议开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "解析完成时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "会议开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date jxwcsj; private Date jxwcsj;
/** 创建人 */ /** 创建人 */
...@@ -70,154 +70,226 @@ public class Hyjyxx extends BaseEntity ...@@ -70,154 +70,226 @@ public class Hyjyxx extends BaseEntity
@Excel(name = "备用3") @Excel(name = "备用3")
private String ext3; private String ext3;
public void setId(Long id) /** 原文标准化 */
@Excel(name = "原文标准化")
private String ywBzh;
/** 会议纪要标准化 */
@Excel(name = "会议纪要标准化")
private String hyjyBzh;
/** 音频文件名称 */
@Excel(name = "音频文件名称")
private String ypwjName;
/** 模板名称 */
@Excel(name = "模板名称")
private String mbmc;
private String jysczt;
public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setXmid(Long xmid) public void setXmid(Long xmid)
{ {
this.xmid = xmid; this.xmid = xmid;
} }
public Long getXmid() public Long getXmid()
{ {
return xmid; return xmid;
} }
public void setHymc(String hymc) public void setHymc(String hymc)
{ {
this.hymc = hymc; this.hymc = hymc;
} }
public String getHymc() public String getHymc()
{ {
return hymc; return hymc;
} }
public void setJxzt(String jxzt) public void setJxzt(String jxzt)
{ {
this.jxzt = jxzt; this.jxzt = jxzt;
} }
public String getJxzt() public String getJxzt()
{ {
return jxzt; return jxzt;
} }
public void setYpwj(String ypwj) public void setYpwj(String ypwj)
{ {
this.ypwj = ypwj; this.ypwj = ypwj;
} }
public String getYpwj() public String getYpwj()
{ {
return ypwj; return ypwj;
} }
public void setYw(String yw) public void setYw(String yw)
{ {
this.yw = yw; this.yw = yw;
} }
public String getYw() public String getYw()
{ {
return yw; return yw;
} }
public void setHyjy(String hyjy) public void setHyjy(String hyjy)
{ {
this.hyjy = hyjy; this.hyjy = hyjy;
} }
public String getHyjy() public String getHyjy()
{ {
return hyjy; return hyjy;
} }
public void setJxwcsj(Date jxwcsj) public void setJxwcsj(Date jxwcsj)
{ {
this.jxwcsj = jxwcsj; this.jxwcsj = jxwcsj;
} }
public Date getJxwcsj() public Date getJxwcsj()
{ {
return jxwcsj; return jxwcsj;
} }
public void setCreatedBy(String createdBy) public void setCreatedBy(String createdBy)
{ {
this.createdBy = createdBy; this.createdBy = createdBy;
} }
public String getCreatedBy() public String getCreatedBy()
{ {
return createdBy; return createdBy;
} }
public void setCreatedTime(Date createdTime) public void setCreatedTime(Date createdTime)
{ {
this.createdTime = createdTime; this.createdTime = createdTime;
} }
public Date getCreatedTime() public Date getCreatedTime()
{ {
return createdTime; return createdTime;
} }
public void setExt1(String ext1) public void setExt1(String ext1)
{ {
this.ext1 = ext1; this.ext1 = ext1;
} }
public String getExt1() public String getExt1()
{ {
return ext1; return ext1;
} }
public void setExt2(String ext2) public void setExt2(String ext2)
{ {
this.ext2 = ext2; this.ext2 = ext2;
} }
public String getExt2() public String getExt2()
{ {
return ext2; return ext2;
} }
public void setExt3(String ext3) public void setExt3(String ext3)
{ {
this.ext3 = ext3; this.ext3 = ext3;
} }
public String getExt3() public String getExt3()
{ {
return ext3; return ext3;
} }
public void setYwBzh(String ywBzh)
{
this.ywBzh = ywBzh;
}
public String getYwBzh()
{
return ywBzh;
}
public void setHyjyBzh(String hyjyBzh)
{
this.hyjyBzh = hyjyBzh;
}
public String getHyjyBzh()
{
return hyjyBzh;
}
public void setYpwjName(String ypwjName)
{
this.ypwjName = ypwjName;
}
public String getYpwjName()
{
return ypwjName;
}
public void setMbmc(String mbmc)
{
this.mbmc = mbmc;
}
public String getMbmc()
{
return mbmc;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("xmid", getXmid()) .append("xmid", getXmid())
.append("hymc", getHymc()) .append("hymc", getHymc())
.append("jxzt", getJxzt()) .append("jxzt", getJxzt())
.append("ypwj", getYpwj()) .append("ypwj", getYpwj())
.append("yw", getYw()) .append("yw", getYw())
.append("hyjy", getHyjy()) .append("hyjy", getHyjy())
.append("jxwcsj", getJxwcsj()) .append("jxwcsj", getJxwcsj())
.append("createdBy", getCreatedBy()) .append("createdBy", getCreatedBy())
.append("createdTime", getCreatedTime()) .append("createdTime", getCreatedTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("ext1", getExt1()) .append("ext1", getExt1())
.append("ext2", getExt2()) .append("ext2", getExt2())
.append("ext3", getExt3()) .append("ext3", getExt3())
.toString(); .append("ywBzh", getYwBzh())
.append("hyjyBzh", getHyjyBzh())
.append("ypwjName", getYpwjName())
.append("mbmc", getMbmc())
.toString();
}
public String getJysczt() {
return jysczt;
}
public void setJysczt(String jysczt) {
this.jysczt = jysczt;
} }
} }
...@@ -58,4 +58,6 @@ public interface IHyjyxxService ...@@ -58,4 +58,6 @@ public interface IHyjyxxService
* @return 结果 * @return 结果
*/ */
public int deleteHyjyxxById(Long id); public int deleteHyjyxxById(Long id);
public int hyzl(Long id);
} }
...@@ -8,6 +8,8 @@ import com.ruoyi.project.ys.mapper.HyjyxxMbMapper; ...@@ -8,6 +8,8 @@ import com.ruoyi.project.ys.mapper.HyjyxxMbMapper;
import com.ruoyi.project.ys.domain.HyjyxxMb; import com.ruoyi.project.ys.domain.HyjyxxMb;
import com.ruoyi.project.ys.service.IHyjyxxMbService; import com.ruoyi.project.ys.service.IHyjyxxMbService;
import static com.ruoyi.common.utils.SecurityUtils.getUserId;
/** /**
* 会议模板Service业务层处理 * 会议模板Service业务层处理
* *
...@@ -53,6 +55,8 @@ public class HyjyxxMbServiceImpl implements IHyjyxxMbService ...@@ -53,6 +55,8 @@ public class HyjyxxMbServiceImpl implements IHyjyxxMbService
@Override @Override
public int insertHyjyxxMb(HyjyxxMb hyjyxxMb) public int insertHyjyxxMb(HyjyxxMb hyjyxxMb)
{ {
hyjyxxMb.setCreateBy(getUserId()+"");
hyjyxxMb.setCreatedTime(DateUtils.getNowDate());
return hyjyxxMbMapper.insertHyjyxxMb(hyjyxxMb); return hyjyxxMbMapper.insertHyjyxxMb(hyjyxxMb);
} }
...@@ -65,6 +69,7 @@ public class HyjyxxMbServiceImpl implements IHyjyxxMbService ...@@ -65,6 +69,7 @@ public class HyjyxxMbServiceImpl implements IHyjyxxMbService
@Override @Override
public int updateHyjyxxMb(HyjyxxMb hyjyxxMb) public int updateHyjyxxMb(HyjyxxMb hyjyxxMb)
{ {
hyjyxxMb.setUpdateBy(getUserId()+"");
hyjyxxMb.setUpdateTime(DateUtils.getNowDate()); hyjyxxMb.setUpdateTime(DateUtils.getNowDate());
return hyjyxxMbMapper.updateHyjyxxMb(hyjyxxMb); return hyjyxxMbMapper.updateHyjyxxMb(hyjyxxMb);
} }
......
...@@ -2,12 +2,25 @@ package com.ruoyi.project.ys.service.impl; ...@@ -2,12 +2,25 @@ package com.ruoyi.project.ys.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.config.RuoYiConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.project.ys.mapper.HyjyxxMapper; import com.ruoyi.project.ys.mapper.HyjyxxMapper;
import com.ruoyi.project.ys.domain.Hyjyxx; import com.ruoyi.project.ys.domain.Hyjyxx;
import com.ruoyi.project.ys.service.IHyjyxxService; import com.ruoyi.project.ys.service.IHyjyxxService;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
/** /**
* 会议信息Service业务层处理 * 会议信息Service业务层处理
* *
...@@ -92,4 +105,105 @@ public class HyjyxxServiceImpl implements IHyjyxxService ...@@ -92,4 +105,105 @@ public class HyjyxxServiceImpl implements IHyjyxxService
{ {
return hyjyxxMapper.deleteHyjyxxById(id); return hyjyxxMapper.deleteHyjyxxById(id);
} }
// 1. 转录接口地址(固定)
private static final String ASR_API_URL = "/asr";
/**
* 修改会议信息
*
* @param id 会议信息
* @return 结果
*/
@Override
public int hyzl(Long id)
{
Hyjyxx hyjyxx =hyjyxxMapper.selectHyjyxxById(id);
String targetMp3Url = RuoYiConfig.getDzysip() + hyjyxx.getYpwj();
try {
// 1. 发送 POST 请求,获取原始 JSON 响应
String responseJson = sendAsrPostRequest(targetMp3Url);
System.out.println("接口返回原始 JSON:" + responseJson);
// 创建ObjectMapper实例
ObjectMapper objectMapper = new ObjectMapper();
// 将String转换为JsonNode(JSON对象)
JsonNode jsonNode = objectMapper.readTree(responseJson);
// 2. 直接提取 asr_text 和 timestamp_text 的值
String asrText = jsonNode.get("asr_text").asText();
String timestampText = jsonNode.get("json_result").toString();
hyjyxx.setYw(asrText);
hyjyxx.setYwBzh(timestampText);
hyjyxx.setJxzt("转录成功");
return hyjyxxMapper.updateHyjyxx(hyjyxx);
} catch (IOException e) {
System.err.println("请求异常:" + e.getMessage());
e.printStackTrace();
hyjyxx.setJxzt("转录失败");
hyjyxxMapper.updateHyjyxx(hyjyxx);
return 0;
}
}
/**
* 发送 POST 请求到 ASR 接口
* @param mp3Url 音频文件 URL(对应请求参数 mp3_url)
* @return 接口返回结果(Map 格式:key=asr_text/timestamp_text,value=对应文本)
* @throws IOException 网络异常/请求失败
*/
public static String sendAsrPostRequest(String mp3Url) throws IOException {
// 1. 构建请求 JSON 字符串(无实体类,直接拼接)
String requestJson = String.format("{\"mp3_url\":\"%s\"}", mp3Url);
// 2. 创建 URL 对象并打开连接
URL url = new URL(RuoYiConfig.getYpzlip()+ASR_API_URL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
try {
// 3. 配置请求参数(POST 方法、请求头、超时时间)
connection.setRequestMethod("POST"); // 必须设为 POST
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); // 声明 JSON 格式
connection.setDoOutput(true); // 允许向服务器写数据(POST 必须开启)
connection.setConnectTimeout(5000); // 连接超时:5秒
connection.setReadTimeout(500000); // 读取响应超时:10秒
// 4. 向服务器写入请求体(JSON 字符串)
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
byte[] requestBytes = requestJson.getBytes(StandardCharsets.UTF_8);
outputStream.write(requestBytes); // 写入请求数据
outputStream.flush(); // 刷新缓冲区,确保数据全部发送
}
// 5. 检查请求是否成功(HTTP 状态码 200-299 为成功)
int responseCode = connection.getResponseCode();
if (responseCode < 200 || responseCode >= 300) {
throw new IOException("请求失败!HTTP 状态码:" + responseCode
+ ",响应信息:" + connection.getResponseMessage());
}
// 6. 读取接口返回的 JSON 响应
StringBuilder responseSb = new StringBuilder();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
responseSb.append(line); // 逐行读取响应内容
}
}
String responseJson = responseSb.toString();
// 7. 将 JSON 转为 Map(无实体类,直接通过 key 取值)
return responseJson;
} finally {
// 8. 关闭连接(避免资源泄漏)
connection.disconnect();
}
}
} }
...@@ -12,6 +12,12 @@ ruoyi: ...@@ -12,6 +12,12 @@ ruoyi:
addressEnabled: false addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证 # 验证码类型 math 数字计算 char 字符验证
captchaType: math captchaType: math
# 本机ip+端口
dzysip: http://192.168.31.12:8999
# 转录ip+端口
ypzlip: http://192.168.31.200:17751
# 纪要ip
hyjyip: http://192.168.31.200:17751
# 开发环境配置 # 开发环境配置
server: server:
...@@ -57,9 +63,9 @@ spring: ...@@ -57,9 +63,9 @@ spring:
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 10MB max-file-size: 100MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 20000MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.ys.mapper.HyjyxxMapper"> <mapper namespace="com.ruoyi.project.ys.mapper.HyjyxxMapper">
<resultMap type="Hyjyxx" id="HyjyxxResult"> <resultMap type="Hyjyxx" id="HyjyxxResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="xmid" column="xmid" /> <result property="xmid" column="xmid" />
...@@ -20,15 +20,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -20,15 +20,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="ext1" column="ext1" /> <result property="ext1" column="ext1" />
<result property="ext2" column="ext2" /> <result property="ext2" column="ext2" />
<result property="ext3" column="ext3" /> <result property="ext3" column="ext3" />
<result property="ywBzh" column="yw_bzh" />
<result property="hyjyBzh" column="hyjy_bzh" />
<result property="ypwjName" column="ypwj_name" />
<result property="mbmc" column="mbmc" />
<result property="jysczt" column="jysczt" />
</resultMap> </resultMap>
<sql id="selectHyjyxxVo"> <sql id="selectHyjyxxVo">
select id, xmid, hymc, jxzt, ypwj, yw, hyjy, jxwcsj, created_by, created_time, update_by, update_time, ext1, ext2, ext3 from hyjyxx select id, xmid, hymc, jxzt, ypwj, yw, hyjy, jxwcsj, created_by, created_time, update_by, update_time, ext1, ext2, ext3, yw_bzh, hyjy_bzh, ypwj_name, mbmc, jysczt from hyjyxx
</sql> </sql>
<select id="selectHyjyxxList" parameterType="Hyjyxx" resultMap="HyjyxxResult"> <select id="selectHyjyxxList" parameterType="Hyjyxx" resultMap="HyjyxxResult">
<include refid="selectHyjyxxVo"/> <include refid="selectHyjyxxVo"/>
<where> <where>
<if test="id != null "> and id = #{id}</if> <if test="id != null "> and id = #{id}</if>
<if test="xmid != null "> and xmid = #{xmid}</if> <if test="xmid != null "> and xmid = #{xmid}</if>
<if test="hymc != null and hymc != ''"> and hymc = #{hymc}</if> <if test="hymc != null and hymc != ''"> and hymc = #{hymc}</if>
...@@ -42,9 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -42,9 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ext1 != null and ext1 != ''"> and ext1 = #{ext1}</if> <if test="ext1 != null and ext1 != ''"> and ext1 = #{ext1}</if>
<if test="ext2 != null and ext2 != ''"> and ext2 = #{ext2}</if> <if test="ext2 != null and ext2 != ''"> and ext2 = #{ext2}</if>
<if test="ext3 != null and ext3 != ''"> and ext3 = #{ext3}</if> <if test="ext3 != null and ext3 != ''"> and ext3 = #{ext3}</if>
<if test="ywBzh != null and ywBzh != ''"> and yw_bzh = #{ywBzh}</if>
<if test="hyjyBzh != null and hyjyBzh != ''"> and hyjy_bzh = #{hyjyBzh}</if>
<if test="ypwjName != null and ypwjName != ''"> and ypwj_name like concat('%', #{ypwjName}, '%')</if>
<if test="mbmc != null and mbmc != ''"> and mbmc = #{mbmc}</if>
<if test="jysczt != null and jysczt != ''"> and jysczt = #{jysczt}</if>
</where> </where>
</select> </select>
<select id="selectHyjyxxById" parameterType="Long" resultMap="HyjyxxResult"> <select id="selectHyjyxxById" parameterType="Long" resultMap="HyjyxxResult">
<include refid="selectHyjyxxVo"/> <include refid="selectHyjyxxVo"/>
where id = #{id} where id = #{id}
...@@ -67,7 +77,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -67,7 +77,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ext1 != null">ext1,</if> <if test="ext1 != null">ext1,</if>
<if test="ext2 != null">ext2,</if> <if test="ext2 != null">ext2,</if>
<if test="ext3 != null">ext3,</if> <if test="ext3 != null">ext3,</if>
</trim> <if test="ywBzh != null">yw_bzh,</if>
<if test="hyjyBzh != null">hyjy_bzh,</if>
<if test="ypwjName != null">ypwj_name,</if>
<if test="mbmc != null">mbmc,</if>
<if test="jysczt != null">jysczt,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="xmid != null">#{xmid},</if> <if test="xmid != null">#{xmid},</if>
<if test="hymc != null">#{hymc},</if> <if test="hymc != null">#{hymc},</if>
...@@ -83,7 +98,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -83,7 +98,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ext1 != null">#{ext1},</if> <if test="ext1 != null">#{ext1},</if>
<if test="ext2 != null">#{ext2},</if> <if test="ext2 != null">#{ext2},</if>
<if test="ext3 != null">#{ext3},</if> <if test="ext3 != null">#{ext3},</if>
</trim> <if test="ywBzh != null">#{ywBzh},</if>
<if test="hyjyBzh != null">#{hyjyBzh},</if>
<if test="ypwjName != null">#{ypwjName},</if>
<if test="mbmc != null">#{mbmc},</if>
<if test="jysczt != null">#{jysczt},</if>
</trim>
</insert> </insert>
<update id="updateHyjyxx" parameterType="Hyjyxx"> <update id="updateHyjyxx" parameterType="Hyjyxx">
...@@ -103,6 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -103,6 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ext1 != null">ext1 = #{ext1},</if> <if test="ext1 != null">ext1 = #{ext1},</if>
<if test="ext2 != null">ext2 = #{ext2},</if> <if test="ext2 != null">ext2 = #{ext2},</if>
<if test="ext3 != null">ext3 = #{ext3},</if> <if test="ext3 != null">ext3 = #{ext3},</if>
<if test="ywBzh != null">yw_bzh = #{ywBzh},</if>
<if test="hyjyBzh != null">hyjy_bzh = #{hyjyBzh},</if>
<if test="ypwjName != null">ypwj_name = #{ypwjName},</if>
<if test="mbmc != null">mbmc = #{mbmc},</if>
<if test="jysczt != null">jysczt = #{jysczt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
...@@ -112,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -112,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteHyjyxxByIds" parameterType="String"> <delete id="deleteHyjyxxByIds" parameterType="String">
delete from hyjyxx where id in delete from hyjyxx where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
......
...@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ext2 != null and ext2 != ''"> and ext2 = #{ext2}</if> <if test="ext2 != null and ext2 != ''"> and ext2 = #{ext2}</if>
<if test="ext3 != null and ext3 != ''"> and ext3 = #{ext3}</if> <if test="ext3 != null and ext3 != ''"> and ext3 = #{ext3}</if>
</where> </where>
order by px
</select> </select>
<select id="selectHyjyxxMbById" parameterType="Long" resultMap="HyjyxxMbResult"> <select id="selectHyjyxxMbById" parameterType="Long" resultMap="HyjyxxMbResult">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment