用户登录问题修改
This commit is contained in:
parent
68182251d4
commit
e163d7fa66
|
|
@ -1,58 +1,136 @@
|
||||||
package com.bonus.system.api.domain;
|
package com.bonus.system.api.domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
import java.util.List;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import java.util.ArrayList;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import java.util.List;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表 sys_dept
|
* 部门表 sys_dept
|
||||||
*
|
*
|
||||||
* @author bonus
|
* @author bonus
|
||||||
*/
|
*/
|
||||||
public class SysDept extends BaseEntity
|
public class SysDept extends BaseEntity {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 部门ID */
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 父部门ID */
|
/**
|
||||||
|
* 父部门ID
|
||||||
|
*/
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/** 祖级列表 */
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
private String ancestors;
|
private String ancestors;
|
||||||
|
|
||||||
/** 部门名称 */
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
/** 显示顺序 */
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
private Integer orderNum;
|
private Integer orderNum;
|
||||||
|
|
||||||
/** 负责人 */
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
private String leader;
|
private String leader;
|
||||||
|
|
||||||
/** 联系电话 */
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/** 邮箱 */
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/** 部门状态:0正常,1停用 */
|
/**
|
||||||
|
* 部门状态:0正常,1停用
|
||||||
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/** 父部门名称 */
|
/**
|
||||||
|
* 父部门名称
|
||||||
|
*/
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
/**
|
||||||
|
* 省
|
||||||
|
*/
|
||||||
|
private String province;
|
||||||
|
/**
|
||||||
|
* 市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
/**
|
||||||
|
* 县
|
||||||
|
*/
|
||||||
|
private String district;
|
||||||
|
|
||||||
/** 子部门 */
|
/**
|
||||||
|
* 详细地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
|
||||||
|
public void setCity(String city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDistrict() {
|
||||||
|
return district;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistrict(String district) {
|
||||||
|
this.district = district;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity() {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getProvince() {
|
||||||
|
return province;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvince(String province) {
|
||||||
|
this.province = province;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子部门
|
||||||
|
*/
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
@ -65,150 +143,126 @@ public class SysDept extends BaseEntity
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDeptId()
|
public Long getDeptId() {
|
||||||
{
|
|
||||||
return deptId;
|
return deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptId(Long deptId)
|
public void setDeptId(Long deptId) {
|
||||||
{
|
|
||||||
this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getParentId()
|
public Long getParentId() {
|
||||||
{
|
|
||||||
return parentId;
|
return parentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentId(Long parentId)
|
public void setParentId(Long parentId) {
|
||||||
{
|
|
||||||
this.parentId = parentId;
|
this.parentId = parentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAncestors()
|
public String getAncestors() {
|
||||||
{
|
|
||||||
return ancestors;
|
return ancestors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAncestors(String ancestors)
|
public void setAncestors(String ancestors) {
|
||||||
{
|
|
||||||
this.ancestors = ancestors;
|
this.ancestors = ancestors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotBlank(message = "部门名称不能为空")
|
@NotBlank(message = "部门名称不能为空")
|
||||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||||
public String getDeptName()
|
public String getDeptName() {
|
||||||
{
|
|
||||||
return deptName;
|
return deptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptName(String deptName)
|
public void setDeptName(String deptName) {
|
||||||
{
|
|
||||||
this.deptName = deptName;
|
this.deptName = deptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull(message = "显示顺序不能为空")
|
@NotNull(message = "显示顺序不能为空")
|
||||||
public Integer getOrderNum()
|
public Integer getOrderNum() {
|
||||||
{
|
|
||||||
return orderNum;
|
return orderNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrderNum(Integer orderNum)
|
public void setOrderNum(Integer orderNum) {
|
||||||
{
|
|
||||||
this.orderNum = orderNum;
|
this.orderNum = orderNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLeader()
|
public String getLeader() {
|
||||||
{
|
|
||||||
return leader;
|
return leader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeader(String leader)
|
public void setLeader(String leader) {
|
||||||
{
|
|
||||||
this.leader = leader;
|
this.leader = leader;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||||
public String getPhone()
|
public String getPhone() {
|
||||||
{
|
|
||||||
return phone;
|
return phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhone(String phone)
|
public void setPhone(String phone) {
|
||||||
{
|
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Email(message = "邮箱格式不正确")
|
@Email(message = "邮箱格式不正确")
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
public String getEmail()
|
public String getEmail() {
|
||||||
{
|
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmail(String email)
|
public void setEmail(String email) {
|
||||||
{
|
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus() {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String status)
|
public void setStatus(String status) {
|
||||||
{
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDelFlag()
|
public String getDelFlag() {
|
||||||
{
|
|
||||||
return delFlag;
|
return delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDelFlag(String delFlag)
|
public void setDelFlag(String delFlag) {
|
||||||
{
|
|
||||||
this.delFlag = delFlag;
|
this.delFlag = delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParentName()
|
public String getParentName() {
|
||||||
{
|
|
||||||
return parentName;
|
return parentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentName(String parentName)
|
public void setParentName(String parentName) {
|
||||||
{
|
|
||||||
this.parentName = parentName;
|
this.parentName = parentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SysDept> getChildren()
|
public List<SysDept> getChildren() {
|
||||||
{
|
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildren(List<SysDept> children)
|
public void setChildren(List<SysDept> children) {
|
||||||
{
|
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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("deptId", getDeptId())
|
.append("deptId", getDeptId())
|
||||||
.append("parentId", getParentId())
|
.append("parentId", getParentId())
|
||||||
.append("ancestors", getAncestors())
|
.append("ancestors", getAncestors())
|
||||||
.append("deptName", getDeptName())
|
.append("deptName", getDeptName())
|
||||||
.append("orderNum", getOrderNum())
|
.append("orderNum", getOrderNum())
|
||||||
.append("leader", getLeader())
|
.append("leader", getLeader())
|
||||||
.append("phone", getPhone())
|
.append("phone", getPhone())
|
||||||
.append("email", getEmail())
|
.append("email", getEmail())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("level", getLevel())
|
.append("level", getLevel())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,10 @@ public class ConfigController {
|
||||||
map.put("registersConfig", systemConfig.getRegistersConfig());
|
map.put("registersConfig", systemConfig.getRegistersConfig());
|
||||||
map.put("isAdmin", systemConfig.isAdmin());
|
map.put("isAdmin", systemConfig.isAdmin());
|
||||||
map.put("webSocketurl", systemConfig.getWebsocketurl());
|
map.put("webSocketurl", systemConfig.getWebsocketurl());
|
||||||
map.put("isAddRootCompany",systemConfig.isAddRootCompany());
|
map.put("isAddRootCompany", systemConfig.isAddRootCompany());
|
||||||
map.put("requestConfig",systemConfig.getRequestConfig());
|
map.put("requestConfig", systemConfig.getRequestConfig());
|
||||||
map.put("passwordConfig",systemConfig.getPasswordConfig());
|
map.put("passwordConfig", systemConfig.getPasswordConfig());
|
||||||
|
map.put("addAddress", systemConfig.isAddAddress());
|
||||||
return R.ok(map);
|
return R.ok(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.bonus.config;
|
package com.bonus.config;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -15,16 +14,21 @@ import java.util.List;
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "system-config")
|
@ConfigurationProperties(prefix = "system-config")
|
||||||
@Data
|
@Data
|
||||||
public class SystemConfig {
|
public class SystemConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录配置
|
* 登录配置
|
||||||
*/
|
*/
|
||||||
private LoginConfig loginConfig;
|
private LoginConfig loginConfig;
|
||||||
/**
|
/**
|
||||||
*增加配置以支持增加根节点公司的添加和删除功能
|
* 增加配置以支持增加根节点公司的添加和删除功能
|
||||||
*/
|
*/
|
||||||
private boolean addRootCompany;
|
private boolean addRootCompany;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司是否添加地址信息
|
||||||
|
*/
|
||||||
|
private boolean addAddress;
|
||||||
/**
|
/**
|
||||||
* token过期时间
|
* token过期时间
|
||||||
*/
|
*/
|
||||||
|
|
@ -109,9 +113,10 @@ public class SystemConfig {
|
||||||
*/
|
*/
|
||||||
private boolean encryptResponse;
|
private boolean encryptResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@RefreshScope
|
@RefreshScope
|
||||||
public static class PasswordConfig{
|
public static class PasswordConfig {
|
||||||
/**
|
/**
|
||||||
* 密码的最小长度
|
* 密码的最小长度
|
||||||
*/
|
*/
|
||||||
|
|
@ -161,7 +166,7 @@ public class SystemConfig {
|
||||||
*/
|
*/
|
||||||
private boolean forcePasswordChangeOnFirstLogin;
|
private boolean forcePasswordChangeOnFirstLogin;
|
||||||
/**
|
/**
|
||||||
*是否开启定期修改密码
|
* 是否开启定期修改密码
|
||||||
*/
|
*/
|
||||||
private boolean enableRegularlyChangePassword;
|
private boolean enableRegularlyChangePassword;
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,22 @@
|
||||||
package com.bonus.common.core.utils.file;
|
package com.bonus.common.core.utils.file;
|
||||||
|
|
||||||
import java.io.File;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import java.io.FileInputStream;
|
import org.apache.commons.io.IOUtils;
|
||||||
import java.io.FileNotFoundException;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import java.io.IOException;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.servlet.ServletOutputStream;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件处理工具类
|
* 文件处理工具类
|
||||||
|
|
@ -296,4 +292,28 @@ public class FileUtils {
|
||||||
IOUtils.copy(is, os);
|
IOUtils.copy(is, os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 MultipartFile 转换为带前缀的 Base64 编码
|
||||||
|
*
|
||||||
|
* @param file 上传的文件
|
||||||
|
* @return 带前缀的 Base64 编码的字符串
|
||||||
|
* @throws IOException 如果读取文件时出错
|
||||||
|
*/
|
||||||
|
public static String convertToBase64WithPrefix(MultipartFile file) throws IOException {
|
||||||
|
// 获取文件的字节数组
|
||||||
|
byte[] fileBytes = file.getBytes();
|
||||||
|
|
||||||
|
// 获取文件的内容类型 (MIME Type)
|
||||||
|
String contentType = file.getContentType();
|
||||||
|
|
||||||
|
// 根据文件的 MIME 类型生成前缀
|
||||||
|
String prefix = "data:" + contentType + ";base64,";
|
||||||
|
|
||||||
|
// 将文件字节数组转换为 Base64 字符串
|
||||||
|
String base64Encoded = Base64.getEncoder().encodeToString(fileBytes);
|
||||||
|
|
||||||
|
// 返回带前缀的 Base64 字符串
|
||||||
|
return prefix + base64Encoded;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.bonus.face.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bonus
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
//@ConditionalOnProperty(name = "storage.type", havingValue = "minio")
|
||||||
|
@ConfigurationProperties(prefix = "face")
|
||||||
|
@Data
|
||||||
|
public class FaceConfig {
|
||||||
|
/**
|
||||||
|
* 人脸识别网络路径
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.bonus.face.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.face.domain.FaceDataEntity;
|
||||||
|
import com.bonus.face.service.FaceDataService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/data")
|
||||||
|
public class FaceDataController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FaceDataService faceDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:data:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(FaceDataEntity faceData) {
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
List<FaceDataEntity> list = faceDataService.selectFaceDataList(faceData);
|
||||||
|
return getDataTable(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:data:query")
|
||||||
|
@GetMapping(value = "/{faceId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("faceId") Long faceId) {
|
||||||
|
return faceDataService.selectFaceDataByFaceId(faceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:data:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@SysLog(title = "", businessType = OperaType.INSERT, logType = 0, module = "", details = "导出列表")
|
||||||
|
public AjaxResult add(FaceDataEntity faceData) {
|
||||||
|
return faceDataService.insertFaceData(faceData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:data:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@SysLog(title = "", businessType = OperaType.UPDATE, logType = 0, module = "", details = "导出列表")
|
||||||
|
public AjaxResult edit(FaceDataEntity faceData) {
|
||||||
|
return faceDataService.updateFaceData(faceData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:data:remove")
|
||||||
|
@PostMapping("/delete/{faceIds}")
|
||||||
|
@SysLog(title = "", businessType = OperaType.DELETE, logType = 0, module = "", details = "导出列表")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] faceIds) {
|
||||||
|
return faceDataService.deleteFaceDataByFaceIds(faceIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.bonus.face.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.face.domain.FaceGroupsEntity;
|
||||||
|
import com.bonus.face.service.FaceGroupsService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/groups")
|
||||||
|
public class FaceGroupsController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private FaceGroupsService faceGroupsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:groups:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(FaceGroupsEntity faceGroups) {
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
List<FaceGroupsEntity> list = faceGroupsService.selectFaceGroupsList(faceGroups);
|
||||||
|
return getDataTable(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:groups:query")
|
||||||
|
@GetMapping(value = "/{groupId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("groupId") Long groupId) {
|
||||||
|
return faceGroupsService.selectFaceGroupsByGroupId(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:groups:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@SysLog(title = "", businessType = OperaType.INSERT, logType = 0, module = "", details = "导出列表")
|
||||||
|
public AjaxResult add(@RequestBody FaceGroupsEntity faceGroups) {
|
||||||
|
return faceGroupsService.insertFaceGroups(faceGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:groups:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@SysLog(title = "", businessType = OperaType.UPDATE, logType = 0, module = "", details = "导出列表")
|
||||||
|
public AjaxResult edit(@RequestBody FaceGroupsEntity faceGroups) {
|
||||||
|
return faceGroupsService.updateFaceGroups(faceGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("face:groups:remove")
|
||||||
|
@PostMapping("/delete/{groupIds}")
|
||||||
|
@SysLog(title = "", businessType = OperaType.DELETE, logType = 0, module = "", details = "导出列表")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] groupIds) {
|
||||||
|
return faceGroupsService.deleteFaceGroupsByGroupIds(groupIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.bonus.face.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象 face_data
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class FaceDataEntity extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* faceId
|
||||||
|
*/
|
||||||
|
private Long faceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组code
|
||||||
|
*/
|
||||||
|
@Size(max = 255, message = "groupCode的长度不能超过255个字符") // 长度最大255
|
||||||
|
private String groupCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "用户名称不能为空") // 用户名称不能为空
|
||||||
|
@Size(max = 100, message = "名称的长度不能超过100个字符") // 长度最大100
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户身份证号
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "身份证号不能为空") // 身份证号不能为空
|
||||||
|
@Size(min = 18, max = 18, message = "身份证号必须为18位") // 身份证号必须为18位
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他信息
|
||||||
|
*/
|
||||||
|
@Size(max = 1000, message = "其他信息的长度不能超过1000个字符") // 长度最大1000
|
||||||
|
private String otherInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人脸特征数据
|
||||||
|
*/
|
||||||
|
private String embedding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人图片数据
|
||||||
|
*/
|
||||||
|
private String imagePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人脸图片
|
||||||
|
*/
|
||||||
|
private MultipartFile file;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bonus.face.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象 face_groups
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class FaceGroupsEntity extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组ID
|
||||||
|
*/
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组唯一标识
|
||||||
|
*/
|
||||||
|
private String groupCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组备注
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createdAt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.bonus.face.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.bonus.face.domain.FaceDataEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper接口
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
public interface FaceDataMapper {
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param faceId 主键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public FaceDataEntity selectFaceDataByFaceId(Long faceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
public List<FaceDataEntity> selectFaceDataList(FaceDataEntity faceData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertFaceData(FaceDataEntity faceData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateFaceData(FaceDataEntity faceData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param faceIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteFaceDataByFaceIds(Long[] faceIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询每个分组内身份证唯一
|
||||||
|
*
|
||||||
|
* @param groupCode
|
||||||
|
* @param idCard
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int isGroupAndIdCardUnique(@Param("groupCode") String groupCode, @Param("idCard") String idCard, @Param("faceId") Long faceId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.bonus.face.mapper;
|
||||||
|
|
||||||
|
import com.bonus.face.domain.FaceGroupsEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Mapper接口
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface FaceGroupsMapper {
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param groupId 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public FaceGroupsEntity selectFaceGroupsByGroupId(Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param faceGroups 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<FaceGroupsEntity> selectFaceGroupsList(FaceGroupsEntity faceGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param faceGroups 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertFaceGroups(FaceGroupsEntity faceGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param faceGroups 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateFaceGroups(FaceGroupsEntity faceGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param groupIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteFaceGroupsByGroupIds(Long[] groupIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称唯一校验
|
||||||
|
*
|
||||||
|
* @param groupName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int isGroupNameUnique(@Param("groupName") String groupName, @Param("groupId") Long groupId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.bonus.face.service;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.face.domain.FaceDataEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service接口
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
public interface FaceDataService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param faceId 主键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public AjaxResult selectFaceDataByFaceId(Long faceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
public List<FaceDataEntity> selectFaceDataList(FaceDataEntity faceData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult insertFaceData(FaceDataEntity faceData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult updateFaceData(FaceDataEntity faceData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param faceIds 需要删除的主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult deleteFaceDataByFaceIds(Long[] faceIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.bonus.face.service;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.face.domain.FaceGroupsEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service接口
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
public interface FaceGroupsService {
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param groupId 主键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public AjaxResult selectFaceGroupsByGroupId(Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param faceGroups
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
public List<FaceGroupsEntity> selectFaceGroupsList(FaceGroupsEntity faceGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param faceGroups
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult insertFaceGroups(FaceGroupsEntity faceGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
|
* @param faceGroups
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult updateFaceGroups(FaceGroupsEntity faceGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param groupIds 需要删除的主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult deleteFaceGroupsByGroupIds(Long[] groupIds);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
package com.bonus.face.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.face.domain.FaceDataEntity;
|
||||||
|
import com.bonus.face.mapper.FaceDataMapper;
|
||||||
|
import com.bonus.face.service.FaceDataService;
|
||||||
|
import com.bonus.face.utils.FaceUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service业务层处理
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaceDataServiceImpl implements FaceDataService {
|
||||||
|
@Resource
|
||||||
|
private FaceDataMapper faceDataMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FaceUtils faceUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param faceId 主键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult selectFaceDataByFaceId(Long faceId) {
|
||||||
|
try {
|
||||||
|
FaceDataEntity faceData = faceDataMapper.selectFaceDataByFaceId(faceId);
|
||||||
|
if (ObjectUtils.isEmpty(faceData)) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.success(faceData);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FaceDataEntity> selectFaceDataList(FaceDataEntity faceData) {
|
||||||
|
return faceDataMapper.selectFaceDataList(faceData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult insertFaceData(FaceDataEntity faceData) {
|
||||||
|
try { // 文件类型验证
|
||||||
|
int groupAndIdCardUnique = faceDataMapper.isGroupAndIdCardUnique(faceData.getGroupCode(), faceData.getIdCard(), faceData.getFaceId());
|
||||||
|
if (groupAndIdCardUnique > 0) {
|
||||||
|
return AjaxResult.error("身份证信息已存在");
|
||||||
|
}
|
||||||
|
if (faceData.getFile() == null || faceData.getFile().isEmpty()) {
|
||||||
|
return AjaxResult.error("请选择图片");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验文件类型
|
||||||
|
if (!faceData.getFile().getContentType().startsWith("image/")) {
|
||||||
|
return AjaxResult.error("只能上传图片文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验文件大小
|
||||||
|
if (faceData.getFile().getSize() > 5 * 1024 * 1024) {
|
||||||
|
return AjaxResult.error("文件大小不能超过 5MB");
|
||||||
|
}
|
||||||
|
|
||||||
|
return faceUtils.addFace(faceData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
|
* @param faceData
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult updateFaceData(FaceDataEntity faceData) {
|
||||||
|
try {
|
||||||
|
int groupAndIdCardUnique = faceDataMapper.isGroupAndIdCardUnique(faceData.getGroupCode(), faceData.getIdCard(), faceData.getFaceId());
|
||||||
|
if (groupAndIdCardUnique > 0) {
|
||||||
|
return AjaxResult.error("身份证信息已存在");
|
||||||
|
}
|
||||||
|
int rows = faceDataMapper.updateFaceData(faceData);
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param faceIds 需要删除的主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult deleteFaceDataByFaceIds(Long[] faceIds) {
|
||||||
|
try {
|
||||||
|
int rows = faceDataMapper.deleteFaceDataByFaceIds(faceIds);
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
package com.bonus.face.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.face.domain.FaceGroupsEntity;
|
||||||
|
import com.bonus.face.mapper.FaceGroupsMapper;
|
||||||
|
import com.bonus.face.service.FaceGroupsService;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service业务层处理
|
||||||
|
*
|
||||||
|
* @author bonus
|
||||||
|
* @date 2024-12-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaceGroupsServiceImpl implements FaceGroupsService {
|
||||||
|
@Resource
|
||||||
|
private FaceGroupsMapper faceGroupsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param groupId 主键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult selectFaceGroupsByGroupId(Long groupId) {
|
||||||
|
try {
|
||||||
|
FaceGroupsEntity faceGroups = faceGroupsMapper.selectFaceGroupsByGroupId(groupId);
|
||||||
|
if (ObjectUtils.isEmpty(faceGroups)) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.success(faceGroups);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param faceGroups
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FaceGroupsEntity> selectFaceGroupsList(FaceGroupsEntity faceGroups) {
|
||||||
|
return faceGroupsMapper.selectFaceGroupsList(faceGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param faceGroups
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult insertFaceGroups(FaceGroupsEntity faceGroups) {
|
||||||
|
try {
|
||||||
|
int groupNameUnique = faceGroupsMapper.isGroupNameUnique(faceGroups.getGroupName(), faceGroups.getGroupId());
|
||||||
|
if (groupNameUnique > 0) {
|
||||||
|
return AjaxResult.error("分组名称已存在");
|
||||||
|
}
|
||||||
|
faceGroups.setGroupCode("GROUP-" + StringUtils.randomUUID().substring(0, 8));
|
||||||
|
int rows = faceGroupsMapper.insertFaceGroups(faceGroups);
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
|
* @param faceGroups
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult updateFaceGroups(FaceGroupsEntity faceGroups) {
|
||||||
|
try {
|
||||||
|
int groupNameUnique = faceGroupsMapper.isGroupNameUnique(faceGroups.getGroupName(), faceGroups.getGroupId());
|
||||||
|
if (groupNameUnique > 0) {
|
||||||
|
return AjaxResult.error("分组名称已存在");
|
||||||
|
}
|
||||||
|
int rows = faceGroupsMapper.updateFaceGroups(faceGroups);
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param groupIds 需要删除的主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult deleteFaceGroupsByGroupIds(Long[] groupIds) {
|
||||||
|
try {
|
||||||
|
int rows = faceGroupsMapper.deleteFaceGroupsByGroupIds(groupIds);
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.bonus.face.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.bonus.common.core.utils.file.FileUtils;
|
||||||
|
import com.bonus.common.core.utils.http.HttpRequestHelper;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.face.config.FaceConfig;
|
||||||
|
import com.bonus.face.domain.FaceDataEntity;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bonus
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaceUtils {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FaceConfig faceConfig;
|
||||||
|
/**
|
||||||
|
* 添加人脸路径
|
||||||
|
*/
|
||||||
|
private static final String ADD_FACE_DATA = "/addFaceData";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加人脸
|
||||||
|
*/
|
||||||
|
public AjaxResult addFace(FaceDataEntity faceData) {
|
||||||
|
try {
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("name", faceData.getName());
|
||||||
|
params.put("idCard", faceData.getIdCard());
|
||||||
|
params.put("otherInfo", faceData.getOtherInfo());
|
||||||
|
params.put("image", FileUtils.convertToBase64WithPrefix(faceData.getFile()));
|
||||||
|
params.put("groupCode", faceData.getGroupCode());
|
||||||
|
String s = HttpRequestHelper.postJson(faceConfig.getUrl(), ADD_FACE_DATA, JSON.toJSONString(params), new HashMap<String, String>());
|
||||||
|
if (ObjectUtils.isNotEmpty(s)) {
|
||||||
|
return AjaxResult.success("添加成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.success("添加失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
||||||
|
_ __ _ _
|
||||||
|
(_) / _|(_)| |
|
||||||
|
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
|
||||||
|
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
|
||||||
|
| | | |_| || (_) || |_| || | | | | || || __/
|
||||||
|
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
|
||||||
|
__/ |
|
||||||
|
|___/
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/bonus-file" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.bonus" level="info" />
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info" />
|
||||||
|
<appender-ref ref="file_error" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bonus.face.mapper.FaceDataMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.bonus.face.domain.FaceDataEntity" id="FaceDataResult">
|
||||||
|
<result property="faceId" column="face_id"/>
|
||||||
|
<result property="groupCode" column="group_code"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="idCard" column="id_card"/>
|
||||||
|
<result property="otherInfo" column="other_info"/>
|
||||||
|
<result property="embedding" column="embedding"/>
|
||||||
|
<result property="imagePath" column="image_path"/>
|
||||||
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="updatedAt" column="updated_at"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFaceDataVo">
|
||||||
|
select face_id,
|
||||||
|
group_code,
|
||||||
|
name,
|
||||||
|
id_card,
|
||||||
|
other_info,
|
||||||
|
embedding,
|
||||||
|
image_path,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
from face_data
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFaceDataList" parameterType="com.bonus.face.domain.FaceDataEntity" resultMap="FaceDataResult">
|
||||||
|
<include refid="selectFaceDataVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="groupCode != null and groupCode != ''">and group_code = #{groupCode}</if>
|
||||||
|
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="idCard != null and idCard != ''">and id_card like concat('%', #{idCard}, '%')</if>
|
||||||
|
<if test="otherInfo != null and otherInfo != ''">and other_info = #{otherInfo}</if>
|
||||||
|
<if test="embedding != null and embedding != ''">and embedding = #{embedding}</if>
|
||||||
|
<if test="imagePath != null and imagePath != ''">and image_path = #{imagePath}</if>
|
||||||
|
<if test="createdAt != null ">and created_at = #{createdAt}</if>
|
||||||
|
<if test="updatedAt != null ">and updated_at = #{updatedAt}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFaceDataByFaceId" parameterType="Long" resultMap="FaceDataResult">
|
||||||
|
<include refid="selectFaceDataVo"/>
|
||||||
|
where face_id = #{faceId}
|
||||||
|
</select>
|
||||||
|
<select id="isGroupAndIdCardUnique" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM face_data
|
||||||
|
WHERE group_code = #{groupCode} AND id_card =#{idCard}
|
||||||
|
<if test="faceId != null and faceId != ''">
|
||||||
|
AND face_id != #{faceId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFaceData" parameterType="com.bonus.face.domain.FaceDataEntity" useGeneratedKeys="true"
|
||||||
|
keyProperty="faceId">
|
||||||
|
insert into face_data
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupCode != null">group_code,</if>
|
||||||
|
<if test="name != null and name != ''">name,</if>
|
||||||
|
<if test="idCard != null and idCard != ''">id_card,</if>
|
||||||
|
<if test="otherInfo != null">other_info,</if>
|
||||||
|
<if test="embedding != null and embedding != ''">embedding,</if>
|
||||||
|
<if test="imagePath != null">image_path,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
<if test="updatedAt != null">updated_at,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupCode != null">#{groupCode},</if>
|
||||||
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
|
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
||||||
|
<if test="otherInfo != null">#{otherInfo},</if>
|
||||||
|
<if test="embedding != null and embedding != ''">#{embedding},</if>
|
||||||
|
<if test="imagePath != null">#{imagePath},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFaceData" parameterType="com.bonus.face.domain.FaceDataEntity">
|
||||||
|
update face_data
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="groupCode != null">group_code = #{groupCode},</if>
|
||||||
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
|
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
|
||||||
|
<if test="otherInfo != null">other_info = #{otherInfo},</if>
|
||||||
|
<if test="embedding != null and embedding != ''">embedding = #{embedding},</if>
|
||||||
|
<if test="imagePath != null">image_path = #{imagePath},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
where face_id = #{faceId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFaceDataByFaceIds" parameterType="String">
|
||||||
|
delete from face_data where face_id in
|
||||||
|
<foreach item="faceId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{faceId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bonus.face.mapper.FaceGroupsMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.bonus.face.domain.FaceGroupsEntity" id="FaceGroupsResult">
|
||||||
|
<result property="groupId" column="group_id" />
|
||||||
|
<result property="groupCode" column="group_code" />
|
||||||
|
<result property="groupName" column="group_name" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="createdAt" column="created_at" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectFaceGroupsVo">
|
||||||
|
select group_id, group_code, group_name, description, created_at from face_groups
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectFaceGroupsList" parameterType="com.bonus.face.domain.FaceGroupsEntity" resultMap="FaceGroupsResult">
|
||||||
|
<include refid="selectFaceGroupsVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="groupCode != null and groupCode != ''">and group_code like concat('%', #{groupCode}, '%')</if>
|
||||||
|
<if test="groupName != null and groupName != ''">and group_name like concat('%', #{groupName}, '%')</if>
|
||||||
|
<if test="description != null and description != ''">and description = #{description}</if>
|
||||||
|
<if test="createdAt != null ">and created_at = #{createdAt}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFaceGroupsByGroupId" parameterType="Long" resultMap="FaceGroupsResult">
|
||||||
|
<include refid="selectFaceGroupsVo"/>
|
||||||
|
where group_id = #{groupId}
|
||||||
|
</select>
|
||||||
|
<select id="isGroupNameUnique" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM face_groups
|
||||||
|
WHERE group_name = #{groupName}
|
||||||
|
<if test="groupId != null and groupId != ''">
|
||||||
|
AND group_id != #{groupId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFaceGroups" parameterType="com.bonus.face.domain.FaceGroupsEntity" useGeneratedKeys="true" keyProperty="groupId">
|
||||||
|
insert into face_groups
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupCode != null and groupCode != ''">group_code,</if>
|
||||||
|
<if test="groupName != null and groupName != ''">group_name,</if>
|
||||||
|
<if test="description != null">description,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="groupCode != null and groupCode != ''">#{groupCode},</if>
|
||||||
|
<if test="groupName != null and groupName != ''">#{groupName},</if>
|
||||||
|
<if test="description != null">#{description},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFaceGroups" parameterType="com.bonus.face.domain.FaceGroupsEntity">
|
||||||
|
update face_groups
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="groupCode != null and groupCode != ''">group_code = #{groupCode},</if>
|
||||||
|
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
|
||||||
|
<if test="description != null">description = #{description},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
</trim>
|
||||||
|
where group_id = #{groupId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteFaceGroupsByGroupIds" parameterType="String">
|
||||||
|
delete from face_groups where group_id in
|
||||||
|
<foreach item="groupId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{groupId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -21,6 +21,7 @@ import com.bonus.system.api.domain.SysUser;
|
||||||
import com.bonus.system.api.model.LoginUser;
|
import com.bonus.system.api.model.LoginUser;
|
||||||
import com.bonus.system.domain.UserPasswordHistory;
|
import com.bonus.system.domain.UserPasswordHistory;
|
||||||
import com.bonus.system.service.*;
|
import com.bonus.system.service.*;
|
||||||
|
import com.bonus.system.warning.WebSocketHandler;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
@ -66,6 +67,9 @@ public class SysUserController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WebSocketHandler webSocketHandler;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysLogService sysLogService;
|
private ISysLogService sysLogService;
|
||||||
|
|
@ -81,6 +85,7 @@ public class SysUserController extends BaseController {
|
||||||
try {
|
try {
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
webSocketHandler.sendMessageToAll("213123");
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.toString(), e);
|
logger.error(e.toString(), e);
|
||||||
|
|
@ -561,5 +566,4 @@ public class SysUserController extends BaseController {
|
||||||
boolean b = SecurityUtils.matchesPassword(user.getPassword(), sysUser.getPassword());
|
boolean b = SecurityUtils.matchesPassword(user.getPassword(), sysUser.getPassword());
|
||||||
return b? success():error("密码错误");
|
return b? success():error("密码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,20 @@
|
||||||
package com.bonus.system.service.impl;
|
package com.bonus.system.service.impl;
|
||||||
|
|
||||||
import com.bonus.system.warning.SysWarning;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.system.warning.WaringLogEvent;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.system.service.ISysLogService;
|
import com.bonus.common.core.utils.global.SystemGlobal;
|
||||||
import com.bonus.common.core.domain.R;
|
|
||||||
import com.bonus.common.core.utils.ip.IpUtils;
|
import com.bonus.common.core.utils.ip.IpUtils;
|
||||||
import com.bonus.common.core.utils.uuid.IdUtils;
|
import com.bonus.common.core.utils.uuid.IdUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.common.core.utils.global.SystemGlobal;
|
|
||||||
import com.bonus.system.api.domain.SysLogsVo;
|
import com.bonus.system.api.domain.SysLogsVo;
|
||||||
import com.bonus.system.api.model.LoginUser;
|
import com.bonus.system.api.model.LoginUser;
|
||||||
import com.bonus.system.mapper.SysLogMapper;
|
import com.bonus.system.mapper.SysLogMapper;
|
||||||
|
import com.bonus.system.service.ISysLogService;
|
||||||
|
import com.bonus.system.warning.SysWarning;
|
||||||
|
import com.bonus.system.warning.WaringLogEvent;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
@ -24,7 +23,6 @@ import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="province" column="province" />
|
||||||
|
<result property="city" column="city" />
|
||||||
|
<result property="district" column="district" />
|
||||||
|
<result property="address" column="address" />
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeptVo">
|
<sql id="selectDeptVo">
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
select d.dept_id,
|
||||||
|
d.parent_id,
|
||||||
|
d.ancestors,
|
||||||
|
d.dept_name,
|
||||||
|
d.order_num,
|
||||||
|
d.leader,
|
||||||
|
d.phone,
|
||||||
|
d.email,
|
||||||
|
d.status,
|
||||||
|
d.del_flag,
|
||||||
|
d.create_by,
|
||||||
|
d.create_time,
|
||||||
|
d.province,
|
||||||
|
d.city,
|
||||||
|
d.district,
|
||||||
|
d.address
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -122,32 +142,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="com.bonus.system.api.domain.SysDept">
|
<insert id="insertDept" parameterType="com.bonus.system.api.domain.SysDept">
|
||||||
insert into sys_dept(
|
insert into sys_dept(
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||||
<if test="orderNum != null">order_num,</if>
|
<if test="orderNum != null">order_num,</if>
|
||||||
<if test="leader != null and leader != ''">leader,</if>
|
<if test="leader != null and leader != ''">leader,</if>
|
||||||
<if test="phone != null and phone != ''">phone,</if>
|
<if test="phone != null and phone != ''">phone,</if>
|
||||||
<if test="email != null and email != ''">email,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="province != null and province != ''">province,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="city != null and city != ''">city,</if>
|
||||||
create_time
|
<if test="district != null and district != ''">district,</if>
|
||||||
)values(
|
<if test="address != null and address != ''">address,</if>
|
||||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
create_time
|
||||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
)values(
|
||||||
<if test="orderNum != null">#{orderNum},</if>
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||||
<if test="leader != null and leader != ''">#{leader},</if>
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||||
<if test="phone != null and phone != ''">#{phone},</if>
|
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||||
<if test="email != null and email != ''">#{email},</if>
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="orderNum != null">#{orderNum},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="leader != null and leader != ''">#{leader},</if>
|
||||||
sysdate()
|
<if test="phone != null and phone != ''">#{phone},</if>
|
||||||
)
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
</insert>
|
<if test="province != null and province != ''">#{province},</if>
|
||||||
|
<if test="city != null and city != ''">#{city},</if>
|
||||||
|
<if test="district != null and district != ''">#{district},</if>
|
||||||
|
<if test="address != null and address != ''">#{address},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateDept" parameterType="com.bonus.system.api.domain.SysDept">
|
<update id="updateDept" parameterType="com.bonus.system.api.domain.SysDept">
|
||||||
update sys_dept
|
update sys_dept
|
||||||
|
|
@ -159,6 +187,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="leader != null">leader = #{leader},</if>
|
<if test="leader != null">leader = #{leader},</if>
|
||||||
<if test="phone != null">phone = #{phone},</if>
|
<if test="phone != null">phone = #{phone},</if>
|
||||||
<if test="email != null">email = #{email},</if>
|
<if test="email != null">email = #{email},</if>
|
||||||
|
<if test="province != null">province = #{province},</if>
|
||||||
|
<if test="city != null">city = #{city},</if>
|
||||||
|
<if test="district != null">district = #{district},</if>
|
||||||
|
<if test="address != null">address = #{address},</if>
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration
|
||||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<!-- 其他MyBatis配置 -->
|
||||||
|
|
||||||
|
<!-- 插件配置 -->
|
||||||
|
<plugins>
|
||||||
|
<plugin interceptor="com.bonus.system.Interceptor.DataScopeInterceptor">
|
||||||
|
<property name="someProperty" value="someValue"/>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
<!-- 其他配置 -->
|
||||||
|
</configuration>
|
||||||
|
|
@ -10,6 +10,7 @@ app_source_jars=(
|
||||||
"bonus-gateway/target/bonus-gateway.jar"
|
"bonus-gateway/target/bonus-gateway.jar"
|
||||||
"bonus-modules/bonus-file/target/bonus-file.jar"
|
"bonus-modules/bonus-file/target/bonus-file.jar"
|
||||||
"bonus-modules/bonus-gen/target/bonus-gen.jar"
|
"bonus-modules/bonus-gen/target/bonus-gen.jar"
|
||||||
|
"bonus-modules/bonus-face/target/bonus-face.jar"
|
||||||
"bonus-modules/bonus-job/target/bonus-job.jar"
|
"bonus-modules/bonus-job/target/bonus-job.jar"
|
||||||
"bonus-modules/bonus-oss/target/bonus-oss.jar"
|
"bonus-modules/bonus-oss/target/bonus-oss.jar"
|
||||||
"bonus-modules/bonus-system/target/bonus-system.jar"
|
"bonus-modules/bonus-system/target/bonus-system.jar"
|
||||||
|
|
@ -27,7 +28,8 @@ jars=("bonus-auth.jar --spring.config.location=file:auth_bootstrap.yml"
|
||||||
"bonus-gen.jar --spring.config.location=file:gen_bootstrap.yml"
|
"bonus-gen.jar --spring.config.location=file:gen_bootstrap.yml"
|
||||||
"bonus-job.jar --spring.config.location=file:job_bootstrap.yml"
|
"bonus-job.jar --spring.config.location=file:job_bootstrap.yml"
|
||||||
"bonus-file.jar --spring.config.location=file:file_bootstrap.yml"
|
"bonus-file.jar --spring.config.location=file:file_bootstrap.yml"
|
||||||
"bonus-visual-monitor.jar --spring.config.location=file:visual_bootstrap.yml")
|
"bonus-visual-monitor.jar --spring.config.location=file:visual_bootstrap.yml"
|
||||||
|
"bonus-face.jar --spring.config.location=file:face_bootstrap.yml")
|
||||||
|
|
||||||
# 遍历数组并检查每个JAR文件的进程
|
# 遍历数组并检查每个JAR文件的进程
|
||||||
for jar_with_args in "${jars[@]}"; do
|
for jar_with_args in "${jars[@]}"; do
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 18087
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bonus-face
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 192.168.0.56:8848
|
||||||
|
namespace: 9cde1ce1-98bc-4b9c-9213-f1fbf8a5b3cc
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 192.168.0.56:8848
|
||||||
|
namespace: 9cde1ce1-98bc-4b9c-9213-f1fbf8a5b3cc
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
Loading…
Reference in New Issue