Commit cd2937f7 authored by hongguangwu's avatar hongguangwu

人员档案相关-调用服务优化吧。。

parent 0f96a352
...@@ -23,7 +23,7 @@ import lombok.Data; ...@@ -23,7 +23,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.Max; import javax.validation.constraints.Max;
import java.util.Date; import java.time.LocalDate;
/** /**
* 员工学历信息表 * 员工学历信息表
...@@ -75,7 +75,7 @@ public class TEmpEducation extends BaseEntity { ...@@ -75,7 +75,7 @@ public class TEmpEducation extends BaseEntity {
* 入学时间 * 入学时间
*/ */
@Schema(description = "入学时间") @Schema(description = "入学时间")
private Date entryDate; private LocalDate entryDate;
/** /**
* 学历名称 * 学历名称
...@@ -88,7 +88,7 @@ public class TEmpEducation extends BaseEntity { ...@@ -88,7 +88,7 @@ public class TEmpEducation extends BaseEntity {
* 结业日期 * 结业日期
*/ */
@Schema(description = "结业日期") @Schema(description = "结业日期")
private Date gradutionDate; private LocalDate gradutionDate;
/** /**
* 学校名称 * 学校名称
......
...@@ -30,7 +30,6 @@ import javax.validation.constraints.NotNull; ...@@ -30,7 +30,6 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -63,15 +62,15 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -63,15 +62,15 @@ public class TEmployeeInfo extends BaseEntity {
* 员工类型(字典值,0外包1派遣2代理) * 员工类型(字典值,0外包1派遣2代理)
*/ */
@Schema(description = "员工类型(字典值,0外包1派遣2代理)") @Schema(description = "员工类型(字典值,0外包1派遣2代理)")
@NotNull( message = "员工类型不可为空") @NotNull(message = "员工类型不可为空")
@Size(max = 1, message = "员工类型不可超过1位") @Size(max = 1, message = "员工类型不可超过1位")
private String empNatrue; private String empNatrue;
/** /**
* 员工姓名 * 员工姓名
*/ */
@Schema(description = "员工姓名") @Schema(description = "员工姓名")
@NotNull( message = "员工姓名不可为空") @NotNull(message = "员工姓名不可为空")
@Size(max = 20, message = "员工姓名不可超过20位") @Size(max = 20, message = "员工姓名不可超过20位")
private String empName; private String empName;
...@@ -79,7 +78,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -79,7 +78,7 @@ public class TEmployeeInfo extends BaseEntity {
* 身份证号码 * 身份证号码
*/ */
@Schema(description = "身份证号码") @Schema(description = "身份证号码")
@NotNull( message = "身份证号码不可为空") @NotNull(message = "身份证号码不可为空")
@Size(max = 20, message = "身份证号码不可超过20位") @Size(max = 20, message = "身份证号码不可超过20位")
private String empIdcard; private String empIdcard;
...@@ -144,8 +143,8 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -144,8 +143,8 @@ public class TEmployeeInfo extends BaseEntity {
* 手机号码 * 手机号码
*/ */
@Schema(description = "手机号码") @Schema(description = "手机号码")
@NotNull( message = "手机号码不可为空") @NotNull(message = "手机号码不可为空")
@Size(max = 11,min = 11, message = "手机号码只能11位") @Size(max = 11, min = 11, message = "手机号码只能11位")
private String empPhone; private String empPhone;
/** /**
...@@ -218,13 +217,13 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -218,13 +217,13 @@ public class TEmployeeInfo extends BaseEntity {
* 入学时间 * 入学时间
*/ */
@Schema(description = "入学时间") @Schema(description = "入学时间")
private Date admissionDate; private LocalDate admissionDate;
/** /**
* 毕业时间 * 毕业时间
*/ */
@Schema(description = "毕业时间") @Schema(description = "毕业时间")
private Date gradutionDate; private LocalDate gradutionDate;
/** /**
* 备注 * 备注
......
...@@ -24,7 +24,6 @@ import javax.validation.constraints.NotNull; ...@@ -24,7 +24,6 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date;
/** /**
* 项目档案表excel对应的实体 * 项目档案表excel对应的实体
...@@ -190,13 +189,13 @@ public class EmployeeVO implements Serializable { ...@@ -190,13 +189,13 @@ public class EmployeeVO implements Serializable {
* 入学时间 * 入学时间
*/ */
@ExcelProperty(value = "入学时间") @ExcelProperty(value = "入学时间")
private Date admissionDate; private LocalDate admissionDate;
/** /**
* 毕业时间 * 毕业时间
*/ */
@ExcelProperty(value = "毕业时间") @ExcelProperty(value = "毕业时间")
private Date gradutionDate; private LocalDate gradutionDate;
/** /**
* 备注 * 备注
......
...@@ -508,13 +508,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -508,13 +508,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return R.failed("该手机号已被使用!"); return R.failed("该手机号已被使用!");
} }
// 调用校验服务-校验手机号 // 调用校验服务-校验手机号
R<Map<String, TCheckMobile>> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId() R<Boolean> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkMobiles", employeeInfo.getEmpPhone(), TCheckMobile.class, SecurityConstants.FROM_IN); , "/tcheckmobile/inner/checkOneMobile", employeeInfo.getEmpPhone(), Boolean.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) { if (checkMobileR != null && checkMobileR.getData() != null) {
for (TCheckMobile checkMobile : checkMobileR.getData().values()) { if (Boolean.FALSE.equals(checkMobileR.getData())) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) { return R.failed("手机号校验错误!");
return R.failed("手机号校验错误!");
}
} }
} }
} }
...@@ -759,14 +757,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -759,14 +757,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard()));
} }
} else { } else {
R<Map<String, TCheckMobile>> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId() R<Boolean> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkMobiles", excel.getEmpPhone(), TCheckMobile.class, SecurityConstants.FROM_IN); , "/tcheckmobile/inner/checkOneMobile", excel.getEmpPhone(), Boolean.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) { if (checkMobileR != null && checkMobileR.getData() != null) {
for (TCheckMobile check : checkMobileR.getData().values()) { if (Boolean.FALSE.equals(checkMobileR.getData())) {
if (!CommonConstants.ONE_STRING.equals(check.getStatus())) { errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
break;
}
} }
} }
} }
...@@ -1131,14 +1126,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1131,14 +1126,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard()));
} }
} else { } else {
R<Map<String, TCheckMobile>> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId() R<Boolean> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkMobiles", excel.getEmpPhone(), TCheckMobile.class, SecurityConstants.FROM_IN); , "/tcheckmobile/inner/checkOneMobile", excel.getEmpPhone(), Boolean.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) { if (checkMobileR != null && checkMobileR.getData() != null) {
for (TCheckMobile check : checkMobileR.getData().values()) { if (Boolean.FALSE.equals(checkMobileR.getData())) {
if (!CommonConstants.ONE_STRING.equals(check.getStatus())) { errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
break;
}
} }
} }
} }
......
...@@ -138,4 +138,18 @@ public class TCheckMobileController { ...@@ -138,4 +138,18 @@ public class TCheckMobileController {
return tCheckMobileService.checkMobiles(mobiles); return tCheckMobileService.checkMobiles(mobiles);
} }
/**
* @Description: 单个检测手机号
* @Author: hgw
* @Date: 2022/6/29 15:08
* @return: boolean
**/
@Operation(description = "单个检测手机号,仅支持国内号码")
@SysLog("单个检测手机号状态" )
@Inner
@GetMapping("/inner/checkOneMobile" )
public boolean checkOneMobile(String mobile) {
return tCheckMobileService.checkOneMobile(mobile);
}
} }
...@@ -32,4 +32,6 @@ import java.util.Map; ...@@ -32,4 +32,6 @@ import java.util.Map;
public interface TCheckMobileService extends IService<TCheckMobile> { public interface TCheckMobileService extends IService<TCheckMobile> {
R<Map<String,TCheckMobile>> checkMobiles(String mobiles); R<Map<String,TCheckMobile>> checkMobiles(String mobiles);
boolean checkOneMobile(String mobile);
} }
...@@ -52,64 +52,98 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh ...@@ -52,64 +52,98 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
* @Author fxj * @Author fxj
* @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割 * @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割
* @Date 19:18 2022/6/20 * @Date 19:18 2022/6/20
**/ **/
@Override @Override
public synchronized R<Map<String,TCheckMobile>> checkMobiles(String mobiles){ public synchronized R<Map<String, TCheckMobile>> checkMobiles(String mobiles) {
R<Map<String,TCheckMobile>> mobileMapR = null; R<Map<String, TCheckMobile>> mobileMapR = null;
Map<String,TCheckMobile> checkMobileMap = null; Map<String, TCheckMobile> checkMobileMap = null;
Map<String,TCheckMobile> existMap = new HashMap<>(); Map<String, TCheckMobile> existMap = new HashMap<>();
if (Common.isNotNull(mobiles)){ if (Common.isNotNull(mobiles)) {
List<String> mobileList = Common.initStrToList(mobiles,CommonConstants.COMMA_STRING); List<String> mobileList = Common.initStrToList(mobiles, CommonConstants.COMMA_STRING);
if (Common.isNotEmpty(mobileList) && mobileList.size() > CommonConstants.INTEGER_HUNDRED){ if (Common.isNotEmpty(mobileList) && mobileList.size() > CommonConstants.INTEGER_HUNDRED) {
return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED)); return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED));
} }
//1.先从本地库获取正常数据 //1.先从本地库获取正常数据
List<TCheckMobile> checkMobiles = baseMapper.selectList(Wrappers.<TCheckMobile>query().lambda() List<TCheckMobile> checkMobiles = baseMapper.selectList(Wrappers.<TCheckMobile>query().lambda()
.in(TCheckMobile::getMobile,mobileList) .in(TCheckMobile::getMobile, mobileList)
.eq(TCheckMobile::getStatus,CommonConstants.ONE_STRING)); .eq(TCheckMobile::getStatus, CommonConstants.ONE_STRING));
if (Common.isNotNull(checkMobiles)){ if (Common.isNotNull(checkMobiles)) {
existMap = checkMobiles.stream().collect(Collectors.toMap(TCheckMobile::getMobile,TCheckMobile -> TCheckMobile)); existMap = checkMobiles.stream().collect(Collectors.toMap(TCheckMobile::getMobile, TCheckMobile -> TCheckMobile));
} }
mobileList.removeAll(existMap.keySet()); mobileList.removeAll(existMap.keySet());
//2.从远处端获取数据 //2.从远处端获取数据
if (Common.isNotNull(mobileList)){ if (Common.isNotNull(mobileList)) {
mobileMapR = ChecksUtil.checkMobile(Common.ListToStr(mobileList,CommonConstants.COMMA_STRING),canCheckService.getCanCheck()); mobileMapR = ChecksUtil.checkMobile(Common.ListToStr(mobileList, CommonConstants.COMMA_STRING), canCheckService.getCanCheck());
if (Common.isEmpty(mobileMapR) || Common.isEmpty(mobileMapR.getData())){ if (Common.isEmpty(mobileMapR) || Common.isEmpty(mobileMapR.getData())) {
return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_ERROR) return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_ERROR)
+(Common.isNotNull(mobileMapR)?mobileMapR.getMsg():CommonConstants.EMPTY_STRING)); + (Common.isNotNull(mobileMapR) ? mobileMapR.getMsg() : CommonConstants.EMPTY_STRING));
} }
checkMobileMap = mobileMapR.getData(); checkMobileMap = mobileMapR.getData();
if (Common.isNotNull(mobileList) && Common.isNotNull(checkMobileMap)){ if (Common.isNotNull(mobileList) && Common.isNotNull(checkMobileMap)) {
TCheckMobile checkMobile = null; TCheckMobile checkMobile = null;
for (String mobile:mobileList){ for (String mobile : mobileList) {
if (Common.isEmpty(checkMobileMap.get(mobile))){ if (Common.isEmpty(checkMobileMap.get(mobile))) {
checkMobile = new TCheckMobile(); checkMobile = new TCheckMobile();
checkMobile.setType(CommonConstants.ONE_STRING); checkMobile.setType(CommonConstants.ONE_STRING);
checkMobile.setMobile(mobile); checkMobile.setMobile(mobile);
checkMobile.setStatus(CommonConstants.TEN_STRING); checkMobile.setStatus(CommonConstants.TEN_STRING);
checkMobile.setMessage(Common.isEmpty(mobileMapR)?MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_ERROR):mobileMapR.getMsg()); checkMobile.setMessage(Common.isEmpty(mobileMapR) ? MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_ERROR) : mobileMapR.getMsg());
checkMobile.setChargesstatus(CommonConstants.ZERO_STRING); checkMobile.setChargesstatus(CommonConstants.ZERO_STRING);
checkMobile.setNumbertype(CommonConstants.EMPTY_STRING); checkMobile.setNumbertype(CommonConstants.EMPTY_STRING);
checkMobile.setArea(CommonConstants.EMPTY_STRING); checkMobile.setArea(CommonConstants.EMPTY_STRING);
checkMobileMap.put(mobile,checkMobile); checkMobileMap.put(mobile, checkMobile);
} }
} }
} }
} }
}else { } else {
return R.failed(MsgUtils.getMessage(ErrorCodes.PARAM_NOT_EMPTY)); return R.failed(MsgUtils.getMessage(ErrorCodes.PARAM_NOT_EMPTY));
} }
if (Common.isNotNull(checkMobileMap)){ if (Common.isNotNull(checkMobileMap)) {
this.saveBatch(checkMobileMap.values()); this.saveBatch(checkMobileMap.values());
}else { } else {
checkMobileMap = new HashMap<>(); checkMobileMap = new HashMap<>();
} }
checkMobileMap.putAll(existMap); checkMobileMap.putAll(existMap);
if (Common.isEmpty(mobileMapR)){ if (Common.isEmpty(mobileMapR)) {
mobileMapR = new R<>(); mobileMapR = new R<>();
} }
mobileMapR.setData(checkMobileMap); mobileMapR.setData(checkMobileMap);
return mobileMapR; return mobileMapR;
} }
@Override
public synchronized boolean checkOneMobile(String mobile) {
if (Common.isNotNull(mobile)) {
//1.先从本地库获取正常数据
List<TCheckMobile> checkMobiles = baseMapper.selectList(Wrappers.<TCheckMobile>query().lambda()
.eq(TCheckMobile::getMobile, mobile));
if (Common.isNotNull(checkMobiles)) {
for (TCheckMobile c : checkMobiles) {
if (CommonConstants.ONE_STRING.equals(c.getStatus())) {
return true;
}
}
return false;
} else {
//2.从远处端获取数据
R<Map<String, TCheckMobile>> mobileMapR = ChecksUtil.checkMobile(mobile, canCheckService.getCanCheck());
if (Common.isEmpty(mobileMapR) || Common.isEmpty(mobileMapR.getData())) {
return false;
}
Map<String, TCheckMobile> checkMobileMap = mobileMapR.getData();
if (Common.isNotNull(checkMobileMap) && checkMobileMap.get(mobile) != null) {
TCheckMobile checkMobile = checkMobileMap.get(mobile);
this.save(checkMobile);
if (checkMobile != null && CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return true;
} else {
return false;
}
}
}
}
return false;
}
} }
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