mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
1、统一抛出ServiceException带占位符的填充方式,不再使用ServiceExceptionUtils;2、新增System服务ErrorCode的国际化;3、Webcad异步导入移除分布式锁,导入解析事务完善;
This commit is contained in:
+2
-3
@@ -54,7 +54,6 @@ import java.util.*;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.error;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
@@ -175,7 +174,7 @@ public class OrderController {
|
||||
public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) {
|
||||
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.DELETED.getStatus());
|
||||
if (index == 0) {
|
||||
throw exception(ORDER_DELETED_ERR);
|
||||
throw new ServiceException(ORDER_DELETED_ERR);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
@@ -188,7 +187,7 @@ public class OrderController {
|
||||
Long orderId = jsonObject.getLong("orderId");
|
||||
Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
if (index == 0) {
|
||||
throw exception(ORDER_RESTORE_ERR);
|
||||
throw new ServiceException(ORDER_RESTORE_ERR);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
@@ -80,7 +80,7 @@ public class BodyNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRuleS
|
||||
} else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
||||
generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO);
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
throw new ServiceException(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
}
|
||||
return generateConfig;
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
@@ -131,7 +131,7 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
||||
} else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
||||
orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule);
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
throw new ServiceException(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
}
|
||||
return orderNoSeq;
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO;
|
||||
@@ -82,7 +82,7 @@ public class PlateNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
||||
} else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) {
|
||||
return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO);
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
throw new ServiceException(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
//
|
||||
//import cn.hutool.core.collection.CollUtil;
|
||||
//import cn.hutool.core.util.ObjectUtil;
|
||||
//import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
//import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
//import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
||||
//import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoRuleDTO;
|
||||
@@ -47,7 +46,7 @@
|
||||
// } else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) {
|
||||
// generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDOList);
|
||||
// } else {
|
||||
// throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PROCESSGROUP_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
// throw new ServiceException(CUSTOM_PLATENO_GENERATE_PROCESSGROUP_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode());
|
||||
// }
|
||||
// return generateConfig;
|
||||
// }
|
||||
|
||||
+6
-5
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.service.goods;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.executor.dal.dataobject.managePlate.ManagePlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.managePlate.ManagePlateMapper;
|
||||
@@ -21,7 +22,7 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -54,16 +55,16 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
List<Long> longs = new ArrayList<>();
|
||||
// 校验生产单是否存在
|
||||
if (orderMapper.selectOne(OrderDO::getId, createReqVOS.get(0).getOrderId()) == null) {
|
||||
throw exception(GOODS_NOT_EXISTS);
|
||||
throw new ServiceException(GOODS_NOT_EXISTS);
|
||||
}
|
||||
createReqVOS.forEach(createReqVO -> {
|
||||
// 校验商品是否存在
|
||||
if (plateMapper.selectOne(ManagePlateDO::getId, createReqVO.getGoodsId()) == null) {
|
||||
throw exception(PLATE_NOT_EXISTS);
|
||||
throw new ServiceException(PLATE_NOT_EXISTS);
|
||||
}
|
||||
// 校验
|
||||
if (rawGoodsService.getRawGoods(createReqVO.getRawGoodsId()) == null) {
|
||||
throw exception(RAW_GOODS_NOT_USED_IN_ORDER);
|
||||
throw new ServiceException(RAW_GOODS_NOT_USED_IN_ORDER);
|
||||
}
|
||||
});
|
||||
// 一次性插入数据库
|
||||
@@ -93,7 +94,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
|
||||
private void validateGoodsExists(Long id) {
|
||||
if (goodsMapper.selectById(id) == null) {
|
||||
throw exception(GOODS_NOT_EXISTS);
|
||||
throw new ServiceException(GOODS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.*;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
@@ -49,7 +50,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE;
|
||||
@@ -325,7 +325,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
|
||||
if(reqVO.getAddPartsIdList().isEmpty() && reqVO.getAddPlateIdList().isEmpty() && reqVO.getDeletePartsIdList().isEmpty()){
|
||||
throw exception(PART_PACK_DATA_ERROR);
|
||||
throw new ServiceException(PART_PACK_DATA_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +447,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
|
||||
if(packageVO.getAddPlateIdList().isEmpty() && packageVO.getAddPartsIdList().isEmpty() && packageVO.getDeletePlateIdList().isEmpty()){
|
||||
throw exception(PART_PACK_DATA_ERROR);
|
||||
throw new ServiceException(PART_PACK_DATA_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -676,7 +676,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
OrderPackageDO orderPackageDO = orderPackageMapper.selectByPackNo(reqVO.getPackNo(), getUserOrganId());
|
||||
if (orderPackageDO.getType() != OrderPackageTypeEnum.OTHER_ACCESSORIES.getType().longValue()) {
|
||||
throw exception(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT);
|
||||
throw new ServiceException(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT);
|
||||
}
|
||||
|
||||
|
||||
@@ -749,7 +749,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
if (setting == null) {
|
||||
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE, UserSettingTypeEnum.PREPACKAGED.getName());
|
||||
throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE, UserSettingTypeEnum.PREPACKAGED.getName());
|
||||
}
|
||||
|
||||
JsonNode settingParse = JsonUtils.parseTree(JsonUtils.unzipString(setting));
|
||||
@@ -929,7 +929,7 @@ public class PackServiceImpl implements PackService {
|
||||
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
||||
|
||||
if (packRespVOList.isEmpty()) {
|
||||
throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后");
|
||||
throw new ServiceException(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后");
|
||||
}
|
||||
packRespVOS.setRecords(packRespVOList);
|
||||
|
||||
|
||||
+7
-10
@@ -13,9 +13,7 @@ import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPage
|
||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
|
||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsBatchMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper;
|
||||
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
|
||||
@@ -44,7 +42,6 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.framework.executor.config.ExecutorThreadPoolConfiguration.EXECUTOR_IMPOT_THREAD_POOL_TASK_EXECUTOR;
|
||||
@@ -97,7 +94,7 @@ public class PartsServiceImpl implements PartsService {
|
||||
partsDO.setOrganId(organId).setIsComposite(createReqVO.getIsComposite() != null && createReqVO.getIsComposite());
|
||||
// 判断是否存在--- goodsId
|
||||
if (validateExistsByGoodsId(partsDO.getGoodsId(), organId)) {
|
||||
throw exception(PARTS_GOOD_ID_EXISTS);
|
||||
throw new ServiceException(PARTS_GOOD_ID_EXISTS);
|
||||
}
|
||||
|
||||
partsMapper.insert(partsDO);
|
||||
@@ -117,12 +114,12 @@ public class PartsServiceImpl implements PartsService {
|
||||
boolean index = validateExistsById(updateReqVO.getId(), organId);
|
||||
|
||||
if (!index) {
|
||||
throw exception(PARTS_NOT_EXISTS);
|
||||
throw new ServiceException(PARTS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 校验goodsId是否存在
|
||||
if (!validateExistsExceptGoodsId(updateReqVO.getId(), updateReqVO.getGoodsId(), organId)) {
|
||||
throw exception(PARTS_GOOD_ID_EXISTS);
|
||||
throw new ServiceException(PARTS_GOOD_ID_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
updateReqVO.setOrganId(organId).setIsComposite(updateReqVO.getIsComposite() != null && updateReqVO.getIsComposite());
|
||||
@@ -157,7 +154,7 @@ public class PartsServiceImpl implements PartsService {
|
||||
public void delete(Long id, Long organId) {
|
||||
// 校验存在
|
||||
if (!validateExistsById(id, getOrganId(BASE_PARTS_DELETE_PERMISSION, getLoginUser().getId(), organId))) {
|
||||
throw exception(PARTS_NOT_EXISTS);
|
||||
throw new ServiceException(PARTS_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 删除
|
||||
@@ -429,7 +426,7 @@ public class PartsServiceImpl implements PartsService {
|
||||
private void validateOrganExists(Long organId) {
|
||||
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
||||
if (!index.isSuccess()) {
|
||||
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,11 +451,11 @@ public class PartsServiceImpl implements PartsService {
|
||||
private void validateFieldExists(PartsSaveReqVO partsSaveReqVO) {
|
||||
if (!CategoryEnum.OTHER.getValue().equals(partsSaveReqVO.getCategory())) { // 不为其他
|
||||
if (partsSaveReqVO.getUnit() == null || partsSaveReqVO.getUnit().isEmpty()) {
|
||||
throw exception(PARTS_UNIT_NOT_NULL);
|
||||
throw new ServiceException(PARTS_UNIT_NOT_NULL);
|
||||
}
|
||||
if (CategoryEnum.EDGING.getValue().equals(partsSaveReqVO.getCategory())) { // 为封边
|
||||
if (partsSaveReqVO.getColor() == null || partsSaveReqVO.getWidth() == null || partsSaveReqVO.getThickness() == null) {
|
||||
throw exception(PARTS_EDGE_NOT_NULL);
|
||||
throw new ServiceException(PARTS_EDGE_NOT_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_ATTR_GROUP_EXISTS;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_EXISTS;
|
||||
@@ -110,14 +109,14 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
// 校验存在
|
||||
Long organId = getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUserId(), updateReqVO.getOrganId());
|
||||
if (updateReqVO.getId() == null) {
|
||||
throw exception(PLATE_ID_NULL_ERROR);
|
||||
throw new ServiceException(PLATE_ID_NULL_ERROR);
|
||||
}
|
||||
validatePlateExists(updateReqVO.getId(), organId);
|
||||
PlateGoodDO updateObj = BeanUtils.toBean(updateReqVO, PlateGoodDO.class);
|
||||
|
||||
// 校验板材goods_id是否相同
|
||||
if (plateGoodMapper.isByGoodIDAndId(updateReqVO.getGoodsId(), organId, Long.valueOf(updateReqVO.getId()))) {
|
||||
throw exception(PLATE_GOODS_ID_NOT_SAME);
|
||||
throw new ServiceException(PLATE_GOODS_ID_NOT_SAME);
|
||||
}
|
||||
|
||||
// 校验板材名称、材质、颜色、厚度、品牌在组织内唯一
|
||||
@@ -140,7 +139,7 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
.eqIfPresent(PlateGoodDO::getBrand, plate.getBrand())
|
||||
.neIfPresent(PlateGoodDO::getId, plate.getId()));
|
||||
if (count > 0) {
|
||||
throw exception(PLATE_ATTR_GROUP_EXISTS);
|
||||
throw new ServiceException(PLATE_ATTR_GROUP_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +156,7 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
|
||||
private void validatePlateExists(Long id, Long organId) {
|
||||
if (plateGoodMapper.selectOneById(id, organId) == null) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,14 +406,14 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
private void validateOrganExists(Long organId) {
|
||||
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
||||
if (!index.isSuccess()) {
|
||||
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||
throw new ServiceException(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 当前组织中板材是否存在
|
||||
private void validateGoodExists(String goodsId, Long organId) {
|
||||
if (plateGoodMapper.selectByGoodID(goodsId, organId, false) != null) {
|
||||
throw exception(PLATE_EXISTS);
|
||||
throw new ServiceException(PLATE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.executor.service.manage.remainplaten;
|
||||
|
||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
@@ -20,7 +21,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_COUNT_MAX;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_ID_NOT_EXISTS;
|
||||
@@ -46,7 +46,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
||||
List<RemainPlateDO> remainPlates = new ArrayList<>();
|
||||
// 限制新增数量不能超过999
|
||||
if (createReqVO.getCount() > MAX_NUM) {
|
||||
throw exception(REMAIN_PLATE_COUNT_MAX);
|
||||
throw new ServiceException(REMAIN_PLATE_COUNT_MAX);
|
||||
}
|
||||
// 插入
|
||||
if (createReqVO.getCount() >= 1) {
|
||||
@@ -101,14 +101,14 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void revertRemainPlateStatus(Set<Long> ids, Integer status) {
|
||||
if (ids == null) {
|
||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
}
|
||||
// 判断余料的状态是否存在使用中
|
||||
validateRemainPlateStatus(ids, RemainPlateStatusEnum.UNUSED.getStatus());
|
||||
// 判断使用类型是否为核销
|
||||
for (Long id : ids) {
|
||||
if (!validateRemainPlateUseType(id).equals(RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) {
|
||||
throw exception(REMAIN_PLATE_USR_TYPE);
|
||||
throw new ServiceException(REMAIN_PLATE_USR_TYPE);
|
||||
}
|
||||
}
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(), 0L);
|
||||
@@ -120,7 +120,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
||||
validateRemainPlateExists(updateReqVO.getId());
|
||||
// 是否使用
|
||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.USED.getStatus()) {
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
throw new ServiceException(REMAIN_PLATE_STATUS_USED);
|
||||
}
|
||||
// 判断是否为开料添加
|
||||
RemainPlateDO updateObj = validateRemainPlateIsCutting(updateReqVO.getId());
|
||||
@@ -136,7 +136,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRemainPlate(Set<Long> ids) {
|
||||
if (ids == null) {
|
||||
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_ID_NOT_EXISTS);
|
||||
}
|
||||
// 余料存在判断
|
||||
validateRemainPlateExists(ids);
|
||||
@@ -151,21 +151,21 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService {
|
||||
for (Long id : ids) {
|
||||
if (validateRemainPlateStatus(id) == status) {
|
||||
if (status == RemainPlateStatusEnum.USED.getStatus())
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
throw new ServiceException(REMAIN_PLATE_STATUS_USED);
|
||||
if (status == RemainPlateStatusEnum.UNUSED.getStatus())
|
||||
throw exception(REMAIN_PLATE_STATUS_NO_USED);
|
||||
throw new ServiceException(REMAIN_PLATE_STATUS_NO_USED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateRemainPlateExists(Long id) {
|
||||
if (remainPlateMapper.selectById(id) == null) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
private void validateRemainPlateExists(Set<Long> id) {
|
||||
if (remainPlateMapper.selectBatchIds(id).isEmpty()) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
private RemainPlateDO validateRemainPlateIsCutting(Long id) {
|
||||
|
||||
+2
-4
@@ -1,20 +1,18 @@
|
||||
package com.cf.imes.module.executor.service.module;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import com.cf.imes.module.executor.controller.admin.module.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.module.ModuleDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.module.ModuleMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -57,7 +55,7 @@ public class ModuleServiceImpl implements ModuleService {
|
||||
|
||||
private void validateModuleExists(Long id) {
|
||||
if (moduleMapper.selectById(id) == null) {
|
||||
throw exception(MODULE_NOT_EXISTS);
|
||||
throw new ServiceException(MODULE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-14
@@ -30,7 +30,6 @@ import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -89,12 +88,10 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.*;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -180,7 +177,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
public Boolean addRemain(AddRemainReqVO vo) {
|
||||
PlanDO planDO = planMapper.selectById(vo.getPlanId());
|
||||
if (Objects.isNull(planDO)) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
throw new ServiceException(PLAN_NOT_EXISTS);
|
||||
}
|
||||
RemainPlateDO remainPlateDO = RemainPlateDO.builder()
|
||||
.width(vo.getWidth())
|
||||
@@ -246,7 +243,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
throw exception(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
||||
throw new ServiceException(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
||||
}
|
||||
|
||||
AssertUtils.notEmpty(remainBoardInfos,ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
@@ -279,7 +276,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Override
|
||||
public OrderSource getOrderSource(Long orderId, Long planId, Long machineId) {
|
||||
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
||||
throw exception(ORDER_PLAN_ID_IS_ONE);
|
||||
throw new ServiceException(ORDER_PLAN_ID_IS_ONE);
|
||||
}
|
||||
OrderSource orderSource;
|
||||
if (ObjectUtil.isNotNull(orderId)) {
|
||||
@@ -292,7 +289,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
return orderSource;
|
||||
}
|
||||
|
||||
throw exception(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR);
|
||||
throw new ServiceException(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@@ -483,7 +480,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
throw exception(THIS_PLAN_OPTIMIZE_DATA_ERROR);
|
||||
throw new ServiceException(THIS_PLAN_OPTIMIZE_DATA_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -583,7 +580,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
if(!planDO.getProcessId().equals(processId)){
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
||||
throw new ServiceException(THIS_PLAN_PLATE_IS_CUT);
|
||||
}
|
||||
|
||||
// 保存排单对应的加工方案组的配置信息
|
||||
@@ -786,7 +783,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
.eq(PlateDO::getPlanId, 0)
|
||||
.eq(PlateDO::getDeleted, false));
|
||||
if (planCreatePlateThreshold < unplanPlateNum) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold);
|
||||
throw new ServiceException(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold);
|
||||
}
|
||||
|
||||
List<PlateDetailRespVO> plateDetailRespVOS = plateMapper.selectNoPlanPlate(orderIds, orderGoodsIds, getUserOrganId());
|
||||
@@ -1288,7 +1285,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
Boolean isOptimized = optimizeBoardModelDO.getIsOptimized();
|
||||
|
||||
if(Boolean.FALSE.equals(isOptimized)){
|
||||
throw exception(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR);
|
||||
throw new ServiceException(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -1312,7 +1309,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
if (Boolean.FALSE.equals(isArray)) {
|
||||
throw exception(ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
throw new ServiceException(ORDER_PLAN_OPTIMIZE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -1701,7 +1698,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
private void validatePlanStatus(PlanDO planDO,List<Boolean> isLocks){
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
||||
throw new ServiceException(THIS_PLAN_PLATE_IS_CUT);
|
||||
}
|
||||
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
@@ -1710,7 +1707,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
Boolean data = permissionApi.hasAnyPermissions(loginUser.getId(), "placeorder:list").getCheckedData();
|
||||
|
||||
if(Boolean.TRUE.equals(planDO.getIsScheduled()) && isLocks.contains(true) && Boolean.FALSE.equals(data)){
|
||||
throw exception(THIS_PLAN_PROCESS_SCHEME_IS_LOCK);
|
||||
throw new ServiceException(THIS_PLAN_PROCESS_SCHEME_IS_LOCK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+21
-22
@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
@@ -96,7 +96,6 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
|
||||
@@ -266,7 +265,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
// 判断是否存在排单
|
||||
if (planDO == null) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
throw new ServiceException(PLAN_NOT_EXISTS);
|
||||
}
|
||||
|
||||
List<Long> orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
||||
@@ -463,7 +462,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (order != null) {
|
||||
//判断是否已经导入
|
||||
// if (!validateOrderNoExists(order.getApiOrderId(), OrganContextHolder.getOrganId())) {
|
||||
// throw exception(ORDER_EXISTS);
|
||||
// throw new ServiceException(ORDER_EXISTS);
|
||||
// }
|
||||
|
||||
validateCustomOrderNoExists(order.getCustomOrderNo());
|
||||
@@ -613,7 +612,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
outputStream.write(buffer);
|
||||
outputStream.flush();
|
||||
} catch (IOException ex) {
|
||||
throw exception(FILE_NOT_EXISTS);
|
||||
throw new ServiceException(FILE_NOT_EXISTS);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -623,7 +622,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 查询生产单
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, OrganContextHolder.getOrganId());
|
||||
if (orderDO == null) {
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||
}
|
||||
return getDataByOrderIdAndType(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
// return getDataByOrderIdAndTypeDetail(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||
@@ -691,11 +690,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 校验存在
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, getUserOrganId(), index);
|
||||
if (orderDO == null)
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||
// 状态排除
|
||||
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.EMPTY.getStatus()) &&
|
||||
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.NEW_ORDER.getStatus()))
|
||||
throw exception(ORDER_NOT_CANCEL);
|
||||
throw new ServiceException(ORDER_NOT_CANCEL);
|
||||
return orderMapper.updateOrderDeleted(orderId, deleted, getUserOrganId());
|
||||
}
|
||||
|
||||
@@ -727,7 +726,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
private void validateOrderExists(Long id, Long organId, Integer deleted) {
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(id, organId, deleted);
|
||||
if (orderDO == null) {
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -744,7 +743,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
// 判断手机号是否匹配正则表达式
|
||||
if (!matcher.matches()) {
|
||||
throw exception(PHONE_NOT_LAWFUL);
|
||||
throw new ServiceException(PHONE_NOT_LAWFUL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,7 +756,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(CUSTOM_ORDER_EXISTS);
|
||||
throw new ServiceException(CUSTOM_ORDER_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -771,7 +770,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(CUSTOM_ORDER_EXISTS);
|
||||
throw new ServiceException(CUSTOM_ORDER_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -794,7 +793,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
.eqIfPresent(OrderBodyDO::getId, bodyId));
|
||||
|
||||
if (bodyCount == 0) {
|
||||
throw exception(ORDER_BODY_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_BODY_NOT_EXISTS);
|
||||
}
|
||||
|
||||
bodyIds.add(bodyId);
|
||||
@@ -849,7 +848,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// } else if (plateGoodDOS != null && !plateGoodDOS.isEmpty()) { // 存在板材
|
||||
// goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId());
|
||||
// } else { // 不存在板材
|
||||
//// throw exception(ORDER_MATCH_NOT);
|
||||
//// throw new ServiceException(ORDER_MATCH_NOT);
|
||||
// long plateNo = idWorker.nextId();
|
||||
// long obtainingTime = idWorker.obtainingTime();
|
||||
//
|
||||
@@ -893,7 +892,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (plateGoodDOs != null && !plateGoodDOs.isEmpty()) {//存在板材
|
||||
goodsDO.setGoodsId(plateGoodDOs.get(0).getGoodsId());
|
||||
} else { // 不存在板材
|
||||
throw exception(PLATE_ATTRIBUTE_NOT_EXIST, goodsDO.getGoodsId() == null ? "" : goodsDO.getGoodsId(), goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness());
|
||||
throw new ServiceException(PLATE_ATTRIBUTE_NOT_EXIST, goodsDO.getGoodsId() == null ? "" : goodsDO.getGoodsId(), goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness());
|
||||
|
||||
}
|
||||
|
||||
@@ -1111,7 +1110,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted));
|
||||
break;
|
||||
default:
|
||||
throw exception(FILE_TYPE_ERR);
|
||||
throw new ServiceException(FILE_TYPE_ERR);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -1153,7 +1152,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted));
|
||||
break;
|
||||
default:
|
||||
throw exception(FILE_TYPE_ERR);
|
||||
throw new ServiceException(FILE_TYPE_ERR);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -1241,11 +1240,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 校验存在
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId);
|
||||
if (orderDO == null)
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||
|
||||
|
||||
if (ObjectUtils.isEmpty(roomIds) && ObjectUtils.isEmpty(bodyId)) {
|
||||
throw exception(ORDER_ERROR);
|
||||
throw new ServiceException(ORDER_ERROR);
|
||||
}
|
||||
|
||||
// 判断小板是否已开料,已开料不允许删除
|
||||
@@ -1444,7 +1443,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 如果是补板校验生产单存在
|
||||
Long orderId = importAsyncReqVO.getOrderId();
|
||||
if (ObjectUtil.isNotNull(orderId)) {
|
||||
Optional.ofNullable(getOrder(orderId)).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_NOT_EXISTS, orderId));
|
||||
Optional.ofNullable(getOrder(orderId)).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, orderId));
|
||||
}
|
||||
// 准备前置数据,准备完成发送消息消费解析临时表
|
||||
orderImportHandler.prepareAndConvert(importAsyncReqVO, file);
|
||||
@@ -1458,11 +1457,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
|
||||
if (Objects.isNull(orderId) && Objects.isNull(planId)) {
|
||||
throw exception(ORDER_PLAN_ID_NOT_NULL);
|
||||
throw new ServiceException(ORDER_PLAN_ID_NOT_NULL);
|
||||
}
|
||||
|
||||
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
||||
throw exception(ORDER_PLAN_ID_IS_ONE);
|
||||
throw new ServiceException(ORDER_PLAN_ID_IS_ONE);
|
||||
}
|
||||
|
||||
Long organId = getUserOrganId();
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package com.cf.imes.module.executor.service.orderImport.factory;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.executor.enums.OrderImportTypeEnum;
|
||||
import com.cf.imes.module.executor.service.orderImport.OrderImportHandler;
|
||||
@@ -45,7 +44,7 @@ public class OrderImportHandlerFactory {
|
||||
if (StringUtils.isEmpty(factoryName)) {
|
||||
factoryName = "default";
|
||||
}
|
||||
ServiceException typeNotSupportException = ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_IMPORT_TYPE_NOT_SUPPORT, type);
|
||||
ServiceException typeNotSupportException = new ServiceException(ErrorCodeConstants.ORDER_IMPORT_TYPE_NOT_SUPPORT, type);
|
||||
switch (importTypeEnum) {
|
||||
case EXCEL:
|
||||
return Optional.ofNullable(getExcelHandler(factoryName)).orElseThrow(() -> typeNotSupportException);
|
||||
|
||||
+2
-11
@@ -3,9 +3,6 @@ package com.cf.imes.module.executor.service.orderImport.handler.xml;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
import com.cf.imes.framework.redis.config.ChenfengCacheProperties;
|
||||
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderImportAsyncReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderImport.OrderImportTaskMapper;
|
||||
@@ -21,15 +18,14 @@ import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessageBuilder;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_FILE_ANALYZE_ERROR;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
@@ -53,12 +49,6 @@ public class DefaultXmlOrderImportHandler implements AbstractXmlOrderImportHandl
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Resource
|
||||
private RedisLockUtil redisLockUtil;
|
||||
|
||||
@Resource
|
||||
private ChenfengCacheProperties chenfengCacheProperties;
|
||||
|
||||
@Resource
|
||||
private PlateGoodMapper plateGoodMapper;
|
||||
|
||||
@@ -68,6 +58,7 @@ public class DefaultXmlOrderImportHandler implements AbstractXmlOrderImportHandl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void prepareAndConvert(OrderImportAsyncReqVO importAsyncReqVO, MultipartFile file) {
|
||||
// 创建任务
|
||||
Long taskId = createImportTask(file.getOriginalFilename());
|
||||
|
||||
+2
-8
@@ -4,14 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateTermsPageReqVO;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -24,12 +20,10 @@ import java.util.*;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -73,7 +67,7 @@ public class OrderPartsServiceImpl implements OrderPartsService {
|
||||
|
||||
private void validateOrderPartsExists(Long id) {
|
||||
if (orderPartsMapper.selectById(id) == null) {
|
||||
throw exception(ORDER_PARTS_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_PARTS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +85,7 @@ public class OrderPartsServiceImpl implements OrderPartsService {
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public OrderPartsImportRespVO importOrderPartsList(List<OrderPartsSaveReqVO> importOrderParts, Long orderId) {
|
||||
if (CollUtil.isEmpty(importOrderParts)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY);
|
||||
throw new ServiceException(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList<OrderPartsSaveReqVO>())
|
||||
.updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build();
|
||||
|
||||
+15
-17
@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.*;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -71,7 +70,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||
@@ -199,7 +197,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR);
|
||||
}
|
||||
|
||||
planDOS.forEach(f-> processSchemeModelDOS.forEach(p->{
|
||||
@@ -226,7 +224,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
if(updateReqVO.getProcessId() != null){
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
||||
throw new ServiceException(THIS_PLAN_PLATE_IS_CUT);
|
||||
}
|
||||
|
||||
planDO.setProcessId(updateReqVO.getProcessId());
|
||||
@@ -281,7 +279,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
// 获取排单下的订单号集合
|
||||
planDOS.forEach(f->{
|
||||
if ( f.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || f.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) ) {
|
||||
throw exception(PLAN_NOT_ALLOW_DELETE,f.getId());
|
||||
throw new ServiceException(PLAN_NOT_ALLOW_DELETE,f.getId());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -365,7 +363,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -684,7 +682,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
if(planDOS.size() != planIds.size()){
|
||||
planDOS.forEach(f->{
|
||||
if(!planIds.contains(f.getId())){
|
||||
throw exception(PLAN_NOT_DATA_EXISTS,f.getId());
|
||||
throw new ServiceException(PLAN_NOT_DATA_EXISTS,f.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -760,7 +758,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
|
||||
if(planDO == null){
|
||||
throw exception(PLAN_NOT_DATA_EXISTS,planId);
|
||||
throw new ServiceException(PLAN_NOT_DATA_EXISTS,planId);
|
||||
}
|
||||
|
||||
sorts.add(planDO.getSort());
|
||||
@@ -960,7 +958,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw exception(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
||||
throw new ServiceException(PLAN_PLATE_OPTIMIZE_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1016,7 +1014,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
for (Long planId : planIds) {
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
if(ObjectUtils.isEmpty(planDO)){
|
||||
throw exception(PLAN_NOT_DATA_EXISTS,planId);
|
||||
throw new ServiceException(PLAN_NOT_DATA_EXISTS,planId);
|
||||
}
|
||||
planDOS.add(planDO);
|
||||
}
|
||||
@@ -1144,16 +1142,16 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<Long> processIds = new ArrayList<>();
|
||||
planDOS.forEach(f->{
|
||||
if (f.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) {
|
||||
throw exception(PLAN_PLATE_IS_ALL_CUT,f.getId());
|
||||
throw new ServiceException(PLAN_PLATE_IS_ALL_CUT,f.getId());
|
||||
}
|
||||
processIds.add(Optional.ofNullable(f.getProcessId()).orElseThrow(() -> exception(PLAN_PROCESS_CONFIG_IS_NULL,f.getId())));
|
||||
processIds.add(Optional.ofNullable(f.getProcessId()).orElseThrow(() -> new ServiceException(PLAN_PROCESS_CONFIG_IS_NULL,f.getId())));
|
||||
});
|
||||
|
||||
Integer processSize = systemConfigApi.getProcessSizeByIds(processIds).getCheckedData();
|
||||
|
||||
for (PlanDO planDO : planDOS) {
|
||||
if (planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) {
|
||||
throw exception(PLAN_PLATE_IS_ALL_CUT,planDO.getId());
|
||||
throw new ServiceException(PLAN_PLATE_IS_ALL_CUT,planDO.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1393,7 +1391,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1447,7 +1445,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1974,7 +1972,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2012,7 +2010,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-15
@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.*;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -44,7 +43,6 @@ import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderItemType;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -59,11 +57,10 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生产单板件 Service 实现类
|
||||
*
|
||||
@@ -155,12 +152,12 @@ public class PlateServiceImpl implements PlateService {
|
||||
for (PlateDO plateDO : plateDOS) {
|
||||
|
||||
if(!plateDO.getType().equals(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())){
|
||||
throw exception(PLATE_IS_SOURCE,plateDO.getPlateNo());
|
||||
throw new ServiceException(PLATE_IS_SOURCE,plateDO.getPlateNo());
|
||||
}
|
||||
|
||||
if(!plateDO.getIsCutted().equals(OrderPlateCutStatusEnum.NOCUTTING.getStatus())){
|
||||
|
||||
throw exception(THIS_PLATE_IS_OPTIMIZE,plateDO.getPlateNo());
|
||||
throw new ServiceException(THIS_PLATE_IS_OPTIMIZE,plateDO.getPlateNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +226,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,7 +264,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
}
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +296,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
private void validatePlateExists(Long id) {
|
||||
if (plateMapper.selectById(id) == null) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,7 +433,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public PlateImportRespVO importPlatesList(List<PlateSaveReqVO> importPlates, Long orderId) {
|
||||
if (CollUtil.isEmpty(importPlates)) {
|
||||
throw ServiceExceptionUtil.exception(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
||||
throw new ServiceException(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlates(new ArrayList<PlateSaveReqVO>())
|
||||
.updatePlates(new ArrayList<>()).failurePlates(new LinkedHashMap<>()).build();
|
||||
@@ -532,7 +529,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
List<OrderModelDO> orderPlateModelDOS = new ArrayList<>();
|
||||
|
||||
Long planId = Optional.ofNullable(reqVO.get(0).getPlanId()).orElseThrow(()-> exception(ORDER_PLAN_PLATE_ERROR));
|
||||
Long planId = Optional.ofNullable(reqVO.get(0).getPlanId()).orElseThrow(()-> new ServiceException(ORDER_PLAN_PLATE_ERROR));
|
||||
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
|
||||
@@ -694,7 +691,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.set(OrderDO::getVersion, version + 1);
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -721,7 +718,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
.set(GoodsDO::getPlateNum, goodsPlateNumAndAreaPlanInfo.getNum() + goodsDO.getPlateNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -781,7 +778,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
|
||||
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
||||
throw exception(PLAN_IS_MIXED_ERROR);
|
||||
throw new ServiceException(PLAN_IS_MIXED_ERROR);
|
||||
}
|
||||
|
||||
// 相同材质和厚度
|
||||
@@ -822,7 +819,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){
|
||||
|
||||
if(!planDO.getStatus().equals(PlanStatusEnum.NOCUTTING.getStatus())){
|
||||
throw exception(PLAN_PLATE_IS_CUTTING);
|
||||
throw new ServiceException(PLAN_PLATE_IS_CUTTING);
|
||||
}
|
||||
|
||||
// 相同材质和厚度 混单
|
||||
|
||||
+6
-8
@@ -2,8 +2,8 @@ package com.cf.imes.module.executor.service.process;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
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.orderBody.OrderBodyDO;
|
||||
@@ -42,10 +42,8 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_EIGHT;
|
||||
import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_SEVEN;
|
||||
|
||||
/**
|
||||
@@ -93,11 +91,11 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
OrderDO order = orderMapper.selectOrderOne(orderId, organId, status);
|
||||
// 当生产不为删除时,校验生产单存在
|
||||
if (order == null) {
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||
}else {
|
||||
// 校验生产单状态
|
||||
if (order.getStatus() != OrderStatusEnum.NEW_ORDER.getStatus()) {
|
||||
throw exception(ORDER_STATUS_CONFLICT);
|
||||
throw new ServiceException(ORDER_STATUS_CONFLICT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,14 +103,14 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
// 校验工序组存在
|
||||
private void checkProcessGroup(Long id) {
|
||||
if (!processGroupApi.getProcessGroup(id)) {
|
||||
throw exception(PROCESS_GROUP_NOT_EXISTS);
|
||||
throw new ServiceException(PROCESS_GROUP_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 校验是否已经存在该生产单对应的工序组
|
||||
private void checkOrderProcessExists(Long orderId, Long organId) {
|
||||
if (orderProcessMapper.getOrderProcess(orderId, organId)) {
|
||||
throw exception(ORDER_PROCESS_EXISTS);
|
||||
throw new ServiceException(ORDER_PROCESS_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +290,7 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
|
||||
private void validateOrderProcessExists(Long id) {
|
||||
if (orderProcessMapper.selectById(id) == null) {
|
||||
throw exception(ORDER_PROCESS_NOT_EXISTS);
|
||||
throw new ServiceException(ORDER_PROCESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-6
@@ -9,14 +9,9 @@ import java.util.*;
|
||||
import com.cf.imes.module.executor.controller.admin.processStep.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.processStep.ProcessStepMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生产单工序步骤 Service 实现类
|
||||
*
|
||||
@@ -60,7 +55,7 @@ public class ProcessStepServiceImpl implements ProcessStepService {
|
||||
|
||||
private void validateProcessStepExists(Long id) {
|
||||
if (processStepMapper.selectById(id) == null) {
|
||||
// throw exception(PROCESS_STEP_NOT_EXISTS);
|
||||
// throw new ServiceException(PROCESS_STEP_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -2,7 +2,6 @@ package com.cf.imes.module.executor.service.rawgoods;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO;
|
||||
@@ -19,7 +18,6 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_IMPORT_LIST_IS_EMPTY;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_NOT_EXISTS;
|
||||
@@ -64,7 +62,7 @@ public class RawGoodsServiceImpl implements RawGoodsService {
|
||||
|
||||
private void validateRawGoodsExists(Long id) {
|
||||
if (rawGoodsMapper.selectById(id) == null) {
|
||||
throw exception(RAW_GOODS_NOT_EXISTS);
|
||||
throw new ServiceException(RAW_GOODS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +80,7 @@ public class RawGoodsServiceImpl implements RawGoodsService {
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public RawGoodsImportRespVO importRawGoodsList(List<RawGoodsSaveReqVO> importRawGoods, Long orderId) {
|
||||
if (CollUtil.isEmpty(importRawGoods)) {
|
||||
throw ServiceExceptionUtil.exception(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
||||
throw new ServiceException(RAW_GOODS_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
RawGoodsImportRespVO respVO = RawGoodsImportRespVO.builder().createRawGoods(new ArrayList<>())
|
||||
.updateRawGoods(new ArrayList<>()).failureRawGoods(new LinkedHashMap<>()).build();
|
||||
|
||||
+2
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.service.remainplate;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -12,7 +13,6 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
|
||||
private void validateRemainPlateExists(Long id) {
|
||||
if (remainPlateMapper.selectById(id) == null) {
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
throw new ServiceException(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -8,7 +8,6 @@ import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPl
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -17,7 +16,7 @@ import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* excel 文件写入
|
||||
|
||||
+7
-6
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.executor.util.file;
|
||||
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -10,7 +11,7 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
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.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class FileHelperUtil {
|
||||
outputStream.write(buffer);
|
||||
outputStream.flush();
|
||||
} catch (IOException ex) {
|
||||
throw exception(FILE_NOT_EXISTS);
|
||||
throw new ServiceException(FILE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,16 +50,16 @@ public class FileHelperUtil {
|
||||
public static boolean checkFile(MultipartFile file,
|
||||
Long fileSize) {
|
||||
if (file.isEmpty()) {
|
||||
throw exception(FILE_NULL);
|
||||
throw new ServiceException(FILE_NULL);
|
||||
}
|
||||
if (!(file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls"))) {
|
||||
throw exception(FILE_FORMAT_ERROR);
|
||||
throw new ServiceException(FILE_FORMAT_ERROR);
|
||||
}
|
||||
if (file.getSize() > fileSize) {
|
||||
throw exception(FILE_EXCEED_SIZE);
|
||||
throw new ServiceException(FILE_EXCEED_SIZE);
|
||||
}
|
||||
if (file.getSize() == 0) {
|
||||
throw exception(FILE_CONTENT_NULL);
|
||||
throw new ServiceException(FILE_CONTENT_NULL);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+17
-17
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@@ -14,7 +15,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||
|
||||
@@ -55,8 +55,8 @@ public class ApiDataAchieve {
|
||||
JSONObject json = apiDataProduction.getApiTokenMessage(appId, appSecret);
|
||||
if (!json.getString(ERR_MSG_KEY).equals("success")) {
|
||||
log.error(APP_TOKEN_ERROR.getMsg());
|
||||
throw exception(API_MES_ERR, "身份认证-" + json.getString(ERR_MSG_KEY));
|
||||
// throw exception(APP_TOKEN_ERROR);
|
||||
throw new ServiceException(API_MES_ERR, "身份认证-" + json.getString(ERR_MSG_KEY));
|
||||
// throw new ServiceException(APP_TOKEN_ERROR);
|
||||
}
|
||||
return new AsyncResult<>(json);
|
||||
}
|
||||
@@ -79,8 +79,8 @@ public class ApiDataAchieve {
|
||||
JSONObject parts = apiDataProduction.getApiOrderPartsMessage(token, jsonParts);
|
||||
if (!parts.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error("N" + orderNo + "配件数据获取错误:" + parts.getString(ERR_MSG_KEY));
|
||||
throw exception(API_MES_ERR, "配件信息获取-" + parts.getString(ERR_MSG_KEY));
|
||||
// throw exception(PARTS_DATA_ERROR);
|
||||
throw new ServiceException(API_MES_ERR, "配件信息获取-" + parts.getString(ERR_MSG_KEY));
|
||||
// throw new ServiceException(PARTS_DATA_ERROR);
|
||||
}
|
||||
if (parts.getJSONObject(VALUE_KEY).getJSONArray("List") == null || parts.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) {
|
||||
return null;
|
||||
@@ -99,8 +99,8 @@ public class ApiDataAchieve {
|
||||
JSONObject body = apiDataProduction.getApiOrderBodyMessage(token, jsonBody);
|
||||
if (!body.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error("N" + orderNo + "柜体数据获取错误:" + body.getString(ERR_MSG_KEY));
|
||||
throw exception(API_MES_ERR, "柜体信息获取-" + body.getString(ERR_MSG_KEY));
|
||||
// throw exception(BODY_DATA_ERROR);
|
||||
throw new ServiceException(API_MES_ERR, "柜体信息获取-" + body.getString(ERR_MSG_KEY));
|
||||
// throw new ServiceException(BODY_DATA_ERROR);
|
||||
}
|
||||
JSONObject dataBody = new JSONObject();
|
||||
for (int i = 1; i <= body.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
||||
@@ -123,8 +123,8 @@ public class ApiDataAchieve {
|
||||
JSONObject goods = apiDataProduction.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
if (!goods.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error("N" + orderNo + "商品信息转换失败:" + goods.getString(ERR_MSG_KEY));
|
||||
throw exception(API_MES_ERR, "商品信息获取-" + goods.getString(ERR_MSG_KEY));
|
||||
// throw exception(GOODS_DATA_ERROR);
|
||||
throw new ServiceException(API_MES_ERR, "商品信息获取-" + goods.getString(ERR_MSG_KEY));
|
||||
// throw new ServiceException(GOODS_DATA_ERROR);
|
||||
}
|
||||
JSONObject dataGoods = new JSONObject();
|
||||
for (int i = 1; i <= goods.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
||||
@@ -143,8 +143,8 @@ public class ApiDataAchieve {
|
||||
JSONObject plates = apiDataProduction.getApiBlocksDataMessage(token, jsonPlates);
|
||||
if (!plates.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error("N" + orderNo + "板材明细信息获取错误" + plates.getString(ERR_MSG_KEY));
|
||||
throw exception(API_MES_ERR, "板材明细信息获取-" + plates.getString(ERR_MSG_KEY));
|
||||
// throw exception(PLATE_DATA_ERROR);
|
||||
throw new ServiceException(API_MES_ERR, "板材明细信息获取-" + plates.getString(ERR_MSG_KEY));
|
||||
// throw new ServiceException(PLATE_DATA_ERROR);
|
||||
}
|
||||
if (plates.getJSONObject(VALUE_KEY).getJSONArray("List") == null || plates.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) {
|
||||
return null;
|
||||
@@ -172,7 +172,7 @@ public class ApiDataAchieve {
|
||||
JSONObject blocks = apiDataProduction.getApiBlocksMessage(token, jsonBlocks);
|
||||
if (!blocks.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error("N" + orderNo + "板材数据获取错误" + blocks.getString(ERR_MSG_KEY));
|
||||
throw exception(API_MES_ERR, "板材数据信息获取-" + blocks.getString(ERR_MSG_KEY));
|
||||
throw new ServiceException(API_MES_ERR, "板材数据信息获取-" + blocks.getString(ERR_MSG_KEY));
|
||||
}
|
||||
JSONObject block = new JSONObject();
|
||||
for (int i = 1; i <= blocks.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) {
|
||||
@@ -193,7 +193,7 @@ public class ApiDataAchieve {
|
||||
JSONObject good = apiDataProduction.getApiGoods(token, jsonGoods);
|
||||
if (!good.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error(id + "配件数据获取错误" + good.getString(ERR_MSG_KEY));
|
||||
throw exception(API_MES_ERR, "配件数据信息获取-" + good.getString(ERR_MSG_KEY));
|
||||
throw new ServiceException(API_MES_ERR, "配件数据信息获取-" + good.getString(ERR_MSG_KEY));
|
||||
|
||||
}
|
||||
return new AsyncResult<>(good);
|
||||
@@ -213,7 +213,7 @@ public class ApiDataAchieve {
|
||||
if (!order.getString(ProduceApiConstants.CODE).equals("0") ||
|
||||
order.getJSONArray(ProduceApiConstants.DATA) == null ||
|
||||
order.getJSONArray(ProduceApiConstants.DATA).isEmpty()) {
|
||||
throw exception(ORDER_NOT_FOUND);
|
||||
throw new ServiceException(ORDER_NOT_FOUND);
|
||||
}
|
||||
|
||||
return order;
|
||||
@@ -230,13 +230,13 @@ public class ApiDataAchieve {
|
||||
LocalDate endTime = LocalDate.parse(createDateMax, formatter);
|
||||
long daysBetweenSimple = ChronoUnit.DAYS.between(startTime, endTime);
|
||||
if (daysBetweenSimple > 30) {
|
||||
throw exception(ORDER_DATE_ERR);
|
||||
throw new ServiceException(ORDER_DATE_ERR);
|
||||
}
|
||||
|
||||
jsonOrders.put("create_date_min", createDateMin + " 00:00:00");
|
||||
jsonOrders.put("create_date_max", createDateMax + " 23:59:59");
|
||||
} catch (Exception e) {
|
||||
throw exception(ORDER_TIME_ERR);
|
||||
throw new ServiceException(ORDER_TIME_ERR);
|
||||
}
|
||||
}
|
||||
// 订单列表
|
||||
@@ -260,7 +260,7 @@ public class ApiDataAchieve {
|
||||
|
||||
JSONObject orders = apiDataProduction.getApiOrderList(token, jsonOrders);
|
||||
if (!orders.getString(ERR_CODE_KEY).equals("0")) {
|
||||
throw exception(ORDER_READ_ERR);
|
||||
throw new ServiceException(ORDER_READ_ERR);
|
||||
}
|
||||
JSONObject order = new JSONObject();
|
||||
int countPage = divideWithPlusOne(orders.getInteger("count"), PARTS_PAGE_MAX);
|
||||
|
||||
+11
-11
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;//packa
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.dto.Point;
|
||||
@@ -30,7 +31,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_DETAIL_DATE_ERR;
|
||||
|
||||
@@ -117,8 +117,8 @@ public class ApiTypeRealize {
|
||||
|
||||
// 判断生产数据是否可以为空
|
||||
if (!platesData.getMapPlatesInfos().isEmpty() && plateDetailData.getMapPlateDetails().isEmpty() ) {
|
||||
throw exception(ORDER_DETAIL_DATE_ERR);
|
||||
// throw exception(API_MES_ERR, "生产数据信息获取-小板缺少生产数据,导致无法正常导单");
|
||||
throw new ServiceException(ORDER_DETAIL_DATE_ERR);
|
||||
// throw new ServiceException(API_MES_ERR, "生产数据信息获取-小板缺少生产数据,导致无法正常导单");
|
||||
}
|
||||
|
||||
// 小板数据补充,order_goods_id添加造型相关数据判断获取,以及配件中添加goods_id
|
||||
@@ -219,15 +219,15 @@ public class ApiTypeRealize {
|
||||
// 第一步判断是否存在需要进行数据添加的小板
|
||||
if (mapPlatesInfos == null || mapPlatesInfos.isEmpty()) {
|
||||
log.error("小板信息:{}" , PLATE_DATA_ERROR);
|
||||
// throw exception(PLATE_DATA_ERROR);
|
||||
// throw new ServiceException(PLATE_DATA_ERROR);
|
||||
}
|
||||
if (mapPlateDetails == null || mapPlateDetails.isEmpty()) {
|
||||
log.error("小板信息:{}" , PLATE_PRODUCE_DATA_ERROR);
|
||||
// throw exception(PLATE_PRODUCE_DATA_ERROR);
|
||||
// throw new ServiceException(PLATE_PRODUCE_DATA_ERROR);
|
||||
}
|
||||
if (mapGoodsDO == null || mapGoodsDO.isEmpty()) {
|
||||
log.error("板材信息:{}" , GOODS_DATA_ERROR);
|
||||
// throw exception(GOODS_DATA_ERROR);
|
||||
// throw new ServiceException(GOODS_DATA_ERROR);
|
||||
}
|
||||
mapPlatesInfos.forEach((k, v) -> {
|
||||
// 判断是否有造型数据可以进行整合
|
||||
@@ -250,7 +250,7 @@ public class ApiTypeRealize {
|
||||
// 获取小板对应的造型信息
|
||||
PlateDetail plateDetail = mapPlateDetails.get(k);
|
||||
if (plateDetail == null) {
|
||||
throw exception(ORDER_DETAIL_DATE_ERR);
|
||||
throw new ServiceException(ORDER_DETAIL_DATE_ERR);
|
||||
}
|
||||
plateDetail.setPlateId(v.getId())
|
||||
.setExtraRemark(mapPlateDetailsRemarks.get(k).getExtraRemark())
|
||||
@@ -439,7 +439,7 @@ public class ApiTypeRealize {
|
||||
|
||||
// if (bodyLists == null || bodyLists.isEmpty()) {
|
||||
// log.error("{}房间柜体信息获取失败",orderNo);
|
||||
// throw exception(ORDER_BODY_NOT_EXISTS);
|
||||
// throw new ServiceException(ORDER_BODY_NOT_EXISTS);
|
||||
//
|
||||
// }
|
||||
|
||||
@@ -947,12 +947,12 @@ public class ApiTypeRealize {
|
||||
|
||||
if (platesJSONObject == null || platesJSONObject.isEmpty()) {
|
||||
log.error("获取板件明细数据失败");
|
||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
throw new ServiceException(PLATE_PLAN_DATA_ERROR);
|
||||
|
||||
}
|
||||
if (blocksJSONObject == null || blocksJSONObject.isEmpty()) {
|
||||
log.error("获取板材数据失败");
|
||||
throw exception(PLATE_GOOD_DATA_NULL);
|
||||
throw new ServiceException(PLATE_GOOD_DATA_NULL);
|
||||
|
||||
}
|
||||
// 板材数据
|
||||
@@ -1516,7 +1516,7 @@ public class ApiTypeRealize {
|
||||
|
||||
if (map == null || map.isEmpty()) {
|
||||
log.error("明细信息:{}" , CHANGE_DETAILS_ITEM_ERROR);
|
||||
// throw exception(CHANGE_DETAILS_ITEM_ERROR);
|
||||
// throw new ServiceException(CHANGE_DETAILS_ITEM_ERROR);
|
||||
}
|
||||
|
||||
// 处理第一个 Map
|
||||
|
||||
+23
-24
@@ -10,7 +10,6 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
@@ -290,7 +289,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
*/
|
||||
private void validCustomOrderNo(String key, String val) {
|
||||
if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +301,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
*/
|
||||
private void validOrderInfoEmpty(String key, String val) {
|
||||
if (StringUtils.isEmpty(val)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +314,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
*/
|
||||
private void validOrderInfoLength(String key, String val, int length) {
|
||||
if (StringUtils.isNotEmpty(val) && length < val.length()) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +326,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
*/
|
||||
private void validOrderInfoPhone(String key, String val) {
|
||||
if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +340,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
try {
|
||||
return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
} catch (Exception e) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +645,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNull(plateGoodDO)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, rowIndex + 1);
|
||||
throw new ServiceException(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, rowIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,11 +661,11 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
// 判断非空,字典值判断
|
||||
public void isNotEmptyAndDict(String value, String dictType, String errValue) {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
} else {
|
||||
DictDataRespDTO dictDataRespDTO = dictDataApi.parseDictData(dictType, value).getData();
|
||||
if (dictDataRespDTO == null) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,12 +673,12 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
// 非空判断,错误填入
|
||||
private void isEmpty(String value, String errValue, int length) {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
} else {
|
||||
// 字符串长度检查
|
||||
int size = value.length();
|
||||
if (size > length) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -688,7 +687,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
// 判断非零,错误返回;不为空时,判断是否符合枚举类
|
||||
private void isNotEmptyAndBack(String value, Class<? extends Enum<?>> enumClass, String errValue, int length) {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
} else {
|
||||
isEmptyAndSize(value, length, errValue);
|
||||
try {
|
||||
@@ -705,10 +704,10 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
}
|
||||
}
|
||||
if (!isValid) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -729,13 +728,13 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) {
|
||||
if (Boolean.TRUE.equals(ToolUtil.checkNumber(value))) {
|
||||
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + POSITIVE_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + POSITIVE_ERR);
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -754,13 +753,13 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) {
|
||||
if (Boolean.TRUE.equals(checkPositiveNumber(value))) {
|
||||
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "必须大于0");
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "必须大于0");
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -768,7 +767,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
// 判断非零,错误返回
|
||||
private void isNotEmptyAndBack(String value, String errValue) {
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,7 +776,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
int size = value.length();
|
||||
if (size > length) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -786,10 +785,10 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener
|
||||
public void isEmptyAndPositiveNumber(String value, Class<?> targetType, String errValue) {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
if (Boolean.FALSE.equals(ToolUtil.convertToType(value, targetType))) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR);
|
||||
} else {
|
||||
if (Boolean.FALSE.equals(checkPositiveNumber(value))) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "数量必须大于0");
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "数量必须大于0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
-28
@@ -7,7 +7,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.dict.core.util.DictFrameworkUtils;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
@@ -442,7 +442,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
// 从标签属性生成order对象
|
||||
OrderXmlVO orderXmlVO = getJavaBeanFromXmlAttr(OrderXmlVO.class, attributes);
|
||||
if (ObjectUtil.isNull(orderXmlVO)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "生产单内容为空");
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "生产单内容为空");
|
||||
}
|
||||
// 校验属性
|
||||
validOrderInfo(orderXmlVO);
|
||||
@@ -705,7 +705,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
if (ObjectUtil.isNotNull(plateGoodDO)) {
|
||||
plate.setItemCode(plateGoodDO.getGoodsId());
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, location.getLineNumber());
|
||||
throw new ServiceException(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, location.getLineNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1067,7 +1067,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
// 校验point数量
|
||||
if (inGroove) {
|
||||
if (CollUtil.isEmpty(points)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "原始造型(外)轮廓点阵列表不能为空");
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "原始造型(外)轮廓点阵列表不能为空");
|
||||
}
|
||||
grooveOutlineXmlVO.setPointXmlVOList(ListUtil.toList(points));
|
||||
} else {
|
||||
@@ -1343,7 +1343,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void endPoints() {
|
||||
// 校验point数量
|
||||
if (ObjectUtil.isNotNull(pointXmlVOS) && CollUtil.isEmpty(points)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, inIslet ? "孤岛点阵列表不可为空" : "槽点坐标列表不可为空");
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, inIslet ? "孤岛点阵列表不可为空" : "槽点坐标列表不可为空");
|
||||
}
|
||||
if (inGroove) {
|
||||
groovePointXmlVOS.setPointXmlVOList(ListUtil.toList(points));
|
||||
@@ -1597,7 +1597,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
}
|
||||
if (StringUtils.isEmpty(pointXmlVO.getItemCode())) {
|
||||
if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "当封边条没有物料编码时,封边条颜色、材质不可为空");
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "当封边条没有物料编码时,封边条颜色、材质不可为空");
|
||||
}
|
||||
}
|
||||
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "edgingThickness");
|
||||
@@ -1718,7 +1718,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
|
||||
// 检查roomCode
|
||||
if (!bodyEmpty) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR, se, boxCode);
|
||||
throw new ServiceException(ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR, se, boxCode);
|
||||
}
|
||||
|
||||
String roomName = NOT_ASSIGNED;
|
||||
@@ -1729,7 +1729,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
} else {
|
||||
// 检查roomCode
|
||||
if (!roomEmpty) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR, se, roomCode);
|
||||
throw new ServiceException(ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR, se, roomCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1768,7 +1768,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
// }
|
||||
|
||||
if (StringUtils.isNotEmpty(groupCodes) && !groupCodeSet.contains(groupCodes)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR, se, groupCodes);
|
||||
throw new ServiceException(ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR, se, groupCodes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1793,7 +1793,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
*/
|
||||
private void validCustomOrderNo(String key, String val) {
|
||||
if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1805,7 +1805,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
*/
|
||||
private void validOrderInfoEmpty(String key, String val) {
|
||||
if (StringUtils.isEmpty(val)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_EMPTY, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1818,7 +1818,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
*/
|
||||
private void validOrderInfoLength(String key, String val, int length) {
|
||||
if (StringUtils.isNotEmpty(val) && length < val.length()) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1830,7 +1830,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
*/
|
||||
private void validOrderInfoPhone(String key, String val) {
|
||||
if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1844,7 +1844,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
try {
|
||||
return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
} catch (Exception e) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
||||
throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1872,10 +1872,10 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void positiveNumber(String value, String name, Class<?> targetType) {
|
||||
if (ToolUtil.convertToType(value, targetType)) {
|
||||
if (!ToolUtil.checkNumber(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1924,13 +1924,13 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
if (ToolUtil.convertToType(value, targetType)) {
|
||||
if (ToolUtil.checkNumber(value)) {
|
||||
if (!ToolUtil.checkPrecision(value, length, decimalLength)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + LONG_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + LONG_ERR, name));
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name));
|
||||
}
|
||||
} else {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1967,7 +1967,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
setter.accept(defaultValue);
|
||||
} else {
|
||||
if (!ToolUtil.convertToType(value.trim(), targetType)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1981,7 +1981,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void isEmptyAndBack(Supplier<String> getter, String name) {
|
||||
String value = getter.get();
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2001,7 +2001,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
} else {
|
||||
String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim());
|
||||
if (StringUtils.isEmpty(dictData)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2017,7 +2017,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void isEmptyAndPositiveNumber(Supplier<String> getter, String name, Consumer<String> setter, Class<?> targetType, Integer length, Integer decimalLength) {
|
||||
String value = getter.get();
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
} else {
|
||||
positiveNumberSize(value, setter, targetType, name, length, decimalLength);
|
||||
}
|
||||
@@ -2048,7 +2048,7 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void isEmptyBackAndPositiveNumber(Supplier<String> getter, String name, Class<?> targetType) {
|
||||
String value = getter.get();
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
} else {
|
||||
positiveNumber(value, name, targetType);
|
||||
}
|
||||
@@ -2064,10 +2064,10 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void isEmptyBackAndNumber(Supplier<String> getter, Class<?> targetType, String name) {
|
||||
String value = getter.get();
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
} else {
|
||||
if (!ToolUtil.convertToType(value.trim(), targetType)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2082,11 +2082,11 @@ public class DefaultOrderImportXmlParserHandler {
|
||||
private void isEmptyBackAndInvalid(Supplier<String> getter, String dictTypeConstants, String name) {
|
||||
String value = getter.get();
|
||||
if (com.alibaba.nacos.common.utils.StringUtils.isEmpty(value)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name));
|
||||
} else {
|
||||
String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim());
|
||||
if (StringUtils.isEmpty(dictData)) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
||||
throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
|
||||
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.alibaba.nacos.shaded.com.google.common.base.Function;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
||||
@@ -108,7 +108,7 @@ public class XMLUtil {
|
||||
writer.write(xmlStr);
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
throw ServiceExceptionUtil.exception(FILE_OUTPUT_ERROR, name);
|
||||
throw new ServiceException(FILE_OUTPUT_ERROR, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user