mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
token校验返回异常信息,未排单查询大板SQL更改
This commit is contained in:
+27
@@ -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<CommonResult<OAuth2AccessTokenCheckRespDTO>> CHECK_RESULT_TYPE_REFERENCE
|
||||
= new TypeReference<CommonResult<OAuth2AccessTokenCheckRespDTO>>() {};
|
||||
|
||||
|
||||
private static final TypeReference<CommonResult> TOKEN_RESULT
|
||||
= new TypeReference<CommonResult>() {};
|
||||
|
||||
/**
|
||||
* 空的 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<OAuth2AccessTokenCheckRespDTO> result = JsonUtils.parseObject(body, CHECK_RESULT_TYPE_REFERENCE);
|
||||
if (result == null) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-9
@@ -68,15 +68,6 @@ public class PlateController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产单板件")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plate:query')")
|
||||
public CommonResult<List<PlateRespVO>> getPlate(@Valid PlateDetailReqVO reqVO) {
|
||||
|
||||
List<PlateRespVO> plate = plateService.getPlate(reqVO);
|
||||
|
||||
return success(plate);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取实际的开料大板")
|
||||
|
||||
-27
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -153,7 +153,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
List<OrderRespVOCopy> selectOrderListByIds(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
IPage<OrderGoodsResp> selectOrderIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
|
||||
// 生产单预警统计
|
||||
IPage<OrderOverdueRespVO> selectOrderNear(@Param("orderDate") LocalDate orderDate, @Param("organId") Long organId, @Param("page") IPage<OrderOverdueRespVO> page);
|
||||
|
||||
-14
@@ -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<OrderItemDO> {
|
||||
@Param("deleted") Integer deleted,
|
||||
@Param("types") Set<String> types);
|
||||
|
||||
|
||||
List<PlateRespVO> selectPlateList(@Param("reqVO") PlateDetailReqVO reqVO, @Param("organId") Long organId);
|
||||
|
||||
|
||||
PlateDetailRespVO selectPlateNumList(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
void deleteByPlateId(@Param("deletePlateIds") List<Long> deletePlateIds);
|
||||
|
||||
|
||||
|
||||
-7
@@ -40,13 +40,6 @@ public interface PlateService {
|
||||
*/
|
||||
void deletePlate(List<Long> plateIds,Long planId);
|
||||
|
||||
/**
|
||||
* 获得生产单板件
|
||||
*
|
||||
* @param
|
||||
* @return 生产单板件
|
||||
*/
|
||||
List<PlateRespVO> getPlate(PlateDetailReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得生产单板件分页
|
||||
|
||||
-27
@@ -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<PlateRespVO> getPlate(PlateDetailReqVO reqVO) {
|
||||
|
||||
// 获取到当前登录用户的信息
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
|
||||
// 查询生产单下的大板,余料板,排单状态的信息
|
||||
PlateDetailRespVO plateDetailRespVO = orderItemMapper.selectPlateNumList(reqVO.getOrderId(),getUserOrganId());
|
||||
|
||||
plateDetailRespVO.setCompanyId(loginUser.getId());
|
||||
|
||||
// 查询生产单下的板材详细信息
|
||||
List<PlateRespVO> 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<PlateDO> getPlatePage(PlatePageReqVO pageReqVO) {
|
||||
|
||||
-56
@@ -221,37 +221,6 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectOrderIds" resultMap="OrderGoodsMap">
|
||||
|
||||
select distinct
|
||||
|
||||
og.goods_id as goodsId,
|
||||
|
||||
og.goods_name,
|
||||
og.color,
|
||||
og.material,
|
||||
og.texture,
|
||||
og.thickness,
|
||||
og.width,
|
||||
og.height,
|
||||
og.brand,
|
||||
og.remark,
|
||||
og.spec
|
||||
|
||||
from orders o
|
||||
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.is_optimized = false and og.id = op.goods_id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectGoodsListByGoodsId" resultMap="OrderGoodsMap">
|
||||
|
||||
|
||||
@@ -467,31 +436,6 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectOrderIds" resultMap="PackMap">
|
||||
|
||||
|
||||
SELECT
|
||||
id as orderNo,
|
||||
custom_order_no as customOrderNo,
|
||||
dealer as dealer,
|
||||
dealer_phone_number as dealerPhoneNumber,
|
||||
order_date as orderDate,
|
||||
create_time as createTime,
|
||||
delivery_date as deliveryDate,
|
||||
customer as customer,
|
||||
phone_number as phoneNumber,
|
||||
address as address,
|
||||
salesman as salesman,
|
||||
splitter as splitter,
|
||||
packaged as packaged
|
||||
FROM orders
|
||||
WHERE organ_id = #{organId} and deleted = false and status in (1,2,3,4) and create_time >= #{createTime} and id != #{orderId}
|
||||
ORDER BY create_time
|
||||
LIMIT 1 ;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderIdsFalse" resultMap="PackMap">
|
||||
|
||||
-122
@@ -113,89 +113,6 @@
|
||||
|
||||
|
||||
|
||||
<resultMap id="PlateListMap" type="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
|
||||
|
||||
<result property="color" column="color"/>
|
||||
<result property="material" column="material"/>
|
||||
<result property="bodyName" column="bodyName"/>
|
||||
<result property="roomName" column="roomName"/>
|
||||
<result property="itemId" column="itemId"/>
|
||||
<result property="processGroupId" column="processGroupId"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<result property="hasTexture" column="hasTexture"/>
|
||||
<result property="bigPlateLength" column="bigPlateLength"/>
|
||||
<result property="bigPlateWidth" column="bigPlateWidth"/>
|
||||
<result property="spec" column="spec"/>
|
||||
|
||||
</resultMap>
|
||||
<select id="selectPlateList"
|
||||
resultMap="PlateListMap"
|
||||
parameterType="map">
|
||||
|
||||
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
|
||||
<where>
|
||||
oi.organ_id = #{organId}
|
||||
<if test="reqVO.orderId != null and reqVO.orderId != ''">
|
||||
AND oi.order_id = #{reqVO.orderId}
|
||||
</if>
|
||||
<if test="reqVO.bodyId != null and reqVO.bodyId != ''">
|
||||
AND oi.body_id = #{reqVO.bodyId}
|
||||
</if>
|
||||
<if test="reqVO.plateId != null and reqVO.plateId != ''">
|
||||
AND oi.plate_id = #{reqVO.plateId}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<resultMap id="PlateNumListMap" type="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO">
|
||||
|
||||
<result property="bigPlateNum" column="bigPlateNum"/>
|
||||
<result property="planStatus" column="planStatus"/>
|
||||
<result property="remainPlateNum" column="remainPlateNum"/>
|
||||
</resultMap>
|
||||
<select id="selectPlateNumList"
|
||||
resultMap="PlateNumListMap"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
select distinct
|
||||
count(distinct og.id) as bigPlateNum,
|
||||
op.status as planStatus,
|
||||
sum(orp.count )as remainPlateNum
|
||||
from order_item oi
|
||||
join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
join order_plan op on opi.plan_id = op.id and opi.organ_id = op.organ_id
|
||||
left join order_remain_plate orp on orp.plan_id = op.id and orp.organ_id = op.organ_id
|
||||
join order_goods og on oi.order_id = og.order_id and oi.organ_id = og.organ_id
|
||||
where oi.organ_id = #{organId} and oi.order_id = #{orderId}
|
||||
group by planStatus;
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<delete id="deleteByPlateId" parameterType="java.lang.Long">
|
||||
|
||||
@@ -372,45 +289,6 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查看板材信息分页-->
|
||||
<resultMap id="PlateMap" type="com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.OrderPlateRespVO">
|
||||
<result property="id" column="palteId"/>
|
||||
<result property="name" column="plateName"/>
|
||||
<result property="color" column="palteColor"/>
|
||||
<result property="width" column="plateWidth"/>
|
||||
<result property="height" column="plateHeight"/>
|
||||
<result property="thickness" column="plateThickness"/>
|
||||
<result property="material" column="plateMaterial"/>
|
||||
</resultMap>
|
||||
<select id="selectPlateList"
|
||||
resultMap="PlateMap"
|
||||
parameterType="com.cf.imes.module.executor.controller.admin.manage.query.vo.productionStatus.PlatePageVO">
|
||||
|
||||
select DISTINCT
|
||||
op.id as palteId,
|
||||
op.name as plateName,
|
||||
p.material as plateMaterial,
|
||||
p.color as palteColor,
|
||||
p.height as plateHeight,
|
||||
p.width as plateWidth,
|
||||
p.thickness as plateThickness
|
||||
from order_item oi
|
||||
join order_plate op on oi.plate_id = op .id
|
||||
join plate p on op.goods_id = p.goods_id
|
||||
|
||||
<where>
|
||||
<if test="bodyId != null">
|
||||
and oi.body_id = #{bodyId}
|
||||
</if>
|
||||
|
||||
<if test="groupId != null">
|
||||
and oi.group_id = #{groupId}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -220,8 +220,8 @@
|
||||
|
||||
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_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}
|
||||
|
||||
-5
@@ -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 调用
|
||||
|
||||
Reference in New Issue
Block a user