add:添加仓库策略

This commit is contained in:
zhangzq
2025-06-25 18:04:07 +08:00
parent cc3376f60d
commit fc2bb569b6
13 changed files with 578 additions and 19 deletions

View File

@@ -5,9 +5,11 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.dto.CurrentUser;
import java.util.List;
import java.util.prefs.BackingStoreException;
/**
* @author: lyd
@@ -23,23 +25,12 @@ public class SecurityUtils {
* @return 系统用户
*/
public static CurrentUser getCurrentUser() {
try {
Object loginInfo = StpUtil.getExtra("loginInfo");
if (loginInfo==null){
CurrentUser currentUser = new CurrentUser();
currentUser.setId("2");
currentUser.setPresonName("外部系统用户");
currentUser.setUsername("admin");
return currentUser;
}
return JSONObject.parseObject(String.valueOf(loginInfo),CurrentUser.class);
} catch (Exception e) {
CurrentUser currentUser = new CurrentUser();
currentUser.setId("2");
currentUser.setPresonName("外部系统用户");
currentUser.setUsername("admin");
return currentUser;
Object loginInfo = StpUtil.getExtra("loginInfo");
if (loginInfo==null){
throw new BadRequestException("用户信息获取失败");
}
return JSONObject.parseObject(String.valueOf(loginInfo),CurrentUser.class);
}
/**

View File

@@ -64,10 +64,10 @@ public class CodeGenerator {
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/lanzhou_two?serverTimezone=GMT&setUnicode=true&characterEncoding=utf8");
dsc.setUrl("jdbc:mysql://192.168.81.251:3306/wms_oulun?serverTimezone=GMT&setUnicode=true&characterEncoding=utf8");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("root");
dsc.setPassword("123456");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();

View File

@@ -0,0 +1,67 @@
package org.nl.wms.decision_manage.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.common.base.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.logging.annotation.Log;
import org.nl.common.utils.MapOf;
import org.nl.wms.decision_manage.service.IStSectStrategyService;
import org.nl.wms.decision_manage.service.dao.StSectStrategy;
import org.nl.wms.decision_manage.service.dao.StStrategyConfig;
import org.nl.wms.decision_manage.service.dto.SectStrategyQuery;
import org.nl.wms.decision_manage.service.dto.StrategyQuery;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author generator
* @since 2025-06-25
*/
@RestController
@RequestMapping("/stSectStrategy")
public class StSectStrategyController {
@Autowired
private IStSectStrategyService iStSectStrategyService;
@GetMapping
public ResponseEntity<Object> query(SectStrategyQuery query, PageQuery page) {
return new ResponseEntity<>(iStSectStrategyService.page(page.build(),query.build()), HttpStatus.OK);
}
@PostMapping
@Log("新增库区货位规则")
public ResponseEntity<Object> create(@Validated @RequestBody StSectStrategy dao) {
iStSectStrategyService.save(dao);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping
@Log("修改库区货位规则")
public ResponseEntity<Object> update(@Validated @RequestBody StSectStrategy dao) {
iStSectStrategyService.updateById(dao);
return new ResponseEntity<>(HttpStatus.OK);
}
@DeleteMapping
@Log("删除规格")
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
iStSectStrategyService.removeByIds(Arrays.asList(ids));
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,16 @@
package org.nl.wms.decision_manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.decision_manage.service.dao.StSectStrategy;
/**
* <p>
* 服务类
* </p>
*
* @author generator
* @since 2025-06-25
*/
public interface IStSectStrategyService extends IService<StSectStrategy> {
}

View File

@@ -0,0 +1,57 @@
package org.nl.wms.decision_manage.service.dao;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author generator
* @since 2025-06-25
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("st_sect_strategy")
public class StSectStrategy implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键盘
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 库区
*/
private String sect_code;
/**
* 规则
*/
private String strategy;
/**
* 描述
*/
private String description;
/**
* 更新时间
*/
private String update_time;
/**
* 更新人
*/
private String update_name;
}

View File

@@ -0,0 +1,16 @@
package org.nl.wms.decision_manage.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.decision_manage.service.dao.StSectStrategy;
/**
* <p>
* Mapper 接口
* </p>
*
* @author generator
* @since 2025-06-25
*/
public interface StSectStrategyMapper extends BaseMapper<StSectStrategy> {
}

View File

@@ -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.decision_manage.service.dao.mapper.StSectStrategyMapper">
</mapper>

View File

@@ -0,0 +1,26 @@
package org.nl.wms.decision_manage.service.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.common.domain.query.QParam;
import org.nl.common.enums.QueryTEnum;
import org.nl.wms.decision_manage.service.dao.StSectStrategy;
import org.nl.wms.decision_manage.service.dao.StStrategyConfig;
/*
* @author ZZQ
* @Date 2023/5/4 19:49
*/
@Data
public class SectStrategyQuery extends BaseQuery<StSectStrategy> {
private String strategy_name;
private Boolean is_delete =Boolean.FALSE;
@Override
public void paramMapping() {
super.doP.put("strategy_name", QParam.builder().k(new String[]{"strategy_name"}).type(QueryTEnum.LK).build());
}
}

View File

@@ -0,0 +1,20 @@
package org.nl.wms.decision_manage.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.decision_manage.service.IStSectStrategyService;
import org.nl.wms.decision_manage.service.dao.StSectStrategy;
import org.nl.wms.decision_manage.service.dao.mapper.StSectStrategyMapper;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author generator
* @since 2025-06-25
*/
@Service
public class StSectStrategyServiceImpl extends ServiceImpl<StSectStrategyMapper, StSectStrategy> implements IStSectStrategyService {
}

View File

@@ -99,7 +99,7 @@
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="debug">
<root level="info">
<appender-ref ref="asyncLuceneAppender"/>
<appender-ref ref="CONSOLE"/>
</root>