BUG修复
This commit is contained in:
parent
c7a9c11d37
commit
08a9ab7b0d
|
|
@ -72,5 +72,6 @@ public interface SystemDataMapper {
|
|||
|
||||
int updateCusFieldData(CusFieldData cusFieldData);
|
||||
|
||||
Long getHrmResourceMaxId();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
<update id="updateCusFieldData">
|
||||
update cus_fielddata
|
||||
<set>
|
||||
field100001=#{field100001},
|
||||
field100002=#{field100002},
|
||||
field100003=#{field100003},
|
||||
field100008=#{field100008},
|
||||
field100006=#{field100006},
|
||||
field100007=#{field100007},
|
||||
|
|
@ -167,6 +170,10 @@
|
|||
and scopeid = #{scopeId}
|
||||
and id = #{id}
|
||||
</select>
|
||||
<select id="getHrmResourceMaxId" resultType="java.lang.Long">
|
||||
select max(id)
|
||||
from hrmresource
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -13,6 +13,7 @@ import com.engine.organization.entity.browser.po.CustomBrowserBean;
|
|||
import com.engine.organization.entity.staff.bo.StaffBO;
|
||||
import com.engine.organization.entity.staff.param.StaffSearchParam;
|
||||
import com.engine.organization.entity.staff.po.StaffPO;
|
||||
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
||||
import com.engine.organization.entity.staff.po.StaffsPO;
|
||||
import com.engine.organization.entity.staff.vo.StaffTableVO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
|
|
@ -87,6 +88,7 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
public int saveStaff(StaffSearchParam param) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
|
||||
checkRequired(staffPO);
|
||||
return getStaffMapper().insertIgnoreNull(staffPO);
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +97,7 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
StaffPO staffByID = getStaffMapper().getStaffByID(param.getId());
|
||||
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
|
||||
|
||||
checkRequired(staffPO);
|
||||
Integer changeNum = param.getChangeNum();
|
||||
if (null == changeNum) {
|
||||
// 插入明细表数据
|
||||
|
|
@ -228,20 +230,26 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
planIdItemBean.setReplaceDatas(planIdMaps);
|
||||
planIdItem.setBrowserConditionParam(planIdItemBean);
|
||||
|
||||
BrowserBean compIdItemBean = compIdItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> compIdMaps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPO.getCompId().toString()).build().getIds());
|
||||
compIdItemBean.setReplaceDatas(compIdMaps);
|
||||
compIdItem.setBrowserConditionParam(compIdItemBean);
|
||||
if (null != staffPO.getCompId()) {
|
||||
BrowserBean compIdItemBean = compIdItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> compIdMaps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPO.getCompId().toString()).build().getIds());
|
||||
compIdItemBean.setReplaceDatas(compIdMaps);
|
||||
compIdItem.setBrowserConditionParam(compIdItemBean);
|
||||
}
|
||||
|
||||
BrowserBean deptIdItemBean = deptIdItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> deptIdMaps = getDepartmentMapper().listDeptsByIds(DeleteParam.builder().ids(staffPO.getDeptId().toString()).build().getIds());
|
||||
deptIdItemBean.setReplaceDatas(deptIdMaps);
|
||||
deptIdItem.setBrowserConditionParam(deptIdItemBean);
|
||||
if (null != staffPO.getDeptId()) {
|
||||
BrowserBean deptIdItemBean = deptIdItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> deptIdMaps = getDepartmentMapper().listDeptsByIds(DeleteParam.builder().ids(staffPO.getDeptId().toString()).build().getIds());
|
||||
deptIdItemBean.setReplaceDatas(deptIdMaps);
|
||||
deptIdItem.setBrowserConditionParam(deptIdItemBean);
|
||||
}
|
||||
|
||||
BrowserBean jobIdItemBean = jobIdItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> jobIdMaps = getJobMapper().listJobsByIds(DeleteParam.builder().ids(staffPO.getJobId().toString()).build().getIds());
|
||||
jobIdItemBean.setReplaceDatas(jobIdMaps);
|
||||
jobIdItem.setBrowserConditionParam(jobIdItemBean);
|
||||
if (null != staffPO.getJobId()) {
|
||||
BrowserBean jobIdItemBean = jobIdItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> jobIdMaps = getJobMapper().listJobsByIds(DeleteParam.builder().ids(staffPO.getJobId().toString()).build().getIds());
|
||||
jobIdItemBean.setReplaceDatas(jobIdMaps);
|
||||
jobIdItem.setBrowserConditionParam(jobIdItemBean);
|
||||
}
|
||||
|
||||
staffNumItem.setValue(staffPO.getStaffNum());
|
||||
controlPolicyItem.setValue(staffPO.getControlPolicy() + "");
|
||||
|
|
@ -353,4 +361,31 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|||
return sqlWhere;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验必填字段
|
||||
*
|
||||
* @param staffPO
|
||||
*/
|
||||
private void checkRequired(StaffPO staffPO) {
|
||||
// 根据维度、校验必填字段
|
||||
StaffPlanPO staffPlanByID = getStaffPlanMapper().getStaffPlanByID(staffPO.getPlanId());
|
||||
switch (staffPlanByID.getControlDimension()) {
|
||||
case "1":// 分部
|
||||
OrganizationAssert.notNull(staffPO.getCompId(), "编制维度选择分部时,分部必填!");
|
||||
break;
|
||||
case "2":// 部门
|
||||
OrganizationAssert.notNull(staffPO.getCompId(), "编制维度选择部门时,分部必填!");
|
||||
OrganizationAssert.notNull(staffPO.getDeptId(), "编制维度选择部门时,部门必填!");
|
||||
break;
|
||||
case "3": // 岗位
|
||||
OrganizationAssert.notNull(staffPO.getCompId(), "编制维度选择岗位时,分部必填!");
|
||||
OrganizationAssert.notNull(staffPO.getDeptId(), "编制维度选择岗位时,部门必填!");
|
||||
OrganizationAssert.notNull(staffPO.getJobId(), "编制维度选择岗位时,岗位必填!");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,11 @@ public class CusFieldDataTrigger {
|
|||
|
||||
public static void run(Long id) {
|
||||
if (null == id) {
|
||||
return;
|
||||
// 查询人员表最新插入的ID
|
||||
id = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmResourceMaxId();
|
||||
if (null == id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
boolean updateFlag = false;
|
||||
// 查询当前操作的数据
|
||||
|
|
@ -50,14 +54,12 @@ public class CusFieldDataTrigger {
|
|||
directionData.setScope("HrmCustomFieldByInfoType");
|
||||
directionData.setScopeId(3L);
|
||||
directionData.setId(id);
|
||||
directionData.setField100001(sourceField100001);
|
||||
directionData.setField100002(sourceField100002);
|
||||
directionData.setField100003(sourceField100003);
|
||||
MapperProxyFactory.getProxy(SystemDataMapper.class).insertCusFieldData(directionData);
|
||||
}
|
||||
|
||||
// field100001更新
|
||||
if (null != sourceField100001 && sourceField100001.split("_").length == 2 && !sourceField100001.equals(directionData.getField100001())) {
|
||||
directionData.setField100001(sourceField100001);
|
||||
String[] field100001Array = sourceField100001.split("_");
|
||||
// 职等
|
||||
long zdId = Long.parseLong(field100001Array[1]);
|
||||
|
|
@ -79,9 +81,9 @@ public class CusFieldDataTrigger {
|
|||
}
|
||||
|
||||
// field100002更新
|
||||
if (null != sourceField100002 && sourceField100002.split("_").length == 2 && !sourceField100002.equals(directionData.getField100002())) {
|
||||
String[] field100002Array = sourceField100002.split("_");
|
||||
Long gwId = Long.parseLong(field100002Array[1]);
|
||||
if (null != sourceField100002 && !sourceField100002.equals(directionData.getField100002())) {
|
||||
directionData.setField100002(sourceField100002);
|
||||
Long gwId = Long.parseLong(sourceField100002);
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(gwId);
|
||||
JSONObject hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
|
||||
Long ecGwId = hrmJobTitleByName.getLong("id");
|
||||
|
|
@ -94,11 +96,12 @@ public class CusFieldDataTrigger {
|
|||
hrmResourceMap.put("departmentid", ecBmId);
|
||||
// 公司
|
||||
hrmResourceMap.put("subcompanyid1", ecGsId);
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateExt(ExtendInfoParams.builder().id(id).tableName("").params(hrmResourceMap).build());
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateExt(ExtendInfoParams.builder().id(id).tableName("hrmresource").params(hrmResourceMap).build());
|
||||
updateFlag = true;
|
||||
}
|
||||
|
||||
if (null != sourceField100003 && sourceField100003.split("_").length == 2 && !sourceField100003.equals(directionData.getField100003())) {
|
||||
directionData.setField100003(sourceField100003);
|
||||
String[] field100003Array = sourceField100003.split("_");
|
||||
long zwId = Long.parseLong(field100003Array[1]);
|
||||
// 职务
|
||||
|
|
|
|||
|
|
@ -55,6 +55,6 @@ public class JclOrgWrapper extends OrganizationWrapper {
|
|||
}
|
||||
|
||||
public void syncCusFieldData(String id) {
|
||||
new CusFieldDataTrigger().run(Long.parseLong(id));
|
||||
new CusFieldDataTrigger().run(StringUtils.isNotBlank(id) ? Long.parseLong(id) : null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue