Commit 3e71c559 authored by 18310373984@163.com's avatar 18310373984@163.com

护理人员页面上传人脸标准照相关功能

parent 0d2fff22
......@@ -180,8 +180,9 @@
and info.DISAB_INFO_ID not in (
select d.disab_info_id from CH_DISAB_ACCOUNTS_detail d where d.mode_name <![CDATA[ <> ]]> '异地' and to_char(d.accounts_time,'yyyy-MM') = to_char(sysdate,'yyyy-MM')
)
-- 该人员未退出,或者退出时间大于等于当月时间才需要结算金额
and (info.EXIT_TIME is null or info.EXIT_TIME = to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'))
-- 该人员未退出,或者退出时间大于异地申请时间,并且退出时间大于等于当月时间才需要结算金额
and (info.EXIT_TIME is null or (info.EXIT_TIME> info.OTHER_APPLY_TIME
and info.EXIT_TIME >= to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')))
</select>
......
......@@ -78,7 +78,23 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. -->
<!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 -->
<version>3.1.1086</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
</dependency>
......
......@@ -260,8 +260,8 @@ public class SrvOrganController {
|| null == srvOrganEmpVo.getEduId()) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
int result= srvOrganEmpService.saveOrUpdateSrvOrganEmp(srvOrganEmpVo);
return result>0?Result.failed("该护理人员已存在于系统,请勿重复录入"):Result.success();
Result result= srvOrganEmpService.saveOrUpdateSrvOrganEmp(srvOrganEmpVo);
return result;
}
......
package com.hungraim.ltc.facelocation.param;
import lombok.Data;
/**
* <pre>
* 人脸认证 参数对象
* </pre>
*
* @author mc
* @date 2021-02-05
*/
@Data
public class FaceAuthParam {
private static final long serialVersionUID = 1L;
private String name;//姓名
private String idNo;//身份证号
private String imgbase64;//人脸核身照片,base64位
private Long gender;
private String imgPath;
}
package com.hungraim.ltc.facelocation.util;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* <pre>
* 人脸认证配置文件
* </pre>
*
* @author mc
* @since 2021/4/16
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "facelocation.interface")
public class FaceAuthProperties {
private String secretId;
private String secretKey;
private String urlPath;
private String groupId;//人员库ID
private String region;
}
package com.hungraim.ltc.facelocation.util;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganEmp;
import com.tencentcloudapi.common.AbstractModel;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.iai.v20200303.IaiClient;
import com.tencentcloudapi.iai.v20200303.models.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Base64;
import com.hungraim.ltc.util.Result;
/**
* <pre>
* 人脸核身代码
* </pre>
*/
@Slf4j
@Configuration
public class FaceAuthUtil {
@Autowired
private FaceAuthProperties faceAuthProperties;
public Result<String> addFace(ChSrvOrganEmp faceAuthParam,String filePath){
try {
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey
Credential cred = new Credential(faceAuthProperties.getSecretId(), faceAuthProperties.getSecretKey());
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(faceAuthProperties.getUrlPath());
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
IaiClient client = new IaiClient(cred, faceAuthProperties.getRegion(), clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
CreatePersonRequest req = new CreatePersonRequest();
req.setGroupId(faceAuthProperties.getGroupId());
req.setPersonName(faceAuthParam.getEmpName());
req.setPersonId(faceAuthParam.getCertifNum());
if(faceAuthParam.getGender().equals("M")){
req.setGender(1l);
}else if(faceAuthParam.getGender().equals("F")){
req.setGender(2l);
}else{
req.setGender(0l);
}
req.setImage(imageToBase64(filePath));
CreatePersonResponse resp = client.CreatePerson(req);
return Result.success(resp.getFaceId());
} catch (
Exception e) {
log.error(e.toString());
return Result.failed(e.getMessage());
}
}
public String imageToBase64(String imagePath) {
String base64String = "";
File file = new File(imagePath);
try (FileInputStream fileInputStream = new FileInputStream(file)) {
byte[] bytes = new byte[(int) file.length()];
fileInputStream.read(bytes);
base64String = Base64.getEncoder().encodeToString(bytes);
} catch (IOException e) {
e.printStackTrace();
}
return base64String;
}
public Result<String> deleteFace(ChSrvOrganEmp faceAuthParam){
try {
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey
Credential cred = new Credential(faceAuthProperties.getSecretId(), faceAuthProperties.getSecretKey());
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(faceAuthProperties.getUrlPath());
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
IaiClient client = new IaiClient(cred, faceAuthProperties.getRegion(), clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DeleteFaceRequest req = new DeleteFaceRequest();
req.setPersonId(faceAuthParam.getCertifNum());
String[] faceIds1 = {faceAuthParam.getFaceId()};//人脸
req.setFaceIds(faceIds1);
// 返回的resp是一个DeleteFaceResponse的实例,与请求对象对应
DeleteFaceResponse resp = client.DeleteFace(req);
// 输出json格式的字符串回包
System.out.println(AbstractModel.toJsonString(resp));
// 输出json格式的字符串回包
return Result.success(resp.getRequestId());
} catch (Exception e) {
log.error(e.toString());
return Result.failed(e.getMessage());
}
}
}
......@@ -65,7 +65,7 @@ public interface SrvOrganEmpService {
* eduId: "", // 文化水平
* fileDataList: [], // 对应数据库中的文件数据列表
*/
int saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo);
Result saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo);
Workbook srvOrganExport(Long organId,Long srvOrganId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Short isLock, Short empType);
......
......@@ -3,11 +3,13 @@ package com.hungraim.ltc.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*;
import com.hungraim.ltc.facelocation.util.FaceAuthUtil;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.account.ChDisabDetailAccounts;
import com.hungraim.ltc.pojo.entity.disable.ChCfgSrvEmpType;
......@@ -29,6 +31,7 @@ import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -65,6 +68,7 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
private final ChSrvTaskDetailDeleteMapper chSrvTaskDetailDeleteMapper;
private final FaceAuthUtil faceAuthUtil;
@Override
......@@ -111,11 +115,16 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
BeanUtils.copyProperties(chSrvOrganEmp, srvOrganEmpVo);
srvOrganEmpVo.setUnifiedSocialCreditCode(chSrvOrgan.getUnifiedSocialCreditCode());
try {
Result<List<ChFndAttach>> listResult = attachFeignService.selectAttachs(empId, AttachType.SRV_ORGAN_EMP.getUploadType());
/*Result<List<ChFndAttach>> listResult = attachFeignService.selectAttachs(empId, AttachType.SRV_ORGAN_EMP.getUploadType());
if (ResultCode.SUCCESS.getCode().equals(listResult.getCode())) {
srvOrganEmpVo.setFileDataList(listResult.getData());
} else {
log.error("请求获取护理人员上传文件出错,出错信息:{}", listResult.getMsg());
}*/
//获取护理人员上传的标准照片
Result<List<ChFndAttach>> photoList = attachFeignService.selectAttachs(empId, AttachType.SRV_EMP_Photo.getUploadType());
if (ResultCode.SUCCESS.getCode().equals(photoList.getCode())) {
srvOrganEmpVo.setPhotoList(photoList.getData());
}
} catch (Exception e) {
log.error("请求获取护理人员上传文件出错,出错信息:{}", e.getMessage());
......@@ -125,7 +134,7 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
@Transactional(rollbackFor = Exception.class)
@Override
public int saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo) {
public Result saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo) {
Long empId = srvOrganEmpVo.getEmpId();
ChSrvOrganEmp chSrvOrganEmp = new ChSrvOrganEmp();
BeanUtils.copyProperties(srvOrganEmpVo, chSrvOrganEmp);
......@@ -136,12 +145,14 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
queryWrapper.eq("IS_LOCK",0);
queryResult = chSrvOrganEmpMapper.selectCount(queryWrapper);
if(queryResult>0){
return queryResult;
return Result.failed("该护理人员已存在于系统,请勿重复录入");
}
// 新增
chSrvOrganEmp.setEffTime(new Date());
chSrvOrganEmp.setIsLock((short) 0);
chSrvOrganEmp.setEmpPwd("ch123456");
chSrvOrganEmpMapper.insert(chSrvOrganEmp);
updateAttachs(srvOrganEmpVo, chSrvOrganEmp.getEmpId());
......@@ -151,24 +162,76 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
chSrvempRiskLevel.setStatus(0);
chSrvempRiskLevel.setFcd(new Date());
chSrvempRiskLevelMapper.insert(chSrvempRiskLevel);
Result<String > faceReult=updatePhotoAttachs(srvOrganEmpVo,chSrvOrganEmp);//上传标准照
if (StrUtil.equals(faceReult.getCode(), ResultCode.SUCCESS.getCode())) {
chSrvOrganEmp.setFaceId(faceReult.getData());//腾讯云人脸库Id
chSrvOrganEmpMapper.updateById(chSrvOrganEmp);//更新护理人员信息
}else{
throw new RuntimeException(faceReult.getMsg());//人脸库上传失败,页面显示错误信息
}
} else {
// 修改
chSrvOrganEmpMapper.updateById(chSrvOrganEmp);
updateAttachs(srvOrganEmpVo, empId);
//上传标准照保存到人脸库
Result<String > faceReult=updatePhotoAttachs(srvOrganEmpVo,chSrvOrganEmp);
String faceId = faceReult.getData();//上传标准照
chSrvOrganEmp.setFaceId(faceId);
chSrvOrganEmpMapper.updateById(chSrvOrganEmp);
if (!StrUtil.equals(faceReult.getCode(), ResultCode.SUCCESS.getCode())) {
throw new RuntimeException(faceReult.getMsg());//人脸库上传失败,页面显示错误信息
}
}
return queryResult;
return Result.success();
}
// 抽取方法
private void updateAttachs(SrvOrganEmpVo srvOrganEmpVo, Long empId) {
private void updateAttachs(SrvOrganEmpVo srvOrganEmpVo, Long empId) {
AttachUpdateVo attachUpdateVo = new AttachUpdateVo();
attachUpdateVo.setChFndAttachs(srvOrganEmpVo.getFileDataList());
attachUpdateVo.setCtrlId(empId);
attachUpdateVo.setAttachType(AttachType.SRV_ORGAN_EMP.getUploadType());
attachFeignService.updateAttachs(attachUpdateVo);
}
}
//保存到本地及人脸库
private Result<String> updatePhotoAttachs(SrvOrganEmpVo srvOrganEmpVo, ChSrvOrganEmp chSrvOrganEmp) {
if(srvOrganEmpVo.getPhotoList().size()>0) {
//修改标准照
AttachUpdateVo attachPhotoUpdateVo = new AttachUpdateVo();
attachPhotoUpdateVo.setChFndAttachs(srvOrganEmpVo.getPhotoList());
attachPhotoUpdateVo.setCtrlId(chSrvOrganEmp.getEmpId());
attachPhotoUpdateVo.setAttachType(AttachType.SRV_EMP_Photo.getUploadType());
attachFeignService.updateAttachs(attachPhotoUpdateVo);
for(int i=0;i<srvOrganEmpVo.getPhotoList().size();i++) {
ChFndAttach chFndAttach=srvOrganEmpVo.getPhotoList().get(i);
if(StringUtils.isEmpty(chFndAttach.getFilePath())){
chFndAttach=attachFeignService.selectAttachById(chFndAttach.getAttachId()).getData();
}
if(StringUtils.isNotEmpty(chSrvOrganEmp.getFaceId())) {
//先删除人员信息
Result<String> delresult = faceAuthUtil.deleteFace(chSrvOrganEmp);
log.info("删除人脸信息:" + delresult);
Result addResult=faceAuthUtil.addFace(srvOrganEmpVo, chFndAttach.getFilePath());
log.info("新增人脸信息:" + addResult);
return addResult;
}else{
//在新增人员信息
Result addResult=faceAuthUtil.addFace(srvOrganEmpVo, chFndAttach.getFilePath());
log.info("新增人脸信息:"+addResult);
return addResult;
}
}
}
return Result.success();
}
@Override
public Workbook srvOrganExport(Long organId,Long srvOrganId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Short isLock, Short empType) {
......
......@@ -48,7 +48,9 @@ public class ChFndAttach implements Serializable {
private Long ctrlId;
/**
* 附件类型(1:失能人员附件;2:鉴定任务附件;3:服务方案附件;4:稽核巡查;5:护理机构基金结算申请新增;6:无锡长护保险自评申请;7:失能信息变更附件;8:评估结论书;9:参保人员及家属;10:评定人员1;11:评定人员2;12:鉴定机构附件;13:护理机构附件;14:鉴定人员附件;15:护理人员附件 16-护理人员服务项目结束附件,17:建床,18:撤床)
* 附件类型(1:失能人员附件;2:鉴定任务附件;3:服务方案附件;4:稽核巡查;5:护理机构基金结算申请新增;6:无锡长护保险自评申请;
* 7:失能信息变更附件;8:评估结论书;9:参保人员及家属;10:评定人员1;11:评定人员2;12:鉴定机构附件;13:护理机构附件;14:鉴定人员附件;
* 15:护理人员附件 16-护理人员服务项目结束附件,17:建床,18:撤床 21:护理人员标准照)
*/
private Short attachType;
......
......@@ -180,4 +180,8 @@ public class ChSrvOrganEmp implements Serializable {
private static final long serialVersionUID = 1L;
//腾讯云人脸库faceId
private String faceId;
}
\ No newline at end of file
......@@ -17,5 +17,8 @@ public class SrvOrganEmpVo extends ChSrvOrganEmp {
/**
* 文件列表数据对象
*/
private List<ChFndAttach> fileDataList;
private List<ChFndAttach> fileDataList;
//标准照片
private List<ChFndAttach> photoList;
}
......@@ -12,7 +12,8 @@ public enum AttachType {
/**
* 附件类型(1:失能人员附件;2:鉴定任务附件;3:服务方案附件;4:稽核巡查;5:护理机构基金结算申请新增;6:无锡长护保险自评申请;7:失能信息变更附件;
* 8:评估结论书;9:参保人员及家属;10:评定人员1;11:评定人员2;12:鉴定机构附件;13:护理机构附件;14:鉴定人员附件;15:护理人员附件 16-护理人员服务项目结束附件,17:建床,18:撤床;19:护理机构结算附件;20:护理人员结算附件;)
* 8:评估结论书;9:参保人员及家属;10:评定人员1;11:评定人员2;12:鉴定机构附件;13:护理机构附件;14:鉴定人员附件;15:护理人员附件 16-护理人员服务项目结束附件,17:建床,18:撤床;
* 19:护理机构结算附件;20:护理人员结算附件;21:护理人员标准照)
*/
/**
* 1:失能人员附件;
......@@ -80,7 +81,13 @@ public enum AttachType {
/**
* 19:护理人员结算附件;
*/
SRV_EMP_ACCOUNT((short) 20);
SRV_EMP_ACCOUNT((short) 20),
SRV_EMP_Photo((short) 21);
/**
* 21:护理人员标准照;
*/
private Short uploadType;
......
......@@ -104,4 +104,13 @@ public class FileUploadController {
}
}
@GetMapping("/selectAttachById")
Result<ChFndAttach> selectAttachById(Long attachId) {
if (null == attachId || 0 == attachId || null == attachId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
ChFndAttach chFndAttache = attachService.selectById(attachId);
return Result.success(chFndAttache);
}
}
......@@ -38,4 +38,8 @@ public interface AttachFeignService {
*/
@GetMapping("/api.system/resource/attachs")
Result<List<ChFndAttach>> selectAttachs(@RequestParam("ctrlId") Long ctrlId, @RequestParam("attachType") Short attachType);
@GetMapping("/api.system/resource/selectAttachById")
Result<ChFndAttach> selectAttachById(@RequestParam("attachId") Long attachId);
}
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