Commit 0554cfc7 authored by KeYong's avatar KeYong

修改任务节点查询逻辑

parent b76f1ad8
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService;
import com.yeejoin.amos.fas.business.vo.EmergencyRelationVo;
import com.yeejoin.amos.fas.common.enums.PlanTypeEnum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
......@@ -19,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
......@@ -42,6 +44,9 @@ public class EmergencyTaskController extends BaseController{
@Autowired
private IDictService dictService;
@Autowired
private RedisTemplate redisTemplate;
@ApiOperation(httpMethod = "GET",value = "岗位人员树", notes = "岗位人员树")
@RequestMapping(value = "/tree", method = RequestMethod.GET)
public CommonResponse tree(){
......@@ -90,7 +95,11 @@ public class EmergencyTaskController extends BaseController{
obligationId = null;
}
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
Page<EmergencyTaskContent> list = iEmergencyTaskService.list(obligationId,commonPageable);
String planType = null;
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
Page<EmergencyTaskContent> list = iEmergencyTaskService.list(obligationId, planType, commonPageable);
return CommonResponseUtil.success(list);
}
......
......@@ -30,6 +30,10 @@ public class PlanClassifyTreeController extends BaseController {
String compCode = getOrgCode(reginParams);
model.setOrgCode(compCode);
model.setCreator(user.getUserId());
if (!"0".equalsIgnoreCase(String.valueOf(model.getParentId()))) {
String planType = planClassifyTreeService.findById(model.getParentId()).getPlanType();
model.setPlanType(planType);
}
return CommonResponseUtil2.success(planClassifyTreeService.create(model));
}
......
......@@ -9,8 +9,8 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface EmergencyTaskMapper extends BaseMapper {
List<EmergencyTaskContent> getEmergencyTaskList(Long obligationId,Long offset,int pageSize);
int getEmergencyTaskCount(Long obligationId);
List<EmergencyTaskContent> getEmergencyTaskList(@Param("obligationId") Long obligationId, @Param("offset")Long offset, @Param("pageSize")int pageSize, @Param("planType") String planType);
int getEmergencyTaskCount(@Param("obligationId") Long obligationId, @Param("planType") String planType);
List<EmergencyRelationTree> treeList();
......@@ -24,8 +24,8 @@ public interface EmergencyTaskMapper extends BaseMapper {
List<String> roleNames(String amosOrgId);
List<EmergencyTaskContentVo> getContentList(@Param("stepCode") String stepCode);
List<EmergencyTaskContentVo> getContentList(@Param("stepCode") String stepCode, @Param("planType") String planType);
List<EmergencyTaskContentVo> getMustTaskList(@Param("stepCode") String stepCode);
List<EmergencyTaskContentVo> getMustTaskList(@Param("stepCode") String stepCode, @Param("planType") String planType);
}
......@@ -468,7 +468,11 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
instance.setContent(instance.getCategory());
ContingencyPlanInstance res = repository.save(instance);
if (!ObjectUtils.isEmpty(res)) {
List<EmergencyTaskContentVo> mustTasks = emergencyTaskService.getMustTaskList(stepCode);
String planType = null;
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
List<EmergencyTaskContentVo> mustTasks = emergencyTaskService.getMustTaskList(stepCode, planType);
boolean flag = judgeIfConfirmed(mustTasks, batchNo);
if (!"-1".equals(stepCode) && flag) {
PlanExecuteVo vo = new PlanExecuteVo();
......
......@@ -74,9 +74,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
private String stationName;
@Override
public Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable) {
int total = emergencyTaskMapper.getEmergencyTaskCount(obligationId);
List<EmergencyTaskContent> emergencyTaskList = emergencyTaskMapper.getEmergencyTaskList(obligationId, pageable.getOffset(), pageable.getPageSize());
public Page<EmergencyTaskContent> list(Long obligationId, String planType, CommonPageable pageable) {
int total = emergencyTaskMapper.getEmergencyTaskCount(obligationId, planType);
List<EmergencyTaskContent> emergencyTaskList = emergencyTaskMapper.getEmergencyTaskList(obligationId, pageable.getOffset(), pageable.getPageSize(), planType);
Page<EmergencyTaskContent> result = new PageImpl<>(emergencyTaskList, pageable, total);
return result;
......@@ -84,6 +84,7 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Override
public List<EmergencyRelationTree> treeList() {
return emergencyTaskMapper.treeList();
}
......@@ -120,7 +121,11 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Transactional
@Override
public void saveTask(String stepCode, String batchId) {
List<EmergencyTaskContentVo> list = emergencyTaskMapper.getContentList(stepCode);
String planType = null;
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
List<EmergencyTaskContentVo> list = emergencyTaskMapper.getContentList(stepCode, planType);
if (0 < list.size()) {
String batchNo = StringUtil.isNotEmpty(batchId) ? batchId : planOperationRecordMapper.getLastBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
......@@ -194,7 +199,7 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
}
@Override
public List<EmergencyTaskContentVo> getMustTaskList(String stepCode) {
return emergencyTaskMapper.getMustTaskList(stepCode);
public List<EmergencyTaskContentVo> getMustTaskList(String stepCode, String planType) {
return emergencyTaskMapper.getMustTaskList(stepCode, planType);
}
}
......@@ -137,6 +137,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return planClassifyTreeDao.save(model);
}
@Override
public PlanClassifyTree findById(Long id) {
return planClassifyTreeDao.findById(id).orElse(new PlanClassifyTree());
}
private boolean classifyNameExist(String classifyName, Long parentId) {
return 0 < planClassifyTreeDao.countByClassifyNameAndParentId(classifyName, parentId);
}
......
......@@ -12,7 +12,7 @@ import java.util.List;
public interface IEmergencyTaskService {
Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable);
Page<EmergencyTaskContent> list(Long obligationId, String planType, CommonPageable pageable);
List<EmergencyRelationTree> treeList();
......@@ -28,5 +28,5 @@ public interface IEmergencyTaskService {
void saveTask(String stepCode, String batchNo);
List<EmergencyTaskContentVo> getMustTaskList(String stepCode);
List<EmergencyTaskContentVo> getMustTaskList(String stepCode, String planType);
}
......@@ -28,4 +28,6 @@ public interface IPlanClassifyTreeService {
PlanClassifyTree create(PlanClassifyTree model);
PlanClassifyTree update(PlanClassifyTree model);
PlanClassifyTree findById(Long id);
}
......@@ -16,8 +16,11 @@
<if test="obligationId != null ">
obligation_id = #{obligationId}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
LIMIT #{offset}, #{pageSize}
LIMIT #{offset}, #{pageSize}
</select>
......@@ -31,8 +34,10 @@
<if test="_parameter != null ">
obligation_id = #{obligationId}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
</select>
......@@ -115,6 +120,9 @@
<if test="stepCode != null and stepCode != '' and stepCode == '-2'">
step_code = -1
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
</select>
......@@ -128,6 +136,9 @@
<if test="stepCode != null and stepCode != ''">
and step_code = #{stepCode}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
</select>
</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