From a5cc902c1077b37c912a185167caafdd6c8447fa Mon Sep 17 00:00:00 2001 From: Mlin Date: Fri, 16 Dec 2022 18:31:50 +0800 Subject: [PATCH] =?UTF-8?q?oracle=E7=8E=AF=E5=A2=83=E5=AD=98=E5=85=A5?= =?UTF-8?q?=E7=89=88=E6=9C=ACbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/version/HrmDepartmentDto.java | 18 ++++ .../entity/version/HrmResourceDto.java | 25 +++++ .../entity/version/HrmSubCompanyDto.java | 15 +++ .../mapper/version/CompanyVersionMapper.java | 15 +-- .../mapper/version/CompanyVersionMapper.xml | 19 ++-- .../impl/VersionManageServiceImpl.java | 102 +++++++++--------- 6 files changed, 125 insertions(+), 69 deletions(-) create mode 100644 src/com/engine/organization/entity/version/HrmDepartmentDto.java create mode 100644 src/com/engine/organization/entity/version/HrmResourceDto.java create mode 100644 src/com/engine/organization/entity/version/HrmSubCompanyDto.java diff --git a/src/com/engine/organization/entity/version/HrmDepartmentDto.java b/src/com/engine/organization/entity/version/HrmDepartmentDto.java new file mode 100644 index 00000000..39304088 --- /dev/null +++ b/src/com/engine/organization/entity/version/HrmDepartmentDto.java @@ -0,0 +1,18 @@ +package com.engine.organization.entity.version; + +import lombok.Data; + +@Data +public class HrmDepartmentDto { + + int id; + String departmentmark; + String departmentcode; + String departmentname; + String subcompanyid1; + String supdepid; + String bmfzr; + String showorder; + String canceled; + +} diff --git a/src/com/engine/organization/entity/version/HrmResourceDto.java b/src/com/engine/organization/entity/version/HrmResourceDto.java new file mode 100644 index 00000000..702b559d --- /dev/null +++ b/src/com/engine/organization/entity/version/HrmResourceDto.java @@ -0,0 +1,25 @@ +package com.engine.organization.entity.version; + + +import lombok.Data; + +@Data +public class HrmResourceDto { + private Integer id; + + private Integer departmentid; + + private String dsporder; + + private Integer subcompanyid1; + + private Integer jobtitle; + + private String mobile; + + private String telephone; + + private String managerid; + + private String lastname; +} diff --git a/src/com/engine/organization/entity/version/HrmSubCompanyDto.java b/src/com/engine/organization/entity/version/HrmSubCompanyDto.java new file mode 100644 index 00000000..4168004e --- /dev/null +++ b/src/com/engine/organization/entity/version/HrmSubCompanyDto.java @@ -0,0 +1,15 @@ +package com.engine.organization.entity.version; + +import lombok.Data; + +@Data +public class HrmSubCompanyDto { + + int id; + String subcompanydesc; + String subcompanycode; + String subcompanyname; + String supsubcomid; + String showorder; + String canceled; +} diff --git a/src/com/engine/organization/mapper/version/CompanyVersionMapper.java b/src/com/engine/organization/mapper/version/CompanyVersionMapper.java index 4a2d8a70..e3e225c1 100644 --- a/src/com/engine/organization/mapper/version/CompanyVersionMapper.java +++ b/src/com/engine/organization/mapper/version/CompanyVersionMapper.java @@ -1,15 +1,10 @@ package com.engine.organization.mapper.version; import com.alibaba.fastjson.JSONObject; -import com.engine.common.entity.HrmDepartmentEntity; -import com.engine.common.entity.HrmSubCompanyEntity; -import com.engine.organization.entity.version.HrmDepartmentVersion; -import com.engine.organization.entity.version.HrmResourceVersion; -import com.engine.organization.entity.version.HrmSubCompanyVersion; +import com.engine.organization.entity.version.*; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; /** * @Author weaver_cl @@ -45,7 +40,7 @@ public interface CompanyVersionMapper { /** * 人员版本最大记录 */ - HrmResourceVersion getMaxHrmVersion(@Param("getMaxHrmVersion") String getMaxHrmVersion); + HrmResourceVersion getMaxHrmVersion(@Param("resourceid") String resourceid); /** * 新增人员版本 @@ -55,17 +50,17 @@ public interface CompanyVersionMapper { /** * 获取分部信息 */ - JSONObject getHrmSubComp(@Param("id") String id); + HrmSubCompanyDto getHrmSubComp(@Param("id") String id); /** * 获取部门信息 */ - JSONObject getHrmDepartment(@Param("id") String id); + HrmDepartmentDto getHrmDepartment(@Param("id") String id); /** * 获取人员信息 */ - JSONObject getHrmResource(@Param("id") String id); + HrmResourceDto getHrmResource(@Param("id") String id); /** * 获取分部版本记录 diff --git a/src/com/engine/organization/mapper/version/CompanyVersionMapper.xml b/src/com/engine/organization/mapper/version/CompanyVersionMapper.xml index a801ec6f..04d66b13 100644 --- a/src/com/engine/organization/mapper/version/CompanyVersionMapper.xml +++ b/src/com/engine/organization/mapper/version/CompanyVersionMapper.xml @@ -39,9 +39,9 @@ insert into hrmsubcompany_version - (subcomid ,subcompanydesc ,subcompanycode ,subcompanyname ,supsubcomid , + (id, subcomid ,subcompanydesc ,subcompanycode ,subcompanyname ,supsubcomid , showorder ,canceled ,description ,operator ,version ,operate_time) - values (#{subComId}, #{subCompanyDesc}, #{subCompanyCode}, #{subCompanyName}, #{supSubComId}, + values (#{id},#{subComId}, #{subCompanyDesc}, #{subCompanyCode}, #{subCompanyName}, #{supSubComId}, #{showOrder}, #{canceled}, #{description}, #{operator}, #{version}, #{operateTime}) @@ -57,9 +57,9 @@ insert into hrmdepartment_version - (departmentid, departmentmark, departmentcode, departmentname, subcompanyid1, supdepid, + (id,departmentid, departmentmark, departmentcode, departmentname, subcompanyid1, supdepid, bmfzr, showorder, canceled, description, operator, version, operate_time) - VALUES (#{departmentId}, #{departmentMark}, #{departmentCode}, #{departmentName}, #{subCompanyId1}, #{supDepId}, + VALUES (#{id},#{departmentId}, #{departmentMark}, #{departmentCode}, #{departmentName}, #{subCompanyId1}, #{supDepId}, #{bmfzr}, #{showOrder}, #{canceled}, #{description}, #{operator}, #{version}, #{operateTime}) @@ -71,7 +71,6 @@ @@ -234,15 +233,15 @@ - + select id ,subcompanyname, subcompanydesc,companyid,supsubcomid,url,canceled,subcompanycode,outkey,showorder from HrmSubCompany where id=#{id} - select id,departmentmark,departmentname,subcompanyid1,supdepid,canceled,departmentcode,outkey,showorder,coadjutant,bmfzr from HrmDepartment where id=#{id} - select id,loginid,password,lastname,sex,birthday,nationality,systemlanguage, maritalstatus,telephone,mobile,mobilecall,email,locationid,workroom,homeaddress, resourcetype,startdate,enddate,jobtitle,jobactivitydesc,joblevel,seclevel,departmentid, @@ -257,7 +256,7 @@ needdynapass,dsporder,passwordstate,accounttype,belongto,dactylogram,assistantdactylogram, passwordlock,sumpasswordwrong,oldpassword1,oldpassword2,msgStyle,messagerurl,pinyinlastname, tokenkey,userUsbType,outkey,adsjgs,adgs,adbm,mobileshowtype,usbstate,totalSpace,occupySpace, - ecology_pinyin_search,isADAccount,accountname,notallot,beforefrozen,resourcefrom,isnewuser, + ecology_pinyin_search,isADAccount,accountname, haschangepwd,created,creater,modified,modifier,passwordlocktime,mobilecaflag,salt,companystartdate, workstartdate,secondaryPwd,useSecondaryPwd,classification,uuid,passwordLockReason,companyworkyear, workyear,DISMISSDATE,encKey,crc,usbscope,tenant_key,clauthtype,hashData,signData from HrmResource diff --git a/src/com/engine/organization/service/impl/VersionManageServiceImpl.java b/src/com/engine/organization/service/impl/VersionManageServiceImpl.java index ca25eeed..743176f9 100644 --- a/src/com/engine/organization/service/impl/VersionManageServiceImpl.java +++ b/src/com/engine/organization/service/impl/VersionManageServiceImpl.java @@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.engine.core.impl.Service; import com.engine.organization.entity.hrmresource.po.HrmResourcePO; import com.engine.organization.entity.map.JclOrgMap; -import com.engine.organization.entity.version.HrmDepartmentVersion; -import com.engine.organization.entity.version.HrmResourceVersion; -import com.engine.organization.entity.version.HrmSubCompanyVersion; -import com.engine.organization.entity.version.VersionData; +import com.engine.organization.entity.version.*; import com.engine.organization.enums.ModuleTypeEnum; import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.resource.ResourceMapper; @@ -16,6 +13,7 @@ import com.engine.organization.service.VersionManageService; import com.engine.organization.util.OrganizationDateUtil; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; +import org.docx4j.wml.U; import weaver.common.DateUtil; import weaver.conn.RecordSet; import weaver.general.Util; @@ -49,18 +47,18 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe switch (moduleTypeEnum.getValue()) { case 1: - paramMap = getCompanyVersionMapper().getHrmSubComp(id); - saveSubComToVersion(paramMap, user); + HrmSubCompanyDto hrmSubComp = getCompanyVersionMapper().getHrmSubComp(id); + saveSubComToVersion(hrmSubComp, user); // saveSubComToMap(paramMap); break; case 2: - paramMap = getCompanyVersionMapper().getHrmDepartment(id); - saveDeptToVersion(paramMap, user); + HrmDepartmentDto hrmDepartmentDto = getCompanyVersionMapper().getHrmDepartment(id); + saveDeptToVersion(hrmDepartmentDto, user); // saveDeptToMap(paramMap); break; case 4: - paramMap = getCompanyVersionMapper().getHrmResource(id); - saveHrmToVersion(paramMap, user); + HrmResourceDto hrmResourceDto = getCompanyVersionMapper().getHrmResource(id); + saveHrmToVersion(hrmResourceDto, user); // saveHrmToMap(paramMap); break; } @@ -324,27 +322,30 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe /** * 分部保存至版本表 */ - void saveSubComToVersion(JSONObject params, User user) { + void saveSubComToVersion(HrmSubCompanyDto hrmSubComp, User user) { String currentDate = OrganizationDateUtil.getFormatLocalDateTime(new java.util.Date()); - String id = params.getString("id"); + int id = hrmSubComp.getId(); HrmSubCompanyVersion hrmSubCompanyVersion = new HrmSubCompanyVersion(); - hrmSubCompanyVersion.setSubComId(Integer.parseInt(id)); - hrmSubCompanyVersion.setSubCompanyDesc(params.getString("subcompanydesc")); - hrmSubCompanyVersion.setSubCompanyCode(params.getString("subcompanycode")); - hrmSubCompanyVersion.setSubCompanyName(params.getString("subcompanyname")); - String supSubComId = params.getString("supsubcomid"); + hrmSubCompanyVersion.setSubComId(id); + hrmSubCompanyVersion.setSubCompanyDesc(hrmSubComp.getSubcompanydesc()); + hrmSubCompanyVersion.setSubCompanyCode(hrmSubComp.getSubcompanycode()); + hrmSubCompanyVersion.setSubCompanyName(hrmSubComp.getSubcompanyname()); + String supSubComId = hrmSubComp.getSupsubcomid(); hrmSubCompanyVersion.setSupSubComId(StringUtils.isNotBlank(supSubComId) ? Integer.parseInt(supSubComId) : null); - String showOrder = params.getString("showorder"); - if (showOrder != null) { - showOrder = showOrder.substring(0, showOrder.indexOf(".")); + String showOrder = hrmSubComp.getShoworder(); + if (showOrder != null && !showOrder.equals("0")) { + int length = showOrder.indexOf("."); + if (length>0){ + showOrder = showOrder.substring(0, length); + } } hrmSubCompanyVersion.setShowOrder(null == showOrder ? null : Integer.parseInt(showOrder)); - String canceled = params.getString("canceled"); + String canceled = hrmSubComp.getCanceled(); ; hrmSubCompanyVersion.setCanceled(StringUtils.isNotBlank(canceled) ? Integer.parseInt(canceled) : null); hrmSubCompanyVersion.setDescription(null); hrmSubCompanyVersion.setOperator(user.getUsername()); - hrmSubCompanyVersion.setVersion(genVersionId(1, id)); + hrmSubCompanyVersion.setVersion(genVersionId(1, Util.null2String(id))); hrmSubCompanyVersion.setOperateTime(new Timestamp(OrganizationDateUtil.stringToDateTime(currentDate).getTime())); getCompanyVersionMapper().insertHrmSubComVersion(hrmSubCompanyVersion); } @@ -352,35 +353,38 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe /** * 部门保存至版本 */ - void saveDeptToVersion(JSONObject params, User user) { - String id = params.getString("id"); + void saveDeptToVersion(HrmDepartmentDto hrmDepartmentDto, User user) { + int id = hrmDepartmentDto.getId(); String currentDate = OrganizationDateUtil.getFormatLocalDateTime(new java.util.Date()); HrmDepartmentVersion hrmDepartmentVersion = new HrmDepartmentVersion(); - hrmDepartmentVersion.setDepartmentId(Integer.parseInt(id)); - hrmDepartmentVersion.setDepartmentMark(params.getString("departmentmark")); - hrmDepartmentVersion.setDepartmentCode(params.getString("departmentcode")); - hrmDepartmentVersion.setDepartmentName(params.getString("departmentname")); - String subCompanyId1 = params.getString("subcompanyid1"); + hrmDepartmentVersion.setDepartmentId(id); + hrmDepartmentVersion.setDepartmentMark(hrmDepartmentDto.getDepartmentmark()); + hrmDepartmentVersion.setDepartmentCode(hrmDepartmentDto.getDepartmentcode()); + hrmDepartmentVersion.setDepartmentName(hrmDepartmentDto.getDepartmentname()); + String subCompanyId1 = hrmDepartmentDto.getSubcompanyid1(); hrmDepartmentVersion.setSubCompanyId1(StringUtils.isNotBlank(subCompanyId1) ? Integer.parseInt(subCompanyId1) : null); - String supDepId = params.getString("supdepid"); + String supDepId = hrmDepartmentDto.getSupdepid(); if (supDepId != null) { hrmDepartmentVersion.setSupDepId(Integer.parseInt(supDepId)); } - String bmfzr = params.getString("bmfzr"); + String bmfzr = hrmDepartmentDto.getBmfzr(); if (!"".equals(bmfzr) && bmfzr != null) { hrmDepartmentVersion.setBmfzr(Integer.parseInt(bmfzr)); } - String showOrder = params.getString("showorder"); - if (showOrder != null) { - showOrder = showOrder.substring(0, showOrder.indexOf(".")); + String showOrder = hrmDepartmentDto.getShoworder(); + if (showOrder != null && !showOrder.equals("0")) { + int length = showOrder.indexOf("."); + if (length>0){ + showOrder = showOrder.substring(0, length); + } } hrmDepartmentVersion.setShowOrder(null == showOrder ? null : Integer.parseInt(showOrder)); - String canceled = params.getString("canceled"); + String canceled = hrmDepartmentDto.getCanceled(); hrmDepartmentVersion.setCanceled(StringUtils.isNotBlank(canceled) ? Integer.parseInt(canceled) : null); hrmDepartmentVersion.setDescription(null); hrmDepartmentVersion.setOperator(user.getLastname()); - hrmDepartmentVersion.setVersion(genVersionId(2, id)); + hrmDepartmentVersion.setVersion(genVersionId(2, Util.null2String(id))); hrmDepartmentVersion.setOperateTime(new Timestamp(OrganizationDateUtil.stringToDateTime(currentDate).getTime())); getCompanyVersionMapper().insertHrmDeptVersion(hrmDepartmentVersion); @@ -389,27 +393,27 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe /** * 人员保存至版本 */ - void saveHrmToVersion(JSONObject params, User user) { - String id = params.getString("id"); + void saveHrmToVersion(HrmResourceDto hrmResourceDto, User user) { + Integer id = hrmResourceDto.getId(); String currentDate = OrganizationDateUtil.getFormatLocalDateTime(new java.util.Date()); HrmResourceVersion hrmResourceVersion = new HrmResourceVersion(); - hrmResourceVersion.setResourceid(Integer.parseInt(id)); + hrmResourceVersion.setResourceid(id); /* hrmResourceVersion.setCompanystartdate(new Date(OrganizationDateUtil.stringToDate((String) params.get("companystartdate")).getTime())); hrmResourceVersion.setCompanyworkyear(Integer.parseInt((String) params.get("companyworkyear"))); hrmResourceVersion.setWorkstartdate(new Date(OrganizationDateUtil.stringToDate((String) params.get("workstartdate")).getTime()));*/ - hrmResourceVersion.setDepartmentid(Integer.parseInt(params.getString("departmentid"))); - hrmResourceVersion.setDsporder(Double.valueOf(params.getString("dsporder")).intValue()); - hrmResourceVersion.setSubcompanyid1(Integer.parseInt(params.getString("subcompanyid1"))); - hrmResourceVersion.setJobtitle(Integer.parseInt(params.getString("jobtitle"))); - hrmResourceVersion.setMobile(params.getString("mobile")); - hrmResourceVersion.setTelephone(params.getString("telephone")); - String managerid = params.getString("managerid"); + hrmResourceVersion.setDepartmentid(hrmResourceDto.getDepartmentid()); + hrmResourceVersion.setDsporder(Double.valueOf(hrmResourceDto.getDsporder()).intValue()); + hrmResourceVersion.setSubcompanyid1(hrmResourceDto.getSubcompanyid1()); + hrmResourceVersion.setJobtitle(hrmResourceDto.getJobtitle()); + hrmResourceVersion.setMobile(hrmResourceDto.getMobile()); + hrmResourceVersion.setTelephone(hrmResourceDto.getTelephone()); + String managerid = hrmResourceDto.getManagerid(); hrmResourceVersion.setManagerid(StringUtils.isNotBlank(managerid) ? Integer.parseInt(managerid) : null); - hrmResourceVersion.setLastname(params.getString("lastname")); + hrmResourceVersion.setLastname(hrmResourceDto.getLastname()); hrmResourceVersion.setOperator(user.getLastname()); - hrmResourceVersion.setVersion(genVersionId(4, id)); + hrmResourceVersion.setVersion(genVersionId(4, String.valueOf(id))); hrmResourceVersion.setOperateTime(new Timestamp(OrganizationDateUtil.stringToDateTime(currentDate).getTime())); getCompanyVersionMapper().insertHrmResourceVersion(hrmResourceVersion); @@ -435,7 +439,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe id = 0.1 + hrmDepartmentVersion.getVersion(); } break; - case 3: + case 4: HrmResourceVersion hrmResourceVersion = getCompanyVersionMapper().getMaxHrmVersion(sid); if (null != hrmResourceVersion) { id = 0.1 + hrmResourceVersion.getVersion();