|
|
@@ -6,6 +6,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.entity.EntityMetadataCache;
|
|
|
import kd.bos.entity.MainEntityType;
|
|
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
|
|
+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;
|
|
|
@@ -15,11 +16,13 @@ import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
+import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|
|
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.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -44,6 +47,9 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
|
|
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
|
|
e.getFieldKeys().add(EmployeesField);
|
|
|
e.getFieldKeys().add(BillTypeField);
|
|
|
+ e.getFieldKeys().add("nckd_newposition.id");
|
|
|
+ e.getFieldKeys().add("nckd_newsalaryrank.id");
|
|
|
+ e.getFieldKeys().add("nckd_newhradminorg.id");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -59,66 +65,81 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
|
|
|
|
|
|
List<Long> employeeIDs = getSelectedEmployees(datas);
|
|
|
|
|
|
+ Map<String,Object> papams = new HashMap<>();
|
|
|
+ List<Map<String,Object>> applyBillData = new ArrayList<>();
|
|
|
Map<String,Object> applyBill = new HashMap<>();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 必填字段
|
|
|
+ * "billname", "billtype", "org", "billcountry", "salaryadjrsn", "salaryadjscm", "billcurrency", "effectivedate", "exchangeratedate", "exctable"
|
|
|
+ */
|
|
|
applyBill.put("billname","员工待定调薪清单-生成");
|
|
|
|
|
|
Long orgId = RequestContext.get().getOrgId();
|
|
|
|
|
|
+ String uniquecode = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ applyBill.put("_uniquecode", uniquecode);
|
|
|
applyBill.put("org",orgId);
|
|
|
- applyBill.put("billcountry", 1000001L); //国家
|
|
|
+ applyBill.put("billtype", 2215975998602655744L); //定调薪明细字段显示方案 调薪明细字段
|
|
|
+ applyBill.put("billcountry", 1000001L); //国家
|
|
|
applyBill.put("salaryadjrsn", 2352340656979984384L); //定调薪类型
|
|
|
- applyBill.put("billcurrency", 1L); //默认币种
|
|
|
+ applyBill.put("billcurrency", 1L); //默认币种
|
|
|
+ applyBill.put("salaryadjscm", 2322515162646457344L); //定调薪方案
|
|
|
applyBill.put("exchangeratedate", new Date()); //汇率日期
|
|
|
applyBill.put("exctable", 2321965096026258432L); //汇率表
|
|
|
applyBill.put("effectivedate", new Date()); //默认生效日期
|
|
|
applyBill.put("isdraft", "1"); //草稿状态
|
|
|
applyBill.put("datasource", "2"); //申请单数据来源 //1:手工新增 2:接口写入
|
|
|
|
|
|
- Map<Long, DynamicObject> salaryfileMap = getSalaryFileInfo(employeeIDs);
|
|
|
-
|
|
|
List<Map<String,Object>> applyBillEntryData = new ArrayList<>();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 必填字段
|
|
|
+ * "adjfile", "standarditem", "frequency", "amount"
|
|
|
+ */
|
|
|
for (DynamicObject data : datas) {
|
|
|
Map<String,Object> applyBillEntry = new HashMap<>();
|
|
|
Long employeeId = data.getLong(EmployeesField);
|
|
|
- DynamicObject salaryfile = salaryfileMap.get(employeeId);
|
|
|
+ Long positionId = data.getLong("nckd_newposition.id");
|
|
|
+ DynamicObject salaryfile = getSalaryFileInfo(employeeId,positionId);
|
|
|
applyBillEntry.put("adjfile", salaryfile.getLong("boid"));
|
|
|
applyBillEntry.put("employee", employeeId);
|
|
|
- applyBillEntry.put("hcdmorg", salaryfile.getLong("org.id")); //薪酬管理组织
|
|
|
- applyBillEntry.put("country", salaryfile.getLong("country.id")); //薪酬管理属地
|
|
|
- applyBillEntry.put("salarystructure", salaryfile.getLong("salarystructure.id")); //薪酬结构
|
|
|
- applyBillEntry.put("stdscmv", salaryfile.getLong("stdscm.id")); //
|
|
|
- applyBillEntry.put("empgroup", salaryfile.getLong("empgroup.id")); //定调薪档案分组
|
|
|
+ applyBillEntry.put("standarditem", 2321899710350111744L); //定调薪项目 岗位工资标准
|
|
|
+ applyBillEntry.put("frequency", 1095454108284088320L); //频度 月
|
|
|
+ applyBillEntry.put("amount", BigDecimal.ZERO);
|
|
|
applyBillEntry.put("nckd_postgrade", salaryfile.getLong("position.nckd_postgrade.id")); //岗级
|
|
|
- applyBillEntry.put("position", data.getLong("nckd_newposition"));
|
|
|
- applyBillEntry.put("salaryrank", data.getLong("nckd_newsalaryrank"));
|
|
|
- applyBillEntry.put("adminorg", data.getLong("nckd_newhradminorg"));
|
|
|
+ applyBillEntry.put("position", positionId);
|
|
|
+ applyBillEntry.put("salaryrank", data.getLong("nckd_newsalaryrank.id"));
|
|
|
applyBillEntryData.add(applyBillEntry);
|
|
|
}
|
|
|
applyBill.put("applybillent", applyBillEntryData);
|
|
|
- Map<String, Object> result = HCDMApplyBillServiceHelper.saveDraftApplyBill(applyBill);
|
|
|
- System.out.println(result);
|
|
|
+ applyBillData.add(applyBill);
|
|
|
+ papams.put("data", applyBillData);
|
|
|
+ Map<String, Object> result = HCDMApplyBillServiceHelper.saveDraftApplyBill(papams);
|
|
|
+ System.out.println("BuildApplyBillOpPlugin:"+result.toString());
|
|
|
+ ///返回界面的数据
|
|
|
+ //this.operationResult.setCustomData(result);
|
|
|
+
|
|
|
+ //OperationResult updatepersonOp = OperationServiceHelper.executeOperate("updatepersoninfo_and_match", "", new DynamicObject[]{change}, OperateOption.create());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取员工定调薪档案 hcdm_adjfileinfo
|
|
|
+ * 员工定调薪档案 会有多条,需要按岗位获取
|
|
|
+ * @param employeeID 员工ID
|
|
|
+ * @param positionID 岗位ID
|
|
|
*/
|
|
|
- public Map<Long, DynamicObject> getSalaryFileInfo(List<Long> employeeIDs){
|
|
|
+ public DynamicObject getSalaryFileInfo(Long employeeID, Long positionID){
|
|
|
|
|
|
- QFilter qFilter = new QFilter("employee.id", QCP.in, employeeIDs);
|
|
|
+ QFilter qFilter = new QFilter("employee.id", QCP.equals, employeeID);
|
|
|
QFilter qFilter1 = new QFilter("iscurrentversion", QCP.equals, "1"); // 启用
|
|
|
QFilter qFilter2 = new QFilter("datastatus", QCP.equals, "1"); // 启用
|
|
|
+ QFilter qFilter3 = new QFilter("position.id", QCP.equals, positionID);
|
|
|
String selectField = "id,boid,number,employee.id,org.id,country.id,salarystructure.id,stdscm.id,empgroup.id,position.nckd_postgrade.id";
|
|
|
- DynamicObjectCollection employeesFiles = QueryServiceHelper.query("hcdm_adjfileinfo", selectField, new QFilter[]{qFilter,qFilter1,qFilter2});
|
|
|
-
|
|
|
- Map<Long, DynamicObject> salaryfileMap = (Map)employeesFiles.stream().collect(Collectors.toMap((obj) -> {
|
|
|
- return obj.getLong("employee.id");
|
|
|
- }, (obj) -> {
|
|
|
- return obj;
|
|
|
- }, (k1, k2) -> {
|
|
|
- return k1;
|
|
|
- }));
|
|
|
+ DynamicObject employeesFiles = QueryServiceHelper.queryOne("hcdm_adjfileinfo", selectField, new QFilter[]{qFilter,qFilter1,qFilter2,qFilter3});
|
|
|
|
|
|
- return salaryfileMap;
|
|
|
+ return employeesFiles;
|
|
|
}
|
|
|
|
|
|
/**
|