| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- package thyyxxk.webserver.service.dictionary;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import thyyxxk.webserver.config.exception.ExceptionEnum;
- import thyyxxk.webserver.dao.his.dictionary.EmployeeMiDao;
- import thyyxxk.webserver.dao.his.dictionary.PersonnelDictDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdEducationCodeDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdEmpInmarkDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdEmpPositionDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdEmpTitleDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdIfcadreDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdUnitClassDao;
- import thyyxxk.webserver.dao.his.dictionary.ZdUnitCodeDao;
- import thyyxxk.webserver.entity.ResultVo;
- import thyyxxk.webserver.entity.dictionary.CodeName;
- import thyyxxk.webserver.entity.dictionary.EmployeeMi;
- import thyyxxk.webserver.entity.dictionary.EmployeeMiVo;
- import thyyxxk.webserver.entity.dictionary.ZdEducationCode;
- import thyyxxk.webserver.entity.dictionary.ZdEmpInmark;
- import thyyxxk.webserver.entity.dictionary.ZdEmpPosition;
- import thyyxxk.webserver.entity.dictionary.ZdEmpTitle;
- import thyyxxk.webserver.entity.dictionary.ZdIfcadre;
- import thyyxxk.webserver.entity.dictionary.ZdUnitClass;
- import thyyxxk.webserver.entity.dictionary.ZdUnitCode;
- import thyyxxk.webserver.entity.login.UserInfo;
- import thyyxxk.webserver.service.redislike.RedisLikeService;
- import thyyxxk.webserver.utils.DateUtil;
- import thyyxxk.webserver.utils.PingYinUtils;
- import thyyxxk.webserver.utils.ResultVoUtil;
- import thyyxxk.webserver.utils.StringUtil;
- import thyyxxk.webserver.utils.TokenUtil;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @Description: 人事字典
- * @Author: hsh
- * @CreateTime: 2023-10-16 16:39
- * @Version: 1.0
- */
- @Service
- @Slf4j
- public class PersonnelDictService {
- private final PersonnelDictDao dao;
- private final ZdUnitCodeDao deptDao;
- private final RedisLikeService redis;
- private final ZdUnitClassDao deptClassDao;
- private final ZdEmpPositionDao empPositionDao;
- private final ZdEmpTitleDao empTitleDao;
- private final ZdEducationCodeDao educationCodeDao;
- private final ZdIfcadreDao ifcadreDao;
- private final ZdEmpInmarkDao empInmarkDao;
- private final EmployeeMiDao employeeMiDao;
- @Autowired
- public PersonnelDictService(PersonnelDictDao dao, ZdUnitCodeDao deptDao, RedisLikeService redis,
- ZdUnitClassDao deptClassDao, ZdEmpPositionDao empPositionDao, ZdEmpTitleDao empTitleDao,
- ZdEducationCodeDao educationCodeDao, ZdIfcadreDao ifcadreDao, ZdEmpInmarkDao empInmarkDao,
- EmployeeMiDao employeeMiDao) {
- this.dao = dao;
- this.deptDao = deptDao;
- this.redis = redis;
- this.deptClassDao = deptClassDao;
- this.empPositionDao = empPositionDao;
- this.empTitleDao = empTitleDao;
- this.educationCodeDao = educationCodeDao;
- this.ifcadreDao = ifcadreDao;
- this.empInmarkDao = empInmarkDao;
- this.employeeMiDao = employeeMiDao;
- }
- public ResultVo<List<ZdUnitCode>> selectZdUnitCode(String text){
- return ResultVoUtil.success(deptDao.selectZdUnitCode(text));
- }
- /**
- * @description: 查询科室字典信息
- * @author: hsh
- * @date: 2023/10/16 16:41
- * @param: [text]
- * @return: ResultVo<List<ZdUnitCode>>
- **/
- public ResultVo<List<ZdUnitCode>> selectDeptDict(String text){
- return ResultVoUtil.success(deptDao.selectDeptDictAll(text));
- }
- /**
- * @description: 查询有效科室
- * @author: hsh
- * @date: 2023/10/17 9:48
- * @param: []
- * @return: ResultVo<List<ZdUnitCode>>
- **/
- public ResultVo<List<ZdUnitCode>> selectDeptDictForEffective(){
- return ResultVoUtil.success(deptDao.selectDeptDictForEffective());
- }
- /**
- * @description: 查询科室分类字典
- * @author: hsh
- * @date: 2023/10/17 9:48
- * @param: []
- * @return: ResultVo<List<Map<String,Object>>>
- **/
- public ResultVo<List<Map<String, Object>>> selectUnitClass(){
- return ResultVoUtil.success(dao.selectUnitClass());
- }
- /**
- * @description: 根据科室code查询科室字典信息
- * @author: hsh
- * @date: 2023/10/19 16:23
- * @param: [code]
- * @return: ResultVo<ZdUnitCode>
- **/
- public ResultVo<ZdUnitCode> selectDeptDictByCode(String code){
- return ResultVoUtil.success(deptDao.selectDeptDictByCode(code));
- }
- /**
- * @description: 保存或更新科室字典信息
- * @author: hsh
- * @date: 2023/10/20 16:25
- * @param: [zdUnitCode]
- * @return: ResultVo<Map<String,Object>>
- **/
- public ResultVo<Map<String, Object>> saveDeptDict(ZdUnitCode zdUnitCode){
- if(null == zdUnitCode || zdUnitCode.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室字典信息不存在,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdUnitCode.getCode();
- ZdUnitCode dept = deptDao.selectDeptDictByCode(code);
- UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
- // 根据名称生成新的拼音码和五笔码
- zdUnitCode.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdUnitCode.getName()));
- zdUnitCode.setDCode(PingYinUtils.getWBCode(zdUnitCode.getName()));
- zdUnitCode.setOpId(user.getCode());
- zdUnitCode.setOpDate(DateUtil.now());
- int num;
- try{
- if(null != dept){
- // 更新科室字典信息(这里仅限于更新老系统科室字典信息,其他信息修改待定)
- num = deptDao.updateDeptDictByCode(zdUnitCode);
- } else {
- // 新增科室字典信息(这里仅限于新增老系统科室字典信息,其他信息新增待定)
- num = deptDao.insert(zdUnitCode);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室字典失败!");
- }
- resultMap.put("cg", "保存科室字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室字典失败!");
- }
- }
- /**
- * @description: 根据科室编码更新科室停用状态
- * @author: hsh
- * @date: 2023/11/9 17:18
- * @param: [code, delFlag]
- * @return: ResultVo<ZdUnitCode>
- **/
- public ResultVo<Map<String, Object>> updateDeptStopOrUsed(String code, String delFlag){
- if(StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有科室编码,请检查!");
- }
- ZdUnitCode dept = deptDao.selectDeptDictByCode(code);
- if(null == dept){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, code + "的科室字典信息不存在,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = deptDao.updateDeptDictDelFlagByCode(code, delFlag);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室字典停用或启用失败!");
- }
- resultMap.put("cg", "更新科室字典停用或启用成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室字典停用或启用失败!");
- }
- }
- /**
- * 根据科室编码删除科室字典
- * @param code 科室编码
- * @return map
- */
- public ResultVo<Map<String, Object>> delDeptDictByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有科室编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = deptDao.deleteByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室字典失败!");
- }
- resultMap.put("cg", "删除科室字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室字典失败!");
- }
- }
- /**
- * 查询科室分类字典
- * @return ResultVo<ZdUnitClass>
- */
- public ResultVo<List<ZdUnitClass>> selectDeptClass(){
- return ResultVoUtil.success(deptClassDao.selectDeptClass());
- }
- /**
- * 保存科室分类
- * @param zdUnitClass 科室分类信息
- * @return map
- */
- public ResultVo<Map<String, Object>> saveDeptClass(ZdUnitClass zdUnitClass){
- if(null == zdUnitClass || zdUnitClass.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室分类信息不存在,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdUnitClass.getCode();
- ZdUnitClass deptClass = deptClassDao.selectDeptClassByCode(code);
- // 根据名称生成新的拼音码和五笔码
- zdUnitClass.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdUnitClass.getName()));
- zdUnitClass.setDCode(PingYinUtils.getWBCode(zdUnitClass.getName()));
- int num;
- try{
- if(null != deptClass){
- num = deptClassDao.updateDeptClassByCode(zdUnitClass);
- } else {
- num = deptClassDao.insert(zdUnitClass);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室分类失败!");
- }
- resultMap.put("cg", "保存科室分类成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室分类失败!");
- }
- }
- /**
- * 根据code删除科室分类
- * @param code 科室分类code
- * @return map
- */
- public ResultVo<Map<String, Object>> delDeptClassByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有科室分类编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = deptClassDao.deleteDeptClassByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室分类失败!");
- }
- resultMap.put("cg", "删除科室分类成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室分类失败!");
- }
- }
- /**
- * @Description 查询行政职务字典
- * @Author hsh
- * @Date 2023/12/19 15:17
- */
- public ResultVo<List<ZdEmpPosition>> selectEmpPosition(){
- return ResultVoUtil.success(empPositionDao.selectEmpPosition());
- }
- /**
- * @Description 保存行政职务字典
- * @Author hsh
- * @param zdEmpPosition 行政职务字典信息
- * @return map
- * @Date 2023/12/20 9:47
- */
- public ResultVo<Map<String, Object>> saveEmpPosition(ZdEmpPosition zdEmpPosition){
- if(null == zdEmpPosition || zdEmpPosition.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "行政职务字典信息不存在,请检查!");
- }
- if(StringUtil.notBlank(zdEmpPosition.getDelFlag()) && zdEmpPosition.getDelFlag().length() > 1){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除标志过长,不允许超出一个字符,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdEmpPosition.getCode();
- ZdEmpPosition empPosition = empPositionDao.selectEmpPositionByCode(code);
- // 根据名称生成新的拼音码和五笔码
- zdEmpPosition.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEmpPosition.getName()));
- zdEmpPosition.setDCode(PingYinUtils.getWBCode(zdEmpPosition.getName()));
- int num;
- try{
- if(null != empPosition){
- num = empPositionDao.updateEmpPositionByCode(zdEmpPosition);
- } else {
- num = empPositionDao.insert(zdEmpPosition);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存行政职务字典失败!");
- }
- resultMap.put("cg", "保存行政职务字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存行政职务字典失败!");
- }
- }
- /**
- * @Description 根据code删除行政职务字典
- * @Author hsh
- * @param code 行政职务字典code
- * @return map
- * @Date 2023/12/20 9:48
- */
- public ResultVo<Map<String, Object>> delEmpPositionByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有行政职务字典编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = empPositionDao.deleteEmpPositionByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除行政职务字典失败!");
- }
- resultMap.put("cg", "删除行政职务字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除行政职务字典失败!");
- }
- }
- /**
- * @Description 查询专业技术职称
- * @Author hsh
- * @return ZdEmpTitle
- * @Date 2023/12/20 14:39
- */
- public ResultVo<List<ZdEmpTitle>> selectEmpTitle(){
- return ResultVoUtil.success(empTitleDao.selectEmpTitle());
- }
- /**
- * @Description 保存专业技术职称
- * @Author hsh
- * @param zdEmpTitle 专业技术职称信息
- * @return map
- * @Date 2023/12/20 14:40
- */
- public ResultVo<Map<String, Object>> saveEmpTitle(ZdEmpTitle zdEmpTitle){
- if(null == zdEmpTitle || zdEmpTitle.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "专业技术职称信息不存在,请检查!");
- }
- if(StringUtil.notBlank(zdEmpTitle.getDelFlag()) && zdEmpTitle.getDelFlag().length() > 1){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除标志过长,不允许超出一个字符,请检查!");
- }
- if(StringUtil.notBlank(zdEmpTitle.getTitGrade()) && zdEmpTitle.getTitGrade().length() > 1){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "专业技术等级过长,不允许超出一个字符,请检查!");
- }
- if(StringUtil.notBlank(zdEmpTitle.getOrderCode()) && zdEmpTitle.getOrderCode().length() > 6){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "专业技术等级过长,不允许超出六个字符,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdEmpTitle.getCode();
- ZdEmpTitle empTitle = empTitleDao.selectEmpTitleByCode(code);
- // 根据名称生成新的拼音码和五笔码
- zdEmpTitle.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEmpTitle.getName()));
- zdEmpTitle.setDCode(PingYinUtils.getWBCode(zdEmpTitle.getName()));
- int num;
- try{
- if(null != empTitle){
- num = empTitleDao.updateEmpTitleByCode(zdEmpTitle);
- } else {
- num = empTitleDao.insert(zdEmpTitle);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存专业技术职称失败!");
- }
- resultMap.put("cg", "保存专业技术职称成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存专业技术职称失败!");
- }
- }
- /**
- * @Description 根据code删除专业技术职称
- * @Author hsh
- * @param code 专业技术职称编码
- * @return map
- * @Date 2023/12/20 14:47
- */
- public ResultVo<Map<String, Object>> delEmpTitleByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有专业技术职称编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = empTitleDao.deleteEmpTitleByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除专业技术职称失败!");
- }
- resultMap.put("cg", "删除专业技术职称成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除专业技术职称失败!");
- }
- }
- /**
- * @Description 查询文化程度字典
- * @Author hsh
- * @return ZdEducationCode
- * @Date 2023/12/20 16:00
- */
- public ResultVo<List<ZdEducationCode>> selectEducation(){
- return ResultVoUtil.success(educationCodeDao.selectEducation());
- }
- /**
- * @Description 保存文化程度字典
- * @Author hsh
- * @param zdEducationCode 文化程度字典信息
- * @return map
- * @Date 2023/12/20 16:01
- */
- public ResultVo<Map<String, Object>> saveEducation(ZdEducationCode zdEducationCode){
- if(null == zdEducationCode || zdEducationCode.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "文化程度字典信息不存在,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdEducationCode.getCode();
- ZdEducationCode education = educationCodeDao.selectEducationByCode(code);
- // 根据名称生成新的拼音码和五笔码
- zdEducationCode.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEducationCode.getName()));
- zdEducationCode.setDCode(PingYinUtils.getWBCode(zdEducationCode.getName()));
- int num;
- try{
- if(null != education){
- num = educationCodeDao.updateEducationByCode(zdEducationCode);
- } else {
- num = educationCodeDao.insert(zdEducationCode);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存文化程度字典失败!");
- }
- resultMap.put("cg", "保存文化程度字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存文化程度字典失败!");
- }
- }
- /**
- * @Description 根据code删除文化程度字典
- * @Author hsh
- * @param code 文化程度字典编码
- * @return map
- * @Date 2023/12/20 16:02
- */
- public ResultVo<Map<String, Object>> delEducationByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有文化程度字典编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = educationCodeDao.deleteEducationByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除文化程度字典失败!");
- }
- resultMap.put("cg", "删除文化程度字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除文化程度字典失败!");
- }
- }
- /**
- * @Description 查询干工标志字典
- * @Author hsh
- * @return ZdIfcadre 干工标志字典信息
- * @Date 2023/12/20 16:22
- */
- public ResultVo<List<ZdIfcadre>> selectIfcadre(){
- return ResultVoUtil.success(ifcadreDao.selectIfcadre());
- }
- /**
- * @Description 保存干工标志字典
- * @Author hsh
- * @param zdIfcadre 干工标志字典信息
- * @return map
- * @Date 2023/12/20 16:22
- */
- public ResultVo<Map<String, Object>> saveIfcadre(ZdIfcadre zdIfcadre){
- if(null == zdIfcadre || zdIfcadre.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "干工标志字典信息不存在,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdIfcadre.getCode();
- ZdIfcadre cadre = ifcadreDao.selectIfcadreByCode(code);
- // 根据名称生成新的拼音码和五笔码
- zdIfcadre.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdIfcadre.getName()));
- zdIfcadre.setDCode(PingYinUtils.getWBCode(zdIfcadre.getName()));
- int num;
- try{
- if(null != cadre){
- num = ifcadreDao.updateIfcadreByCode(zdIfcadre);
- } else {
- num = ifcadreDao.insert(zdIfcadre);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存干工标志字典失败!");
- }
- resultMap.put("cg", "保存干工标志字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存干工标志字典失败!");
- }
- }
- /**
- * @Description 根据code删除干工标志字典
- * @Author hsh
- * @param code 干工标志字典编码
- * @return map
- * @Date 2023/12/20 16:23
- */
- public ResultVo<Map<String, Object>> delIfcadreByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有干工标志字典编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = ifcadreDao.deleteIfcadreByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除干工标志字典失败!");
- }
- resultMap.put("cg", "删除干工标志字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除干工标志字典失败!");
- }
- }
- /**
- * @Description 查询在院标志字典
- * @Author hsh
- * @return ZdEmpInmark 在院标志字典信息
- * @Date 2023/12/20 16:44
- */
- public ResultVo<List<ZdEmpInmark>> selectEmpInmark(){
- return ResultVoUtil.success(empInmarkDao.selectEmpInmark());
- }
- /**
- * @Description 保存在院标志字典
- * @Author hsh
- * @param zdEmpInmark 在院标志字典信息
- * @return map
- * @Date 2023/12/20 16:45
- */
- public ResultVo<Map<String, Object>> saveEmpInmark(ZdEmpInmark zdEmpInmark){
- if(null == zdEmpInmark || zdEmpInmark.getCode() == null){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "在院标志字典信息不存在,请检查!");
- }
- if(StringUtil.notBlank(zdEmpInmark.getCode()) && zdEmpInmark.getCode().length() > 1){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "在院标志字典编码仅限一个字符,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- String code = zdEmpInmark.getCode();
- ZdEmpInmark mark = empInmarkDao.selectEmpInmarkByCode(code);
- // 根据名称生成新的拼音码和五笔码
- zdEmpInmark.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEmpInmark.getName()));
- zdEmpInmark.setDCode(PingYinUtils.getWBCode(zdEmpInmark.getName()));
- int num;
- try{
- if(null != mark){
- num = empInmarkDao.updateEmpInmarkByCode(zdEmpInmark);
- } else {
- num = empInmarkDao.insert(zdEmpInmark);
- }
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存在院标志字典失败!");
- }
- resultMap.put("cg", "保存在院标志字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存在院标志字典失败!");
- }
- }
- /**
- * @Description 根据code删除在院标志字典
- * @Author hsh
- * @param code 在院标志字典编码
- * @return map
- * @Date 2023/12/20 16:46
- */
- public ResultVo<Map<String, Object>> delEmpInmarkByCode(String code) {
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有在院标志字典编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = empInmarkDao.deleteEmpInmarkByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除在院标志字典失败!");
- }
- resultMap.put("cg", "删除在院标志字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除在院标志字典失败!");
- }
- }
- /**
- * @Description 根据text查询职工信息
- * @Author hsh
- * @param text 关键字
- * @return EmployeeMiVo 职工信息
- * @Date 2023/12/25 10:51
- */
- public ResultVo<List<EmployeeMiVo>> selectEmployeeMi(String text){
- return ResultVoUtil.success(employeeMiDao.selectEmployeeMiAll(text));
- }
- /**
- * @Description 根据code查询职工信息
- * @Author hsh
- * @param code 职工编码
- * @return EmployeeMi 职工信息
- * @Date 2023/12/26 10:39
- */
- public ResultVo<EmployeeMi> selectEmployeeMiByCode(String code){
- return ResultVoUtil.success(employeeMiDao.selectEmployeeMiByCode(code));
- }
- /**
- * @Description 根据code删除职工信息
- * @Author hsh
- * @param code 职工编码
- * @return map
- * @Date 2023/12/26 10:54
- */
- public ResultVo<Map<String, Object>> delEmployeeMiByCode(String code){
- if (StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有职工编码,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = employeeMiDao.deleteEmployeeMiByCode(code);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除职工字典失败!");
- }
- resultMap.put("cg", "删除职工字典成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除职工字典失败!");
- }
- }
- /**
- * @Description 根据code更新员工信息停用状态
- * @Author hsh
- * @param code 员工编码
- * @return map
- * @Date 2023/12/26 14:46
- */
- public ResultVo<Map<String, Object>> updateEmployeeMiDelFlagByCode(String code, String delFlag){
- if(StringUtil.isBlank(code)) {
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有职工编码,请检查!");
- }
- EmployeeMi emp = employeeMiDao.selectEmployeeMiByCode(code);
- if(null == emp){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, code + "的职工字典信息不存在,请检查!");
- }
- Map<String, Object> resultMap = new HashMap<>();
- try{
- int num = employeeMiDao.updateEmployeeMiDelFlagByCode(code, delFlag);
- if(num == 0){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新职工字典停用或启用失败!");
- }
- resultMap.put("cg", "更新职工字典停用或启用成功!");
- return ResultVoUtil.success(resultMap);
- } catch(Exception e){
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新职工字典停用或启用失败!");
- }
- }
- /**
- * @Description 根据text模糊查询,获取所有在职医生(字典用)
- * @Author hsh
- * @param text 模糊查询
- * @return CodeName 字典信息
- * @Date 2024/1/29 10:38
- */
- public ResultVo<List<CodeName>> selectEmployeeByCode(String text){
- return ResultVoUtil.success(employeeMiDao.selectEmployeeByCode(text));
- }
- }
|