Commit c73ed47f by 林永健

Merge remote-tracking branch 'origin/v2.0.1' into v2.0.1

# Conflicts:
#	platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
2 parents 9c60121c 82c5d19d
...@@ -21,4 +21,6 @@ public interface SopInstNodeMapper extends CommonBaseMapper<SopInstNode> { ...@@ -21,4 +21,6 @@ public interface SopInstNodeMapper extends CommonBaseMapper<SopInstNode> {
List<SopTaskDTO> findPageListByInstId(@Param("instId")String instId); List<SopTaskDTO> findPageListByInstId(@Param("instId")String instId);
int updateNodeParamById(@Param("instNodeId") Integer instNodeId, @Param("nodeParam") Map<String, Object> nodeParam); int updateNodeParamById(@Param("instNodeId") Integer instNodeId, @Param("nodeParam") Map<String, Object> nodeParam);
int updateNodeContentById(@Param("instNodeId") Integer instNodeId, @Param("nodeContent") String nodeContent);
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,14 +3,17 @@ package cn.com.glsx.process.modules.assembler; ...@@ -3,14 +3,17 @@ package cn.com.glsx.process.modules.assembler;
import cn.com.glsx.process.common.sysenum.ResultEnum; import cn.com.glsx.process.common.sysenum.ResultEnum;
import cn.com.glsx.process.exception.AdminException; import cn.com.glsx.process.exception.AdminException;
import cn.com.glsx.process.modules.converter.SopTplNodeProtoConverter; import cn.com.glsx.process.modules.converter.SopTplNodeProtoConverter;
import cn.com.glsx.process.modules.entity.SopTplLink; import cn.com.glsx.process.modules.entity.*;
import cn.com.glsx.process.modules.entity.SopTplNode; import cn.com.glsx.process.modules.mapper.SopInstNodeMapper;
import cn.com.glsx.process.modules.entity.SopTplNodeProto;
import cn.com.glsx.process.modules.mapper.SopTplNodeProtoMapper; import cn.com.glsx.process.modules.mapper.SopTplNodeProtoMapper;
import cn.com.glsx.process.modules.model.SopInstDTO;
import cn.com.glsx.process.modules.model.SopTplDTO; import cn.com.glsx.process.modules.model.SopTplDTO;
import cn.com.glsx.process.modules.service.SopDataService;
import cn.com.glsx.process.modules.sop.execute.SopNodeType;
import cn.com.glsx.process.util.CronUtil; import cn.com.glsx.process.util.CronUtil;
import cn.com.glsx.process.util.JacksonUtil; import cn.com.glsx.process.util.JacksonUtil;
import cn.com.glsx.process.util.JacksonUtils; import cn.com.glsx.process.util.JacksonUtils;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -49,6 +52,12 @@ public class KeHuLvChengAssembler { ...@@ -49,6 +52,12 @@ public class KeHuLvChengAssembler {
@Autowired @Autowired
private SopTplNodeProtoMapper sopTplNodeProtoMapper; private SopTplNodeProtoMapper sopTplNodeProtoMapper;
@Autowired
private SopDataService sopDataService;
@Autowired
private SopInstNodeMapper sopInstNodeMapper;
/** /**
* 客户旅程模板组装 * 客户旅程模板组装
* 备注:taskType 1 门店短信 2 门店ai外呼 3 门店助手朋友圈 4 门店助手1v1转发 5 门店客户跟进提醒 6 查询到保 7 企微提醒 8 企微群发 9 企微朋友圈 10 群发短信 * 备注:taskType 1 门店短信 2 门店ai外呼 3 门店助手朋友圈 4 门店助手1v1转发 5 门店客户跟进提醒 6 查询到保 7 企微提醒 8 企微群发 9 企微朋友圈 10 群发短信
...@@ -244,4 +253,42 @@ public class KeHuLvChengAssembler { ...@@ -244,4 +253,42 @@ public class KeHuLvChengAssembler {
sopTplLink.setTargetId(targetTplNode.getNodeId()); sopTplLink.setTargetId(targetTplNode.getNodeId());
tplNodeLinks.add(sopTplLink); tplNodeLinks.add(sopTplLink);
} }
/**
* 开启实例之前的动作
* 根据阶段条件,刷新 更新客户阶段 的sql
*
* @param instDTO
*/
public void doBeforeInstStart(SopInstDTO instDTO) {
String instParam = instDTO.getInstParam();
String stagesStr = JacksonUtil.getStrValueInJsonStrByPath(instParam, "stages");
if (!StringUtils.hasLength(stagesStr)) {
//无阶段 返回
return;
}
Map<String, Object> map = JacksonUtil.readValue(stagesStr, Map.class);
if (CollectionUtils.isEmpty(map)) {
//无阶段 返回
return;
}
List<SopInstNode> nodes = instDTO.getNodes();
SopInstNode endNode = nodes.stream().filter(node -> SopNodeType.END.getBusType().equalsIgnoreCase(node.getNodeType())).findFirst().get();
List<SopInstLink> links = instDTO.getLinks();
SopInstLink lastLink = links.stream().filter(link -> link.getTargetId().equals(endNode.getNodeId())).findFirst().get();
Integer sourceId = lastLink.getSourceId();
SopInstNode updateStageNode = nodes.stream().filter(node -> node.getNodeId().equals(sourceId)).findFirst().get();
// TODO 获取阶段更新的sql
String nodeContent = updateStageNode.getNodeContent();
Map<String, Object> nodeContentMap = JSON.parseObject(nodeContent, Map.class);
String updateSql = nodeContentMap.get("source").toString();
nodeContentMap.put("source", updateSql);
sopInstNodeMapper.updateNodeContentById(updateStageNode.getInstNodeId(), JSON.toJSONString(nodeContentMap));
}
} }
...@@ -10,6 +10,7 @@ import cn.com.glsx.execute.modules.model.task.SopNodeTaskSearch; ...@@ -10,6 +10,7 @@ import cn.com.glsx.execute.modules.model.task.SopNodeTaskSearch;
import cn.com.glsx.execute.modules.model.task.SopNodeTaskStaticModel; import cn.com.glsx.execute.modules.model.task.SopNodeTaskStaticModel;
import cn.com.glsx.process.common.sysenum.ResultEnum; import cn.com.glsx.process.common.sysenum.ResultEnum;
import cn.com.glsx.process.exception.AdminException; import cn.com.glsx.process.exception.AdminException;
import cn.com.glsx.process.modules.assembler.KeHuLvChengAssembler;
import cn.com.glsx.process.modules.converter.SopInstConverter; import cn.com.glsx.process.modules.converter.SopInstConverter;
import cn.com.glsx.process.modules.converter.SopTplConverter; import cn.com.glsx.process.modules.converter.SopTplConverter;
import cn.com.glsx.process.modules.converter.SopTplLinKConverter; import cn.com.glsx.process.modules.converter.SopTplLinKConverter;
...@@ -86,6 +87,9 @@ public class SopInstService { ...@@ -86,6 +87,9 @@ public class SopInstService {
private SopInstNodeBatchService sopInstNodeBatchService; private SopInstNodeBatchService sopInstNodeBatchService;
@Autowired @Autowired
private KeHuLvChengAssembler keHuLvChengAssembler;
@Autowired
private SopDataService sopDataService; private SopDataService sopDataService;
/** /**
...@@ -291,6 +295,11 @@ public class SopInstService { ...@@ -291,6 +295,11 @@ public class SopInstService {
} }
} }
if (status.equals(SopInstStatusEnum.NORMAL.getValue())) {
SopInstDTO instDTO = this.findById(instId);
keHuLvChengAssembler.doBeforeInstStart(instDTO);
}
sopInstMapper.updateInstStatus(instId, status); sopInstMapper.updateInstStatus(instId, status);
return result; return result;
} }
......
...@@ -93,4 +93,6 @@ public class CustomerInfo { ...@@ -93,4 +93,6 @@ public class CustomerInfo {
private String scrmOneId; private String scrmOneId;
private String carNumber; private String carNumber;
private String customerAvatarUrl;
} }
...@@ -40,9 +40,11 @@ public class ControllerGetEntCusDemo { ...@@ -40,9 +40,11 @@ public class ControllerGetEntCusDemo {
SopInst sopInst = excustorParam.getSopInst(); SopInst sopInst = excustorParam.getSopInst();
String instParam = sopInst.getInstParam(); String instParam = sopInst.getInstParam();
try { try {
String merchantId = SopHelper.getValueFromJsonString(instParam,
"merchantId");
String instDefalutName = SopHelper.getValueFromJsonString(instParam, "stages", "stage1", String instDefalutName = SopHelper.getValueFromJsonString(instParam, "stages", "stage1",
"value"); "value");
multiValueMap.add("merchantId",sopInst.getGrantId()+""); multiValueMap.add("merchantId",merchantId);
multiValueMap.add("instId",sopInst.getInstId()); multiValueMap.add("instId",sopInst.getInstId());
multiValueMap.add("instDefalutName",instDefalutName); multiValueMap.add("instDefalutName",instDefalutName);
System.out.println("入参" + JSONObject.toJSONString(multiValueMap)); System.out.println("入参" + JSONObject.toJSONString(multiValueMap));
......
...@@ -28,9 +28,11 @@ public class ControllerGetGrCusDemo { ...@@ -28,9 +28,11 @@ public class ControllerGetGrCusDemo {
SopInst sopInst = excustorParam.getSopInst(); SopInst sopInst = excustorParam.getSopInst();
String instParam = sopInst.getInstParam(); String instParam = sopInst.getInstParam();
try { try {
String merchantId = SopHelper.getValueFromJsonString(instParam,
"merchantId");
String instDefalutName = SopHelper.getValueFromJsonString(instParam, "stages", "stage1", String instDefalutName = SopHelper.getValueFromJsonString(instParam, "stages", "stage1",
"value"); "value");
multiValueMap.add("merchantId",sopInst.getGrantId()+""); multiValueMap.add("merchantId",merchantId);
multiValueMap.add("instId",sopInst.getInstId()); multiValueMap.add("instId",sopInst.getInstId());
multiValueMap.add("instDefalutName",instDefalutName); multiValueMap.add("instDefalutName",instDefalutName);
System.out.println("入参" + JSONObject.toJSONString(multiValueMap)); System.out.println("入参" + JSONObject.toJSONString(multiValueMap));
......
...@@ -47,5 +47,8 @@ ...@@ -47,5 +47,8 @@
<update id="updateNodeParamById"> <update id="updateNodeParamById">
update sop_inst_node set node_param = CAST(#{nodeParam, typeHandler=cn.com.glsx.process.modules.handler.JsonTypeHandler} AS JSON) where inst_node_id = #{instNodeId} update sop_inst_node set node_param = CAST(#{nodeParam, typeHandler=cn.com.glsx.process.modules.handler.JsonTypeHandler} AS JSON) where inst_node_id = #{instNodeId}
</update> </update>
<update id="updateNodeContentById">
update sop_inst_node set node_content = CAST(#{nodeContent} AS JSON) where inst_node_id = #{instNodeId}
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
<result column="node_type" jdbcType="VARCHAR" property="nodeType" /> <result column="node_type" jdbcType="VARCHAR" property="nodeType" />
<result column="node_label" jdbcType="VARCHAR" property="nodeLabel" /> <result column="node_label" jdbcType="VARCHAR" property="nodeLabel" />
<result column="node_show" jdbcType="VARCHAR" property="nodeShow" /> <result column="node_show" jdbcType="VARCHAR" property="nodeShow" />
<result column="node_param_def" jdbcType="LONGVARCHAR" property="nodeParamDef" />
<result column="node_content_def" jdbcType="LONGVARCHAR" property="nodeContentDef" />
<result column="node_key" jdbcType="VARCHAR" property="nodeKey" /> <result column="node_key" jdbcType="VARCHAR" property="nodeKey" />
<result column="node_result_def" jdbcType="LONGVARCHAR" property="nodeResultDef" />
<result column="node_visible" jdbcType="TINYINT" property="nodeVisible" /> <result column="node_visible" jdbcType="TINYINT" property="nodeVisible" />
<result column="node_cron" jdbcType="VARCHAR" property="nodeCron" /> <result column="node_cron" jdbcType="VARCHAR" property="nodeCron" />
<result column="node_expire_cron" jdbcType="VARCHAR" property="nodeExpireCron" /> <result column="node_expire_cron" jdbcType="VARCHAR" property="nodeExpireCron" />
...@@ -24,28 +27,15 @@ ...@@ -24,28 +27,15 @@
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" /> <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" /> <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
</resultMap> </resultMap>
<!-- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.com.glsx.process.modules.entity.SopTplNodeProtoWithBLOBs">-->
<!-- &lt;!&ndash;-->
<!-- WARNING - @mbg.generated-->
<!-- &ndash;&gt;-->
<!-- <result column="node_param_def" jdbcType="LONGVARCHAR" property="nodeParamDef" />-->
<!-- <result column="node_content_def" jdbcType="LONGVARCHAR" property="nodeContentDef" />-->
<!-- <result column="node_result_def" jdbcType="LONGVARCHAR" property="nodeResultDef" />-->
<!-- </resultMap>-->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, node_name, node_type, node_label, node_show, node_key, node_visible, node_cron, id, node_name, node_type, node_label, node_show, node_param_def, node_key, node_visible, node_cron,
node_expire_cron, node_skipable, node_async, daily_limit, data_type_code, group_code, node_expire_cron, node_skipable, node_async, daily_limit, data_type_code, group_code,
action_code, `desc`, updated_time, created_time action_code, `desc`, updated_time, created_time
</sql> </sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
-->
node_param_def, node_content_def, node_result_def
</sql>
<select id="list" resultMap="BaseResultMap"> <select id="list" resultMap="BaseResultMap">
select select
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!