|
|
@@ -7,14 +7,18 @@ import kd.bos.entity.EntityMetadataCache;
|
|
|
import kd.bos.entity.MainEntityType;
|
|
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
|
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
|
+import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
|
|
+import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
|
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
|
|
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
|
|
import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
+import kd.scm.common.util.DynamicObjectUtil;
|
|
|
import kd.sdk.plugin.Plugin;
|
|
|
import kd.sdk.swc.hcdm.business.helper.HCDMApplyBillServiceHelper;
|
|
|
+import nckd.jxccl.base.entity.helper.EntityHelper;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -26,21 +30,34 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
|
|
|
|
|
+ /**
|
|
|
+ * 员工待定调薪清单 员工ID
|
|
|
+ */
|
|
|
+ private static final String EmployeesField = "nckd_employeefield.id";
|
|
|
+ private static final String BillTypeField = "nckd_billtype";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * this.getDataEntities()中需要加载的字段,增加员工待定调薪清单中员工ID
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void onPreparePropertys(PreparePropertysEventArgs e) {
|
|
|
+ e.getFieldKeys().add(EmployeesField);
|
|
|
+ e.getFieldKeys().add(BillTypeField);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAddValidators(AddValidatorsEventArgs e) {
|
|
|
+ super.onAddValidators(e);
|
|
|
+ e.addValidator(new SalaryAdjDelivaryDateValidator());
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void beginOperationTransaction(BeginOperationTransactionArgs e) {
|
|
|
super.beginOperationTransaction(e);
|
|
|
DynamicObject[] datas = e.getDataEntities();
|
|
|
|
|
|
- Map<Long, DynamicObject> employeeMap =
|
|
|
- Arrays.stream(datas)
|
|
|
- .collect(Collectors.toMap(
|
|
|
- detail -> detail.getLong("nckd_employeefield"),
|
|
|
- detail -> detail, // 整个 DynamicObject 作为 value
|
|
|
- (existing, replacement) -> existing // 保留前面的值
|
|
|
- ));
|
|
|
-
|
|
|
- List<Long> employeeIDs = employeeMap.keySet().stream().collect(Collectors.toList());
|
|
|
+ List<Long> employeeIDs = getSelectedEmployees(datas);
|
|
|
|
|
|
Map<String,Object> applyBill = new HashMap<>();
|
|
|
applyBill.put("billname","员工待定调薪清单-生成");
|
|
|
@@ -62,7 +79,7 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
|
|
|
List<Map<String,Object>> applyBillEntryData = new ArrayList<>();
|
|
|
for (DynamicObject data : datas) {
|
|
|
Map<String,Object> applyBillEntry = new HashMap<>();
|
|
|
- Long employeeId = data.getLong("nckd_employeefield");
|
|
|
+ Long employeeId = data.getLong(EmployeesField);
|
|
|
DynamicObject salaryfile = salaryfileMap.get(employeeId);
|
|
|
applyBillEntry.put("adjfile", salaryfile.getLong("boid"));
|
|
|
applyBillEntry.put("employee", employeeId);
|
|
|
@@ -104,6 +121,24 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
|
|
|
return salaryfileMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取员工待定调薪清单中员工ID
|
|
|
+ * @param datas DynamicObject[]
|
|
|
+ */
|
|
|
+ public List<Long> getSelectedEmployees(DynamicObject[] datas){
|
|
|
+
|
|
|
+ Map<Long, DynamicObject> employeeMap =
|
|
|
+ Arrays.stream(datas)
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ detail -> detail.getLong(EmployeesField),
|
|
|
+ detail -> detail, // 整个 DynamicObject 作为 value
|
|
|
+ (existing, replacement) -> existing // 保留前面的值
|
|
|
+ ));
|
|
|
+
|
|
|
+ List<Long> employeeIDs = employeeMap.keySet().stream().collect(Collectors.toList());
|
|
|
+ return employeeIDs;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|