This commit is contained in:
杜建超 2020-11-18 17:51:20 +08:00
parent 5749a63cb0
commit 0bb94e4b24
5 changed files with 54 additions and 14 deletions

View File

@ -76,7 +76,10 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
FlowRecord selectFlowRecordByRecordIdMinIdStatus(@Param("resultRecordId") Long resultRecordId, @Param("id") Long id, @Param("status") int status);
int batchUpdateExecution(@Param("recordIds")List<Long> recordIds,@Param("processId") int processId);
int batchUpdateSkip(@Param("recordIds")List<Long> recordIds);
List<FlowRecord> selectFlowRecordByRecordIdFlowProcess(@Param("id") Long id, @Param("flowProcess") int flowProcess);
int batchDeleteByRecordIds(@Param("recordIds")List<Long> recordIds);
}

View File

@ -80,8 +80,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
@Autowired
private DingtalkBusiness dingtalkBusiness;
public static final int processId = 1;
@Override
@ -165,7 +163,14 @@ public class AssessManagerServiceImpl implements AssessManagerService {
//删除副本组
evaluationGroupService.deleteByCopyIds(collect,flowStart.getId());
}
resultRecordMapper.batchDeleteByStartId(flowStart.getId());
List<Long> ids = resultRecordMapper.selectIdsByStartId(flowStart.getId());
if(CollectionUtils.isNotEmpty(ids)){
log.info("删除resultRecordIds: " + JSON.toJSONString(ids));
resultRecordMapper.batchDeleteByResultRecordIds(ids);
//删除flowRecord
flowRecordMapper.batchDeleteByRecordIds(ids);
}
return ;
}
@ -317,7 +322,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
List<Long> collect = objects.stream().map(o -> Long.valueOf(String.valueOf(o))).collect(toList());
int updateExecution = flowRecordMapper.batchUpdateExecution(collect, processId);
int updateExecution = flowRecordMapper.batchUpdateSkip(collect);
log.info("更新flowRecord记录,i:" + updateExecution);
}

View File

@ -101,4 +101,9 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
ResultRecord selectLastResultRecordByUserId(@Param("userId") Long userId);
ResultRecord selectResultRecordByStaffIdAndStartId(@Param("userId") Long userId, @Param("startId") Long startId);
List<Long> selectIdsByStartId(@Param("startId")Long startId);
int batchDeleteByResultRecordIds(@Param("resultRecordIds")List<Long> resultRecordIds);
}

View File

@ -594,5 +594,21 @@
<select id="selectResultRecordByStaffIdAndStartId" resultType="ResultRecord" >
select * from lz_result_record where staff_id=#{userId} and is_delete = 0 and start_id = #{startId} order by id desc limit 1
</select>
<select id="selectIdsByStartId" resultType="long">
select id from lz_result_record where
is_delete = 0
and start_id = #{startId}
</select>
<update id="batchDeleteByResultRecordIds">
update lz_result_record set is_delete = 1 where
is_delete = 0
and id in (
<foreach collection="resultRecordIds" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@ -266,23 +266,34 @@
select * from lz_flow_record where is_delete = 0 and record_id = #{resultRecordId} and id > #{id} and status = #{status} order by id asc limit 1
</select>
<update id="batchUpdateExecution">
<update id="batchUpdateSkip">
UPDATE lz_flow_record
SET status = 4
,gmt_modified = now()
where is_delete = 0 and status !=4 and flow_process = 2 and process_id = #{processId}
<if test="recordIds !=null and recordIds.size()!=0">
and record_id in (
<foreach collection="recordIds" item="record_id" separator=",">
#{record_id}
</foreach>
)
</if>
where is_delete = 0 and status !=4 and flow_process = 2
and record_id in (
<foreach collection="recordIds" item="record_id" separator=",">
#{record_id}
</foreach>
)
</update>
<select id="selectFlowRecordByRecordIdFlowProcess" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{id} and flow_process = #{flowProcess}
</select>
<update id="batchDeleteByRecordIds">
UPDATE lz_flow_record
SET is_delete = 1,
,gmt_modified = now()
where is_delete = 0
and record_id in (
<foreach collection="recordIds" item="record_id" separator=",">
#{record_id}
</foreach>
)
</update>
</mapper>