mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、新增网关支持固定接口不传token调用,新增ignoreToken配置;2、新增小程序专用单板查询、单板查询订单信息接口;
This commit is contained in:
@@ -26,4 +26,9 @@ public class CfGatewayProperties {
|
|||||||
* 需要忽略打印requestBody和responseBody的请求地址列表
|
* 需要忽略打印requestBody和responseBody的请求地址列表
|
||||||
*/
|
*/
|
||||||
private Set<String> accessLogIgnoreUrls = Collections.emptySet();
|
private Set<String> accessLogIgnoreUrls = Collections.emptySet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要忽略token的请求地址列表
|
||||||
|
*/
|
||||||
|
private Set<String> ignoreTokenUrls = Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|||||||
+50
@@ -1,21 +1,25 @@
|
|||||||
package com.cf.imes.gateway.filter.security;
|
package com.cf.imes.gateway.filter.security;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
|
import com.cf.imes.gateway.config.CfGatewayProperties;
|
||||||
import com.cf.imes.gateway.util.SecurityFrameworkUtils;
|
import com.cf.imes.gateway.util.SecurityFrameworkUtils;
|
||||||
import com.cf.imes.gateway.util.WebFrameworkUtils;
|
import com.cf.imes.gateway.util.WebFrameworkUtils;
|
||||||
import com.cf.imes.module.system.api.oauth2.OAuth2TokenApi;
|
import com.cf.imes.module.system.api.oauth2.OAuth2TokenApi;
|
||||||
import com.cf.imes.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO;
|
import com.cf.imes.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.cloud.client.loadbalancer.reactive.ReactorLoadBalancerExchangeFilterFunction;
|
import org.springframework.cloud.client.loadbalancer.reactive.ReactorLoadBalancerExchangeFilterFunction;
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.AntPathMatcher;
|
||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@@ -45,6 +49,13 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
|
|||||||
private static final TypeReference<CommonResult> TOKEN_RESULT
|
private static final TypeReference<CommonResult> TOKEN_RESULT
|
||||||
= new TypeReference<CommonResult>() {};
|
= new TypeReference<CommonResult>() {};
|
||||||
|
|
||||||
|
private static final TypeReference<CommonResult<String>> IGNORE_TOKEN_SOURCE_RESULT
|
||||||
|
= new TypeReference<>() {
|
||||||
|
};
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CfGatewayProperties cfGatewayProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 空的 LoginUser 的结果
|
* 空的 LoginUser 的结果
|
||||||
*
|
*
|
||||||
@@ -72,6 +83,24 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
|
|||||||
// 情况一,如果没有 Token 令牌,则直接继续 filter
|
// 情况一,如果没有 Token 令牌,则直接继续 filter
|
||||||
String token = SecurityFrameworkUtils.obtainAuthorization(exchange);
|
String token = SecurityFrameworkUtils.obtainAuthorization(exchange);
|
||||||
if (CharSequenceUtil.isEmpty(token)) {
|
if (CharSequenceUtil.isEmpty(token)) {
|
||||||
|
// 是否忽略token的外部请求,如小程序用
|
||||||
|
AntPathMatcher pathMatcher = new AntPathMatcher();
|
||||||
|
String url = exchange.getRequest().getURI().getPath();
|
||||||
|
for (String ignoreUrl : cfGatewayProperties.getIgnoreTokenUrls()) {
|
||||||
|
if (pathMatcher.match(ignoreUrl, url)) {
|
||||||
|
return getIgnoreTokenSource()
|
||||||
|
.defaultIfEmpty("")
|
||||||
|
.flatMap(result -> {
|
||||||
|
String dataCode = buildSource(result);
|
||||||
|
LoginUser user = new LoginUser().setDataCode(dataCode);
|
||||||
|
ServerWebExchange newExchange = exchange.mutate()
|
||||||
|
.request(builder -> SecurityFrameworkUtils.setLoginUserHeader1(builder, user))
|
||||||
|
.build();
|
||||||
|
return chain.filter(newExchange);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return chain.filter(exchange);
|
return chain.filter(exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +140,12 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
|
|||||||
.retrieve().bodyToMono(String.class);
|
.retrieve().bodyToMono(String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Mono<String> getIgnoreTokenSource() {
|
||||||
|
return webClient.get()
|
||||||
|
.uri(OAuth2TokenApi.IGNORE_TOKEN_SOURCE_GET)
|
||||||
|
.retrieve().bodyToMono(String.class);
|
||||||
|
}
|
||||||
|
|
||||||
private LoginUser buildUser(String body) {
|
private LoginUser buildUser(String body) {
|
||||||
|
|
||||||
CommonResult commonResult = JsonUtils.parseObject(body, TOKEN_RESULT);
|
CommonResult commonResult = JsonUtils.parseObject(body, TOKEN_RESULT);
|
||||||
@@ -155,6 +190,21 @@ public class TokenAuthenticationFilter implements GlobalFilter, Ordered {
|
|||||||
.setProductId(tokenInfo.getProductId());
|
.setProductId(tokenInfo.getProductId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建忽略令牌的数据源请求结果
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String buildSource(String body) {
|
||||||
|
CommonResult<String> commonResult = JsonUtils.parseObject(body, IGNORE_TOKEN_SOURCE_RESULT);
|
||||||
|
if (ObjectUtil.isNotNull(commonResult)) {
|
||||||
|
return commonResult.getData();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return -100; // 和 Spring Security Filter 的顺序对齐
|
return -100; // 和 Spring Security Filter 的顺序对齐
|
||||||
|
|||||||
@@ -124,4 +124,23 @@ public class SecurityFrameworkUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略令牌将 data-code 并设置到 请求头
|
||||||
|
*
|
||||||
|
* @param builder 请求
|
||||||
|
* @param user 用户
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public static void setLoginUserHeader1(ServerHttpRequest.Builder builder, LoginUser user) {
|
||||||
|
try {
|
||||||
|
String userStr = JsonUtils.toJsonString(user);
|
||||||
|
userStr = URLEncoder.encode(userStr, StandardCharsets.UTF_8.name()); // 编码,避免中文乱码
|
||||||
|
builder.header(LOGIN_USER_HEADER, userStr);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("[setLoginUserHeader][序列化 user({}) 发生异常]", user, ex);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
builder.header(DATA_CODE, user.getDataCode());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ logging:
|
|||||||
|
|
||||||
chenfeng:
|
chenfeng:
|
||||||
gateway:
|
gateway:
|
||||||
|
ignore-token-urls:
|
||||||
|
- /admin-api/executor/plate/wechat/miniprogram/cadview/info/*
|
||||||
|
- /admin-api/executor/plate/wechat/miniprogram/cadview/order/info/*
|
||||||
accessLogEnable: false
|
accessLogEnable: false
|
||||||
access-log-ignore-urls:
|
access-log-ignore-urls:
|
||||||
- /report/template
|
- /report/template
|
||||||
|
|||||||
+14
@@ -160,4 +160,18 @@ public class PlateController {
|
|||||||
public CommonResult<OrdersViewCadViewInfoRespVO> getBodyViewPartCadInfo(@Validated @RequestBody OrderCadViewPlatePageReqVO orderCadViewPlatePageReqVO) {
|
public CommonResult<OrdersViewCadViewInfoRespVO> getBodyViewPartCadInfo(@Validated @RequestBody OrderCadViewPlatePageReqVO orderCadViewPlatePageReqVO) {
|
||||||
return success(plateService.getBodyViewPartCadInfo(orderCadViewPlatePageReqVO));
|
return success(plateService.getBodyViewPartCadInfo(orderCadViewPlatePageReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/wechat/miniprogram/cadview/info/{plateNo:[A-Fa-f0-9]{6}[A-Za-z0-9]{11}}")
|
||||||
|
@Operation(summary = "微信小程序根据板编号获取单板视图信息")
|
||||||
|
@Parameter(name = "plateNo", description = "板编号", required = true)
|
||||||
|
public CommonResult<OrderPlateWechatMiniProgramCadInfoRespVO> getPlateInfoByPlateNo(@PathVariable String plateNo) {
|
||||||
|
return success(plateService.getPlateInfoByPlateNo(plateNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/wechat/miniprogram/cadview/order/info/{plateNo:[A-Fa-f0-9]{6}[A-Za-z0-9]{11}}")
|
||||||
|
@Operation(summary = "微信小程序根据板编号获取单板所属订单信息")
|
||||||
|
@Parameter(name = "plateNo", description = "板编号", required = true)
|
||||||
|
public CommonResult<OrderWechatMiniProgramCadInfoRespVO> getOrderInfoByPlateNo(@PathVariable String plateNo) {
|
||||||
|
return success(plateService.getOrderInfoByPlateNo(plateNo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/4/3 17:41
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@Schema(description = "管理后台 - 微信小程序 - 查看单板视图信息 Resp VO")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class OrderPlateWechatMiniProgramCadInfoRespVO {
|
||||||
|
@Schema(description = "房间名称")
|
||||||
|
private String roomName;
|
||||||
|
|
||||||
|
@Schema(description = "柜体名称")
|
||||||
|
private String bodyName;
|
||||||
|
|
||||||
|
@Schema(description = "板编号")
|
||||||
|
private String plateNo;
|
||||||
|
|
||||||
|
@Schema(description = "板名称")
|
||||||
|
private String plateName;
|
||||||
|
|
||||||
|
@Schema(description = "自定义板编号")
|
||||||
|
private String customPlateNo;
|
||||||
|
|
||||||
|
@Schema(description = "宽度")
|
||||||
|
private BigDecimal width;
|
||||||
|
|
||||||
|
@Schema(description = "高度")
|
||||||
|
private BigDecimal height;
|
||||||
|
|
||||||
|
@Schema(description = "厚度")
|
||||||
|
private BigDecimal thickness;
|
||||||
|
|
||||||
|
@Schema(description = "左封边厚度")
|
||||||
|
private BigDecimal sealLeft;
|
||||||
|
|
||||||
|
@Schema(description = "右封边厚度")
|
||||||
|
private BigDecimal sealRight;
|
||||||
|
|
||||||
|
@Schema(description = "上封边厚度")
|
||||||
|
private BigDecimal sealUp;
|
||||||
|
|
||||||
|
@Schema(description = "下封边厚度")
|
||||||
|
private BigDecimal sealDown;
|
||||||
|
|
||||||
|
@Schema(description = "材质")
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "CAD视图ID")
|
||||||
|
private Integer cadViewId;
|
||||||
|
|
||||||
|
@Schema(description = "CAD视图文件ID")
|
||||||
|
private Long cadViewFileId;
|
||||||
|
}
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
||||||
|
|
||||||
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/4/7 14:54
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(description = "管理后台 - 微信小程序 - 查看单板所属订单信息 Resp VO")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class OrderWechatMiniProgramCadInfoRespVO {
|
||||||
|
@Schema(description = "订单信息")
|
||||||
|
private OrderRespVO order;
|
||||||
|
|
||||||
|
@Schema(description = "订单柜体列表")
|
||||||
|
private List<OrderBodyRespVO> orderBodyList;
|
||||||
|
|
||||||
|
@Schema(description = "订单部件列表")
|
||||||
|
private List<OrderComponentRespVO> orderComponentList;
|
||||||
|
}
|
||||||
+8
@@ -49,6 +49,14 @@ public interface OrderService {
|
|||||||
*/
|
*/
|
||||||
OrderDO getOrder(Long id);
|
OrderDO getOrder(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得订单表 order_{N}
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 订单表 order_{N}
|
||||||
|
*/
|
||||||
|
OrderDO getOrder(Long id, Long... organIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得订单表 order_{N}分页
|
* 获得订单表 order_{N}分页
|
||||||
*
|
*
|
||||||
|
|||||||
+13
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.service.order;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -252,6 +253,18 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
return orderMapper.selectOrderOne(id, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
|
return orderMapper.selectOrderOne(id, getUserOrganId(), OrderDeletedEnum.NOT_DELETED.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderDO getOrder(Long id, Long... organIds) {
|
||||||
|
Long userOrganId = SecurityFrameworkUtils.getUserOrganId();
|
||||||
|
if (ObjectUtil.isNull(userOrganId) && ArrayUtil.isNotEmpty(organIds)) {
|
||||||
|
userOrganId = organIds[0];
|
||||||
|
}
|
||||||
|
return orderMapper.selectOne(new LambdaQueryWrapper<OrderDO>()
|
||||||
|
.eq(OrderDO::getId, id)
|
||||||
|
.eq(OrderDO::getOrganId, userOrganId)
|
||||||
|
.eq(OrderDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<OrderDO> getOrderPage(OrderPageReqVO pageReqVO) {
|
public PageResult<OrderDO> getOrderPage(OrderPageReqVO pageReqVO) {
|
||||||
PageResult<OrderDO> pageResult = orderMapper.selectPage(pageReqVO.setOrganId(getUserOrganId()));
|
PageResult<OrderDO> pageResult = orderMapper.selectPage(pageReqVO.setOrganId(getUserOrganId()));
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cf.imes.module.executor.service.orderbody;
|
||||||
|
|
||||||
|
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单柜体 order_body_{N} Service 接口
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/4/7 15:27
|
||||||
|
*/
|
||||||
|
public interface OrderBodyService {
|
||||||
|
/**
|
||||||
|
* 根据订单ID获取订单柜体列表
|
||||||
|
*
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @return 订单柜体列表
|
||||||
|
*/
|
||||||
|
List<OrderBodyRespVO> getOrderBodyList(Long orderId, Long... organIds);
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
package com.cf.imes.module.executor.service.orderbody;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||||
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单柜体接口实现类 Service Impl
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/4/7 15:28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderBodyServiceImpl implements OrderBodyService {
|
||||||
|
@Resource
|
||||||
|
private OrderBodyMapper orderBodyMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderBodyRespVO> getOrderBodyList(Long orderId, Long... organIds) {
|
||||||
|
Long userOrganId = SecurityFrameworkUtils.getUserOrganId();
|
||||||
|
if (ObjectUtil.isNull(userOrganId) && ArrayUtil.isNotEmpty(organIds)) {
|
||||||
|
userOrganId = organIds[0];
|
||||||
|
}
|
||||||
|
List<OrderBodyDO> orderBodyDOS = orderBodyMapper.selectList(new LambdaQueryWrapper<OrderBodyDO>()
|
||||||
|
.eq(OrderBodyDO::getOrderId, orderId)
|
||||||
|
.eq(OrderBodyDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus())
|
||||||
|
.eq(OrderBodyDO::getOrganId, userOrganId)
|
||||||
|
);
|
||||||
|
return BeanUtil.copyToList(orderBodyDOS, OrderBodyRespVO.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -78,7 +78,7 @@ public interface OrderComponentService {
|
|||||||
* @param orderIds
|
* @param orderIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderComponentRespVO> getOrderComponentListOnOrders(List<Long> orderIds);
|
List<OrderComponentRespVO> getOrderComponentListOnOrders(List<Long> orderIds, Long... organId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部件下所有子部件
|
* 查询部件下所有子部件
|
||||||
|
|||||||
+7
-2
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.service.ordercomponent;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@@ -655,11 +656,15 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderComponentRespVO> getOrderComponentListOnOrders(List<Long> orderIds) {
|
public List<OrderComponentRespVO> getOrderComponentListOnOrders(List<Long> orderIds, Long... organIds) {
|
||||||
|
Long userOrganId = SecurityFrameworkUtils.getUserOrganId();
|
||||||
|
if (ObjectUtil.isNull(userOrganId) && ArrayUtil.isNotEmpty(organIds)) {
|
||||||
|
userOrganId = organIds[0];
|
||||||
|
}
|
||||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapper<OrderComponentDO>()
|
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapper<OrderComponentDO>()
|
||||||
.in(OrderComponentDO::getOrderId, orderIds)
|
.in(OrderComponentDO::getOrderId, orderIds)
|
||||||
.eq(OrderComponentDO::getDeleted, false)
|
.eq(OrderComponentDO::getDeleted, false)
|
||||||
.eq(OrderComponentDO::getOrganId, SecurityFrameworkUtils.getUserOrganId())
|
.eq(OrderComponentDO::getOrganId, userOrganId)
|
||||||
.select(OrderComponentDO::getId, OrderComponentDO::getName, OrderComponentDO::getPid));
|
.select(OrderComponentDO::getId, OrderComponentDO::getName, OrderComponentDO::getPid));
|
||||||
return BeanUtil.copyToList(orderComponentDOS, OrderComponentRespVO.class);
|
return BeanUtil.copyToList(orderComponentDOS, OrderComponentRespVO.class);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
@@ -137,4 +137,20 @@ public interface PlateService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
OrdersViewCadViewInfoRespVO getBodyViewPartCadInfo(OrderCadViewPlatePageReqVO orderBodyPageRespVO);
|
OrdersViewCadViewInfoRespVO getBodyViewPartCadInfo(OrderCadViewPlatePageReqVO orderBodyPageRespVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据板编号获取板件信息
|
||||||
|
*
|
||||||
|
* @param plateNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OrderPlateWechatMiniProgramCadInfoRespVO getPlateInfoByPlateNo(String plateNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据板编号获取订单信息
|
||||||
|
*
|
||||||
|
* @param plateNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OrderWechatMiniProgramCadInfoRespVO getOrderInfoByPlateNo(String plateNo);
|
||||||
}
|
}
|
||||||
+114
@@ -25,6 +25,7 @@ import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
|||||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCadViewPlatePageReqVO;
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCadViewPlatePageReqVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO;
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrdersViewCadViewInfoRespVO;
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrdersViewCadViewInfoRespVO;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
|
||||||
@@ -49,6 +50,10 @@ 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.OrderItemType;
|
||||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||||
|
import com.cf.imes.module.executor.service.order.OrderService;
|
||||||
|
import com.cf.imes.module.executor.service.orderbody.OrderBodyService;
|
||||||
|
import com.cf.imes.module.executor.service.ordercomponent.OrderComponentService;
|
||||||
|
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -111,6 +116,18 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
@Resource
|
@Resource
|
||||||
private IdentifierGenerator identifierGenerator;
|
private IdentifierGenerator identifierGenerator;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrganApi organApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderService orderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderBodyService orderBodyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderComponentService orderComponentService;
|
||||||
|
|
||||||
private static final String FIELD_PLATE_ID = "plateId";
|
private static final String FIELD_PLATE_ID = "plateId";
|
||||||
private static final String FIELD_OG_MATERIAL = "og.material";
|
private static final String FIELD_OG_MATERIAL = "og.material";
|
||||||
private static final String FIELD_OG_BRAND = "og.brand";
|
private static final String FIELD_OG_BRAND = "og.brand";
|
||||||
@@ -958,4 +975,101 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
ordersViewCadViewInfoRespVO.setParts(BeanUtil.copyToList(partRecords, OrderViewPartPageRespVO.class));
|
ordersViewCadViewInfoRespVO.setParts(BeanUtil.copyToList(partRecords, OrderViewPartPageRespVO.class));
|
||||||
return ordersViewCadViewInfoRespVO;
|
return ordersViewCadViewInfoRespVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderPlateWechatMiniProgramCadInfoRespVO getPlateInfoByPlateNo(String plateNo) {
|
||||||
|
// 1、解析组织id,查询板件信息
|
||||||
|
Integer organId = Integer.parseInt(plateNo.substring(0, 6), 16);
|
||||||
|
organApi.validOrgan(organId.longValue()).checkError();
|
||||||
|
|
||||||
|
PlateDO plateDO = plateMapper.selectOne(new LambdaQueryWrapper<PlateDO>()
|
||||||
|
.eq(PlateDO::getOrganId, organId)
|
||||||
|
.eq(PlateDO::getPlateNo, plateNo.substring(6)));
|
||||||
|
|
||||||
|
if (ObjectUtil.isNull(plateDO)) {
|
||||||
|
throw new ServiceException(PLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
Long orderId = plateDO.getOrderId();
|
||||||
|
|
||||||
|
// 2、根据板id查询明细
|
||||||
|
List<OrderItemDO> plateItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>()
|
||||||
|
.eq(OrderItemDO::getPlateId, plateDO.getId())
|
||||||
|
.eq(OrderItemDO::getOrganId, organId)
|
||||||
|
.eq(OrderItemDO::getOrderId, orderId)
|
||||||
|
);
|
||||||
|
if (CollUtil.isEmpty(plateItemDOS)) {
|
||||||
|
throw new ServiceException(PLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3、查询柜体获取图纸id
|
||||||
|
OrderItemDO plateItemDO = plateItemDOS.get(0);
|
||||||
|
// 板件cad id
|
||||||
|
Integer cadViewId = plateItemDO.getCadViewId();
|
||||||
|
OrderBodyDO orderBodyDO = orderBodyMapper.selectOne(new LambdaQueryWrapper<OrderBodyDO>()
|
||||||
|
.eq(OrderBodyDO::getOrderId, orderId)
|
||||||
|
.eq(OrderBodyDO::getId, plateItemDO.getBodyId())
|
||||||
|
.eq(OrderBodyDO::getOrganId, organId)
|
||||||
|
);
|
||||||
|
// 图纸id
|
||||||
|
Long cadViewFileId = orderBodyDO.getCadViewFileId();
|
||||||
|
|
||||||
|
// 4、查询材料内容
|
||||||
|
GoodsDO goodsDO = goodsMapper.selectOne(new LambdaQueryWrapper<GoodsDO>()
|
||||||
|
.eq(GoodsDO::getOrderId, orderId)
|
||||||
|
.eq(GoodsDO::getId, plateDO.getGoodsId())
|
||||||
|
.eq(GoodsDO::getOrganId, organId)
|
||||||
|
);
|
||||||
|
|
||||||
|
return OrderPlateWechatMiniProgramCadInfoRespVO
|
||||||
|
.builder()
|
||||||
|
.roomName(orderBodyDO.getRoomName())
|
||||||
|
.bodyName(orderBodyDO.getName())
|
||||||
|
.plateNo(plateDO.getPlateNo())
|
||||||
|
.plateName(plateDO.getName())
|
||||||
|
.width(plateDO.getWidth())
|
||||||
|
.height(plateDO.getHeight())
|
||||||
|
.thickness(plateDO.getThickness())
|
||||||
|
.sealLeft(plateDO.getSealLeft())
|
||||||
|
.sealRight(plateDO.getSealRight())
|
||||||
|
.sealUp(plateDO.getSealUp())
|
||||||
|
.sealDown(plateDO.getSealDown())
|
||||||
|
.material(goodsDO.getMaterial())
|
||||||
|
.color(goodsDO.getColor())
|
||||||
|
.remark(plateDO.getRemark())
|
||||||
|
.cadViewFileId(cadViewFileId)
|
||||||
|
.cadViewId(cadViewId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderWechatMiniProgramCadInfoRespVO getOrderInfoByPlateNo(String plateNo) {
|
||||||
|
OrderWechatMiniProgramCadInfoRespVO result = new OrderWechatMiniProgramCadInfoRespVO();
|
||||||
|
// 1、解析组织id,查询板件信息
|
||||||
|
Integer organId = Integer.parseInt(plateNo.substring(0, 6), 16);
|
||||||
|
Long organIdLong = organId.longValue();
|
||||||
|
organApi.validOrgan(organId.longValue()).checkError();
|
||||||
|
|
||||||
|
PlateDO plateDO = plateMapper.selectOne(new LambdaQueryWrapper<PlateDO>()
|
||||||
|
.eq(PlateDO::getOrganId, organIdLong)
|
||||||
|
.eq(PlateDO::getPlateNo, plateNo.substring(6)));
|
||||||
|
|
||||||
|
if (ObjectUtil.isNull(plateDO)) {
|
||||||
|
throw new ServiceException(PLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
Long orderId = plateDO.getOrderId();
|
||||||
|
|
||||||
|
// 2、查询订单信息
|
||||||
|
OrderDO order = orderService.getOrder(orderId, organIdLong);
|
||||||
|
if (ObjectUtil.isNull(order)) {
|
||||||
|
throw new ServiceException(ORDER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
result.setOrder(BeanUtil.copyProperties(order, OrderRespVO.class));
|
||||||
|
|
||||||
|
// 3、查询柜体信息
|
||||||
|
result.setOrderBodyList(orderBodyService.getOrderBodyList(orderId, organIdLong));
|
||||||
|
|
||||||
|
// 4、查询部件信息
|
||||||
|
result.setOrderComponentList(orderComponentService.getOrderComponentListOnOrders(List.of(orderId), organIdLong));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+2
@@ -186,6 +186,8 @@ chenfeng:
|
|||||||
superadmin-prod-org-ignore-enable: false
|
superadmin-prod-org-ignore-enable: false
|
||||||
ignore-urls:
|
ignore-urls:
|
||||||
- /rpc-api/**
|
- /rpc-api/**
|
||||||
|
- /admin-api/executor/plate/wechat/miniprogram/cadview/info/*
|
||||||
|
- /admin-api/executor/plate/wechat/miniprogram/cadview/order/info/*
|
||||||
ignore-tables:
|
ignore-tables:
|
||||||
|
|
||||||
env: # 多环境的配置项
|
env: # 多环境的配置项
|
||||||
|
|||||||
+7
@@ -26,6 +26,9 @@ public interface OAuth2TokenApi {
|
|||||||
@SuppressWarnings("HttpUrlsUsage")
|
@SuppressWarnings("HttpUrlsUsage")
|
||||||
String URL_CHECK = "http://" + ApiConstants.NAME + PREFIX + "/check";
|
String URL_CHECK = "http://" + ApiConstants.NAME + PREFIX + "/check";
|
||||||
|
|
||||||
|
@SuppressWarnings("HttpUrlsUsage")
|
||||||
|
String IGNORE_TOKEN_SOURCE_GET = "http://" + ApiConstants.NAME + PREFIX + "/ignore/token/source";
|
||||||
|
|
||||||
String URL_ORGAN = "http://" + ApiConstants.NAME + PREFIX + "/getOrganIdByToken";
|
String URL_ORGAN = "http://" + ApiConstants.NAME + PREFIX + "/getOrganIdByToken";
|
||||||
|
|
||||||
@PostMapping(PREFIX + "/create")
|
@PostMapping(PREFIX + "/create")
|
||||||
@@ -57,4 +60,8 @@ public interface OAuth2TokenApi {
|
|||||||
@Parameter(name = "accessToken", description = "访问令牌", required = true, example = "tudou")
|
@Parameter(name = "accessToken", description = "访问令牌", required = true, example = "tudou")
|
||||||
CommonResult<Long> getOrganIdByToken(@RequestParam("accessToken") String accessToken);
|
CommonResult<Long> getOrganIdByToken(@RequestParam("accessToken") String accessToken);
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/ignore/token/source")
|
||||||
|
@Operation(summary = "请求忽略令牌数据源")
|
||||||
|
CommonResult<String> getIgnoreTokenSource();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -64,4 +64,8 @@ public class OAuth2TokenApiImpl implements OAuth2TokenApi {
|
|||||||
return success(accessTokenDO.getOrganId());
|
return success(accessTokenDO.getOrganId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<String> getIgnoreTokenSource() {
|
||||||
|
return success(oauth2TokenService.getIgnoreTokenSource());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -72,6 +72,13 @@ public interface OAuth2TokenService {
|
|||||||
*/
|
*/
|
||||||
OAuth2AccessTokenDO checkAccessToken(String accessToken);
|
OAuth2AccessTokenDO checkAccessToken(String accessToken);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取忽略令牌的数据源
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getIgnoreTokenSource();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除访问令牌
|
* 移除访问令牌
|
||||||
* 注意:该流程中,会移除相关的刷新令牌
|
* 注意:该流程中,会移除相关的刷新令牌
|
||||||
|
|||||||
+5
@@ -176,6 +176,11 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
|||||||
return accessTokenDO;
|
return accessTokenDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIgnoreTokenSource() {
|
||||||
|
return useDataCode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAuth2AccessTokenDO removeAccessToken(String accessToken) {
|
public OAuth2AccessTokenDO removeAccessToken(String accessToken) {
|
||||||
// 删除访问令牌
|
// 删除访问令牌
|
||||||
|
|||||||
Reference in New Issue
Block a user