取消板件自动写入,bug1255,1225

This commit is contained in:
lym
2025-02-20 16:27:40 +08:00
parent 2e34c68a90
commit c26b357f14
20 changed files with 565 additions and 75 deletions
@@ -11,6 +11,7 @@ import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.common.util.servlet.ServletUtils;
import com.cf.imes.module.infra.api.logger.ApiErrorLogApi;
import com.cf.imes.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.dao.DuplicateKeyException;
@@ -31,9 +32,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.ValidationException;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
@@ -213,6 +217,23 @@ public class GlobalExceptionHandler {
@ExceptionHandler(value = HttpMessageNotReadableException.class)
public CommonResult httpMessageNotReadableExceptionHandler(HttpServletRequest req, HttpMessageNotReadableException ex) {
log.warn("[httpMessageNotReadableExceptionHandler]", ex);
Throwable rootCause = ex.getRootCause();
// 无效格式异常处理。
if (rootCause instanceof MismatchedInputException) {
return CommonResult.error(BAD_REQUEST.getCode(), "参数格式异常无法解读,请按照对应格式上传");
}
// 文件格式错误处理
if (rootCause instanceof IOException ) {
// 使用正则提取数值
Pattern pattern = Pattern.compile("Numeric value \\((\\d+)\\) out of range");
Matcher matcher = pattern.matcher(rootCause.getMessage());
if (matcher.find()) {
String invalidValue = matcher.group(1);
return CommonResult.error(BAD_REQUEST.getCode(), String.format("参数校验失败:'%s' 超出范围", invalidValue));
}
}
return CommonResult.error(BAD_REQUEST.getCode(), "请求参数不合法");
}
@@ -61,14 +61,15 @@ public class ErrorCodeConstants {
public static final ErrorCode ORDER_DATE_ERR = new ErrorCode(1_002_029_008, "获取订单列表,时间超出范围,请在30天范围内选择");
public static final ErrorCode ORDER_TIME_ERR = new ErrorCode(1_002_029_009, "获取订单列表,时间格式输入出错,请更换格式");
public static final ErrorCode FILE_TYPE_ERR = new ErrorCode(1_002_029_010, "当前文件类型尚未开发,敬请期待");
public static final ErrorCode ORDER_DETAIL_DATE_ERR = new ErrorCode(1_002_029_006, "板件生产数据缺失,请确认数据源中是否存在相关数据");
public static final ErrorCode ORDER_DETAIL_DATE_ERR = new ErrorCode(1_002_029_011, "板件生产数据缺失,请确认数据源中是否存在相关数据");
public static final ErrorCode SOURCE_NOT_EXITS_ERROR = new ErrorCode(1_002_029_013, "源数据查询失败");
public static final ErrorCode ORDER_DELETED_ERR = new ErrorCode(1_002_029_006, "生产单删除失败");
public static final ErrorCode ORDER_RESTORE_ERR = new ErrorCode(1_002_029_006, "生产单还原失败");
public static final ErrorCode ORDER_DELETED_ERR = new ErrorCode(1_002_029_014, "生产单删除失败");
public static final ErrorCode ORDER_RESTORE_ERR = new ErrorCode(1_002_029_015, "生产单还原失败");
public static final ErrorCode LOCK_ERR = new ErrorCode(1_002_030_001, "当前存在导入情况,请稍后");
public static final ErrorCode API_MES_ERR = new ErrorCode(1_002_031_001, "MES接口数据出错:{}");
public static final ErrorCode CHANGE_DETAILS_ITEM_ERROR = new ErrorCode(1_002_032_001, "明细转换失败");
public static final ErrorCode ORDER_MATCH_NOT = new ErrorCode(1_002_033_001, "板材库缺少相关板材,请在板材库中进行添加之后再进行导入");
// ========== 自定义板编号生成 ==========
public static final ErrorCode CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE = new ErrorCode(1_002_030_001, "自定义版编号生产单序号规则中存在不支持的复位类型:{}");
@@ -0,0 +1,31 @@
package com.cf.imes.module.executor.controller.admin.order.vo.type;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPrintRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.util.List;
/**
* 房间-柜体 -- 配件
*/
@Schema(description = "管理后台 - 房间-柜体 -- 配件 Response VO")
@Data
@ExcelIgnoreUnannotated
@Builder
public class PartsByRoomBodyRespVO {
@Schema(description = "房间名称")
private String roomName ;
@Schema(description = "柜体名称")
private String bodyName ;
@Schema(description = "配件集合")
private List<OrderPartsPrintRespVO> partsRespVO ;
@Schema(description = "小计")
private Double total ;
}
@@ -0,0 +1,41 @@
package com.cf.imes.module.executor.controller.admin.order.vo.type;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 板材 -- 小板明细
*/
@Schema(description = "管理后台 - 板材 -- 小板明细 Response VO")
@Data
@ExcelIgnoreUnannotated
@Builder
public class PlateByGoodsDetRespVO {
@Schema(description = "商品编号")
private String goodsId ;
@Schema(description = "板材名称")
private String name ;
@Schema(description = "板材颜色")
private String color ;
@Schema(description = "板材厚度")
private BigDecimal thickness;
@Schema(description = "小计")
private Integer number ;
@Schema(description = "小板集合")
private List<PlateGoodsRespVO> plateRespVO ;
@Schema(description = "小计面积")
private BigDecimal totalArea ;
}
@@ -0,0 +1,36 @@
package com.cf.imes.module.executor.controller.admin.order.vo.type;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 房间-柜体 -- 小板明细
*/
@Schema(description = "管理后台 - 房间-柜体 -- 小板明细 Response VO")
@Data
@ExcelIgnoreUnannotated
@Builder
public class PlateByRoomBodyDetRespVO {
@Schema(description = "房间名称")
private String roomName ;
@Schema(description = "柜体名称")
private String bodyName ;
@Schema(description = "小计")
private Integer number ;
@Schema(description = "小板集合")
private List<PlateGoodsRespVO> plateRespVO ;
@Schema(description = "小计面积")
private BigDecimal totalArea ;
}
@@ -0,0 +1,59 @@
package com.cf.imes.module.executor.controller.admin.orderParts.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
/**
* 总价 -- 配件明细
*/
@Schema(description = "管理后台 - 总价 -- 配件明细 Response VO")
@Data
@ExcelIgnoreUnannotated
@Builder
public class OrderPartsPrintRespVO {
@Schema(description = "配件id")
private Long id;
@Schema(description = "配件编号")
private String goodsId;
@Schema(description = "配件名称")
private String name;
@Schema(description = "配件材质")
private String material;
@Schema(description = "配件类型")
private String category;
@Schema(description = "型号")
private String model;
@Schema(description = "规格")
private String spec;
@Schema(description = "品牌")
private String brand;
@Schema(description = "厂家")
private String factory;
@Schema(description = "单位")
private String unit;
@Schema(description = "备注")
private String remark;
@Schema(description = "单价")
private Double price;
@Schema(description = "金额")
private Double amount;
@Schema(description = "数量")
private Double num;
}
@@ -202,4 +202,11 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
List<Long> selectInsertGoodsIds(@Param("orderIds") List<Long> orderIds,@Param("goodsIds") List<Long> goodsIds,@Param("organId") Long organId);
// 通过orderId查找板材
default List<GoodsDO> selectGoodsByOrderId(Long orderId, Long organId, Integer deleted) {
return selectList(new LambdaQueryWrapperX<GoodsDO>()
.eq(GoodsDO::getOrderId, orderId)
.eq(GoodsDO::getDeleted, deleted)
.eq(GoodsDO::getOrganId, organId));
}
}
@@ -6,6 +6,7 @@ import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPageReqVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPrintRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO;
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrderPartsRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
@@ -104,4 +105,10 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
.select(OrderPartsDO::getId));
}
// 柜体查找配件
List<OrderPartsPrintRespVO> selectOrderPartsListByBody(@Param("orderId")Long orderId,
@Param("organId")Long organId,
@Param("deleted")Integer deleted,
@Param("roomId")Long roomId,
@Param("bodyId")Long bodyId);
}
@@ -50,6 +50,23 @@ public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
}
default List<PlateGoodDO> selectGood(String material, String color, BigDecimal thickness,
String brand, String goodsName, Long organId) {
LambdaQueryWrapper<PlateGoodDO> queryWrapper = new LambdaQueryWrapper<PlateGoodDO>()
.eq(PlateGoodDO::getGoodsName, goodsName)
.eq(PlateGoodDO::getMaterial, material)
.eq(PlateGoodDO::getColor, color)
.eq(PlateGoodDO::getThickness, thickness)
.eq(PlateGoodDO::getDeleted, 0)
.eq(PlateGoodDO::getOrganId, organId);
if (brand == null) {
queryWrapper.eq(PlateGoodDO::getBrand,"");
}else {
queryWrapper.eq(PlateGoodDO::getBrand, brand);
}
return selectList(queryWrapper);
}
default PageResult<PlateGoodDO> selectGoodsPage(GoodsPlateFilterPageReqVO pageReqVO, Long organId) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<PlateGoodDO>()
.eq(PlateGoodDO::getOrganId,organId)
@@ -281,4 +281,18 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
}
List<PlateGoodsRespVO> selectOrderPlateList(@Param("orderId") Long orderId,
@Param("organId") Long organId,
@Param("deleted") Integer deleted,
@Param("roomId")Long roomId,
@Param("bodyId")Long bodyId,
@Param("plateId")Long goodsId); // 明细
List<PlateGoodsRespVO> selectOrderPlateListSummary(@Param("orderId") Long orderId,
@Param("organId") Long organId,
@Param("deleted") Integer deleted,
@Param("roomId")Long roomId,
@Param("bodyId")Long bodyId,
@Param("plateId")Long goodsId); // 汇总
}
@@ -166,7 +166,7 @@ public class OrderInputProcessor {
insertInBatches(plateDOS, 1000, (batch, index) -> plateMapper.insertBatch((Collection<PlateDO>) batch));
insertInBatches(itemDOS, 1000, (batch, index) -> orderItemMapper.insertBatch((Collection<OrderItemDO>) batch));
insertInBatches(goodsDOS, 1000, (batch, index) -> goodsMapper.insertBatch((Collection<GoodsDO>) batch));
insertInBatches(plateGoodDOS, 1000, (batch, index) -> plateGoodMapper.insertBatch((Collection<PlateGoodDO>) batch));
// insertInBatches(plateGoodDOS, 1000, (batch, index) -> plateGoodMapper.insertBatch((Collection<PlateGoodDO>) batch));
insertInBatches(partsDOS, 1000, (batch, index) -> partsMapper.insertBatch((Collection<PartsDO>) batch));
}
@@ -220,4 +220,29 @@
</select>
<select id="selectOrderPartsListByBody" resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsPrintRespVO">
SELECT DISTINCT a.id,
a.goods_id,
a.name,
a.material,
a.category,
a.model,
a.spec,
a.brand,
a.factory,
a.unit,
a.remark,
a.price,
a.price * b.num as amount,
b.num
FROM order_parts a
LEFT JOIN order_item b ON a.id = b.parts_id
LEFT JOIN order_body c on c.id = b.body_id
WHERE b.order_id = #{orderId}
and b.organ_id = #{organId}
and a.deleted = #{deleted}
and b.room_id = #{roomId}
and b.body_id = #{bodyId}
</select>
</mapper>
@@ -730,5 +730,110 @@
</update>
<select id="selectOrderPlateListByBody" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
select distinct
op.id,
op.name,
op.goods_id,
ogs.goods_name,
op.front_hole_count,
op.back_hole_count,
op.side_hole_count,
op.unregular_point_count,
op.front_model_count,
op.back_model_count,
op.hole_arrange,
op.hole_face,
op.texture,
op.type,
op.open_door_type,
op.filter_type,
op.seal_left,
op.seal_right,
op.seal_up,
op.seal_down,
op.offset_x,
op.offset_y,
op.is_arc_across,
op.is_door,
op.is_cancel,
op.remark,
op.plate_no,
op.split_height,
op.split_width,
op.split_thickness,
op.module_type_id,
op.height,
op.width,
op.thickness,
op.area,
op.is_special_shaped,
op.is_sculpt,
ogs.price,
ogs.brand,
ogs.height as goods_height,
ogs.width as goods_width,
ogs.thickness as goods_thickness,
ogs.color,
ogs.material,
ogs.spec,
bdy.id as body_id,
bdy.`name` as body_name,
bdy.room_id,
bdy.room_name
from order_plate op
left join order_goods ogs on op.organ_id = ogs.organ_id and op.order_id = ogs.order_id and op.goods_id = ogs.id
left join order_item its on op.organ_id = its.organ_id and op.order_id = its.order_id and op.id = its.plate_id
left join order_body bdy on its.organ_id = bdy.organ_id and its.order_id = bdy.order_id and its.body_id = bdy.id
where op.organ_id = #{organId}
and op.deleted = #{deleted}
and op.order_id = #{orderId}
<if test="roomId != null">
and its.room_id = #{roomId}
</if>
<if test="bodyId != null">
and its.body_id = #{bodyId}
</if>
<if test="bodyId == null">
and its.id = #{plateId}
</if>
</select>
<select id="selectOrderPlateListSummary" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
select distinct
op.id,
op.name,
op.open_door_type,
op.height,
op.width,
op.thickness,
op.area,
ogs.thickness as goods_thickness,
ogs.color,
ogs.material,
ogs.spec,
bdy.id as body_id,
bdy.`name` as body_name,
bdy.room_id,
bdy.room_name
from order_plate op
left join order_goods ogs on op.organ_id = ogs.organ_id and op.order_id = ogs.order_id and op.goods_id = ogs.id
left join order_item its on op.organ_id = its.organ_id and op.order_id = its.order_id and op.id = its.plate_id
left join order_body bdy on its.organ_id = bdy.organ_id and its.order_id = bdy.order_id and its.body_id = bdy.id
where op.order_id = #{orderId}
and op.organ_id = #{organId}
and op.deleted = #{deleted}
<if test="roomId != null">
and its.room_id = #{roomId}
</if>
<if test="bodyId != null">
and its.body_id = #{bodyId}
</if>
<if test="bodyId == null">
and its.id = #{plateId}
</if>
</select>
</mapper>
@@ -27,18 +27,15 @@ public class PartsRespVO {
@ExcelProperty("配件编号")
private String goodsId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("配件名称")
private String name;
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "是否复合部件", converter = DictConvert.class)
@DictFormat(DictTypeConstants.BOOLEAN_STRING)
private Boolean isComposite;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 32, message = "颜色长度不能超过32个字符")
@ExcelProperty("颜色")
private String color;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材质")
private String material;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
// @ExcelProperty("子配件ID列表")
@ExcelIgnore
private String subparts;
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("配件类型")
@@ -49,14 +46,39 @@ public class PartsRespVO {
@ExcelProperty("配件子类")
private String type;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("配件名称")
private String name;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("型号")
private String model;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "价格")
@ExcelProperty("价格")
private Double price;
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材质")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 32, message = "颜色长度不能超过32个字符")
@ExcelProperty("颜色")
private String color;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("单位")
private String unit;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("规格")
private String spec;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厂家")
private String factory;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "宽度")
@@ -73,31 +95,10 @@ public class PartsRespVO {
@ExcelProperty("厚度")
private Double thickness;
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("")
private String spec;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厂家")
private String factory;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("单位")
private String unit;
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "是否复合部件", converter = DictConvert.class)
@DictFormat(DictTypeConstants.BOOLEAN_STRING)
private Boolean isComposite;
@Schema(description = "子配件ID列表,复合部件时记录子配件ID,半角逗号分隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
// @ExcelProperty("子配件ID列表")
@ExcelIgnore
private String subparts;
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
@NumberValid(name = "")
@ExcelProperty("价格")
private Double price;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@ExcelProperty("备注")
@@ -226,7 +226,7 @@ public class PartsServiceImpl implements PartsService {
// 必填字段判断
private void validateFieldExists(PartsSaveReqVO partsSaveReqVO) {
if (!CategoryEnum.OTHER.getValue().equals(partsSaveReqVO.getCategory())) { // 不为其他
if (partsSaveReqVO.getUnit() == null) {
if (partsSaveReqVO.getUnit() == null || partsSaveReqVO.getUnit().isEmpty()) {
throw exception(PARTS_UNIT_NOT_NULL);
}
if (CategoryEnum.EDGING.getValue().equals(partsSaveReqVO.getCategory())) { // 为封边
@@ -74,6 +74,9 @@ public class PlateServiceImpl implements PlateService {
public void updatePlate(PlateSaveReqVO updateReqVO) {
// 校验存在
Long organId = getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUser().getId(), updateReqVO.getOrganId());
if (updateReqVO.getId() == null) {
throw exception(ErrorCodeConstants.PLATE_NOT_EXISTS);
}
validatePlateExists(Long.valueOf(updateReqVO.getId()), organId);
PlateDO updateObj = BeanUtils.toBean(updateReqVO, PlateDO.class);
// 校验板材goods_id是否相同
@@ -39,6 +39,10 @@ public class RemainPlateServiceImpl implements RemainPlateService {
@Override
public Boolean createRemainPlate(RemainPlateSaveReqVO createReqVO) {
List<RemainPlateDO> remainPlates = new ArrayList<>();
// 限制新增数量不能超过999
if (createReqVO.getCount() > 999) {
throw exception(REMAIN_PLATE_COUNT_MAX);
}
// 插入
if (createReqVO.getCount() >= 1) {
for (int i = 0; i < createReqVO.getCount(); i++) {
@@ -70,9 +70,10 @@ public class ErrorCodeConstants {
public static final ErrorCode DEPT_EXISTS_USER = new ErrorCode(1_002_004_005, "部门中存在员工,无法删除");
public static final ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1_002_004_006, "部门({})不处于开启状态,不允许选择");
public static final ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "不能设置自己的子部门为父部门");
public static final ErrorCode DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_015_008, "不允许操作用户自身部门");
public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_015_008, "不允许操作用户自身部门及其上级部门");
public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_006, "部门({})已被禁用");
public static final ErrorCode DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_008, "不允许操作用户自身部门");
public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_009, "不允许操作用户自身部门及其上级部门");
public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_010, "部门({})已被禁用");
public static final ErrorCode DEPT_EXITS_USER = new ErrorCode(1_002_004_011, "当前部门存在用户,无法删除");
// ========== 岗位模块 1-002-005-000 ==========
public static final ErrorCode POST_NOT_FOUND = new ErrorCode(1_002_005_000, "当前岗位不存在");
@@ -260,6 +261,7 @@ public class ErrorCodeConstants {
public static final ErrorCode REMAIN_PLATE_NOT_EXISTS = new ErrorCode(1_002_033_005, "板材不存在");
public static final ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_033_006, "设计板材不存在");
public static final ErrorCode RAW_GOODS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_007, "生产板材导入数据不可以为空");
public static final ErrorCode PLATE_NOT_EXISTS = new ErrorCode(1_002_033_008, "板材标识代号禁止空");
public static final ErrorCode PLATE_GOODS_ID_NOT_SAME = new ErrorCode(1_002_033_009, "板材商品编号存在,请重新命名商品编号");
public static final ErrorCode PLATE_IS_SOURCE = new ErrorCode(1_002_033_010, "小板:{} 为源小板,无法删除");
public static final ErrorCode PLAN_GOODS_IS_FILTER_DATA_ERROR = new ErrorCode(1_002_033_011, "当前排单为非混单,无法添加颜色的筛选条件");
@@ -349,6 +351,7 @@ public class ErrorCodeConstants {
public static final ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_006, "未选中余料板,请选择余料板");
public static final ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(1_002_038_007, "应用信息不存在");
public static final ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_038_008, "应用登陆失败");
public static final ErrorCode REMAIN_PLATE_COUNT_MAX = new ErrorCode(1_002_038_009, "每次新增余料板数量,最大为999");
//=========== 用户的系统配置 1-002-039-000 ============
@@ -114,6 +114,10 @@ public class DeptServiceImpl implements DeptService {
}
// 校验部门内用户操作
checkCurrentWhenOperate(id);
// 校验部门内是否存在用户,存在用户则禁止删除
if (!userService.getUserListByDeptIds(Collections.singletonList(id)).isEmpty()) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXITS_USER);
}
// 删除部门
deptMapper.deleteById(id);
// 删除关联的用户