mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
+2
-2
@@ -32,9 +32,9 @@ public class GlobalErrorCodeConstants {
|
||||
public static final ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启");
|
||||
|
||||
// ES文档更新失败
|
||||
public static final ErrorCode ES_ERROR_UPDATE = new ErrorCode(503, "数据异常,请勿点击过快,请稍等再试");
|
||||
// ES文档删除失败
|
||||
public static final ErrorCode ES_ERROR_DELETE = new ErrorCode(504, "数据异常,请勿点击过快,请稍等再试");
|
||||
// ES文档刷新失败
|
||||
public static final ErrorCode ES_DATA_ERROR = new ErrorCode(503, "数据异常,请勿点击过快,请稍等再试");
|
||||
public static final ErrorCode DATA_EXCEPTION_ERROR = new ErrorCode(505, "数据异常,请联系客服处理");
|
||||
public static final ErrorCode DATA_DATA_ERROR = new ErrorCode(506, "文档数据异常,请稍后重试或联系客服处理");
|
||||
|
||||
|
||||
+6
@@ -17,6 +17,12 @@ import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.e
|
||||
*/
|
||||
public class AssertUtils {
|
||||
|
||||
|
||||
private AssertUtils() {
|
||||
throw new IllegalStateException("AssertUtils class");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 判断是否为空,可以不用if语句,简化代码
|
||||
* */
|
||||
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plan.dto.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@Data
|
||||
public class PlateDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5934179383701994502L;
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "点详情列表")
|
||||
private List<PointDetail> pointDetailList;
|
||||
|
||||
@Schema(description = "孔详情列表")
|
||||
private List<HoleDetail> holeDetailList;
|
||||
|
||||
@Schema(description = "造型列表")
|
||||
private List<ModelDetail> modelDetailList;
|
||||
|
||||
@Schema(description = "偏移量")
|
||||
private OffSet offSet;
|
||||
|
||||
@Schema(description = "是否新版本")
|
||||
private Boolean newVersion;
|
||||
|
||||
@Schema(description = "原始点详情列表")
|
||||
private List<OldPointDetail> oldPointDetailList;
|
||||
|
||||
@Schema(description = "开料尺寸")
|
||||
private KaiLiaoSize kaiLiaoSize;
|
||||
|
||||
@Schema(description = "边模型详情列表")
|
||||
private List<SideModelDetail> sideModelDetails;
|
||||
|
||||
@Schema(description = "边孔详情")
|
||||
private List<SideHoleDetail> sideHoleDetailList;
|
||||
|
||||
}
|
||||
+1
-10
@@ -110,15 +110,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
List<GoodsDO> selectPlanGoodsDataSource(@Param("filed") String filed,@Param("planId") Long planId ,@Param("organId") Long organId);
|
||||
|
||||
|
||||
// default GoodsDO selectGoodsId(Long orderId, String goodsId, Long organId) {
|
||||
// return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
// .eq(GoodsDO::getOrganId, organId)
|
||||
// .eq(GoodsDO::getDeleted, false)
|
||||
// .eq(GoodsDO::getGoodsId, goodsId)
|
||||
// .eq(GoodsDO::getOrderId, orderId)
|
||||
// .select(GoodsDO::getId));
|
||||
//
|
||||
// }
|
||||
|
||||
GoodsDO selectGoodsId(@Param("orderId") Long orderId,@Param("goodsId") String goodsId,@Param("organId") Long organId);
|
||||
|
||||
@@ -217,7 +208,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
.inIfPresent(GoodsDO::getOrderId,orderIds)
|
||||
.in(GoodsDO::getOrderId,orderIds)
|
||||
.eq(GoodsDO::getPlanId,0)
|
||||
.select(GoodsDO::getOrderId));
|
||||
|
||||
|
||||
+2
-3
@@ -98,7 +98,6 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
// IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage page,@Param("pageReqVO") OrderPageReqVOCopy pageReqVO, @Param("organId") Long organId);
|
||||
|
||||
Map<String, Object> selectDynamicSqlString(@Param("sqlStr") String sqlStr);
|
||||
|
||||
@@ -273,9 +272,9 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
default List<OrderDO> selectOrderPackList(List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.inIfPresent(OrderDO::getId,orderIds)
|
||||
.in(OrderDO::getId,orderIds)
|
||||
.eq(OrderDO::getPackaged, OrderPackageStatusEnum.PACKAGED.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
+37
-15
@@ -6,6 +6,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import co.elastic.clients.elasticsearch.indices.RefreshRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
@@ -188,6 +189,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateByPlateNo(plateNo.stream().distinct().toList(), getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDOS,ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(plateDOS.stream().map(PlateDO::getOrderId).distinct().toList());
|
||||
|
||||
@@ -230,7 +232,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
|
||||
if(cutedBoardNumber > 0){
|
||||
@@ -247,15 +249,21 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
planMapper.updateById(planDO);
|
||||
|
||||
List<Long> deleteOrderIds = goodsMapper.selectNoPlanOrdersListByOrderIds(orderIds, getUserOrganId()).stream().map(GoodsDO::getOrderId).distinct().toList();
|
||||
// 需要去除的生产单ID
|
||||
List<Long> deleteOrderIds = new ArrayList<>();
|
||||
|
||||
// 筛选出还有未排单的生产单ID
|
||||
deleteOrderIds.addAll(goodsMapper.selectNoPlanOrdersListByOrderIds(orderIds, getUserOrganId()).stream().map(GoodsDO::getOrderId).distinct().toList());
|
||||
|
||||
// 筛选出生产单对应的排单里状态为 未排单的 生产单ID
|
||||
deleteOrderIds.addAll(goodsMapper.selectOrderPlanList(orderIds, getUserOrganId()));
|
||||
|
||||
// 去除
|
||||
orderIds.removeAll(deleteOrderIds);
|
||||
|
||||
if(ObjectUtil.isNotEmpty(orderIds)) {
|
||||
|
||||
List<Long> orderIdList = goodsMapper.selectOrderPlanList(orderIds, getUserOrganId());
|
||||
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderPackList(orderIdList, getUserOrganId());
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderPackList(orderIds, getUserOrganId());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(orderDOS)) {
|
||||
List<OrderDO> orderDOList = orderDOS.stream().map(m -> m.setStatus(OrderStatusEnum.FINISH_PRODUCTION.getStatus())).toList();
|
||||
@@ -333,7 +341,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
|
||||
if(cutedBoardInfo.getCutedBoardNumber() == 0){
|
||||
@@ -708,7 +716,8 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 保存优化后的大板数据
|
||||
batchSaveBoardModel(req.getOptimizeBoardModelDOS());
|
||||
|
||||
|
||||
// ES文档数据刷新
|
||||
refresh(ORDER_REMAIN_PLATE_MODEL);
|
||||
|
||||
plateMapper.updatePlateOptimized(orderIds,ids,getUserOrganId());
|
||||
|
||||
@@ -774,12 +783,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
*/
|
||||
public void batchSaveBoardModel(List<OptimizeBoardModelDO> optimizeBoardModelDOS) {
|
||||
try {
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDOS);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error("优化生产ES文档保存数据异常: "+bulkResponse.items().toString());
|
||||
throw new ServiceException(DATA_DATA_ERROR);
|
||||
}
|
||||
|
||||
esDocumentService.bulkCreate(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDOS);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("优化生产ES文档保存数据异常: "+e.getMessage());
|
||||
@@ -905,12 +911,28 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), planIds);
|
||||
} catch (Exception e) {
|
||||
log.error("Error deleting documents with planId {}: {}", planIds, e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_DELETE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void refresh( String index) {
|
||||
|
||||
try {
|
||||
|
||||
// 创建刷新请求
|
||||
RefreshRequest refreshRequest = new RefreshRequest.Builder().index(index).build();
|
||||
|
||||
elasticsearchClient.indices().refresh(refreshRequest);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("ES文档数据刷新失败:"+e.getMessage());
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -992,7 +992,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), planIds);
|
||||
} catch (Exception e) {
|
||||
log.error("Error deleting documents with planId {}: {}", planIds, e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_DELETE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -50,8 +50,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_ERROR_UPDATE;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
@@ -175,7 +174,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_UPDATE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -467,7 +467,7 @@
|
||||
<foreach item="orderIds" collection="orderIds" open="(" separator="," close=")">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
and op.status = 2
|
||||
and op.status in (0,1);
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
+138
-122
@@ -36,6 +36,7 @@ import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -47,7 +48,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||
@@ -56,7 +56,6 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
@Transactional
|
||||
public class PackServiceImpl implements PackService {
|
||||
|
||||
@Resource
|
||||
@@ -101,104 +100,21 @@ public class PackServiceImpl implements PackService {
|
||||
List<Long> orderIds = new ArrayList<>();
|
||||
|
||||
|
||||
IPage<PackRespVO> packRespVOS = new PageDTO<>();
|
||||
|
||||
|
||||
if (pageReqVO.getIsUp() != null) {
|
||||
|
||||
OrderDO order = ordersMapper.selectById(pageReqVO.getOrderId());
|
||||
|
||||
// 判断是否为空
|
||||
AssertUtils.notEmpty(order,ORDER_DATE_ERROR);
|
||||
|
||||
List<PackRespVO> packRespVOList = pageReqVO.getIsUp() ?
|
||||
ordersMapper.selectOrderIds(order.getCreateTime().toString(), getUserOrganId(), order.getId()) :
|
||||
|
||||
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
||||
|
||||
if (packRespVOList.isEmpty()) {
|
||||
throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, pageReqVO.getIsUp() ? "第" : "最后");
|
||||
}
|
||||
|
||||
packRespVOS.setRecords(packRespVOList);
|
||||
|
||||
packRespVOS.setTotal(1);
|
||||
|
||||
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
||||
|
||||
return handleIsUpCase(pageReqVO, orderIds,pageReqVO.getIsUp());
|
||||
|
||||
} else {
|
||||
|
||||
pageReqVO.setCustomer(insertSeparator(pageReqVO.getCustomer()));
|
||||
pageReqVO.setCustomOrderNo(insertSeparator(pageReqVO.getCustomOrderNo()));
|
||||
pageReqVO.setAddress(insertSeparator(pageReqVO.getAddress()));
|
||||
|
||||
|
||||
// 查询查询分页
|
||||
packRespVOS = ordersMapper.selectOrderIdList(page, pageReqVO, getUserOrganId());
|
||||
|
||||
if (CollUtil.isEmpty(packRespVOS.getRecords())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
||||
|
||||
if (orderIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 查询板材的总量
|
||||
List<PackRespVO> packRespVOList = orderPlateMapper.selectPlateNum(orderIds, getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(packRespVOList, ErrorCodeConstants.ORDER_PLATE_ERROR);
|
||||
|
||||
for (PackRespVO packRespVO : packRespVOList) {
|
||||
packRespVO.setTotalPieceCount((long) packRespVO.getPlateIdList().size());
|
||||
packRespVO.setPlateIdList(null);
|
||||
}
|
||||
|
||||
|
||||
// 查询当前生产的包裹数量
|
||||
List<PackRespVO> respVOS = orderPackageMapper.selectPackPage(orderIds, getUserOrganId());
|
||||
|
||||
|
||||
for (PackRespVO packRespVO : respVOS) {
|
||||
packRespVO.setPackCount((long) packRespVO.getPackIdList().size());
|
||||
packRespVO.setPackIdList(null);
|
||||
}
|
||||
|
||||
|
||||
// 查询当前生产单已经打包的板材数量
|
||||
List<PackRespVO> plateNum = orderPackageMapper.selectPackPieceCount(orderIds, getUserOrganId());
|
||||
|
||||
for (PackRespVO packRespVO : plateNum) {
|
||||
packRespVO.setPackPieceCount((long) packRespVO.getPlateIdList().size());
|
||||
packRespVO.setPlateIdList(null);
|
||||
}
|
||||
|
||||
|
||||
for (PackRespVO record : packRespVOS.getRecords()) {
|
||||
|
||||
// 板材总数
|
||||
record.setTotalPieceCount(packRespVOList.stream().filter(f -> Objects.equals(f.getId(), record.getId())).mapToLong(PackRespVO::getTotalPieceCount).sum());
|
||||
// 已打包数
|
||||
record.setPackCount(respVOS.stream().filter(f -> Objects.equals(f.getId(), record.getId())).mapToLong(PackRespVO::getPackCount).sum());
|
||||
// 已打包片数
|
||||
record.setPackPieceCount(plateNum.stream().filter(f -> Objects.equals(f.getId(), record.getId())).mapToLong(PackRespVO::getPackPieceCount).sum());
|
||||
// 待处理量
|
||||
record.setPendingNum(record.getTotalPieceCount() - record.getPackPieceCount());
|
||||
return handleNormalCase(pageReqVO, orderIds, page);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new PageResult<>(packRespVOS.getRecords(), packRespVOS.getTotal());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 查看生产订单对应的板材信息
|
||||
@Override
|
||||
public List<PlateDetailsRespVO> getOrderPlateList(Long orderId) {
|
||||
@@ -207,20 +123,20 @@ public class PackServiceImpl implements PackService {
|
||||
List<PlateDetailsRespVO> plateDetailsRespVOS = orderPlateMapper.selectOrderNoPackPlateList(orderId, getUserOrganId());
|
||||
|
||||
if(plateDetailsRespVOS.isEmpty()){
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
for (PlateDetailsRespVO plateDetailsRespVO : plateDetailsRespVOS) {
|
||||
String name = "";
|
||||
StringBuilder name = new StringBuilder();
|
||||
if (!plateDetailsRespVO.getProcessGroupNameList().isEmpty()) {
|
||||
for (GroupNameList groupNameList : plateDetailsRespVO.getProcessGroupNameList()) {
|
||||
// 去除最后的逗号
|
||||
name += groupNameList.getName() + ",";
|
||||
name.append(groupNameList.getName()).append(",");
|
||||
|
||||
}
|
||||
name = name.substring(0, name.length() - 1);
|
||||
name = new StringBuilder(name.substring(0, name.length() - 1));
|
||||
}
|
||||
plateDetailsRespVO.setProcessGroup(name);
|
||||
plateDetailsRespVO.setProcessGroup(name.toString());
|
||||
}
|
||||
|
||||
return plateDetailsRespVOS;
|
||||
@@ -238,7 +154,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
if (plateDetailsRespVOS.isEmpty()) {
|
||||
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<Long> packageIds = plateDetailsRespVOS.stream().map(PlateDetailsRespVO::getPackageId).distinct().toList();
|
||||
@@ -249,15 +165,15 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
|
||||
for (PlateDetailsRespVO plateDetailsRespVO : plateDetailsRespVOS) {
|
||||
String name = "";
|
||||
StringBuilder name = new StringBuilder();
|
||||
if (!plateDetailsRespVO.getProcessGroupNameList().isEmpty()) {
|
||||
for (GroupNameList groupNameList : plateDetailsRespVO.getProcessGroupNameList()) {
|
||||
// 去除最后的逗号
|
||||
name += groupNameList.getName() + ",";
|
||||
name.append(groupNameList.getName()).append(",");
|
||||
}
|
||||
name = name.substring(0, name.length() - 1);
|
||||
name = new StringBuilder(name.substring(0, name.length() - 1));
|
||||
}
|
||||
plateDetailsRespVO.setProcessGroup(name);
|
||||
plateDetailsRespVO.setProcessGroup(name.toString());
|
||||
|
||||
plateDetailsRespVO.setPackageNo(orderPackageDOS.stream()
|
||||
.filter(m -> m.getId().equals(plateDetailsRespVO.getPackageId()))
|
||||
@@ -284,18 +200,18 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
OrderDO orderDO = ordersMapper.selectById(reqVO.getOrderId());
|
||||
|
||||
// AssertUtils.notEmpty(orderPackageVOS,orderDO,ORDER_PLATE_ERROR);
|
||||
AssertUtils.notEmpty(orderDO,ORDER_DATE_ERROR);
|
||||
|
||||
|
||||
|
||||
return orderPackageVOS.stream().peek(m -> {
|
||||
orderPackageVOS.forEach(m -> {
|
||||
m.setCustomOrderNo(orderDO.getCustomOrderNo());
|
||||
m.setCustomer(orderDO.getCustomer());
|
||||
m.setAddress(orderDO.getAddress());
|
||||
m.setDealer(orderDO.getDealer());
|
||||
m.setOrderRemark(orderDO.getRemark());
|
||||
}
|
||||
).toList();
|
||||
);
|
||||
|
||||
return orderPackageVOS;
|
||||
|
||||
}
|
||||
|
||||
@@ -353,20 +269,7 @@ public class PackServiceImpl implements PackService {
|
||||
public List<OrderPartsRespVO> getPartsList(OrderPartsReqVO reqVO) {
|
||||
|
||||
|
||||
List<OrderPartsRespVO> orderPartsRespVOS = orderPartsMapper.selectPartsList(reqVO.getOrderId(), getUserOrganId());
|
||||
|
||||
|
||||
return orderPartsRespVOS;
|
||||
|
||||
// PageDTO<OrderPartsRespVO> page = new PageDTO<>(reqVO.getPageNo(), reqVO.getPageSize());
|
||||
//
|
||||
// IPage<OrderPartsRespVO> orderPartsRespVOS = orderPartsMapper.selectPartsList(page,reqVO.getOrderId(),getUserOrganId());
|
||||
//
|
||||
// if (CollectionUtil.isEmpty(orderPartsRespVOS.getRecords())) {
|
||||
// return new PageResult<>();
|
||||
// }
|
||||
//
|
||||
// return new PageResult<>(orderPartsRespVOS.getRecords(), orderPartsRespVOS.getTotal());
|
||||
return orderPartsMapper.selectPartsList(reqVO.getOrderId(), getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
@@ -395,7 +298,8 @@ public class PackServiceImpl implements PackService {
|
||||
// 判断当前生产单的板材和配件是否已全部打包且当前生产单的包裹已全部封包
|
||||
if (validateOrderPack(reqVO.getOrderId())) {
|
||||
|
||||
updateOrderStatus(reqVO.getOrderId());
|
||||
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||
p.updateOrderStatus(reqVO.getOrderId());
|
||||
|
||||
}
|
||||
|
||||
@@ -449,7 +353,8 @@ public class PackServiceImpl implements PackService {
|
||||
// 判断当前生产单的板材和配件是否已全部打包且当前生产单的包裹已全部封包
|
||||
if (validateOrderPack(reqVO.getOrderId())) {
|
||||
|
||||
updateOrderStatus(reqVO.getOrderId());
|
||||
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||
p.updateOrderStatus(reqVO.getOrderId());
|
||||
|
||||
}
|
||||
|
||||
@@ -511,7 +416,9 @@ public class PackServiceImpl implements PackService {
|
||||
}
|
||||
|
||||
if (validateOrderPack(packageVO.getOrderId())) {
|
||||
updateOrderStatus(packageVO.getOrderId());
|
||||
|
||||
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||
p.updateOrderStatus(packageVO.getOrderId());
|
||||
}
|
||||
|
||||
return typeConversion(orderPackageDO);
|
||||
@@ -565,7 +472,8 @@ public class PackServiceImpl implements PackService {
|
||||
if (validateOrderPack(packageVO.getOrderId())) {
|
||||
|
||||
// 修改生产单的打包状态
|
||||
updateOrderStatus(packageVO.getOrderId());
|
||||
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||
p.updateOrderStatus(packageVO.getOrderId());
|
||||
|
||||
}
|
||||
|
||||
@@ -620,7 +528,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
List<OrderPackageDO> orderPackageDOS = orderPackageMapper.selectPackStatus(orderId, getUserOrganId());
|
||||
|
||||
return orderPackageDOS.stream().map(this::typeConversion).collect(Collectors.toList());
|
||||
return orderPackageDOS.stream().map(this::typeConversion).toList();
|
||||
|
||||
}
|
||||
|
||||
@@ -1004,4 +912,112 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 打包翻页查询
|
||||
private PageResult<PackRespVO> handleIsUpCase(PackPageReqVO pageReqVO, List<Long> orderIds,Boolean isUp) {
|
||||
|
||||
IPage<PackRespVO> packRespVOS = new PageDTO<>();
|
||||
|
||||
OrderDO order = ordersMapper.selectById(pageReqVO.getOrderId());
|
||||
AssertUtils.notEmpty(order, ORDER_DATE_ERROR);
|
||||
|
||||
List<PackRespVO> packRespVOList = Boolean.TRUE.equals(isUp) ?
|
||||
ordersMapper.selectOrderIds(order.getCreateTime().toString(), getUserOrganId(), order.getId()) :
|
||||
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
||||
|
||||
if (packRespVOList.isEmpty()) {
|
||||
throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后");
|
||||
}
|
||||
packRespVOS.setRecords(packRespVOList);
|
||||
|
||||
packRespVOS.setTotal(1);
|
||||
|
||||
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
||||
|
||||
return buildPageResult(orderIds,packRespVOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 打包分页查询
|
||||
private PageResult<PackRespVO> handleNormalCase(PackPageReqVO pageReqVO, List<Long> orderIds, PageDTO<PackRespVO> page) {
|
||||
|
||||
pageReqVO.setCustomer(insertSeparator(pageReqVO.getCustomer()));
|
||||
pageReqVO.setCustomOrderNo(insertSeparator(pageReqVO.getCustomOrderNo()));
|
||||
pageReqVO.setAddress(insertSeparator(pageReqVO.getAddress()));
|
||||
|
||||
|
||||
// 查询查询分页
|
||||
IPage<PackRespVO> packRespVOS = ordersMapper.selectOrderIdList(page, pageReqVO, getUserOrganId());
|
||||
|
||||
if (CollUtil.isEmpty(packRespVOS.getRecords())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
||||
|
||||
return buildPageResult(orderIds, packRespVOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 打包分页页面显示数据查询
|
||||
private PageResult<PackRespVO> buildPageResult(List<Long> orderIds,IPage<PackRespVO> packRespVOS){
|
||||
|
||||
if(orderIds.isEmpty()){
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
|
||||
// 查询板材的总量
|
||||
List<PackRespVO> packRespVOList = orderPlateMapper.selectPlateNum(orderIds, getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(packRespVOList, ErrorCodeConstants.ORDER_PLATE_ERROR);
|
||||
|
||||
for (PackRespVO packRespVO : packRespVOList) {
|
||||
packRespVO.setTotalPieceCount((long) packRespVO.getPlateIdList().size());
|
||||
packRespVO.setPlateIdList(null);
|
||||
}
|
||||
|
||||
|
||||
// 查询当前生产的包裹数量
|
||||
List<PackRespVO> respVOS = orderPackageMapper.selectPackPage(orderIds, getUserOrganId());
|
||||
|
||||
|
||||
for (PackRespVO packRespVO : respVOS) {
|
||||
packRespVO.setPackCount((long) packRespVO.getPackIdList().size());
|
||||
packRespVO.setPackIdList(null);
|
||||
}
|
||||
|
||||
|
||||
// 查询当前生产单已经打包的板材数量
|
||||
List<PackRespVO> plateNum = orderPackageMapper.selectPackPieceCount(orderIds, getUserOrganId());
|
||||
|
||||
for (PackRespVO packRespVO : plateNum) {
|
||||
packRespVO.setPackPieceCount((long) packRespVO.getPlateIdList().size());
|
||||
packRespVO.setPlateIdList(null);
|
||||
}
|
||||
|
||||
|
||||
for (PackRespVO vosRecords : packRespVOS.getRecords()) {
|
||||
|
||||
// 板材总数
|
||||
vosRecords.setTotalPieceCount(packRespVOList.stream().filter(f -> Objects.equals(f.getId(), vosRecords.getId())).mapToLong(PackRespVO::getTotalPieceCount).sum());
|
||||
// 已打包数
|
||||
vosRecords.setPackCount(respVOS.stream().filter(f -> Objects.equals(f.getId(), vosRecords.getId())).mapToLong(PackRespVO::getPackCount).sum());
|
||||
// 已打包片数
|
||||
vosRecords.setPackPieceCount(plateNum.stream().filter(f -> Objects.equals(f.getId(), vosRecords.getId())).mapToLong(PackRespVO::getPackPieceCount).sum());
|
||||
// 待处理量
|
||||
vosRecords.setPendingNum(vosRecords.getTotalPieceCount() - vosRecords.getPackPieceCount());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new PageResult<>(packRespVOS.getRecords(), packRespVOS.getTotal());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.report.controller.admin.dataset.vo;
|
||||
|
||||
import com.cf.imes.module.report.validation.datasource.SqlParamInjectionValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -37,5 +38,6 @@ public class ReportDatasetParameterVO implements Serializable {
|
||||
* 默认值
|
||||
*/
|
||||
@Schema(description = "参数默认值")
|
||||
@SqlParamInjectionValid
|
||||
private String defaultValue;
|
||||
}
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.report.controller.admin.dataset.vo;
|
||||
|
||||
import com.cf.imes.module.report.validation.datasource.SqlIllegalValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -42,6 +43,7 @@ public class ReportDatasetSaveReqVO implements Serializable {
|
||||
private Long datasourceId;
|
||||
|
||||
@Schema(description = "动态查询SQL")
|
||||
@SqlIllegalValid
|
||||
private String sql;
|
||||
|
||||
@Schema(description = "bean数据源方法名")
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.report.controller.admin.datasource.vo;
|
||||
|
||||
import com.cf.imes.module.report.validation.datasource.SqlParamInjectionValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -38,5 +39,6 @@ public class ReportDatasourceParameterVO implements Serializable {
|
||||
* 默认值
|
||||
*/
|
||||
@Schema(description = "参数默认值")
|
||||
@SqlParamInjectionValid
|
||||
private String defaultValue;
|
||||
}
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.report.controller.admin.datasource.vo;
|
||||
|
||||
import com.cf.imes.module.report.validation.datasource.SqlIllegalValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -29,6 +30,7 @@ public class ReportDatasourcePreviewReqVO {
|
||||
|
||||
@Schema(description = "查询语句")
|
||||
@NotBlank(message = "查询语句不能为空")
|
||||
@SqlIllegalValid
|
||||
private String sql;
|
||||
|
||||
@Schema(description = "查询参数列表")
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.report.validation.datasource;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 非法sql校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/21 18:42
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
ElementType.PARAMETER,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {SqlIllegalValidator.class}
|
||||
)
|
||||
public @interface SqlIllegalValid {
|
||||
String message() default "sql语句非法输入,请检查";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package com.cf.imes.module.report.validation.datasource;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 非法sql校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/21 18:44
|
||||
*/
|
||||
public class SqlIllegalValidator implements ConstraintValidator<SqlIllegalValid, String> {
|
||||
|
||||
private static final Pattern annotationPattern = Pattern.compile("/\\*[\\s\\S]*\\*/");
|
||||
|
||||
private static final String[] someKeywordPattern = new String[]{"chr\\s*\\(", "mid\\s*\\(", " char\\s*\\(", "sleep\\s*\\(", "user\\s*\\(", "show\\s+tables", "user[\\s]*\\([\\s]*\\)", "show\\s+databases", "sleep\\(\\d*\\)", "sleep\\(.*\\)"};
|
||||
|
||||
private static final List<String> specialSymbolList = new ArrayList<>();
|
||||
|
||||
static {
|
||||
specialSymbolList.add(";");
|
||||
specialSymbolList.add("+");
|
||||
specialSymbolList.add("--");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String sql, ConstraintValidatorContext context) {
|
||||
if (StringUtils.isEmpty(sql)) {
|
||||
return true;
|
||||
}
|
||||
// 校验注释
|
||||
if (hasAnnotation(sql)) {
|
||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||
context.buildConstraintViolationWithTemplate("SQL中不允许包含注释,存在安全风险").addConstraintViolation();
|
||||
return false;
|
||||
}
|
||||
sql = sql.toLowerCase();
|
||||
sql = sql.replaceAll("/\\*.*\\*/", "");
|
||||
// 敏感关键字数组
|
||||
String[] arrayOfSensitiveKey = "exec |peformance_schema|information_schema|extractvalue|updatexml|geohash|gtid_subset|gtid_subtract|insert |alter |delete |grant |update |drop |master |truncate |declare |--|".split("\\|");
|
||||
// 校验敏感关键字
|
||||
for (byte b = 0; b < arrayOfSensitiveKey.length; b++) {
|
||||
if (checkSensitiveKey(sql, arrayOfSensitiveKey[b])) {
|
||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||
context.buildConstraintViolationWithTemplate("SQL不合法,存在注入风险").addConstraintViolation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 校验一些函数关键字
|
||||
for (String skw : someKeywordPattern) {
|
||||
String someKeywordStr = ".*" + skw + ".*";
|
||||
if (Pattern.matches(someKeywordStr, sql)) {
|
||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||
context.buildConstraintViolationWithTemplate("SQL不合法,存在注入风险").addConstraintViolation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查敏感关键字
|
||||
*
|
||||
* @param sql
|
||||
* @param sensitiveKey
|
||||
* @return true:带敏感关键字,反之不带
|
||||
*/
|
||||
private boolean checkSensitiveKey(String sql, String sensitiveKey) {
|
||||
if (sql.startsWith(sensitiveKey.trim())) {
|
||||
return true;
|
||||
}
|
||||
if (sql.contains(sensitiveKey)) {
|
||||
String sk1 = " " + sensitiveKey;
|
||||
if (specialSymbolList.contains(sensitiveKey)) {
|
||||
sk1 = sensitiveKey;
|
||||
}
|
||||
if (sql.contains(sk1)) {
|
||||
return true;
|
||||
}
|
||||
String sk2 = "\\s+\\S+" + sensitiveKey;
|
||||
List<String> list = matchInjectKeyword(sk2, sql);
|
||||
for (String keyword : list) {
|
||||
if (keyword.contains("%") || keyword.contains("+") || keyword.contains("#") || keyword.contains("/") || keyword.contains(")")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验注释
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
private boolean hasAnnotation(String sql) {
|
||||
// 不允许存在注释
|
||||
if (sql.contains("--")) {
|
||||
return true;
|
||||
} else {
|
||||
Matcher var1 = annotationPattern.matcher(sql);
|
||||
if (var1.find()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 匹配注入关键字
|
||||
*
|
||||
* @param sensitiveKey
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
public List<String> matchInjectKeyword(String sensitiveKey, CharSequence sql) {
|
||||
Pattern paramPattern = Pattern.compile(sensitiveKey, 32);
|
||||
List<String> paramT = new ArrayList<>();
|
||||
if (ObjectUtil.isAllNotEmpty(paramPattern, sql)) {
|
||||
Matcher matcher = paramPattern.matcher(sql);
|
||||
while (matcher.find()) {
|
||||
paramT.add(matcher.group(0));
|
||||
}
|
||||
}
|
||||
return paramT;
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.report.validation.datasource;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* sql参数注入攻击校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/25 10:30
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
ElementType.PARAMETER,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {SqlParamInjectionValidator.class}
|
||||
)
|
||||
public @interface SqlParamInjectionValid {
|
||||
String message() default "sql查询参数默认值非法输入,请检查";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.cf.imes.module.report.validation.datasource;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlInjectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* sql参数注入攻击校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/25 10:30
|
||||
*/
|
||||
public class SqlParamInjectionValidator implements ConstraintValidator<SqlParamInjectionValid, String> {
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
return true;
|
||||
}
|
||||
// mybatisplus工具校验注入攻击
|
||||
return !SqlInjectionUtils.check(value);
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -27,8 +27,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_ERROR_DELETE;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.object.BeanUtils.toBean;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.DATA_SOURCE_NOT_EXISTS;
|
||||
@@ -788,7 +787,7 @@ public class DataSourceServiceImpl implements DataSourceService {
|
||||
log.info("Deleted {} documents with planId {}", response.deleted(), machineId);
|
||||
} catch (IOException e) {
|
||||
log.error("Error deleting documents with planId {}: {}", machineId, e.getMessage());
|
||||
throw new ServiceException(ES_ERROR_DELETE);
|
||||
throw new ServiceException(ES_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.validation.user;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.common.SexEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
@@ -16,6 +17,9 @@ public class SexValidator implements ConstraintValidator<SexValid, Integer> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (SexEnum sexEnum : SexEnum.values()) {
|
||||
if (Objects.equals(sexEnum.getSex(), value)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user