15 changed files with 227 additions and 31 deletions
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.biutag.supervision.pojo.entity.SupRiskPersonalControlRecord; |
||||||
|
|
||||||
|
public interface SupRiskPersonalControlRecordMapper extends BaseMapper<SupRiskPersonalControlRecord> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.biutag.supervision.pojo.entity.SupRiskPersonal; |
||||||
|
|
||||||
|
public interface SupRiskPersonalMapper extends BaseMapper<SupRiskPersonal> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
package com.biutag.supervision.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class SupRiskPersonal { |
||||||
|
|
||||||
|
// 证件号码
|
||||||
|
@TableId(value = "id_code") |
||||||
|
private String idCode; |
||||||
|
|
||||||
|
// 姓名
|
||||||
|
@TableField("name") |
||||||
|
private String name; |
||||||
|
|
||||||
|
// 性别男1女2
|
||||||
|
@TableField("gender") |
||||||
|
private String gender; |
||||||
|
|
||||||
|
// 年龄
|
||||||
|
@TableField("age") |
||||||
|
private Integer age; |
||||||
|
|
||||||
|
// 手机号
|
||||||
|
@TableField("mobile") |
||||||
|
private String mobile; |
||||||
|
|
||||||
|
// 人员类别
|
||||||
|
@TableField("personal_type") |
||||||
|
private String personalType; |
||||||
|
|
||||||
|
// 管控级别
|
||||||
|
@TableField("control_level") |
||||||
|
private String controlLevel; |
||||||
|
|
||||||
|
// 责任单位id
|
||||||
|
@TableField("responsible_depart_id") |
||||||
|
private String responsibleDepartId; |
||||||
|
|
||||||
|
// 责任单位名称
|
||||||
|
@TableField("responsible_depart_name") |
||||||
|
private String responsibleDepartName; |
||||||
|
|
||||||
|
// 责任民警警号
|
||||||
|
@TableField("responsible_emp_no") |
||||||
|
private String responsibleEmpNo; |
||||||
|
|
||||||
|
// 责任民警姓名
|
||||||
|
@TableField("responsible_name") |
||||||
|
private String responsibleName; |
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
@TableField("create_time") |
||||||
|
private LocalDateTime createTime; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
package com.biutag.supervision.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class SupRiskPersonalControlRecord { |
||||||
|
|
||||||
|
// 主键
|
||||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||||
|
private Integer id; |
||||||
|
|
||||||
|
// 姓名
|
||||||
|
@TableField("name") |
||||||
|
private String name; |
||||||
|
|
||||||
|
// 证件号码
|
||||||
|
@TableField("id_code") |
||||||
|
private String idCode; |
||||||
|
|
||||||
|
// 包保督察人员警号
|
||||||
|
@TableField("control_emp_no") |
||||||
|
private String controlEmpNo; |
||||||
|
|
||||||
|
// 包保督察人员姓名
|
||||||
|
@TableField("control_name") |
||||||
|
private String controlName; |
||||||
|
|
||||||
|
// 管控间隔
|
||||||
|
@TableField("control_time_interval") |
||||||
|
private String controlTimeInterval; |
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
@TableField("create_time") |
||||||
|
private LocalDateTime createTime; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.biutag.supervision.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.biutag.supervision.pojo.entity.SupRiskPersonalControlRecord; |
||||||
|
import com.biutag.supervision.mapper.SupRiskPersonalControlRecordMapper; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class SupRiskPersonalControlRecordService extends ServiceImpl<SupRiskPersonalControlRecordMapper, SupRiskPersonalControlRecord> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.biutag.supervision.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.biutag.supervision.pojo.entity.SupRiskPersonal; |
||||||
|
import com.biutag.supervision.mapper.SupRiskPersonalMapper; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, SupRiskPersonal> { |
||||||
|
|
||||||
|
} |
||||||
@ -1,23 +0,0 @@ |
|||||||
package com.biutag.supervision.util; |
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil; |
|
||||||
import cn.hutool.core.util.StrUtil; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author wxc |
|
||||||
* @date 2025/3/27 |
|
||||||
*/ |
|
||||||
public class ImgUtil { |
|
||||||
|
|
||||||
public final static List<String> IMG_TYPES = List.of("jpg", "jpeg", "png", "gif", "ico", "svg", "webp"); |
|
||||||
|
|
||||||
public static boolean isImg(String fileName) { |
|
||||||
if (StrUtil.isBlank(fileName)) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
return IMG_TYPES.contains(FileUtil.extName(fileName).toLowerCase()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -0,0 +1,45 @@ |
|||||||
|
package com.biutag.supervision.util; |
||||||
|
|
||||||
|
import cn.hutool.core.img.ImgUtil; |
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import cn.hutool.core.util.NumberUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
import java.awt.image.BufferedImage; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/3/27 |
||||||
|
*/ |
||||||
|
public class ImgUtils { |
||||||
|
|
||||||
|
public final static List<String> IMG_TYPES = List.of("jpg", "jpeg", "png", "gif", "ico", "svg", "webp"); |
||||||
|
|
||||||
|
public static boolean isImg(String fileName) { |
||||||
|
if (StrUtil.isBlank(fileName)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return IMG_TYPES.contains(FileUtil.extName(fileName).toLowerCase()); |
||||||
|
} |
||||||
|
|
||||||
|
public static String createSquareThumbnailBase64(InputStream is, int j) { |
||||||
|
BufferedImage bufferedImage = ImgUtil.read(is); |
||||||
|
int h = Math.min(bufferedImage.getHeight(), bufferedImage.getWidth()); |
||||||
|
int x = 0; |
||||||
|
int y = 0; |
||||||
|
if (bufferedImage.getHeight() >= bufferedImage.getWidth()) { |
||||||
|
y = (bufferedImage.getHeight() - bufferedImage.getWidth()) / 2; |
||||||
|
} else { |
||||||
|
x = (bufferedImage.getWidth() - bufferedImage.getHeight()) / 2; |
||||||
|
} |
||||||
|
// 裁剪
|
||||||
|
Image cutImg = cn.hutool.core.img.ImgUtil.cut(bufferedImage, new Rectangle(x, y, h, h)); |
||||||
|
// 缩放
|
||||||
|
Image scaleImg = cn.hutool.core.img.ImgUtil.scale(cutImg, (float) NumberUtil.div(j, h)); |
||||||
|
return ImgUtil.toBase64(scaleImg, "jpg"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.biutag.supervision; |
||||||
|
|
||||||
|
import com.biutag.supervision.util.ImgUtils; |
||||||
|
import org.junit.jupiter.api.Test; |
||||||
|
|
||||||
|
import java.io.FileInputStream; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/7/3 |
||||||
|
*/ |
||||||
|
public class PhotoTests { |
||||||
|
|
||||||
|
|
||||||
|
@Test |
||||||
|
public void testThumbnail() throws IOException { |
||||||
|
//createSquareThumbnail(new FileInputStream("C:\\Users\\ldj\\Desktop\\文件类型\\3.jpg"), "D:\\deploy\\1.png", 100, true);
|
||||||
|
FileInputStream is = new FileInputStream("C:\\Users\\ldj\\Desktop\\文件类型\\3.jpg"); |
||||||
|
String base64 = ImgUtils.createSquareThumbnailBase64(is, 100); |
||||||
|
System.out.println(base64); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue