Commit 6ae78efc by jiang'yun

修改

parent 894c397f
package com.ruoyi.framework.util;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
public class ImageCompressor {
// 压缩Base64图片
public static String compressBase64Image(String base64Image, float quality, int maxWidth, int maxHeight) {
try {
// 去除Base64前缀
String base64Data = base64Image.replaceAll("data:image/.*?;base64,", "");
// 解码Base64为字节数组
byte[] imageBytes = Base64.getDecoder().decode(base64Data);
// 读取图片
BufferedImage originalImage = ImageIO.read(new ByteArrayInputStream(imageBytes));
// 计算压缩后的尺寸
int[] newDimensions = calculateDimensions(originalImage.getWidth(), originalImage.getHeight(), maxWidth, maxHeight);
int newWidth = newDimensions[0];
int newHeight = newDimensions[1];
// 创建压缩后的图片
BufferedImage resizedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
g.dispose();
// 压缩图片质量
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ImageIO.write(resizedImage, "jpg", outputStream);
// 编码为Base64并添加前缀
String compressedBase64 = Base64.getEncoder().encodeToString(outputStream.toByteArray());
return "data:image/jpeg;base64," + compressedBase64;
} catch (IOException e) {
// 处理异常,无法压缩时返回原图
return base64Image;
}
}
// 计算压缩后的尺寸,保持比例
private static int[] calculateDimensions(int originalWidth, int originalHeight, int maxWidth, int maxHeight) {
if (originalWidth <= maxWidth && originalHeight <= maxHeight) {
return new int[]{originalWidth, originalHeight};
}
double widthRatio = (double) maxWidth / originalWidth;
double heightRatio = (double) maxHeight / originalHeight;
double ratio = Math.min(widthRatio, heightRatio);
return new int[]{
(int) (originalWidth * ratio),
(int) (originalHeight * ratio)
};
}
}
package com.ruoyi.framework.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RichTextProcessor {
// 匹配img标签的正则表达式
private static final Pattern IMG_TAG_PATTERN = Pattern.compile("<img[^>]+src\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>");
// 处理富文本,压缩其中的图片
public static String processRichText(String richText, float quality, int maxWidth, int maxHeight) {
if (richText == null || richText.isEmpty()) {
return richText;
}
Matcher matcher = IMG_TAG_PATTERN.matcher(richText);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String imgTag = matcher.group(0);
String src = matcher.group(1);
// 只处理Base64图片
if (src.startsWith("data:image/")) {
String compressedSrc = ImageCompressor.compressBase64Image(src, quality, maxWidth, maxHeight);
String compressedImgTag = imgTag.replace(src, compressedSrc);
matcher.appendReplacement(sb, compressedImgTag);
}
}
matcher.appendTail(sb);
return sb.toString();
}
}
......@@ -41,7 +41,7 @@ public class SjDcfxDzfcController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SjDcfxDzfc sjDcfxDzfc)
{
startPage();
// startPage();
List<SjDcfxDzfc> list = sjDcfxDzfcService.selectSjDcfxDzfcList(sjDcfxDzfc);
return getDataTable(list);
}
......
......@@ -80,6 +80,12 @@ public class SjLjjwController extends BaseController
return toAjax(sjLjjwService.insertSjLjjw(sjLjjw));
}
@PostMapping("/pladd")
public AjaxResult pladd(@RequestBody List<SjLjjw> list)
{
return toAjax(sjLjjwService.insertSjLjjwBatch(list));
}
/**
* 修改设计-邻井井位
*/
......@@ -101,4 +107,15 @@ public class SjLjjwController extends BaseController
{
return toAjax(sjLjjwService.deleteSjLjjwByIds(ids));
}
@PostMapping("/addAll")
public AjaxResult addAll(@RequestBody List<SjLjjw> list)
{
if(list.size()==0){
return AjaxResult.error();
}
sjLjjwService.deleteSjLjjwByJh(list.get(0).getJh());
return toAjax(sjLjjwService.insertSjLjjwBatch(list));
}
}
......@@ -58,4 +58,9 @@ public interface ISjLjjwService
* @return 结果
*/
public int deleteSjLjjwById(Long id);
int insertSjLjjwBatch(List<SjLjjw> list);
int deleteSjLjjwByJh(String jh);
}
package com.ruoyi.project.zjsgfa.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.codec.Base64;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.util.RichTextProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.zjsgfa.mapper.JcxxHseMapper;
......@@ -32,7 +34,18 @@ public class JcxxHseServiceImpl implements IJcxxHseService
@Override
public JcxxHse selectJcxxHseById(Long id)
{
return jcxxHseMapper.selectJcxxHseById(id);
JcxxHse jcxxHse = jcxxHseMapper.selectJcxxHseById(id);
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
jcxxHse.getHse(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
jcxxHse.setHse(compressedContent);
return jcxxHse;
}
/**
......@@ -44,7 +57,22 @@ public class JcxxHseServiceImpl implements IJcxxHseService
@Override
public List<JcxxHse> selectJcxxHseList(JcxxHse jcxxHse)
{
return jcxxHseMapper.selectJcxxHseList(jcxxHse);
List<JcxxHse> list = jcxxHseMapper.selectJcxxHseList(jcxxHse);
list.stream().map(entity -> {
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
entity.getHse(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setHse(compressedContent);
return entity;
}).collect(Collectors.toList());
return list;
}
/**
......
package com.ruoyi.project.zjsgfa.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.codec.Base64;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.util.RichTextProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.zjsgfa.mapper.JcxxJkzpMapper;
......@@ -32,7 +34,51 @@ public class JcxxJkzpServiceImpl implements IJcxxJkzpService
@Override
public JcxxJkzp selectJcxxJkzpById(Long id)
{
return jcxxJkzpMapper.selectJcxxJkzpById(id);
JcxxJkzp jcxxJkzp = jcxxJkzpMapper.selectJcxxJkzpById(id);
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
jcxxJkzp.getZjkzz(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
jcxxJkzp.setZjkzz(compressedContent);
String clcb = RichTextProcessor.processRichText(
jcxxJkzp.getClcb(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
jcxxJkzp.setClcb(clcb);
String jlgh = RichTextProcessor.processRichText(
jcxxJkzp.getJlgh(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
jcxxJkzp.setJlgh(jlgh);
String syyq = RichTextProcessor.processRichText(
jcxxJkzp.getSyyq(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
jcxxJkzp.setSyyq(syyq);
return jcxxJkzp;
}
/**
......@@ -44,7 +90,54 @@ public class JcxxJkzpServiceImpl implements IJcxxJkzpService
@Override
public List<JcxxJkzp> selectJcxxJkzpList(JcxxJkzp jcxxJkzp)
{
return jcxxJkzpMapper.selectJcxxJkzpList(jcxxJkzp);
List<JcxxJkzp> list = jcxxJkzpMapper.selectJcxxJkzpList(jcxxJkzp);
list.stream().map(entity -> {
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
entity.getZjkzz(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setZjkzz(compressedContent);
String clcb = RichTextProcessor.processRichText(
entity.getClcb(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setClcb(clcb);
String jlgh = RichTextProcessor.processRichText(
entity.getJlgh(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setJlgh(jlgh);
String syyq = RichTextProcessor.processRichText(
entity.getSyyq(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setSyyq(syyq);
return entity;
}).collect(Collectors.toList());
return list;
}
/**
......
......@@ -137,20 +137,20 @@ public class SjDjjcServiceImpl implements ISjDjjcService
param.setJh(null);
//保存邻井
List<Ljjw> ljjwList = djdcService.getLjjwList(param);
List<SjLjjw> sjLjjwList=new ArrayList<>();
ljjwList.forEach(item->{
SjLjjw sjLjjw=new SjLjjw();
BeanUtils.copyProperties(item,sjLjjw);
sjLjjw.setJh(jh);
sjLjjw.setLjjh(item.getJh());
sjLjjwList.add(sjLjjw);
});
if(sjLjjwList.size()>0){
sjLjjwMapper.deleteSjLjjwByJh(jh);
sjLjjwMapper.insertSjLjjwBatch(sjLjjwList);
}
// List<Ljjw> ljjwList = djdcService.getLjjwList(param);
// List<SjLjjw> sjLjjwList=new ArrayList<>();
// ljjwList.forEach(item->{
// SjLjjw sjLjjw=new SjLjjw();
// BeanUtils.copyProperties(item,sjLjjw);
// sjLjjw.setJh(jh);
// sjLjjw.setLjjh(item.getJh());
// sjLjjwList.add(sjLjjw);
// });
// if(sjLjjwList.size()>0){
// sjLjjwMapper.deleteSjLjjwByJh(jh);
// sjLjjwMapper.insertSjLjjwBatch(sjLjjwList);
//
// }
param.setJkhzb(null);
param.setJkzzb(null);
param.setJdhzb(null);
......
package com.ruoyi.project.zjsgfa.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.codec.Base64;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.util.RichTextProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.zjsgfa.mapper.SjHseMapper;
......@@ -32,7 +34,18 @@ public class SjHseServiceImpl implements ISjHseService
@Override
public SjHse selectSjHseById(Long id)
{
return sjHseMapper.selectSjHseById(id);
SjHse sjHse = sjHseMapper.selectSjHseById(id);
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
sjHse.getHse(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
sjHse.setHse(compressedContent);
return sjHse;
}
/**
......@@ -44,7 +57,21 @@ public class SjHseServiceImpl implements ISjHseService
@Override
public List<SjHse> selectSjHseList(SjHse sjHse)
{
return sjHseMapper.selectSjHseList(sjHse);
List<SjHse> list = sjHseMapper.selectSjHseList(sjHse);
list.stream().map(entity -> {
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
entity.getHse(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setHse(compressedContent);
return entity;
}).collect(Collectors.toList());
return list;
}
/**
......
package com.ruoyi.project.zjsgfa.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.codec.Base64;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.util.RichTextProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.zjsgfa.mapper.SjJkzpMapper;
......@@ -32,7 +34,50 @@ public class SjJkzpServiceImpl implements ISjJkzpService
@Override
public SjJkzp selectSjJkzpById(Long id)
{
return sjJkzpMapper.selectSjJkzpById(id);
SjJkzp sjJkzp = sjJkzpMapper.selectSjJkzpById(id);
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
sjJkzp.getZjkzz(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
sjJkzp.setZjkzz(compressedContent);
String clcb = RichTextProcessor.processRichText(
sjJkzp.getClcb(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
sjJkzp.setClcb(clcb);
String jlgh = RichTextProcessor.processRichText(
sjJkzp.getJlgh(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
sjJkzp.setJlgh(jlgh);
String syyq = RichTextProcessor.processRichText(
sjJkzp.getSyyq(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
sjJkzp.setSyyq(syyq);
return sjJkzp;
}
/**
......@@ -44,7 +89,53 @@ public class SjJkzpServiceImpl implements ISjJkzpService
@Override
public List<SjJkzp> selectSjJkzpList(SjJkzp sjJkzp)
{
return sjJkzpMapper.selectSjJkzpList(sjJkzp);
List<SjJkzp> list = sjJkzpMapper.selectSjJkzpList(sjJkzp);
list.stream().map(entity -> {
// 压缩富文本中的图片,设置质量和最大尺寸
String compressedContent = RichTextProcessor.processRichText(
entity.getZjkzz(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setZjkzz(compressedContent);
String clcb = RichTextProcessor.processRichText(
entity.getClcb(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setClcb(clcb);
String jlgh = RichTextProcessor.processRichText(
entity.getJlgh(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setJlgh(jlgh);
String syyq = RichTextProcessor.processRichText(
entity.getSyyq(), // 你的富文本字段
0.7f, // 质量 0.0-1.0
800, // 最大宽度
600 // 最大高度
);
// 设置压缩后的富文本
entity.setSyyq(syyq);
return entity;
}).collect(Collectors.toList());
return list;
}
/**
......
......@@ -90,4 +90,14 @@ public class SjLjjwServiceImpl implements ISjLjjwService
{
return sjLjjwMapper.deleteSjLjjwById(id);
}
@Override
public int insertSjLjjwBatch(List<SjLjjw> list) {
return sjLjjwMapper.insertSjLjjwBatch(list);
}
@Override
public int deleteSjLjjwByJh(String jh) {
return sjLjjwMapper.deleteSjLjjwByJh(jh);
}
}
......@@ -239,10 +239,13 @@ public class DjdcController {
return AjaxResult.success( djdcService.getZtzhzzdfList(param),map);
case "getDzfcList":
//获取地质分成
return AjaxResult.success( djdcService.getDzfcList(param),map);
return AjaxResult.success( djdcService.getDzfcList2(param),map);
case "getFdcsList":
//获取分段方案参数
return AjaxResult.success( djdcService.getFdcsList(param));
case "getKjsjList":
//获取
return AjaxResult.success( djdcService.getKjsjList(param));
default:
return AjaxResult.success();
}
......@@ -308,6 +311,12 @@ public class DjdcController {
List<Jsha> fdcsList = djdcService.getFdcsList(param);
exportFdcs(response,fdcsList);
break;
case "exportKsjList":
//导出实钻分析结果
List<DjZqsjfx> kjsjList = djdcService.getKjsjList(param);
ExcelUtil<DjZqsjfx> kssjEx = new ExcelUtil<DjZqsjfx>(DjZqsjfx.class);
kssjEx.exportExcel(response, kjsjList, "Sheet1");
break;
default:
break;
}
......
package com.ruoyi.project.zt.domain;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import lombok.Data;
/**
......@@ -9,12 +10,16 @@ import lombok.Data;
public class DjZqsjfx {
//井号
@Excel(name = "井号")
private String jh;
//开钻时间
@Excel(name = "一开开钻时间")
private String kssj;
//结束时间
private String jssj;
private String zwsj;
@Excel(name = "日志开钻时间")
private String wasj;
/**
* 井筒名
*/
......
package com.ruoyi.project.zt.domain;
import lombok.Data;
import java.time.LocalTime;
@Data
public class TimePointPair {
private LocalTime previousTime;
private LocalTime previousTime2;
private LocalTime drillingTime;
public TimePointPair(LocalTime previousTime, LocalTime drillingTime) {
this.previousTime = previousTime;
this.drillingTime = drillingTime;
}
public TimePointPair(LocalTime previousTime, LocalTime drillingTime,LocalTime previousTime2) {
this.previousTime = previousTime;
this.drillingTime = drillingTime;
this.previousTime2 = previousTime2;
}
public LocalTime getPreviousTime() {
return previousTime;
......@@ -24,6 +33,13 @@ public class TimePointPair {
return drillingTime.isBefore(previousTime);
}
public boolean isCrossDay2() {
if(previousTime2==null){
return false;
}
return previousTime.isBefore(previousTime2);
}
@Override
public String toString() {
return previousTime + " - " + drillingTime;
......
......@@ -39,4 +39,7 @@ public interface DjdcInfoMapper {
List<Jsha> getFdcsList(CommonParam param);
List<DjZqsjfx> getZqshfxList2(CommonParam param);
}
......@@ -3,6 +3,7 @@ package com.ruoyi.project.zt.mapper;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.zt.domain.Jsaa;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -12,6 +13,7 @@ import java.util.List;
* @author ruoyi
* @date 2025-07-10
*/
@Mapper
@DataSource(value = DataSourceType.SLAVE)
public interface JsaaMapper
{
......
......@@ -52,4 +52,5 @@ public interface DjdcService {
List<SjDcfxDzfc> getDzfcList2(CommonParam param);
List<DjZqsjfx> getKjsjList(CommonParam param);
}
......@@ -41,6 +41,7 @@ public class JsaaServiceImpl implements IJsaaService
* @return 基础数据
*/
@Override
@DataSource(value = DataSourceType.SLAVE)
public List<Jsaa> selectJsaaList(Jsaa jsaa)
{
return jsaaMapper.selectJsaaList(jsaa);
......@@ -72,7 +73,6 @@ public class JsaaServiceImpl implements IJsaaService
/**
* 批量删除基础数据
*
* @param jhs 需要删除的基础数据主键
* @return 结果
*/
......
......@@ -586,4 +586,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by kc asc
</select>
<select id="getZqshfxList2" resultType="com.ruoyi.project.zt.domain.DjZqsjfx">
select a.jh,c.ksjs,c.JS,to_char(KZRQ1,'YYYY-MM-DD') || ' ' ||TO_CHAR(TO_DATE(KZSJ1, 'HH24MI'), 'HH24:MI') kssj,to_char(KZRQ2,'YYYY-MM-DD') || ' ' ||TO_CHAR(TO_DATE(KZSJ2, 'HH24MI'), 'HH24:MI') jssj from jsaa a
left join (
select * from (SELECT jh,
0 AS kc,
JS,
LAG(JS, 1, 0) OVER (PARTITION BY jh ORDER BY js) AS ksjs
FROM JSDB jsdb
where jsdb.tgcc like '%导管%'
UNION all
SELECT jh,
ROW_NUMBER() OVER (PARTITION BY jh ORDER BY js) AS kc,
JS,
LAG(JS, 1, 0) OVER (PARTITION BY jh ORDER BY js) AS ksjs
FROM JSDB jsdb
where jsdb.tgcc not like '%导管%'
order by jh)) c on a.jh=c.jh where kc='1'
<if test="jh!=null and jh!=''">
and a. jh =#{jh}
</if>
order by JH
</select>
</mapper>
\ No newline at end of file
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