add: 点位管理
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package org.nl.common.enums.wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/5/15
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PointStatusEnum {
|
||||
EMPTY_PLACE("1", "空位"),
|
||||
FULL_MATERIAL("2", "有料"),
|
||||
EMPTY_VEHICLE("3", "空载具");
|
||||
private final String value;
|
||||
private final String description;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.wms.sch.point.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "点位管理管理")
|
||||
@RequestMapping("/api/schBasePoint")
|
||||
public class SchBasePointController {
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询点位管理")
|
||||
@ApiOperation("查询点位管理")
|
||||
//@SaCheckPermission("@el.check('schBasePoint:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBasePointService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增点位管理")
|
||||
@ApiOperation("新增点位管理")
|
||||
//@SaCheckPermission("@el.check('schBasePoint:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SchBasePoint entity){
|
||||
schBasePointService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改点位管理")
|
||||
@ApiOperation("修改点位管理")
|
||||
//@SaCheckPermission("@el.check('schBasePoint:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SchBasePoint entity){
|
||||
schBasePointService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除点位管理")
|
||||
@ApiOperation("删除点位管理")
|
||||
//@SaCheckPermission("@el.check('schBasePoint:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
schBasePointService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("启动与禁用")
|
||||
@PostMapping("/changeUsed")
|
||||
@ApiOperation("启动与禁用")
|
||||
public ResponseEntity<Object> changeUsedOn(@RequestBody JSONObject jsonObject) {
|
||||
schBasePointService.changeUsed(jsonObject);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.wms.sch.point.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.point.service.dao.SchBasePoint;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBasePoint>
|
||||
*/
|
||||
IPage<SchBasePoint> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SchBasePoint entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SchBasePoint entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
* @param jsonObject
|
||||
*/
|
||||
void changeUsed(JSONObject jsonObject);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package org.nl.wms.sch.point.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sch_base_point")
|
||||
public class SchBasePoint implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "point_code", type = IdType.NONE)
|
||||
@ApiModelProperty(value = "点位编码")
|
||||
private String point_code;
|
||||
|
||||
@ApiModelProperty(value = "点位名称")
|
||||
private String point_name;
|
||||
|
||||
@ApiModelProperty(value = "区域编码")
|
||||
private String region_code;
|
||||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
private String region_name;
|
||||
|
||||
@ApiModelProperty(value = "点位类型")
|
||||
private String point_type;
|
||||
|
||||
@ApiModelProperty(value = "点位状态")
|
||||
private String point_status;
|
||||
|
||||
@ApiModelProperty(value = "允许的物料类型")
|
||||
private String can_material_type;
|
||||
|
||||
@ApiModelProperty(value = "允许的载具类型")
|
||||
private String can_vehicle_type;
|
||||
|
||||
@ApiModelProperty(value = "载具允许最大数量")
|
||||
private BigDecimal vehicle_max_qty;
|
||||
|
||||
@ApiModelProperty(value = "载具类型")
|
||||
private String vehicle_type;
|
||||
|
||||
@ApiModelProperty(value = "载具编码")
|
||||
private String vehicle_code;
|
||||
|
||||
@ApiModelProperty(value = "载具数量")
|
||||
private BigDecimal vehicle_qty;
|
||||
|
||||
@ApiModelProperty(value = "块")
|
||||
private BigDecimal block_num;
|
||||
|
||||
@ApiModelProperty(value = "排")
|
||||
private BigDecimal row_num;
|
||||
|
||||
@ApiModelProperty(value = "列")
|
||||
private BigDecimal col_num;
|
||||
|
||||
@ApiModelProperty(value = "层")
|
||||
private BigDecimal layer_num;
|
||||
|
||||
@ApiModelProperty(value = "入库顺序")
|
||||
private BigDecimal in_order_seq;
|
||||
|
||||
@ApiModelProperty(value = "出库顺序")
|
||||
private BigDecimal out_order_seq;
|
||||
|
||||
@ApiModelProperty(value = "入空载具顺序")
|
||||
private BigDecimal in_empty_seq;
|
||||
|
||||
@ApiModelProperty(value = "出空载具顺序")
|
||||
private BigDecimal out_empty_seq;
|
||||
|
||||
@ApiModelProperty(value = "父点位编码")
|
||||
private String parent_point_code;
|
||||
|
||||
@ApiModelProperty(value = "外部点位编码")
|
||||
private String ext_point_code;
|
||||
|
||||
@ApiModelProperty(value = "在执行的任务标识")
|
||||
private String ing_task_code;
|
||||
|
||||
@ApiModelProperty(value = "是否创建工单")
|
||||
private Boolean is_has_workder;
|
||||
|
||||
@ApiModelProperty(value = "车间编码")
|
||||
private String workshop_code;
|
||||
|
||||
@ApiModelProperty(value = "是否自动")
|
||||
private Boolean is_auto;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean is_used;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String create_id;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String create_name;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String create_time;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String update_id;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String update_name;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private String update_time;
|
||||
|
||||
@ApiModelProperty(value = "允许存放的载具数据")
|
||||
@TableField(exist = false)
|
||||
private List<String> can_vehicle_types;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String point_type_name;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String point_status_name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.sch.point.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,116 @@
|
||||
package org.nl.wms.sch.point.service.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Data
|
||||
public class SchBasePointDto implements Serializable {
|
||||
|
||||
/** 点位编码 */
|
||||
private String point_code;
|
||||
|
||||
/** 点位名称 */
|
||||
private String point_name;
|
||||
|
||||
/** 区域编码 */
|
||||
private String region_code;
|
||||
|
||||
/** 区域名称 */
|
||||
private String region_name;
|
||||
|
||||
/** 点位类型 */
|
||||
private String point_type;
|
||||
|
||||
/** 点位状态 */
|
||||
private String point_status;
|
||||
|
||||
/** 允许的物料类型 */
|
||||
private String can_material_type;
|
||||
|
||||
/** 允许的载具类型 */
|
||||
private String can_vehicle_type;
|
||||
|
||||
/** 载具允许最大数量 */
|
||||
private BigDecimal vehicle_max_qty;
|
||||
|
||||
/** 载具类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
/** 载具编码 */
|
||||
private String vehicle_code;
|
||||
|
||||
/** 载具数量 */
|
||||
private BigDecimal vehicle_qty;
|
||||
|
||||
/** 块 */
|
||||
private BigDecimal block_num;
|
||||
|
||||
/** 排 */
|
||||
private BigDecimal row_num;
|
||||
|
||||
/** 列 */
|
||||
private BigDecimal col_num;
|
||||
|
||||
/** 层 */
|
||||
private BigDecimal layer_num;
|
||||
|
||||
/** 入库顺序 */
|
||||
private BigDecimal in_order_seq;
|
||||
|
||||
/** 出库顺序 */
|
||||
private BigDecimal out_order_seq;
|
||||
|
||||
/** 入空载具顺序 */
|
||||
private BigDecimal in_empty_seq;
|
||||
|
||||
/** 出空载具顺序 */
|
||||
private BigDecimal out_empty_seq;
|
||||
|
||||
/** 父点位编码 */
|
||||
private String parent_point_code;
|
||||
|
||||
/** 外部点位编码 */
|
||||
private String ext_point_code;
|
||||
|
||||
/** 在执行的任务标识 */
|
||||
private String ing_task_code;
|
||||
|
||||
/** 是否创建工单 */
|
||||
private Boolean is_has_workder;
|
||||
|
||||
/** 车间编码 */
|
||||
private String workshop_code;
|
||||
|
||||
/** 是否自动 */
|
||||
private Boolean is_auto;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否启用 */
|
||||
private Boolean is_used;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_id;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改人 */
|
||||
private String update_id;
|
||||
|
||||
/** 修改人 */
|
||||
private String update_name;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.sch.point.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
public class SchBasePointQuery extends BaseQuery<SchBasePoint> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.nl.wms.sch.point.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.enums.wms.PointStatusEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch.region.service.dao.mapper.SchBaseRegionMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, SchBasePoint> implements ISchBasePointService {
|
||||
|
||||
@Autowired
|
||||
private SchBasePointMapper pointMapper;
|
||||
|
||||
@Autowired
|
||||
private SchBaseRegionMapper regionMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page){
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), SchBasePoint::getPoint_code, blurry)
|
||||
.or(ObjectUtil.isNotEmpty(blurry), lam1 -> lam1.like(SchBasePoint::getPoint_name, blurry));
|
||||
IPage<SchBasePoint> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pointMapper.selectPage(pages, lam);
|
||||
// 可以存放的载具类型
|
||||
pages.getRecords().forEach(point -> {
|
||||
point.setCan_vehicle_types(Arrays.asList(point.getCan_vehicle_type().split(",")));
|
||||
String pointStatus = point.getPoint_status(); // 点位状态
|
||||
String pointType = point.getPoint_type(); // 点位类型
|
||||
SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_code());
|
||||
if (ObjectUtil.isNotEmpty(pointStatus)) {
|
||||
JSONObject statusArr = new JSONObject();
|
||||
String[] split = regionObj.getPoint_status_explain().split(",");
|
||||
for ( int j = 0; j < split.length; j++) {
|
||||
String[] status = split[j].split("-");
|
||||
statusArr.put(status[0], status[1]);
|
||||
}
|
||||
// 设置
|
||||
point.setPoint_status_name(statusArr.getString(pointStatus));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pointType)) {
|
||||
JSONObject typeArr = new JSONObject();
|
||||
String[] split = regionObj.getPoint_type_explain().split(",");
|
||||
for ( int j = 0; j < split.length; j++) {
|
||||
String[] types = split[j].split("-");
|
||||
typeArr.put(types[0], types[1]);
|
||||
}
|
||||
// 设置
|
||||
point.setPoint_type_name(typeArr.getString(pointType));
|
||||
}
|
||||
});
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(SchBasePoint entity) {
|
||||
String point_code = entity.getPoint_code();
|
||||
SchBasePoint pointObj = pointMapper.selectById(point_code);
|
||||
if (ObjectUtil.isNotEmpty(pointObj) && !pointObj.getPoint_code().equals(entity.getPoint_code())) {
|
||||
throw new BadRequestException("存在相同的点位编码");
|
||||
}
|
||||
|
||||
// 默认父类点位为自身
|
||||
if (ObjectUtil.isEmpty(entity.getParent_point_code())) {
|
||||
entity.setParent_point_code(entity.getPoint_code());
|
||||
}
|
||||
|
||||
String can_vehicle_type = String.join(",", entity.getCan_vehicle_types());
|
||||
entity.setCan_vehicle_type(can_vehicle_type);
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
// 获取region_name
|
||||
SchBaseRegion baseRegion = regionMapper.selectById(entity.getRegion_code());
|
||||
entity.setRegion_name(baseRegion.getRegion_name());
|
||||
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
pointMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(SchBasePoint entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
String can_vehicle_type = String.join(",", entity.getCan_vehicle_types());
|
||||
entity.setCan_vehicle_type(can_vehicle_type);
|
||||
String pointStatus = entity.getPoint_status();
|
||||
// 根据点位状态来判断更新内容
|
||||
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals(PointStatusEnum.EMPTY_PLACE.getValue())) {
|
||||
entity.setVehicle_type("");
|
||||
entity.setVehicle_code("");
|
||||
entity.setVehicle_qty(BigDecimal.valueOf(0));
|
||||
}
|
||||
pointMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
pointMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeUsed(JSONObject jsonObject) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,14 +27,14 @@ import java.util.Set;
|
||||
public class SchBaseRegionController {
|
||||
|
||||
@Autowired
|
||||
private ISchBaseRegionService schBaseRegionService;
|
||||
private ISchBaseRegionService regionService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询区域管理")
|
||||
@ApiOperation("查询区域管理")
|
||||
//@SaCheckPermission("@el.check('schBaseRegion:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseRegionService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(regionService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@@ -42,7 +42,7 @@ public class SchBaseRegionController {
|
||||
@ApiOperation("新增区域管理")
|
||||
//@SaCheckPermission("@el.check('schBaseRegion:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SchBaseRegion entity){
|
||||
schBaseRegionService.create(entity);
|
||||
regionService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SchBaseRegionController {
|
||||
@ApiOperation("修改区域管理")
|
||||
//@SaCheckPermission("@el.check('schBaseRegion:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SchBaseRegion entity){
|
||||
schBaseRegionService.update(entity);
|
||||
regionService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,31 @@ public class SchBaseRegionController {
|
||||
//@SaCheckPermission("@el.check('schBaseRegion:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
schBaseRegionService.deleteAll(ids);
|
||||
regionService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getRegionList")
|
||||
@Log("获取区域下拉框")
|
||||
@ApiOperation("获取区域下拉框")
|
||||
//@SaCheckPermission("@el.check('schBaseRegion:list')")
|
||||
public ResponseEntity<Object> getRegionList(){
|
||||
return new ResponseEntity<>(regionService.getRegionList(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getPointStatusSelectById")
|
||||
@Log("获取点位状态下拉框")
|
||||
@ApiOperation("获取点位状态下拉框")
|
||||
//@SaCheckPermission("region:add")
|
||||
public ResponseEntity<Object> getPointStatusSelectById(@RequestBody String region_id) {
|
||||
return new ResponseEntity<>(regionService.getPointStatusSelectById(region_id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getPointTypeSelectById")
|
||||
@Log("获取点位类型下拉框")
|
||||
@ApiOperation("获取点位类型下拉框")
|
||||
//@SaCheckPermission("region:add")
|
||||
public ResponseEntity<Object> getPointTypeSelectById(@RequestBody String region_id) {
|
||||
return new ResponseEntity<>(regionService.getPointTypeSelectById(region_id), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.nl.wms.sch.region.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.region.service.dao.SchBaseRegion;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -40,4 +42,14 @@ public interface ISchBaseRegionService extends IService<SchBaseRegion> {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 区域下拉框
|
||||
* @return
|
||||
*/
|
||||
List<SchBaseRegion> getRegionList();
|
||||
|
||||
JSONArray getPointStatusSelectById(String regionId);
|
||||
|
||||
JSONArray getPointTypeSelectById(String regionId);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.sch.region.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -18,6 +20,7 @@ import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
@@ -82,4 +85,49 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
schBaseRegionMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBaseRegion> getRegionList() {
|
||||
return this.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getPointStatusSelectById(String regionId) {
|
||||
/**
|
||||
* label,value
|
||||
*/
|
||||
SchBaseRegion schBaseRegion = schBaseRegionMapper.selectById(regionId);
|
||||
JSONArray res = new JSONArray();
|
||||
String pointStatusExplain = schBaseRegion.getPoint_status_explain();
|
||||
if (ObjectUtil.isEmpty(pointStatusExplain)) return res;
|
||||
String[] explain = pointStatusExplain.split(",");
|
||||
for (int i = 0; i < explain.length; i++) {
|
||||
String[] status = explain[i].split("-");
|
||||
JSONObject point_status = new JSONObject();
|
||||
point_status.put("label", status[1]);
|
||||
point_status.put("value", status[0]);
|
||||
res.add(point_status);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getPointTypeSelectById(String regionId) {
|
||||
/**
|
||||
* label,value
|
||||
*/
|
||||
SchBaseRegion schBaseRegion = schBaseRegionMapper.selectById(regionId);
|
||||
JSONArray res = new JSONArray();
|
||||
String pointTypeExplain = schBaseRegion.getPoint_type_explain();
|
||||
if (ObjectUtil.isEmpty(pointTypeExplain)) return res;
|
||||
String[] explain = pointTypeExplain.split(",");
|
||||
for (int i = 0; i < explain.length; i++) {
|
||||
String[] types = explain[i].split("-");
|
||||
JSONObject point_type = new JSONObject();
|
||||
point_type.put("label", types[1]);
|
||||
point_type.put("value", types[0]);
|
||||
res.add(point_type);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user