mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
init
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-manage</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-common</artifactId>
|
||||
</dependency>
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<artifactId>cf-module-prod-manage-api</artifactId>
|
||||
<description>
|
||||
manage 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* manage API包 暴露给其他模块API
|
||||
*/
|
||||
package com.cf.imes.module.manage.api;
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
import com.cf.imes.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "manage-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/manage";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
* 生产管理服务错误码枚举 使用1-004-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-manage</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cf-module-prod-manage-biz</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 依赖服务 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-manage-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-banner</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-organ</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-error-code</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.apache.shardingsphere</groupId>
|
||||
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-rpc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 注册中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.smallbun.screw</groupId>
|
||||
<artifactId>screw-core</artifactId> <!-- 实现数据库文档 -->
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
|
||||
</dependency>
|
||||
|
||||
<!-- 三方云服务相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-file</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-data-permission</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.cf.imes.module.manage;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class ManageServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ManageServerApplication.class, args);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.cf.imes.module.manage.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
|
||||
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.manage.dal.dataobject.register.RegisterDO;
|
||||
import com.cf.imes.module.manage.dal.mysql.register.RegisterMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DataSourceInitializer {
|
||||
|
||||
@Autowired
|
||||
private DefaultDataSourceCreator defaultDataSourceCreator;
|
||||
|
||||
@Autowired
|
||||
private RegisterMapper registerMapper;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
DynamicRoutingDataSource dynamicRoutingDataSource=(DynamicRoutingDataSource)dataSource;
|
||||
OrganContextHolder.setOrganId(0L);
|
||||
List<RegisterDO> registerDOS=registerMapper.findAll();
|
||||
OrganContextHolder.clear();
|
||||
for(RegisterDO registerDO:registerDOS){
|
||||
DataSourceProperty dataSourceProperty=new DataSourceProperty();
|
||||
dataSourceProperty.setPoolName(registerDO.getCode());
|
||||
dataSourceProperty.setUrl(registerDO.getDbUrl());
|
||||
dataSourceProperty.setUsername(registerDO.getDbUsername());
|
||||
dataSourceProperty.setPassword(registerDO.getDbPassword());
|
||||
DataSource dataSource=defaultDataSourceCreator.createDataSource(dataSourceProperty);
|
||||
dynamicRoutingDataSource.addDataSource(registerDO.getCode(),dataSource);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
### 请求 /manage/plate 接口 => 没有权限
|
||||
GET {{baseUrl}}/system/plate
|
||||
Authorization: Bearer {{token}}
|
||||
organ-id: {{adminTenentId}}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate;
|
||||
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.*;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.cf.imes.module.manage.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.manage.service.plate.PlateService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Tag(name = "管理后台 - 板材信息表 plate")
|
||||
@RestController
|
||||
@RequestMapping("/manage/plate")
|
||||
@Validated
|
||||
public class PlateController {
|
||||
|
||||
@Resource
|
||||
private PlateService plateService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建板材信息表 plate_{N}")
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:create')")
|
||||
public CommonResult<Long> createPlate(@Valid @RequestBody PlateSaveReqVO createReqVO) {
|
||||
return success(plateService.createPlate(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新板材信息表 plate_{N}")
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:update')")
|
||||
public CommonResult<Boolean> updatePlate(@Valid @RequestBody PlateSaveReqVO updateReqVO) {
|
||||
plateService.updatePlate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除板材信息表 plate_{N}")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:delete')")
|
||||
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id) {
|
||||
plateService.deletePlate(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得板材信息表 plate_{N}")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:query')")
|
||||
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id) {
|
||||
PlateDO plate = plateService.getPlate(id);
|
||||
return success(BeanUtils.toBean(plate, PlateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得板材信息表 plate_{N}分页")
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:query')")
|
||||
public CommonResult<PageResult<PlateRespVO>> getPlatePage(@Valid PlatePageReqVO pageReqVO) {
|
||||
PageResult<PlateDO> pageResult = plateService.getPlatePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PlateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出板材信息")
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportPlateExcel(@Valid PlatePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlateDO> list = plateService.getPlatePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "板材信息表 plate_{N}.xls", "数据", PlateRespVO.class,
|
||||
BeanUtils.toBean(list, PlateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
@Operation(summary = "获得导入用户模板")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
// 手动创建导出 demo
|
||||
List<PlateImportExcelVO> list = Arrays.asList(
|
||||
PlateImportExcelVO.builder().goodsId(Long.parseLong("23112371")).goodsName("xixih").material("颗粒板").width(1212.3)
|
||||
.thickness(0.2).price(33333.2).brand("SexEnum.MALE.getSex()").spec("大厂").remark("测试").build(),
|
||||
PlateImportExcelVO.builder().goodsId(Long.parseLong("23112372")).goodsName("2L").material("yuanma@cf.com").width(21.6)
|
||||
.thickness(5.3).price(333.555).brand("kkkkkk").spec("大厂").remark("测试").build()
|
||||
);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "板材导入模板.xls", "板材列表", PlateImportExcelVO.class, list);
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入板材")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('manage:plate:import')")
|
||||
public CommonResult<PlateImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
List<PlateImportExcelVO> list = ExcelUtils.read(file, PlateImportExcelVO.class);
|
||||
return success(plateService.importPlateList(list, updateSupport));
|
||||
// return null;
|
||||
}
|
||||
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate;
|
||||
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateRespVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.manage.service.remainplaten.RemainPlateService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Tag(name = "管理后台 - 生产单余料板表 order_remain_plate_{N}")
|
||||
@RestController
|
||||
@RequestMapping("/manage/remain-plate")
|
||||
@Validated
|
||||
public class RemainPlateController {
|
||||
|
||||
@Resource
|
||||
private RemainPlateService remainPlateService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产单余料板表 order_remain_plate_{N}")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:create')")
|
||||
public CommonResult<Long> createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) {
|
||||
return success(remainPlateService.createRemainPlate(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产单余料板表 order_remain_plate_{N}")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:update')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO updateReqVO) {
|
||||
remainPlateService.updateRemainPlate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产单余料板表 order_remain_plate_{N}")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:delete')")
|
||||
public CommonResult<Boolean> deleteRemainPlate(@RequestParam("id") Long id) {
|
||||
remainPlateService.deleteRemainPlate(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产单余料板表 order_remain_plate_{N}")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:query')")
|
||||
public CommonResult<RemainPlateRespVO> getRemainPlate(@RequestParam("id") Long id) {
|
||||
RemainPlateDO remainPlate = remainPlateService.getRemainPlate(id);
|
||||
return success(BeanUtils.toBean(remainPlate, RemainPlateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单余料板表 order_remain_plate_{N}分页")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:query')")
|
||||
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) {
|
||||
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RemainPlateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产单余料板表 order_remain_plate_{N} Excel")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportRemainPlateExcel(@Valid RemainPlatePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RemainPlateDO> list = remainPlateService.getRemainPlatePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产单余料板表 order_remain_plate_{N}.xls", "数据", RemainPlateRespVO.class,
|
||||
BeanUtils.toBean(list, RemainPlateRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户 Excel 导入 VO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
|
||||
public class PlateImportExcelVO {
|
||||
|
||||
@ExcelProperty("客户的商品编号")
|
||||
private Long goodsId;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
private String goodsName;
|
||||
|
||||
@ExcelProperty("材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
private String material;
|
||||
|
||||
@ExcelProperty("颜色")
|
||||
private String color;
|
||||
|
||||
@ExcelProperty("宽度")
|
||||
private Double width;
|
||||
|
||||
@ExcelProperty("厚度")
|
||||
private Double thickness;
|
||||
|
||||
@ExcelProperty("价格")
|
||||
private Double price;
|
||||
|
||||
@ExcelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ExcelProperty("规格")
|
||||
private String spec;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @projectName: cf_imes_back
|
||||
* @author: 晨丰科技
|
||||
* @date: 2024/2/27 16:36
|
||||
*/
|
||||
|
||||
@Schema(description = "管理后台 - 板材信息表 plate_{N}导入 Response VO")
|
||||
@Data
|
||||
@Builder
|
||||
public class PlateImportRespVO {
|
||||
@Schema(description = "创建成功的板材数组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> createPlateNames;
|
||||
|
||||
@Schema(description = "更新成功的板材数组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> updatePlateNames;
|
||||
|
||||
@Schema(description = "导入失败的板材集合,key 为板材名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Map<String, String> failurePlateNames;
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 板材信息表 plate_{N}分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PlatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "客户的商品编号", example = "9822")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名称", example = "李四")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "高度")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "厚度")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "价格", example = "20204")
|
||||
private Double price;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 板材信息表 plate_{N} Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PlateRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4399")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户的商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
|
||||
@ExcelProperty("客户的商品编号")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("商品名称")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("高度")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("厚度")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "20204")
|
||||
@ExcelProperty("价格")
|
||||
private Double price;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 板材信息表 plate_{N}新增/修改 Request VO")
|
||||
@Data
|
||||
public class PlateSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4399")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户的商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
|
||||
@NotNull(message = "客户的商品编号不能为空")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotEmpty(message = "商品名称不能为空")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板不能为空")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "颜色不能为空")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "高度不能为空")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "厚度不能为空")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "20204")
|
||||
@NotNull(message = "价格不能为空")
|
||||
private Double price;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "规格不能为空")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N}分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RemainPlatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "排单 ID", example = "9338")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "初始排单 ID", example = "20444")
|
||||
private Long initPlanId;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品 ID", example = "5748")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "材料")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "长度")
|
||||
private Double length;
|
||||
|
||||
@Schema(description = "厚度")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
|
||||
private Integer placeStyle;
|
||||
|
||||
@Schema(description = "仓库名")
|
||||
private String store;
|
||||
|
||||
@Schema(description = "数量", example = "24524")
|
||||
private Integer count;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "轮廊数据,Json 串")
|
||||
private String outline;
|
||||
|
||||
@Schema(description = "创建日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N} Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RemainPlateRespVO {
|
||||
|
||||
@Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "349")
|
||||
@ExcelProperty("余料板 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9338")
|
||||
@ExcelProperty("排单 ID")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20444")
|
||||
@ExcelProperty("初始排单 ID")
|
||||
private Long initPlanId;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("余料板状态,0未使用,1使用中,2已使用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5748")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("商品名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("材料")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("长度")
|
||||
private Double length;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("厚度")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
|
||||
private Integer placeStyle;
|
||||
|
||||
@Schema(description = "仓库名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("仓库名")
|
||||
private String store;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "24524")
|
||||
@ExcelProperty("数量")
|
||||
private Integer count;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("轮廊数据,Json 串")
|
||||
private String outline;
|
||||
|
||||
@Schema(description = "创建日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建日期")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N}新增/修改 Request VO")
|
||||
@Data
|
||||
public class RemainPlateSaveReqVO {
|
||||
|
||||
@Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "349")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9338")
|
||||
@NotNull(message = "排单 ID不能为空")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20444")
|
||||
@NotNull(message = "初始排单 ID不能为空")
|
||||
private Long initPlanId;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "余料板状态,0未使用,1使用中,2已使用不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5748")
|
||||
@NotNull(message = "商品 ID不能为空")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotEmpty(message = "商品名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "材料不能为空")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "颜色不能为空")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "长度不能为空")
|
||||
private Double length;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "厚度不能为空")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "品牌不能为空")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转不能为空")
|
||||
private Integer placeStyle;
|
||||
|
||||
@Schema(description = "仓库名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "仓库名不能为空")
|
||||
private String store;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "24524")
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer count;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "轮廊数据,Json 串不能为空")
|
||||
private String outline;
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.manage.controller.admin.test;
|
||||
|
||||
import com.cf.imes.module.manage.dal.mysql.test.TestMapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
* 测试 controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/test")
|
||||
@Tag(name = "测试")
|
||||
public class TestController {
|
||||
|
||||
@Resource
|
||||
private TestMapper testMapper;
|
||||
|
||||
@GetMapping("/get")
|
||||
@PermitAll
|
||||
@Operation(summary = "测试")
|
||||
public Object get() {
|
||||
return testMapper.selectList();
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 提供 RESTful API 给前端:
|
||||
* 1. admin 包:提供给管理后台 cf-ui-admin 前端项目
|
||||
* 2. app 包:提供给用户 APP cf-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
|
||||
*/
|
||||
package com.cf.imes.module.manage.controller;
|
||||
+1
@@ -0,0 +1 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject;
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject.plate;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 板材信息表 plate_N DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("plate_n")
|
||||
@KeySequence("plate_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 客户的商品编号
|
||||
*/
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板
|
||||
*/
|
||||
private String material;
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
private String color;
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Double width;
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
private Double height;
|
||||
/**
|
||||
* 厚度
|
||||
*/
|
||||
private Double thickness;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private Double price;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
private String brand;
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String spec;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject.register;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
@TableName("system_db_register")
|
||||
public class RegisterDO {
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String dbUrl;
|
||||
|
||||
private String dbUsername;
|
||||
|
||||
private String dbPassword;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject.register;
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject.remainplaten;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} DO
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@TableName("order_remain_plate_n")
|
||||
@KeySequence("order_remain_plate_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RemainPlateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 余料板 ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 排单 ID
|
||||
*/
|
||||
private Long planId;
|
||||
/**
|
||||
* 初始排单 ID
|
||||
*/
|
||||
private Long initPlanId;
|
||||
/**
|
||||
* 余料板状态,0未使用,1使用中,2已使用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 商品 ID
|
||||
*/
|
||||
private Long goodsId;
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 材料
|
||||
*/
|
||||
private String material;
|
||||
/**
|
||||
* 颜色
|
||||
*/
|
||||
private String color;
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Double width;
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private Double length;
|
||||
/**
|
||||
* 厚度
|
||||
*/
|
||||
private Double thickness;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
private String brand;
|
||||
/**
|
||||
* 放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转
|
||||
*/
|
||||
private Integer placeStyle;
|
||||
/**
|
||||
* 仓库名
|
||||
*/
|
||||
private String store;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer count;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 轮廊数据,Json 串
|
||||
*/
|
||||
private String outline;
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.cf.imes.module.manage.dal.dataobject.test;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
@TableName("test")
|
||||
public class TestDO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
package com.cf.imes.module.manage.dal.mysql;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.plate;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlatePageReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.plate.PlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 板材信息表 plate_{N} Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
default PlateDO selectByGoodID(Long goodId) {
|
||||
return selectOne(PlateDO::getGoodsId, goodId);
|
||||
}
|
||||
|
||||
default PageResult<PlateDO> selectPage(PlatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PlateDO>()
|
||||
.eqIfPresent(PlateDO::getGoodsId, reqVO.getGoodsId())
|
||||
.likeIfPresent(PlateDO::getGoodsName, reqVO.getGoodsName())
|
||||
.eqIfPresent(PlateDO::getMaterial, reqVO.getMaterial())
|
||||
.eqIfPresent(PlateDO::getColor, reqVO.getColor())
|
||||
.eqIfPresent(PlateDO::getWidth, reqVO.getWidth())
|
||||
.eqIfPresent(PlateDO::getHeight, reqVO.getHeight())
|
||||
.eqIfPresent(PlateDO::getThickness, reqVO.getThickness())
|
||||
.eqIfPresent(PlateDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(PlateDO::getBrand, reqVO.getBrand())
|
||||
.eqIfPresent(PlateDO::getSpec, reqVO.getSpec())
|
||||
.eqIfPresent(PlateDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(PlateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PlateDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.register;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.manage.dal.dataobject.register.RegisterDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegisterMapper extends BaseMapperX<RegisterDO> {
|
||||
|
||||
@Select("select * from system_db_register")
|
||||
List<RegisterDO> findAll();
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.remainplaten;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} Mapper
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Mapper
|
||||
public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||
|
||||
default PageResult<RemainPlateDO> selectPage(RemainPlatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RemainPlateDO>()
|
||||
.eqIfPresent(RemainPlateDO::getPlanId, reqVO.getPlanId())
|
||||
.eqIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId())
|
||||
.eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
|
||||
.likeIfPresent(RemainPlateDO::getName, reqVO.getName())
|
||||
.eqIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
|
||||
.eqIfPresent(RemainPlateDO::getColor, reqVO.getColor())
|
||||
.eqIfPresent(RemainPlateDO::getWidth, reqVO.getWidth())
|
||||
.eqIfPresent(RemainPlateDO::getLength, reqVO.getLength())
|
||||
.eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
|
||||
.eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
|
||||
.eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle())
|
||||
.eqIfPresent(RemainPlateDO::getStore, reqVO.getStore())
|
||||
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(RemainPlateDO::getOutline, reqVO.getOutline())
|
||||
.betweenIfPresent(RemainPlateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RemainPlateDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.test;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.manage.dal.dataobject.test.TestDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Mapper
|
||||
public interface TestMapper extends BaseMapperX<TestDO> {
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.cf.imes.module.manage.framework.rpc.config;
|
||||
|
||||
import com.cf.imes.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = AdminUserApi.class)
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package com.cf.imes.module.manage.framework.rpc;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.manage.framework.security.config;
|
||||
|
||||
import com.cf.imes.framework.security.config.AuthorizeRequestsCustomizer;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
|
||||
/**
|
||||
* manage 模块的 Security 配置
|
||||
* @author there
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false, value = "manageSecurityConfiguration")
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Bean("manageAuthorizeRequestsCustomizer")
|
||||
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||
return new AuthorizeRequestsCustomizer() {
|
||||
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// Swagger 接口文档
|
||||
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
|
||||
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
|
||||
// Spring Boot Actuator 的安全配置
|
||||
registry.antMatchers("/actuator").anonymous()
|
||||
.antMatchers("/actuator/**").anonymous();
|
||||
// Druid 监控
|
||||
registry.antMatchers("/druid/**").anonymous();
|
||||
|
||||
// RPC 服务的安全配置
|
||||
registry.antMatchers("/rpc-api/manage/**").permitAll();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package com.cf.imes.module.manage.framework.security.core;
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.cf.imes.module.manage.service.plate;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateImportExcelVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateImportRespVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlatePageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 板材信息表 plate_{N} Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface PlateService {
|
||||
|
||||
/**
|
||||
* 创建板材信息表 plate_{N}
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPlate(@Valid PlateSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新板材信息表 plate_{N}
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePlate(@Valid PlateSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除板材信息表 plate_{N}
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlate(Long id);
|
||||
|
||||
/**
|
||||
* 获得板材信息表 plate_{N}
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 板材信息表 plate_{N}
|
||||
*/
|
||||
PlateDO getPlate(Long id);
|
||||
|
||||
/**
|
||||
* 获得板材信息表 plate_{N}分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 板材信息表 plate_{N}分页
|
||||
*/
|
||||
PageResult<PlateDO> getPlatePage(PlatePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 批量导入用户
|
||||
*
|
||||
* @param importUsers 导入用户列表
|
||||
* @param isUpdateSupport 是否支持更新
|
||||
* @return 导入结果
|
||||
*/
|
||||
PlateImportRespVO importPlateList(List<PlateImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package com.cf.imes.module.manage.service.plate;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateImportExcelVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateImportRespVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlatePageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateSaveReqVO;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.cf.imes.module.manage.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.manage.dal.mysql.plate.PlateMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 板材信息表 plate_{N} Service 实现类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
@Override
|
||||
public Long createPlate(PlateSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PlateDO plate = BeanUtils.toBean(createReqVO, PlateDO.class);
|
||||
plateMapper.insert(plate);
|
||||
// 返回
|
||||
return plate.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlate(PlateSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlateExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlateDO updateObj = BeanUtils.toBean(updateReqVO, PlateDO.class);
|
||||
plateMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlate(Long id) {
|
||||
// 校验存在
|
||||
validatePlateExists(id);
|
||||
// 删除
|
||||
plateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePlateExists(Long id) {
|
||||
if (plateMapper.selectById(id) == null) {
|
||||
throw exception(PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlateDO getPlate(Long id) {
|
||||
return plateMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlateDO> getPlatePage(PlatePageReqVO pageReqVO) {
|
||||
return plateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
private void validatePlateForCreateOrUpdate(PlateImportExcelVO importPlate) {
|
||||
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||
DataPermissionUtils.executeIgnore(() -> {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public PlateImportRespVO importPlateList(List<PlateImportExcelVO> importPlates, boolean isUpdateSupport) {
|
||||
if (CollUtil.isEmpty(importPlates)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.PLATE_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlateNames(new ArrayList<>())
|
||||
.updatePlateNames(new ArrayList<>()).failurePlateNames(new LinkedHashMap<>()).build();
|
||||
importPlates.forEach(importPlate -> {
|
||||
// 校验,判断是否有不符合的原因 校验全部是否为空
|
||||
try {
|
||||
validatePlateForCreateOrUpdate(importPlate);
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailurePlateNames().put(importPlate.getGoodsName() , ex.getMessage());
|
||||
return;
|
||||
}
|
||||
// 判断如果不存在,在进行插入
|
||||
PlateDO existPlate = plateMapper.selectByGoodID(importPlate.getGoodsId());
|
||||
if (existPlate == null) {
|
||||
plateMapper.insert(BeanUtils.toBean(importPlate, PlateDO.class));
|
||||
respVO.getCreatePlateNames().add(importPlate.getGoodsName());
|
||||
return;
|
||||
}
|
||||
// 如果存在,判断是否允许更新
|
||||
if (!isUpdateSupport) {
|
||||
respVO.getFailurePlateNames().put(importPlate.getGoodsName(), ErrorCodeConstants.PLATE_EXISTS.getMsg());
|
||||
return;
|
||||
}
|
||||
PlateDO updateUser = BeanUtils.toBean(importPlate, PlateDO.class);
|
||||
updateUser.setId(existPlate.getId());
|
||||
plateMapper.updateById(updateUser);
|
||||
respVO.getUpdatePlateNames().add(importPlate.getGoodsName());
|
||||
});
|
||||
return respVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.cf.imes.module.manage.service.remainplaten;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface RemainPlateService {
|
||||
|
||||
/**
|
||||
* 创建生产单余料板表 order_remain_plate_{N}
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产单余料板表 order_remain_plate_{N}
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRemainPlate(@Valid RemainPlateSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生产单余料板表 order_remain_plate_{N}
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRemainPlate(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产单余料板表 order_remain_plate_{N}
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产单余料板表 order_remain_plate_{N}
|
||||
*/
|
||||
RemainPlateDO getRemainPlate(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产单余料板表 order_remain_plate_{N}分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生产单余料板表 order_remain_plate_{N}分页
|
||||
*/
|
||||
PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.cf.imes.module.manage.service.remainplaten;
|
||||
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.manage.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} Service 实现类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
|
||||
@Resource
|
||||
private RemainPlateMapper remainPlateMapper;
|
||||
|
||||
@Override
|
||||
public Long createRemainPlate(RemainPlateSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class);
|
||||
remainPlateMapper.insert(remainPlate);
|
||||
// 返回
|
||||
return remainPlate.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRemainPlate(RemainPlateSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRemainPlateExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RemainPlateDO updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class);
|
||||
remainPlateMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRemainPlate(Long id) {
|
||||
// 校验存在
|
||||
validateRemainPlateExists(id);
|
||||
// 删除
|
||||
remainPlateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRemainPlateExists(Long id) {
|
||||
if (remainPlateMapper.selectById(id) == null) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemainPlateDO getRemainPlate(Long id) {
|
||||
return remainPlateMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO) {
|
||||
return remainPlateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 5 # 初始连接数
|
||||
min-idle: 10 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
name: imes_base
|
||||
url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: root
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 192.168.1.205 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 1 # 数据库索引
|
||||
password: cf@2024 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||
rocketmq:
|
||||
name-server: 127.0.0.1:9876 # RocketMQ Namesrv
|
||||
|
||||
spring:
|
||||
# RabbitMQ 配置项,对应 RabbitProperties 配置类
|
||||
rabbitmq:
|
||||
host: 127.0.0.1 # RabbitMQ 服务的地址
|
||||
port: 5672 # RabbitMQ 服务的端口
|
||||
username: guest # RabbitMQ 服务的账号
|
||||
password: guest # RabbitMQ 服务的密码
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
# Spring Boot Admin Server 服务端的相关配置
|
||||
context-path: /admin # 配置 Spring
|
||||
|
||||
--- #################### 微信公众号、小程序相关配置 ####################
|
||||
wx:
|
||||
mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
|
||||
# app-id: wx041349c6f39b268b
|
||||
# secret: 5abee519483bc9f8cb37ce280e814bd0
|
||||
app-id: wx5b23ba7a5589ecbb # 测试号
|
||||
secret: 2a7b3b20c537e52e74afd395eb85f61f
|
||||
# 存储配置,解决 AccessToken 的跨节点的共享
|
||||
config-storage:
|
||||
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||
key-prefix: wx # Redis Key 的前缀
|
||||
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
|
||||
miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档
|
||||
# appid: wx62056c0d5e8db250
|
||||
# secret: 333ae72f41552af1e998fe1f54e1584a
|
||||
appid: wx63c280fe3248a3e7 # wenhualian的接口测试号
|
||||
secret: 6f270509224a7ae1296bbf1c8cb97aed
|
||||
config-storage:
|
||||
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||
key-prefix: wa # Redis Key 的前缀
|
||||
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
|
||||
|
||||
--- #################### 晨丰相关配置 ####################
|
||||
|
||||
# 晨丰配置项,设置当前项目所有自定义的配置
|
||||
chenfeng:
|
||||
xss:
|
||||
enable: false
|
||||
exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系
|
||||
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
||||
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||
pay:
|
||||
pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify
|
||||
pay-return-url: http://niubi.natapp1.cc/api/pay/order/return
|
||||
refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify
|
||||
demo: false # 开启演示模式
|
||||
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
DINGTALK: # 钉钉
|
||||
client-id: dingvrnreaje3yqvzhxg
|
||||
client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI
|
||||
ignore-check-redirect-uri: true
|
||||
WECHAT_ENTERPRISE: # 企业微信
|
||||
client-id: wwd411c69a39ad2e54
|
||||
client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw
|
||||
agent-id: 1000004
|
||||
ignore-check-redirect-uri: true
|
||||
WECHAT_MINI_APP: # 微信小程序
|
||||
client-id: ${wx.miniapp.appid}
|
||||
client-secret: ${wx.miniapp.secret}
|
||||
ignore-check-redirect-uri: true
|
||||
ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验
|
||||
WECHAT_MP: # 微信公众号
|
||||
client-id: ${wx.mp.app-id}
|
||||
client-secret: ${wx.mp.secret}
|
||||
ignore-check-redirect-uri: true
|
||||
ignore-check-state: true # 微信公众号,未调用后端的 getSocialAuthorizeUrl 方法,所以无法进行 state 校验 TODO 芋艿:后续考虑支持
|
||||
cache:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 1 # 初始连接数
|
||||
min-idle: 1 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
name: imes_base
|
||||
url: jdbc:mysql://192.168.1.205:3307/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
|
||||
username: root
|
||||
password: root
|
||||
# username: sa
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 0 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||
rocketmq:
|
||||
name-server: 127.0.0.1:9876 # RocketMQ Namesrv
|
||||
|
||||
spring:
|
||||
# RabbitMQ 配置项,对应 RabbitProperties 配置类
|
||||
rabbitmq:
|
||||
host: 127.0.0.1 # RabbitMQ 服务的地址
|
||||
port: 5672 # RabbitMQ 服务的端口
|
||||
username: guest # RabbitMQ 服务的账号
|
||||
password: guest # RabbitMQ 服务的密码
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
job:
|
||||
enabled: false # 是否开启调度中心,默认为 true 开启
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
# Spring Boot Admin Server 服务端的相关配置
|
||||
context-path: /admin # 配置 Spring
|
||||
|
||||
# 日志文件配置
|
||||
logging:
|
||||
level:
|
||||
# 配置自己写的 MyBatis Mapper 打印日志
|
||||
com.cf.imes.module.business.dal.mysql: debug
|
||||
com.cf.imes.module.business.dal.mysql.file.FileConfigMapper: INFO # 配置 FileConfigMapper 的日志级别为 info
|
||||
|
||||
--- #################### 晨丰相关配置 ####################
|
||||
|
||||
# 晨丰配置项,设置当前项目所有自定义的配置
|
||||
chenfeng:
|
||||
env: # 多环境的配置项
|
||||
tag: ${HOSTNAME}
|
||||
security:
|
||||
mock-enable: true
|
||||
xss:
|
||||
enable: false
|
||||
exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系
|
||||
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
||||
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
||||
access-log: # 访问日志的配置项
|
||||
enable: false
|
||||
error-code: # 错误码相关配置项
|
||||
enable: false
|
||||
demo: false # 关闭演示模式
|
||||
@@ -0,0 +1,164 @@
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
|
||||
|
||||
# Servlet 配置
|
||||
servlet:
|
||||
# 文件上传相关配置项
|
||||
multipart:
|
||||
max-file-size: 16MB # 单个文件大小
|
||||
max-request-size: 32MB # 设置总上传的文件大小
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类
|
||||
|
||||
# Jackson 配置项
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
|
||||
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
|
||||
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
|
||||
fail-on-empty-beans: false # 允许序列化无属性的 Bean
|
||||
|
||||
# Cache 配置项
|
||||
cache:
|
||||
type: REDIS
|
||||
redis:
|
||||
time-to-live: 1h # 设置过期时间为 1 小时
|
||||
|
||||
--- #################### 接口文档配置 ####################
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true # 1. 是否开启 Swagger 接文档的元数据
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
|
||||
path: /swagger-ui.html
|
||||
default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
|
||||
|
||||
knife4j:
|
||||
enable: true # 2.2 是否开启 Swagger 文档的 Knife4j UI 界面
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
global-config:
|
||||
db-config:
|
||||
worker-id: 0
|
||||
datacenter-id: 0
|
||||
id-type: ASSIGN_ID # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
||||
# id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库
|
||||
# id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
|
||||
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
type-aliases-package: ${chenfeng.info.base-package}.dal.dataobject
|
||||
encryptor:
|
||||
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||
mybatis-plus-join:
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
# Spring Data Redis 配置
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
||||
|
||||
--- #################### RPC 远程调用相关配置 ####################
|
||||
|
||||
--- #################### 消息队列相关 ####################
|
||||
|
||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||
rocketmq:
|
||||
# Producer 配置项
|
||||
producer:
|
||||
group: ${spring.application.name}_PRODUCER # 生产者分组
|
||||
|
||||
spring:
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
# Kafka Producer 配置项
|
||||
producer:
|
||||
acks: 1 # 0-不应答。1-leader 应答。all-所有 leader 和 follower 应答。
|
||||
retries: 3 # 发送失败时,重试发送的次数
|
||||
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer # 消息的 value 的序列化
|
||||
# Kafka Consumer 配置项
|
||||
consumer:
|
||||
auto-offset-reset: earliest # 设置消费者分组最初的消费进度为 earliest 。可参考博客 https://blog.csdn.net/lishuangzhe7047/article/details/74530417 理解
|
||||
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
|
||||
properties:
|
||||
spring.json.trusted.packages: '*'
|
||||
# Kafka Consumer Listener 监听器配置
|
||||
listener:
|
||||
missing-topics-fatal: false # 消费监听接口监听的主题不存在时,默认会报错。所以通过设置为 false ,解决报错
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
xxl:
|
||||
job:
|
||||
executor:
|
||||
appname: ${spring.application.name} # 执行器 AppName
|
||||
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
|
||||
accessToken: default_token # 执行器通讯TOKEN
|
||||
|
||||
--- #################### 验证码相关配置 ####################
|
||||
|
||||
aj:
|
||||
captcha:
|
||||
jigsaw: classpath:images/jigsaw # 滑动验证,底图路径,不配置将使用默认图片;以 classpath: 开头,取 resource 目录下路径
|
||||
pic-click: classpath:images/pic-click # 滑动验证,底图路径,不配置将使用默认图片;以 classpath: 开头,取 resource 目录下路径
|
||||
cache-type: redis # 缓存 local/redis...
|
||||
cache-number: 1000 # local 缓存的阈值,达到这个值,清除缓存
|
||||
timing-clear: 180 # local定时清除过期缓存(单位秒),设置为0代表不执行
|
||||
type: blockPuzzle # 验证码类型 default两种都实例化。 blockPuzzle 滑块拼图 clickWord 文字点选
|
||||
water-mark: 晨丰科技 # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 Unicode,Linux 可能需要转 unicode
|
||||
interference-options: 0 # 滑动干扰项(0/1/2)
|
||||
req-frequency-limit-enable: false # 接口请求次数一分钟限制是否开启 true|false
|
||||
req-get-lock-limit: 5 # 验证失败5次,get接口锁定
|
||||
req-get-lock-seconds: 10 # 验证失败后,锁定时间间隔
|
||||
req-get-minute-limit: 30 # get 接口一分钟内请求数限制
|
||||
req-check-minute-limit: 60 # check 接口一分钟内请求数限制
|
||||
req-verify-minute-limit: 60 # verify 接口一分钟内请求数限制
|
||||
|
||||
--- #################### 晨丰相关配置 ####################
|
||||
|
||||
chenfeng:
|
||||
dynamicDataSource:
|
||||
enabled: true
|
||||
info:
|
||||
version: 1.0.0
|
||||
base-package: com.cf.imes.module.manage
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.chenfeng.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
swagger:
|
||||
title: 生产单管理
|
||||
description: 提供生产单管理的所有功能
|
||||
version: ${chenfeng.info.version}
|
||||
base-package: ${chenfeng.info.base-package}
|
||||
captcha:
|
||||
enable: true # 验证码的开关,默认为 true;
|
||||
error-code: # 错误码相关配置项
|
||||
constants-class-list:
|
||||
- com.cf.imes.module.manage.enums.ErrorCodeConstants
|
||||
organ: # 多组织相关配置项
|
||||
enable: true
|
||||
ignore-urls:
|
||||
- /admin-api/manage/test
|
||||
ignore-tables:
|
||||
- test
|
||||
sms-code: # 短信验证码相关的配置项
|
||||
expire-times: 10m
|
||||
send-frequency: 1m
|
||||
send-maximum-quantity-per-day: 10
|
||||
begin-code: 9999 # 这里配置 9999 的原因是,测试方便。
|
||||
end-code: 9999 # 这里配置 9999 的原因是,测试方便。
|
||||
|
||||
debug: false
|
||||
@@ -0,0 +1,25 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 192.168.1.205:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
discovery:
|
||||
#namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 192.168.1.205:8848 # Nacos 服务器地址
|
||||
namespace: dev # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
discovery:
|
||||
# namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||
namespace: dev # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
||||
@@ -0,0 +1,14 @@
|
||||
spring:
|
||||
application:
|
||||
name: manage-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
server:
|
||||
port: 48083
|
||||
|
||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
||||
logging:
|
||||
file:
|
||||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
||||
@@ -0,0 +1,76 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 chenfeng.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="chenfeng.info.base-package" source="chenfeng.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件 Appender -->
|
||||
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
<!-- 日志文件名 -->
|
||||
<file>${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 滚动后的日志文件名 -->
|
||||
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||
<!-- 日志文件的保留天数 -->
|
||||
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- 异步写入日志,提升性能 -->
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||
<queueSize>256</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地环境 -->
|
||||
<springProfile name="local">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>cf-module-prod-manage-api</module>
|
||||
<module>cf-module-prod-manage-biz</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>cf-module-prod-manage</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<description>
|
||||
manage 模块下,我们放生产单管理业务
|
||||
</description>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user