处理问题
This commit is contained in:
parent
51fe298d3e
commit
0aa4514d84
68
basic-util/src/main/java/ink/wgink/util/IdCardUtil.java
Normal file
68
basic-util/src/main/java/ink/wgink/util/IdCardUtil.java
Normal file
@ -0,0 +1,68 @@
|
||||
package ink.wgink.util;
|
||||
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* @ClassName: IdCardUtil
|
||||
* @Description: 身份证工具
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/5/20 22:39
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class IdCardUtil {
|
||||
|
||||
/**
|
||||
* 获取性别
|
||||
*
|
||||
* @param idCard
|
||||
* @return
|
||||
*/
|
||||
public static Integer getSexNumber(String idCard) {
|
||||
if (!RegexUtil.isIdentity(idCard)) {
|
||||
throw new ParamsException("身份证格式错误");
|
||||
}
|
||||
return Integer.parseInt(idCard.substring(16, 17));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取性别
|
||||
*
|
||||
* @param idCard
|
||||
* @return
|
||||
*/
|
||||
public static String getSexName(String idCard) {
|
||||
int sexNumber = getSexNumber(idCard);
|
||||
if (sexNumber % 2 == 0) {
|
||||
return "女";
|
||||
} else {
|
||||
return "男";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得年龄
|
||||
*
|
||||
* @param idCard
|
||||
* @return
|
||||
*/
|
||||
public static Integer getAge(String idCard) {
|
||||
int birthYear = Integer.parseInt(idCard.substring(6, 10));
|
||||
int birthMonth = Integer.parseInt(idCard.substring(10, 12));
|
||||
int birthDay = Integer.parseInt(idCard.substring(12, 14));
|
||||
|
||||
DateTime now = DateTime.now();
|
||||
int year = now.getYear();
|
||||
int month = now.getMonthOfYear();
|
||||
int day = now.getDayOfMonth();
|
||||
|
||||
int age = year - birthYear;
|
||||
if (month < birthMonth) {
|
||||
return age - 1;
|
||||
} else if (month == birthMonth && day < birthDay) {
|
||||
return age - 1;
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
}
|
@ -26,6 +26,8 @@ public class EnvManager {
|
||||
private IEnvDao envDao;
|
||||
private Env env = new Env();
|
||||
|
||||
private EnvManager() {}
|
||||
|
||||
public static EnvManager getInstance() {
|
||||
return envManager;
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ public class AreaDTO implements Serializable {
|
||||
}
|
||||
|
||||
public String getAreaMergerName() {
|
||||
return areaMergerName == null ? "" : areaMergerName;
|
||||
return areaMergerName == null ? "" : areaMergerName.trim();
|
||||
}
|
||||
|
||||
public void setAreaMergerMame(String areaMergerMame) {
|
||||
this.areaMergerName = areaMergerMame;
|
||||
public void setAreaMergerName(String areaMergerName) {
|
||||
this.areaMergerName = areaMergerName;
|
||||
}
|
||||
|
||||
public String getAreaShortName() {
|
||||
|
@ -119,6 +119,14 @@ public interface IAreaService {
|
||||
*/
|
||||
List<AreaDTO> listByCode(String areaCode);
|
||||
|
||||
/**
|
||||
* 地区字典列表(通过地区字典编码)
|
||||
*
|
||||
* @param areaCodes
|
||||
* @return
|
||||
*/
|
||||
List<AreaDTO> listByCodes(List<String> areaCodes);
|
||||
|
||||
/**
|
||||
* 地区字典子列表(不包含本级)
|
||||
*
|
||||
|
@ -15,6 +15,7 @@ import ink.wgink.util.string.WStringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -124,6 +125,16 @@ public class AreaServiceImpl extends DefaultBaseService implements IAreaService
|
||||
return areaDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaDTO> listByCodes(List<String> areaCodes) {
|
||||
if (areaCodes == null || areaCodes.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Map<String, Object> params = getHashMap(1);
|
||||
params.put("areaCodes", areaCodes);
|
||||
return areaDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaDTO> listSubByCode(String areaCode) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
|
@ -219,6 +219,13 @@
|
||||
#{areaIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="areaCodes != null and areaCodes.size > 0">
|
||||
AND
|
||||
area_code IN
|
||||
<foreach collection="areaCodes" index="index" open="(" separator="," close=")">
|
||||
#{areaCodes[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 字典详情 -->
|
||||
|
@ -2,6 +2,7 @@ package ink.wgink.service.department.service;
|
||||
|
||||
import ink.wgink.interfaces.department.IDepartmentBaseService;
|
||||
import ink.wgink.interfaces.department.IDepartmentCheckService;
|
||||
import ink.wgink.pojo.pos.DepartmentPO;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import ink.wgink.service.department.pojo.vos.DepartmentVO;
|
||||
import ink.wgink.service.department.pojo.vos.MergeDepartmentInfoVO;
|
||||
@ -100,4 +101,11 @@ public interface IDepartmentService extends IDepartmentBaseService, IDepartmentC
|
||||
*/
|
||||
void resetCode();
|
||||
|
||||
/**
|
||||
* 部门列表
|
||||
*
|
||||
* @param departmentNames
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentPO> listPOByNames(List<String> departmentNames);
|
||||
}
|
||||
|
@ -539,6 +539,13 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
||||
return count(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentPO> listPOByNames(List<String> departmentNames) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("departmentNames", departmentNames);
|
||||
return listPO(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过上级ID和新增或修改日期获取组织列表(简单模式)
|
||||
*
|
||||
|
@ -668,6 +668,13 @@
|
||||
#{departmentIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="departmentNames != null and departmentNames.size > 0">
|
||||
AND
|
||||
department_name IN
|
||||
<foreach collection="departmentNames" index="index" open="(" separator="," close=")">
|
||||
#{departmentNames[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
AND
|
||||
department_name = #{departmentName}
|
||||
|
@ -147,7 +147,7 @@
|
||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||
<div class="layui-input-block layui-input-block-down select-area">
|
||||
<input type="hidden" id="departmentAreaCode" name="departmentAreaCode">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor:pointer;">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly style="cursor:pointer;">
|
||||
<div class="layui-btn-group select-btn">
|
||||
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||
<i class="fa fa-circle-thin"></i>
|
||||
|
@ -153,7 +153,7 @@
|
||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||
<div class="layui-input-block layui-input-block-down select-area">
|
||||
<input type="hidden" id="departmentAreaCode" name="departmentAreaCode">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor:pointer;">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly style="cursor:pointer;">
|
||||
<div class="layui-btn-group select-btn">
|
||||
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||
<i class="fa fa-circle-thin"></i>
|
||||
|
@ -160,7 +160,7 @@
|
||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||
<div class="layui-input-block layui-input-block-down select-area">
|
||||
<input type="hidden" id="departmentAreaCode" name="departmentAreaCode">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor:pointer;">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly style="cursor:pointer;">
|
||||
<div class="layui-btn-group select-btn">
|
||||
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||
<i class="fa fa-circle-thin"></i>
|
||||
|
@ -143,7 +143,7 @@
|
||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||
<div class="layui-input-block layui-input-block-down select-area">
|
||||
<input type="hidden" id="departmentAreaCode" name="departmentAreaCode">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor:pointer;">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly style="cursor:pointer;">
|
||||
<div class="layui-btn-group select-btn">
|
||||
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||
<i class="fa fa-circle-thin"></i>
|
||||
|
@ -160,7 +160,7 @@
|
||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||
<div class="layui-input-block layui-input-block-down select-area">
|
||||
<input type="hidden" id="departmentAreaCode" name="departmentAreaCode">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor:pointer;">
|
||||
<input type="text" id="departmentAreaName" name="departmentAreaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly style="cursor:pointer;">
|
||||
<div class="layui-btn-group select-btn">
|
||||
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||
<i class="fa fa-circle-thin"></i>
|
||||
|
Loading…
Reference in New Issue
Block a user