diff --git a/cf-gateway/src/main/java/com/cf/imes/gateway/filter/security/TokenAuthenticationFilter.java b/cf-gateway/src/main/java/com/cf/imes/gateway/filter/security/TokenAuthenticationFilter.java index 38cb37a33..7bed95d46 100644 --- a/cf-gateway/src/main/java/com/cf/imes/gateway/filter/security/TokenAuthenticationFilter.java +++ b/cf-gateway/src/main/java/com/cf/imes/gateway/filter/security/TokenAuthenticationFilter.java @@ -1,6 +1,8 @@ package com.cf.imes.gateway.filter.security; import cn.hutool.core.text.CharSequenceUtil; +import com.cf.imes.framework.common.exception.ErrorCode; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.gateway.util.SecurityFrameworkUtils; @@ -21,6 +23,8 @@ import reactor.core.publisher.Mono; import java.util.Objects; import java.util.function.Function; +import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; + /** * Token 过滤器,验证 token 的有效性 * 1. 验证通过时,将 userId、userType、organId 通过 Header 转发给服务 @@ -37,6 +41,10 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered { private static final TypeReference> CHECK_RESULT_TYPE_REFERENCE = new TypeReference>() {}; + + private static final TypeReference TOKEN_RESULT + = new TypeReference() {}; + /** * 空的 LoginUser 的结果 * @@ -104,6 +112,25 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered { } private LoginUser buildUser(String body) { + + CommonResult commonResult = JsonUtils.parseObject(body, TOKEN_RESULT); + if(commonResult != null) { + Integer code = commonResult.getCode(); + String msg = commonResult.getMsg(); + if(code != 0) { + if (TOKEN_TIME_IS_EXPIRES.getCode().equals(code)) { + throw new ServiceException(TOKEN_TIME_IS_EXPIRES); + } else if (TOKEN_CONFIG_NOT_EXISTS.getCode().equals(code)) { + throw new ServiceException(TOKEN_CONFIG_NOT_EXISTS); + } else if (ORGAN_NOT_EXISTS.getCode().equals(code)) { + throw new ServiceException(ORGAN_NOT_EXISTS); + } else if (ORGAN_DISABLE.getCode().equals(code)) { + throw new ServiceException(new ErrorCode(code, msg)); + } else if (ORGAN_EXPIRE.getCode().equals(code)) { + throw new ServiceException(new ErrorCode(code, msg)); + } + } + } // 处理结果,结果不正确 CommonResult result = JsonUtils.parseObject(body, CHECK_RESULT_TYPE_REFERENCE); if (result == null) { diff --git a/cf-gateway/src/main/java/com/cf/imes/gateway/handler/GlobalExceptionHandler.java b/cf-gateway/src/main/java/com/cf/imes/gateway/handler/GlobalExceptionHandler.java index 0547eeae6..f678cac8c 100644 --- a/cf-gateway/src/main/java/com/cf/imes/gateway/handler/GlobalExceptionHandler.java +++ b/cf-gateway/src/main/java/com/cf/imes/gateway/handler/GlobalExceptionHandler.java @@ -1,5 +1,6 @@ package com.cf.imes.gateway.handler; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.gateway.util.WebFrameworkUtils; import lombok.extern.slf4j.Slf4j; @@ -39,7 +40,10 @@ public class GlobalExceptionHandler implements ErrorWebExceptionHandler { CommonResult result; if (ex instanceof ResponseStatusException) { result = responseStatusExceptionHandler(exchange, (ResponseStatusException) ex); - } else { + } else if(ex instanceof ServiceException){ + result = serviceExceptionHandler((ServiceException) ex); + } + else { result = defaultExceptionHandler(exchange, ex); } @@ -71,4 +75,10 @@ public class GlobalExceptionHandler implements ErrorWebExceptionHandler { return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), INTERNAL_SERVER_ERROR.getMsg()); } + @ExceptionHandler(value = ServiceException.class) + public CommonResult serviceExceptionHandler(ServiceException ex) { + log.info(String.format("========[serviceExceptionHandler]========,%s: %s", ex.getCode(),ex.getMessage())); + return CommonResult.error(ex.getCode(), ex.getMessage()); + } + } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java index 2674648e3..ca0af4389 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java @@ -68,15 +68,6 @@ public class PlateController { return success(true); } - @GetMapping("/get") - @Operation(summary = "获得生产单板件") - @PreAuthorize("@ss.hasPermission('executor:plate:query')") - public CommonResult> getPlate(@Valid PlateDetailReqVO reqVO) { - - List plate = plateService.getPlate(reqVO); - - return success(plate); - } @GetMapping("/page") @Operation(summary = "获取实际的开料大板") diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateDetailReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateDetailReqVO.java deleted file mode 100644 index 133f7cd85..000000000 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateDetailReqVO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.cf.imes.module.executor.controller.admin.plate.vo; - - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - - - -@Schema(description = "管理后台 - 查询生产单板件对应详细信息") -@Data -public class PlateDetailReqVO { - - - @Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14195") - private Long plateId; - - @Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11087") - private Long orderId; - - @Schema(description = "柜体ID", example = "11087") - private Long bodyId; - - - - - -} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java index 0e233925d..3dfbd35ed 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java @@ -153,7 +153,7 @@ public interface OrderMapper extends BaseMapperX { List selectOrderListByIds(@Param("orderIds") List orderIds, @Param("organId") Long organId); - IPage selectOrderIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper wrapper); + // 生产单预警统计 IPage selectOrderNear(@Param("orderDate") LocalDate orderDate, @Param("organId") Long organId, @Param("page") IPage page); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java index 374f89dec..9d9e9d5ca 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java @@ -5,17 +5,10 @@ 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.manage.pack.vo.PlateAndPartIdList; import com.cf.imes.module.executor.controller.admin.manage.pack.vo.PlateDetailsRespVO; -import com.cf.imes.module.executor.controller.admin.manage.process.vo.PlateDetails; -import com.cf.imes.module.executor.controller.admin.manage.process.vo.ProcessPlateReqVO; -import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.OrderModuleVO; -import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.OrderPlateRespVO; -import com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.PlatePageVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsDetailRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO; -import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO; -import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO; import org.apache.ibatis.annotations.Mapper; @@ -57,13 +50,6 @@ public interface OrderItemMapper extends BaseMapperX { @Param("deleted") Integer deleted, @Param("types") Set types); - - List selectPlateList(@Param("reqVO") PlateDetailReqVO reqVO, @Param("organId") Long organId); - - - PlateDetailRespVO selectPlateNumList(@Param("orderId") Long orderId, @Param("organId") Long organId); - - void deleteByPlateId(@Param("deletePlateIds") List deletePlateIds); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java index 5aa3ed82e..4e2b379ba 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java @@ -40,13 +40,6 @@ public interface PlateService { */ void deletePlate(List plateIds,Long planId); - /** - * 获得生产单板件 - * - * @param - * @return 生产单板件 - */ - List getPlate(PlateDetailReqVO reqVO); /** * 获得生产单板件分页 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java index 16ecd314a..4a7c4aba5 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java @@ -24,8 +24,6 @@ import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX; import com.cf.imes.framework.mybatis.core.query.QueryWrapperX; -import com.cf.imes.framework.security.core.LoginUser; -import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO; import com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList; @@ -239,33 +237,8 @@ public class PlateServiceImpl implements PlateService { } } - @Override - public List getPlate(PlateDetailReqVO reqVO) { - - // 获取到当前登录用户的信息 - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - - // 查询生产单下的大板,余料板,排单状态的信息 - PlateDetailRespVO plateDetailRespVO = orderItemMapper.selectPlateNumList(reqVO.getOrderId(),getUserOrganId()); - - plateDetailRespVO.setCompanyId(loginUser.getId()); - - // 查询生产单下的板材详细信息 - List plateRespVOS = orderItemMapper.selectPlateList(reqVO,getUserOrganId()); - // 将大板等信息循环插入 - for (PlateRespVO respVO : plateRespVOS) { - respVO.setCompanyId(plateDetailRespVO.getCompanyId()); - respVO.setPlanStatus(plateDetailRespVO.getPlanStatus()); - respVO.setBigPlateNum(plateDetailRespVO.getBigPlateNum()); - respVO.setRemainPlateNum(plateDetailRespVO.getRemainPlateNum()); - } - - return plateRespVOS; - - - } @Override public PageResult getPlatePage(PlatePageReqVO pageReqVO) { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml index 1e362e5c5..77d2da805 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml @@ -221,37 +221,6 @@ - - - - - - - select distinct - op.*, - og.color as color, - og.material as material, - ob.name as bodyName, - ob.room_name as roomName, - oi.id as itemId, - oi.group_id as processGroupId, - og.brand as brand, - (case - when p.texture = '' then '是' - else '否' end ) as hasTexture, - og.height as bigPlateLength, - og.width as bigPlateWidth, - og.spec as spec - from order_item oi - join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id - join order_body ob on oi.body_id = ob.id and oi.organ_id = ob.organ_id - join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id - join plate p on og.goods_id = p.id and og.organ_id = p.organ_id - - oi.organ_id = #{organId} - - AND oi.order_id = #{reqVO.orderId} - - - AND oi.body_id = #{reqVO.bodyId} - - - AND oi.plate_id = #{reqVO.plateId} - - - - - - - - - - - - - - - - - - @@ -372,45 +289,6 @@ - - - - - - - - - - - - diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml index 020ddcb34..3c5c7083a 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml @@ -219,9 +219,9 @@ og.order_id as orderId from orders o - left join order_goods og on o.id = og.order_id and og.organ_id = #{organId} - left join order_plate op on og.id = op.goods_id and op.organ_id = #{organId} - left join order_item oi on op.id = oi.plate_id and oi.organ_id = #{organId} + left join order_goods og on o.id = og.order_id and og.organ_id = #{organId} + left join order_plate op on og.order_id = op.order_id and og.id = op.goods_id and op.organ_id = #{organId} + left join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id and oi.organ_id = #{organId} left join order_plan_item opi on op.order_id = opi.order_id and op.id = opi.plate_id and opi.organ_id = #{organId} ${ew.customSqlSegment} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/oauth2/OAuth2TokenApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/oauth2/OAuth2TokenApiImpl.java index 4fc421671..c44c2bd30 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/oauth2/OAuth2TokenApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/oauth2/OAuth2TokenApiImpl.java @@ -1,14 +1,11 @@ package com.cf.imes.module.system.api.oauth2; -import com.cf.imes.framework.common.exception.ServerException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.util.object.BeanUtils; -import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO; import com.cf.imes.module.system.api.oauth2.dto.OAuth2AccessTokenCreateReqDTO; import com.cf.imes.module.system.api.oauth2.dto.OAuth2AccessTokenRespDTO; import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; -import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO; import com.cf.imes.module.system.service.oauth2.OAuth2TokenService; import com.cf.imes.module.system.service.organ.OrganService; import io.swagger.v3.oas.annotations.Operation; @@ -17,8 +14,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.Objects; - import static com.cf.imes.framework.common.pojo.CommonResult.success; @RestController // 提供 RESTful API 接口,给 Feign 调用