332 changed files with 1524 additions and 3644 deletions
@ -1,433 +0,0 @@ |
|||
package org.nl.common.utils; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.extra.template.*; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.system.service.generator.dao.CodeColumnConfig; |
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
import org.springframework.util.ObjectUtils; |
|||
|
|||
import java.io.File; |
|||
import java.io.FileWriter; |
|||
import java.io.IOException; |
|||
import java.io.Writer; |
|||
import java.time.LocalDate; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import static org.nl.common.utils.FileUtil.SYS_TEM_DIR; |
|||
|
|||
/** |
|||
* @author: lyd |
|||
* @description: 代码生成 |
|||
* @Date: 2022/12/2 |
|||
*/ |
|||
@Slf4j |
|||
@SuppressWarnings({"unchecked", "all"}) |
|||
public class GenUtil { |
|||
private static final String TIMESTAMP = "Timestamp"; |
|||
|
|||
private static final String Date = "Date"; |
|||
|
|||
private static final String BIGDECIMAL = "BigDecimal"; |
|||
|
|||
public static final String PK = "PRI"; |
|||
|
|||
public static final String EXTRA = "auto_increment"; |
|||
|
|||
/** |
|||
* 获取后端代码模板名称 |
|||
* |
|||
* @return List |
|||
*/ |
|||
private static List<String> getAdminTemplateNames() { |
|||
List<String> templateNames = new ArrayList<>(); |
|||
templateNames.add("Entity"); |
|||
templateNames.add("MySQLMapper"); |
|||
templateNames.add("Dto"); |
|||
templateNames.add("Mapper"); |
|||
templateNames.add("Controller"); |
|||
templateNames.add("QueryCriteria"); |
|||
templateNames.add("Service"); |
|||
templateNames.add("ServiceImpl"); |
|||
// templateNames.add("Repository");
|
|||
return templateNames; |
|||
} |
|||
|
|||
/** |
|||
* 获取前端代码模板名称 |
|||
* |
|||
* @return List |
|||
*/ |
|||
private static List<String> getFrontTemplateNames() { |
|||
List<String> templateNames = new ArrayList<>(); |
|||
templateNames.add("index"); |
|||
templateNames.add("api"); |
|||
return templateNames; |
|||
} |
|||
|
|||
public static List<Map<String, Object>> preview(List<CodeColumnConfig> columns, CodeGenConfig genConfig) { |
|||
Map<String, Object> genMap = getGenMap(columns, genConfig); // 获取参数
|
|||
List<Map<String, Object>> genList = new ArrayList<>(); |
|||
// 获取后端模版
|
|||
List<String> templates = getAdminTemplateNames(); |
|||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); |
|||
for (String templateName : templates) { // 创建模板
|
|||
Map<String, Object> map = new HashMap<>(1); |
|||
Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); |
|||
map.put("content", template.render(genMap)); |
|||
map.put("name", templateName); |
|||
genList.add(map); |
|||
} |
|||
// 获取前端模版
|
|||
templates = getFrontTemplateNames(); |
|||
for (String templateName : templates) { |
|||
Map<String, Object> map = new HashMap<>(1); |
|||
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); |
|||
map.put(templateName, template.render(genMap)); |
|||
map.put("content", template.render(genMap)); |
|||
map.put("name", templateName); |
|||
genList.add(map); |
|||
} |
|||
return genList; |
|||
} |
|||
|
|||
/** |
|||
* 定义后端文件路径以及名称 |
|||
*/ |
|||
private static String getAdminFilePath(String templateName, CodeGenConfig genConfig, String className, String rootPath) { |
|||
String projectPath = rootPath + File.separator + genConfig.getModule_name() + File.separator; |
|||
String packagePath = projectPath + "src" + File.separator + "main" + File.separator + "java" + File.separator; |
|||
if (!ObjectUtils.isEmpty(genConfig.getPack())) { |
|||
packagePath += genConfig.getPack().replace(".", File.separator) + File.separator; |
|||
} |
|||
|
|||
if ("Entity".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "dao" + File.separator + className + ".java"; |
|||
} |
|||
|
|||
if ("Controller".equals(templateName)) { |
|||
return packagePath + "controller" + File.separator + className + "Controller.java"; |
|||
} |
|||
|
|||
if ("Service".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "I" + className + "Service.java"; |
|||
} |
|||
|
|||
if ("ServiceImpl".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; |
|||
} |
|||
|
|||
if ("Dto".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "dto" + File.separator + className + "Dto.java"; |
|||
} |
|||
|
|||
if ("QueryCriteria".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "dto" + File.separator + className + "Query.java"; |
|||
} |
|||
|
|||
if ("Mapper".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "dao" + File.separator + "mapper" + File.separator + className + "Mapper.java"; |
|||
} |
|||
|
|||
if ("MySQLMapper".equals(templateName)) { |
|||
return packagePath + "service" + File.separator + "dao" + File.separator + "mapper" + File.separator + className + "Mapper.xml"; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 定义前端文件路径以及名称 |
|||
*/ |
|||
private static String getFrontFilePath(String templateName, String apiPath, String path, String apiName) { |
|||
|
|||
if ("api".equals(templateName)) { |
|||
return path + File.separator + apiName + ".js"; |
|||
} |
|||
|
|||
if ("index".equals(templateName)) { |
|||
return path + File.separator + "index.vue"; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
// 获取模版数据
|
|||
private static Map<String, Object> getGenMap(List<CodeColumnConfig> columnInfos, CodeGenConfig genConfig) { |
|||
// 存储模版字段数据
|
|||
Map<String, Object> genMap = new HashMap<>(16); |
|||
// 接口别名
|
|||
genMap.put("apiAlias", genConfig.getApi_alias()); |
|||
// 包名称
|
|||
genMap.put("package", genConfig.getPack()); |
|||
// 模块名称
|
|||
genMap.put("moduleName", genConfig.getModule_name()); |
|||
// 作者
|
|||
genMap.put("author", genConfig.getAuthor()); |
|||
// 创建日期
|
|||
genMap.put("date", LocalDate.now().toString()); |
|||
// 表名
|
|||
genMap.put("tableName", genConfig.getTable_name()); |
|||
// 大写开头的类名
|
|||
String className = StringUtils.toCapitalizeCamelCase(genConfig.getTable_name()); |
|||
// 小写开头的类名
|
|||
String changeClassName = StringUtils.toCamelCase(genConfig.getTable_name()); |
|||
// 判断是否去除表前缀
|
|||
if (StrUtil.isNotEmpty(genConfig.getPrefix())) { |
|||
className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTable_name(), genConfig.getPrefix())); |
|||
changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTable_name(), genConfig.getPrefix())); |
|||
} |
|||
// 保存类名
|
|||
genMap.put("className", className); // 驼峰命名
|
|||
// 保存小写开头的类名
|
|||
genMap.put("changeClassName", changeClassName); |
|||
// 存在 Timestamp 字段
|
|||
genMap.put("hasTimestamp", false); |
|||
// 查询类中存在 Timestamp 字段
|
|||
genMap.put("queryHasTimestamp", false); |
|||
// 存在 BigDecimal 字段
|
|||
genMap.put("hasBigDecimal", false); |
|||
// 查询类中存在 BigDecimal 字段
|
|||
genMap.put("queryHasBigDecimal", false); |
|||
// 是否需要创建查询
|
|||
genMap.put("hasQuery", false); |
|||
// 是否有主键
|
|||
genMap.put("hasPk", false); |
|||
// 自增主键
|
|||
genMap.put("auto", false); |
|||
genMap.put("hasDate", false); |
|||
// 存在字典
|
|||
genMap.put("hasDict", false); |
|||
// 存在日期注解
|
|||
genMap.put("hasDateAnnotation", false); |
|||
// 保存字段信息
|
|||
List<Map<String, Object>> columns = new ArrayList<>(); |
|||
// 保存查询字段的信息
|
|||
List<Map<String, Object>> queryColumns = new ArrayList<>(); |
|||
// 存储字典信息
|
|||
List<String> dicts = new ArrayList<>(); |
|||
// 存储 between 信息
|
|||
List<Map<String, Object>> betweens = new ArrayList<>(); |
|||
// 存储不为空的字段信息
|
|||
List<Map<String, Object>> isNotNullColumns = new ArrayList<>(); |
|||
|
|||
for (CodeColumnConfig column : columnInfos) { // 遍历所有字段
|
|||
Map<String, Object> listMap = new HashMap<>(16); |
|||
// 字段描述
|
|||
listMap.put("remark", column.getRemark()); |
|||
// 字段类型
|
|||
listMap.put("columnKey", column.getKey_type()); |
|||
// 主键类型
|
|||
String colType = ColUtil.cloToJava(column.getColumn_type()); |
|||
// 小写开头的字段名 - 转驼峰
|
|||
// String changeColumnName = StringUtils.toCamelCase(column.getColumnName());
|
|||
String changeColumnName = column.getColumn_name(); |
|||
// 大写开头的字段名
|
|||
String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumn_name()); |
|||
if (PK.equals(column.getKey_type())) { // 如果是主键
|
|||
genMap.put("hasPk", true); |
|||
// 存储主键类型
|
|||
genMap.put("pkColumnType", colType); |
|||
// 存储小写开头的字段名
|
|||
genMap.put("pkChangeColName", changeColumnName); |
|||
// 存储大写开头的字段名
|
|||
genMap.put("pkCapitalColName", capitalColumnName); |
|||
} |
|||
// 是否存在 Timestamp 类型的字段
|
|||
if (TIMESTAMP.equals(colType)) { |
|||
genMap.put("hasTimestamp", true); |
|||
} |
|||
// 是否存在 BigDecimal 类型的字段
|
|||
if (BIGDECIMAL.equals(colType)) { |
|||
genMap.put("hasBigDecimal", true); |
|||
} |
|||
// 主键是否自增
|
|||
if (EXTRA.equals(column.getExtra())) { |
|||
genMap.put("auto", true); |
|||
} |
|||
// 主键存在字典
|
|||
if (StrUtil.isNotEmpty(column.getDict_name())) { |
|||
genMap.put("hasDict", true); |
|||
dicts.add(column.getDict_name()); |
|||
} |
|||
|
|||
// 存储字段类型
|
|||
listMap.put("columnType", colType); |
|||
// 存储字原始段名称
|
|||
listMap.put("columnName", column.getColumn_name()); |
|||
// 不为空
|
|||
listMap.put("istNotNull", column.getNot_null()); |
|||
// 字段列表显示
|
|||
listMap.put("columnShow", column.getList_show()); |
|||
// 表单显示
|
|||
listMap.put("formShow", column.getForm_show()); |
|||
// 表单组件类型
|
|||
listMap.put("formType", StrUtil.isNotEmpty(column.getForm_type()) ? column.getForm_type() : "Input"); |
|||
// 小写开头的字段名称
|
|||
listMap.put("changeColumnName", changeColumnName); |
|||
//大写开头的字段名称
|
|||
listMap.put("capitalColumnName", capitalColumnName); |
|||
// 字典名称
|
|||
listMap.put("dictName", column.getDict_name()); |
|||
// 日期注解
|
|||
listMap.put("dateAnnotation", column.getDate_annotation()); |
|||
if (StrUtil.isNotEmpty(column.getDate_annotation())) { |
|||
genMap.put("hasDateAnnotation", true); |
|||
} |
|||
// 添加非空字段信息
|
|||
if (column.getNot_null()) { |
|||
isNotNullColumns.add(listMap); |
|||
} |
|||
// 判断是否有查询,如有则把查询的字段set进columnQuery
|
|||
if (!StrUtil.isEmpty(column.getQuery_type())) { |
|||
// 查询类型
|
|||
listMap.put("queryType", column.getQuery_type()); |
|||
// 是否存在查询
|
|||
genMap.put("hasQuery", true); |
|||
if (TIMESTAMP.equals(colType)) { |
|||
// 查询中存储 Timestamp 类型
|
|||
genMap.put("queryHasTimestamp", true); |
|||
} |
|||
if (BIGDECIMAL.equals(colType)) { |
|||
// 查询中存储 BigDecimal 类型
|
|||
genMap.put("queryHasBigDecimal", true); |
|||
} |
|||
if ("between".equalsIgnoreCase(column.getQuery_type())) { |
|||
betweens.add(listMap); |
|||
} else { |
|||
// 添加到查询列表中
|
|||
queryColumns.add(listMap); |
|||
} |
|||
} |
|||
// 添加到字段列表中
|
|||
columns.add(listMap); |
|||
} |
|||
// 保存字段列表
|
|||
genMap.put("columns", columns); |
|||
// 保存查询列表
|
|||
genMap.put("queryColumns", queryColumns); |
|||
// 保存字段列表
|
|||
genMap.put("dicts", dicts); |
|||
// 保存查询列表
|
|||
genMap.put("betweens", betweens); |
|||
// 保存非空字段信息
|
|||
genMap.put("isNotNullColumns", isNotNullColumns); |
|||
return genMap; |
|||
} |
|||
|
|||
/** |
|||
* 打包下载 |
|||
* @param columns |
|||
* @param genConfig |
|||
* @return |
|||
* @throws IOException |
|||
*/ |
|||
public static String download(List<CodeColumnConfig> columns, CodeGenConfig genConfig) throws IOException { |
|||
// 拼接的路径:/tmpnladmin-gen-temp/,这个路径在Linux下需要root用户才有权限创建,非root用户会权限错误而失败,更改为: /tmp/nladmin-gen-temp/
|
|||
// String tempPath =SYS_TEM_DIR + "nladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator;
|
|||
String tempPath = SYS_TEM_DIR + "nladmin-gen-temp" + File.separator + genConfig.getTable_name() + File.separator; |
|||
Map<String, Object> genMap = getGenMap(columns, genConfig); |
|||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); |
|||
// 生成后端代码
|
|||
List<String> templates = getAdminTemplateNames(); |
|||
for (String templateName : templates) { |
|||
Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); |
|||
String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), tempPath + "eladmin" + File.separator); |
|||
assert filePath != null; |
|||
File file = new File(filePath); |
|||
// 如果非覆盖生成
|
|||
if (!genConfig.getCover() && FileUtil.exist(file)) { |
|||
continue; |
|||
} |
|||
// 生成代码
|
|||
genFile(file, template, genMap); |
|||
} |
|||
// 生成前端代码
|
|||
templates = getFrontTemplateNames(); |
|||
for (String templateName : templates) { |
|||
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); |
|||
String path = tempPath + "nladmin-web" + File.separator; |
|||
String apiPath = path + "src" + File.separator + "api" + File.separator; |
|||
String srcPath = path + "src" + File.separator + "views" + File.separator + genMap.get("changeClassName").toString() + File.separator; |
|||
String filePath = getFrontFilePath(templateName, apiPath, srcPath, genMap.get("changeClassName").toString()); |
|||
assert filePath != null; |
|||
File file = new File(filePath); |
|||
// 如果非覆盖生成
|
|||
if (!genConfig.getCover() && FileUtil.exist(file)) { |
|||
continue; |
|||
} |
|||
// 生成代码
|
|||
genFile(file, template, genMap); |
|||
} |
|||
return tempPath; |
|||
} |
|||
|
|||
/** |
|||
* 生成文件 |
|||
* @param file |
|||
* @param template |
|||
* @param map |
|||
* @throws IOException |
|||
*/ |
|||
private static void genFile(File file, Template template, Map<String, Object> map) throws IOException { |
|||
// 生成目标文件
|
|||
Writer writer = null; |
|||
try { |
|||
FileUtil.touch(file); |
|||
writer = new FileWriter(file); |
|||
template.render(map, writer); |
|||
} catch (TemplateException | IOException e) { |
|||
throw new RuntimeException(e); |
|||
} finally { |
|||
assert writer != null; |
|||
writer.close(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 生成代码 |
|||
* @param columnInfos |
|||
* @param genConfig |
|||
* @throws IOException |
|||
*/ |
|||
public static void generatorCode(List<CodeColumnConfig> columnInfos, CodeGenConfig genConfig) throws IOException { |
|||
Map<String, Object> genMap = getGenMap(columnInfos, genConfig); |
|||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); |
|||
// 生成后端代码
|
|||
List<String> templates = getAdminTemplateNames(); |
|||
for (String templateName : templates) { |
|||
Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); |
|||
String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), System.getProperty("user.dir")); |
|||
|
|||
assert filePath != null; |
|||
File file = new File(filePath); |
|||
|
|||
// 如果非覆盖生成
|
|||
if (!genConfig.getCover() && FileUtil.exist(file)) { |
|||
continue; |
|||
} |
|||
// 生成代码
|
|||
genFile(file, template, genMap); |
|||
} |
|||
|
|||
// 生成前端代码
|
|||
templates = getFrontTemplateNames(); |
|||
for (String templateName : templates) { |
|||
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); |
|||
String filePath = getFrontFilePath(templateName, genConfig.getApi_path(), genConfig.getPath(), genMap.get("changeClassName").toString()); |
|||
|
|||
assert filePath != null; |
|||
File file = new File(filePath); |
|||
|
|||
// 如果非覆盖生成
|
|||
if (!genConfig.getCover() && FileUtil.exist(file)) { |
|||
continue; |
|||
} |
|||
// 生成代码
|
|||
genFile(file, template, genMap); |
|||
} |
|||
} |
|||
} |
@ -1,19 +0,0 @@ |
|||
package org.nl.config; |
|||
|
|||
/** |
|||
* <p> |
|||
* ID生成工具类 |
|||
* </p> |
|||
* |
|||
* @author generator |
|||
* @since 2023-11-16 |
|||
*/ |
|||
public class IdUtil { |
|||
public static Long getLongId() { |
|||
return cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId(); |
|||
} |
|||
|
|||
public static String getStringId() { |
|||
return String.valueOf(IdUtil.getLongId()); |
|||
} |
|||
} |
@ -1,25 +0,0 @@ |
|||
package org.nl.config; |
|||
|
|||
|
|||
import org.checkerframework.checker.units.qual.K; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.HashMap; |
|||
import java.util.Iterator; |
|||
|
|||
/** |
|||
* s |
|||
* @author ZZQ |
|||
* @Date 2022/11/29 2:55 下午 |
|||
*/ |
|||
public class MapOf implements Serializable { |
|||
|
|||
public static <K> HashMap of(K... key){ |
|||
HashMap map = new HashMap<>(); |
|||
for (int i = 0; i < (key.length & ~1); i=i+2) { |
|||
map.put(key[i],key[i+1]); |
|||
} |
|||
return map; |
|||
} |
|||
} |
@ -1,9 +1,9 @@ |
|||
package org.nl.wms.gateway.controller; |
|||
package org.nl.gateway.controller; |
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.gateway.service.GateWayService; |
|||
import org.nl.wms.gateway.dto.InteracteDto; |
|||
import org.nl.gateway.service.GateWayService; |
|||
import org.nl.gateway.dto.InteracteDto; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.gateway.dto; |
|||
package org.nl.gateway.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
@ -1,13 +1,12 @@ |
|||
package org.nl.wms.gateway.service; |
|||
package org.nl.gateway.service; |
|||
|
|||
import cn.hutool.core.lang.Assert; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.RedissonUtils; |
|||
import org.nl.wms.ext.service.AcsToWmsService; |
|||
import org.nl.wms.gateway.dto.InteracteDto; |
|||
import org.nl.wms.gateway.service.impl.GateWayServiceImpl; |
|||
import org.nl.gateway.dto.InteracteDto; |
|||
import org.nl.gateway.service.impl.GateWayServiceImpl; |
|||
import org.nl.wms.sch_manage.service.ISchBasePointService; |
|||
import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch_manage.service.dao.SchBasePoint; |
@ -1,44 +0,0 @@ |
|||
package org.nl.system.controller.generator; |
|||
|
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
|
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import org.nl.system.service.generator.ICodeGenConfigService; |
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
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.*; |
|||
|
|||
/** |
|||
* <p> |
|||
* 代码生成配置表 前端控制器 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
@SaIgnore |
|||
@RestController |
|||
@RequestMapping("api/genConfig") |
|||
public class CodeGenConfigController { |
|||
|
|||
@Autowired |
|||
private ICodeGenConfigService genConfigService; |
|||
|
|||
|
|||
@GetMapping(value = "/{tableName}") |
|||
public ResponseEntity<Object> query(@PathVariable String tableName){ |
|||
return new ResponseEntity<>(genConfigService.findByTableName(tableName), HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@PutMapping |
|||
public ResponseEntity<Object> update(@Validated @RequestBody CodeGenConfig genConfig){ |
|||
return new ResponseEntity<>(genConfigService.update(genConfig.getTable_name(), genConfig),HttpStatus.OK); |
|||
} |
|||
} |
|||
|
@ -1,91 +0,0 @@ |
|||
package org.nl.system.controller.generator; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
|
|||
|
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.config.language.LangProcess; |
|||
import org.nl.system.service.generator.ICodeGenConfigService; |
|||
import org.nl.system.service.generator.ICodeGeneratorService; |
|||
import org.nl.system.service.generator.dao.CodeColumnConfig; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* 列的数据信息表 前端控制器 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
@SaIgnore |
|||
@RestController |
|||
@RequestMapping("/api/generator") |
|||
public class CodeGeneratorController { |
|||
@Autowired |
|||
private ICodeGeneratorService generatorService; |
|||
@Autowired |
|||
private ICodeGenConfigService genConfigService; |
|||
|
|||
@Value("${generator.enabled}") |
|||
private Boolean generatorEnabled; |
|||
|
|||
|
|||
@GetMapping(value = "/tables") |
|||
public ResponseEntity<Object> queryTables(@RequestParam(defaultValue = "") String name, PageQuery pageable){ |
|||
return new ResponseEntity<>(TableDataInfo.build(generatorService.getTables(name, pageable)), HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@GetMapping(value = "/columns") |
|||
public ResponseEntity<Object> queryColumns(@RequestParam String tableName){ |
|||
return new ResponseEntity<>(TableDataInfo.build(generatorService.getColumns(tableName)), HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@PutMapping |
|||
public ResponseEntity<HttpStatus> save(@RequestBody List<CodeColumnConfig> columnInfos){ |
|||
generatorService.updateBatchById(columnInfos); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@PostMapping(value = "sync") |
|||
public ResponseEntity<HttpStatus> sync(@RequestBody List<String> tables){ |
|||
for (String table : tables) { |
|||
generatorService.sync(generatorService.getColumns(table), generatorService.query(table)); |
|||
} |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@PostMapping(value = "/{tableName}/{type}") |
|||
public ResponseEntity<Object> generator(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){ |
|||
if(!generatorEnabled && type == 0){ |
|||
throw new BadRequestException(LangProcess.msg("error_CodeGenerator")); |
|||
} |
|||
switch (type){ |
|||
// 生成代码
|
|||
case 0: generatorService.generator(genConfigService.findByTableName(tableName), generatorService.getColumns(tableName)); |
|||
break; |
|||
// 预览
|
|||
case 1: return generatorService.preview(genConfigService.findByTableName(tableName), generatorService.getColumns(tableName)); |
|||
// 打包
|
|||
case 2: generatorService.download(genConfigService.findByTableName(tableName), generatorService.getColumns(tableName), request, response); |
|||
break; |
|||
default: throw new BadRequestException(LangProcess.msg("error_NullPoint")); |
|||
} |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
|||
|
@ -1,30 +0,0 @@ |
|||
package org.nl.system.service.generator; |
|||
|
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* <p> |
|||
* 代码生成配置表 服务类 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
public interface ICodeGenConfigService extends IService<CodeGenConfig> { |
|||
|
|||
/** |
|||
* 根据表名查找 |
|||
* @param tableName |
|||
* @return |
|||
*/ |
|||
CodeGenConfig findByTableName(String tableName); |
|||
|
|||
/** |
|||
* 根据表名更新 |
|||
* @param tableName |
|||
* @param genConfig |
|||
* @return |
|||
*/ |
|||
CodeGenConfig update(String tableName, CodeGenConfig genConfig); |
|||
} |
@ -1,80 +0,0 @@ |
|||
package org.nl.system.service.generator; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.system.service.generator.dao.CodeColumnConfig; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
import org.nl.system.service.generator.dto.TablesInfo; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* 列的数据信息表 服务类 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
public interface ICodeGeneratorService extends IService<CodeColumnConfig> { |
|||
|
|||
/** |
|||
* 获得所有的表格信息 |
|||
* @param name |
|||
* @param pageQuery |
|||
* @return IPage<TablesInfo> |
|||
*/ |
|||
IPage<TablesInfo> getTables(String name, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 得到数据表的元数据 |
|||
* @param tableName 表名 |
|||
* @return / |
|||
*/ |
|||
IPage<CodeColumnConfig> getColumns(String tableName); |
|||
|
|||
/** |
|||
* 根据表名查询表字段 |
|||
* @param tableName |
|||
* @return |
|||
*/ |
|||
List<CodeColumnConfig> query(String tableName); |
|||
|
|||
/** |
|||
* 同步表数据 |
|||
* @param columnInfos / |
|||
* @param columnInfoList / |
|||
*/ |
|||
@Async |
|||
void sync(IPage<CodeColumnConfig> columnInfos, List<CodeColumnConfig> columnInfoList); |
|||
|
|||
/** |
|||
* 视图 |
|||
* @param byTableName |
|||
* @param columns |
|||
* @return ResponseEntity<Object> |
|||
*/ |
|||
ResponseEntity<Object> preview(CodeGenConfig byTableName, IPage<CodeColumnConfig> columns); |
|||
|
|||
/** |
|||
* 打包下载 |
|||
* @param genConfig 配置信息 |
|||
* @param columnsPage 字段信息分页数据 |
|||
* @param request / |
|||
* @param response / |
|||
*/ |
|||
void download(CodeGenConfig genConfig, IPage<CodeColumnConfig> columnsPage, HttpServletRequest request, HttpServletResponse response); |
|||
|
|||
/** |
|||
* 代码生成 |
|||
* @param genConfig 配置信息 |
|||
* @param columnsPage 字段信息分页数据 |
|||
*/ |
|||
void generator(CodeGenConfig genConfig, IPage<CodeColumnConfig> columnsPage); |
|||
} |
@ -1,100 +0,0 @@ |
|||
package org.nl.system.service.generator.dao; |
|||
|
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import org.nl.common.utils.GenUtil; |
|||
import org.nl.system.service.generator.dto.ColumnInfo; |
|||
|
|||
/** |
|||
* <p> |
|||
* 列的数据信息表 |
|||
* </p> |
|||
* |
|||
* @author generator |
|||
* @since 2023-05-03 |
|||
*/ |
|||
@Data |
|||
@TableName("code_column_config") |
|||
public class CodeColumnConfig implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 标识 |
|||
*/ |
|||
@TableId(value = "column_id", type = IdType.ASSIGN_ID) |
|||
private String column_id; |
|||
|
|||
|
|||
private String table_name; |
|||
|
|||
|
|||
private String column_name; |
|||
|
|||
|
|||
private String column_type; |
|||
|
|||
|
|||
private String key_type; |
|||
|
|||
|
|||
private String extra; |
|||
|
|||
|
|||
private String remark; |
|||
|
|||
|
|||
private Boolean not_null; |
|||
|
|||
|
|||
private Boolean list_show; |
|||
|
|||
|
|||
private Boolean form_show; |
|||
|
|||
|
|||
private String form_type; |
|||
|
|||
|
|||
private String query_type; |
|||
|
|||
|
|||
private String dict_name; |
|||
|
|||
|
|||
private String date_annotation; |
|||
|
|||
/** |
|||
* 创建默认的实体 |
|||
* @param tableName / |
|||
* @param config / |
|||
* @return CodeColumnConfig |
|||
*/ |
|||
public static CodeColumnConfig createDefault(String tableName, ColumnInfo config) { |
|||
CodeColumnConfig columnConfig = new CodeColumnConfig(); |
|||
columnConfig.setColumn_id(IdUtil.getSnowflake(1,1).nextIdStr()); |
|||
columnConfig.setTable_name(tableName); |
|||
columnConfig.setColumn_name(config.getColumn_name()); |
|||
columnConfig.setColumn_type(config.getColumn_type()); |
|||
columnConfig.setKey_type(config.getKey_type()); |
|||
columnConfig.setExtra(config.getExtra()); |
|||
columnConfig.setNot_null((ObjectUtil.isNotEmpty(config.getKey_type()) |
|||
&&ObjectUtil.isNotEmpty(config.getExtra()) |
|||
&& GenUtil.PK.equalsIgnoreCase(config.getKey_type()) |
|||
&&GenUtil.EXTRA.equalsIgnoreCase(config.getExtra())) |
|||
?false:ObjectUtil.isNotEmpty(config.getNot_null())?config.getNot_null():false); |
|||
columnConfig.setRemark(ObjectUtil.isNotEmpty(config.getRemark())?config.getRemark():null); |
|||
columnConfig.setList_show(true); |
|||
columnConfig.setForm_show(true); |
|||
return columnConfig; |
|||
} |
|||
} |
@ -1,82 +0,0 @@ |
|||
package org.nl.system.service.generator.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import java.io.Serializable; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* <p> |
|||
* 代码生成配置表 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("code_gen_config") |
|||
public class CodeGenConfig implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public CodeGenConfig(String table_name) { |
|||
this.table_name = table_name; |
|||
} |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
@TableId(value = "config_id") |
|||
private String config_id; |
|||
|
|||
/** |
|||
* 表名 |
|||
*/ |
|||
private String table_name; |
|||
|
|||
/** |
|||
* 作者 |
|||
*/ |
|||
private String author; |
|||
|
|||
/** |
|||
* 是否覆盖 |
|||
*/ |
|||
private Boolean cover; |
|||
|
|||
/** |
|||
* 模块名称 |
|||
*/ |
|||
private String module_name; |
|||
|
|||
/** |
|||
* 包名 |
|||
*/ |
|||
private String pack; |
|||
|
|||
/** |
|||
* 路径 |
|||
*/ |
|||
private String path; |
|||
|
|||
/** |
|||
* api路径 |
|||
*/ |
|||
private String api_path; |
|||
|
|||
/** |
|||
* 表前缀 |
|||
*/ |
|||
private String prefix; |
|||
|
|||
/** |
|||
* 接口名称 |
|||
*/ |
|||
private String api_alias; |
|||
|
|||
|
|||
} |
@ -1,42 +0,0 @@ |
|||
package org.nl.system.service.generator.dao.mapper; |
|||
|
|||
import org.nl.system.service.generator.dao.CodeColumnConfig; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.system.service.generator.dto.ColumnInfo; |
|||
import org.nl.system.service.generator.dto.TablesInfo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* 列的数据信息表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
public interface CodeColumnConfigMapper extends BaseMapper<CodeColumnConfig> { |
|||
|
|||
/** |
|||
* 分页查找 |
|||
* @param name / |
|||
* @param pageSize / |
|||
* @param offset / |
|||
* @return List<TablesInfo> |
|||
*/ |
|||
List<TablesInfo> getTables(String name, int pageSize, int offset); |
|||
|
|||
/** |
|||
* 分页查询的总数 |
|||
* @param name |
|||
* @return long |
|||
*/ |
|||
long getTablesTotal(String name); |
|||
|
|||
/** |
|||
* 获取字段名称 |
|||
* @param tableName |
|||
* @return List<ColumnInfo> |
|||
*/ |
|||
List<ColumnInfo> getTablesByTableName(String tableName); |
|||
} |
@ -1,46 +0,0 @@ |
|||
<?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.system.service.generator.dao.mapper.CodeColumnConfigMapper"> |
|||
|
|||
<select id="getTables" resultType="org.nl.system.service.generator.dto.TablesInfo"> |
|||
SELECT |
|||
table_name, |
|||
create_time, |
|||
engine, |
|||
table_collation AS coding, |
|||
table_comment AS remark |
|||
FROM |
|||
information_schema.tables |
|||
WHERE |
|||
table_schema = (SELECT database()) |
|||
<if test="name != null and name != ''"> |
|||
AND table_name LIKE #{name} |
|||
</if> |
|||
ORDER BY create_time DESC |
|||
LIMIT #{pageSize} OFFSET #{offset} |
|||
</select> |
|||
<select id="getTablesTotal" resultType="java.lang.Long"> |
|||
SELECT count(*) |
|||
FROM information_schema.tables |
|||
WHERE table_schema = (select database()) |
|||
<if test="name != null and name != ''"> |
|||
AND table_name LIKE #{name} |
|||
</if> |
|||
</select> |
|||
<select id="getTablesByTableName" resultType="org.nl.system.service.generator.dto.ColumnInfo"> |
|||
SELECT |
|||
column_name, |
|||
is_nullable as is_null, |
|||
data_type as column_type, |
|||
column_comment as remark, |
|||
column_key as key_type, |
|||
extra |
|||
FROM information_schema.columns |
|||
WHERE |
|||
table_schema = (SELECT database()) |
|||
<if test="tableName != null and tableName != ''"> |
|||
AND table_name = #{tableName} |
|||
</if> |
|||
ORDER BY ordinal_position |
|||
</select> |
|||
</mapper> |
@ -1,16 +0,0 @@ |
|||
package org.nl.system.service.generator.dao.mapper; |
|||
|
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* <p> |
|||
* 代码生成配置表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author generator |
|||
* @since 2023-05-03 |
|||
*/ |
|||
public interface CodeGenConfigMapper extends BaseMapper<CodeGenConfig> { |
|||
|
|||
} |
@ -1,48 +0,0 @@ |
|||
package org.nl.system.service.generator.dto; |
|||
|
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: 字段信息 |
|||
* @Date: 2023/5/3 |
|||
*/ |
|||
@Data |
|||
public class ColumnInfo { |
|||
|
|||
private String column_name; |
|||
|
|||
|
|||
private String column_type; |
|||
|
|||
|
|||
private String key_type; |
|||
|
|||
|
|||
private String extra; |
|||
|
|||
|
|||
private String remark; |
|||
|
|||
|
|||
private Boolean not_null; |
|||
|
|||
|
|||
private Boolean list_show; |
|||
|
|||
|
|||
private Boolean form_show; |
|||
|
|||
|
|||
private String form_type; |
|||
|
|||
|
|||
private String query_type; |
|||
|
|||
|
|||
private String dict_name; |
|||
|
|||
|
|||
private String date_annotation; |
|||
} |
@ -1,40 +0,0 @@ |
|||
package org.nl.system.service.generator.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: 表的数据信息 |
|||
* @Date: 2023/5/3 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class TablesInfo { |
|||
/** |
|||
* 表名 |
|||
*/ |
|||
private String table_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 引擎 |
|||
*/ |
|||
private String ENGINE; |
|||
|
|||
/** |
|||
* 字符序 |
|||
*/ |
|||
private String coding; |
|||
|
|||
/** |
|||
* 注释 |
|||
*/ |
|||
private String remark; |
|||
} |
@ -1,71 +0,0 @@ |
|||
package org.nl.system.service.generator.impl; |
|||
|
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.system.service.generator.ICodeGenConfigService; |
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
import org.nl.system.service.generator.dao.mapper.CodeGenConfigMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.io.File; |
|||
|
|||
/** |
|||
* <p> |
|||
* 代码生成配置表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
@Service |
|||
public class CodeGenConfigServiceImpl extends ServiceImpl<CodeGenConfigMapper, CodeGenConfig> implements ICodeGenConfigService { |
|||
|
|||
@Autowired |
|||
private CodeGenConfigMapper codeGenConfigMapper; |
|||
|
|||
@Override |
|||
public CodeGenConfig findByTableName(String tableName) { |
|||
CodeGenConfig codeGenConfig = codeGenConfigMapper.selectOne(new LambdaQueryWrapper<CodeGenConfig>() |
|||
.eq(CodeGenConfig::getTable_name, tableName)); |
|||
if (ObjectUtil.isEmpty(codeGenConfig)) { |
|||
return new CodeGenConfig(tableName); |
|||
} |
|||
return codeGenConfig; |
|||
} |
|||
|
|||
@Override |
|||
public CodeGenConfig update(String tableName, CodeGenConfig genConfig) { |
|||
// 如果 api 路径为空,则自动生成路径
|
|||
if(StrUtil.isEmpty(genConfig.getApi_path())){ |
|||
String separator = File.separator; |
|||
String[] paths; |
|||
String symbol = "\\"; |
|||
if (symbol.equals(separator)) { |
|||
paths = genConfig.getPath().split("\\\\"); |
|||
} else { |
|||
paths = genConfig.getPath().split(File.separator); |
|||
} |
|||
StringBuilder api = new StringBuilder(); |
|||
for (String path : paths) { |
|||
api.append(path); |
|||
api.append(separator); |
|||
if ("src".equals(path)) { |
|||
api.append("api"); |
|||
break; |
|||
} |
|||
} |
|||
genConfig.setApi_path(api.toString()); |
|||
} |
|||
if (ObjectUtil.isNotEmpty(genConfig.getConfig_id())) { |
|||
codeGenConfigMapper.updateById(genConfig); |
|||
} else { |
|||
genConfig.setConfig_id(IdUtil.getSnowflake(1,1).nextIdStr()); |
|||
codeGenConfigMapper.insert(genConfig); |
|||
} |
|||
return genConfig; |
|||
} |
|||
} |
@ -1,164 +0,0 @@ |
|||
package org.nl.system.service.generator.impl; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.core.util.ZipUtil; |
|||
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 org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.FileUtil; |
|||
import org.nl.common.utils.GenUtil; |
|||
import org.nl.config.language.LangProcess; |
|||
import org.nl.system.service.generator.ICodeGeneratorService; |
|||
import org.nl.system.service.generator.dao.CodeColumnConfig; |
|||
import org.nl.system.service.generator.dao.CodeGenConfig; |
|||
import org.nl.system.service.generator.dao.mapper.CodeColumnConfigMapper; |
|||
import org.nl.system.service.generator.dto.ColumnInfo; |
|||
import org.nl.system.service.generator.dto.TablesInfo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 列的数据信息表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author lyd |
|||
* @since 2023-05-03 |
|||
*/ |
|||
@Service |
|||
public class CodeGeneratorServiceImpl extends ServiceImpl<CodeColumnConfigMapper, CodeColumnConfig> implements ICodeGeneratorService { |
|||
|
|||
@Autowired |
|||
private CodeColumnConfigMapper columnConfigMapper; |
|||
|
|||
@Override |
|||
public IPage<TablesInfo> getTables(String name, PageQuery pageQuery) { |
|||
IPage<TablesInfo> pages = new Page<>(); |
|||
int page = pageQuery.getPage(); |
|||
int pageSize = pageQuery.getSize(); |
|||
int offset = page * pageSize; |
|||
List<TablesInfo> tableInfos = columnConfigMapper.getTables(name, pageSize, offset); |
|||
long num = columnConfigMapper.getTablesTotal(name); |
|||
pages.setRecords(tableInfos); |
|||
pages.setCurrent(page + 1); |
|||
pages.setSize(pageSize); |
|||
pages.setTotal(num); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public IPage<CodeColumnConfig> getColumns(String tableName) { |
|||
IPage<CodeColumnConfig> pages = new Page<>(); |
|||
// 查找行列数据表
|
|||
List<CodeColumnConfig> codeColumnConfigs = columnConfigMapper |
|||
.selectList(new LambdaQueryWrapper<CodeColumnConfig>() |
|||
.eq(CodeColumnConfig::getTable_name, tableName)); |
|||
if (ObjectUtil.isEmpty(codeColumnConfigs)) { |
|||
// 为空查找全新的数据
|
|||
codeColumnConfigs = query(tableName); |
|||
// 保存
|
|||
this.saveBatch(codeColumnConfigs); |
|||
} |
|||
pages.setRecords(codeColumnConfigs); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public List<CodeColumnConfig> query(String tableName) { |
|||
List<ColumnInfo> columnConfigList = columnConfigMapper.getTablesByTableName(tableName); |
|||
// 设置默认值
|
|||
List<CodeColumnConfig> columnInfos = columnConfigList.stream() |
|||
.map(config -> CodeColumnConfig.createDefault(tableName, config)) |
|||
.collect(Collectors.toList()); |
|||
return columnInfos; |
|||
} |
|||
|
|||
@Override |
|||
public void sync(IPage<CodeColumnConfig> columnInfos, List<CodeColumnConfig> columnInfoList) { |
|||
List<CodeColumnConfig> records = columnInfos.getRecords(); |
|||
// 第一种情况,数据库类字段改变或者新增字段
|
|||
for (CodeColumnConfig columnInfo : columnInfoList) { |
|||
// 根据字段名称查找
|
|||
List<CodeColumnConfig> columns = records.stream().filter(c -> c.getColumn_name().equals(columnInfo.getColumn_name())).collect(Collectors.toList()); |
|||
// 如果能找到,就修改部分可能被字段
|
|||
if (CollectionUtil.isNotEmpty(columns)) { |
|||
CodeColumnConfig column = columns.get(0); |
|||
column.setColumn_type(columnInfo.getColumn_type()); |
|||
column.setExtra(columnInfo.getExtra()); |
|||
column.setKey_type(columnInfo.getKey_type()); |
|||
if (StrUtil.isEmpty(column.getRemark())) { |
|||
column.setRemark(columnInfo.getRemark()); |
|||
} |
|||
columnConfigMapper.updateById(column); |
|||
} else { |
|||
// 如果找不到,则保存新字段信息
|
|||
columnConfigMapper.insert(columnInfo); |
|||
} |
|||
} |
|||
// 第二种情况,数据库字段删除了
|
|||
for (CodeColumnConfig columnInfo : records) { |
|||
// 根据字段名称查找
|
|||
List<CodeColumnConfig> columns = columnInfoList.stream().filter(c -> c.getColumn_name().equals(columnInfo.getColumn_name())).collect(Collectors.toList()); |
|||
// 如果找不到,就代表字段被删除了,则需要删除该字段
|
|||
if (CollectionUtil.isEmpty(columns)) { |
|||
columnConfigMapper.deleteById(columnInfo.getColumn_id()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public ResponseEntity<Object> preview(CodeGenConfig genConfig, IPage<CodeColumnConfig> columns) { |
|||
List<CodeColumnConfig> columnsRecords = columns.getRecords(); |
|||
if (genConfig.getConfig_id() == null) { |
|||
throw new BadRequestException(LangProcess.msg("genrator_cfg")); |
|||
} |
|||
List<Map<String, Object>> genList = GenUtil.preview(columnsRecords, genConfig); |
|||
return new ResponseEntity<>(genList, HttpStatus.OK); |
|||
} |
|||
|
|||
@Override |
|||
public void download(CodeGenConfig genConfig, IPage<CodeColumnConfig> columnsPage, HttpServletRequest request, HttpServletResponse response) { |
|||
List<CodeColumnConfig> columns = columnsPage.getRecords(); |
|||
if (genConfig.getConfig_id() == null) { |
|||
throw new BadRequestException(LangProcess.msg("genrator_cfg")); |
|||
} |
|||
try { |
|||
File file = new File(GenUtil.download(columns, genConfig)); |
|||
String zipPath = file.getPath() + ".zip"; |
|||
ZipUtil.zip(file.getPath(), zipPath); |
|||
FileUtil.downloadFile(request, response, new File(zipPath), true); |
|||
} catch (IOException e) { |
|||
throw new BadRequestException(LangProcess.msg("error_SystemError")); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void generator(CodeGenConfig genConfig, IPage<CodeColumnConfig> columnsPage) { |
|||
List<CodeColumnConfig> columns = columnsPage.getRecords(); |
|||
if (genConfig.getConfig_id() == null) { |
|||
throw new BadRequestException(LangProcess.msg("genrator_cfg")); |
|||
} |
|||
try { |
|||
GenUtil.generatorCode(columns, genConfig); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage(), e); |
|||
throw new BadRequestException(LangProcess.msg("error_SystemError")); |
|||
} |
|||
} |
|||
} |
@ -1,64 +0,0 @@ |
|||
package org.nl.wms.basedata_manage.controller; |
|||
|
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
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.basedata_manage.service.IEmBiDeviceinfoService; |
|||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo; |
|||
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; |
|||
|
|||
/** |
|||
* <p> |
|||
* 设备基础信息表 控制层 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-14 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/deviceinfo") |
|||
@Slf4j |
|||
public class DeviceInfoController { |
|||
|
|||
@Autowired |
|||
private IEmBiDeviceinfoService iEmBiDeviceinfoService; |
|||
|
|||
@GetMapping |
|||
@Log("查询设备") |
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(iEmBiDeviceinfoService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增设备") |
|||
public ResponseEntity<Object> create(@Validated @RequestBody EmBiDeviceinfo dto) { |
|||
iEmBiDeviceinfoService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改设备") |
|||
public ResponseEntity<Object> update(@Validated @RequestBody EmBiDeviceinfo dto) { |
|||
iEmBiDeviceinfoService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
@Log("删除设备") |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
iEmBiDeviceinfoService.delete(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -1,47 +0,0 @@ |
|||
package org.nl.wms.basedata_manage.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 生产设备基础信息表 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-14 |
|||
*/ |
|||
public interface IEmBiDeviceinfoService extends IService<EmBiDeviceinfo> { |
|||
|
|||
/** |
|||
* 分页查询 |
|||
* @param whereJson : {查询参数} |
|||
* @param pageable : 分页对象 |
|||
* @return 返回结果 |
|||
*/ |
|||
IPage<EmBiDeviceinfo> queryAll(Map whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 新增设备 |
|||
* @param dto 实体类 |
|||
*/ |
|||
void create(EmBiDeviceinfo dto); |
|||
|
|||
/** |
|||
* 修改设备 |
|||
* @param dto 实体类 |
|||
*/ |
|||
void update(EmBiDeviceinfo dto); |
|||
|
|||
/** |
|||
* 删除设备 |
|||
* @param ids 设备标识集合 |
|||
*/ |
|||
void delete(Set<String> ids); |
|||
|
|||
} |
@ -1,126 +0,0 @@ |
|||
package org.nl.wms.basedata_manage.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* <p> |
|||
* 生产设备基础信息表 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-14 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("em_bi_deviceinfo") |
|||
public class EmBiDeviceinfo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 设备标识 |
|||
*/ |
|||
@TableId(value = "device_id") |
|||
private String device_id; |
|||
|
|||
/** |
|||
* 设备编码 |
|||
*/ |
|||
private String device_code; |
|||
|
|||
/** |
|||
* 设备名称 |
|||
*/ |
|||
private String device_name; |
|||
|
|||
/** |
|||
* 设备型号 |
|||
*/ |
|||
private String device_model; |
|||
|
|||
/** |
|||
* 设备规格 |
|||
*/ |
|||
private String device_specification; |
|||
|
|||
/** |
|||
* 供应商 |
|||
*/ |
|||
private String manufacturer; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 是否启用 |
|||
*/ |
|||
private String is_used; |
|||
|
|||
/** |
|||
* 外部编码 |
|||
*/ |
|||
private String extend_code; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_id; |
|||
|
|||
/** |
|||
* 创建人姓名 |
|||
*/ |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_optid; |
|||
|
|||
/** |
|||
* 修改人名称 |
|||
*/ |
|||
private String update_optname; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
|
|||
/** |
|||
* 工厂 |
|||
*/ |
|||
private String factory; |
|||
|
|||
/** |
|||
* 生产规划 |
|||
*/ |
|||
private String manufactureplanning; |
|||
|
|||
/** |
|||
* 生产区域 |
|||
*/ |
|||
private String manufacturearea; |
|||
|
|||
/** |
|||
* 外部设备编码 |
|||
*/ |
|||
private String extend_code_mes; |
|||
|
|||
} |
@ -1,16 +0,0 @@ |
|||
package org.nl.wms.basedata_manage.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo; |
|||
|
|||
/** |
|||
* <p> |
|||
* 生产设备基础信息表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author author |
|||
* @since 2025-05-14 |
|||
*/ |
|||
public interface EmBiDeviceinfoMapper extends BaseMapper<EmBiDeviceinfo> { |
|||
|
|||
} |
@ -1,5 +0,0 @@ |
|||
<?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.basedata_manage.service.dao.mapper.EmBiDeviceinfoMapper"> |
|||
|
|||
</mapper> |
@ -1,96 +0,0 @@ |
|||
package org.nl.wms.basedata_manage.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.map.MapUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.IdUtil; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.wms.basedata_manage.enums.BaseDataEnum; |
|||
import org.nl.wms.basedata_manage.service.IEmBiDeviceinfoService; |
|||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo; |
|||
import org.nl.wms.basedata_manage.service.dao.mapper.EmBiDeviceinfoMapper; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 生产设备基础信息表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-14 |
|||
*/ |
|||
@Service |
|||
public class EmBiDeviceinfoServiceImpl extends ServiceImpl<EmBiDeviceinfoMapper, EmBiDeviceinfo> implements IEmBiDeviceinfoService { |
|||
|
|||
@Override |
|||
public IPage<EmBiDeviceinfo> queryAll(Map whereJson, PageQuery page) { |
|||
// 查询条件
|
|||
LambdaQueryWrapper<EmBiDeviceinfo> queryWrapper = new QueryWrapper<EmBiDeviceinfo>().lambda(); |
|||
String search = MapUtil.getStr(whereJson, "search"); |
|||
|
|||
if (ObjectUtil.isNotEmpty(search)) { |
|||
queryWrapper.likeRight(EmBiDeviceinfo::getDevice_code, search) |
|||
.or(item -> item.likeRight(EmBiDeviceinfo::getDevice_name, search)); |
|||
} |
|||
queryWrapper.eq(EmBiDeviceinfo::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否")); |
|||
queryWrapper.orderByDesc(EmBiDeviceinfo::getUpdate_time); |
|||
|
|||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), |
|||
queryWrapper |
|||
); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void create(EmBiDeviceinfo dto) { |
|||
EmBiDeviceinfo emBiDeviceinfo = this.baseMapper.selectOne( |
|||
new QueryWrapper<EmBiDeviceinfo>().lambda() |
|||
.eq(EmBiDeviceinfo::getDevice_code, dto.getDevice_code()) |
|||
); |
|||
if (ObjectUtil.isNotEmpty(emBiDeviceinfo)) { |
|||
throw new BadRequestException("当前设备编码已存在【"+dto.getDevice_code()+"】"); |
|||
} |
|||
|
|||
// 新增
|
|||
dto.setDevice_id(IdUtil.getStringId()); |
|||
dto.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
dto.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
dto.setCreate_time(DateUtil.now()); |
|||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|||
dto.setUpdate_time(DateUtil.now()); |
|||
this.save(dto); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void update(EmBiDeviceinfo dto) { |
|||
EmBiDeviceinfo emBiDeviceinfo = this.baseMapper.selectById(dto.getDevice_id()); |
|||
if (ObjectUtil.isEmpty(emBiDeviceinfo)) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
// 修改
|
|||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|||
dto.setUpdate_time(DateUtil.now()); |
|||
this.updateById(dto); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void delete(Set<String> ids) { |
|||
this.baseMapper.deleteBatchIds(ids); |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
package org.nl.wms.bigscreen_manage.controller; |
|||
|
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.bigscreen_manage.service.BigScreenService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* <p> |
|||
* 大屏显示 控制层 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-24 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/bigScreen") |
|||
@Slf4j |
|||
public class BigScreenController { |
|||
|
|||
@Autowired |
|||
private BigScreenService bigScreenService; |
|||
|
|||
@PostMapping("/getData") |
|||
@Log("大屏数据") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> getData() { |
|||
return new ResponseEntity<>(bigScreenService.getData(null), HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package org.nl.wms.bigscreen_manage.service; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
/** |
|||
* <p> |
|||
* 大屏显示 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-24 |
|||
*/ |
|||
public interface BigScreenService { |
|||
|
|||
/** |
|||
* 获取大屏数据 |
|||
*根据配置的仓库 |
|||
* @return PdaResponse |
|||
*/ |
|||
JSONObject getData(String[] stors); |
|||
} |
@ -0,0 +1,376 @@ |
|||
package org.nl.wms.bigscreen_manage.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateField; |
|||
import cn.hutool.core.date.DateTime; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.NumberUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import org.nl.common.utils.MapOf; |
|||
import org.nl.wms.basedata_manage.service.IStructattrService; |
|||
import org.nl.wms.basedata_manage.service.dao.Structattr; |
|||
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto; |
|||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|||
import org.nl.wms.bigscreen_manage.service.BigScreenService; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
import org.nl.wms.sch_manage.enums.TaskStatus; |
|||
import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
|||
import org.nl.wms.system_manage.service.dict.dao.mapper.SysDictMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 大屏显示 实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-24 |
|||
*/ |
|||
@Service |
|||
public class BigScreenServiceImpl implements BigScreenService { |
|||
|
|||
/** |
|||
* 仓位服务 |
|||
*/ |
|||
@Autowired |
|||
private IStructattrService iStructattrService; |
|||
|
|||
/** |
|||
* 载具扩展属性mapper服务 |
|||
*/ |
|||
@Autowired |
|||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper; |
|||
|
|||
/** |
|||
* 任务服务 |
|||
*/ |
|||
@Autowired |
|||
private ISchBaseTaskService iSchBaseTaskService; |
|||
|
|||
@Override |
|||
public JSONObject getData(String[] stors) { |
|||
// String storCode = "GW";
|
|||
JSONObject result = new JSONObject(); |
|||
// //1.【货位使用】数据
|
|||
// result.put("pointUse", pointUse(storCode));
|
|||
// //2.【实时库存分析】数据
|
|||
// result.put("ivtAnalyse", ivtAnalyse(storCode));
|
|||
// //3.【出入库趋势】数据
|
|||
// result.put("inAndOutTrend", inAndOutTrend(storCode));
|
|||
// //4.【今日出入库】数据
|
|||
// result.put("toDayInAndOut", toDayInAndOut(storCode));
|
|||
// //5.【今日出入库】数据
|
|||
// result.put("realTask", realTask(storCode));
|
|||
// //6.【未完成单据】数据
|
|||
// result.put("unIos", unIos(storCode));
|
|||
return result; |
|||
} |
|||
/** |
|||
//
|
|||
// * 货位使用
|
|||
// *
|
|||
// * @return JSONObject {
|
|||
// * total_qty: 总货位数
|
|||
// * use_qty: 已用货位
|
|||
// * emp_qty: 空余货位
|
|||
// * use_percentage: 百分比(使用货位百分比)
|
|||
// * }
|
|||
// */
|
|||
// private JSONObject pointUse(String storCode) {
|
|||
// // 返回数据
|
|||
// JSONObject result = new JSONObject();
|
|||
// // 查询所有未删除且启用仓位
|
|||
// int emp_qty = iStructattrService.count(
|
|||
// new QueryWrapper<Structattr>().lambda()
|
|||
// .eq(Structattr::getIs_used, Boolean.TRUE)
|
|||
// .eq(Structattr::getStor_code, storCode)
|
|||
// .isNull(Structattr::getStoragevehicle_code));
|
|||
// int use_qty = iStructattrService.count(
|
|||
// new QueryWrapper<Structattr>().lambda()
|
|||
// .eq(Structattr::getIs_used, Boolean.TRUE)
|
|||
// .eq(Structattr::getStor_code, storCode)
|
|||
// .isNotNull(Structattr::getStoragevehicle_code));
|
|||
// int total_qty = iStructattrService.count(
|
|||
// new QueryWrapper<Structattr>().lambda()
|
|||
// .eq(Structattr::getIs_used, Boolean.TRUE)
|
|||
// .eq(Structattr::getStor_code, storCode));
|
|||
// // 总货位数
|
|||
// result.put("total_qty", total_qty);
|
|||
// // 已用货位数
|
|||
// result.put("use_qty", use_qty);
|
|||
// // 空余货位
|
|||
// result.put("emp_qty", emp_qty);
|
|||
// // 使用货位百分比
|
|||
// double use_percentage = NumberUtil.mul(NumberUtil.div(use_qty, total_qty), 100);
|
|||
// result.put("use_percentage", NumberUtil.round(use_percentage, 2));
|
|||
// return result;
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 实时库存分析
|
|||
// *
|
|||
// * @return JSONObject {
|
|||
// * total_qty: 总数
|
|||
// * data: [
|
|||
// * material_name: 物料名称
|
|||
// * ivt_qty: 库存数量
|
|||
// * percentage: 百分比
|
|||
// * ]
|
|||
// * }
|
|||
// */
|
|||
// private JSONObject ivtAnalyse(String storCode) {
|
|||
// // 返回数据
|
|||
// JSONObject result = new JSONObject();
|
|||
// // 查询所有库存
|
|||
// List<StructattrVechielDto> vechielDtos = iStructattrService.collectVechicle(MapOf.of("stor_code", storCode));
|
|||
// // 总数
|
|||
// double total_qty = ivtList.stream()
|
|||
// .map(row -> row.getDoubleValue("canuse_qty"))
|
|||
// .reduce(Double::sum).orElse(0.0);
|
|||
// result.put("total_qty", NumberUtil.round(total_qty, 2));
|
|||
//
|
|||
// // 查询排名前五的物料库存
|
|||
// List<JSONObject> topFiveList;
|
|||
// List<JSONObject> otherList = null;
|
|||
// if (ivtList.size() < 5) {
|
|||
// topFiveList = ivtList;
|
|||
// } else {
|
|||
// topFiveList = ivtList.subList(0, 5);
|
|||
// otherList = ivtList.subList(5, ivtList.size());
|
|||
// }
|
|||
// // 组织数据(物料前五)
|
|||
// for (JSONObject json : topFiveList) {
|
|||
// // 库存数量
|
|||
// json.put("ivt_qty", NumberUtil.round(json.getDoubleValue("canuse_qty"), 2));
|
|||
// // 百分比
|
|||
// double percentage = NumberUtil.mul(NumberUtil.div(json.getDoubleValue("canuse_qty"), total_qty), 100);
|
|||
// json.put("percentage", NumberUtil.round(percentage, 2));
|
|||
// }
|
|||
//
|
|||
// // 计算其他物料
|
|||
// if (ObjectUtil.isNotEmpty(otherList)) {
|
|||
// JSONObject jsonOther = new JSONObject();
|
|||
// jsonOther.put("material_name", "其他");
|
|||
// double ivt_qty = otherList.stream()
|
|||
// .map(row -> row.getDoubleValue("canuse_qty"))
|
|||
// .reduce(Double::sum).orElse(0.0);
|
|||
// jsonOther.put("ivt_qty", NumberUtil.round(ivt_qty, 2));
|
|||
// // 百分比
|
|||
// double percentage = NumberUtil.mul(NumberUtil.div(ivt_qty, total_qty), 100);
|
|||
// jsonOther.put("percentage", NumberUtil.round(percentage, 2));
|
|||
// topFiveList.add(jsonOther);
|
|||
// }
|
|||
//
|
|||
// result.put("data", topFiveList);
|
|||
// return result;
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 出入库趋势
|
|||
// *
|
|||
// * @return JSONObject {
|
|||
// * in: [{date:日期,qty:数量}]
|
|||
// * out: [{date:日期,qty:数量}]
|
|||
// * }
|
|||
// */
|
|||
// private JSONObject inAndOutTrend() {
|
|||
// // 获取七天天数集合
|
|||
// DateTime dateTime = DateUtil.offsetDay(DateUtil.parseDate(DateUtil.today()), -6);
|
|||
// List<String> dateList = DateUtil.rangeToList(dateTime, DateUtil.parse(DateUtil.today()), DateField.DAY_OF_YEAR).stream()
|
|||
// .map(DateTime::toString)
|
|||
// .map(row -> row.substring(0, 10))
|
|||
// .collect(Collectors.toList());
|
|||
// // 查询七天内的出入库数据
|
|||
// List<IOStorInv> allIosList = iOutBillService.list(
|
|||
// new QueryWrapper<IOStorInv>().lambda()
|
|||
// .in(IOStorInv::getBiz_date, dateList)
|
|||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
|||
// .eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|||
// );
|
|||
//
|
|||
// // 查询入库单据
|
|||
// List<IOStorInv> inIosList = allIosList.stream()
|
|||
// .filter(row -> row.getIo_type().equals(IOSEnum.IO_TYPE.code("入库")))
|
|||
// .collect(Collectors.toList());
|
|||
// // 查询出库单据
|
|||
// List<IOStorInv> outIosList = allIosList.stream()
|
|||
// .filter(row -> row.getIo_type().equals(IOSEnum.IO_TYPE.code("出库")))
|
|||
// .collect(Collectors.toList());
|
|||
// // 组织数据
|
|||
// List<JSONObject> inList = new ArrayList<>();
|
|||
// List<JSONObject> outList = new ArrayList<>();
|
|||
// for (String date : dateList) {
|
|||
// // 处理入库数量
|
|||
// JSONObject jsonIn = new JSONObject();
|
|||
// jsonIn.put("date", date);
|
|||
// double in_qty = inIosList.stream()
|
|||
// .filter(row -> row.getBiz_date().equals(date))
|
|||
// .map(row -> row.getTotal_qty().doubleValue())
|
|||
// .reduce(Double::sum).orElse(0.00);
|
|||
// jsonIn.put("qty", NumberUtil.round(in_qty, 2));
|
|||
// inList.add(jsonIn);
|
|||
//
|
|||
// // 处理出库数据
|
|||
// JSONObject jsonOut = new JSONObject();
|
|||
// jsonOut.put("date", date);
|
|||
// double out_qty = outIosList.stream()
|
|||
// .filter(row -> row.getBiz_date().equals(date))
|
|||
// .map(row -> row.getTotal_qty().doubleValue())
|
|||
// .reduce(Double::sum).orElse(0.00);
|
|||
// jsonOut.put("qty", NumberUtil.round(out_qty, 2));
|
|||
// outList.add(jsonOut);
|
|||
// }
|
|||
//
|
|||
// JSONObject result = new JSONObject();
|
|||
// result.put("in", inList);
|
|||
// result.put("out", outList);
|
|||
// return result;
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 今日出入库
|
|||
// *
|
|||
// * @return JSONObject {
|
|||
// * in: {total_qty:总数量,vehicle_qty:托盘数量}
|
|||
// * out: {total_qty:总数量,vehicle_qty:托盘数量}
|
|||
// * }
|
|||
// */
|
|||
// private JSONObject toDayInAndOut() {
|
|||
// // 查询今天出入库单据
|
|||
// List<IOStorInv> inList = iOutBillService.list(
|
|||
// new QueryWrapper<IOStorInv>().lambda()
|
|||
// .eq(IOStorInv::getBiz_date, DateUtil.today())
|
|||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
|||
// .eq(IOStorInv::getIo_type, IOSEnum.IO_TYPE.code("入库"))
|
|||
// .eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|||
// );
|
|||
// // 查询今天出库单据
|
|||
// List<IOStorInv> outList = iOutBillService.list(
|
|||
// new QueryWrapper<IOStorInv>().lambda()
|
|||
// .eq(IOStorInv::getBiz_date, DateUtil.today())
|
|||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
|||
// .eq(IOStorInv::getIo_type, IOSEnum.IO_TYPE.code("出库"))
|
|||
// .eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|||
// );
|
|||
//
|
|||
// // 入库
|
|||
// JSONObject jsonIn = new JSONObject();
|
|||
// // 总数量
|
|||
// double total_qty_in = inList.stream()
|
|||
// .map(row -> row.getTotal_qty().doubleValue())
|
|||
// .reduce(Double::sum).orElse(0.0);
|
|||
// jsonIn.put("total_qty", NumberUtil.round(total_qty_in, 2));
|
|||
//
|
|||
// // 托盘数
|
|||
// List<IOStorInvDis> inDisList = new ArrayList<>();
|
|||
// if (ObjectUtil.isNotEmpty(inList)) {
|
|||
// inDisList = ioStorInvDisMapper.selectList(
|
|||
// new QueryWrapper<IOStorInvDis>().lambda()
|
|||
// .in(IOStorInvDis::getIostorinv_id, inList.stream()
|
|||
// .map(IOStorInv::getIostorinv_id)
|
|||
// .collect(Collectors.toList())
|
|||
// )
|
|||
// );
|
|||
// }
|
|||
// jsonIn.put("vehicle_qty", inDisList.size());
|
|||
//
|
|||
// // 出库
|
|||
// JSONObject jsonOut = new JSONObject();
|
|||
// // 总数量
|
|||
// double total_qty_out = outList.stream()
|
|||
// .map(row -> row.getTotal_qty().doubleValue())
|
|||
// .reduce(Double::sum).orElse(0.0);
|
|||
// jsonOut.put("total_qty", NumberUtil.round(total_qty_out, 2));
|
|||
// // 托盘数
|
|||
// List<IOStorInvDis> outDisList = new ArrayList<>();
|
|||
// if (ObjectUtil.isNotEmpty(outList)) {
|
|||
// outDisList = ioStorInvDisMapper.selectList(
|
|||
// new QueryWrapper<IOStorInvDis>().lambda()
|
|||
// .in(IOStorInvDis::getIostorinv_id, outList.stream()
|
|||
// .map(IOStorInv::getIostorinv_id)
|
|||
// .collect(Collectors.toList())
|
|||
// )
|
|||
// );
|
|||
// }
|
|||
// jsonOut.put("vehicle_qty", outDisList.size());
|
|||
//
|
|||
// JSONObject result = new JSONObject();
|
|||
// result.put("in", jsonIn);
|
|||
// result.put("out", jsonOut);
|
|||
// return result;
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 实时任务
|
|||
// *
|
|||
// * @return List<SchBaseTask> {
|
|||
// * 任务实体列
|
|||
// * }
|
|||
// */
|
|||
// private List<SchBaseTask> realTask() {
|
|||
// List<SchBaseTask> list = iSchBaseTaskService.list(
|
|||
// new QueryWrapper<SchBaseTask>().lambda()
|
|||
// .in(SchBaseTask::getTask_status, TaskStatus.CREATE.getCode()
|
|||
// , TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()
|
|||
// )
|
|||
// .eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
|
|||
// );
|
|||
// list.stream().forEach(item -> {
|
|||
// if (item.getTask_status().equals(TaskStatus.CREATE.getCode())) {
|
|||
// item.setTask_status(TaskStatus.CREATE.getName());
|
|||
// }
|
|||
// if (item.getTask_status().equals(TaskStatus.ISSUED.getCode())) {
|
|||
// item.setTask_status(TaskStatus.ISSUED.getName());
|
|||
// }
|
|||
// if (item.getTask_status().equals(TaskStatus.EXECUTING.getCode())) {
|
|||
// item.setTask_status(TaskStatus.EXECUTING.getName());
|
|||
// }
|
|||
// });
|
|||
//
|
|||
// return list;
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 未完成单据
|
|||
// *
|
|||
// * @return List<IOStorInv>{
|
|||
// * 出入库实体类
|
|||
// * }
|
|||
// */
|
|||
// private List<IOStorInv> unIos() {
|
|||
// List<Dict> dicts = sysDictMapper.selectList(
|
|||
// new QueryWrapper<Dict>().lambda()
|
|||
// .in(Dict::getCode, "ST_INV_IN_TYPE", "ST_INV_OUT_TYPE")
|
|||
// );
|
|||
//
|
|||
// List<IOStorInv> list = iOutBillService.list(
|
|||
// new QueryWrapper<IOStorInv>().lambda()
|
|||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
|||
// .ne(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|||
// );
|
|||
// list.stream().forEach(item -> {
|
|||
// item.setIo_type(item.getIo_type().equals(IOSEnum.IO_TYPE.code("入库")) ? IOSConstant.IOS_IO_TYPE_IN : IOSConstant.IOS_IO_TYPE_OUT);
|
|||
// if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("生成"))) {
|
|||
// item.setBill_status("生成");
|
|||
// }
|
|||
// if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配中"))) {
|
|||
// item.setBill_status("分配中");
|
|||
// }
|
|||
// if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))) {
|
|||
// item.setBill_status("分配完");
|
|||
// }
|
|||
// Dict dict = dicts.stream()
|
|||
// .filter(row -> row.getValue().equals(item.getBill_type()))
|
|||
// .findFirst().orElse(null);
|
|||
// item.setBill_type(dict.getLabel());
|
|||
// });
|
|||
// return list;
|
|||
// }
|
|||
} |
@ -1,9 +1,9 @@ |
|||
package org.nl.wms.ext.controller; |
|||
package org.nl.wms.ext_manage.controller; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.ext.service.AcsToWmsService; |
|||
import org.nl.wms.ext_manage.service.AcsToWmsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.ext.enums; |
|||
package org.nl.wms.ext_manage.enums; |
|||
|
|||
/** |
|||
* @author Liuyx |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.ext.enums; |
|||
package org.nl.wms.ext_manage.enums; |
|||
|
|||
/** |
|||
* <p> |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.ext.service; |
|||
package org.nl.wms.ext_manage.service; |
|||
|
|||
import java.util.Map; |
|||
|
@ -1,7 +1,7 @@ |
|||
package org.nl.wms.ext.service; |
|||
package org.nl.wms.ext_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.ext.service.util.ErpResponse; |
|||
import org.nl.wms.ext_manage.service.util.ErpResponse; |
|||
|
|||
/** |
|||
* <p> |
@ -1,7 +1,7 @@ |
|||
package org.nl.wms.ext.service; |
|||
package org.nl.wms.ext_manage.service; |
|||
|
|||
|
|||
import org.nl.wms.ext.service.util.AcsResponse; |
|||
import org.nl.wms.ext_manage.service.util.AcsResponse; |
|||
import org.nl.wms.sch_manage.service.util.AcsTaskDto; |
|||
|
|||
import java.util.List; |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.ext.service; |
|||
package org.nl.wms.ext_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
@ -1,12 +1,12 @@ |
|||
package org.nl.wms.ext.service.impl; |
|||
package org.nl.wms.ext_manage.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.SneakyThrows; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.wms.ext.enums.ResultAcsStatus; |
|||
import org.nl.wms.ext.service.AcsToWmsService; |
|||
import org.nl.wms.ext_manage.enums.ResultAcsStatus; |
|||
import org.nl.wms.ext_manage.service.AcsToWmsService; |
|||
import org.nl.wms.sch_manage.enums.TaskStatus; |
|||
import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
@ -1,10 +1,10 @@ |
|||
package org.nl.wms.ext.service.impl; |
|||
package org.nl.wms.ext_manage.service.impl; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.wms.ext.enums.EXTConstant; |
|||
import org.nl.wms.ext.service.WmsToAcsService; |
|||
import org.nl.wms.ext.service.util.AcsResponse; |
|||
import org.nl.wms.ext.util.AcsUtil; |
|||
import org.nl.wms.ext_manage.enums.EXTConstant; |
|||
import org.nl.wms.ext_manage.service.WmsToAcsService; |
|||
import org.nl.wms.ext_manage.service.util.AcsResponse; |
|||
import org.nl.wms.ext_manage.util.AcsUtil; |
|||
import org.nl.wms.sch_manage.service.util.AcsTaskDto; |
|||
import org.springframework.stereotype.Service; |
|||
|
@ -1,14 +1,14 @@ |
|||
package org.nl.wms.ext.service.impl; |
|||
package org.nl.wms.ext_manage.service.impl; |
|||
|
|||
import cn.hutool.http.HttpRequest; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.config.SpringContextHolder; |
|||
import org.nl.system.enums.SysParamConstant; |
|||
import org.nl.system.service.param.impl.SysParamServiceImpl; |
|||
import org.nl.wms.ext.enums.EXTConstant; |
|||
import org.nl.wms.ext.service.WmsToErpService; |
|||
import org.nl.wms.system_manage.enums.SysParamConstant; |
|||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl; |
|||
import org.nl.wms.ext_manage.enums.EXTConstant; |
|||
import org.nl.wms.ext_manage.service.WmsToErpService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.stereotype.Service; |
|||
|
@ -1,10 +1,10 @@ |
|||
package org.nl.wms.ext.service.util; |
|||
package org.nl.wms.ext_manage.service.util; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.http.HttpStatus; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import lombok.Data; |
|||
import org.nl.wms.ext.util.BaseResponse; |
|||
import org.nl.wms.ext_manage.util.BaseResponse; |
|||
|
|||
/** |
|||
* @Author: Liuxy |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.ext.service.util; |
|||
package org.nl.wms.ext_manage.service.util; |
|||
|
|||
import cn.hutool.http.HttpStatus; |
|||
import com.alibaba.fastjson.JSONObject; |
@ -1,15 +1,15 @@ |
|||
package org.nl.wms.ext.util; |
|||
package org.nl.wms.ext_manage.util; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.http.HttpRequest; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.config.SpringContextHolder; |
|||
import org.nl.system.enums.SysParamConstant; |
|||
import org.nl.system.service.param.dao.Param; |
|||
import org.nl.system.service.param.impl.SysParamServiceImpl; |
|||
import org.nl.wms.ext.service.util.AcsResponse; |
|||
import org.nl.wms.warehouse_management.enums.IOSConstant; |
|||
import org.nl.wms.system_manage.enums.SysParamConstant; |
|||
import org.nl.wms.system_manage.service.param.dao.Param; |
|||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl; |
|||
import org.nl.wms.ext_manage.service.util.AcsResponse; |
|||
import org.nl.wms.warehouse_manage.enums.IOSConstant; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.ext.util; |
|||
package org.nl.wms.ext_manage.util; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.http.HttpStatus; |
@ -1,8 +1,8 @@ |
|||
package org.nl.wms.pda.authorization.controller; |
|||
package org.nl.wms.pda_manage.authorization.controller; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.system.service.menu.ISysMenuService; |
|||
import org.nl.wms.system_manage.service.menu.ISysMenuService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
@ -1,15 +1,12 @@ |
|||
package org.nl.wms.pda.ios_manage.controller; |
|||
package org.nl.wms.pda_manage.ios_manage.controller; |
|||
|
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.pda.ios_manage.service.PdaIosOutService; |
|||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
@ -1,9 +1,9 @@ |
|||
package org.nl.wms.pda.ios_manage.service; |
|||
package org.nl.wms.pda_manage.ios_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
import org.nl.wms.warehouse_manage.service.dao.StIvtCheckdtl; |
|||
|
|||
/** |
|||
* <p> |
@ -1,11 +1,10 @@ |
|||
package org.nl.wms.pda.ios_manage.service; |
|||
package org.nl.wms.pda_manage.ios_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.vo.SelectItemVo; |
|||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
|
|||
import java.util.List; |
|||
|
@ -1,7 +1,7 @@ |
|||
package org.nl.wms.pda.ios_manage.service; |
|||
package org.nl.wms.pda_manage.ios_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
|
|||
/** |
|||
* <p> |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.pda.ios_manage.service.dto; |
|||
package org.nl.wms.pda_manage.ios_manage.service.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
@ -1,15 +1,15 @@ |
|||
package org.nl.wms.pda.ios_manage.service.impl; |
|||
package org.nl.wms.pda_manage.ios_manage.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.wms.pda.ios_manage.service.PdaIosCheckService; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|||
import org.nl.wms.warehouse_management.service.IStIvtCheckdtlService; |
|||
import org.nl.wms.warehouse_management.service.IStIvtCheckmstService; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl; |
|||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtCheckdtlMapper; |
|||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosCheckService; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
import org.nl.wms.warehouse_manage.enums.IOSEnum; |
|||
import org.nl.wms.warehouse_manage.service.IStIvtCheckdtlService; |
|||
import org.nl.wms.warehouse_manage.service.IStIvtCheckmstService; |
|||
import org.nl.wms.warehouse_manage.service.dao.StIvtCheckdtl; |
|||
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtCheckdtlMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
@ -1,8 +1,8 @@ |
|||
package org.nl.wms.pda.sch_manage.service; |
|||
package org.nl.wms.pda_manage.sch_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
import org.nl.wms.sch_manage.service.dao.SchBasePoint; |
|||
|
|||
/** |
@ -1,8 +1,8 @@ |
|||
package org.nl.wms.pda.sch_manage.service; |
|||
package org.nl.wms.pda_manage.sch_manage.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
|||
|
|||
/** |
@ -1,11 +1,11 @@ |
|||
package org.nl.wms.pda.sch_manage.service.impl; |
|||
package org.nl.wms.pda_manage.sch_manage.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService; |
|||
import org.nl.wms.pda.sch_manage.service.PdaSchPointService; |
|||
import org.nl.wms.pda.util.PdaResponse; |
|||
import org.nl.wms.pda_manage.sch_manage.service.PdaSchPointService; |
|||
import org.nl.wms.pda_manage.util.PdaResponse; |
|||
import org.nl.wms.sch_manage.service.dao.SchBasePoint; |
|||
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.pda.util; |
|||
package org.nl.wms.pda_manage.util; |
|||
|
|||
import cn.hutool.http.HttpStatus; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
@ -1,123 +0,0 @@ |
|||
package org.nl.wms.pm_manage.form_data.service.dao.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
|
|||
/** |
|||
* {@code @Description:} 表单信息表(PmFormData)数据传输类 |
|||
* {@code @Author:} gbx |
|||
* |
|||
* @since 2025-06-27 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class PmFormDataDto implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -7739291296662381396L; |
|||
|
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
/** |
|||
* 编号 |
|||
*/ |
|||
private String code; |
|||
/** |
|||
* 单据状态 |
|||
*/ |
|||
private String status; |
|||
/** |
|||
* 单据类型 |
|||
*/ |
|||
private String form_type; |
|||
/** |
|||
* 源单单据日期 |
|||
*/ |
|||
private String source_form_date; |
|||
/** |
|||
* 物料code |
|||
*/ |
|||
private String material_code; |
|||
/** |
|||
* 批次号 |
|||
*/ |
|||
private String pcsn; |
|||
/** |
|||
* 计划数量 |
|||
*/ |
|||
private BigDecimal plan_qty; |
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private BigDecimal qty; |
|||
/** |
|||
* 分配数量 |
|||
*/ |
|||
private BigDecimal assign_qty; |
|||
/** |
|||
* 实际数量 |
|||
*/ |
|||
private BigDecimal actual_qty; |
|||
/** |
|||
* 单据累计数量 |
|||
*/ |
|||
private BigDecimal total_qty; |
|||
/** |
|||
* 数量单位 |
|||
*/ |
|||
private String unit_id; |
|||
/** |
|||
* 单位名称 |
|||
*/ |
|||
private String unit_name; |
|||
/** |
|||
* 载具信息 |
|||
*/ |
|||
private String vehicle_code; |
|||
/** |
|||
* 载具组盘id |
|||
*/ |
|||
private String vehicle_id; |
|||
/** |
|||
* 自定义表单字段 |
|||
*/ |
|||
private String form_data; |
|||
/** |
|||
* 创建id |
|||
*/ |
|||
private String create_time; |
|||
/** |
|||
* 创建id |
|||
*/ |
|||
private String create_name; |
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_name; |
|||
/** |
|||
* 说明 |
|||
*/ |
|||
private String remark; |
|||
/** |
|||
* 是否完结 |
|||
*/ |
|||
private Integer is_finish; |
|||
|
|||
} |
|||
|
|||
|
|||
|
@ -1,12 +1,14 @@ |
|||
package org.nl.wms.pm_manage.form_data.service; |
|||
package org.nl.wms.pm_manage.service; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.pm_manage.form_data.service.dao.dao.PmFormData; |
|||
import org.nl.wms.pm_manage.form_data.service.dao.dto.PmFormDataParam; |
|||
import org.nl.wms.pm_manage.form_data.service.dto.FormDataQuery; |
|||
import org.nl.wms.pm_manage.form_data.service.dto.PmFormDataDto; |
|||
import org.nl.wms.pm_manage.service.dao.PmFormData; |
|||
import org.nl.wms.pm_manage.service.dto.PmFormDataDto; |
|||
import org.nl.wms.pm_manage.service.dto.PmFormDataParam; |
|||
import org.nl.wms.pm_manage.service.dto.FormDataQuery; |
|||
|
|||
|
|||
import java.util.List; |
|||
|
@ -1,11 +1,11 @@ |
|||
package org.nl.wms.pm_manage.form_data.service.dao.mapper; |
|||
package org.nl.wms.pm_manage.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Update; |
|||
import org.nl.wms.pm_manage.form_data.service.dao.dao.PmFormData; |
|||
import org.nl.wms.pm_manage.form_data.service.dto.FormDataQuery; |
|||
import org.nl.wms.pm_manage.form_data.service.dto.PmFormDataDto; |
|||
import org.nl.wms.pm_manage.service.dao.PmFormData; |
|||
import org.nl.wms.pm_manage.service.dto.FormDataQuery; |
|||
import org.nl.wms.pm_manage.service.dto.PmFormDataDto; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
@ -1,10 +1,10 @@ |
|||
package org.nl.wms.pm_manage.form_data.service.dto; |
|||
package org.nl.wms.pm_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.pm_manage.form_data.service.dao.dao.PmFormData; |
|||
import org.nl.wms.pm_manage.service.dao.PmFormData; |
|||
|
|||
import java.util.Map; |
|||
|
@ -1,4 +1,4 @@ |
|||
package org.nl.wms.pm_manage.form_data.service.dto; |
|||
package org.nl.wms.pm_manage.service.dto; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.Data; |
@ -1,11 +1,11 @@ |
|||
package org.nl.wms.pm_manage.form_data.service.dao.dto; |
|||
package org.nl.wms.pm_manage.service.dto; |
|||
|
|||
|
|||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
|||
import lombok.*; |
|||
import org.nl.common.domain.handler.IsoToLocalDateTimeStringDeserializer; |
|||
import org.nl.common.domain.query.BaseQuery; |
|||
import org.nl.wms.pm_manage.form_data.service.dao.dao.PmFormData; |
|||
import org.nl.wms.pm_manage.service.dao.PmFormData; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue