parent
86254acc19
commit
bcfd66f339
|
|
@ -166,6 +166,29 @@ public class UserController {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件 返回文件路径
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "uploadFile", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxRes uploadFile(HttpServletRequest request){
|
||||
StandardMultipartHttpServletRequest req = (StandardMultipartHttpServletRequest) request;
|
||||
String photoType = req.getParameter("photoType");
|
||||
AttachmentService as = new AttachmentService();
|
||||
HashMap<String, Object> map = as.uploadFile(req);
|
||||
List<MultipartFile> items = (List<MultipartFile>) map.get("filePath");
|
||||
for (int i = 0; i < items.size();) {
|
||||
MultipartFile item = items.get(i);
|
||||
as = new AttachmentService();
|
||||
return as.saveFile(request, item, photoType);
|
||||
}
|
||||
AjaxRes res = new AjaxRes();
|
||||
res.setFailMsg("fail");
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传app崩溃日志
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.springframework.web.multipart.support.StandardMultipartHttpServletReq
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -21,7 +22,7 @@ import java.util.List;
|
|||
public class AttachmentService {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(AttachmentService.class);
|
||||
|
||||
|
||||
public HashMap<String, Object> uploadFile(StandardMultipartHttpServletRequest request) {
|
||||
MultipartFile multipartFile;
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
|
@ -61,7 +62,7 @@ public class AttachmentService {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public boolean savePhoto(HttpServletRequest request, MultipartFile multipartFile, String photoType) throws Exception {
|
||||
// 完整路径 IE
|
||||
String tmpName = multipartFile.getOriginalFilename();
|
||||
|
|
@ -71,7 +72,7 @@ public class AttachmentService {
|
|||
}
|
||||
tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1);
|
||||
String imageFiles="/rdata/gz_real_name/" + photoType + "/";
|
||||
String os = System.getProperty("os.name");
|
||||
String os = System.getProperty("os.name");
|
||||
if(os.toLowerCase().startsWith(GlobalConst.STRING_WIN)){
|
||||
imageFiles="D://images/lsdPhoto/" + photoType + "/";
|
||||
}
|
||||
|
|
@ -103,6 +104,83 @@ public class AttachmentService {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准保存文件返回
|
||||
* 保存图片
|
||||
* @param request
|
||||
* @param multipartFile
|
||||
* @param photoType
|
||||
* @return
|
||||
*/
|
||||
public AjaxRes saveFile(HttpServletRequest request, MultipartFile multipartFile, String photoType) {
|
||||
AjaxRes ajaxRes = new AjaxRes();
|
||||
try {
|
||||
// 检查文件是否为空
|
||||
if (multipartFile == null || multipartFile.isEmpty()) {
|
||||
ajaxRes.setFailMsg("上传文件为空");
|
||||
return ajaxRes;
|
||||
}
|
||||
|
||||
String tmpName = multipartFile.getOriginalFilename();
|
||||
if (tmpName == null || tmpName.trim().isEmpty()) {
|
||||
ajaxRes.setFailMsg("文件名无效");
|
||||
return ajaxRes;
|
||||
}
|
||||
|
||||
// 处理 Windows 路径中的反斜杠(兼容 IE)
|
||||
tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1);
|
||||
tmpName = tmpName.substring(tmpName.lastIndexOf("/") + 1); // 兼容其他浏览器
|
||||
|
||||
// 确定基础路径
|
||||
String baseDir;
|
||||
String os = System.getProperty("os.name");
|
||||
if (os.toLowerCase().startsWith(GlobalConst.STRING_WIN)) {
|
||||
baseDir = "D://images/lsdPhoto/";
|
||||
} else {
|
||||
baseDir = "/rdata/gz_real_name/";
|
||||
}
|
||||
|
||||
// 构建完整路径:baseDir/photoType/yyyy/MM/dd/filename
|
||||
String year = DateTimeHelper.getNowYear();
|
||||
String month = DateTimeHelper.getNowMonths();
|
||||
String day = DateTimeHelper.getNowDay();
|
||||
String specfile = baseDir + photoType + "/" + year + "/" + month + "/" + day;
|
||||
File file = new File(specfile, tmpName);
|
||||
|
||||
// 创建目录
|
||||
if (!file.getParentFile().exists()) {
|
||||
if (!file.getParentFile().mkdirs()) {
|
||||
ajaxRes.setFailMsg("创建目录失败:" + file.getParentFile().getAbsolutePath());
|
||||
return ajaxRes;
|
||||
}
|
||||
}
|
||||
|
||||
// 写入文件
|
||||
try (InputStream in = multipartFile.getInputStream();
|
||||
FileOutputStream fos = new FileOutputStream(file)) {
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
ajaxRes.setFailMsg("文件写入失败: " + e.getMessage());
|
||||
return ajaxRes;
|
||||
}
|
||||
|
||||
// 成功返回:可返回保存的相对路径或文件名
|
||||
String savedPath = photoType + "/" + year + "/" + month + "/" + day + "/" + tmpName;
|
||||
ajaxRes.setSucceed(savedPath, "照片上传成功");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ajaxRes.setFailMsg("系统异常: " + e.getMessage());
|
||||
}
|
||||
return ajaxRes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String savePhotoReturnUrl(HttpServletRequest request, MultipartFile multipartFile,String photoType) throws Exception {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
package com.bonus.hnrn.rnama.person.controller;
|
||||
|
||||
|
||||
import com.bonus.hnrn.rnama.core.advice.LogAnnotation;
|
||||
import com.bonus.hnrn.rnama.core.entity.FaceContrastBean;
|
||||
import com.bonus.hnrn.rnama.core.entity.MapBean;
|
||||
import com.bonus.hnrn.rnama.core.util.Ajax;
|
||||
import com.bonus.hnrn.rnama.core.util.AjaxRes;
|
||||
import com.bonus.hnrn.rnama.core.util.DateTimeHelper;
|
||||
import com.bonus.hnrn.rnama.core.util.StringHelper;
|
||||
import com.bonus.hnrn.rnama.person.entity.*;
|
||||
import com.bonus.hnrn.rnama.person.service.PersonAttService;
|
||||
import com.bonus.hnrn.rnama.person.service.PersonIdentifyService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸是被相关接口,通过身份证调取人员相关数据
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/personIdentify")
|
||||
public class PersonIdentifyController {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(PersonIdentifyController.class);
|
||||
|
||||
@Resource(name = "PersonIdentifyService")
|
||||
private PersonIdentifyService service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 合同签订-根据身份证查询人员分包和基础信息
|
||||
*/
|
||||
@PostMapping("selectWorkerContractMsgByIdNumber")
|
||||
public AjaxRes selectWorkerContractMsgByIdNumber(WorkerBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try{
|
||||
WorkerBean o = service.selectWorkerContractMsgByIdNumber(bean);
|
||||
ar.setRes(1);
|
||||
ar.setResMsg("success");
|
||||
ar.setSucceed(o);
|
||||
} catch (Exception e) {
|
||||
ar.setRes(0);
|
||||
ar.setResMsg("error");
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员相关照片
|
||||
*/
|
||||
@PostMapping("selectWorkerPhotoByIdNumber")
|
||||
public AjaxRes selectWorkerPhotoByIdNumber(WorkerPhotoBean bean){
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try{
|
||||
WorkerPhotoBean o = service.selectWorkerPhotoByIdNumber(bean);
|
||||
ar.setRes(1);
|
||||
ar.setResMsg("success");
|
||||
ar.setSucceed(o);
|
||||
} catch (Exception e) {
|
||||
ar.setRes(0);
|
||||
ar.setResMsg("error");
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.hnrn.rnama.person.dao;
|
||||
|
||||
import com.bonus.hnrn.rnama.core.entity.*;
|
||||
import com.bonus.hnrn.rnama.person.entity.*;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository("PersonIdentifyDao")
|
||||
public interface PersonIdentifyDao {
|
||||
|
||||
WorkerBean selectWorkerContractMsgByIdNumber(WorkerBean bean);
|
||||
|
||||
WorkerPhotoBean selectWorkerPhotoByIdNumber(WorkerPhotoBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.hnrn.rnama.person.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class WorkerBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idNumber;
|
||||
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 人脸照片
|
||||
*/
|
||||
private String facePhoto;
|
||||
|
||||
/**
|
||||
* 人脸特征
|
||||
*/
|
||||
private byte[] faceFeature;
|
||||
|
||||
/**
|
||||
* 人脸特征
|
||||
*/
|
||||
private String faceFeatureStr;
|
||||
|
||||
private String subId;
|
||||
private String subName;
|
||||
|
||||
private String teamId;
|
||||
private String teamName;
|
||||
private String subAddress;
|
||||
private String represent;
|
||||
private String subPhone;
|
||||
|
||||
private String proId;
|
||||
private String proName;
|
||||
/**
|
||||
* 班组类型
|
||||
*/
|
||||
private String teamType;
|
||||
|
||||
private String postId;
|
||||
|
||||
private String postName;
|
||||
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String examineStatus;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private String isXbg;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.hnrn.rnama.person.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class WorkerPhotoBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 人员
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String examineStatus;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.hnrn.rnama.person.service;
|
||||
|
||||
import com.bonus.hnrn.rnama.core.entity.FaceContrastBean;
|
||||
import com.bonus.hnrn.rnama.core.entity.MapBean;
|
||||
import com.bonus.hnrn.rnama.core.entity.VersionNoticeBean;
|
||||
import com.bonus.hnrn.rnama.core.util.Ajax;
|
||||
import com.bonus.hnrn.rnama.core.util.AjaxRes;
|
||||
import com.bonus.hnrn.rnama.person.entity.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author bns
|
||||
*/
|
||||
public interface PersonIdentifyService {
|
||||
|
||||
/**
|
||||
* 合同签订-根据身份证查询人员分包和基础信息
|
||||
*/
|
||||
WorkerBean selectWorkerContractMsgByIdNumber(WorkerBean bean);
|
||||
/**
|
||||
* 获取人员相关照片
|
||||
*/
|
||||
WorkerPhotoBean selectWorkerPhotoByIdNumber(WorkerPhotoBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.hnrn.rnama.person.service;
|
||||
|
||||
import com.bonus.hnrn.rnama.core.entity.FaceContrastBean;
|
||||
import com.bonus.hnrn.rnama.core.entity.MapBean;
|
||||
import com.bonus.hnrn.rnama.core.entity.Page;
|
||||
import com.bonus.hnrn.rnama.core.entity.VersionNoticeBean;
|
||||
import com.bonus.hnrn.rnama.core.util.Ajax;
|
||||
import com.bonus.hnrn.rnama.core.util.AjaxRes;
|
||||
import com.bonus.hnrn.rnama.core.util.StringHelper;
|
||||
import com.bonus.hnrn.rnama.person.dao.PersonAttDao;
|
||||
import com.bonus.hnrn.rnama.person.dao.PersonIdentifyDao;
|
||||
import com.bonus.hnrn.rnama.person.entity.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service("PersonIdentifyService")
|
||||
public class PersonIdentifyServiceImpl implements PersonIdentifyService {
|
||||
|
||||
@Resource(name = "PersonIdentifyDao")
|
||||
PersonIdentifyDao dao;
|
||||
|
||||
@Override
|
||||
public WorkerBean selectWorkerContractMsgByIdNumber(WorkerBean bean) {
|
||||
return dao.selectWorkerContractMsgByIdNumber(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkerPhotoBean selectWorkerPhotoByIdNumber(WorkerPhotoBean bean) {
|
||||
return dao.selectWorkerPhotoByIdNumber(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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.hnrn.rnama.person.dao.PersonIdentifyDao">
|
||||
|
||||
<select id="selectWorkerContractMsgByIdNumber" resultType="com.bonus.hnrn.rnama.person.entity.WorkerBean">
|
||||
SELECT
|
||||
bw.`name`,
|
||||
bw.id_number,
|
||||
bw.phone,
|
||||
bw.address,
|
||||
sdd.id AS postId,
|
||||
sdd.`name` AS postName,
|
||||
bs.id AS subId,
|
||||
bs.`sub_name` AS subName,
|
||||
bs.ADDRESS AS subAddress,
|
||||
bs.represent,
|
||||
bs.RE_CONTACT AS subPhone,
|
||||
bp.id AS proId,
|
||||
bp.`name` AS proName,
|
||||
IF(xc.id IS NULL, 0, 1) AS isXbg
|
||||
FROM
|
||||
bm_worker_record bwr
|
||||
LEFT JOIN bm_worker bw ON bw.ID_NUMBER = bwr.ID_NUMBER
|
||||
LEFT JOIN bm_subcontractor bs ON bs.id = bwr.SUB_ID
|
||||
LEFT JOIN sys_dic_detail sdd ON sdd.id = bwr.POST_ID
|
||||
LEFT JOIN bm_project bp ON bp.id = bwr.PROJECT_ID
|
||||
LEFT JOIN xbg_contract xc ON xc.team_id = bwr.TEAM_ID
|
||||
AND xc.contract_status = '0'
|
||||
AND xc.del_flag = '0'
|
||||
WHERE
|
||||
bwr.ein_status = 1
|
||||
AND bwr.ID_NUMBER = #{idNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectWorkerPhotoByIdNumber" resultType="com.bonus.hnrn.rnama.person.entity.WorkerPhotoBean">
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue