diff --git a/interface-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/IBasicStaffInfoService.java b/interface-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/IBasicStaffInfoService.java index c61d376..916dab7 100644 --- a/interface-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/IBasicStaffInfoService.java +++ b/interface-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/IBasicStaffInfoService.java @@ -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.vos.basicstaffinfo.BasicStaffInfoVO; import ink.wgink.exceptions.RemoveException; +import ink.wgink.exceptions.SaveException; import ink.wgink.exceptions.SearchException; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResult; @@ -28,9 +29,9 @@ public interface IBasicStaffInfoService { * @param basicStaffInfoVO * @param token * @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> listPage(ListPage page) throws SearchException; + /** + * 根据token查询个人信息 + * @param token + * @return + */ + BasicStaffInfoDTO getBindUserAccount(String token); } \ No newline at end of file diff --git a/module-staff/src/main/java/cn/com/tenlion/staff/dao/basicstaffinfo/IBasicStaffInfoDao.java b/module-staff/src/main/java/cn/com/tenlion/staff/dao/basicstaffinfo/IBasicStaffInfoDao.java index c8f9a1b..59f1f6a 100644 --- a/module-staff/src/main/java/cn/com/tenlion/staff/dao/basicstaffinfo/IBasicStaffInfoDao.java +++ b/module-staff/src/main/java/cn/com/tenlion/staff/dao/basicstaffinfo/IBasicStaffInfoDao.java @@ -28,4 +28,5 @@ public interface IBasicStaffInfoDao { void remove(Map params); void delete(Map params); + } diff --git a/module-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/impl/BasicStaffInfoServiceImpl.java b/module-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/impl/BasicStaffInfoServiceImpl.java index 371f82a..89e425b 100644 --- a/module-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/impl/BasicStaffInfoServiceImpl.java +++ b/module-staff/src/main/java/cn/com/tenlion/staff/service/basicstaffinfo/impl/BasicStaffInfoServiceImpl.java @@ -8,10 +8,12 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.RemoveException; +import ink.wgink.exceptions.SaveException; import ink.wgink.exceptions.SearchException; import ink.wgink.module.dictionary.pojo.dtos.AreaDTO; import ink.wgink.module.dictionary.service.IAreaService; import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.app.AppTokenUser; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResultData; 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.stereotype.Service; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 人员基础信息接口实现类 @@ -41,12 +41,21 @@ public class BasicStaffInfoServiceImpl extends DefaultBaseService implements IBa private IAreaService areaService; @Override - public SuccessResultData save(String token, BasicStaffInfoVO basicStaffInfoVO) throws Exception { + public SuccessResultData save(String token, BasicStaffInfoVO basicStaffInfoVO) throws SaveException { String basicStaffInfoId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(basicStaffInfoVO); params.put("basicStaffInfoId", basicStaffInfoId); if (!StringUtils.isEmpty(token)) { setAppSaveInfo(token, params); + params.put("bindUserAccount",params.get("creator").toString()); + params.put("tags","普通用户"); + Map query = new HashMap<>(4); + query.put("bindUserAccount",params.get("creator").toString()); + BasicStaffInfoDTO dto = basicStaffInfoDao.getById(query); + List ids = new ArrayList<>(); + ids.add(dto.getBasicStaffInfoId()); + query.put("ids",ids); + basicStaffInfoDao.delete(query); } else { setSaveInfo(params); } @@ -75,6 +84,15 @@ public class BasicStaffInfoServiceImpl extends DefaultBaseService implements IBa return dto; } + @Override + public BasicStaffInfoDTO getBindUserAccount(String token) { + AppTokenUser appTokenUser = getAppTokenUser(token); + Map param = getHashMap(8); + param.put("bindUserAccount",appTokenUser.getId()); + BasicStaffInfoDTO dto = basicStaffInfoDao.getById(param); + return dto != null ? dto : new BasicStaffInfoDTO(); + } + @Override public List list(Map params) throws SearchException { return null; @@ -93,6 +111,10 @@ public class BasicStaffInfoServiceImpl extends DefaultBaseService implements IBa if(dataId.equals(item.getGender())){ item.setGender(dataItem.get("data_name").toString()); } + //证件类型 + if(dataId.equals(item.getCardType())){ + item.setCardType(dataItem.get("data_name").toString()); + } //民族 if(dataId.equals(item.getNation())){ item.setNation(dataItem.get("data_name").toString()); diff --git a/module-staff/src/main/resources/mybatis/mapper/basicstaffinfo/basic-staff-info-mapper.xml b/module-staff/src/main/resources/mybatis/mapper/basicstaffinfo/basic-staff-info-mapper.xml index 71815af..5f2a467 100644 --- a/module-staff/src/main/resources/mybatis/mapper/basicstaffinfo/basic-staff-info-mapper.xml +++ b/module-staff/src/main/resources/mybatis/mapper/basicstaffinfo/basic-staff-info-mapper.xml @@ -4,6 +4,7 @@ + @@ -37,6 +38,7 @@ SELECT t1.basic_staff_info_id, t1.id_card_number, + t1.card_type, t1.full_name, t1.name_used_before, t1.gender, @@ -86,6 +88,7 @@ INSERT INTO m_basic_staff_info ( basic_staff_info_id, + card_type, id_card_number, full_name, name_used_before, @@ -120,6 +123,7 @@ is_delete ) VALUES( #{basicStaffInfoId}, + #{cardType}, #{idCardNumber}, #{fullName}, #{nameUsedBefore}, @@ -158,6 +162,7 @@ UPDATE m_basic_staff_info SET + + card_type = #{cardType}, + id_card_number = #{idCardNumber}, diff --git a/module-staff/src/main/resources/templates/basic-staff-info/save-basic-staff-info.html b/module-staff/src/main/resources/templates/basic-staff-info/save-basic-staff-info.html index 00551ad..fb28a8a 100644 --- a/module-staff/src/main/resources/templates/basic-staff-info/save-basic-staff-info.html +++ b/module-staff/src/main/resources/templates/basic-staff-info/save-basic-staff-info.html @@ -227,13 +227,27 @@
- + +
+ +
+
+
+
+
-
+
@@ -241,7 +255,7 @@
-
+
@@ -255,7 +269,7 @@
-
+
@@ -532,7 +546,8 @@ // 初始化内容 function initData() { initBirthDateDate(); - initGenderSelect(); + initGenderSelect() + initCardTypeSelect(); initNationSelect(); initPoliticalStatusSelect(); 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() { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/a981579c-572b-4fd1-8e76-5d17df97f6a4', []), {}, null, function(code, data, args) { diff --git a/module-staff/src/main/resources/templates/basic-staff-info/update-basic-staff-info.html b/module-staff/src/main/resources/templates/basic-staff-info/update-basic-staff-info.html index 8fbee24..49f9d81 100644 --- a/module-staff/src/main/resources/templates/basic-staff-info/update-basic-staff-info.html +++ b/module-staff/src/main/resources/templates/basic-staff-info/update-basic-staff-info.html @@ -225,6 +225,20 @@
+
+
+ +
+ +
+
@@ -233,7 +247,7 @@
-
+
@@ -241,7 +255,7 @@
-
+
@@ -255,7 +269,7 @@
-
+
@@ -564,6 +578,7 @@ currentResidence2 = currentResidence[2]; initBirthDateDate(); initGenderSelect(data['gender']); + initCardTypeSelect(data['cardType']); initNationSelect(data['nation']); initReligionSelect(data['religion']); 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) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/a981579c-572b-4fd1-8e76-5d17df97f6a4', []), {}, null, function(code, data, args) { diff --git a/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/dtos/basicstaffinfo/BasicStaffInfoDTO.java b/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/dtos/basicstaffinfo/BasicStaffInfoDTO.java index 29223c5..4c15615 100644 --- a/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/dtos/basicstaffinfo/BasicStaffInfoDTO.java +++ b/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/dtos/basicstaffinfo/BasicStaffInfoDTO.java @@ -16,7 +16,9 @@ public class BasicStaffInfoDTO { @ApiModelProperty(name = "basicStaffInfoId", value = "主键") private String basicStaffInfoId; - @ApiModelProperty(name = "idCardNumber", value = "公民身份证号") + @ApiModelProperty(name = "cardType", value = "证件类型") + private String cardType; + @ApiModelProperty(name = "idCardNumber", value = "证件号码") private String idCardNumber; @ApiModelProperty(name = "fullName", value = "全名") private String fullName; @@ -79,6 +81,14 @@ public class BasicStaffInfoDTO { this.basicStaffInfoId = basicStaffInfoId; } + public String getCardType() { + return cardType == null ? "" : cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + public String getIdCardNumber() { return idCardNumber == null ? "" : idCardNumber; } diff --git a/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/vos/basicstaffinfo/BasicStaffInfoVO.java b/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/vos/basicstaffinfo/BasicStaffInfoVO.java index 1a76b00..9e18fa6 100644 --- a/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/vos/basicstaffinfo/BasicStaffInfoVO.java +++ b/pojo-staff/src/main/java/cn/com/tenlion/staff/pojo/vos/basicstaffinfo/BasicStaffInfoVO.java @@ -14,7 +14,9 @@ import io.swagger.annotations.ApiModelProperty; @ApiModel public class BasicStaffInfoVO { - @ApiModelProperty(name = "idCardNumber", value = "公民身份证号") + @ApiModelProperty(name = "cardType", value = "证件类型") + private String cardType; + @ApiModelProperty(name = "idCardNumber", value = "证件号码") private String idCardNumber; @ApiModelProperty(name = "fullName", value = "全名") private String fullName; @@ -69,6 +71,14 @@ public class BasicStaffInfoVO { @ApiModelProperty(name = "tags", value = "用户标签") private String tags; + public String getCardType() { + return cardType == null ? "" : cardType; + } + + public void setCardType(String cardType) { + this.cardType = cardType; + } + public String getIdCardNumber() { return idCardNumber == null ? "" : idCardNumber; }