添加证件类型

This commit is contained in:
wans 2021-05-08 16:50:21 +08:00
parent 3cebfb7d25
commit f1637a3383
8 changed files with 135 additions and 16 deletions

View File

@ -4,6 +4,7 @@ package cn.com.tenlion.staff.service.basicstaffinfo;
import cn.com.tenlion.staff.pojo.dtos.basicstaffinfo.BasicStaffInfoDTO; import cn.com.tenlion.staff.pojo.dtos.basicstaffinfo.BasicStaffInfoDTO;
import cn.com.tenlion.staff.pojo.vos.basicstaffinfo.BasicStaffInfoVO; import cn.com.tenlion.staff.pojo.vos.basicstaffinfo.BasicStaffInfoVO;
import ink.wgink.exceptions.RemoveException; import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException; import ink.wgink.exceptions.SearchException;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
@ -28,9 +29,9 @@ public interface IBasicStaffInfoService {
* @param basicStaffInfoVO * @param basicStaffInfoVO
* @param token * @param token
* @return * @return
* @throws Exception * @throws SaveException
*/ */
SuccessResultData save(String token, BasicStaffInfoVO basicStaffInfoVO) throws Exception; SuccessResultData save(String token, BasicStaffInfoVO basicStaffInfoVO) throws SaveException;
/** /**
@ -89,4 +90,10 @@ public interface IBasicStaffInfoService {
*/ */
SuccessResultList<List<BasicStaffInfoDTO>> listPage(ListPage page) throws SearchException; SuccessResultList<List<BasicStaffInfoDTO>> listPage(ListPage page) throws SearchException;
/**
* 根据token查询个人信息
* @param token
* @return
*/
BasicStaffInfoDTO getBindUserAccount(String token);
} }

View File

@ -28,4 +28,5 @@ public interface IBasicStaffInfoDao {
void remove(Map<String, Object> params); void remove(Map<String, Object> params);
void delete(Map<String, Object> params); void delete(Map<String, Object> params);
} }

View File

@ -8,10 +8,12 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService; import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.RemoveException; import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException; import ink.wgink.exceptions.SearchException;
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO; import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
import ink.wgink.module.dictionary.service.IAreaService; import ink.wgink.module.dictionary.service.IAreaService;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.app.AppTokenUser;
import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
@ -21,9 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* 人员基础信息接口实现类 * 人员基础信息接口实现类
@ -41,12 +41,21 @@ public class BasicStaffInfoServiceImpl extends DefaultBaseService implements IBa
private IAreaService areaService; private IAreaService areaService;
@Override @Override
public SuccessResultData save(String token, BasicStaffInfoVO basicStaffInfoVO) throws Exception { public SuccessResultData save(String token, BasicStaffInfoVO basicStaffInfoVO) throws SaveException {
String basicStaffInfoId = UUIDUtil.getUUID(); String basicStaffInfoId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(basicStaffInfoVO); Map<String, Object> params = HashMapUtil.beanToMap(basicStaffInfoVO);
params.put("basicStaffInfoId", basicStaffInfoId); params.put("basicStaffInfoId", basicStaffInfoId);
if (!StringUtils.isEmpty(token)) { if (!StringUtils.isEmpty(token)) {
setAppSaveInfo(token, params); setAppSaveInfo(token, params);
params.put("bindUserAccount",params.get("creator").toString());
params.put("tags","普通用户");
Map<String, Object> query = new HashMap<>(4);
query.put("bindUserAccount",params.get("creator").toString());
BasicStaffInfoDTO dto = basicStaffInfoDao.getById(query);
List<String> ids = new ArrayList<>();
ids.add(dto.getBasicStaffInfoId());
query.put("ids",ids);
basicStaffInfoDao.delete(query);
} else { } else {
setSaveInfo(params); setSaveInfo(params);
} }
@ -75,6 +84,15 @@ public class BasicStaffInfoServiceImpl extends DefaultBaseService implements IBa
return dto; return dto;
} }
@Override
public BasicStaffInfoDTO getBindUserAccount(String token) {
AppTokenUser appTokenUser = getAppTokenUser(token);
Map<String, Object> param = getHashMap(8);
param.put("bindUserAccount",appTokenUser.getId());
BasicStaffInfoDTO dto = basicStaffInfoDao.getById(param);
return dto != null ? dto : new BasicStaffInfoDTO();
}
@Override @Override
public List<BasicStaffInfoDTO> list(Map<String, Object> params) throws SearchException { public List<BasicStaffInfoDTO> list(Map<String, Object> params) throws SearchException {
return null; return null;
@ -93,6 +111,10 @@ public class BasicStaffInfoServiceImpl extends DefaultBaseService implements IBa
if(dataId.equals(item.getGender())){ if(dataId.equals(item.getGender())){
item.setGender(dataItem.get("data_name").toString()); item.setGender(dataItem.get("data_name").toString());
} }
//证件类型
if(dataId.equals(item.getCardType())){
item.setCardType(dataItem.get("data_name").toString());
}
//民族 //民族
if(dataId.equals(item.getNation())){ if(dataId.equals(item.getNation())){
item.setNation(dataItem.get("data_name").toString()); item.setNation(dataItem.get("data_name").toString());

View File

@ -4,6 +4,7 @@
<resultMap id="basicStaffInfoDTO" type="cn.com.tenlion.staff.pojo.dtos.basicstaffinfo.BasicStaffInfoDTO"> <resultMap id="basicStaffInfoDTO" type="cn.com.tenlion.staff.pojo.dtos.basicstaffinfo.BasicStaffInfoDTO">
<id column="basic_staff_info_id" property="basicStaffInfoId"></id> <id column="basic_staff_info_id" property="basicStaffInfoId"></id>
<result column="card_type" property="cardType"/>
<result column="id_card_number" property="idCardNumber"/> <result column="id_card_number" property="idCardNumber"/>
<result column="full_name" property="fullName"/> <result column="full_name" property="fullName"/>
<result column="name_used_before" property="nameUsedBefore"/> <result column="name_used_before" property="nameUsedBefore"/>
@ -37,6 +38,7 @@
SELECT SELECT
t1.basic_staff_info_id, t1.basic_staff_info_id,
t1.id_card_number, t1.id_card_number,
t1.card_type,
t1.full_name, t1.full_name,
t1.name_used_before, t1.name_used_before,
t1.gender, t1.gender,
@ -86,6 +88,7 @@
<insert id="save" parameterType="map"> <insert id="save" parameterType="map">
INSERT INTO m_basic_staff_info ( INSERT INTO m_basic_staff_info (
basic_staff_info_id, basic_staff_info_id,
card_type,
id_card_number, id_card_number,
full_name, full_name,
name_used_before, name_used_before,
@ -120,6 +123,7 @@
is_delete is_delete
) VALUES( ) VALUES(
#{basicStaffInfoId}, #{basicStaffInfoId},
#{cardType},
#{idCardNumber}, #{idCardNumber},
#{fullName}, #{fullName},
#{nameUsedBefore}, #{nameUsedBefore},
@ -158,6 +162,7 @@
<select id="getById" parameterType="map" resultMap="basicStaffInfoDTO"> <select id="getById" parameterType="map" resultMap="basicStaffInfoDTO">
SELECT SELECT
t1.basic_staff_info_id, t1.basic_staff_info_id,
t1.card_type,
t1.id_card_number, t1.id_card_number,
t1.full_name, t1.full_name,
t1.name_used_before, t1.name_used_before,
@ -192,12 +197,19 @@
<if test="basicStaffInfoId != null and basicStaffInfoId != ''"> <if test="basicStaffInfoId != null and basicStaffInfoId != ''">
AND t1.basic_staff_info_id = #{basicStaffInfoId} AND t1.basic_staff_info_id = #{basicStaffInfoId}
</if> </if>
<if test="bindUserAccount != null and bindUserAccount != ''">
AND t1.bind_user_account = #{bindUserAccount}
</if>
limit 1
</select> </select>
<update id="update" parameterType="map"> <update id="update" parameterType="map">
UPDATE UPDATE
m_basic_staff_info m_basic_staff_info
SET SET
<if test="cardType != null and cardType != ''">
card_type = #{cardType},
</if>
<if test="idCardNumber != null and idCardNumber != ''"> <if test="idCardNumber != null and idCardNumber != ''">
id_card_number = #{idCardNumber}, id_card_number = #{idCardNumber},
</if> </if>

View File

@ -227,13 +227,27 @@
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md3"> <div class="layui-col-md3">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">身份证号</label> <label class="layui-form-label">证件类型</label>
<div class="layui-input-block layui-form" id="cardTypeSelectTemplateBox" lay-filter="cardTypeSelectTemplateBox"></div>
<script id="cardTypeSelectTemplate" type="text/html">
<select id="cardType" name="cardType" lay-search>
<option value="">请选择证件类型(支持搜索)</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">证件证号</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" id="idCardNumber" name="idCardNumber" class="layui-input" value="" autocomplete="off" placeholder="请输入公民身份证号"> <input type="text" id="idCardNumber" name="idCardNumber" class="layui-input" value="" autocomplete="off" placeholder="请输入公民身份证号">
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md2">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">出生日期</label> <label class="layui-form-label">出生日期</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -241,7 +255,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md2">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">民族</label> <label class="layui-form-label">民族</label>
<div class="layui-input-block layui-form" id="nationSelectTemplateBox" lay-filter="nationSelectTemplateBox"></div> <div class="layui-input-block layui-form" id="nationSelectTemplateBox" lay-filter="nationSelectTemplateBox"></div>
@ -255,7 +269,7 @@
</script> </script>
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md2">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">宗教信仰</label> <label class="layui-form-label">宗教信仰</label>
<div class="layui-input-block layui-form" id="religionSelectTemplateBox" lay-filter="religionSelectTemplateBox"></div> <div class="layui-input-block layui-form" id="religionSelectTemplateBox" lay-filter="religionSelectTemplateBox"></div>
@ -532,7 +546,8 @@
// 初始化内容 // 初始化内容
function initData() { function initData() {
initBirthDateDate(); initBirthDateDate();
initGenderSelect(); initGenderSelect()
initCardTypeSelect();
initNationSelect(); initNationSelect();
initPoliticalStatusSelect(); initPoliticalStatusSelect();
initMaritalStatusSelect(); initMaritalStatusSelect();
@ -823,6 +838,18 @@
}); });
} }
// 初始化证件类别下拉选择
function initCardTypeSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('cardTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('cardTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'cardTypeSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化民族下拉选择 // 初始化民族下拉选择
function initNationSelect() { function initNationSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/a981579c-572b-4fd1-8e76-5d17df97f6a4', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/a981579c-572b-4fd1-8e76-5d17df97f6a4', []), {}, null, function(code, data, args) {

View File

@ -225,6 +225,20 @@
</div> </div>
</div> </div>
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">证件类型</label>
<div class="layui-input-block layui-form" id="cardTypeSelectTemplateBox" lay-filter="cardTypeSelectTemplateBox"></div>
<script id="cardTypeSelectTemplate" type="text/html">
<select id="cardType" name="cardType" lay-search>
<option value="">请选择证件类型(支持搜索)</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-col-md3"> <div class="layui-col-md3">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">身份证号</label> <label class="layui-form-label">身份证号</label>
@ -233,7 +247,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md2">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">出生日期</label> <label class="layui-form-label">出生日期</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -241,7 +255,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md2">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">民族</label> <label class="layui-form-label">民族</label>
<div class="layui-input-block layui-form" id="nationSelectTemplateBox" lay-filter="nationSelectTemplateBox"></div> <div class="layui-input-block layui-form" id="nationSelectTemplateBox" lay-filter="nationSelectTemplateBox"></div>
@ -255,7 +269,7 @@
</script> </script>
</div> </div>
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md2">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">宗教信仰</label> <label class="layui-form-label">宗教信仰</label>
<div class="layui-input-block layui-form" id="religionSelectTemplateBox" lay-filter="religionSelectTemplateBox"></div> <div class="layui-input-block layui-form" id="religionSelectTemplateBox" lay-filter="religionSelectTemplateBox"></div>
@ -564,6 +578,7 @@
currentResidence2 = currentResidence[2]; currentResidence2 = currentResidence[2];
initBirthDateDate(); initBirthDateDate();
initGenderSelect(data['gender']); initGenderSelect(data['gender']);
initCardTypeSelect(data['cardType']);
initNationSelect(data['nation']); initNationSelect(data['nation']);
initReligionSelect(data['religion']); initReligionSelect(data['religion']);
initEducationSelect(data['education']); initEducationSelect(data['education']);
@ -860,6 +875,21 @@
}); });
} }
// 初始化证件类别下拉选择
function initCardTypeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('cardTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('cardTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'cardTypeSelectTemplateBox');
var selectObj = {};
selectObj['cardType'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化民族下拉选择 // 初始化民族下拉选择
function initNationSelect(selectValue) { function initNationSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/a981579c-572b-4fd1-8e76-5d17df97f6a4', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/a981579c-572b-4fd1-8e76-5d17df97f6a4', []), {}, null, function(code, data, args) {

View File

@ -16,7 +16,9 @@ public class BasicStaffInfoDTO {
@ApiModelProperty(name = "basicStaffInfoId", value = "主键") @ApiModelProperty(name = "basicStaffInfoId", value = "主键")
private String basicStaffInfoId; private String basicStaffInfoId;
@ApiModelProperty(name = "idCardNumber", value = "公民身份证号") @ApiModelProperty(name = "cardType", value = "证件类型")
private String cardType;
@ApiModelProperty(name = "idCardNumber", value = "证件号码")
private String idCardNumber; private String idCardNumber;
@ApiModelProperty(name = "fullName", value = "全名") @ApiModelProperty(name = "fullName", value = "全名")
private String fullName; private String fullName;
@ -79,6 +81,14 @@ public class BasicStaffInfoDTO {
this.basicStaffInfoId = basicStaffInfoId; this.basicStaffInfoId = basicStaffInfoId;
} }
public String getCardType() {
return cardType == null ? "" : cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public String getIdCardNumber() { public String getIdCardNumber() {
return idCardNumber == null ? "" : idCardNumber; return idCardNumber == null ? "" : idCardNumber;
} }

View File

@ -14,7 +14,9 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel @ApiModel
public class BasicStaffInfoVO { public class BasicStaffInfoVO {
@ApiModelProperty(name = "idCardNumber", value = "公民身份证号") @ApiModelProperty(name = "cardType", value = "证件类型")
private String cardType;
@ApiModelProperty(name = "idCardNumber", value = "证件号码")
private String idCardNumber; private String idCardNumber;
@ApiModelProperty(name = "fullName", value = "全名") @ApiModelProperty(name = "fullName", value = "全名")
private String fullName; private String fullName;
@ -69,6 +71,14 @@ public class BasicStaffInfoVO {
@ApiModelProperty(name = "tags", value = "用户标签") @ApiModelProperty(name = "tags", value = "用户标签")
private String tags; private String tags;
public String getCardType() {
return cardType == null ? "" : cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public String getIdCardNumber() { public String getIdCardNumber() {
return idCardNumber == null ? "" : idCardNumber; return idCardNumber == null ? "" : idCardNumber;
} }