项目接口保存改成操作保存,并增加同步更新项目F7逻辑

This commit is contained in:
yuxueliang0813 2024-12-05 17:09:46 +08:00
parent 7fa6b622b5
commit 04429b95d3
1 changed files with 15 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.db.DB;
import kd.bos.db.DBRoute;
@ -14,6 +15,7 @@ import kd.bos.orm.query.QFilter;
import kd.bos.schedule.executor.AbstractTask;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin;
import okhttp3.OkHttpClient;
@ -29,6 +31,7 @@ import java.util.Map;
* 后台任务插件
*/
public class DobeDWprojectTask extends AbstractTask implements Plugin {
//项目f7的基础资料是单独的表 t_repmd_project
private static final String entityName = "repmd_projectbill";//表名 t_repmd_projectbill
private static Log log = LogFactory.getLog(DobeDWprojectTask.class);
private static final String dw_menthod = "mdm_projectinfo";
@ -97,6 +100,7 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
DynamicObject orginfo = null;
DynamicObject projectinfo = null;
String updateSql = "UPDATE t_org_org SET fk_qeug_combofield=? WHERE fnumber=?;";
String updateF7Sql = "UPDATE t_repmd_project SET fk_qeug_combofield=? WHERE fnumber=?;";
// DynamicObject projectstageinfo = null;
for (int i = 0; i < detailsJson.size(); i++) {
json_body = detailsJson.getJSONObject(i);
@ -119,7 +123,12 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
// projectstageinfo = QueryServiceHelper.queryOne("repmd_projectstages","id,number",new QFilter[]{new QFilter("number","=",fprojectstageid)});
if(projectinfo != null){
if("C".equals(projectinfo.getString("billstatus"))){
//如果项目已审核则不进行修改
//如果项目已审核则不进行项目建立的数据修改只更新项目F7的业务体系字段
if("新拓园区".equals(project_stage)){
DB.update(DBRoute.of("scm"), updateF7Sql, new Object[]{"XTYQ",fbillno});
}else if("成熟园区".equals(project_stage)){
DB.update(DBRoute.of("scm"), updateF7Sql, new Object[]{"CSYQ",fbillno});
}
continue;
}
//已存在做更新 名称 阶段 版本号等信息组织编号是否叶子节点不能更新需要前台操作
@ -146,7 +155,9 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
// projectinfo.set("billno", fbillno);
// projectinfo.set("org", );
// projectinfo.set("isleaf", fisleaf);
SaveServiceHelper.update(projectinfo);
//原保存逻辑直接存入数据库现在改成调用保存操作
// SaveServiceHelper.update(projectinfo);
OperationServiceHelper.executeOperate("save",entityName,new DynamicObject[]{projectinfo}, OperateOption.create());
}else{
//不存在做新增 根据实体名称创建动态对象
projectinfo = BusinessDataServiceHelper.newDynamicObject(entityName);
@ -187,7 +198,8 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
}
projectinfo.set("qeug_ywlx", ywlx);
//保存数据直接保存入库不走操作校验
SaveServiceHelper.save(new DynamicObject[]{projectinfo});
// SaveServiceHelper.save(new DynamicObject[]{projectinfo});
OperationServiceHelper.executeOperate("save",entityName,new DynamicObject[]{projectinfo}, OperateOption.create());
}
//获得组织对象后将本项目的体系字段更新到组织的体系上面
if(!DobeDWUtils.isEmpty(project_stage) && !DobeDWUtils.isEmpty(forgid)){