|
|
@@ -12,6 +12,7 @@ import kd.bos.entity.operate.result.IOperateInfo;
|
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
|
|
+import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
|
|
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
|
|
import kd.bos.entity.validate.AbstractValidator;
|
|
|
import kd.bos.orm.query.QCP;
|
|
|
@@ -51,6 +52,11 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onPreparePropertys(PreparePropertysEventArgs e) {
|
|
|
+ e.getFieldKeys().addAll(billEntityType.getAllFields().keySet());
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
|
|
e.addValidator(new AbstractValidator(){
|
|
|
@@ -59,22 +65,29 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
List<Long> personIds = new ArrayList<>();
|
|
|
for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
|
|
|
DynamicObject data = rowDataEntity.getDataEntity();
|
|
|
- DynamicObject person = data.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
|
|
|
- if(person == null){
|
|
|
- this.addFatalErrorMessage(rowDataEntity,"请选择人员");
|
|
|
- }else{
|
|
|
- long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
- personIds.add(personId);
|
|
|
+ DynamicObjectCollection entryEntity = data.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
+ for (DynamicObject entry : entryEntity) {
|
|
|
+ DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
|
|
|
+ if(person == null){
|
|
|
+ this.addFatalErrorMessage(rowDataEntity,"请选择人员");
|
|
|
+ }else{
|
|
|
+ long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
+ personIds.add(personId);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
Map<Long, DynamicObject> empPosOrgRelMap = EmpPosOrgRelHelper.queryEmpPosOrgRelByEmployeesMap(personIds);
|
|
|
for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
|
|
|
DynamicObject data = rowDataEntity.getDataEntity();
|
|
|
- DynamicObject person = data.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
|
|
|
- if(person != null){
|
|
|
- long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
- if(empPosOrgRelMap.get(personId) == null){
|
|
|
- this.addFatalErrorMessage(rowDataEntity,StrFormatter.format("人员【{}】没有在岗状态的任职经历",person.getString(FormConstant.NAME_KEY)));
|
|
|
+ DynamicObjectCollection entryEntity = data.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
+ for (DynamicObject entry : entryEntity) {
|
|
|
+ DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
|
|
|
+ if (person != null) {
|
|
|
+ long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
+ if (empPosOrgRelMap.get(personId) == null) {
|
|
|
+ this.addFatalErrorMessage(rowDataEntity, StrFormatter.format("人员【{}】没有在岗状态的任职经历", person.getString(FormConstant.NAME_KEY)));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -90,9 +103,10 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
for (DynamicObject dataEntity : e.getDataEntities()) {
|
|
|
DynamicObjectCollection entryEntity = dataEntity.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
for (DynamicObject entry : entryEntity) {
|
|
|
+ DynamicObject person = entry.getDynamicObject(PositionStructureConstant.NCKD_PERSON);
|
|
|
boolean isEnter = entry.getBoolean(IntJobPostConstant.NCKD_ISENTER);
|
|
|
if(isEnter){
|
|
|
- personIds.add(entry.getLong(IntJobPostConstant.NCKD_PERSON));
|
|
|
+ personIds.add(person.getLong(IntJobPostConstant.ID_KEY));
|
|
|
}
|
|
|
entityIds.add(entry.getLong(IntJobPostConstant.ID_KEY));
|
|
|
}
|
|
|
@@ -110,14 +124,13 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
Map<Long, DynamicObject> latestLocusMap = findLatestLocusByPerson(personIds);
|
|
|
for (DynamicObject dataEntity : e.getDataEntities()) {
|
|
|
Date auditDate = dataEntity.getDate(IntJobPostConstant.AUDIT_DATE_KEY);
|
|
|
- long personId = dataEntity.getLong(String.join(".", IntJobPostConstant.NCKD_PERSON, IntJobPostConstant.ID_KEY));
|
|
|
String talentType = dataEntity.getString(IntJobPostConstant.NCKD_TALENTTYPE);
|
|
|
TalentTypeEnum talentTypeEnum = TalentTypeEnum.getByCode(talentType);
|
|
|
DynamicObjectCollection entryEntity = dataEntity.getDynamicObjectCollection(FormConstant.NCKD_ENTRYENTITY);
|
|
|
-
|
|
|
for (DynamicObject entry : entryEntity) {
|
|
|
long id = entry.getLong(IntJobPostConstant.ID_KEY);
|
|
|
boolean isEnter = entry.getBoolean(IntJobPostConstant.NCKD_ISENTER);
|
|
|
+ long personId = entry.getLong(String.join(".", IntJobPostConstant.NCKD_PERSON, IntJobPostConstant.ID_KEY));
|
|
|
if(isEnter){
|
|
|
DynamicObject latestRecord = latestRecordMap.get(personId);
|
|
|
if(latestRecord != null) {
|
|
|
@@ -136,7 +149,7 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
// --- B. 插入新记录 ---
|
|
|
DynamicObject newRecord = EntityHelper.newEntity(IntJobPostConstant.INTJOBPOSTRECORD_ENTITYID);
|
|
|
DynamicObject empPosOrgRel = empPosOrgRelMap.get(personId);
|
|
|
- newRecord.set(IntJobPostConstant.HRPI_EMPPOSORGREL, empPosOrgRel);
|
|
|
+ newRecord.set(IntJobPostConstant.NCKD_EMPPOSORGREL, empPosOrgRel);
|
|
|
newRecord.set(IntJobPostConstant.NCKD_ADMINORG,empPosOrgRel.get(IntJobPostConstant.ADMINORG));
|
|
|
newRecord.set(IntJobPostConstant.NCKD_ISCURRENTNEWEST, Boolean.TRUE);
|
|
|
//初始状态:进入市场
|
|
|
@@ -145,7 +158,7 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
newRecord.set(IntJobPostConstant.NCKD_BEGINDATE,dataEntity.get(IntJobPostConstant.NCKD_BIZDAY));
|
|
|
newRecord.set(IntJobPostConstant.NCKD_YEAR,dataEntity.get(IntJobPostConstant.NCKD_YEAR));
|
|
|
//分录
|
|
|
- newRecord.set(IntJobPostConstant.NCKD_INTJOBPOSTENTRY,latestRecord);
|
|
|
+ newRecord.set(IntJobPostConstant.NCKD_INTJOBPOSTENTRY,entry);
|
|
|
newRecord.set(IntJobPostConstant.NCKD_APPRAISALRESULT,entry.get(IntJobPostConstant.NCKD_APPRAISALRESULT));
|
|
|
newRecord.set(IntJobPostConstant.NCKD_BEFORELAST,entry.get(IntJobPostConstant.NCKD_BEFORELAST));
|
|
|
newRecord.set(FormConstant.CREATOR_KEY,currUserId);
|
|
|
@@ -167,7 +180,7 @@ public class IntJobPostAuditedOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
}
|
|
|
// 2. 插入新轨迹
|
|
|
DynamicObject newLocus = EntityHelper.newEntity(IntJobPostConstant.INTJOBPOSTLOCUS_ENTITYID);
|
|
|
- newLocus.set(IntJobPostConstant.HRPI_EMPPOSORGREL, empPosOrgRel);
|
|
|
+ newLocus.set(IntJobPostConstant.NCKD_EMPPOSORGREL, empPosOrgRel);
|
|
|
newLocus.set(IntJobPostConstant.NCKD_ADMINORG,empPosOrgRel.get(IntJobPostConstant.ADMINORG));
|
|
|
newLocus.set(IntJobPostConstant.NCKD_ISCURRENTNEWEST, Boolean.TRUE);
|
|
|
newLocus.set(IntJobPostConstant.NCKD_INTJOBPOSTRECORD, newRecord);
|