项目接口保存改成操作保存,并增加同步更新项目F7逻辑
This commit is contained in:
parent
7fa6b622b5
commit
04429b95d3
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.context.RequestContext;
|
import kd.bos.context.RequestContext;
|
||||||
|
import kd.bos.dataentity.OperateOption;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.db.DB;
|
import kd.bos.db.DB;
|
||||||
import kd.bos.db.DBRoute;
|
import kd.bos.db.DBRoute;
|
||||||
|
@ -14,6 +15,7 @@ import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.schedule.executor.AbstractTask;
|
import kd.bos.schedule.executor.AbstractTask;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.QueryServiceHelper;
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
@ -29,6 +31,7 @@ import java.util.Map;
|
||||||
* 后台任务插件
|
* 后台任务插件
|
||||||
*/
|
*/
|
||||||
public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
||||||
|
//项目f7的基础资料是单独的表 t_repmd_project
|
||||||
private static final String entityName = "repmd_projectbill";//表名 t_repmd_projectbill
|
private static final String entityName = "repmd_projectbill";//表名 t_repmd_projectbill
|
||||||
private static Log log = LogFactory.getLog(DobeDWprojectTask.class);
|
private static Log log = LogFactory.getLog(DobeDWprojectTask.class);
|
||||||
private static final String dw_menthod = "mdm_projectinfo";
|
private static final String dw_menthod = "mdm_projectinfo";
|
||||||
|
@ -97,6 +100,7 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
||||||
DynamicObject orginfo = null;
|
DynamicObject orginfo = null;
|
||||||
DynamicObject projectinfo = null;
|
DynamicObject projectinfo = null;
|
||||||
String updateSql = "UPDATE t_org_org SET fk_qeug_combofield=? WHERE fnumber=?;";
|
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;
|
// DynamicObject projectstageinfo = null;
|
||||||
for (int i = 0; i < detailsJson.size(); i++) {
|
for (int i = 0; i < detailsJson.size(); i++) {
|
||||||
json_body = detailsJson.getJSONObject(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)});
|
// projectstageinfo = QueryServiceHelper.queryOne("repmd_projectstages","id,number",new QFilter[]{new QFilter("number","=",fprojectstageid)});
|
||||||
if(projectinfo != null){
|
if(projectinfo != null){
|
||||||
if("C".equals(projectinfo.getString("billstatus"))){
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
//已存在,做更新 名称 阶段 版本号等信息;组织、编号、是否叶子节点不能更新;需要前台操作
|
//已存在,做更新 名称 阶段 版本号等信息;组织、编号、是否叶子节点不能更新;需要前台操作
|
||||||
|
@ -146,7 +155,9 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
||||||
// projectinfo.set("billno", fbillno);
|
// projectinfo.set("billno", fbillno);
|
||||||
// projectinfo.set("org", );
|
// projectinfo.set("org", );
|
||||||
// projectinfo.set("isleaf", fisleaf);
|
// projectinfo.set("isleaf", fisleaf);
|
||||||
SaveServiceHelper.update(projectinfo);
|
//原保存逻辑直接存入数据库,现在改成调用保存操作
|
||||||
|
// SaveServiceHelper.update(projectinfo);
|
||||||
|
OperationServiceHelper.executeOperate("save",entityName,new DynamicObject[]{projectinfo}, OperateOption.create());
|
||||||
}else{
|
}else{
|
||||||
//不存在,做新增 根据实体名称创建动态对象
|
//不存在,做新增 根据实体名称创建动态对象
|
||||||
projectinfo = BusinessDataServiceHelper.newDynamicObject(entityName);
|
projectinfo = BusinessDataServiceHelper.newDynamicObject(entityName);
|
||||||
|
@ -187,7 +198,8 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin {
|
||||||
}
|
}
|
||||||
projectinfo.set("qeug_ywlx", ywlx);
|
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)){
|
if(!DobeDWUtils.isEmpty(project_stage) && !DobeDWUtils.isEmpty(forgid)){
|
||||||
|
|
Loading…
Reference in New Issue