|
@@ -0,0 +1,302 @@
|
|
|
|
|
+package nckd.jxccl.swc.mas.plugin.form.empmgt;
|
|
|
|
|
+
|
|
|
|
|
+import kd.bos.common.enums.EnableEnum;
|
|
|
|
|
+import kd.bos.consts.PermItemConst;
|
|
|
|
|
+import kd.bos.context.RequestContext;
|
|
|
|
|
+import kd.bos.dataentity.OperateOption;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
|
|
+import kd.bos.entity.EntityMetadataCache;
|
|
|
|
|
+import kd.bos.entity.MainEntityType;
|
|
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
|
+import kd.bos.form.IFormView;
|
|
|
|
|
+import kd.bos.form.IPageCache;
|
|
|
|
|
+import kd.bos.form.MessageBoxOptions;
|
|
|
|
|
+import kd.bos.form.ShowType;
|
|
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
|
|
+import kd.bos.list.plugin.AbstractListPlugin;
|
|
|
|
|
+import kd.bos.mvc.SessionManager;
|
|
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
|
|
+import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
|
|
|
|
|
+import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|
|
|
|
+import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
|
|
+import kd.hr.hbp.common.model.AuthorizedOrgResultWithSub;
|
|
|
|
|
+import kd.sdk.hr.hbp.business.helper.permission.HRPermissionServiceHelper;
|
|
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
|
|
+import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
|
|
+import nckd.jxccl.base.common.utils.DateUtil;
|
|
|
|
|
+import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
|
|
|
+import nckd.jxccl.base.common.utils.ShowOperExecuteResult;
|
|
|
|
|
+import nckd.jxccl.base.common.utils.StrFormatter;
|
|
|
|
|
+import nckd.jxccl.base.entity.helper.EntityHelper;
|
|
|
|
|
+import nckd.jxccl.base.hrpi.helper.EmpPosOrgRelHelper;
|
|
|
|
|
+import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
|
|
|
+import nckd.jxccl.swc.mas.common.SubCoHeadServiceConstant;
|
|
|
|
|
+
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.Comparator;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+import java.util.function.BinaryOperator;
|
|
|
|
|
+import java.util.function.Function;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+* 子企业负责人任职情况-列表插件
|
|
|
|
|
+* 实体标识:nckd_subcoheadservice
|
|
|
|
|
+* @author W.Y.C
|
|
|
|
|
+* @date 2025/11/27 18:36
|
|
|
|
|
+* @version 1.0
|
|
|
|
|
+*/
|
|
|
|
|
+public class SubCoHeadServiceListPlugin extends AbstractListPlugin implements Plugin {
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs e) {
|
|
|
|
|
+ String operateKey = e.getOperateKey();
|
|
|
|
|
+ if(e.getOperationResult() != null && e.getOperationResult().isSuccess()){
|
|
|
|
|
+ if(SubCoHeadServiceConstant.LOADPARTYPOSITION_OP.equals(operateKey)){
|
|
|
|
|
+ //载入党政职务履历
|
|
|
|
|
+ loadParTyPosition();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 载入党政职务履历
|
|
|
|
|
+ * @return: void
|
|
|
|
|
+ * @author W.Y.C
|
|
|
|
|
+ * @date: 2025/11/27 18:40
|
|
|
|
|
+ */
|
|
|
|
|
+ private void loadParTyPosition(){
|
|
|
|
|
+ /*假设今年是2025年,那么符合查询条件的数据应该满足:
|
|
|
|
|
+ 开始日期 <= 2025-12-31 且 结束日期 >= 2025-01-01
|
|
|
|
|
+ 符合条件的例子:
|
|
|
|
|
+ 开始日期: 2025-03-01, 结束日期: 2025-09-30
|
|
|
|
|
+ 在今年范围内开始和结束
|
|
|
|
|
+
|
|
|
|
|
+ 开始日期: 2024-06-01, 结束日期: 2025-06-01
|
|
|
|
|
+ 跨年度,但在今年有有效期
|
|
|
|
|
+
|
|
|
|
|
+ 开始日期: 2025-08-01, 结束日期: 2026-07-31
|
|
|
|
|
+ 从今年开始延续到明年
|
|
|
|
|
+
|
|
|
|
|
+ 开始日期: 2020-01-01, 结束日期: 2030-12-31
|
|
|
|
|
+ 长期有效,覆盖今年全年
|
|
|
|
|
+ */
|
|
|
|
|
+ LocalDateTime now = DateUtil.now();
|
|
|
|
|
+
|
|
|
|
|
+ LocalDateTime beginYear = DateUtil.beginOfYear(now);
|
|
|
|
|
+ LocalDateTime endYear = DateUtil.endOfYear(now);
|
|
|
|
|
+
|
|
|
|
|
+ Date startOfYear = DateUtil.toDate(DateUtil.beginOfYear(now));
|
|
|
|
|
+ Date endOfYear = DateUtil.toDate(DateUtil.endOfYear(now));
|
|
|
|
|
+
|
|
|
|
|
+ // 只处理权限范围内的人员
|
|
|
|
|
+ Long currUserId = RequestContext.get().getCurrUserId();
|
|
|
|
|
+ AuthorizedOrgResultWithSub userAdminOrgWithSub = HRPermissionServiceHelper.getUserAdminOrgsWithSub(
|
|
|
|
|
+ currUserId, "nckd_pm", SubCoHeadServiceConstant.SUBCOHEADSERVICE_ENTITYID,
|
|
|
|
|
+ PermItemConst.ITEM_VIEW, "nckd_employee.hsbs_empposorgrel.adminorg", new HashMap<>());
|
|
|
|
|
+ QueryFieldBuilder subCoHeadServiceFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_EMPLOYEE);
|
|
|
|
|
+ //查询当年已生成子企业负责人任职情况的人员
|
|
|
|
|
+ QFilter subCoHeadServiceFilter = new QFilter(SubCoHeadServiceConstant.NCKD_YEAR, QCP.large_equals, startOfYear)
|
|
|
|
|
+ .and(SubCoHeadServiceConstant.NCKD_YEAR, QCP.less_equals, endOfYear);
|
|
|
|
|
+ DynamicObjectCollection subCoHeadServiceFilterQuery = QueryServiceHelper.query(SubCoHeadServiceConstant.SUBCOHEADSERVICE_ENTITYID, subCoHeadServiceFieldBuilder.buildSelect(), new QFilter[]{subCoHeadServiceFilter});
|
|
|
|
|
+ List<Long> employeeIds = subCoHeadServiceFilterQuery.stream()
|
|
|
|
|
+ .map(dynamicObject -> dynamicObject.getLong(String.join(".", SubCoHeadServiceConstant.NCKD_EMPLOYEE, FormConstant.ID_KEY)))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ //查询党政履历
|
|
|
|
|
+// nckd_hrpi_partyposh
|
|
|
|
|
+ QueryFieldBuilder partyPoshFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.STARTDATE)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.ENDDATE)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_PAYUNIT)
|
|
|
|
|
+ //变动时间
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_CHANGETIME)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_POSNAME)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_POSCHTP)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_POSLEVEL)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_POSGRADE)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_APPRWAY)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_OFFICEDEPT)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_APPRDOCNO)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_ISDIRCADRE)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_ORGPOSGRD)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.EMPLOYEE_KEY)
|
|
|
|
|
+ .orderDesc(SubCoHeadServiceConstant.STARTDATE,SubCoHeadServiceConstant.ENDDATE);
|
|
|
|
|
+ QFilter partyPoshFilter = new QFilter(SubCoHeadServiceConstant.STARTDATE, QCP.less_equals, endOfYear)
|
|
|
|
|
+ .and(new QFilter(SubCoHeadServiceConstant.ENDDATE, QCP.is_null,null)
|
|
|
|
|
+ .or(SubCoHeadServiceConstant.ENDDATE, QCP.large_equals, startOfYear))
|
|
|
|
|
+ //TODO 法人岗位层级为高管
|
|
|
|
|
+ .and(FormConstant.EMPLOYEE_KEY, QCP.not_in, employeeIds);
|
|
|
|
|
+ DynamicObjectCollection partyPoshQuery = QueryServiceHelper.query(FormConstant.NCKD_HRPI_PARTYPOSH, partyPoshFieldBuilder.buildSelect(), new QFilter[]{partyPoshFilter});
|
|
|
|
|
+ //按员工ID分组
|
|
|
|
|
+ Map<Long, DynamicObject> latestPartyPoshRecordMap = partyPoshQuery.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(obj -> obj.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)), Function.identity(), BinaryOperator.maxBy(Comparator.comparing(
|
|
|
|
|
+ // 按 STARTDATE 字段比较
|
|
|
|
|
+ obj -> obj.getDate(SubCoHeadServiceConstant.STARTDATE)
|
|
|
|
|
+ ))));
|
|
|
|
|
+
|
|
|
|
|
+ //查询企业负责人信息
|
|
|
|
|
+ QueryFieldBuilder entHeadFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.STARTDATE)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.ENDDATE)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_HEADTYPE)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_ISPROFMAN)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_PROFMANTYP)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_ISMANAGER)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_SALCALCPOST)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_SALNEGOT)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_TERM)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_POSTLEVEL)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_LEGPOSTLV)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.EMPLOYEE_KEY)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.NCKD_TERMCONT)
|
|
|
|
|
+ .orderDesc(SubCoHeadServiceConstant.STARTDATE,SubCoHeadServiceConstant.ENDDATE);
|
|
|
|
|
+ QFilter entHeadFilter = new QFilter(SubCoHeadServiceConstant.STARTDATE, QCP.less_equals, endOfYear)
|
|
|
|
|
+ .and(new QFilter(SubCoHeadServiceConstant.ENDDATE, QCP.is_null,null)
|
|
|
|
|
+ .or(SubCoHeadServiceConstant.ENDDATE, QCP.large_equals, startOfYear))
|
|
|
|
|
+ .and(FormConstant.EMPLOYEE_KEY,QCP.not_in, employeeIds)
|
|
|
|
|
+ //法人岗位层级为高管
|
|
|
|
|
+ .and(String.join(".", SubCoHeadServiceConstant.NCKD_LEGPOSTLV, SubCoHeadServiceConstant.NCKD_ISEXEC),QCP.equals, EnableEnum.YES.getCode());
|
|
|
|
|
+ DynamicObjectCollection entHeadQuery = QueryServiceHelper.query(FormConstant.NCKD_HRPI_ENTHEAD, entHeadFieldBuilder.buildSelect(), new QFilter[]{entHeadFilter});
|
|
|
|
|
+ Map<Long, DynamicObject> entHeadRecordMap = entHeadQuery.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(obj -> obj.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)), Function.identity(), BinaryOperator.maxBy(Comparator.comparing(
|
|
|
|
|
+ // 按 STARTDATE 字段比较
|
|
|
|
|
+ obj -> obj.getDate(SubCoHeadServiceConstant.STARTDATE)
|
|
|
|
|
+ ))));
|
|
|
|
|
+
|
|
|
|
|
+ //查询人员最新任职经历
|
|
|
|
|
+ DynamicObject[] empPosOrgRelArray = EmpPosOrgRelHelper.queryEmpPosOrgRelByEmployees(entHeadRecordMap.keySet());
|
|
|
|
|
+ List<Long> empPosOrgRelIds = Arrays.stream(empPosOrgRelArray).map(empPosOrgRel -> empPosOrgRel.getLong(FormConstant.ID_KEY)).collect(Collectors.toList());
|
|
|
|
|
+ //查询人员法人单位
|
|
|
|
|
+ QueryFieldBuilder legalPostFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.STARTDATE)
|
|
|
|
|
+ .add(SubCoHeadServiceConstant.ENDDATE)
|
|
|
|
|
+ .addIdNumberName(FormConstant.NCKD_EMPPOSORGREL,FormConstant.EMPLOYEE_KEY)
|
|
|
|
|
+ .addIdNumberName(SubCoHeadServiceConstant.NCKD_LAWENTITY);
|
|
|
|
|
+ QFilter legalPostFilter = QFilterCommonHelper.getValidDateFilter(SubCoHeadServiceConstant.STARTDATE,SubCoHeadServiceConstant.ENDDATE)
|
|
|
|
|
+ .and(FormConstant.NCKD_EMPPOSORGREL,QCP.in, empPosOrgRelIds);
|
|
|
|
|
+ DynamicObjectCollection legalPostQuery = QueryServiceHelper.query(FormConstant.NCKD_HRPI_LEGALPOST, legalPostFieldBuilder.buildSelect(), new QFilter[]{legalPostFilter});
|
|
|
|
|
+ Map<Long, DynamicObject> legalPostMap = legalPostQuery.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(obj -> obj.getLong(String.join(".",FormConstant.NCKD_EMPPOSORGREL, FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)), Function.identity(), BinaryOperator.maxBy(Comparator.comparing(
|
|
|
|
|
+ // 按 STARTDATE 字段比较
|
|
|
|
|
+ obj -> obj.getDate(SubCoHeadServiceConstant.STARTDATE)
|
|
|
|
|
+ ))));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> createOrgList = BaseDataServiceHelper.getCreateOrgList(SubCoHeadServiceConstant.SUBCOHEADSERVICE_ENTITYID);
|
|
|
|
|
+ MainEntityType bosOrgEntityType = EntityMetadataCache.getDataEntityType(FormConstant.BOS_ORG);
|
|
|
|
|
+ DynamicObject org = new DynamicObject(bosOrgEntityType);
|
|
|
|
|
+ if (!createOrgList.isEmpty()) {
|
|
|
|
|
+ org.set(FormConstant.ID_KEY, createOrgList.get(0));
|
|
|
|
|
+ }
|
|
|
|
|
+ String ctrlStrategy = BaseDataServiceHelper.getBdCtrlStrgy(SubCoHeadServiceConstant.SUBCOHEADSERVICE_ENTITYID,org.getLong(FormConstant.ID_KEY)+"");
|
|
|
|
|
+ //构建子企业负责人任职情况实体
|
|
|
|
|
+ List<DynamicObject> saveSubCoHeadServiceList = new ArrayList<>();
|
|
|
|
|
+ for (Map.Entry<Long, DynamicObject> entHeadRecordEntry : entHeadRecordMap.entrySet()) {
|
|
|
|
|
+ //企业负责人信息
|
|
|
|
|
+ DynamicObject entHead = entHeadRecordEntry.getValue();
|
|
|
|
|
+ //党政履历
|
|
|
|
|
+ DynamicObject partyPosh = latestPartyPoshRecordMap.get(entHeadRecordEntry.getKey());
|
|
|
|
|
+ DynamicObject newSubCoHeadService = EntityHelper.newEntity(SubCoHeadServiceConstant.SUBCOHEADSERVICE_ENTITYID);
|
|
|
|
|
+ newSubCoHeadService.set(FormConstant.CREATEORG_KEY,org);
|
|
|
|
|
+ newSubCoHeadService.set(FormConstant.CTRLSTRATEGY_KEY,ctrlStrategy);
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_YEAR,DateUtil.toDate(beginYear));
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_EMPLOYEE,entHeadRecordEntry.getKey());
|
|
|
|
|
+ if(partyPosh != null) {
|
|
|
|
|
+ //所属二级单位
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_PAYUNIT, partyPosh.getString(SubCoHeadServiceConstant.NCKD_PAYUNIT));
|
|
|
|
|
+ //职务
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_POSNAME,partyPosh.getString(SubCoHeadServiceConstant.NCKD_POSNAME));
|
|
|
|
|
+ //是否直管干部
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_ISDIRCADRE,partyPosh.getString(SubCoHeadServiceConstant.NCKD_ISDIRCADRE));
|
|
|
|
|
+ //任职开始时间(变动日期)
|
|
|
|
|
+ Date changeTime = entHead.getDate(SubCoHeadServiceConstant.NCKD_CHANGETIME);
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_STARTDATE,changeTime);
|
|
|
|
|
+ //TODO 任职结束时间(下一段的开始日期)
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_ENDDATE,null);
|
|
|
|
|
+ if(changeTime != null){
|
|
|
|
|
+ //【变动时间】的次月到当年年底的月数
|
|
|
|
|
+ LocalDateTime newMonths = DateUtil.addMonths(DateUtil.toLocalDateTime(changeTime), 1);
|
|
|
|
|
+ long between = DateUtil.between(newMonths, endYear, ChronoUnit.MONTHS);
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_SERVICEMONTHS,between);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ DynamicObject legalPost = legalPostMap.get(entHeadRecordEntry.getKey());
|
|
|
|
|
+ if(legalPost != null){
|
|
|
|
|
+ long lawEntityId = legalPost.getLong(String.join(".", SubCoHeadServiceConstant.NCKD_LAWENTITY, FormConstant.ID_KEY));
|
|
|
|
|
+ //法人单位
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_LAWENTITY,lawEntityId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(entHead != null){
|
|
|
|
|
+
|
|
|
|
|
+ //是否职业经理人
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_ISPROFMAN,entHead.getString(SubCoHeadServiceConstant.NCKD_ISPROFMAN));
|
|
|
|
|
+ //是否经理层成员
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_ISMANAGER,entHead.getString(SubCoHeadServiceConstant.NCKD_ISMANAGER));
|
|
|
|
|
+ //薪酬核算岗位
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_SALCALCPOST,entHead.getLong(String.join(".", SubCoHeadServiceConstant.NCKD_SALCALCPOST,FormConstant.ID_KEY)));
|
|
|
|
|
+ //薪酬是否一人一议
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_SALNEGOT,entHead.getString(SubCoHeadServiceConstant.NCKD_SALNEGOT));
|
|
|
|
|
+ //TODO 当前取的是岗位管理层级,可能要改为岗位管理层级细项
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_POSTLEVEL,entHead.getLong(String.join(".", SubCoHeadServiceConstant.NCKD_POSTLEVEL,FormConstant.ID_KEY)));
|
|
|
|
|
+ //法人岗位层级
|
|
|
|
|
+ newSubCoHeadService.set(SubCoHeadServiceConstant.NCKD_LEGPOSTLV,entHead.getLong(String.join(".", SubCoHeadServiceConstant.NCKD_LEGPOSTLV,FormConstant.ID_KEY)));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ saveSubCoHeadServiceList.add(newSubCoHeadService);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!saveSubCoHeadServiceList.isEmpty()) {
|
|
|
|
|
+ //调用save op
|
|
|
|
|
+ OperateOption option = OperateOption.create();
|
|
|
|
|
+ option.setVariableValue("action", "load");
|
|
|
|
|
+ OperationResult operationResult = SaveServiceHelper.saveOperate(SubCoHeadServiceConstant.SUBCOHEADSERVICE_ENTITYID, saveSubCoHeadServiceList.toArray(new DynamicObject[0]), option);
|
|
|
|
|
+ if (!operationResult.isSuccess()) {
|
|
|
|
|
+ String parentPageId = this.getView().getFormShowParameter().getPageId();
|
|
|
|
|
+ IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
|
|
|
|
|
+ IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
|
|
|
|
|
+ Map<String, String> customData = operationResult.getCustomData();
|
|
|
|
|
+ //成功的记录
|
|
|
|
|
+ Map<Object, Object> successMap = new HashMap<>();
|
|
|
|
|
+ for (Object successPkId : operationResult.getSuccessPkIds()) {
|
|
|
|
|
+ successMap.put(successPkId, customData.get(successPkId.toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ int billCount = operationResult.getBillCount();
|
|
|
|
|
+ int successCount = operationResult.getSuccessPkIds().size();
|
|
|
|
|
+ int validError = billCount - successCount;
|
|
|
|
|
+ String title = StrFormatter.format("载入人数:{},成功数量:{},失败数量:{}。", billCount, successCount, validError);
|
|
|
|
|
+ this.getView().showForm(ShowOperExecuteResult.getOperResultForm(title, "载入党政职务履历", successMap, pageCache, operationResult));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //刷新列表
|
|
|
|
|
+ Map<String, String> customData = operationResult.getCustomData();
|
|
|
|
|
+ Map<Object, Object> successMap = new HashMap<>();
|
|
|
|
|
+ for (Object successPkId : operationResult.getSuccessPkIds()) {
|
|
|
|
|
+ successMap.put(successPkId, customData.get(successPkId.toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!successMap.isEmpty()) {
|
|
|
|
|
+ String parentPageId = this.getView().getFormShowParameter().getPageId();
|
|
|
|
|
+ IFormView parentView = SessionManager.getCurrent().getViewNoPlugin(parentPageId);
|
|
|
|
|
+ IPageCache pageCache = (IPageCache) parentView.getService(IPageCache.class);
|
|
|
|
|
+ this.getView().showForm(ShowOperExecuteResult.getOperResultForm("载入党政职务履历", successMap, pageCache, operationResult));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.getView().invokeOperation(FormConstant.REFRESH_OP);
|
|
|
|
|
+ this.getView().showConfirm("提示", operationResult.getMessage(), MessageBoxOptions.OK, null, null, null, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.getView().showTipNotification("没有需要载入的数据!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+}
|