Merge branch 'main' into 'LiuZt'

# Conflicts:
#   cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java
#   cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessGroupService.java
#   cf-module-system/cf-module-system-biz/src/test/java/com/cf/imes/module/system/service/process/GroupServiceImplTest.java
This commit is contained in:
刘照田
2024-04-26 09:03:38 +00:00
496 changed files with 25208 additions and 7444 deletions
+1
View File
@@ -21,6 +21,7 @@ target/
*.iml
*.ipr
*.class
*.json
target/*
### NetBeans ###
@@ -26,6 +26,7 @@ public interface GlobalErrorCodeConstants {
ErrorCode LOCKED = new ErrorCode(423, "请求失败,请稍后重试"); // 并发请求,不允许
ErrorCode TOO_MANY_REQUESTS = new ErrorCode(429, "请求过于频繁,请稍后重试");
ErrorCode DATA_SOURCE_CODE_NOT_FOUND = new ErrorCode(430, "未传递数据源标识");
ErrorCode ORGAN_ID_NOT_FOUND = new ErrorCode(431, "未传组织标识");
// ========== 服务端错误段 ==========
@@ -65,7 +65,8 @@ public class OrganSecurityWebFilter extends ApiRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
Long organId = OrganContextHolder.getOrganId();
Long organId = WebFrameworkUtils.getOrganId(request);
//Long organId = OrganContextHolder.getOrganId();
boolean isRpcRequest = WebFrameworkUtils.isRpcRequest(request);
// 1. 登陆的用户,校验是否有权限访问该组织,避免越权问题。
LoginUser user = SecurityFrameworkUtils.getLoginUser();
@@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
@@ -19,12 +18,12 @@ public class ESDocument {
public String id;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date createTime;
private Long creator;
private String createTime;
private String creator;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date updateTime;
private Long updater;
private String updateTime;
private String updater;
private Long organId;
}
@@ -56,7 +56,7 @@ public interface ESDocumentService {
* @param documents 要增加的对象集合
* @return 批量操作的结果
*/
<T> BulkResponse bulkCreate(String idxName, List<T> documents) throws Exception;
<T> BulkResponse bulkCreate(String idxName, List<?extends ESDocument> documents) throws Exception;
/**
@@ -15,6 +15,11 @@ import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import java.io.IOException;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -23,7 +28,7 @@ import java.util.function.BiConsumer;
/**
* @author there
*/
public class ESDocumentServiceImpl implements ESDocumentService{
public class ESDocumentServiceImpl implements ESDocumentService {
//同步客户端
private final ElasticsearchClient elasticsearchClient;
@@ -32,20 +37,23 @@ public class ESDocumentServiceImpl implements ESDocumentService{
private Snowflake snowflake = IdUtil.getSnowflake();
public ESDocumentServiceImpl (ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public ESDocumentServiceImpl(ElasticsearchClient elasticsearchClient, ElasticsearchAsyncClient elasticsearchAsyncClient) {
this.elasticsearchClient = elasticsearchClient;
this.elasticsearchAsyncClient = elasticsearchAsyncClient;
}
@Override
public <T> IndexResponse createByFluentDSL(String idxName, String idxId, ESDocument document) throws Exception {
Date date = new Date();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
document.setCreator(loginUser.getId());
document.setUpdater(loginUser.getId());
document.setCreator(loginUser.getNickname());
document.setUpdater(loginUser.getNickname());
document.setOrganId(loginUser.getOrganId());
document.setCreateTime(new Date());
document.setUpdateTime(new Date());
if(StrUtil.isBlank(document.getId())) {
document.setCreateTime(simpleDateFormat.format(date));
document.setUpdateTime(simpleDateFormat.format(date));
if (StrUtil.isBlank(document.getId())) {
document.setId(snowflake.nextIdStr());
}
return elasticsearchClient.index(idx -> idx
@@ -56,21 +64,23 @@ public class ESDocumentServiceImpl implements ESDocumentService{
/**
* BuilderPattern 方式创建文档
* @param idxName 索引名
* @param idxId 索引id
*
* @param idxName 索引
* @param idxId 索引id
* @param document 文档对象
*/
@Override
public <T> IndexResponse createByBuilderPattern(String idxName, String idxId, ESDocument document) throws Exception {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
document.setCreator(loginUser.getId());
document.setUpdater(loginUser.getId());
Date date = new Date();
document.setCreator(loginUser.getNickname());
document.setUpdater(loginUser.getNickname());
document.setOrganId(loginUser.getOrganId());
document.setCreateTime(new Date());
document.setUpdateTime(new Date());
document.setCreateTime(simpleDateFormat.format(date));
document.setUpdateTime(simpleDateFormat.format(date));
IndexRequest.Builder<Object> indexReqBuilder = new IndexRequest.Builder<>();
indexReqBuilder.index(idxName);
if(StrUtil.isBlank(idxId)) {
if (StrUtil.isBlank(idxId)) {
idxId = snowflake.nextIdStr();
}
indexReqBuilder.id(idxId);
@@ -80,13 +90,14 @@ public class ESDocumentServiceImpl implements ESDocumentService{
/**
* json方式创建文档
* @param idxName 索引名
* @param idxId 索引id
*
* @param idxName 索引
* @param idxId 索引id
* @param jsonContent json字符串
*/
@Override
public IndexResponse createByJson(String idxName, String idxId, String jsonContent) throws Exception {
if(StrUtil.isBlank(idxId)) {
if (StrUtil.isBlank(idxId)) {
idxId = snowflake.nextIdStr();
}
String finalIdxId = idxId;
@@ -98,11 +109,12 @@ public class ESDocumentServiceImpl implements ESDocumentService{
}
/**
* 异步方式创建文档
* @param idxName 索引名
* @param idxId 索引id
* 异步方式创建文档
*
* @param idxName 索引
* @param idxId 索引id
* @param document 文档
* @param action 操作
* @param action 操作
*/
@Override
public <T> void createAsync(String idxName, String idxId, T document, BiConsumer<IndexResponse, Throwable> action) {
@@ -115,51 +127,57 @@ public class ESDocumentServiceImpl implements ESDocumentService{
/**
* 批量方式创建文档
* @param idxName 索引名
*
* @param idxName 索引名
* @param documents 要增加的对象集合
*/
@Override
public <T> BulkResponse bulkCreate(String idxName, List<T> documents) throws Exception {
public <T> BulkResponse bulkCreate(String idxName, List<? extends ESDocument> documents) throws Exception {
BulkRequest.Builder br = new BulkRequest.Builder();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
documents.forEach(document ->{
ESDocument esDocument = (ESDocument) document;
if(StrUtil.isBlank(esDocument.getId())) {
Date date = new Date();
LocalDateTime now = LocalDateTime.now();
documents.forEach(esDocument -> {
if (StrUtil.isBlank(esDocument.getId())) {
esDocument.setId(snowflake.nextIdStr());
}
esDocument.setUpdater(loginUser.getId());
esDocument.setUpdateTime(new Date());
esDocument.setCreator(loginUser.getNickname());
esDocument.setCreateTime(simpleDateFormat.format(date));
esDocument.setUpdater(loginUser.getNickname());
esDocument.setUpdateTime(simpleDateFormat.format(date));
br.operations(op -> op.index(idx -> idx
.index(idxName)
.id(esDocument.getId().toString())
.id(esDocument.getId())
.document(esDocument)));
});
return elasticsearchClient.bulk(br.build());
return elasticsearchClient.bulk(br.build());
}
/**
*
* @param idxName 索引名称
* @param docId 文档id
* @param tClass 返回的类型
* @param map 修改内容的map
* Map<String, Object> map = new HashMap<>();
* map.put("age", 35);
* 把年龄改成35
* @param docId 文档id
* @param tClass 返回的类型
* @param map 修改内容的map
* Map<String, Object> map = new HashMap<>();
* map.put("age", 35);
* 把年龄改成35
*/
@Override
public <T> Result updateById(String idxName, String docId, Class<T> tClass, Map<String,Object> map) throws IOException {
public <T> Result updateById(String idxName, String docId, Class<T> tClass, Map<String, Object> map) throws IOException {
UpdateResponse<T> response = elasticsearchClient.update(e -> e.index(idxName).id(docId).doc(map), tClass);
return response.result();
}
/**
* 文档id查询信息
*
* @param idxName 索引名
* @param docId 文档id
* @param docId 文档id
*/
@Override
public <T> T getById(String idxName, String docId,Class<T> tClass) throws IOException {
public <T> T getById(String idxName, String docId, Class<T> tClass) throws IOException {
GetResponse<T> response = elasticsearchClient.get(g -> g
.index(idxName)
.id(docId),
@@ -169,8 +187,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
/**
* 根据索引名称和文档id查询ObjectNode
*
* @param idxName 索引名
* @param docId 文档id
* @param docId 文档id
*/
@Override
public JSONObject getObjectNodeById(String idxName, String docId) throws IOException {
@@ -184,8 +203,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
/**
* 单条输出
*
* @param idxName 索引名
* @param docId 文档id
* @param docId 文档id
*/
@Override
public Boolean deleteById(String idxName, String docId) throws IOException {
@@ -197,8 +217,9 @@ public class ESDocumentServiceImpl implements ESDocumentService{
/**
* 批量删除
*
* @param idxName 索引名
* @param docIds 要删除的文档id集合
* @param docIds 要删除的文档id集合
*/
@Override
public BulkResponse bulkDeleteByIds(String idxName, List<String> docIds) throws Exception {
@@ -32,14 +32,15 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
baseDO.setUpdateTime(current);
}
Long userId = WebFrameworkUtils.getLoginUserId();
//Long userId = WebFrameworkUtils.getLoginUserId();
String loginUserName = WebFrameworkUtils.getLoginUserName();
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
baseDO.setCreator(userId.toString());
if (Objects.nonNull(loginUserName) && Objects.isNull(baseDO.getCreator())) {
baseDO.setCreator(loginUserName);
}
// 当前登录用户不为空,更新人为空,则当前登录用户为更新人
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getUpdater())) {
baseDO.setUpdater(userId.toString());
if (Objects.nonNull(loginUserName) && Objects.isNull(baseDO.getUpdater())) {
baseDO.setUpdater(loginUserName);
}
}
}
@@ -54,9 +55,10 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
// 当前登录用户不为空,更新人为空,则当前登录用户为更新人
Object modifier = getFieldValByName("updater", metaObject);
Long userId = WebFrameworkUtils.getLoginUserId();
if (Objects.nonNull(userId) && Objects.isNull(modifier)) {
setFieldValByName("updater", userId.toString(), metaObject);
//Long userId = WebFrameworkUtils.getLoginUserId();
String loginUserName = WebFrameworkUtils.getLoginUserName();
if (Objects.nonNull(loginUserName) && Objects.isNull(modifier)) {
setFieldValByName("updater", loginUserName, metaObject);
}
}
}
@@ -132,4 +132,16 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
return this;
}
@Override
public LambdaQueryWrapperX<T> or(boolean condition) {
super.or(condition);
return this;
}
@Override
public LambdaQueryWrapperX<T> or() {
super.or();
return this;
}
}
@@ -19,6 +19,8 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.security.web.firewall.DefaultHttpFirewall;
import org.springframework.security.web.firewall.HttpFirewall;
import javax.annotation.Resource;
@@ -100,4 +102,10 @@ public class ChenfengSecurityAutoConfiguration {
return methodInvokingFactoryBean;
}
@Bean
public HttpFirewall httpFirewall() {
return new DefaultHttpFirewall();
}
}
@@ -75,4 +75,8 @@ public class LoginUser {
* 数据源编码
*/
private String dataCode;
/**
* 用户昵称
*/
private String nickname;
}
@@ -23,6 +23,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
/**
* Token 过滤器,验证 token 的有效性
@@ -92,10 +94,10 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
&& ObjectUtil.notEqual(accessToken.getUserType(), userType)) {
throw new AccessDeniedException("错误的用户类型");
}
CommonResult<Boolean> superAdmin = permissionApi.hasAnyRoles(accessToken.getUserId(), "super_admin");
//CommonResult<Boolean> superAdmin = permissionApi.hasAnyRoles(accessToken.getUserId(), "super_admin");
// 构建登录用户
return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType())
.setOrganId(accessToken.getOrganId()).setScopes(accessToken.getScopes()).setIsSupAdmin(superAdmin.getCheckedData())
.setOrganId(accessToken.getOrganId()).setScopes(accessToken.getScopes()).setIsSupAdmin(accessToken.getIsSupAdmin())
.setLarge(accessToken.getLarge()).setDbNo(accessToken.getDbNo()).setTableNo(accessToken.getTableNo());
} catch (ServiceException serviceException) {
// 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可
@@ -131,8 +133,9 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
String loginUserStr = request.getHeader(SecurityFrameworkUtils.LOGIN_USER_HEADER);
if(StrUtil.isNotEmpty(loginUserStr)) {
LoginUser loginUser = JsonUtils.parseObject(loginUserStr, LoginUser.class);
CommonResult<Boolean> superAdmin = permissionApi.hasAnyRoles(loginUser.getId(), "super_admin");
loginUser.setIsSupAdmin(superAdmin.getCheckedData());
//CommonResult<Boolean> superAdmin = permissionApi.hasAnyRoles(loginUser.getId(), "super_admin");
//loginUser.setIsSupAdmin(superAdmin.getCheckedData());
loginUser.setNickname(URLDecoder.decode(loginUser.getNickname(),StandardCharsets.UTF_8));
return loginUser;
}
return null;
@@ -41,6 +41,16 @@ public interface SecurityFrameworkService {
*/
boolean hasAnyRoles(String... roles);
/**
* 判断是否有角色,任一一个即可
*
* @param userId 用户id
* @param roles 角色数组
* @return 是否
*/
boolean hasAnyRoles(Long userId, String... roles);
/**
* 判断是否有授权
*
@@ -48,7 +48,8 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService {
@Override
public Boolean load(KeyValue<Long, List<String>> key) {
return permissionApi.hasAnyPermissions(key.getKey(), key.getValue().toArray(new String[0])).getCheckedData();
Boolean checkedData = permissionApi.hasAnyPermissions(key.getKey(), key.getValue().toArray(new String[0])).getCheckedData();
return checkedData;
}
});
@@ -75,6 +76,12 @@ public class SecurityFrameworkServiceImpl implements SecurityFrameworkService {
return hasAnyRolesCache.get(new KeyValue<>(SecurityFrameworkUtils.getLoginUserId(), Arrays.asList(roles)));
}
@Override
@SneakyThrows
public boolean hasAnyRoles(Long userId, String... roles) {
return hasAnyRolesCache.get(new KeyValue<>(userId, Arrays.asList(roles)));
}
@Override
public boolean hasScope(String scope) {
return hasAnyScopes(scope);
@@ -106,6 +106,7 @@ public class SecurityFrameworkUtils {
// 原因是,Spring Security 的 Filter 在 ApiAccessLogFilter 后面,在它记录访问日志时,线上上下文已经没有用户编号等信息
WebFrameworkUtils.setLoginUserId(request, loginUser.getId());
WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType());
WebFrameworkUtils.setLoginUserName(request, loginUser.getNickname());
}
private static Authentication buildAuthentication(LoginUser loginUser, HttpServletRequest request) {
@@ -19,7 +19,7 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta
*/
public class DataSourceFilter extends OncePerRequestFilter {
//数据源编码
private static final String DATA_SOURCE_CODE = "dataCode";
private static final String DATA_SOURCE_CODE = "data-code";
private WebProperties webProperties;
@@ -36,12 +36,12 @@ public class DataSourceFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
String dataSourceCode = request.getHeader(DATA_SOURCE_CODE);
if(StrUtil.isBlank(dataSourceCode)) {
String dataCode = request.getHeader(DATA_SOURCE_CODE);
if(StrUtil.isEmpty(dataCode)) {
ServletUtils.writeJSON(response, CommonResult.error(DATA_SOURCE_CODE_NOT_FOUND));
return;
}
DynamicDataSourceContextHolder.push(dataSourceCode);
DynamicDataSourceContextHolder.push(dataCode);
filterChain.doFilter(request, response);
DynamicDataSourceContextHolder.clear();
}
@@ -87,6 +87,7 @@ public class GlobalExceptionHandler {
return serviceExceptionHandler((ServiceException) ex);
}
if (ex instanceof AccessDeniedException) {
ex.printStackTrace();
return accessDeniedExceptionHandler(request, (AccessDeniedException) ex);
}
return defaultExceptionHandler(request, ex);
@@ -25,6 +25,8 @@ public class WebFrameworkUtils {
private static final String REQUEST_ATTRIBUTE_COMMON_RESULT = "common_result";
private static final String REQUEST_ATTRIBUTE_LOGIN_USER_NAME = "login-user-name";
public static final String HEADER_ORGAN_ID = "organ-id";
/**
@@ -56,6 +58,10 @@ public class WebFrameworkUtils {
request.setAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_ID, userId);
}
public static void setLoginUserName(ServletRequest request, String nickname) {
request.setAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_NAME, nickname);
}
/**
* 设置用户类型
*
@@ -80,6 +86,20 @@ public class WebFrameworkUtils {
return (Long) request.getAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_ID);
}
/**
* 获得当前用户的昵称,从请求中
* 注意:该方法仅限于 framework 框架使用!!!
*
* @param request 请求
* @return 用户编号
*/
private static String getLoginUserName(HttpServletRequest request) {
if (request == null) {
return null;
}
return (String) request.getAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_NAME);
}
/**
* 获得当前用户的类型
* 注意:该方法仅限于 web 相关的 framework 组件使用!!!
@@ -116,6 +136,12 @@ public class WebFrameworkUtils {
return getLoginUserId(request);
}
public static String getLoginUserName() {
HttpServletRequest request = getRequest();
return getLoginUserName(request);
}
public static Integer getTerminal() {
HttpServletRequest request = getRequest();
if (request == null) {
@@ -46,5 +46,13 @@ public class LoginUser {
* 数据源编码
*/
private String dataCode;
/**
* 用户nic
*/
private String nickname;
/**
* 是否超级管理员
*/
private Boolean isSupAdmin;
}
@@ -22,7 +22,11 @@ import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
@@ -70,6 +74,14 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
});
private final LoadingCache<String, Long> organIdCache = CacheUtils.buildAsyncReloadingCache(Duration.ofMinutes(1L), // 过期时间 1 分钟
new CacheLoader<>() {
@Override
public Long load(String token) {
return getOrganIdByToken(token).block();
}
});
public TokenAuthenticationFilter(ReactorLoadBalancerExchangeFilterFunction lbFunction) {
// Q:为什么不使用 OAuth2TokenApi 进行调用?
// A1Spring Cloud OpenFeign 官方未内置 Reactive 的支持 https://docs.spring.io/spring-cloud-openfeign/docs/current/reference/html/#reactive-support
@@ -101,12 +113,14 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
SecurityFrameworkUtils.setLoginUser(exchange, user);
// 2.2 将 user 并设置到 login-user 的请求头,使用 json 存储值
ServerWebExchange newExchange = exchange.mutate()
.request(builder -> SecurityFrameworkUtils.setLoginUserHeader(builder, user)).build();
.request(builder -> SecurityFrameworkUtils.setLoginUserHeader(builder, user))
.build();
return chain.filter(newExchange);
});
}
private Mono<LoginUser> getLoginUser(ServerWebExchange exchange, String token) {
//Long organId = organIdCache.getIfPresent(token);
// 从缓存中,获取 LoginUser
Long organId = WebFrameworkUtils.getOrganId(exchange);
KeyValue<Long, String> cacheKey = new KeyValue<Long, String>().setKey(organId).setValue(token);
@@ -130,10 +144,17 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
private Mono<String> checkAccessToken(Long organId, String token) {
return webClient.get()
.uri(OAuth2TokenApi.URL_CHECK, uriBuilder -> uriBuilder.queryParam("accessToken", token).build())
.headers(httpHeaders -> WebFrameworkUtils.setOrganIdHeader(organId, httpHeaders)) // 设置组织的 Header
// .headers(httpHeaders -> WebFrameworkUtils.setOrganIdHeader(organId, httpHeaders)) // 设置组织的 Header
.retrieve().bodyToMono(String.class);
}
private Mono<Long> getOrganIdByToken(String token) {
return webClient.get()
.uri(OAuth2TokenApi.URL_ORGAN, uriBuilder -> uriBuilder.queryParam("accessToken", token).build())
.retrieve()
.bodyToMono(Long.class);
}
private LoginUser buildUser(String body) {
// 处理结果,结果不正确
CommonResult<OAuth2AccessTokenCheckRespDTO> result = JsonUtils.parseObject(body, CHECK_RESULT_TYPE_REFERENCE);
@@ -152,7 +173,9 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
OAuth2AccessTokenCheckRespDTO tokenInfo = result.getData();
return new LoginUser().setId(tokenInfo.getUserId()).setUserType(tokenInfo.getUserType())
.setOrganId(tokenInfo.getOrganId()).setScopes(tokenInfo.getScopes())
.setLarge(tokenInfo.getLarge()).setDbNo(tokenInfo.getDbNo()).setTableNo(tokenInfo.getTableNo());
.setLarge(tokenInfo.getLarge()).setDbNo(tokenInfo.getDbNo()).setTableNo(tokenInfo.getTableNo())
.setDataCode(tokenInfo.getDataCode()).setIsSupAdmin(tokenInfo.getIsSupAdmin())
.setNickname(URLEncoder.encode(tokenInfo.getNickname(), StandardCharsets.UTF_8));
}
@Override
@@ -24,6 +24,8 @@ public class SecurityFrameworkUtils {
private static final String LOGIN_USER_ID_ATTR = "login-user-id";
private static final String LOGIN_USER_TYPE_ATTR = "login-user-type";
private static final String DATA_CODE = "data-code";
private static final String ORGAN_ID = "organ-id";
private SecurityFrameworkUtils() {}
@@ -101,6 +103,12 @@ public class SecurityFrameworkUtils {
*/
public static void setLoginUserHeader(ServerHttpRequest.Builder builder, LoginUser user) {
builder.header(LOGIN_USER_HEADER, JsonUtils.toJsonString(user));
builder.header(DATA_CODE, user.getDataCode());
builder.header(ORGAN_ID, user.getOrganId().toString());
}
public static void setOrganHeader(ServerHttpRequest.Builder builder, LoginUser user) {
builder.header(ORGAN_ID, user.getOrganId().toString());
}
}
@@ -3,9 +3,11 @@ package com.cf.imes.module.infra.api.file;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
import com.cf.imes.module.infra.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@@ -57,4 +59,9 @@ public interface FileApi {
@Operation(summary = "保存文件,并返回文件的访问路径")
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
@DeleteMapping(PREFIX + "/deleteFileByPath")
@Operation(summary = "根据文件地址删除文件")
@Parameter(name = "path", description = "文件地址", example = "url", required = true)
CommonResult<Boolean> deleteFileByPath(String path);
}
@@ -31,6 +31,7 @@ public interface ErrorCodeConstants {
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1_001_003_000, "文件路径已存在");
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1_001_003_001, "文件不存在");
ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空");
ErrorCode FILE_REMOVE_FAIL = new ErrorCode(1_001_003_003, "文件删除失败");
// ========== 代码生成器 1-001-004-000 ==========
ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_003_001_000, "表定义已经存在");
@@ -23,4 +23,9 @@ public class FileApiImpl implements FileApi {
createReqDTO.getContent()));
}
@Override
public CommonResult<Boolean> deleteFileByPath(String path) {
return success(fileService.deleteFileByPath(path));
}
}
@@ -63,6 +63,7 @@ public class FileController {
@PermitAll
@Operation(summary = "下载文件")
@Parameter(name = "configId", description = "配置编号", required = true)
@OperateLog(enable = false)
public void getFileContent(HttpServletRequest request,
HttpServletResponse response,
@PathVariable("configId") Long configId) throws Exception {
@@ -4,6 +4,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.module.infra.service.logger.ApiAccessLogService;
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -30,11 +31,12 @@ public class AccessLogCleanJob {
*/
private static final Integer DELETE_LIMIT = 100;
/* @XxlJob("accessLogCleanJob")
/* @XxlJob("accessLogCleanJob")*/
@OrganIgnore
/* @Scheduled(cron = "0 0 * * * ?")*/
public void execute() {
Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT);
log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count);
}*/
}
}
@@ -4,6 +4,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.module.infra.service.logger.ApiErrorLogService;
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -30,11 +31,12 @@ public class ErrorLogCleanJob {
*/
private static final Integer DELETE_LIMIT = 100;
/* @XxlJob("errorLogCleanJob")
/*@XxlJob("errorLogCleanJob")*/
@OrganIgnore
/*@Scheduled(cron = "0 0 2 * * ?")*/
public void execute() {
Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT);
log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count);
}*/
}
}
@@ -45,4 +45,10 @@ public interface FileService {
*/
byte[] getFileContent(Long configId, String path) throws Exception;
/**
* 删除文件
* @param path 文件地址
* @return
*/
Boolean deleteFileByPath(String path);
}
@@ -6,6 +6,7 @@ import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.io.FileUtils;
import com.cf.imes.framework.file.core.client.FileClient;
import com.cf.imes.framework.file.core.utils.FileTypeUtils;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.infra.controller.admin.file.vo.file.FilePageReqVO;
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
import com.cf.imes.module.infra.dal.mysql.file.FileMapper;
@@ -14,8 +15,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Objects;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_REMOVE_FAIL;
/**
* 文件 Service 实现类
@@ -95,4 +99,25 @@ public class FileServiceImpl implements FileService {
return client.getContent(path);
}
@Override
public Boolean deleteFileByPath(String path) {
// 校验存在
FileDO fileDO = fileMapper.selectOne(new LambdaQueryWrapperX<FileDO>().eq(FileDO::getPath, path));
if(Objects.isNull(fileDO)) {
throw exception(FILE_NOT_EXISTS);
}
// 从文件存储器中删除
FileClient client = fileConfigService.getFileClient(fileDO.getConfigId());
Assert.notNull(client, "客户端({}) 不能为空", fileDO.getConfigId());
try {
client.delete(path);
} catch (Exception e) {
throw exception(FILE_REMOVE_FAIL);
}
// 删除记录
fileMapper.deleteById(fileDO.getId());
return Boolean.TRUE;
}
}
@@ -29,7 +29,11 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
@Override
public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
apiAccessLogMapper.insert(apiAccessLog);
try {
apiAccessLogMapper.insert(apiAccessLog);
}catch (Exception e) {
log.error("插入API 访问日志发生异常,异常信息{},日志内容{}", e.getMessage(), apiAccessLog);
}
}
@Override
@@ -35,7 +35,11 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
apiErrorLogMapper.insert(apiErrorLog);
try {
apiErrorLogMapper.insert(apiErrorLog);
}catch (Exception e) {
log.error("插入系统异常日志发生异常,异常信息{},日志内容{}",e.getMessage(), apiErrorLog);
}
}
@Override
@@ -11,6 +11,10 @@ public interface ErrorCodeConstants {
// ========== 生产单开料排单
ErrorCode PLAN_NOT_EXISTS = new ErrorCode(1_001_107_000, "生产单开料排单不存在");
ErrorCode PLAN_NOT_ALLOW_DELETE = new ErrorCode(1_001_107_001, "排单 开料中 已开料 不予许删除");
ErrorCode PLAN_NOT_ALLOW_CANCEL = new ErrorCode(1_001_107_002, "排单 新单 不予许作废");
// ========== 生产单商品 TODO 补充编号 ==========
ErrorCode GOODS_NOT_EXISTS = new ErrorCode(1_001_108_000, "生产单商品不存在");
@@ -35,4 +39,14 @@ public interface ErrorCodeConstants {
// ========== 生产单 TODO 补充编号 ==========
ErrorCode ORDER_PARTS_NOT_EXISTS = new ErrorCode(1_001_115_000, "生产单配件不存在");
// ========== 生产单 TODO 补充编号 ==========
ErrorCode PHONE_NOT_LAWFUL = new ErrorCode(1_001_116_000, "手机号不合法");
ErrorCode CUSTOM_ORDER_EXISTS = new ErrorCode(1_001_117_000, "自定义生产单号存在");
ErrorCode SALESMAN_ORDER_NOT_EXISTS = new ErrorCode(1_001_118_000, "业务员不存在");
ErrorCode SPLITTER_ORDER_NOT_EXISTS = new ErrorCode(1_001_119_000, "拆单员不存在");
ErrorCode ORDER_PROCESS_NOT_EXISTS = new ErrorCode(1_001_119_000, "工序组不存在");
ErrorCode ORDER_PROCESS_EXISTS = new ErrorCode(1_001_119_000, "该生产单工序组已经存在");
ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_029_000, "工序组不存在");
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_029_000, "此生产单中柜体并不存在不存在");
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_029_000, "生产单中未用到此板材");
}
@@ -1,7 +1,4 @@
<?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">
<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>
@@ -10,28 +7,28 @@
</parent>
<packaging>jar</packaging>
<artifactId>cf-module-prod-executor-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 基础 -->
<!-- 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-executor-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-dict</artifactId>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-banner</artifactId>
@@ -48,92 +45,126 @@
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-error-code</artifactId>
</dependency>
<!-- Web 相关 -->
<!-- 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>
-->
<!-- 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>
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-elasticsearch</artifactId>
<exclusions>
<exclusion>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
</exclusion>
</exclusions>
<version>${revision}</version>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.1</version>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-rpc</artifactId>
</dependency>
<!-- Registry 注册中心相关 -->
<!-- Registry 注册中心相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- Config 配置中心相关 -->
<!-- Config 配置中心相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- Test 测试相关 -->
<!-- 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> <!-- 实现数据库文档 -->
<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 服务端 -->
<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>io.vavr</groupId>
<artifactId>vavr</artifactId>
<version>0.10.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
</dependency>
<!-- JSON -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
<!-- 设置构建的 jar 包名 -->
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- 打包 -->
<!-- 打包 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -141,12 +172,12 @@
<executions>
<execution>
<goals>
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
<goal>repackage</goal>
<!-- 将引入的 jar 打入其中 -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -2,11 +2,13 @@ package com.cf.imes.module.executor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author there
*/
@SpringBootApplication
@EnableFeignClients
public class ExecutorServerApplication {
public static void main(String[] args) {
SpringApplication.run(ExecutorServerApplication.class, args);
@@ -1,5 +1,7 @@
package com.cf.imes.module.executor.controller.admin.goods;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -29,7 +31,7 @@ import com.cf.imes.module.executor.controller.admin.goods.vo.*;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.service.goods.GoodsService;
@Tag(name = "管理后台 - 生产单商品")
@Tag(name = "管理后台 - 生产单商品对应")
@RestController
@RequestMapping("/executor/goods")
@Validated
@@ -38,15 +40,16 @@ public class GoodsController {
@Resource
private GoodsService goodsService;
// 新建生产单新板材商品对应
@PostMapping("/create")
@Operation(summary = "创建生产单商品")
@Operation(summary = "对应生产单商品")
@PreAuthorize("@ss.hasPermission('executor:goods:create')")
public CommonResult<Long> createGoods(@Valid @RequestBody GoodsSaveReqVO createReqVO) {
return success(goodsService.createGoods(createReqVO));
public CommonResult<Boolean> createGoods(@Valid @RequestBody List<GoodsSaveReqVO> createReqVOS) {
return success(goodsService.createCorrespondsGoods(createReqVOS));
}
@PutMapping("/update")
@Operation(summary = "更新生产单商品")
@Operation(summary = "修改对应生产单商品")
@PreAuthorize("@ss.hasPermission('executor:goods:update')")
public CommonResult<Boolean> updateGoods(@Valid @RequestBody GoodsSaveReqVO updateReqVO) {
goodsService.updateGoods(updateReqVO);
@@ -54,7 +57,7 @@ public class GoodsController {
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单商品")
@Operation(summary = "删除对应生产单商品")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('executor:goods:delete')")
public CommonResult<Boolean> deleteGoods(@RequestParam("id") Long id) {
@@ -63,7 +66,7 @@ public class GoodsController {
}
@GetMapping("/get")
@Operation(summary = "获得生产单商品")
@Operation(summary = "获得对应生产单商品")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:goods:query')")
public CommonResult<GoodsRespVO> getGoods(@RequestParam("id") Long id) {
@@ -72,24 +75,10 @@ public class GoodsController {
}
@GetMapping("/page")
@Operation(summary = "获得生产单商品分页")
@Operation(summary = "获得对应生产单商品分页")
@PreAuthorize("@ss.hasPermission('executor:goods:query')")
public CommonResult<PageResult<GoodsRespVO>> getGoodsPage(@Valid GoodsPageReqVO pageReqVO) {
PageResult<GoodsDO> pageResult = goodsService.getGoodsPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, GoodsRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单商品 Excel")
@PreAuthorize("@ss.hasPermission('executor:goods:export')")
@OperateLog(type = EXPORT)
public void exportGoodsExcel(@Valid GoodsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<GoodsDO> list = goodsService.getGoodsPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单商品.xls", "数据", GoodsRespVO.class,
BeanUtils.toBean(list, GoodsRespVO.class));
}
}
@@ -1,6 +1,8 @@
package com.cf.imes.module.executor.controller.admin.goods.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam;
@@ -15,13 +17,16 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@ToString(callSuper = true)
public class GoodsPageReqVO extends PageParam {
@Schema(description = "生产单号")
private Long orderNo;
@Schema(description = "生产单号", example = "12114")
private Long orderId;
@Schema(description = "商品 ID", example = "18975")
@Schema(description = "设计端商品ID", example = "832")
private Long rawGoodsId;
@Schema(description = "商品 ID", example = "243")
private Long goodsId;
@Schema(description = "商品 ID", example = "王五")
@Schema(description = "商品名称", example = "晨丰")
private String goodsName;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
@@ -31,16 +36,16 @@ public class GoodsPageReqVO extends PageParam {
private String color;
@Schema(description = "宽度")
private Double width;
private BigDecimal width;
@Schema(description = "高度")
private Double height;
private BigDecimal height;
@Schema(description = "厚度")
private Double thickness;
private BigDecimal thickness;
@Schema(description = "价格", example = "21231")
private Double price;
@Schema(description = "价格", example = "7305")
private BigDecimal price;
@Schema(description = "品牌")
private String brand;
@@ -2,6 +2,8 @@ package com.cf.imes.module.executor.controller.admin.goods.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
@@ -13,19 +15,23 @@ import com.alibaba.excel.annotation.*;
@ExcelIgnoreUnannotated
public class GoodsRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "26190")
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4109")
@ExcelProperty("主键")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12114")
@ExcelProperty("生产单号")
private Long orderNo;
private Long orderId;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18975")
@Schema(description = "设计端商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "832")
@ExcelProperty("设计端商品ID")
private Long rawGoodsId;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
@ExcelProperty("商品 ID")
private Long goodsId;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("商品名称")
private String goodsName;
@@ -39,19 +45,19 @@ public class GoodsRespVO {
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("宽度")
private Double width;
private BigDecimal width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("高度")
private Double height;
private BigDecimal height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度")
private Double thickness;
private BigDecimal thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "21231")
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "7305")
@ExcelProperty("价格")
private Double price;
private BigDecimal price;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
@@ -2,6 +2,8 @@ package com.cf.imes.module.executor.controller.admin.goods.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import javax.validation.constraints.*;
@@ -9,55 +11,46 @@ import javax.validation.constraints.*;
@Data
public class GoodsSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "26190")
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4109")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号不能为空")
private Long orderNo;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12114")
private Long orderId;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18975")
@NotNull(message = "商品 ID不能为空")
@Schema(description = "设计端商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "832")
private Long rawGoodsId;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
private Long goodsId;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "商品名称不能为空")
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
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;
private BigDecimal width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "高度不能为空")
private Double height;
private BigDecimal height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空")
private Double thickness;
private BigDecimal thickness;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "21231")
@NotNull(message = "价格不能为空")
private Double price;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "7305")
private BigDecimal 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;
}
@@ -16,7 +16,7 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class ModulePageReqVO extends PageParam {
@Schema(description = "生产单号")
private Long orderNo;
private Long orderId;
@Schema(description = "模块名称", example = "张三")
private String name;
@@ -1,95 +0,0 @@
package com.cf.imes.module.executor.controller.admin.moduleitem;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
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 javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
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.executor.controller.admin.moduleitem.vo.*;
import com.cf.imes.module.executor.dal.dataobject.moduleitem.ModuleItemDO;
import com.cf.imes.module.executor.service.moduleitem.ModuleItemService;
@Tag(name = "管理后台 - 生产单模块明细")
@RestController
@RequestMapping("/executor/module-item")
@Validated
public class ModuleItemController {
@Resource
private ModuleItemService moduleItemService;
@PostMapping("/create")
@Operation(summary = "创建生产单模块明细")
@PreAuthorize("@ss.hasPermission('executor:module-item:create')")
public CommonResult<Long> createModuleItem(@Valid @RequestBody ModuleItemSaveReqVO createReqVO) {
return success(moduleItemService.createModuleItem(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单模块明细")
@PreAuthorize("@ss.hasPermission('executor:module-item:update')")
public CommonResult<Boolean> updateModuleItem(@Valid @RequestBody ModuleItemSaveReqVO updateReqVO) {
moduleItemService.updateModuleItem(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单模块明细")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('executor:module-item:delete')")
public CommonResult<Boolean> deleteModuleItem(@RequestParam("id") Long id) {
moduleItemService.deleteModuleItem(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得生产单模块明细")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:module-item:query')")
public CommonResult<ModuleItemRespVO> getModuleItem(@RequestParam("id") Long id) {
ModuleItemDO moduleItem = moduleItemService.getModuleItem(id);
return success(BeanUtils.toBean(moduleItem, ModuleItemRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得生产单模块明细分页")
@PreAuthorize("@ss.hasPermission('executor:module-item:query')")
public CommonResult<PageResult<ModuleItemRespVO>> getModuleItemPage(@Valid ModuleItemPageReqVO pageReqVO) {
PageResult<ModuleItemDO> pageResult = moduleItemService.getModuleItemPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ModuleItemRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单模块明细 Excel")
@PreAuthorize("@ss.hasPermission('executor:module-item:export')")
@OperateLog(type = EXPORT)
public void exportModuleItemExcel(@Valid ModuleItemPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ModuleItemDO> list = moduleItemService.getModuleItemPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单模块明细.xls", "数据", ModuleItemRespVO.class,
BeanUtils.toBean(list, ModuleItemRespVO.class));
}
}
@@ -1,32 +0,0 @@
package com.cf.imes.module.executor.controller.admin.moduleitem.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam;
@Schema(description = "管理后台 - 生产单模块明细分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ModuleItemPageReqVO extends PageParam {
@Schema(description = "生产单号")
private Long orderNo;
@Schema(description = "房间 ID", example = "1469")
private Long roomId;
@Schema(description = "柜体 ID", example = "3460")
private Long bodyId;
@Schema(description = "模块类型 ID", example = "15993")
private Long typeId;
@Schema(description = "模块 ID", example = "13998")
private Long moduleId;
@Schema(description = "明细 ID", example = "11426")
private Long itemId;
}
@@ -1,42 +0,0 @@
package com.cf.imes.module.executor.controller.admin.moduleitem.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 生产单模块明细 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ModuleItemRespVO {
@Schema(description = "记录 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15563")
@ExcelProperty("记录 ID")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("生产单号")
private Long orderNo;
@Schema(description = "房间 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1469")
@ExcelProperty("房间 ID")
private Long roomId;
@Schema(description = "柜体 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3460")
@ExcelProperty("柜体 ID")
private Long bodyId;
@Schema(description = "模块类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15993")
@ExcelProperty("模块类型 ID")
private Long typeId;
@Schema(description = "模块 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "13998")
@ExcelProperty("模块 ID")
private Long moduleId;
@Schema(description = "明细 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11426")
@ExcelProperty("明细 ID")
private Long itemId;
}
@@ -1,39 +0,0 @@
package com.cf.imes.module.executor.controller.admin.moduleitem.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 生产单模块明细新增/修改 Request VO")
@Data
public class ModuleItemSaveReqVO {
@Schema(description = "记录 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15563")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号不能为空")
private Long orderNo;
@Schema(description = "房间 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1469")
@NotNull(message = "房间 ID不能为空")
private Long roomId;
@Schema(description = "柜体 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3460")
@NotNull(message = "柜体 ID不能为空")
private Long bodyId;
@Schema(description = "模块类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15993")
@NotNull(message = "模块类型 ID不能为空")
private Long typeId;
@Schema(description = "模块 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "13998")
@NotNull(message = "模块 ID不能为空")
private Long moduleId;
@Schema(description = "明细 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11426")
@NotNull(message = "明细 ID不能为空")
private Long itemId;
}
@@ -1,12 +1,25 @@
package com.cf.imes.module.executor.controller.admin.order;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderImportRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderSaveReqVO;
import org.springframework.beans.factory.annotation.Autowired;
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
import com.cf.imes.module.executor.service.order.ApiOrderService;
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
import com.cf.imes.module.executor.util.FileTypeChangeUtil;
import com.cf.imes.module.executor.util.deviseData.Detail;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.PlateImportVO;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -23,27 +36,30 @@ 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.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.service.order.OrderService;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@Tag(name = "管理后台 - 生产单表 order_{N}")
@Tag(name = "管理后台 - 生产单管理")
@RestController
@RequestMapping("/executor/order")
@Validated
@@ -52,17 +68,20 @@ public class OrderController {
@Resource
private OrderService orderService;
@Resource
private ApiOrderService apiOrderService;
private static final Logger log = LoggerFactory.getLogger(OrderController.class);
@PostMapping("/create")
@Operation(summary = "创建生产单表 order_{N}")
@Operation(summary = "创建生产单")
@PreAuthorize("@ss.hasPermission('executor:order:create')")
public CommonResult<Long> createOrder(@Valid @RequestBody OrderSaveReqVO createReqVO) {
return success(orderService.createOrder(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单表 order_{N}")
@Operation(summary = "更新生产单")
@PreAuthorize("@ss.hasPermission('executor:order:update')")
public CommonResult<Boolean> updateOrder(@Valid @RequestBody OrderSaveReqVO updateReqVO) {
orderService.updateOrder(updateReqVO);
@@ -70,16 +89,16 @@ public class OrderController {
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单表 order_{N}")
@Parameter(name = "id", description = "编号", required = true)
@Operation(summary = "删除(作废)生产单")
@Parameter(name = "orderIds", description = "生产单id组", required = true, example = "1,2")
@PreAuthorize("@ss.hasPermission('executor:order:delete')")
public CommonResult<Boolean> deleteOrder(@RequestParam("id") Long id) {
orderService.deleteOrder(id);
public CommonResult<Boolean> deleteOrder(@RequestParam("orderIds") Collection<Long> orderIds) {
orderService.deleteOrder(orderIds);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得生产单表 order_{N}")
@Operation(summary = "获得(单个)生产单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<OrderRespVO> getOrder(@RequestParam("id") Long id) {
@@ -87,33 +106,31 @@ public class OrderController {
return success(BeanUtils.toBean(order, OrderRespVO.class));
}
// 获取当前条件下所有生产单信息
@GetMapping("/allOrder")
@Operation(summary = "获得所有生产单")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<PageResult<OrderRespVO>> getAllOrder(@Valid OrderPageReqVO pageReqVO) {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得生产单表 order_{N}分页")
@Operation(summary = "获得生产单分页")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<PageResult<OrderRespVO>> getOrderPage(@Valid OrderPageReqVO pageReqVO) {
PageResult<OrderDO> pageResult = orderService.getOrderPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, OrderRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单表 order_{N} Excel")
@PreAuthorize("@ss.hasPermission('executor:order:export')")
@OperateLog(type = EXPORT)
public void exportOrderExcel(@Valid OrderPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<OrderDO> list = orderService.getOrderPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单表 order_{N}.xls", "数据", OrderRespVO.class,
BeanUtils.toBean(list, OrderRespVO.class));
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入生产单模板")
public void importTemplate(HttpServletResponse response) {
@Parameter(name = "type", description = "文件类型", required = true, example = "0")
public void importTemplate(HttpServletResponse response, @RequestParam("type") Integer type) {
try {
// path是指想要下载的文件的路径
File file = new File(ResourceUtils.getURL("classpath:").getPath()+ "\\files\\生产单上传样式.xlsx");
File file = new File(ResourceUtils.getURL("classpath:").getPath() + "\\files\\生产单上传样式.xlsx");
log.info(file.getPath());
// 获取文件名
String filename = file.getName();
@@ -147,4 +164,264 @@ public class OrderController {
}
}
// @PostMapping("/import")
// @Operation(summary = "导入生产单新增")
// @Parameters({
// @Parameter(name = "file", description = "Excel 文件", required = true),
// @Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
// @Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
// @Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true)
// })
// @PreAuthorize("@ss.hasPermission('executor:order:import')")
// public CommonResult<Map<Boolean, String>> importExcel(@RequestPart("file") MultipartFile file,
// @RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
// @RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
// @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO) throws IOException {
// Map<Boolean, String> map = new HashMap<>();
//// 判断是否更新板材
// if (!isAddPlate) {//不需要添加板材
// if (upload) {
// orderService.updateOrder(createReqVO);//更新
// map.put(true, "单独更新生产单成功");
// } else {
// Long id = orderService.createOrder(createReqVO);//新建
// map.put(true, "单独新增生产单成功");
// }
// return success(map);
// } else {
// Long id = 0L;
// if (upload) {
// orderService.updateOrder(createReqVO);//更新
// id = createReqVO.getId();
// map.put(true, "单独更新生产单成功");
// } else {
// id = orderService.createOrder(createReqVO);//新建
// map.put(true, "单独新增生产单成功");
// }
//// 解析导入文件,生成统一格式
// List<?> list = new ArrayList<>();
// if (createReqVO.getDataType() == 1) {//CAD
//
// } else if (createReqVO.getDataType() == 2) {//WebCAD
//
// } else if (createReqVO.getDataType() == 3) {//Excel
//// 文件数据读取
// list = fileTypeChangeUtil.fileDataChange(file);
// }
// if (list == null || list.size() == 0) {
// map.put(false, "导入文件有误");
// return success(map);
// }
//// OrderImportRespVO respVO = orderService.importOrderList(list , id , orderImportRespVO);
// orderInputProcessor.input((List<Detail>) list, id);
//// 是否新增成功需要返回
// map.putIfAbsent(true, "文件导入成功");
// return success(map);
//
// }
// }
// 导出错误的excel
// @PostMapping("/import-excel")
// @Operation(summary = "生产单导入新增")
// @Parameters({
// @Parameter(name = "file", description = "Excel 文件", required = true),
// @Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
// @Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
// @Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true)
// })
// @PreAuthorize("@ss.hasPermission('executor:order:importExcel')")
// @OperateLog(type = EXPORT)
// public void exportExcel(@RequestPart("file") MultipartFile file,
// @RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
// @RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
// @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO,
// HttpServletResponse response) throws IOException {
//// 判断是否更新板材
// if (!isAddPlate) {//不需要添加板材
// if (upload) {
// orderService.updateOrder(createReqVO);//更新
// } else {
// Long id = orderService.createOrder(createReqVO);//新建
// }
// } else {
// Long id = 0L;
// if (upload) {
// orderService.updateOrder(createReqVO);//更新
// id = createReqVO.getId();
// } else {
// id = orderService.createOrder(createReqVO);//新建
// }
//// 解析导入文件,生成统一格式
// List<?> list = new ArrayList<>();
// if (createReqVO.getDataType() == 1) {//数据源
//
// } else if (createReqVO.getDataType() == 2) {//api
//
// } else if (createReqVO.getDataType() == 0) {//文件
//// 文件数据读取
// list = fileTypeChangeUtil.fileDataChange(file);
// }
// if (!fileTypeChangeUtil.getFlag()) {
// // 导出 Excel
// ExcelUtils.write(response, "生产单导入错误返回.xlsx", "数据", OrderPlateImportExcelVO.class,
// BeanUtils.toBean(list, OrderPlateImportExcelVO.class));
// }
// orderInputProcessor.input((List<Detail>) list, id);
// }
//
// }
// 清理生产单
@GetMapping("/clean")
@Operation(summary = "清理生产单")
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order:delete')")
public CommonResult<Boolean> cleanOrder(@RequestParam("orderId") Long orderId) {
orderService.cleanOrder(orderId);
return success(true);
}
// 获得 房间和柜体 信息
@GetMapping("/get-room")
@Operation(summary = "获得房间——柜体 基本信息")
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<Map<Long, List<OrderBodyRespVO>>> getRoom(@RequestParam("orderId") Long orderId) {
Map<Long, List<OrderBodyRespVO>> orderBodyMap = orderService.getOrderBody(orderId);
return success(orderBodyMap);
}
// 获得模组 —— 模块信息
@GetMapping("/get-moduleDetails")
@Operation(summary = "获得模组——模块信息")
@Parameters({
@Parameter(name = "orderId", description = "生产单编号", example = "1024"),
@Parameter(name = "roomId", description = "房间编号", example = "1024"),
@Parameter(name = "bodyId", description = "柜体编号", example = "1024")
})
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<List<OrderModuleExtraDO>> getModule(@RequestParam("orderId") Long orderId,
@RequestParam(value = "roomId", required = false) Long roomId,
@RequestParam(value = "bodyId", required = false) Long bodyId) {
List<OrderModuleExtraDO> moduleDOList = orderService.getModule(orderId, roomId, bodyId);
return success(moduleDOList);
}
// 删除柜体
@DeleteMapping("/delete-body")
@Operation(summary = "删除柜体")
@Parameters({
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024"),
@Parameter(name = "bodyIds", description = "柜体编号集合", required = true, example = "1,2")
})
@PreAuthorize("@ss.hasPermission('executor:order:delete')")
public CommonResult<Boolean> deleteBody(@RequestParam("orderId") Long orderId, @RequestParam("bodyIds") Set<Long> bodyIds) {
orderService.deleteBodyByOrder(orderId, bodyIds);
return success(true);
}
// 柜体数据获取,需要加上柜体的属性
@GetMapping("/get-body")
@Operation(summary = "生产单柜体数据获取")
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<List<OrderBodyRespVO>> getBody(@RequestParam("orderId") Long orderId) {
return success(BeanUtils.toBean(orderService.getBody(orderId), OrderBodyRespVO.class));
}
// @PostMapping("file-import")
// @Operation(summary = "文件上传接口--完善中")
// @Parameters({
// @Parameter(name = "file", description = "文件", required = false),
// @Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
// @Parameter(name = "upload", description = "是 更新、否 新建", example = "false"),
// @Parameter(name = "orderSaveReqVO", description = "生产单新增参数", required = true),
// @Parameter(name = "type", description = "文件类型", required = true)
// })
// @PreAuthorize("@ss.hasPermission('executor:fileData:import')")
// public CommonResult<OrderImportRespVO> apiImport(@RequestPart(value = "file", required = false) MultipartFile file,
// @RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
// @RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
// @RequestPart("orderSaveReqVO") OrderSaveReqVO createReqVO,
// @RequestParam(value = "type", required = false, defaultValue = "cf_cad") String type,
// final HttpServletResponse respons) throws IOException {
//
// OrderImportRespVO orderImportRespVO = OrderImportRespVO.builder().createOrder(new ArrayList<>())
// .updateOrder(new ArrayList<>()).failureOrder(new LinkedHashMap<>()).build();
//
//// 数据格式转换,返回转换完成的数据(传入文件类型,和文件类容),判断需要使用那种解析之后,进行数据的转换
// List<?> list = fileTypeChangeUtil.chooseType(file, type);
// if (fileTypeChangeUtil.getFlag()) {//文件数据转换成功,进行数据填入
//
// }
//
// return success(orderImportRespVO);
// }
// 测试接口
@GetMapping("getTest")
@Operation(summary = "测试接口(忽略)")
@PreAuthorize("@ss.hasPermission('executor:order:query')")
public CommonResult<JSONObject> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo) {
// 获取token
JSONObject json = apiOrderService.getApiTokenMessage("CF7526AD51", "5f467b508061eff60bdacc7230357d2f");
// 判断获取token是否成功
if (json.getString("err_msg").equals("success")) {
System.out.println("获取token成功");
String token = json.getJSONObject("info").getString("access_token");
JSONObject jsonObject = new JSONObject();
jsonObject.put("order_no", orderNo);//生产单号需要传入赋值
jsonObject.put("format", "json");
// 数据解析
JSONObject data = apiOrderService.getApiOrderMessage(token, jsonObject);
if (data.getString("err_code").equals("0")) {
System.out.println("获取数据成功");
String value = data.getString("value");
System.out.println("value " + data.getString("value") );
// System.out.println("list " + toListMap(value));
// 数据格式进行转换
System.out.println("order " + value.substring(1, value.length() - 1));
}
}
return success(apiOrderService.getApiTokenMessage("CF7526AD51", "5f467b508061eff60bdacc7230357d2f"));
}
@PostMapping("/importFile")
@Operation(summary = "生产单导入新增")
@Parameters({
@Parameter(name = "file", description = "文件", required = true),
@Parameter(name = "type", description = "文件类型", required = true),
@Parameter(name = "isAddPlate", description = "是否为生产单新增板材", example = "false"),
@Parameter(name = "upload", description = "是 更新、否 新建", example = "false")
})
@PreAuthorize("@ss.hasPermission('executor:order:importExcel')")
@OperateLog(type = EXPORT)
public void exportTest(@RequestPart("file") MultipartFile file,
@RequestParam(value = "type", required = false, defaultValue = "true") Integer type,
@RequestParam(value = "isAddPlate", required = false, defaultValue = "false") Boolean isAddPlate,
@RequestParam(value = "upload", required = false, defaultValue = "false") Boolean upload,
HttpServletResponse response) throws IOException {
// 判断是否更新板材
EasyExcel.read(file.getInputStream(), OrderRespVO.class, null)
.headRowNumber(2)
.autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理
.doReadAllSync();
List<PlateImportVO> orderPlateImportExcelVOS = ExcelUtils.read(file, PlateImportVO.class);
System.out.println(
"orderPlateImportExcelVOS " + orderPlateImportExcelVOS
);
}
}
@@ -0,0 +1,27 @@
package com.cf.imes.module.executor.controller.admin.order.vo.order;
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_server
* @author: 晨丰科技
* @date: 2024/3/6 10:03
*/
@Schema(description = "管理后台 - 生产单导入 Response VO")
@Data
@Builder
public class OrderImportRespVO {
@Schema(description = "创建成功的生产单名数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> createOrder;
@Schema(description = "更新成功的生产单名数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updateOrder;
@Schema(description = "导入失败的生产单集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failureOrder;
}
@@ -1,6 +1,8 @@
package com.cf.imes.module.executor.controller.admin.order.vo.order;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam;
@@ -11,8 +13,10 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Schema(description = "管理后台 - 生产单表 order_{N}分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OrderPageReqVO extends PageParam {
@Schema(description = "父单号")
@@ -29,10 +33,10 @@ public class OrderPageReqVO extends PageParam {
private Integer sort;
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", example = "1")
private Boolean dataType;
private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", example = "1")
private Boolean status;
private Integer status;
@Schema(description = "自定义单号")
private String customOrderNo;
@@ -65,4 +69,5 @@ public class OrderPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private Boolean deleted;
}
@@ -2,9 +2,7 @@ package com.cf.imes.module.executor.controller.admin.order.vo.order;
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.*;
@@ -35,11 +33,11 @@ public class OrderRespVO {
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("CAD数据类型,1CAD 2WebCAD 3Excel")
private Boolean dataType;
private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成")
private Boolean status;
private Integer status;
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自定义单号")
@@ -81,4 +79,6 @@ public class OrderRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
private Boolean deleted;
}
@@ -2,6 +2,8 @@ package com.cf.imes.module.executor.controller.admin.order.vo.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
@@ -11,11 +13,10 @@ import java.time.LocalDateTime;
@Data
public class OrderSaveReqVO {
@Schema(description = "生产单号,主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15091")
private Long id;
@Schema(description = "父单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "父单号不能为空")
@NotNull(message = "父单号不能为空,无父单时为0")
private Long parentNo;
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED)
@@ -32,11 +33,11 @@ public class OrderSaveReqVO {
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "CAD数据类型,1CAD 2WebCAD 3Excel不能为空")
private Boolean dataType;
private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成不能为空")
private Boolean status;
private Integer status;
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "自定义单号不能为空")
@@ -74,4 +75,6 @@ public class OrderSaveReqVO {
@NotEmpty(message = "备注不能为空")
private String remark;
private Boolean deleted;
}
@@ -0,0 +1,75 @@
package com.cf.imes.module.executor.controller.admin.order.vo.product;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import java.util.List;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 生产单柜体 Response VO")
@Data
@ExcelIgnoreUnannotated
public class OrderBodyRespVO {
@Schema(description = "模块 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30562")
@ExcelProperty("模块 ID")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11075")
@ExcelProperty("生产单号")
private Long orderId;
@Schema(description = "房间ID,后端生成", requiredMode = Schema.RequiredMode.REQUIRED, example = "26936")
@ExcelProperty("房间ID,后端生成")
private Long roomId;
@Schema(description = "房间名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("房间名称")
private String roomName;
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("模块名称")
private String name;
@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 depth;
@Schema(description = "模块复制数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("模块复制数量")
private Short multiNum;
@Schema(description = "板材数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("板材数量")
private Short plateNum;
@Schema(description = "异型数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("异型数量")
private Short unregularNum;
// @Schema(description = "生产单详情内容", requiredMode = Schema.RequiredMode.REQUIRED)
// @ExcelProperty("生产单详情内容")
// private List<OrderItemDO> orderItemDOS;
@Schema(description = "文件名", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("文件名")
private String filename;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.order.vo.product;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 产品信息合集 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProductRespVO {
// private Long orderId;
private Long roomId;
private String roomName;
private Long bodyId;
private String bodyName;
private Long groupId;
private Long groupTypeId;
private String groupTypeName;
private int goodType;
private String goodName;
private String units;
private Double num;
}
@@ -1,95 +0,0 @@
package com.cf.imes.module.executor.controller.admin.orderModuleExtra;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
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 javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
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.executor.controller.admin.orderModuleExtra.vo.*;
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
import com.cf.imes.module.executor.service.orderModuleExtra.OrderModuleExtraService;
@Tag(name = "管理后台 - 生产单模块扩充属性表 order_module_extra_N")
@RestController
@RequestMapping("/executor/order-module-extra")
@Validated
public class OrderModuleExtraController {
@Resource
private OrderModuleExtraService orderModuleExtraService;
@PostMapping("/create")
@Operation(summary = "创建生产单模块扩充属性表 order_module_extra_N")
@PreAuthorize("@ss.hasPermission('executor:order-module-extra:create')")
public CommonResult<Long> createOrderModuleExtra(@Valid @RequestBody OrderModuleExtraSaveReqVO createReqVO) {
return success(orderModuleExtraService.createOrderModuleExtra(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单模块扩充属性表 order_module_extra_N")
@PreAuthorize("@ss.hasPermission('executor:order-module-extra:update')")
public CommonResult<Boolean> updateOrderModuleExtra(@Valid @RequestBody OrderModuleExtraSaveReqVO updateReqVO) {
orderModuleExtraService.updateOrderModuleExtra(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单模块扩充属性表 order_module_extra_N")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('executor:order-module-extra:delete')")
public CommonResult<Boolean> deleteOrderModuleExtra(@RequestParam("id") Long id) {
orderModuleExtraService.deleteOrderModuleExtra(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得生产单模块扩充属性表 order_module_extra_N")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order-module-extra:query')")
public CommonResult<OrderModuleExtraRespVO> getOrderModuleExtra(@RequestParam("id") Long id) {
OrderModuleExtraDO orderModuleExtra = orderModuleExtraService.getOrderModuleExtra(id);
return success(BeanUtils.toBean(orderModuleExtra, OrderModuleExtraRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得生产单模块扩充属性表 order_module_extra_N分页")
@PreAuthorize("@ss.hasPermission('executor:order-module-extra:query')")
public CommonResult<PageResult<OrderModuleExtraRespVO>> getOrderModuleExtraPage(@Valid OrderModuleExtraPageReqVO pageReqVO) {
PageResult<OrderModuleExtraDO> pageResult = orderModuleExtraService.getOrderModuleExtraPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, OrderModuleExtraRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单模块扩充属性表 order_module_extra_N Excel")
@PreAuthorize("@ss.hasPermission('executor:order-module-extra:export')")
@OperateLog(type = EXPORT)
public void exportOrderModuleExtraExcel(@Valid OrderModuleExtraPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<OrderModuleExtraDO> list = orderModuleExtraService.getOrderModuleExtraPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单模块扩充属性表 order_module_extra_N.xls", "数据", OrderModuleExtraRespVO.class,
BeanUtils.toBean(list, OrderModuleExtraRespVO.class));
}
}
@@ -1,29 +0,0 @@
package com.cf.imes.module.executor.controller.admin.orderModuleExtra.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam;
@Schema(description = "管理后台 - 生产单模块扩充属性表 order_module_extra_N分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OrderModuleExtraPageReqVO extends PageParam {
@Schema(description = "生产单号")
private Long orderNo;
@Schema(description = "房间 ID", example = "273")
private Long roomId;
@Schema(description = "柜体 ID", example = "1826")
private Long bodyId;
@Schema(description = "属性类型:1 板材铰链备注, 2 五金分类, 3 五金尺寸, 4 板材特殊备注, 5 排钻规格, 6 门板组件铰链备注, 7 板材排钻备注, 8 板材额外信息备注, 9 板材自定义编号, 10 门板拉手备注, 11 门板组件拉手备注, 12 五金特殊备注", example = "1")
private Integer type;
@Schema(description = "属性数据")
private String extraData;
}
@@ -1,38 +0,0 @@
package com.cf.imes.module.executor.controller.admin.orderModuleExtra.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 生产单模块扩充属性表 order_module_extra_N Response VO")
@Data
@ExcelIgnoreUnannotated
public class OrderModuleExtraRespVO {
@Schema(description = "属性 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17407")
@ExcelProperty("属性 ID")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("生产单号")
private Long orderNo;
@Schema(description = "房间 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "273")
@ExcelProperty("房间 ID")
private Long roomId;
@Schema(description = "柜体 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1826")
@ExcelProperty("柜体 ID")
private Long bodyId;
@Schema(description = "属性类型:1 板材铰链备注, 2 五金分类, 3 五金尺寸, 4 板材特殊备注, 5 排钻规格, 6 门板组件铰链备注, 7 板材排钻备注, 8 板材额外信息备注, 9 板材自定义编号, 10 门板拉手备注, 11 门板组件拉手备注, 12 五金特殊备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("属性类型:1 板材铰链备注, 2 五金分类, 3 五金尺寸, 4 板材特殊备注, 5 排钻规格, 6 门板组件铰链备注, 7 板材排钻备注, 8 板材额外信息备注, 9 板材自定义编号, 10 门板拉手备注, 11 门板组件拉手备注, 12 五金特殊备注")
private Integer type;
@Schema(description = "属性数据", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("属性数据")
private String extraData;
}
@@ -1,35 +0,0 @@
package com.cf.imes.module.executor.controller.admin.orderModuleExtra.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 生产单模块扩充属性表 order_module_extra_N新增/修改 Request VO")
@Data
public class OrderModuleExtraSaveReqVO {
@Schema(description = "属性 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17407")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号不能为空")
private Long orderNo;
@Schema(description = "房间 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "273")
@NotNull(message = "房间 ID不能为空")
private Long roomId;
@Schema(description = "柜体 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1826")
@NotNull(message = "柜体 ID不能为空")
private Long bodyId;
@Schema(description = "属性类型:1 板材铰链备注, 2 五金分类, 3 五金尺寸, 4 板材特殊备注, 5 排钻规格, 6 门板组件铰链备注, 7 板材排钻备注, 8 板材额外信息备注, 9 板材自定义编号, 10 门板拉手备注, 11 门板组件拉手备注, 12 五金特殊备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "属性类型:1 板材铰链备注, 2 五金分类, 3 五金尺寸, 4 板材特殊备注, 5 排钻规格, 6 门板组件铰链备注, 7 板材排钻备注, 8 板材额外信息备注, 9 板材自定义编号, 10 门板拉手备注, 11 门板组件拉手备注, 12 五金特殊备注不能为空")
private Integer type;
@Schema(description = "属性数据", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "属性数据不能为空")
private String extraData;
}
@@ -1,5 +1,7 @@
package com.cf.imes.module.executor.controller.admin.orderParts;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateTermsPageReqVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -29,7 +31,7 @@ import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
import com.cf.imes.module.executor.service.orderParts.OrderPartsService;
@Tag(name = "管理后台 - 生产单配件表 order_parts_{N}")
@Tag(name = "管理后台 - 生产单配件表")
@RestController
@RequestMapping("/executor/order-parts")
@Validated
@@ -39,14 +41,14 @@ public class OrderPartsController {
private OrderPartsService orderPartsService;
@PostMapping("/create")
@Operation(summary = "创建生产单配件表 order_parts_{N}")
@Operation(summary = "创建生产单配件")
@PreAuthorize("@ss.hasPermission('executor:order-parts:create')")
public CommonResult<Long> createOrderParts(@Valid @RequestBody OrderPartsSaveReqVO createReqVO) {
return success(orderPartsService.createOrderParts(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单配件表 order_parts_{N}")
@Operation(summary = "更新生产单配件")
@PreAuthorize("@ss.hasPermission('executor:order-parts:update')")
public CommonResult<Boolean> updateOrderParts(@Valid @RequestBody OrderPartsSaveReqVO updateReqVO) {
orderPartsService.updateOrderParts(updateReqVO);
@@ -54,7 +56,7 @@ public class OrderPartsController {
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单配件表 order_parts_{N}")
@Operation(summary = "删除生产单配件")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('executor:order-parts:delete')")
public CommonResult<Boolean> deleteOrderParts(@RequestParam("id") Long id) {
@@ -63,7 +65,7 @@ public class OrderPartsController {
}
@GetMapping("/get")
@Operation(summary = "获得生产单配件表 order_parts_{N}")
@Operation(summary = "获得生产单配件")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:order-parts:query')")
public CommonResult<OrderPartsRespVO> getOrderParts(@RequestParam("id") Long id) {
@@ -72,7 +74,7 @@ public class OrderPartsController {
}
@GetMapping("/page")
@Operation(summary = "获得生产单配件表 order_parts_{N}分页")
@Operation(summary = "获得生产单配件分页")
@PreAuthorize("@ss.hasPermission('executor:order-parts:query')")
public CommonResult<PageResult<OrderPartsRespVO>> getOrderPartsPage(@Valid OrderPartsPageReqVO pageReqVO) {
PageResult<OrderPartsDO> pageResult = orderPartsService.getOrderPartsPage(pageReqVO);
@@ -80,7 +82,7 @@ public class OrderPartsController {
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单配件表 order_parts_{N} Excel")
@Operation(summary = "导出生产单配件 Excel")
@PreAuthorize("@ss.hasPermission('executor:order-parts:export')")
@OperateLog(type = EXPORT)
public void exportOrderPartsExcel(@Valid OrderPartsPageReqVO pageReqVO,
@@ -92,4 +94,12 @@ public class OrderPartsController {
BeanUtils.toBean(list, OrderPartsRespVO.class));
}
// 批量查询有生产单号id、房间id,柜体id的板材
@GetMapping("getPartsByOrderId")
@Operation(summary = "批量查询有生产单号id、房间id,柜体id的板材")
@PreAuthorize("@ss.hasPermission('executor:plate:getPlatesByOrderId')")
public CommonResult<PageResult<OrderPartsRespVO>> getPPartsByOrderId(@Valid PlateTermsPageReqVO pageVO) {
return success(orderPartsService.getPartsPageByTerms(pageVO));
}
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.orderParts.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
import java.util.Map;
@Schema(description = "管理后台 - 生产配件导入 Response VO")
@Data
@Builder
public class OrderPartsImportRespVO {
@Schema(description = "创建成功的生产配件数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List< OrderPartsSaveReqVO> createOrderParts;
@Schema(description = "更新成功的生产配件数组", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> updateOrderParts;
@Schema(description = "导入失败的生产配件集合,key 为生产单名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> failureOrderParts;
}
@@ -16,10 +16,10 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class OrderPartsPageReqVO extends PageParam {
@Schema(description = "生产单号")
private Long orderNo;
private Long orderId;
@Schema(description = "商品ID", example = "1195")
private Long goodsId;
private String goodsId;
@Schema(description = "配件名称", example = "晨丰")
private String name;
@@ -28,7 +28,7 @@ public class OrderPartsPageReqVO extends PageParam {
private String material;
@Schema(description = "配件类型", example = "2")
private String type;
private Integer type;
@Schema(description = "型号")
private String model;
@@ -19,11 +19,11 @@ public class OrderPartsRespVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("生产单号")
private Long orderNo;
private Long orderId;
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
@ExcelProperty("商品ID")
private Long goodsId;
private String goodsId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@ExcelProperty("配件名称")
@@ -35,7 +35,7 @@ public class OrderPartsRespVO {
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("配件类型")
private String type;
private Integer type;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("型号")
@@ -73,4 +73,8 @@ public class OrderPartsRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
@ExcelProperty("数量")
private Double num;
}
@@ -14,11 +14,11 @@ public class OrderPartsSaveReqVO {
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "生产单号不能为空")
private Long orderNo;
private Long orderId;
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
@NotNull(message = "商品ID不能为空")
private Long goodsId;
private String goodsId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
@NotEmpty(message = "配件名称不能为空")
@@ -30,7 +30,7 @@ public class OrderPartsSaveReqVO {
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "配件类型不能为空")
private String type;
private Integer type;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "型号不能为空")
@@ -0,0 +1,112 @@
package com.cf.imes.module.executor.controller.admin.plan;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
import com.cf.imes.module.executor.util.RandomUtils;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* @author there
*/
@RestController
@RequestMapping("/executor/optimize-plan")
@Tag(name= "优化排单")
@Validated
public class OptimizePlanController {
@Resource
private OptimizePlanService optimizePlanService;
@GetMapping("/getPlateListByPlanId")
@Operation(summary = "根据排单id获取板材列表")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<List<PlateOptimize>> getPlateListByPlanId(@Schema(description = "排单id") @RequestParam("planId") Long planId) {
return CommonResult.success(optimizePlanService.getPlateListByPlanId(planId));
}
@PostMapping("/addRemain")
@Operation(summary = "添加余料板")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<Boolean> addRemain(@RequestBody @Valid AddRemainReqVO vo){
return CommonResult.success(optimizePlanService.addRemain(vo));
}
@PostMapping("savePlanPlateResult")
@Operation(summary = "提交保存优化结果文件")
@OperateLog(logArgs = false)
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<Boolean> savePlanPlateResult(SavePlanPlateResult result) {
return CommonResult.success(optimizePlanService.savePlanPlateResult(result));
}
@GetMapping("commit")
@Operation(summary = "开始开料")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<Boolean> commit(@RequestParam @Valid @NotNull(message = "排单id不能空") Long planId) {
return CommonResult.success(optimizePlanService.commit(planId));
}
@GetMapping("/getOptimizeParam")
@Operation(summary = "获取优化算法参数")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<OptimizeParamResVO> getOptimizeParam(@RequestParam @Valid @NotNull(message = "排单id不能空") Long planId) {
return CommonResult.success(optimizePlanService.getOptimizeParam(planId));
}
@GetMapping("/getCfData")
@Operation(summary = "获取cfData")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<OptimizeParamResVO> getCfData(@RequestParam @Valid @NotNull(message = "排单id不能空") Long planId) {
//todo
return CommonResult.success(null);
}
/* @GetMapping("/getOptimizePlanParam")
@Operation(summary = "获取优化排单参数 (mock)")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
@Parameter(name = "planId", description = "排单id", required = false)
public CommonResult<OptimizeParamRespVO> getOptimizePlanParam (@RequestParam (required = false) Long planId) {
*//* OptimizeParamRespVO data = RandomUtils.randomPojo(OptimizeParamRespVO.class);
return CommonResult.success(data);*//*
//todo
OptimizeParamRespVO optimizePlanParam = optimizePlanService.getOptimizePlanParam(planId);
return CommonResult.success(optimizePlanParam);
}*/
@GetMapping("/getOrderSource")
@Operation(summary = "获取生产单源数据")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<OrderSource> getOrderSource(@Schema(description = "生产单id") @RequestParam(required = false) Long orderId,
@Schema(description = "排单id") @RequestParam(required = false) Long planId,
@Schema(description = "机台Id") @RequestParam("machineId") Long machineId
) {
return CommonResult.success(optimizePlanService.getOrderSource(orderId, planId, machineId));
//return CommonResult.success(RandomUtils.randomPojo(OrderSource.class));
}
@GetMapping("/getLabelDataSourceValue")
@Operation(summary = "获取标签数据源value")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<Map<String,Object>> getLabelDataSourceValue(@Valid GetSourceDataReq req ) {
return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req));
}
}
@@ -1,5 +1,9 @@
package com.cf.imes.module.executor.controller.admin.plan;
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
import com.cf.imes.module.executor.util.RandomUtils;
import com.cf.imes.module.executor.util.deviseData.Detail;
import com.cf.imes.module.executor.util.deviseData.IBoardProdInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -8,7 +12,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
@@ -26,10 +29,9 @@ import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
import com.cf.imes.module.executor.service.plan.PlanService;
@Tag(name = "管理后台 - 生产单开料排单")
@Tag(name = "管理后台 - 排单")
@RestController
@RequestMapping("/executor/plan")
@Validated
@@ -38,15 +40,18 @@ public class PlanController {
@Resource
private PlanService planService;
@Resource
private OrderInputProcessor orderInputProcessor;
@PostMapping("/create")
@Operation(summary = "创建生产单开料排单")
@Operation(summary = "创建排单")
@PreAuthorize("@ss.hasPermission('executor:plan:create')")
public CommonResult<Long> createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) {
return success(planService.createPlan(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单开料排单")
@Operation(summary = "更新排单")
@PreAuthorize("@ss.hasPermission('executor:plan:update')")
public CommonResult<Boolean> updatePlan(@Valid @RequestBody PlanSaveReqVO updateReqVO) {
planService.updatePlan(updateReqVO);
@@ -54,40 +59,70 @@ public class PlanController {
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单开料排单")
@Parameter(name = "id", description = "编号", required = true)
@Operation(summary = "删除排单")
@Parameter(name = "id", description = "排单id", required = true)
@PreAuthorize("@ss.hasPermission('executor:plan:delete')")
public CommonResult<Boolean> deletePlan(@RequestParam("id") Long id) {
planService.deletePlan(id);
return success(true);
return success(planService.deletePlan(id));
}
@DeleteMapping("cancellation")
@Operation(summary = "作废")
@Parameter(name = "id", description = "排单id", required = true)
@PreAuthorize("@ss.hasPermission('executor:plan:delete')")
public CommonResult<Boolean> cancellation(@RequestParam("id") Long id) {
return success(planService.cancellation(id));
}
@GetMapping("/get")
@Operation(summary = "获得生产单开料排单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@Operation(summary = "获得排单")
@Parameter(name = "id", description = "排单id", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
public CommonResult<PlanRespVO> getPlan(@RequestParam("id") Long id) {
PlanRespVO plan = planService.getPlan(id);
return success(BeanUtils.toBean(plan, PlanRespVO.class));
}
@GetMapping("getPlateByPlanId")
@Operation(summary = "根据排单id获取板材列表")
@Parameter(name = "id", description = "排单id", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
public CommonResult<List<PlateResList>> getPlateByPlanId(@Valid GetPlateByPlanIdVO vo) {
return success(planService.getPlateByPlanId(vo));
}
@GetMapping("/page")
@Operation(summary = "获得生产单开料排单分页")
@Operation(summary = "获得排单分页")
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
public CommonResult<PageResult<PlanRespVO>> getPlanPage(@Valid PlanPageReqVO pageReqVO) {
PageResult<PlanRespVO> pageResult = planService.getPlanPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PlanRespVO.class));
}
@GetMapping("getOrderPageByPlanId")
@GetMapping("getNotPlanOrderListPage")
@Operation(summary = "获取未排单的板材生产单板材分页列表")
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
public CommonResult<PageResult<OrderRespVO>> getOrderPage(@Valid OrderPageReqVO pageReqVO) {
public CommonResult<PageResult<OrderRespVOCopy>> getOrderPage(@Valid OrderPageReqVOCopy pageReqVO) {
return success(planService.getOrderPage(pageReqVO));
}
@GetMapping("getNotPlanPlateListPage")
@Operation(summary = "获取未排单的板材分页列表")
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
public CommonResult<PageResult<PlatePage>> getNotPlanPlateListPage(@Valid PlateReqPageVO pageVO) {
return success(planService.getNotPlanPlateListPage(pageVO));
}
@PostMapping("addPlate")
@Operation(summary = "添加板材")
@PreAuthorize("@ss.hasPermission('executor:plan:update')")
public CommonResult<Boolean> addPlate(@Valid @RequestBody AddPlateReq req) {
return success(planService.addPlate(req));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单开料排单 Excel")
@Operation(summary = "导出排单 Excel")
@PreAuthorize("@ss.hasPermission('executor:plan:export')")
@OperateLog(type = EXPORT)
public void exportPlanExcel(@Valid PlanPageReqVO pageReqVO,
@@ -95,8 +130,59 @@ public class PlanController {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PlanRespVO> list = planService.getPlanPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单开料排单.xls", "数据", PlanRespVO.class,
ExcelUtils.write(response, "排单.xls", "数据", PlanRespVO.class,
BeanUtils.toBean(list, PlanRespVO.class));
}
@GetMapping("/export-plate-excel")
@Operation(summary = "导出板材 Excel")
@PreAuthorize("@ss.hasPermission('executor:plan:export')")
@OperateLog(type = EXPORT)
public void exportPlateExcel(@Valid GetPlateByPlanIdVO vo,
HttpServletResponse response) throws IOException {
List<PlateResList> plateByPlanId = planService.getPlateByPlanId(vo);
// 导出 Excel
ExcelUtils.write(response, "排单板材.xls", "数据", PlateResList.class,
BeanUtils.toBean(plateByPlanId, PlateResList.class));
}
@GetMapping("test")
@Operation(summary = "test")
public Boolean test() {
ArrayList<Detail> details = new ArrayList<>();
for (int i = 0; i < 20; i++) {
Detail detail = RandomUtils.randomPojo(Detail.class);
IBoardProdInfo iBoardProdInfo = detail.getIBoardProdInfo();
iBoardProdInfo.setRawGoodsId(999L);
iBoardProdInfo.setGoodsName("abc");
iBoardProdInfo.setMaterial("ccc");
iBoardProdInfo.setColor("blue");
iBoardProdInfo.setBrand("xxx");
iBoardProdInfo.setSpec("xxxx");
iBoardProdInfo.setGoodType(1);
iBoardProdInfo.setWidth((float) 0.0);
iBoardProdInfo.setHeight((float) 0.0);
iBoardProdInfo.setThickness(5.0);
iBoardProdInfo.setSplitWidth(1);
iBoardProdInfo.setSplitHeight(1);
iBoardProdInfo.setSplitThickness(2);
iBoardProdInfo.setSealUp((float) 0.0);
iBoardProdInfo.setSealLeft((float) 0.0);
iBoardProdInfo.setSealRight((float) 0.0);
iBoardProdInfo.setSealDown((float) 0.0);
iBoardProdInfo.setTexture(1);
iBoardProdInfo.setOpenDoorType(1);
iBoardProdInfo.setTypographicFace(1);
detail.setMultiNum(23);
detail.setDepth(10.0);
detail.setHeight(9.0);
detail.getContourDetail().forEach(e->e.setTypographicFace(1));
detail.getSideModelDetail().forEach(e->e.setTypographicFace(1));
details.add(detail);
}
orderInputProcessor.input(details, 999L);
return Boolean.TRUE;
}
}
@@ -0,0 +1,47 @@
package com.cf.imes.module.executor.controller.admin.plan.bo;
import com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Beal
* 生产单源数据对象
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OrderSource {
@Schema(description = "机台数据")
private MachineDTO machineDTO;
@Schema(description = "排单数据")
private PlanDO planDO;
@Schema(description = "生产单列表")
private List<OrderDO> orders;
@Schema(description = "商品板材列表")
private List<GoodsDO> goods;
@Schema(description = "小板列表")
private List<PlateDO> plates;
@Schema(description = "小板造型列表")
private List<OrderModelDO> plateModels;
}
@@ -0,0 +1,56 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class BlockPlaceMessage {
@Schema(description = "自增板信息")
private String incrInfo;
@Schema(description = "大板ID")
private Integer bi;
@Schema(description = "小板号")
private Long bo;
@Schema(description = "位置X")
private Double x;
@Schema(description = "位置Y")
private Double y;
@Schema(description = "优化顺序")
private Double pi;
@Schema(description = "放置方式")
private Double ps;
@Schema(description = "开料顺序")
private Double ci;
@Schema(description = "下刀点位置")
private Double ca;
@Schema(description = "下刀点")
private Double cp;
@Schema(description = "未移动")
private Boolean ia;
@Schema(description = "是否重叠isOverlap")
private Boolean io;
@Schema(description = "是否排钻")
private Boolean dh;
@Schema(description = "是否造型")
private Boolean dm;
@Schema(description = "超限板 标识")
private Integer of;
@Schema(description = "板类型 普通=0 自增=1 ,余料=2(失效)")
private Integer type;
@Schema(description = "点阵")
private List<Point> points;
@Schema(description = "原造型偏移信息")
private OldSizeOutOff olgSizeOutOff;
@Schema(description = "尺寸扩展信息(造型)")
private SizeOutOff sizeOutOff;
@Schema(description = "跟优化位置 漂移多少?X")
private Double placeOffX;
@Schema(description = "跟优化位置 漂移多少?Y")
private Double placeOffY;
}
@@ -0,0 +1,9 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import java.awt.Point;
import java.util.ArrayList;
public class ContourData {
private ArrayList<Point> pts; //点集(二维向量(x,y))
private Integer[] buls; //凸度(0直线段 >0逆时针方向 <0顺时针方向)
}
@@ -0,0 +1,37 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.swing.*;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:58
*/
@Data
public class HoleDetail {
private Integer holeId;
@Schema(description = "孔类别 大孔 = 0, 小孔 = 10, 木削 = 20, 木削大孔 = 21, 层板钉 = 30, 通孔 = 40, 造型孔 = -10, 连接杆 = 50")
private Integer holeType;
@Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30")
private Integer face;
@Schema(description = "坐标x")
private Integer pointX;
@Schema(description = "坐标y")
private Integer pointY;
@Schema(description = "坐标z")
private Integer pointZ;
@Schema(description = "半径")
private Integer radius;
@Schema(description = "深度")
private Integer depth;
@Schema(description = "起点坐标")
private Integer endPoint;
private Integer pointX2;
private Integer pointY2;
private Integer angle;
}
@@ -0,0 +1,87 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author Beal
*/
@Data
public class Material {
@Schema(description = "生产单id")
private String orderId;
@Schema(description = "商品id")
private Integer goodsId;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "规范")
private String specification;
@Schema(description = "材质")
private String metrial;
@Schema(description = "颜色")
private String color;
@Schema(description = "品牌")
private String brank;
@Schema(description = "")
private Integer width;
@Schema(description = "")
private Integer length;
@Schema(description = "")
private Integer thickness;
@Schema(description = "修边值")
private Integer border;
@Schema(description = "开料刀直径")
private Integer cutDia;
@Schema(description = "开料间隙")
private Integer cutGap;
@Schema(description = "IsSorted")
private Boolean isSorted;
@Schema(description = "大板数")
private Integer boardCount;
@Schema(description = "最小大板ID")
private Integer minBoardId;
@Schema(description = "最大大板ID")
private Integer maxBoardId;
@Schema(description = "平均利用率")
private Double avgLyr_All;
@Schema(description = "前N平均利用率")
private Integer avgLyr_NoLastOne;
@Schema(description = "尾张利用率")
private Double lyr_LastOne;
@Schema(description = "组织id")
private Integer organId;
@Schema(description = "使用板信息列表")
private List<UsedBoardMessage> usedBoardMessageList;
@Schema(description = "小板信息列表")
private List<BlockPlaceMessage> blockPlaceMessageList;
@Schema(description = "状态")
private Integer state;
@Schema(description = "有纹路")
private Boolean hasTexture;
@Schema(description = "板材原宽")
private Integer orgWidth;
@Schema(description = "板材原长")
private Integer orgLength;
@Schema(description = "余料板数")
private Integer boardCountRemain;
@Schema(description = "余料板情况")
private String remainBoardMessage;
@Schema(description = "预洗值")
private Integer preCutValue;
@Schema(description = "废料板列表")
private List<ScrapBoard> remainBoardList;
@Schema(description = "是否辅助开料")
private Boolean helpCut;
@Schema(description = "同刀辅助 厚度")
private Integer sameKnifeHelpCutGap;
@Schema(description = "开料刀ID")
private Integer cutKnifeID;
@Schema(description = "辅助刀ID")
private Integer helpKnifeID;
@Schema(description = "最后保存时间")
private Date lastSaveDate;
}
@@ -0,0 +1,32 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:53
*/
@Data
public class ModelDetail {
@Schema(description = "造型ID")
private Integer modelId;
@Schema(description = "线ID")
private Integer lineId;
@Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30")
private Integer face;
@Schema(description = "刀号")
private String knifeName;
@Schema(description = "刀半径")
private Integer knifeRadius;
@Schema(description = "深度")
private Integer depth;
@Schema(description = "造型轮廓")
private OriginModelingData originModeling;
private List<ModelPoint> modelPoint;
private List<ModelOffSet> modelOffSet;
}
@@ -0,0 +1,19 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:51
*/
public class ModelOffSet {
private String name;
@Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30")
private Integer face;
private Integer value;
private Integer radius;
private Integer deep;
private Integer angle;
}
@@ -0,0 +1,16 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:49
*/
public class ModelPoint {
private Integer lineId;
private Integer pointId;
private Integer pointX;
private Integer pointY;
private Integer radius;
private Integer depth;
private Integer curve;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 17:00
*/
@Data
public class OldPointDetail {
@Schema(description = "点id")
private Long pointId;
@Schema(description = "x")
private Double pointX;
@Schema(description = "y")
private Double pointY;
@Schema(description = "曲线")
private Double curve;
@Schema(description = "密封尺寸")
private Double sealSize;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class OldSizeOutOff {
private Integer left;
private Integer right;
private Integer upper;
private Integer under;
@Schema(description = "板外扩宽")
private Integer width;
@Schema(description = "板外扩长")
private Integer length;
@Schema(description = "排版外扩宽")
private Integer outWidth;
@Schema(description = "排版外扩长")
private Integer outLength;
private Boolean hasDone;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Dictionary;
public class OriginModelingData {
@Schema(description = "轮郭")
private ContourData outline;
@Schema(description = "孔轮廓")
private Dictionary<String, ContourData> holes;
@Schema(description ="厚度" )
private Integer thickness;
@Schema(description = "0正面、1反面、2侧面")
private Integer dir;
@Schema(description = "刀半径")
private Integer knifeRadius;
@Schema(description = "槽加长")
private Integer addLen;
@Schema(description = "槽加宽")
private Integer addWidth;
@Schema(description = "槽加深")
private Integer addDepth;
}
@@ -0,0 +1,12 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class Point {
private Double x;
private Double y;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:57
*/
@Data
public class PointDetail {
@Schema(description = "点id")
private Long pointId;
@Schema(description = "x")
private Double pointX;
@Schema(description = "y")
private Double pointY;
@Schema(description = "曲线")
private Double curve;
@Schema(description = "密封尺寸")
private Double sealSize;
}
@@ -0,0 +1,31 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class ScrapBlock {
@Schema(description = "余料号")
private Long scrapNo;
@Schema(description = "是否异形")
private Boolean isUnRegular;
@Schema(description = "是否重叠")
private Boolean isOverlap;
@Schema(description = "是否已录入")
private Boolean isInstored;
private List<Point> points;
private String remark;
@Schema(description = "坐标X")
private Double placeX;
@Schema(description = "坐标Y")
private Double placeY;
@Schema(description = "开料宽")
private Double placeWidth;
@Schema(description = "开料长")
private Double placeLength;
}
@@ -0,0 +1,45 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Beal
*/
@NoArgsConstructor
@Data
public class ScrapBoard {
@Schema(description ="源排单号")
private String planCode;
@Schema(description ="使用排单号")
private String usedPlanCode;
@Schema(description ="ID")
private Long id;
@Schema(description ="排单ID")
private Long planId;
@Schema(description ="源排单ID")
private Long oldPlanId;
@Schema(description ="未使用 = 0, 已使用 = 1")
private Integer status;
@Schema(description ="正面 = 0, 正面右转 = 1, 正面后转 = 2, 正面左转 = 3, 反面 = 4, 反面右转 = 5, 反面后转 = 6, 反面左转 = 7")
private Integer placedStyle;
@Schema(description ="仓库")
private String storeHouse;
@Schema(description ="Count")
private Integer count;
@Schema(description ="备注")
private String remark;
@Schema(description ="OutLineJson")
private String outLineJson;
@Schema(description ="组织id")
private Integer organId;
@Schema(description ="原始多段线")
private List<ScrapPt> basePolyline;
@Schema(description ="放置的多段线")
private List<ScrapPt> placedPolyline;
private Boolean isUsed;
}
@@ -0,0 +1,13 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class ScrapPt {
private Double x;
private Double y;
private Double bul;
}
@@ -0,0 +1,25 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 18:02
*/
@Data
public class SideHoleDetail {
private Integer holeID;
private Integer holeType; // 请定义HoleType枚举类型
private Integer face; // 请定义FaceType枚举类型
private Integer pointX;
private Integer pointY;
private Integer pointZ;
private Integer radius;
private Integer depth;
private String endPoint;
private Integer pointX2;
private Integer pointY2;
private Integer angle;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
import java.util.List;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 17:59
*/
@Data
public class SideModelDetail {
private Integer modelId;
private Integer lineId;
private int face;
private String knifeName;
private Integer knifeRadius;
private Integer depth;
private OriginModelingData originModeling;
private List<ModelPoint> modelPoint;
private List<ModelOffSet> modelOffSet;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class SizeOutOff {
private Double left;
private Double right;
private Double upper;
private Double under;
@Schema(description = "板外扩宽")
private Double width;
@Schema(description = "板外扩长")
private Double length;
@Schema(description = "排版外扩 宽")
private Double outWidth;
@Schema(description = "排版外扩 长")
private Double outLength;
private Boolean hasDone;
}
@@ -0,0 +1,39 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class UsedBoardMessage {
@Schema(description = "大板id")
private Integer bi;
@Schema(description = "")
private Integer w;
@Schema(description = "长度")
private Integer l;
@Schema(description = "余料板ID")
private Integer si;
/*@Schema(description = "仓库号")
private String so;*/
@Schema(description = "余料板号,大板为空")
private String no;
@Schema(description = "RM")
private String rm;
@Schema(description = "是否锁定")
private Boolean lK;
@Schema(description = "余料母板")
private List<ScrapPt> remainPtList;
@Schema(description = "余料空间")
private List<ScrapBlock> remainBlocks;
@Schema(description = "左边不能加工区域,有造型")
private Boolean le;
@Schema(description = "右边不能加工区域,有造型")
private Boolean re;
@Schema(description = "WLs")
private List<String> wLs;
}
@@ -0,0 +1,37 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NonNull;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author there
*/
@Data
public class AddPlateReq {
@NotNull(message = "排单id")
@Schema(description = "排单id")
private Long planId;
@NotEmpty(message = "列表不能空")
@JsonProperty("list")
private List<Obj> list;
@Valid
@Data
public static class Obj {
@NotNull(message = "生产单id不能空")
@Schema(description = "生产单id")
private Long orderId;
@NotNull(message = "板材id不能空")
@Schema(description = "板材id")
private Long plateId;
}
}
@@ -0,0 +1,42 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @author Beal
*/
@Data
public class AddRemainReqVO {
@Schema(description = "排单id")
private Long planId;
@NotNull(message = "宽 不能空")
@Schema(description = "")
private BigDecimal width;
@NotNull(message = "长 不能空")
@Schema(description = "")
private BigDecimal length;
@NotNull(message = "数量 不能空")
@Schema(description = "数量")
private Integer count;
@Schema(description = "商品id")
private String goodsId;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "材料")
private String material;
@Schema(description = "颜色")
private String color;
}
@@ -0,0 +1,43 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
public class GetPlateByPlanIdVO {
@Schema(description = "排单id")
@NotNull(message = "排单id不能空")
private Long planId;
@Schema(description = "矩形")
private boolean rectangle;
@Schema(description = "异形")
private boolean specialShaped;
@Schema(description = "造型")
private boolean sculpt;
@Schema(description = "有挖穿造型")
private boolean holeThrough;
@Schema(description = "有挖穿孔")
private boolean burrow;
@Schema(description = "有二维纹路")
private boolean twoDimensionalToolPath;
@Schema(description = "开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date beginDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endDate;
@Schema(description = "长 小范围")
private BigDecimal longMinRang;
@Schema(description = "长 大范围")
private BigDecimal longMaxRang;
@Schema(description = "宽 小范围")
private BigDecimal widthMinRang;
@Schema(description = "宽 大范围")
private BigDecimal widthMaxRang;
}
@@ -0,0 +1,29 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author Beal
*/
@Data
@Schema(description = "")
public class GetSourceDataReq {
@Schema(description = "生产单id")
@NotNull(message = "生产单id不能空")
private Long orderId;
@Schema(description = "数据源id")
@NotNull(message = "数据源id不能空")
private Long dataSourceId;
@Schema(description = "排单id")
private Long planId;
@Schema(description = "包裹id")
private Long packageId;
}
@@ -0,0 +1,53 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.models.security.SecurityScheme;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Beal
*/
@Data
@Schema(description = "优化算法入参")
@Builder
public class OptimizeParamResVO {
@Schema(description = "小板列表")
private List<PlateParam> plates;
@Schema(description = "原料板规格列表")
private List<RawSize> rawSizes;
@Schema(description = "余料板数量")
private List<Integer> remainPlateCount;
@Schema(description = "优化次数")
private Integer optimizeCount;
@Schema(description = "双面加工的小板是否优先排入")
private Boolean isdTwoSided;
@Schema(description = "排版缝隙 = 开料刀直径 + 缝隙 ")
private BigDecimal gap;
@Schema(description = "算法")
private Boolean hssf;
@Schema(description = "余料板是否排入双面加工的小板")
private Boolean remainPlateBoardDo2FaceBlock;
@Data
@Schema(description = "原料板规格")
@Builder
public static class RawSize {
@Schema(description = "")
private BigDecimal length;
@Schema(description = "")
private BigDecimal width;
@Schema(description = "x")
private BigDecimal x;
@Schema(description = "y")
private BigDecimal y;
}
}
@@ -0,0 +1,66 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.cf.imes.module.executor.controller.admin.plan.dto.Material;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
/**
* @author Beal
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OptimizeParamRespVO {
@Schema(description = "排单id")
private Long planId;
@Schema(description = "排单号")
private String planNo;
@Schema(description = "排序优先级")
private Integer sort;
@Schema(description = "排单类型:1 混单排单,2 生产单排单")
private Integer type;
@Schema(description = "排单状态 0 新单,1 板材已申请,2 开料中,3 已开料")
private Integer status;
@Schema(description = "机台 ID")
private Long machineId;
@Schema(description = "计划时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date planTime;
@Schema(description = "生产单号")
private String orderNos;
@Schema(description = "排单优化文件地址")
private String placeDateFileUrl;
@Schema(description = "排单优化文件地址")
private String placeOrderFileUrl;
@Schema(description = "备注")
private String remark;
@Schema(description = "生产操作人")
private String operator;
@Schema(description = "生产时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date produceTime;
@Schema(description = "生产单列表")
private List<OrderResp> orderList;
@Schema(description = "大板使用信息列表")
private List<Material> materialList;
/*@Schema(description = "商品列表")
private List<GoodsRespVO> goodsList;*/
@Schema(description = "小板列表")
private List<PlateRespVO> plateList;
@Schema(description = "区域删除")
private Boolean areaDeleted;
@Schema(description = "源id")
private Long sourceNo;
}
@@ -1,81 +0,0 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author there
*/
@NoArgsConstructor
@Data
public class OrderPageReqVO extends PageParam {
@Schema(description = "生产单id")
private Long orderId;
@Schema(description = "商品id")
private Long goodsId;
@Schema(description = "自定义id")
private String defaultId;
@Schema(description = "客户")
private String consignee;
@Schema(description = "地址")
private String consigneeAddress;
@Schema(description = "状态列表")
private List<Integer> stateList;
@Schema(description = "形状搜索条件")
private CheckDicBean checkDic;
@Schema(description = "开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date beginDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endDate;
@Schema(description = "长范围")
private LongRangBean longRang;
@Schema(description = "宽范围")
private WidthRangBean widthRang;
@NoArgsConstructor
@Data
public static class CheckDicBean {
@Schema(description = "矩形")
private boolean rectangle;
@Schema(description = "异形")
private boolean specialShaped;
@Schema(description = "造型")
private boolean sculpt;
@Schema(description = "有挖穿造型")
private boolean holeThrough;
@Schema(description = "有挖穿孔")
private boolean burrow;
@Schema(description = "有二维纹路")
private boolean twoDimensionalToolPath;
}
@NoArgsConstructor
@Data
public static class LongRangBean {
@Schema(description = "生产单id")
private BigDecimal min;
@Schema(description = "生产单id")
private BigDecimal max;
}
@NoArgsConstructor
@Data
public static class WidthRangBean {
@Schema(description = "生产单id")
private BigDecimal min;
@Schema(description = "生产单id")
private BigDecimal max;
}
}
@@ -0,0 +1,60 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.cf.imes.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author there
*/
@NoArgsConstructor
@Data
public class OrderPageReqVOCopy extends PageParam {
@Schema(description = "生产单id")
private Long orderId;
@Schema(description = "商品id")
private String goodsId;
@Schema(description = "自定义id")
private String defaultId;
@Schema(description = "客户")
private String consignee;
@Schema(description = "地址")
private String consigneeAddress;
@Schema(description = "状态列表")
private List<Integer> stateList;
@Schema(description = "矩形")
private boolean rectangle;
@Schema(description = "异形")
private boolean specialShaped;
@Schema(description = "造型")
private boolean sculpt;
@Schema(description = "有挖穿造型")
private boolean holeThrough;
@Schema(description = "有挖穿孔")
private boolean burrow;
@Schema(description = "有二维纹路")
private boolean twoDimensionalToolPath;
@Schema(description = "开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date beginDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endDate;
@Schema(description = "长 小范围")
private BigDecimal longMinRang;
@Schema(description = "长 大范围")
private BigDecimal longMaxRang;
@Schema(description = "宽 小范围")
private BigDecimal widthMinRang;
@Schema(description = "宽 大范围")
private BigDecimal widthMaxRang;
}
@@ -0,0 +1,52 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
/**
* @author Beal
*/
@Data
public class OrderResp {
@Schema(description = "生产单id")
private Long orderId;
@Schema(description = "父id")
private Long parentNo;
@Schema(description = "自定义单号")
private String customOrderNo;
@Schema(description = "客户")
private String customer;
@Schema(description = "地址")
private String address;
@Schema(description = "客户电话")
private String phoneNumber;
@Schema(description = "经销商")
private String dealer;
@Schema(description = "经销商电话")
private String dealerPhoneNumber;
@Schema(description = "业务员")
private String salesman;
@Schema(description = "拆单员")
private String splitter;
@Schema(description = "备注")
private String remark;
@Schema(description = "交付日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date deliveryDate;
@Schema(description = "生产单类型,1主单 2子单")
private Integer type;
@Schema(description = "生产单排序号")
private Integer sort;
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel")
private Integer dataType;
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成")
private Integer status;
}
@@ -21,7 +21,7 @@ import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderRespVO {
public class OrderRespVOCopy {
@Schema(description = "生产单id")
private Long orderId;
@Schema(description = "自定义单号")
@@ -37,6 +37,8 @@ public class OrderRespVO {
private int num;
@Schema(description = "平方")
private BigDecimal area = new BigDecimal("0");
@Schema(description = "商品id")
private String goodsId;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "颜色")
@@ -41,6 +41,10 @@ public class PlanRespVO {
@ExcelProperty("机台 ID")
private Long machineId;
@Schema(description = "机台 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16707")
@ExcelProperty("机台 名称")
private String machineName;
@Schema(description = "计划时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("计划时间")
private LocalDateTime planTime;
@@ -41,8 +41,8 @@ public class PlanSaveReqVO {
@NotNull(message = "计划时间不能为空")
private LocalDateTime planTime;
@Schema(description = "生产单id列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Long> orderIds;
/*@Schema(description = "生产单id列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Long> orderIds;*/
@Schema(description = "板件id列表")
private List<Long> plateIds;
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @author there
@@ -21,17 +22,17 @@ public class PlateInfoVO {
private String material;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double width;
private BigDecimal width;
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "高度不能为空")
private Double height;
private BigDecimal height;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
private Double thickness;
private BigDecimal thickness;
@Schema(description = "面积")
private Double area;
private BigDecimal area;
@Schema(description = "数量")
private Integer count;
@@ -0,0 +1,46 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* @author there
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PlateOptimize {
@Schema(description = "是否已排")
private Boolean isPlan;
@Schema(description = "商品id")
private String goodsId;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "商品材质")
private String material;
@Schema(description = "商品颜色")
private String color;
@Schema(description = "")
private BigDecimal width;
@Schema(description = "")
private BigDecimal height;
@Schema(description = "")
private BigDecimal thickness;
@Schema(description = "小板数量")
private Integer plateNum;
@Schema(description = "有纹路")
private Boolean hasLines;
@Schema(description = "余料板列表")
private List<RemainPlateDO> plateDOList;
}
@@ -0,0 +1,43 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author there
*/
@Data
public class PlatePage {
@Schema(description = "板材id")
private Long plateId;
@Schema(description = "生产单id")
private Long orderId;
@Schema(description = "商品id")
private String goodsId;
@Schema(description = "板名称")
private String name;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "商品材质")
private String material;
@Schema(description = "商品颜色")
private String color;
@Schema(description = "")
private BigDecimal width;
@Schema(description = "")
private BigDecimal height;
@Schema(description = "")
private BigDecimal thickness;
@Schema(description = "面积")
private BigDecimal area;
@Schema(description = "客户")
private String customer;
@Schema(description = "地址")
private String address;
@Schema(description = "自定义单号")
private String customOrderNo;
@Schema(description = "备注")
private String remark;
}
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author Beal
*/
@Data
public class PlateParam {
@Schema(description = "id")
private Long id;
@Schema(description = "板编号")
private String plateNo;
@Schema(description = "")
private BigDecimal length;
@Schema(description = "")
private BigDecimal width;
@Schema(description = "纹路类型 0 正纹 1 可翻转 2 反纹")
private Integer texture;
@Schema(description = " 排孔类型,0 正纹 1 反面 2 随意面")
private Integer holeArrange;
@Schema(description = "孔面类型")
private Integer holeFace;
@Schema(description = "是否矩形")
private Boolean isRect;
@Schema(description = "有网洞")
private Boolean hasHole;
@Schema(description = "是否双面")
private Boolean isdTwoSided;
}

Some files were not shown because too many files have changed in this diff Show More