|
@@ -0,0 +1,68 @@
|
|
|
|
|
+package nckd.jxccl.hr.tsc.plugin.form;
|
|
|
|
|
+
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
+import kd.bos.entity.datamodel.events.BizDataEventArgs;
|
|
|
|
|
+import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
|
|
+import kd.bos.form.operate.FormOperate;
|
|
|
|
|
+import kd.bos.servicehelper.user.UserServiceHelper;
|
|
|
|
|
+import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
|
|
+import kd.hr.hbp.formplugin.web.template.HRBaseDataTplEdit;
|
|
|
|
|
+import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
|
|
+import nckd.jxccl.base.swc.helper.SWCHelper;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 政策公告插件
|
|
|
|
|
+ * @author turborao
|
|
|
|
|
+ * 时间 2026/1/13 16:05
|
|
|
|
|
+ */
|
|
|
|
|
+public class AnnouncementsBasePlugin extends HRBaseDataTplEdit implements Plugin {
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void createNewData(BizDataEventArgs e) {
|
|
|
|
|
+ super.createNewData(e);
|
|
|
|
|
+
|
|
|
|
|
+ Long userId = UserServiceHelper.getCurrentUserId();
|
|
|
|
|
+
|
|
|
|
|
+ DynamicObject personUserDyn = SWCHelper.queryOne(FormConstant.HRPI_PERSONUSERREL, "employee.id","user",userId);
|
|
|
|
|
+
|
|
|
|
|
+ Long empId = 0L;
|
|
|
|
|
+ if(personUserDyn == null){
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 没有员工信息时,返回常量,用于测试
|
|
|
|
|
+ */
|
|
|
|
|
+ //KEY_EMPID = 2313784485549715456L;
|
|
|
|
|
+ this.getView().showMessage("未找到员工!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ empId = personUserDyn.getLong("employee.id");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> employeeIds = new java.util.ArrayList<>();
|
|
|
|
|
+ employeeIds.add(empId);
|
|
|
|
|
+ DynamicObject[] empDyns = SWCHelper.queryEmpPosOrgRelDyns(employeeIds);
|
|
|
|
|
+ if(empDyns != null && empDyns.length > 0){
|
|
|
|
|
+ Long companyId = empDyns[0].getLong("company.id");
|
|
|
|
|
+ this.getModel().setValue("nckd_hradminorg", companyId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
|
|
|
+ FormOperate source = (FormOperate)args.getSource();
|
|
|
|
|
+ String formOp = source.getOperateKey();
|
|
|
|
|
+ DynamicObject data = this.getModel().getDataEntity();
|
|
|
|
|
+ HRBaseServiceHelper hrBaseServiceHelper = new HRBaseServiceHelper(FormConstant.NCKD_ANNOUNCEMENTS);
|
|
|
|
|
+ if ("publish".equals(formOp)) {
|
|
|
|
|
+ data.set("nckd_billstatus", "C");
|
|
|
|
|
+ data.set("nckd_publishdate", new java.util.Date());
|
|
|
|
|
+ data.set("nckd_publishuser", UserServiceHelper.getCurrentUserId());
|
|
|
|
|
+ Object billPk = hrBaseServiceHelper.saveOne(data);
|
|
|
|
|
+ }
|
|
|
|
|
+ if("withdraw".equals(formOp)){
|
|
|
|
|
+ data.set("nckd_billstatus", "A");
|
|
|
|
|
+ Object billPk = hrBaseServiceHelper.saveOne(data);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|