2025-07-31 10:07:09 +00:00
|
|
|
|
package tqq9.lc123.cloud.app.plugin.form.pm;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.common.utils.StringUtils;
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
|
|
import kd.bos.entity.datamodel.IDataModel;
|
|
|
|
|
import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
|
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
2025-08-05 09:09:21 +00:00
|
|
|
|
import kd.bos.logging.Log;
|
|
|
|
|
import kd.bos.logging.LogFactory;
|
2025-07-31 10:07:09 +00:00
|
|
|
|
import kd.bos.orm.query.QCP;
|
|
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
|
|
import kd.sdk.plugin.Plugin;
|
2025-08-05 09:09:21 +00:00
|
|
|
|
import tqq9.lc123.cloud.app.plugin.form.im.ReturnStockSyncNoticePlugin;
|
2025-07-31 10:07:09 +00:00
|
|
|
|
|
|
|
|
|
import java.util.EventObject;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表单通用插件,带出创建人部门,许可证号
|
|
|
|
|
* 注册证号:tqq9_registration
|
|
|
|
|
* 许可证号:tqq9_licenseno
|
|
|
|
|
* 创建部门:tqq9_dept
|
|
|
|
|
* 需保持一致
|
|
|
|
|
*/
|
|
|
|
|
public class BaseDataPlugin extends AbstractFormPlugin implements Plugin {
|
2025-08-05 09:09:21 +00:00
|
|
|
|
private final static Log logger = LogFactory.getLog(BaseDataPlugin.class);
|
|
|
|
|
|
2025-07-31 10:07:09 +00:00
|
|
|
|
@Override
|
|
|
|
|
public void afterCreateNewData(EventObject e) {
|
|
|
|
|
super.afterCreateNewData(e);
|
|
|
|
|
IDataModel model = this.getModel();
|
|
|
|
|
DynamicObject dataEntity = model.getDataEntity();
|
|
|
|
|
DynamicObject creator = dataEntity.getDynamicObject("creator");
|
|
|
|
|
DynamicObject bos_user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("id", QCP.equals, creator.getLong("id"))});
|
|
|
|
|
DynamicObjectCollection entryentity = bos_user.getDynamicObjectCollection("entryentity");
|
|
|
|
|
DynamicObject dept=null;
|
|
|
|
|
for (DynamicObject dynamicObject : entryentity) {
|
|
|
|
|
boolean ispartjob = dynamicObject.getBoolean("ispartjob");
|
|
|
|
|
if (!ispartjob){
|
|
|
|
|
dept=dynamicObject.getDynamicObject("dpt");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model.setValue("tqq9_dept",dept);
|
|
|
|
|
this.getView().updateView();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void propertyChanged(PropertyChangedArgs e) {
|
|
|
|
|
super.propertyChanged(e);
|
|
|
|
|
String key = e.getProperty().getName();
|
|
|
|
|
if (StringUtils.equals("tqq9_registration", key)) {
|
|
|
|
|
StringBuilder stringBuilder=new StringBuilder();
|
|
|
|
|
ChangeData[] changeSet = e.getChangeSet();
|
|
|
|
|
ChangeData changeData = changeSet[0];
|
|
|
|
|
int rowIndex = changeData.getRowIndex();
|
|
|
|
|
DynamicObject newValue = (DynamicObject)changeData.getNewValue();
|
|
|
|
|
if(newValue!=null){
|
|
|
|
|
DynamicObject tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", new QFilter[]{new QFilter("id", QCP.equals, newValue.getLong("id"))});
|
|
|
|
|
DynamicObjectCollection tqq9_entry = tqq9_registration.getDynamicObjectCollection("tqq9_entry");
|
|
|
|
|
for (DynamicObject entry : tqq9_entry) {
|
|
|
|
|
String supno = entry.getString("tqq9_e_supno");
|
|
|
|
|
stringBuilder.append(",").append(supno);
|
|
|
|
|
}
|
|
|
|
|
String substring = stringBuilder.substring(1);
|
|
|
|
|
this.getModel().setValue("tqq9_licenseno",substring,rowIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.getView().updateView();
|
|
|
|
|
}
|
|
|
|
|
}
|