fix: 任务配置以及基础分类三级回显失败BUG
This commit is contained in:
@@ -213,40 +213,36 @@ public class MdBaseClassstandardServiceImpl extends ServiceImpl<MdBaseClassstand
|
||||
|
||||
@Override
|
||||
public List<MdBaseClassstandard> buildTree(ArrayList<MdBaseClassstandard> list) {
|
||||
// 将获取的数据初始化状态
|
||||
// 初始化数据
|
||||
list.forEach(classstandard -> {
|
||||
classstandard.setId(classstandard.getClass_id());
|
||||
classstandard.setLabel(classstandard.getClass_name());
|
||||
classstandard.setLeaf((classstandard.getSub_count() <= 0));
|
||||
classstandard.setHasChildren(classstandard.getSub_count() > 0);
|
||||
});
|
||||
// 待返回数据
|
||||
List<MdBaseClassstandard> trees = new ArrayList<>();
|
||||
for (MdBaseClassstandard mdBaseClassstandard : list) {
|
||||
// 筛选父类的值
|
||||
if (ObjectUtil.isEmpty(mdBaseClassstandard.getParent_class_id())
|
||||
|| mdBaseClassstandard.getParent_class_id().equals("0")) {
|
||||
// collect:获取当前对象的所有子级
|
||||
List<MdBaseClassstandard> collect = list.stream().filter(t -> t.getParent_class_id()
|
||||
.equals(mdBaseClassstandard.getClass_id())).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(collect)) {
|
||||
// 设置参数
|
||||
collect.forEach(classstandard -> {
|
||||
classstandard.setId(classstandard.getClass_id());
|
||||
classstandard.setLabel(classstandard.getClass_name());
|
||||
classstandard.setHasChildren(classstandard.getSub_count() > 0);
|
||||
});
|
||||
MdBaseClassstandardTrees tObj = new MdBaseClassstandardTrees();
|
||||
// 赋值一份实体,可以避免vue-tree拿到children属性显示展开图标
|
||||
BeanUtils.copyProperties(mdBaseClassstandard, tObj);
|
||||
tObj.setChildren(collect);
|
||||
trees.add(tObj);
|
||||
} else {
|
||||
trees.add(mdBaseClassstandard);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建树结构
|
||||
return list.stream()
|
||||
.filter(node -> "0".equals(node.getParent_class_id()) || ObjectUtil.isEmpty(node.getParent_class_id()))
|
||||
.map(node -> createTree(node, list))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private MdBaseClassstandard createTree(MdBaseClassstandard node, List<MdBaseClassstandard> list) {
|
||||
List<MdBaseClassstandard> children = list.stream()
|
||||
.filter(child -> node.getClass_id().equals(child.getParent_class_id()))
|
||||
.map(child -> createTree(child, list))
|
||||
.collect(Collectors.toList());
|
||||
if (!children.isEmpty()) {
|
||||
MdBaseClassstandardTrees tObj = new MdBaseClassstandardTrees();
|
||||
// 赋值一份实体,可以避免vue-tree拿到children属性显示展开图标
|
||||
BeanUtils.copyProperties(node, tObj);
|
||||
tObj.setChildren(children);
|
||||
return tObj;
|
||||
} else {
|
||||
node.setLeaf(true);
|
||||
}
|
||||
return trees;
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task.service.dto.SchBaseTaskconfigQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -30,7 +31,7 @@ public class SchBaseTaskconfigController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询任务配置")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
public ResponseEntity<Object> query(SchBaseTaskconfigQuery whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskconfigService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task.service.dto.SchBaseTaskconfigQuery;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -21,7 +22,7 @@ public interface ISchBaseTaskconfigService extends IService<SchBaseTaskconfig> {
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBaseTaskconfig>
|
||||
*/
|
||||
IPage<SchBaseTaskconfig> queryAll(Map whereJson, PageQuery pageable);
|
||||
IPage<SchBaseTaskconfig> queryAll(SchBaseTaskconfigQuery whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
|
||||
@@ -25,124 +25,128 @@ public class SchBaseTaskconfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "config_id", type = IdType.NONE)
|
||||
|
||||
|
||||
private String config_id;
|
||||
|
||||
|
||||
|
||||
private String config_code;
|
||||
|
||||
|
||||
|
||||
private String config_name;
|
||||
|
||||
|
||||
|
||||
private String route_plan_code;
|
||||
|
||||
|
||||
|
||||
private String task_qf_type;
|
||||
|
||||
|
||||
|
||||
private String acs_task_type;
|
||||
|
||||
|
||||
|
||||
private String task_name;
|
||||
|
||||
|
||||
private String task_type;
|
||||
|
||||
|
||||
private String task_type;
|
||||
@TableField(exist = false)
|
||||
private String task_type_id;
|
||||
@TableField(exist = false)
|
||||
private String task_type_name;
|
||||
|
||||
|
||||
private String task_direction;
|
||||
|
||||
|
||||
|
||||
private String priority;
|
||||
|
||||
|
||||
|
||||
private Integer task_create_max_num;
|
||||
|
||||
|
||||
|
||||
private Integer task_issue_max_num;
|
||||
|
||||
|
||||
|
||||
private Boolean is_auto_issue;
|
||||
|
||||
|
||||
|
||||
private String start_region_str;
|
||||
|
||||
|
||||
|
||||
private String next_region_str;
|
||||
|
||||
|
||||
|
||||
private String start_point_pre;
|
||||
|
||||
|
||||
|
||||
private String next_region_pre;
|
||||
|
||||
|
||||
|
||||
private Boolean is_check_workorder;
|
||||
|
||||
|
||||
|
||||
private Boolean is_check_start_lock;
|
||||
|
||||
|
||||
|
||||
private Boolean is_immediate_create;
|
||||
|
||||
|
||||
|
||||
private Boolean is_check_next_lock;
|
||||
|
||||
|
||||
|
||||
private Boolean is_start_auto;
|
||||
|
||||
|
||||
|
||||
private Boolean is_next_auto;
|
||||
|
||||
|
||||
|
||||
private Boolean is_lock_start;
|
||||
|
||||
|
||||
|
||||
private Boolean is_lock_next;
|
||||
|
||||
|
||||
|
||||
private String request_param;
|
||||
|
||||
|
||||
|
||||
private String response_param;
|
||||
|
||||
|
||||
|
||||
private Boolean is_group_congrol_issue_seq;
|
||||
|
||||
|
||||
|
||||
private BigDecimal unfinish_notify_time;
|
||||
|
||||
|
||||
|
||||
private String sql_param;
|
||||
|
||||
|
||||
|
||||
private String workshop_code;
|
||||
|
||||
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
private Boolean is_used;
|
||||
|
||||
|
||||
|
||||
private Boolean is_delete;
|
||||
|
||||
|
||||
|
||||
private String create_id;
|
||||
|
||||
|
||||
|
||||
private String create_name;
|
||||
|
||||
|
||||
|
||||
private String create_time;
|
||||
|
||||
|
||||
|
||||
private String update_id;
|
||||
|
||||
|
||||
|
||||
private String update_name;
|
||||
|
||||
|
||||
|
||||
private String update_time;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.sch.task.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task.service.dto.SchBaseTaskconfigQuery;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -9,4 +11,11 @@ import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
**/
|
||||
public interface SchBaseTaskconfigMapper extends BaseMapper<SchBaseTaskconfig> {
|
||||
|
||||
/**
|
||||
* 连接查询
|
||||
* @param pages 分页
|
||||
* @param config 参数
|
||||
* @return 任务配置数据
|
||||
*/
|
||||
IPage<SchBaseTaskconfig> selectPageLeftJoin(IPage<SchBaseTaskconfig> pages, SchBaseTaskconfigQuery config);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,20 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.sch.task.service.dao.mapper.SchBaseTaskconfigMapper">
|
||||
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.wms.sch.task.service.dao.SchBaseTaskconfig">
|
||||
SELECT
|
||||
sc.*,
|
||||
mc.class_id AS task_type_id,
|
||||
mc.class_name AS task_type_name
|
||||
FROM
|
||||
`sch_base_taskconfig` sc
|
||||
LEFT JOIN md_base_classstandard mc ON mc.class_code = sc.task_type
|
||||
WHERE sc.is_delete = FALSE
|
||||
<if test="config.blurry != null">
|
||||
AND sc.config_name LIKE '%${config.blurry}%'
|
||||
</if>
|
||||
<if test="config.workshop_code != null">
|
||||
AND sc.workshop_code = config.workshop_code
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package org.nl.wms.sch.task.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
public class SchBaseTaskconfigQuery extends BaseQuery<SchBaseTaskconfig> {
|
||||
@Data
|
||||
public class SchBaseTaskconfigQuery extends SchBaseTaskconfig {
|
||||
|
||||
private String blurry;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,9 +12,12 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.wms.basedata.master.classification.service.IMdBaseClassstandardService;
|
||||
import org.nl.wms.basedata.master.classification.service.dao.MdBaseClassstandard;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task.service.dao.mapper.SchBaseTaskconfigMapper;
|
||||
import org.nl.wms.sch.task.service.dto.SchBaseTaskconfigQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -33,32 +36,27 @@ public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigM
|
||||
|
||||
@Autowired
|
||||
private SchBaseTaskconfigMapper schBaseTaskconfigMapper;
|
||||
@Autowired
|
||||
private IMdBaseClassstandardService classstandardService;
|
||||
|
||||
@Override
|
||||
public IPage<SchBaseTaskconfig> queryAll(Map whereJson, PageQuery page) {
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code")) ? whereJson.get("workshop_code").toString() : null;
|
||||
LambdaQueryWrapper<SchBaseTaskconfig> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), SchBaseTaskconfig::getConfig_name, blurry)
|
||||
.eq(ObjectUtil.isNotEmpty(workshop_code), SchBaseTaskconfig::getWorkshop_code, workshop_code);
|
||||
public IPage<SchBaseTaskconfig> queryAll(SchBaseTaskconfigQuery whereJson, PageQuery page) {
|
||||
IPage<SchBaseTaskconfig> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
schBaseTaskconfigMapper.selectPage(pages, lam);
|
||||
pages.getRecords().forEach(config -> {
|
||||
if (ObjectUtil.isNotEmpty(config.getStart_region_str())) {
|
||||
config.setStart_region_strs(Arrays.asList(config.getStart_region_str().split(",")));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(config.getNext_region_str())) {
|
||||
config.setNext_region_strs(Arrays.asList(config.getNext_region_str().split(",")));
|
||||
}
|
||||
});
|
||||
pages = schBaseTaskconfigMapper.selectPageLeftJoin(pages, whereJson);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(SchBaseTaskconfig entity) {
|
||||
SchBaseTaskconfig schBaseTaskconfig = schBaseTaskconfigMapper.selectOne(new LambdaQueryWrapper<SchBaseTaskconfig>().eq(SchBaseTaskconfig::getConfig_code, entity.getConfig_code()));
|
||||
if (ObjectUtil.isNotEmpty(schBaseTaskconfig))
|
||||
if (ObjectUtil.isNotEmpty(schBaseTaskconfig)) {
|
||||
throw new BadRequestException(LangProcess.msg("error_ParamExist", entity.getConfig_code()));
|
||||
}
|
||||
|
||||
MdBaseClassstandard classstandard = classstandardService.getById(entity.getTask_type_id());
|
||||
if (classstandard == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_isNull", entity.getTask_type()));
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -71,26 +69,19 @@ public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigM
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
entity.setTask_type(classstandard.getClass_code());
|
||||
schBaseTaskconfigMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(SchBaseTaskconfig entity) {
|
||||
SchBaseTaskconfig dto = schBaseTaskconfigMapper.selectById(entity.getConfig_id());
|
||||
if (dto == null) throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs()))
|
||||
throw new BadRequestException(LangProcess.msg("point_checkNull_1"));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(entity.getStart_region_strs())) {
|
||||
// 起点区域配置
|
||||
String startRegion = String.join(",", entity.getStart_region_strs());
|
||||
entity.setStart_region_str(startRegion);
|
||||
if (dto == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(entity.getNext_region_strs())) {
|
||||
// 终点区域配置
|
||||
String nextRegion = String.join(",", entity.getNext_region_strs());
|
||||
entity.setNext_region_str(nextRegion);
|
||||
MdBaseClassstandard classstandard = classstandardService.getById(entity.getTask_type_id());
|
||||
if (classstandard == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_isNull", entity.getTask_type()));
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -98,7 +89,7 @@ public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigM
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
entity.setTask_type(classstandard.getClass_code());
|
||||
schBaseTaskconfigMapper.updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user