|
@@ -4,13 +4,13 @@ import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.dataentity.entity.LocaleString;
|
|
import kd.bos.dataentity.entity.LocaleString;
|
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
|
|
+import kd.bos.form.control.Control;
|
|
|
import kd.bos.form.control.Label;
|
|
import kd.bos.form.control.Label;
|
|
|
import kd.bos.form.control.grid.DataGrid;
|
|
import kd.bos.form.control.grid.DataGrid;
|
|
|
import kd.bos.form.control.grid.DataGridRow;
|
|
import kd.bos.form.control.grid.DataGridRow;
|
|
|
import kd.bos.form.control.grid.DataGridRowBuilder;
|
|
import kd.bos.form.control.grid.DataGridRowBuilder;
|
|
|
import kd.bos.form.control.grid.column.AmountDataGridColumn;
|
|
import kd.bos.form.control.grid.column.AmountDataGridColumn;
|
|
|
import kd.bos.form.control.grid.column.DataGridColumn;
|
|
import kd.bos.form.control.grid.column.DataGridColumn;
|
|
|
-
|
|
|
|
|
import kd.bos.form.control.grid.events.BeforeCreateDataGridColumnsEvent;
|
|
import kd.bos.form.control.grid.events.BeforeCreateDataGridColumnsEvent;
|
|
|
import kd.bos.form.control.grid.events.BeforeCreateDataGridColumnsListener;
|
|
import kd.bos.form.control.grid.events.BeforeCreateDataGridColumnsListener;
|
|
|
import kd.bos.form.control.grid.events.DataGridBindDataEvent;
|
|
import kd.bos.form.control.grid.events.DataGridBindDataEvent;
|
|
@@ -33,13 +33,14 @@ import java.util.*;
|
|
|
* @author turborao
|
|
* @author turborao
|
|
|
* @date 2025/11/28 16:01
|
|
* @date 2025/11/28 16:01
|
|
|
*/
|
|
*/
|
|
|
-public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements Plugin, DataGridBindDataListener, BeforeCreateDataGridColumnsListener {
|
|
|
|
|
|
|
+public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements Plugin,BeforeCreateDataGridColumnsListener, DataGridBindDataListener {
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String KEY_LAB_EMP_NAME = "nckd_name";
|
|
private static final String KEY_LAB_EMP_NAME = "nckd_name";
|
|
|
private static final String KEY_LAB_EMP_DESCRIPTION = "nckd_desc";
|
|
private static final String KEY_LAB_EMP_DESCRIPTION = "nckd_desc";
|
|
|
private static final String KEY_LAB_REALAMT = "nckd_realamt";
|
|
private static final String KEY_LAB_REALAMT = "nckd_realamt";
|
|
|
private static final String KEY_LAB_GROSSAMT = "nckd_grossamt";
|
|
private static final String KEY_LAB_GROSSAMT = "nckd_grossamt";
|
|
|
|
|
+ private static final String KEY_LAB_SUBAMT = "nckd_subamt";
|
|
|
private static String KEY_CTL_STARTDATE = "startmonth";
|
|
private static String KEY_CTL_STARTDATE = "startmonth";
|
|
|
private static String KEY_CTL_ENDDATE = "endmonth";
|
|
private static String KEY_CTL_ENDDATE = "endmonth";
|
|
|
private static String KEY_META_PERUSER = "hrpi_personuserrel";
|
|
private static String KEY_META_PERUSER = "hrpi_personuserrel";
|
|
@@ -48,10 +49,11 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
private static Date KEY_ENDDATE = new Date();
|
|
private static Date KEY_ENDDATE = new Date();
|
|
|
private static String KEY_TYPE = "10";
|
|
private static String KEY_TYPE = "10";
|
|
|
|
|
|
|
|
- Map<String, String> itemNameMap = new HashMap<>();
|
|
|
|
|
|
|
+ Map<String, String> itemNameMap = new LinkedHashMap<>();
|
|
|
Map<String, BigDecimal> calItemAmtMap = new HashMap<>();
|
|
Map<String, BigDecimal> calItemAmtMap = new HashMap<>();
|
|
|
Map<String, Map<String, BigDecimal>> calItemAmtMapByPeriod = new HashMap<>();
|
|
Map<String, Map<String, BigDecimal>> calItemAmtMapByPeriod = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
+ private static final String CTL_DATAGRID = "nckd_datagridap";
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void initialize() {
|
|
public void initialize() {
|
|
@@ -72,7 +74,22 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
KEY_EMPID = personUserDyn.getLong("employee.id");
|
|
KEY_EMPID = personUserDyn.getLong("employee.id");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 设置最大日期为上个月
|
|
|
|
|
|
|
+ if(!this.getModel().isDataLoaded()) {
|
|
|
|
|
+
|
|
|
|
|
+ //KEY_STARTDATE = (Date) this.getModel().getValue(KEY_CTL_STARTDATE);
|
|
|
|
|
+ //KEY_ENDDATE = (Date) this.getModel().getValue(KEY_CTL_ENDDATE);
|
|
|
|
|
+ //KEY_TYPE = (String) this.getModel().getValue("nckd_type");
|
|
|
|
|
+
|
|
|
|
|
+ showData();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void afterCreateNewData(EventObject e) {
|
|
|
|
|
+ super.afterCreateNewData(e);
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(new Date());
|
|
calendar.setTime(new Date());
|
|
|
calendar.add(Calendar.MONTH, -1);
|
|
calendar.add(Calendar.MONTH, -1);
|
|
@@ -83,17 +100,6 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
Date lastMonthDate = calendar.getTime();
|
|
Date lastMonthDate = calendar.getTime();
|
|
|
KEY_STARTDATE = lastMonthDate;
|
|
KEY_STARTDATE = lastMonthDate;
|
|
|
-
|
|
|
|
|
- showData();
|
|
|
|
|
- /**
|
|
|
|
|
- * 构建表格数据
|
|
|
|
|
- */
|
|
|
|
|
- DataGrid dataGrid = this.getControl("nckd_datagridap");
|
|
|
|
|
- // 注册创建列监听事件
|
|
|
|
|
- dataGrid.addBeforeCreateDataGridColumnsListener(this);
|
|
|
|
|
- // 注册绑定数据监听事件
|
|
|
|
|
- dataGrid.addBindDataListener(this);
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -117,9 +123,34 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void afterCreateNewData(EventObject e) {
|
|
|
|
|
- super.afterCreateNewData(e);
|
|
|
|
|
|
|
+ public void registerListener(EventObject event) {
|
|
|
|
|
+ registerDataGridListener();
|
|
|
|
|
+ // 添加箭头点击事件监控
|
|
|
|
|
+ this.addClickListeners("nckd_query");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private void registerDataGridListener() {
|
|
|
|
|
+ DataGrid dataGrid = this.getControl(CTL_DATAGRID);
|
|
|
|
|
+ // 注册创建列监听事件
|
|
|
|
|
+ dataGrid.addBeforeCreateDataGridColumnsListener(this);
|
|
|
|
|
+ // 注册绑定数据监听事件
|
|
|
|
|
+ dataGrid.addBindDataListener(this);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void click(EventObject e) {
|
|
|
|
|
+ super.click(e);
|
|
|
|
|
+ Control source = (Control) e.getSource();
|
|
|
|
|
+ if("nckd_query".equals(source.getKey())) {
|
|
|
|
|
+ KEY_STARTDATE = (Date) this.getModel().getValue(KEY_CTL_STARTDATE);
|
|
|
|
|
+ KEY_ENDDATE = (Date) this.getModel().getValue(KEY_CTL_ENDDATE);
|
|
|
|
|
+ KEY_TYPE = (String) this.getModel().getValue("nckd_type");
|
|
|
|
|
+ showData();
|
|
|
|
|
+
|
|
|
|
|
+ this.getView().updateView(CTL_DATAGRID);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -166,7 +197,7 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
desc = "公司:" + companyName;
|
|
desc = "公司:" + companyName;
|
|
|
}
|
|
}
|
|
|
if(adminorgName != null){
|
|
if(adminorgName != null){
|
|
|
- desc = desc + " 部门:" + adminorgName;
|
|
|
|
|
|
|
+ desc = desc + " 部门:" + adminorgName;
|
|
|
}
|
|
}
|
|
|
labelDesc.setText( desc);
|
|
labelDesc.setText( desc);
|
|
|
|
|
|
|
@@ -191,13 +222,20 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
}else {
|
|
}else {
|
|
|
label2.setText(df.format(calItemAmtMap.get("JT_283"))); //应发合计
|
|
label2.setText(df.format(calItemAmtMap.get("JT_283"))); //应发合计
|
|
|
}
|
|
}
|
|
|
|
|
+ Label label3 = this.getView().getControl(KEY_LAB_SUBAMT);
|
|
|
|
|
+ if(calItemAmtMap.get("JT383") == null){
|
|
|
|
|
+ label3.setText("0.00");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ label3.setText(df.format(calItemAmtMap.get("JT383")));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
Label label1 = this.getView().getControl(KEY_LAB_REALAMT);
|
|
Label label1 = this.getView().getControl(KEY_LAB_REALAMT);
|
|
|
label1.setText("0.00");
|
|
label1.setText("0.00");
|
|
|
Label label2 = this.getView().getControl(KEY_LAB_GROSSAMT);
|
|
Label label2 = this.getView().getControl(KEY_LAB_GROSSAMT);
|
|
|
label2.setText("0.00");
|
|
label2.setText("0.00");
|
|
|
-
|
|
|
|
|
|
|
+ Label label3 = this.getView().getControl(KEY_LAB_SUBAMT);
|
|
|
|
|
+ label3.setText("0.00");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -233,8 +271,19 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
* @return Map<period, Map<itemnumber, amount>> 嵌套Map结构
|
|
* @return Map<period, Map<itemnumber, amount>> 嵌套Map结构
|
|
|
*/
|
|
*/
|
|
|
public Map<String, Map<String, BigDecimal>> getCalItemAmtByPeriod(DynamicObjectCollection calTableDyns) {
|
|
public Map<String, Map<String, BigDecimal>> getCalItemAmtByPeriod(DynamicObjectCollection calTableDyns) {
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 排序
|
|
|
|
|
+ */
|
|
|
|
|
+ Collections.sort(calTableDyns , new Comparator<DynamicObject>(){
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int compare(DynamicObject stu1, DynamicObject stu2) {
|
|
|
|
|
+ return stu1.getDate("bizdate").compareTo(stu2.getDate("bizdate"));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
// 按 period 分组,每个 period 再按 salaryitem.number 分组汇总金额
|
|
// 按 period 分组,每个 period 再按 salaryitem.number 分组汇总金额
|
|
|
- Map<String, Map<String, BigDecimal>> result = new HashMap<>();
|
|
|
|
|
|
|
+ Map<String, Map<String, BigDecimal>> result = new LinkedHashMap<>();
|
|
|
|
|
|
|
|
for (DynamicObject item : calTableDyns) {
|
|
for (DynamicObject item : calTableDyns) {
|
|
|
Date bizPeriod = item.getDate("bizdate");
|
|
Date bizPeriod = item.getDate("bizdate");
|
|
@@ -266,7 +315,7 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public Map<String, String> getItemName(DynamicObjectCollection calTableDyns) {
|
|
public Map<String, String> getItemName(DynamicObjectCollection calTableDyns) {
|
|
|
- Map<String, String> itemNameMap = new HashMap<>();
|
|
|
|
|
|
|
+ Map<String, String> itemNameMap = new LinkedHashMap<>();
|
|
|
for (DynamicObject item : calTableDyns) {
|
|
for (DynamicObject item : calTableDyns) {
|
|
|
String salaryItemNumber = item.getString("hsas_caltableentry.salaryitem.number");
|
|
String salaryItemNumber = item.getString("hsas_caltableentry.salaryitem.number");
|
|
|
String salaryItemName = item.getString("hsas_caltableentry.salaryitem.name");
|
|
String salaryItemName = item.getString("hsas_caltableentry.salaryitem.name");
|
|
@@ -283,16 +332,16 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
super.propertyChanged(e);
|
|
super.propertyChanged(e);
|
|
|
String fieldKey = e.getProperty().getName();
|
|
String fieldKey = e.getProperty().getName();
|
|
|
if (fieldKey.equals(KEY_CTL_STARTDATE) || fieldKey.equals(KEY_CTL_ENDDATE)){
|
|
if (fieldKey.equals(KEY_CTL_STARTDATE) || fieldKey.equals(KEY_CTL_ENDDATE)){
|
|
|
- KEY_STARTDATE = (Date)this.getModel().getValue(KEY_CTL_STARTDATE);
|
|
|
|
|
- KEY_ENDDATE = (Date)this.getModel().getValue(KEY_CTL_ENDDATE);
|
|
|
|
|
- showData();
|
|
|
|
|
- this.getView().updateView();
|
|
|
|
|
|
|
+ //KEY_STARTDATE = (Date)this.getModel().getValue(KEY_CTL_STARTDATE);
|
|
|
|
|
+ //KEY_ENDDATE = (Date)this.getModel().getValue(KEY_CTL_ENDDATE);
|
|
|
|
|
+ //showData();
|
|
|
|
|
+ //this.getView().updateView();
|
|
|
}
|
|
}
|
|
|
if (fieldKey.equals("nckd_type")){
|
|
if (fieldKey.equals("nckd_type")){
|
|
|
|
|
|
|
|
- KEY_TYPE = (String)this.getModel().getValue("nckd_type");
|
|
|
|
|
- showData();
|
|
|
|
|
- this.getView().updateView();
|
|
|
|
|
|
|
+ //KEY_TYPE = (String)this.getModel().getValue("nckd_type");
|
|
|
|
|
+ //showData();
|
|
|
|
|
+ //this.getView().updateView();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -318,7 +367,6 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -354,9 +402,21 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
row.setValue(itemNumber, amount);
|
|
row.setValue(itemNumber, amount);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
list.add(row.get());
|
|
list.add(row.get());
|
|
|
index++;
|
|
index++;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if(calItemAmtMap != null && calItemAmtMap.size() > 0) {
|
|
|
|
|
+ DataGridRow row = builder.buildRow();
|
|
|
|
|
+ row.setValue("rk", index + 1); // rk必须存在且唯一不能重复
|
|
|
|
|
+ row.setValue("seq", index + 2);
|
|
|
|
|
+ row.setValue("nckd_period", "_合计_");
|
|
|
|
|
+ for(String key : calItemAmtMap.keySet()){
|
|
|
|
|
+ row.setValue(key, calItemAmtMap.get( key));
|
|
|
|
|
+ }
|
|
|
|
|
+ list.add(row.get());
|
|
|
}
|
|
}
|
|
|
// 重要: 传递列表数据
|
|
// 重要: 传递列表数据
|
|
|
e.setData(list);
|
|
e.setData(list);
|
|
@@ -364,4 +424,5 @@ public class EmpSalaryQueryWebFormPlugin extends AbstractFormPlugin implements P
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|