Commit 21c97569 authored by hongguangwu's avatar hongguangwu

MVP1.7.0 utildate改为sqldate

parent 82db8910
...@@ -113,11 +113,14 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -113,11 +113,14 @@ public class TEmployeeInfo extends BaseEntity {
/** /**
* 出生日期 * 出生日期
* Error attempting to get column 'EMP_BIRTHDAY' from result set. Cause: java.sql.SQLException: HOUR_OF_DAY
* 因为夏令时引起的。只有1940-06-03、1941-03-16、1986-05-04、1987-04-12、1988-04-10、1989-04-16、1990-04-15、1991-04-14几个时间会有如上错误抛出
* https://blog.csdn.net/weixin_51906670/article/details/130556793
*/ */
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyy-MM-dd")
@Schema(description = "出生日期") @Schema(description = "出生日期")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date empBirthday; private java.sql.Date empBirthday;
/** /**
* 年龄 * 年龄
......
...@@ -35,10 +35,10 @@ public class IdCardUtil { ...@@ -35,10 +35,10 @@ public class IdCardUtil {
* @param idNum * @param idNum
* @return * @return
*/ */
public static Date getBirthdate(String idNum){ public static java.sql.Date getBirthdate(String idNum){
Pattern idNumPattern = null; Pattern idNumPattern = null;
Matcher idNumMatcher = null; Matcher idNumMatcher = null;
Date date = null; java.sql.Date date = null;
//定义判别用户身份证号的正则表达式(要么是15位,要么是18位,最后一位可以为字母) //定义判别用户身份证号的正则表达式(要么是15位,要么是18位,最后一位可以为字母)
idNumPattern = compile("(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])"); idNumPattern = compile("(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])");
//通过Pattern获得Matcher //通过Pattern获得Matcher
...@@ -70,13 +70,13 @@ public class IdCardUtil { ...@@ -70,13 +70,13 @@ public class IdCardUtil {
String datetemp = birthDateMather.group(3); String datetemp = birthDateMather.group(3);
String dateStr =year+"-"+month+"-"+datetemp; String dateStr =year+"-"+month+"-"+datetemp;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" ); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
Date shijian = null; Date shijian = null;
try { try {
shijian =sdf.parse(dateStr); shijian =sdf.parse(dateStr);
String temp = sdf.format(shijian); String temp = sdf.format(shijian);
if(dateStr.equals(temp)){ if(dateStr.equals(temp)){
//输出用户的出生年月日 //输出用户的出生年月日
date = shijian; date = new java.sql.Date(shijian.getTime());
} }
} catch (ParseException e) { } catch (ParseException e) {
//数据有误 //数据有误
......
...@@ -70,7 +70,7 @@ public class EmployeeBusinessVo { ...@@ -70,7 +70,7 @@ public class EmployeeBusinessVo {
*/ */
@ExcelAttribute(name = "出生日期",isDate =true ,dateFormat = DateUtil.ISO_EXPANDED_DATE_FORMAT) @ExcelAttribute(name = "出生日期",isDate =true ,dateFormat = DateUtil.ISO_EXPANDED_DATE_FORMAT)
@Schema(description = "出生日期", name = "empBirthday") @Schema(description = "出生日期", name = "empBirthday")
private Date empBirthday; private java.sql.Date empBirthday;
/** /**
* 民族 * 民族
*/ */
......
...@@ -521,6 +521,13 @@ public class TEmployeeInfoController { ...@@ -521,6 +521,13 @@ public class TEmployeeInfoController {
return tEmployeeInfoService.getHcmEmpInfo(idCard); return tEmployeeInfoService.getHcmEmpInfo(idCard);
} }
@Operation(description = "测试异常数据使用接口")
@SysLog("测试异常数据使用接口")
@PostMapping("/getListByDeptIdByLimit")
public List<TEmployeeInfo> getListByDeptIdByLimit(@RequestParam String deptId,@RequestParam Integer limit1, @RequestParam Integer limit2) {
return tEmployeeInfoService.getListByDeptIdByLimit(deptId, limit1,limit2);
}
/** /**
* @param idCardList * @param idCardList
* @Description: HCM获取人员信息列表 * @Description: HCM获取人员信息列表
......
...@@ -50,6 +50,7 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> { ...@@ -50,6 +50,7 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
// 批量更新使用,按项目查询人员信息 // 批量更新使用,按项目查询人员信息
List<TEmployeeInfo> getListByDeptId(@Param("deptId") String deptId); List<TEmployeeInfo> getListByDeptId(@Param("deptId") String deptId);
List<TEmployeeInfo> getListByDeptIdByLimit(@Param("deptId") String deptId, @Param("limit1") Integer limit1, @Param("limit2") Integer limit2);
// hgw 2022-6-22 15:32:39 根据身份证查询一批档案 // hgw 2022-6-22 15:32:39 根据身份证查询一批档案
List<TEmployeeInfo> getListByIdCard(@Param("idCardList") List<String> idCardList); List<TEmployeeInfo> getListByIdCard(@Param("idCardList") List<String> idCardList);
......
...@@ -268,4 +268,6 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -268,4 +268,6 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
// 预入职批量导入使用 // 预入职批量导入使用
List<TEmployeeInfo> getListByIdCardList(List<String> idList); List<TEmployeeInfo> getListByIdCardList(List<String> idList);
List<TEmployeeInfo> getListByDeptIdByLimit(String deptId, Integer limit1, Integer limit2);
} }
...@@ -332,7 +332,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -332,7 +332,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
newEmployeeInfo.setCreateName(fddContractAttachInfo.getCreateName()); newEmployeeInfo.setCreateName(fddContractAttachInfo.getCreateName());
newEmployeeInfo.setUpdateBy(fddContractAttachInfo.getUpdateBy()); newEmployeeInfo.setUpdateBy(fddContractAttachInfo.getUpdateBy());
newEmployeeInfo.setContractStatus(CommonConstants.ONE_INT); newEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard()); java.sql.Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard());
if (null != date) { if (null != date) {
//初始化年龄 //初始化年龄
......
...@@ -76,6 +76,7 @@ import org.springframework.http.HttpHeaders; ...@@ -76,6 +76,7 @@ import org.springframework.http.HttpHeaders;
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.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.yifu.cloud.plus.v1.yifu.archives.util.IdCardUtil;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -978,9 +979,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -978,9 +979,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(idCard) && Common.isEmpty(employeeInfo.getEmpSex()) && idCard.length() > 14) { if (Common.isNotNull(idCard) && Common.isEmpty(employeeInfo.getEmpSex()) && idCard.length() > 14) {
// 出生日期 // 出生日期
String idCardDate = idCard.substring(6, 14); java.sql.Date date = IdCardUtil.getBirthdate(idCard);
Date empBirthday = DateUtil.stringToDateByPatten(idCardDate, "yyyyMMdd"); employeeInfo.setEmpBirthday(date);
employeeInfo.setEmpBirthday(empBirthday);
// 性别 // 性别
if (idCard.length() > 17) { if (idCard.length() > 17) {
...@@ -2683,7 +2683,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -2683,7 +2683,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(empAddsMap)) { if (Common.isNotNull(empAddsMap)) {
EmpAddDispatchVo empAdd; EmpAddDispatchVo empAdd;
TEmployeeInfo employeeInfo; TEmployeeInfo employeeInfo;
Date date; java.sql.Date date;
for (Map.Entry<String, EmpAddDispatchVo> entry : empAddsMap.entrySet()) { for (Map.Entry<String, EmpAddDispatchVo> entry : empAddsMap.entrySet()) {
empAdd = entry.getValue(); empAdd = entry.getValue();
try { try {
...@@ -3142,13 +3142,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -3142,13 +3142,13 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
pairsIdCard.put("身份证开始日期", CommonConstants.ZERO_INT); pairsIdCard.put("身份证开始日期", CommonConstants.ZERO_INT);
pairsIdCard.put("身份证截止日期", CommonConstants.ZERO_INT); pairsIdCard.put("身份证截止日期", CommonConstants.ZERO_INT);
Map<String, Integer> pairsHuJi = new HashMap<>(); Map<String, Integer> pairsHuJi = new HashMap<>();
pairsHuJi.put("户籍所在省", CommonConstants.ZERO_INT); pairsHuJi.put("户籍所在地-省", CommonConstants.ZERO_INT);
pairsHuJi.put("户籍所在市", CommonConstants.ZERO_INT); pairsHuJi.put("户籍所在地-市", CommonConstants.ZERO_INT);
pairsHuJi.put("户籍所在县", CommonConstants.ZERO_INT); pairsHuJi.put("户籍所在地-区/县", CommonConstants.ZERO_INT);
Map<String, Integer> pairsDang = new HashMap<>(); Map<String, Integer> pairsDang = new HashMap<>();
pairsDang.put("档案所在省", CommonConstants.ZERO_INT); pairsDang.put("档案所在地-省", CommonConstants.ZERO_INT);
pairsDang.put("档案所在市", CommonConstants.ZERO_INT); pairsDang.put("档案所在地-市", CommonConstants.ZERO_INT);
pairsDang.put("档案所在县", CommonConstants.ZERO_INT); pairsDang.put("档案所在地-区/县", CommonConstants.ZERO_INT);
Map<String, Integer> pairsTong = new HashMap<>(); Map<String, Integer> pairsTong = new HashMap<>();
pairsTong.put("通信地址-省", CommonConstants.ZERO_INT); pairsTong.put("通信地址-省", CommonConstants.ZERO_INT);
pairsTong.put("通信地址-市", CommonConstants.ZERO_INT); pairsTong.put("通信地址-市", CommonConstants.ZERO_INT);
...@@ -3769,6 +3769,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -3769,6 +3769,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return preMap; return preMap;
} }
@Override
public List<TEmployeeInfo> getListByDeptIdByLimit(String deptId, Integer limit1, Integer limit2) {
List<TEmployeeInfo> preList = baseMapper.getListByDeptIdByLimit(deptId, limit1,limit2);
return preList;
}
private Map<String, TEmpContactInfo> getTEmpContactInfoMapByDeptId(String deptId) { private Map<String, TEmpContactInfo> getTEmpContactInfoMapByDeptId(String deptId) {
Map<String, TEmpContactInfo> contactMap = new HashMap<>(); Map<String, TEmpContactInfo> contactMap = new HashMap<>();
if (Common.isNotNull(deptId)) { if (Common.isNotNull(deptId)) {
......
...@@ -773,6 +773,14 @@ ...@@ -773,6 +773,14 @@
where a.DELETE_FLAG = '0' and b.DEPT_ID = #{deptId} where a.DELETE_FLAG = '0' and b.DEPT_ID = #{deptId}
GROUP BY a.EMP_IDCARD GROUP BY a.EMP_IDCARD
</select> </select>
<select id="getListByDeptIdByLimit" resultMap="tEmployeeInfoMap">
select
<include refid="baseParam"/>
from t_employee_info a
left join t_employee_project b on a.EMP_IDCARD = b.EMP_IDCARD
where a.DELETE_FLAG = '0' and b.DEPT_ID = #{deptId}
limit #{limit1},#{limit2}
</select>
<select id="getListByIdCardList" resultMap="tEmployeeInfoMap"> <select id="getListByIdCardList" resultMap="tEmployeeInfoMap">
select select
......
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