Commit 869f8a12 authored by 赵啸非's avatar 赵啸非

修改部分类

parent f18ca5f7
package com.mortals.xhx.base.framework.config; package com.mortals.xhx.base.framework.config;
import com.alibaba.fastjson.parser.ParserConfig; import com.alibaba.fastjson.parser.ParserConfig;
import com.mortals.framework.thirty.dm.DmTransInterceptor;
import com.mortals.xhx.module.site.model.SiteTreeSelect; import com.mortals.xhx.module.site.model.SiteTreeSelect;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
...@@ -18,6 +20,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; ...@@ -18,6 +20,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class CorsConfig implements WebMvcConfigurer { public class CorsConfig implements WebMvcConfigurer {
@Bean @Bean
public CorsFilter corsFilter(){ public CorsFilter corsFilter(){
ParserConfig.getGlobalInstance().putDeserializer(SiteTreeSelect.class, new SiteTreeSelect.Deserializer()); ParserConfig.getGlobalInstance().putDeserializer(SiteTreeSelect.class, new SiteTreeSelect.Deserializer());
......
package com.mortals.xhx.face;
import com.arcsoft.face.*;
import com.arcsoft.face.toolkit.ImageInfo;
import com.google.common.collect.Lists;
import com.mortals.xhx.face.factory.FaceEnginePoolFactory;
import com.mortals.xhx.module.identity.model.SysFaceEntity;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.pool2.impl.AbandonedConfig;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
@Slf4j
@Component
public class ArcsoftFaceUtil {
@Value(value = "${faceAppId}")
private String appId;
@Value(value = "${winSdkKey}")
private String winSdkKey;
@Value(value = "${linuxSdkkey}")
private String linuxSdkKey;
public Integer threadPoolSize=5;
private GenericObjectPool<FaceEngine> faceEngineGenericObjectPool;
public ArcsoftFaceUtil(){
String sdkLibPath = getClass().getResource(getOsName()).getPath();
String sdkKey = getSdkKey(sdkLibPath);
// 对象池工厂
FaceEnginePoolFactory personPoolFactory = new FaceEnginePoolFactory(appId,sdkKey,sdkLibPath);
// 对象池配置
GenericObjectPoolConfig<FaceEngine> objectPoolConfig = new GenericObjectPoolConfig<>();
objectPoolConfig.setMaxTotal(threadPoolSize);
AbandonedConfig abandonedConfig = new AbandonedConfig();
//在Maintenance的时候检查是否有泄漏
abandonedConfig.setRemoveAbandonedOnMaintenance(true);
//borrow 的时候检查泄漏
abandonedConfig.setRemoveAbandonedOnBorrow(true);
//如果一个对象borrow之后10秒还没有返还给pool,认为是泄漏的对象
abandonedConfig.setRemoveAbandonedTimeout(10);
// 对象池
faceEngineGenericObjectPool = new GenericObjectPool<>(personPoolFactory, objectPoolConfig);
faceEngineGenericObjectPool.setAbandonedConfig(abandonedConfig);
faceEngineGenericObjectPool.setTimeBetweenEvictionRunsMillis(5000); //5秒运行一次维护任务
log.info("引擎池开启成功");
}
private String getOsName() {
String os = System.getProperty("os.name");
String osName = os.toLowerCase().startsWith("win") ? "/face_lib/win64" : "/face_lib/linux";
return osName;
}
private String getSdkKey(String sdkLibPath) {
return sdkLibPath.equals("/face_lib/win64") ? winSdkKey : linuxSdkKey;
}
/**
* 人脸检测
*
* @param fileInputStream
* @return
*/
public List<FaceInfo> faceFind(InputStream fileInputStream) throws IOException {
FaceEngine faceEngine = null;
try {
faceEngine = faceEngineGenericObjectPool.borrowObject();
ImageInfo imageInfo = getRGBData(fileInputStream);
List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>();
int errorCode = faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
return faceInfoList;
} catch (Exception e) {
log.error("人脸检测出现了异常");
e.printStackTrace();
return new ArrayList<FaceInfo>();
} finally {
fileInputStream.close();
// 回收对象到对象池
if (faceEngine != null) {
faceEngineGenericObjectPool.returnObject(faceEngine);
}
}
}
/**
* 人脸截取
*
* @param fileInputStream
* @param rect
* @return
*/
public String faceCrop(InputStream fileInputStream, Rect rect) {
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
BufferedImage bufImage = ImageIO.read(fileInputStream);
int height = bufImage.getHeight();
int width = bufImage.getWidth();
int top = rect.getTop();
int bottom = rect.getBottom();
int left = rect.getLeft();
int right = rect.getRight();
//System.out.println(top + "-" + bottom + "-" + left + "-" + right);
try {
BufferedImage subimage = bufImage.getSubimage(left, top, right - left, bottom - left);
ImageIO.write(subimage, "png", stream);
String base64 = Base64.encode(stream.toByteArray());
return base64;
}catch (Exception e){
return null;
}finally {
stream.close();
fileInputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}finally {
}
return null;
}
/**
* 人脸特征值提取
*/
public byte[] faceFeature(byte[] bytes) {
FaceEngine faceEngine = null;
try {
faceEngine = faceEngineGenericObjectPool.borrowObject();
ImageInfo imageInfo = getRGBData(bytes);
//人脸检测得到人脸列表
List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>();
faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
FaceFeature faceFeature = new FaceFeature();
faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
byte[] featureData = faceFeature.getFeatureData();
return featureData;
} catch (Exception e) {
log.error("人脸特征值提取出现了异常");
e.printStackTrace();
return new byte[0];
} finally {
// 回收对象到对象池
if (faceEngine != null) {
faceEngineGenericObjectPool.returnObject(faceEngine);
}
}
}
/**
* 人脸对比
*/
public float faceCompared(byte [] source,byte [] des) throws IOException {
FaceEngine faceEngine = null;
try {
faceEngine = faceEngineGenericObjectPool.borrowObject();
FaceFeature targetFaceFeature = new FaceFeature();
targetFaceFeature.setFeatureData(source);
FaceFeature sourceFaceFeature = new FaceFeature();
sourceFaceFeature.setFeatureData(des);
FaceSimilar faceSimilar = new FaceSimilar();
faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
float score = faceSimilar.getScore();
return score;
} catch (Exception e) {
log.error("人脸对比出现了异常");
e.printStackTrace();
return 0;
} finally {
// 回收对象到对象池
if (faceEngine != null) {
faceEngineGenericObjectPool.returnObject(faceEngine);
}
}
}
/**
* 人脸搜索
*/
public List<SysFaceEntity> faceSearch(FaceFeature targetFaceFeature,List<SysFaceEntity> sourceList) throws IOException {
FaceEngine faceEngine = null;
List<SysFaceEntity> resultFaceInfoList = Lists.newLinkedList();//识别到的人脸列表
try {
faceEngine = faceEngineGenericObjectPool.borrowObject();
for(SysFaceEntity faceUserInfo : sourceList) {
FaceFeature sourceFaceFeature = new FaceFeature();
sourceFaceFeature.setFeatureData(faceUserInfo.getFaceFeature());
FaceSimilar faceSimilar = new FaceSimilar();
faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
float score = faceSimilar.getScore();
if(score > 0.8){
faceUserInfo.setSimilarValue(plusHundred(score));
resultFaceInfoList.add(faceUserInfo);
}
}
} catch (Exception e) {
log.error("人脸对比出现了异常");
e.printStackTrace();
} finally {
// 回收对象到对象池
if (faceEngine != null) {
faceEngineGenericObjectPool.returnObject(faceEngine);
}
}
return resultFaceInfoList;
}
private int plusHundred(Float value) {
BigDecimal target = new BigDecimal(value);
BigDecimal hundred = new BigDecimal(100f);
return target.multiply(hundred).intValue();
}
}
package com.mortals.xhx.face.factory;
import com.arcsoft.face.ActiveFileInfo;
import com.arcsoft.face.EngineConfiguration;
import com.arcsoft.face.FaceEngine;
import com.arcsoft.face.FunctionConfiguration;
import com.arcsoft.face.enums.DetectMode;
import com.arcsoft.face.enums.DetectOrient;
import com.arcsoft.face.enums.ErrorInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.pool2.BasePooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
@Slf4j
public class FaceEnginePoolFactory extends BasePooledObjectFactory<FaceEngine> {
private String appId;
private String sdkKey;
private String sdkLibPath;
public FaceEnginePoolFactory(String appId, String sdkKey, String sdkLibPath) {
this.appId = appId;
this.sdkKey = sdkKey;
this.sdkLibPath = sdkLibPath;
//this.sdkLibPath = "D:\\face\\win64";
}
/**
* 在对象池中创建对象
* @return
* @throws Exception
*/
@Override
public FaceEngine create() throws Exception {
FaceEngine faceEngine = new FaceEngine(sdkLibPath);
//激活引擎
int errorCode = faceEngine.activeOnline(appId, sdkKey);
if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
log.warn("引擎激活失败");
}
ActiveFileInfo activeFileInfo=new ActiveFileInfo();
errorCode = faceEngine.getActiveFileInfo(activeFileInfo);
if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
log.warn("获取激活文件信息失败");
}
//引擎配置
EngineConfiguration engineConfiguration = new EngineConfiguration();
engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);
engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT);
engineConfiguration.setDetectFaceMaxNum(10);
engineConfiguration.setDetectFaceScaleVal(16);
//功能配置
FunctionConfiguration functionConfiguration = new FunctionConfiguration();
functionConfiguration.setSupportAge(true);
functionConfiguration.setSupportFace3dAngle(true);
functionConfiguration.setSupportFaceDetect(true);
functionConfiguration.setSupportFaceRecognition(true);
functionConfiguration.setSupportGender(true);
functionConfiguration.setSupportLiveness(true);
functionConfiguration.setSupportIRLiveness(true);
engineConfiguration.setFunctionConfiguration(functionConfiguration);
//初始化引擎
errorCode = faceEngine.init(engineConfiguration);
if (errorCode != ErrorInfo.MOK.getValue()) {
log.error("初始化引擎失败");
}
return faceEngine;
}
/**
* 包装对象
* @param faceEngine
* @return
*/
@Override
public PooledObject<FaceEngine> wrap(FaceEngine faceEngine) {
return new DefaultPooledObject<>(faceEngine);
}
/**
* 销毁对象
* @param faceEngine 对象池
* @throws Exception 异常
*/
@Override
public void destroyObject(PooledObject<FaceEngine> faceEngine) throws Exception {
super.destroyObject(faceEngine);
}
/**
* 校验对象是否可用
* @param faceEngine 对象池
* @return 对象是否可用结果,boolean
*/
@Override
public boolean validateObject(PooledObject<FaceEngine> faceEngine) {
return super.validateObject(faceEngine);
}
/**
* 激活钝化的对象系列操作
* @param faceEngine 对象池
* @throws Exception 异常信息
*/
@Override
public void activateObject(PooledObject<FaceEngine> faceEngine) throws Exception {
super.activateObject(faceEngine);
}
/**
* 钝化未使用的对象
* @param faceEngine 对象池
* @throws Exception 异常信息
*/
@Override
public void passivateObject(PooledObject<FaceEngine> faceEngine) throws Exception {
super.passivateObject(faceEngine);
}
}
...@@ -19,6 +19,8 @@ import com.mortals.xhx.module.dept.model.DeptEntity; ...@@ -19,6 +19,8 @@ import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo; import com.mortals.xhx.module.dept.model.vo.DeptVo;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.matters.model.MattersDeptEntity; import com.mortals.xhx.module.matters.model.MattersDeptEntity;
import com.mortals.xhx.module.matters.model.MattersDeptQuery; import com.mortals.xhx.module.matters.model.MattersDeptQuery;
import com.mortals.xhx.module.matters.service.MattersDeptService; import com.mortals.xhx.module.matters.service.MattersDeptService;
...@@ -64,11 +66,13 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -64,11 +66,13 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
private WindowMatterService windowMatterService; private WindowMatterService windowMatterService;
@Autowired @Autowired
private SiteMatterService siteMatterService; private SiteMatterService siteMatterService;
@Autowired
private MatterService matterService;
@Override @Override
protected String getExtKey(DeptEntity data) { protected String getExtKey(DeptEntity data) {
return data.getDeptNumber()+"_"+data.getSiteId(); return data.getDeptNumber() + "_" + data.getSiteId();
} }
/** /**
...@@ -80,7 +84,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -80,7 +84,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
protected void saveBefore(DeptEntity entity, Context context) throws AppException { protected void saveBefore(DeptEntity entity, Context context) throws AppException {
super.saveBefore(entity, context); super.saveBefore(entity, context);
//新增校验部门编码与站点是否重复 //新增校验部门编码与站点是否重复
DeptEntity extCache = this.getExtCache(entity.getDeptNumber()+"_"+entity.getSiteId()); DeptEntity extCache = this.getExtCache(entity.getDeptNumber() + "_" + entity.getSiteId());
if (!ObjectUtils.isEmpty(extCache)) { if (!ObjectUtils.isEmpty(extCache)) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber()); throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
} }
...@@ -95,12 +99,30 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -95,12 +99,30 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
protected void updateBefore(DeptEntity entity, Context context) throws AppException { protected void updateBefore(DeptEntity entity, Context context) throws AppException {
super.updateBefore(entity, context); super.updateBefore(entity, context);
DeptEntity beforeEntity = this.get(entity.getId(), context); DeptEntity beforeEntity = this.get(entity.getId(), context);
if (!(beforeEntity.getDeptNumber()+"_"+beforeEntity.getSiteId()).equals(entity.getDeptNumber()+"_"+entity.getSiteId())) { if (!(beforeEntity.getDeptNumber() + "_" + beforeEntity.getSiteId()).equals(entity.getDeptNumber() + "_" + entity.getSiteId())) {
DeptEntity extCache = this.getExtCache(entity.getDeptNumber()+"_"+entity.getSiteId()); DeptEntity extCache = this.getExtCache(entity.getDeptNumber() + "_" + entity.getSiteId());
if (!ObjectUtils.isEmpty(extCache)) { if (!ObjectUtils.isEmpty(extCache)) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber()); throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
} }
} }
//todo 判断部门名称是否修改,如果一体化的部门 修改名称则同步修改对应事项的部门名称
if (!ObjectUtils.isEmpty(entity.getSiteId()) &&
!ObjectUtils.isEmpty(entity.getName()) &&
!ObjectUtils.isEmpty(beforeEntity) &&
!entity.getName().equals(beforeEntity.getName())) {
SiteEntity siteCache = siteService.getCache(entity.getSiteId().toString());
//matterService.
MatterQuery condition = new MatterQuery();
condition.setAreaCode(siteCache.getAreaCode());
condition.setDeptName(beforeEntity.getName());
MatterQuery updateQuery = new MatterQuery();
updateQuery.setDeptName(entity.getName());
matterService.getDao().update(updateQuery, condition);
}
} }
@Override @Override
......
package com.mortals.xhx.module.identity.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.identity.model.PeopleInfoEntity;
import java.util.List;
/**
* 用户信息Dao
* 用户信息 DAO接口
*
* @author zxfei
* @date 2022-08-08
*/
public interface PeopleInfoDao extends ICRUDDao<PeopleInfoEntity,Long>{
}
package com.mortals.xhx.module.identity.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.identity.model.SysFaceEntity;
import java.util.List;
/**
* 人脸识别信息Dao
* 人脸识别信息 DAO接口
*
* @author zxfei
* @date 2022-08-03
*/
public interface SysFaceDao extends ICRUDDao<SysFaceEntity,String>{
}
package com.mortals.xhx.module.identity.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
import java.util.List;
/**
* 人员身份信息Dao
* 人员身份信息 DAO接口
*
* @author zxfei
* @date 2022-08-03
*/
public interface SysIdentityDao extends ICRUDDao<SysIdentityEntity,String>{
/**
* 身份证号查询
* @param region
* @param birthday
* @param ase
* @param name
* @param id
* @return
*/
SysIdentityEntity findIdentity(Long region,Long birthday,String ase, String name, String id);
}
package com.mortals.xhx.module.identity.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.identity.dao.PeopleInfoDao;
import com.mortals.xhx.module.identity.model.PeopleInfoEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 用户信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-08-08
*/
@Repository("peopleInfoDao")
public class PeopleInfoDaoImpl extends BaseCRUDDaoMybatis<PeopleInfoEntity,Long> implements PeopleInfoDao {
}
package com.mortals.xhx.module.identity.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.identity.dao.SysFaceDao;
import com.mortals.xhx.module.identity.model.SysFaceEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 人脸识别信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-08-03
*/
@Repository("sysFaceDao")
public class SysFaceDaoImpl extends BaseCRUDDaoMybatis<SysFaceEntity,String> implements SysFaceDao {
}
package com.mortals.xhx.module.identity.dao.ibatis;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.model.ParamDto;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.identity.dao.SysIdentityDao;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 人员身份信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-08-03
*/
@Repository("sysIdentityDao")
public class SysIdentityDaoImpl extends BaseCRUDDaoMybatis<SysIdentityEntity,String> implements SysIdentityDao {
@Override
public SysIdentityEntity findIdentity(Long region, Long birthday, String ase, String name, String id) {
Map<String,Object> condition = new HashMap<>();
condition.put("region",region);
condition.put("birthday",birthday);
condition.put("ase",ase);
condition.put("name",name);
condition.put("id",id);
return (SysIdentityEntity)this.getSqlSession().selectOne(this.getSqlId("findIdentity"), condition);
}
}
package com.mortals.xhx.module.identity.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.identity.model.vo.PeopleInfoVo;
/**
* 用户信息实体对象
*
* @author zxfei
* @date 2022-08-08
*/
public class PeopleInfoEntity extends PeopleInfoVo {
private static final long serialVersionUID = 1L;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private String sex;
/**
* 民族
*/
private String nation;
/**
* 出生日期
*/
private String born;
/**
* 地址
*/
private String address;
/**
* 身份证号
*/
private String idCardNo;
/**
* 发证机关
*/
private String grantDept;
/**
* 有效期开始
*/
private String userLifeBegin;
/**
* 有效期结束
*/
private String userLifeEnd;
/**
* 照片
*/
private String photoFileName;
/**
* 手机
*/
private String phone;
/**
* 微信开放认证id
*/
private String openid;
/**
* 最近登录时间
*/
private Date lastTime;
/**
*
*/
private Date upTime;
/**
* 微信头像
*/
private String icon;
/**
* 微信昵称
*/
private String nickname;
/**
* 身份证正面照片
*/
private String zImg;
/**
* 身份证背面照片
*/
private String bImg;
/**
* 默认选择的站点id
*/
private Long siteid;
/**
* 天府通办用户名
*/
private String username;
public PeopleInfoEntity(){}
/**
* 获取 姓名
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 姓名
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 性别
* @return String
*/
public String getSex(){
return sex;
}
/**
* 设置 性别
* @param sex
*/
public void setSex(String sex){
this.sex = sex;
}
/**
* 获取 民族
* @return String
*/
public String getNation(){
return nation;
}
/**
* 设置 民族
* @param nation
*/
public void setNation(String nation){
this.nation = nation;
}
/**
* 获取 出生日期
* @return String
*/
public String getBorn(){
return born;
}
/**
* 设置 出生日期
* @param born
*/
public void setBorn(String born){
this.born = born;
}
/**
* 获取 地址
* @return String
*/
public String getAddress(){
return address;
}
/**
* 设置 地址
* @param address
*/
public void setAddress(String address){
this.address = address;
}
/**
* 获取 身份证号
* @return String
*/
public String getIdCardNo(){
return idCardNo;
}
/**
* 设置 身份证号
* @param idCardNo
*/
public void setIdCardNo(String idCardNo){
this.idCardNo = idCardNo;
}
/**
* 获取 发证机关
* @return String
*/
public String getGrantDept(){
return grantDept;
}
/**
* 设置 发证机关
* @param grantDept
*/
public void setGrantDept(String grantDept){
this.grantDept = grantDept;
}
/**
* 获取 有效期开始
* @return String
*/
public String getUserLifeBegin(){
return userLifeBegin;
}
/**
* 设置 有效期开始
* @param userLifeBegin
*/
public void setUserLifeBegin(String userLifeBegin){
this.userLifeBegin = userLifeBegin;
}
/**
* 获取 有效期结束
* @return String
*/
public String getUserLifeEnd(){
return userLifeEnd;
}
/**
* 设置 有效期结束
* @param userLifeEnd
*/
public void setUserLifeEnd(String userLifeEnd){
this.userLifeEnd = userLifeEnd;
}
/**
* 获取 照片
* @return String
*/
public String getPhotoFileName(){
return photoFileName;
}
/**
* 设置 照片
* @param photoFileName
*/
public void setPhotoFileName(String photoFileName){
this.photoFileName = photoFileName;
}
/**
* 获取 手机
* @return String
*/
public String getPhone(){
return phone;
}
/**
* 设置 手机
* @param phone
*/
public void setPhone(String phone){
this.phone = phone;
}
/**
* 获取
* @return String
*/
public String getOpenid(){
return openid;
}
/**
* 设置
* @param openid
*/
public void setOpenid(String openid){
this.openid = openid;
}
/**
* 获取 最近登录时间
* @return Date
*/
public Date getLastTime(){
return lastTime;
}
/**
* 设置 最近登录时间
* @param lastTime
*/
public void setLastTime(Date lastTime){
this.lastTime = lastTime;
}
/**
* 获取
* @return Date
*/
public Date getUpTime(){
return upTime;
}
/**
* 设置
* @param upTime
*/
public void setUpTime(Date upTime){
this.upTime = upTime;
}
/**
* 获取 微信头像
* @return String
*/
public String getIcon(){
return icon;
}
/**
* 设置 微信头像
* @param icon
*/
public void setIcon(String icon){
this.icon = icon;
}
/**
* 获取 微信昵称
* @return String
*/
public String getNickname(){
return nickname;
}
/**
* 设置 微信昵称
* @param nickname
*/
public void setNickname(String nickname){
this.nickname = nickname;
}
/**
* 获取 身份证正面照片
* @return String
*/
public String getZImg(){
return zImg;
}
/**
* 设置 身份证正面照片
* @param zImg
*/
public void setZImg(String zImg){
this.zImg = zImg;
}
/**
* 获取 身份证背面照片
* @return String
*/
public String getBImg(){
return bImg;
}
/**
* 设置 身份证背面照片
* @param bImg
*/
public void setBImg(String bImg){
this.bImg = bImg;
}
/**
* 获取 默认选择的站点id
* @return Long
*/
public Long getSiteid(){
return siteid;
}
/**
* 设置 默认选择的站点id
* @param siteid
*/
public void setSiteid(Long siteid){
this.siteid = siteid;
}
/**
* 获取 天府通办用户名
* @return String
*/
public String getUsername(){
return username;
}
/**
* 设置 天府通办用户名
* @param username
*/
public void setUsername(String username){
this.username = username;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof PeopleInfoEntity) {
PeopleInfoEntity tmp = (PeopleInfoEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",name:").append(getName());
sb.append(",sex:").append(getSex());
sb.append(",nation:").append(getNation());
sb.append(",born:").append(getBorn());
sb.append(",address:").append(getAddress());
sb.append(",idCardNo:").append(getIdCardNo());
sb.append(",grantDept:").append(getGrantDept());
sb.append(",userLifeBegin:").append(getUserLifeBegin());
sb.append(",userLifeEnd:").append(getUserLifeEnd());
sb.append(",photoFileName:").append(getPhotoFileName());
sb.append(",phone:").append(getPhone());
sb.append(",openid:").append(getOpenid());
sb.append(",lastTime:").append(getLastTime());
sb.append(",upTime:").append(getUpTime());
sb.append(",icon:").append(getIcon());
sb.append(",nickname:").append(getNickname());
sb.append(",zImg:").append(getZImg());
sb.append(",bImg:").append(getBImg());
sb.append(",siteid:").append(getSiteid());
sb.append(",username:").append(getUsername());
return sb.toString();
}
public void initAttrValue(){
this.name = "";
this.sex = "";
this.nation = "";
this.born = "";
this.address = "";
this.idCardNo = "";
this.grantDept = "";
this.userLifeBegin = "";
this.userLifeEnd = "";
this.photoFileName = "";
this.phone = "";
this.openid = "微信开放认证id";
this.lastTime = null;
this.upTime = null;
this.icon = "";
this.nickname = "";
this.zImg = "";
this.bImg = "";
this.siteid = 0L;
this.username = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityStr;
import com.mortals.xhx.module.identity.model.vo.SysFaceVo;
/**
* 人脸识别信息实体对象
*
* @author zxfei
* @date 2022-08-03
*/
public class SysFaceEntity extends SysFaceVo {
private static final long serialVersionUID = 1L;
/**
* 场所名称
*/
private String placeName;
/**
* 场所ID
*/
private String placeId;
/**
* 人脸缩略图
*/
private byte[] face;
/**
* 人脸特征
*/
private byte[] faceFeature;
/**
* 身份ID
*/
private String idCard;
/**
* 删除标识
*/
private Integer deleted;
public SysFaceEntity(){}
/**
* 获取 场所名称
* @return String
*/
public String getPlaceName(){
return placeName;
}
/**
* 设置 场所名称
* @param placeName
*/
public void setPlaceName(String placeName){
this.placeName = placeName;
}
/**
* 获取 场所ID
* @return String
*/
public String getPlaceId(){
return placeId;
}
/**
* 设置 场所ID
* @param placeId
*/
public void setPlaceId(String placeId){
this.placeId = placeId;
}
/**
* 获取 人脸缩略图
* @return String
*/
public byte[] getFace(){
return face;
}
/**
* 设置 人脸缩略图
* @param face
*/
public void setFace(byte[] face){
this.face = face;
}
/**
* 获取 人脸特征
* @return String
*/
public byte[] getFaceFeature(){
return faceFeature;
}
/**
* 设置 人脸特征
* @param faceFeature
*/
public void setFaceFeature(byte[] faceFeature){
this.faceFeature = faceFeature;
}
/**
* 获取 身份ID
* @return String
*/
public String getIdCard(){
return idCard;
}
/**
* 设置 身份ID
* @param idCard
*/
public void setIdCard(String idCard){
this.idCard = idCard;
}
/**
* 获取 删除标识
* @return Integer
*/
public Integer getDeleted(){
return deleted;
}
/**
* 设置 删除标识
* @param deleted
*/
public void setDeleted(Integer deleted){
this.deleted = deleted;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SysFaceEntity) {
SysFaceEntity tmp = (SysFaceEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",placeName:").append(getPlaceName());
sb.append(",placeId:").append(getPlaceId());
sb.append(",face:").append(getFace());
sb.append(",faceFeature:").append(getFaceFeature());
sb.append(",idCard:").append(getIdCard());
sb.append(",deleted:").append(getDeleted());
return sb.toString();
}
public void initAttrValue(){
this.placeName = "";
this.placeId = "";
this.face = null;
this.faceFeature = null;
this.idCard = "0";
this.deleted = 0;
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.model;
import com.mortals.xhx.module.identity.model.vo.SysIdentityVo;
/**
* 人员身份信息实体对象
*
* @author zxfei
* @date 2022-08-03
*/
public class SysIdentityEntity extends SysIdentityVo {
private static final long serialVersionUID = 1L;
/**
* 区域
*/
private Long region;
/**
* 生日
*/
private Long birthday;
/**
* 序列号
*/
private String ase;
/**
* 姓名
*/
private String name;
/**
* 电话
*/
private String phone;
/**
* 删除标识
*/
private Integer deleted;
public SysIdentityEntity(){}
/**
* 获取 区域
* @return Long
*/
public Long getRegion(){
return region;
}
/**
* 设置 区域
* @param region
*/
public void setRegion(Long region){
this.region = region;
}
/**
* 获取 生日
* @return Long
*/
public Long getBirthday(){
return birthday;
}
/**
* 设置 生日
* @param birthday
*/
public void setBirthday(Long birthday){
this.birthday = birthday;
}
/**
* 获取 序列号
* @return String
*/
public String getAse(){
return ase;
}
/**
* 设置 序列号
* @param ase
*/
public void setAse(String ase){
this.ase = ase;
}
/**
* 获取 姓名
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 姓名
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 电话
* @return String
*/
public String getPhone(){
return phone;
}
/**
* 设置 电话
* @param phone
*/
public void setPhone(String phone){
this.phone = phone;
}
/**
* 获取 删除标识
* @return Integer
*/
public Integer getDeleted(){
return deleted;
}
/**
* 设置 删除标识
* @param deleted
*/
public void setDeleted(Integer deleted){
this.deleted = deleted;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SysIdentityEntity) {
SysIdentityEntity tmp = (SysIdentityEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",region:").append(getRegion());
sb.append(",birthday:").append(getBirthday());
sb.append(",ase:").append(getAse());
sb.append(",name:").append(getName());
sb.append(",phone:").append(getPhone());
sb.append(",deleted:").append(getDeleted());
return sb.toString();
}
public void initAttrValue(){
this.region = null;
this.birthday = null;
this.ase = "";
this.name = "0";
this.phone = "";
this.deleted = 0;
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.model.vo;
import lombok.Data;
@Data
public class FaceInfoResVO {
/** id */
private String id;
/** 场所ID */
private String placeId;
/** 场所名称 */
private String placeName;
/** 人脸缩略图 */
private String face;
/** 人脸特征 */
private String faceFeature;
/** 身份信息ID */
private String cardId;
/** 身份证ID */
private String idCard;
/** 身份证名称 */
private String name;
/** 手机号 */
private String phone;
}
package com.mortals.xhx.module.identity.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.identity.model.PeopleInfoEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 用户信息视图对象
*
* @author zxfei
* @date 2022-08-08
*/
public class PeopleInfoVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.identity.model.vo;
import com.mortals.framework.model.BaseEntityStr;
import com.mortals.xhx.module.identity.model.SysFaceEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 人脸识别信息视图对象
*
* @author zxfei
* @date 2022-08-03
*/
public class SysFaceVo extends BaseEntityStr {
/** 相似度 */
private Integer similarValue;
public Integer getSimilarValue() {
return similarValue;
}
public void setSimilarValue(Integer similarValue) {
this.similarValue = similarValue;
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.model.vo;
import com.mortals.framework.model.BaseEntityStr;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 人员身份信息视图对象
*
* @author zxfei
* @date 2022-08-03
*/
@Data
public class SysIdentityVo extends BaseEntityStr {
/**
* 身份证编码
*/
private String idCard;
}
\ No newline at end of file
package com.mortals.xhx.module.identity.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.identity.model.PeopleInfoEntity;
/**
* PeopleInfoService
*
* 用户信息 service接口
*
* @author zxfei
* @date 2022-08-08
*/
public interface PeopleInfoService extends ICRUDService<PeopleInfoEntity,Long>{
/**
* 获取身份详细数据
* @param reqVo
* @return
* @throws AppException
*/
PeopleInfoEntity findPeopleInfo(PeopleInfoEntity reqVo) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.identity.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.identity.model.SysFaceEntity;
import com.mortals.xhx.module.identity.model.vo.FaceInfoResVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.concurrent.ExecutionException;
/**
* SysFaceService
*
* 人脸识别信息 service接口
*
* @author zxfei
* @date 2022-08-03
*/
public interface SysFaceService extends ICRUDService<SysFaceEntity,String>{
/**
* 注册人脸
*/
FaceInfoResVO uploadImage(MultipartFile multipartFile, String name, String idCard, String placeId, String placeName) throws AppException;
/**
* 下发人脸列表
*
* @param placeId
* @return
*/
List<FaceInfoResVO> findFaceList(String placeId) throws AppException;
/**
* 批量录入人脸
*
* @param
* @return
*/
void batchAddFace( List<MultipartFile> files,String placeId,String placeName);
/**
* 人脸特征识别
* @param faceFeature
* @return
*/
List<FaceInfoResVO> searchUserByFace(byte[] faceFeature) throws InterruptedException, ExecutionException;
}
\ No newline at end of file
package com.mortals.xhx.module.identity.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
/**
* SysIdentityService
*
* 人员身份信息 service接口
*
* @author zxfei
* @date 2022-08-03
*/
public interface SysIdentityService extends ICRUDService<SysIdentityEntity,String>{
/**
* 添加身份数据
*
* @param reqVO
* @return
*/
SysIdentityEntity saveIdEntity(SysIdentityEntity reqVO) throws AppException;
/**
* 获取身份ID
*
* @param reqVO
* @return
*/
String findIdEntity(SysIdentityEntity reqVO) throws AppException;
/**
* 获取身份详细数据
*
* @param id
* @param type 系统内部使用 1
* @return
*/
SysIdentityEntity findIdEntityDetail(String id,int type) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.identity.service.impl;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.PhoneUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.identity.dao.PeopleInfoDao;
import com.mortals.xhx.module.identity.model.PeopleInfoEntity;
import com.mortals.xhx.module.identity.service.PeopleInfoService;
import java.util.List;
/**
* PeopleInfoService
* 用户信息 service实现
*
* @author zxfei
* @date 2022-08-08
*/
@Service("peopleInfoService")
public class PeopleInfoServiceImpl extends AbstractCRUDServiceImpl<PeopleInfoDao, PeopleInfoEntity, Long> implements PeopleInfoService {
@Override
protected void validData(PeopleInfoEntity entity, Context context) throws AppException {
if(StringUtils.isEmpty(entity.getIdCardNo())){
throw new AppException("身份证号不能为空");
}
if(StringUtils.isEmpty(entity.getName())){
throw new AppException("身份证姓名不能为空");
}
if(!IdcardUtil.isValidCard18(entity.getIdCardNo())){
throw new AppException("身份证号码格式不正确");
}
if(StringUtils.isEmpty(entity.getPhone())){
throw new AppException("手机号不能为空");
}
if(!PhoneUtil.isPhone(entity.getPhone())){
throw new AppException("手机号码格式不正确");
}
}
@Override
protected void saveBefore(PeopleInfoEntity entity, Context context) throws AppException {
this.validData(entity, context);
PeopleInfoEntity query = new PeopleInfoEntity();
query.setIdCardNo(entity.getIdCardNo());
List<PeopleInfoEntity> list = dao.getList(query);
if(CollectionUtils.isNotEmpty(list)){
throw new AppException("身份证号码重复");
}
}
@Override
public PeopleInfoEntity findPeopleInfo(PeopleInfoEntity reqVo) throws AppException {
// if(StringUtils.isEmpty(reqVo.getIdCardNo())){
// throw new AppException("身份证号不能为空");
// }
// if(!IdcardUtil.isValidCard18(reqVo.getIdCardNo())){
// throw new AppException("身份证号码格式不正确");
// }
List<PeopleInfoEntity> list = dao.getList(reqVo);
if(CollectionUtils.isEmpty(list)){
throw new AppException("无身份数据");
}
return list.get(0);
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.service.impl;
import cn.hutool.core.util.IdcardUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.utils.RioUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.identity.dao.SysIdentityDao;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
import com.mortals.xhx.module.identity.service.SysIdentityService;
import cn.hutool.core.util.IdUtil;
import java.util.Date;
/**
* SysIdentityService
* 人员身份信息 service实现
*
* @author zxfei
* @date 2022-08-03
*/
@Service("sysIdentityService")
public class SysIdentityServiceImpl extends AbstractCRUDServiceImpl<SysIdentityDao, SysIdentityEntity, String> implements SysIdentityService {
@Value(value = "${sm4key}")
private String sm4key;
@Override
protected void saveBefore(SysIdentityEntity entity, Context context) throws AppException {
//非系统自增,需这里设置主键
entity.setId(IdUtil.fastSimpleUUID());
super.saveBefore(entity, context);
}
@Override
public SysIdentityEntity saveIdEntity(SysIdentityEntity entity) throws AppException {
if(StringUtils.isEmpty(entity.getIdCard())){
throw new AppException("身份证号不能为空");
}
if(StringUtils.isEmpty(entity.getName())){
throw new AppException("身份证姓名不能为空");
}
if(!IdcardUtil.isValidCard18(entity.getIdCard())){
throw new AppException("身份证号码格式不正确");
}
//获取区域
String region = StringUtils.substring(entity.getIdCard(), 0, 6);
//获取生日
String birthday = StringUtils.substring(entity.getIdCard(), 6, 14);
//获取序列号
String serial = StringUtils.substring(entity.getIdCard(), 14, 18);
SysIdentityEntity sysIdentity = dao.findIdentity(Long.parseLong(region), Long.parseLong(birthday), serial, entity.getName(), "");
if (sysIdentity == null) {
sysIdentity = new SysIdentityEntity();
sysIdentity.setId(IdUtil.fastSimpleUUID());
sysIdentity.setPhone(entity.getPhone());
sysIdentity.setName(entity.getName());
sysIdentity.setRegion(Long.parseLong(region));
sysIdentity.setBirthday(Long.parseLong(birthday));
sysIdentity.setAse(serial);
sysIdentity.setCreateTime(new Date());
sysIdentity.setDeleted(0);
dao.insert(sysIdentity);
}else {
if(StringUtils.isNotEmpty(entity.getPhone())){
SysIdentityEntity update = new SysIdentityEntity();
update.setId(sysIdentity.getId());
update.setPhone(entity.getPhone());
dao.update(update);
sysIdentity.setPhone(entity.getPhone());
}
}
return sysIdentity;
}
@Override
public String findIdEntity(SysIdentityEntity reqVO) throws AppException {
if(StringUtils.isEmpty(reqVO.getIdCard())){
throw new AppException("身份证号不能为空");
}
if(!IdcardUtil.isValidCard18(reqVO.getIdCard())){
throw new AppException("身份证号码格式不正确");
}
//获取区域
String region = StringUtils.substring(reqVO.getIdCard(), 0, 6);
//获取生日
String birthday = StringUtils.substring(reqVO.getIdCard(), 6, 14);
//获取序列号
String serial = StringUtils.substring(reqVO.getIdCard(), 14, 18);
SysIdentityEntity sysIdentity = dao.findIdentity(Long.parseLong(region), Long.parseLong(birthday), serial, reqVO.getName(), "");
if (sysIdentity == null) {
throw new AppException("无身份数据");
}
return sysIdentity.getId();
}
@Override
public SysIdentityEntity findIdEntityDetail(String id, int type) throws AppException {
SysIdentityEntity sysIdentity = dao.findIdentity(null, null, "", "", id);
if (sysIdentity == null) {
throw new AppException("无身份数据");
}
String idCard = sysIdentity.getRegion() + sysIdentity.getBirthday() + sysIdentity.getAse();
SysIdentityEntity resVO = new SysIdentityEntity();
if (type == 0) {
resVO.setIdCard(RioUtil.encryptHex(idCard, sm4key));
resVO.setName(RioUtil.encryptHex(sysIdentity.getName(), sm4key));
resVO.setPhone(RioUtil.encryptHex(sysIdentity.getPhone(), sm4key));
} else {
resVO.setIdCard(idCard);
resVO.setName(sysIdentity.getName());
resVO.setPhone(sysIdentity.getPhone());
}
return resVO;
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.web;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.service.IUser;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.identity.model.PeopleInfoEntity;
import com.mortals.xhx.module.identity.service.PeopleInfoService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 用户信息
*
* @author zxfei
* @date 2022-08-08
*/
@RestController
@RequestMapping("people/info")
public class PeopleInfoController extends BaseCRUDJsonBodyMappingController<PeopleInfoService,PeopleInfoEntity,Long> {
@Autowired
private ParamService paramService;
public PeopleInfoController(){
super.setModuleDesc( "用户信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
@PostMapping({"save"})
@RepeatSubmit
@UnAuth
public String save(@RequestBody PeopleInfoEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
int code = 1;
String busiDesc = "保存" + this.getModuleDesc();
try {
this.saveBefore(entity, model, context);
IUser user;
if (entity.newEntity()) {
busiDesc = "新增" + this.getModuleDesc();
entity.setCreateTime(new Date());
entity.setUpdateTime(entity.getCreateTime());
user = this.getCurUser();
if (user != null) {
entity.setCreateUserId(user.getId());
entity.setCreateUser(user.getLoginName());
entity.setCreateUserName(user.getRealName());
entity.setCreateUserDeptId(user.getDeptId());
entity.setCreateUserDeptName(user.getDeptName());
entity.setUpdateUserId(user.getId());
entity.setUpdateUser(user.getLoginName());
entity.setUpdateUserName(user.getRealName());
entity.setUpdateUserDeptId(user.getDeptId());
entity.setUpdateUserDeptName(user.getDeptName());
}
this.service.save(entity, context);
} else {
busiDesc = "修改" + this.getModuleDesc();
entity.setUpdateTime(new Date());
user = this.getCurUser();
if (user != null) {
entity.setUpdateUserId(user.getId());
entity.setUpdateUser(user.getLoginName());
entity.setUpdateUserName(user.getRealName());
entity.setUpdateUserDeptId(user.getDeptId());
entity.setUpdateUserDeptName(user.getDeptName());
}
this.service.update(entity, context);
}
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var7) {
this.doException(this.request, busiDesc, model, var7);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var7);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
@PostMapping({"findIdEntity"})
@UnAuth
public String findIdEntity(@RequestBody PeopleInfoEntity entity) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "获取基础信息";
Context context = this.getContext();
try {
PeopleInfoEntity peopleInfo = service.findPeopleInfo(entity);
model.put("data",peopleInfo);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.identity.model.SysFaceEntity;
import com.mortals.xhx.module.identity.model.vo.FaceInfoResVO;
import com.mortals.xhx.module.identity.service.SysFaceService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* 人脸识别信息
*
* @author zxfei
* @date 2022-08-03
*/
@RestController
@RequestMapping("face")
public class SysFaceController extends BaseCRUDJsonBodyMappingController<SysFaceService,SysFaceEntity,String> {
public SysFaceController(){
super.setModuleDesc( "人脸识别信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
@PostMapping({"uploadImage"})
@UnAuth
public String uploadImage(@RequestPart("file") MultipartFile file,
@RequestParam("name") String name,
@RequestParam("idCard") String idCard,
@RequestParam(value = "placeId") String placeId,
@RequestParam(value = "placeName") String placeName) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "人脸特征解析";
Context context = this.getContext();
try {
FaceInfoResVO resVO = service.uploadImage(file, name, idCard, placeId, placeName);
model.put("data",resVO);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@GetMapping({"findFaceList"})
@UnAuth
public String findFaceList(@RequestParam("placeId") String placeId) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "下发人脸列表";
Context context = this.getContext();
try {
List<FaceInfoResVO> list = service.findFaceList(placeId);
model.put("data",list);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@PostMapping({"batchAddFace"})
@UnAuth
public String batchAddFace(@RequestPart("files") List<MultipartFile> files,
@RequestParam("placeId") String placeId,
@RequestParam("placeName") String placeName) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "批量上传人脸";
Context context = this.getContext();
try {
service.batchAddFace(files, placeId, placeName);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", null);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@PostMapping({"search"})
@UnAuth
public String search(@RequestPart("file") MultipartFile file) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "人脸识别";
Context context = this.getContext();
try {
List<FaceInfoResVO> list = service.searchUserByFace(file.getBytes());
model.put("data",list);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.module.identity.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.identity.model.SysIdentityEntity;
import com.mortals.xhx.module.identity.service.SysIdentityService;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
*
* 人员身份信息
*
* @author zxfei
* @date 2022-08-03
*/
@RestController
@RequestMapping("identity")
public class SysIdentityController extends BaseCRUDJsonBodyMappingController<SysIdentityService,SysIdentityEntity,String> {
public SysIdentityController(){
super.setModuleDesc( "人员身份信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
@PostMapping({"saveIdEntity"})
@RepeatSubmit
@UnAuth
public String save(@RequestBody SysIdentityEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
int code = 1;
String busiDesc = "保存人员身份信息";
try {
entity = this.service.saveIdEntity(entity);
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var7) {
this.doException(this.request, busiDesc, model, var7);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var7);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
@PostMapping({"findIdEntity"})
@UnAuth
public String findIdEntity(@RequestBody SysIdentityEntity entity) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "获取基础信息唯一ID";
Context context = this.getContext();
try {
String id = service.findIdEntity(entity);
model.put("data",id);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@RequestMapping(value = {"findIdEntityDetail"},method = {RequestMethod.POST, RequestMethod.GET})
@UnAuth
public String findIdEntityDetail(@RequestParam("id") String id) {
Map<String, Object> model = new HashMap();
if (StringUtils.isEmpty(id)) {
return this.createFailJsonResp("请选择待查看人员身份信息");
} else {
JSONObject ret = new JSONObject();
String busiDesc = "获取身份证详细信息";
Context context = this.getContext();
try {
SysIdentityEntity entity = this.service.findIdEntityDetail(id, 1);
if (entity == null) {
throw new Exception(busiDesc + ",不存在或已被删除");
}
model.putAll(model);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
}
\ No newline at end of file
...@@ -1325,9 +1325,9 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter ...@@ -1325,9 +1325,9 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
//由于附件连接有效性,强制更新材料属性与附件地址 //由于附件连接有效性,强制更新材料属性与附件地址
saveDatumInfo(matterEntity, context, dom, sqclInfoSetting); saveDatumInfo(matterEntity, context, dom, sqclInfoSetting);
if (matterEditionLocal >= matterEditionRemote) { /* if (matterEditionLocal >= matterEditionRemote) {
return Rest.fail("本地事项版本大于等于远端,不需要更新!"); return Rest.fail("本地事项版本大于等于远端,不需要更新!");
} }*/
// log.info("更新详细事项==>{},id===>{},localVersion===>{},newVersion==>{}", matterEntity.getMatterName(),matterEntity.getId(),matterEntity.getMatterEdition(), matterEditionRemote); // log.info("更新详细事项==>{},id===>{},localVersion===>{},newVersion==>{}", matterEntity.getMatterName(),matterEntity.getId(),matterEntity.getMatterEdition(), matterEditionRemote);
//更新部门信息 //更新部门信息
......
...@@ -11,3 +11,4 @@ application: ...@@ -11,3 +11,4 @@ application:
...@@ -46,7 +46,5 @@ application: ...@@ -46,7 +46,5 @@ application:
auth: auth:
unloginUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/assessment/* unloginUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/assessment/*
uncheckUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/assessment/* uncheckUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/assessment/*
dm:
enable: true
jsonCheck: @profiles.req.json.check@ jsonCheck: @profiles.req.json.check@
trustedReferer : @profiles.trustedReferer@ trustedReferer : @profiles.trustedReferer@
\ No newline at end of file
...@@ -22,11 +22,5 @@ ...@@ -22,11 +22,5 @@
<property name="showSql" value="false" /> <property name="showSql" value="false" />
</plugin> </plugin>
<!--
<plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor">
<property name="showSql" value="false" />
</plugin>
-->
</plugins> </plugins>
</configuration> </configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.identity.dao.ibatis.SysIdentityDaoImpl">
<select id="findIdentity" resultMap="SysIdentityEntity-Map">
SELECT
id,region,birthday,
AES_DECRYPT(UNHEX(ase),'${@com.mortals.xhx.common.key.Constant@MYSQL_KEY}') as ase,
name,phone,create_time,update_time
FROM mortals_sys_identity
<where>
deleted = 0
<if test="region != null">
and region = #{region}
</if>
<if test="birthday != null">
and birthday = #{birthday}
</if>
<if test="ase != null and ase != ''">
and ase = HEX(AES_ENCRYPT(#{ase},'${@com.mortals.xhx.common.key.Constant@MYSQL_KEY}'))
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="id != null and id != ''">
and id = #{id}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
...@@ -146,7 +146,7 @@ POST {{baseUrl}}/site/syncGovMatterBySiteId ...@@ -146,7 +146,7 @@ POST {{baseUrl}}/site/syncGovMatterBySiteId
Content-Type: application/json Content-Type: application/json
{ {
"id":72 "id":8
} }
......
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