Commit 58bb130b by zhouhaibao

[+]旅程节点多sql更新新增

1 parent ca6c9284
package cn.com.glsx.process.modules.sop.execute.executor;
import java.util.Map;
......@@ -45,7 +44,9 @@ public class SqlExecutor implements SopNodeExecutor {
String sql = FreemarkerUtil.processContent(sqlTemplate, executeStruct.toMap());
mcgBizAdapter.executeUpdate(sql);
int i = mcgBizAdapter.executeUpdate(sql);
return "更新成功条数" + i;
} catch (Exception e) {
String message = e.getMessage();
......
......@@ -121,7 +121,13 @@ public abstract class AbstractConnect {
* @throws SQLException
*/
public int executeUpdate(String sql, Object... para) throws SQLException {
return dbConnect.executeUpdate(sql, para);
int total=0;
String[] split = sql.split(";");
for (String s : split) {
int i = dbConnect.executeUpdate(s, para);
total=total+i;
}
return total;
}
public boolean testConnect() {
......
......@@ -175,7 +175,7 @@ public class DbConnect {
* @throws
*/
public int executeUpdate(String sql, Object... para) throws SQLException {
logger.debug("executeUpdate: {}, para: {}", sql, ToStringBuilder.reflectionToString(para));
logger.info("executeUpdate: {}, para: {}", sql, ToStringBuilder.reflectionToString(para));
QueryRunner runner = new QueryRunner();
Connection conn = null;
int count = 0;
......
......@@ -61,20 +61,19 @@ public class TestApplication {
@Test
public void testupdate() throws SQLException {
SopDataSource byId = sopDataSourceService.getById(1);
SopDataSource byId = sopDataSourceService.findByDataSourceId("SOP_CDP");
SopBizAdapter mcgBizAdapter = new FlowDataAdapterImpl(byId);
mcgBizAdapter.executeUpdate("SELECT * FROM aa_bb");
int i = mcgBizAdapter.executeUpdate("update cdp_customer_sop_journey t1,(select t1.one_id,t1.org_id from cdp_customer t1 LEFT JOIN cdp_customer_car_relation t2 on t1.one_id=t2.one_id left join cdp_car t3 on t3.car_id=t2.car_id\n" + "where to_days(t3.arrival_date) = to_days(now()) ) t2 set t1.sop_journey_stage='保费报价',t1.sop_journey_stage_enter_time=now() where t1.one_id=t2.one_id and t1.org_id=t2.org_id;\n" + "update cdp_customer_sop_journey set sop_journey_stage='战败客户',sop_journey_stage_enter_time=now() where DATEDIFF(CURDATE(), sop_journey_enter_time) > 45 and sop_journey_stage!='成功续保';\n" + "update cdp_customer_sop_journey set sop_journey_stage='意向客户',sop_journey_stage_enter_time=now() where one_id in (SELECT one_id FROM cdp_customer_event where event_type='ORDERED' and extra->'$.orderStatus'=2 and extra->'$.payStatus'=2 and extra->'$.afterSaleStatus' is null);\n" + "update cdp_customer_sop_journey set sop_journey_stage='意向客户',sop_journey_stage_enter_time=now() where one_id in (SELECT one_id FROM cdp_customer_event where event_type='RECALL_AI_CALL' and extra->'$.taskResult[0].resultValue'='A');");
System.out.println("更新成功的行数" + i);
}
@Test
public void testjava() throws Exception {
DynamicEngine de = DynamicEngine.getInstance();
String source = "import com.alibaba.fastjson.JSON;\n" + "\n" + "public class Controller {\n" + "\n"
+ " public JSON execute(JSON param) {\n" + " System.out.println(\"测试java\");\n" + " return param;\n" + " }\n"
+ "}\n";
String source = "import com.alibaba.fastjson.JSON;\n" + "\n" + "public class Controller {\n" + "\n" + " public JSON execute(JSON param) {\n" + " System.out.println(\"测试java\");\n" + " return param;\n" + " }\n" + "}\n";
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", 22);
Object instance = de.execute("Controller", source, "execute", new Class[] { JSON.class }, new Object[] { jsonObject });
Object instance = de.execute("Controller", source, "execute", new Class[]{JSON.class}, new Object[]{jsonObject});
System.out.println(JSON.toJSONString(instance));
}
......@@ -143,6 +142,7 @@ public class TestApplication {
JSON execute = ControllerHttpDemo.execute(jsonObject);
System.out.println(execute);
}
@Test
public void findByInstId() {
List<SopInstNode> xblc7 = sopInstLinkService.findByInstId("xblc7");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!