Commit 845a7726 authored by KeYong's avatar KeYong

更新流程重复数据问题

parent 2f443d1d
...@@ -589,11 +589,12 @@ public class ContingencyAction implements CustomerAction { ...@@ -589,11 +589,12 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("key", actionName); tempmap1.put("key", actionName);
tempmap1.put("content", paramJSON); tempmap1.put("content", paramJSON);
if (isArea.contains(paramJSON)) { // if (isArea.contains(paramJSON)) {
tempmap1.put("isArea", true); // tempmap1.put("isArea", true);
} else { // } else {
tempmap1.put("isArea", false); // tempmap1.put("isArea", false);
} // }
tempmap1.put("isArea", false);
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("maparea", paramObj, result); this.sendcmd("maparea", paramObj, result);
} }
......
...@@ -45,4 +45,6 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla ...@@ -45,4 +45,6 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla
Integer getPlanInstanceCountByCondition(@Param("category") String category, @Param("recordType") String recordType, @Param("batchNo") String batchNo, @Param("content") String content); Integer getPlanInstanceCountByCondition(@Param("category") String category, @Param("recordType") String recordType, @Param("batchNo") String batchNo, @Param("content") String content);
List<ContingencyPlanInstance> getPlanInstanceByCondition(@Param("category") String category, @Param("recordType") String recordType, @Param("batchNo") String batchNo, @Param("content") String content);
} }
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
...@@ -18,10 +19,7 @@ import com.yeejoin.amos.fas.business.service.intfc.*; ...@@ -18,10 +19,7 @@ import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.model.Operate; import com.yeejoin.amos.fas.business.service.model.Operate;
import com.yeejoin.amos.fas.business.service.model.OperateGroup; import com.yeejoin.amos.fas.business.service.model.OperateGroup;
import com.yeejoin.amos.fas.business.util.DateUtils; import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.vo.ButtonJsonVO; import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.common.enums.PlanReplyMessageEnum; import com.yeejoin.amos.fas.common.enums.PlanReplyMessageEnum;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
...@@ -42,6 +40,8 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -42,6 +40,8 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -167,6 +167,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -167,6 +167,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
} }
// 异步数据同步之消息发送 // 异步数据同步之消息发送
// contingencyPlanInstanceDataSync(instance); // contingencyPlanInstanceDataSync(instance);
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
List<ContingencyPlanInstance> list = contingencyPlanInstanceMapper.getPlanInstanceByCondition(contingencyPlanInstance.getCategory(),
contingencyPlanInstance.getRecordType(),
contingencyPlanInstance.getBatchNo(),
contingencyPlanInstance.getContent());
if (1 < list.size()) {
repository.delete(list.get(1));
}
}
});
return instance; return instance;
} }
...@@ -564,7 +576,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -564,7 +576,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
} }
@Scheduled(cron = "*/2 * * * * ?") @Scheduled(cron = "*/3 * * * * ?")
public void runFireQueue() throws Exception { public void runFireQueue() throws Exception {
if (fireQueue.size() == 0) if (fireQueue.size() == 0)
......
...@@ -409,4 +409,23 @@ ...@@ -409,4 +409,23 @@
</if> </if>
</select> </select>
<select id="getPlanInstanceByCondition" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select * from
contingency_plan_instance
where
is_delete = 0
<if test="category!=null and category!=''">
AND category = #{category}
</if>
<if test="recordType!=null and recordType!=''">
AND record_type = #{recordType}
</if>
<if test="batchNo!=null and batchNo!=''">
AND batch_no = #{batchNo}
</if>
<if test="content!=null and content!=''">
AND content = #{content}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment