1. 修复 base 编译错误
2. build 追加 skywalking 集成
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
ARG BASE_IMAGE=172.16.46.66:10043/base-service/skywalking-agent-jre:9.7.0
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# 设置应用目录
|
||||
RUN mkdir -p /app
|
||||
WORKDIR /app
|
||||
|
||||
# 复制应用文件
|
||||
COPY target/base-server.jar /app/base-server.jar
|
||||
COPY target/base-server.jar app.jar
|
||||
|
||||
# 设置环境变量
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV JAVA_OPTS="-Xms512m -Xmx512m"
|
||||
ENV SW_AGENT_HOME=/opt/skywalking/agent
|
||||
ENV SW_AGENT_NAME=base-server
|
||||
ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES=172.16.46.63:30201
|
||||
ENV AGENT_JAVA_OPTS="-javaagent:${SW_AGENT_HOME}/skywalking-agent.jar -Dskywalking.agent.service_name=${SW_AGENT_NAME} -Dskywalking.collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES}"
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 48200
|
||||
|
||||
# 运行应用
|
||||
ENTRYPOINT ["java", "-jar", "/app/base-server.jar"]
|
||||
CMD java ${AGENT_JAVA_OPTS} ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 物料信息精简分页 Request VO
|
||||
*/
|
||||
@Schema(description = "管理后台 - 物料信息精简分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MaterialInfomationSimplePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "关键字(编码/名称模糊匹配)")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "分类 ID")
|
||||
private Long classesId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 精简的物料信息 Response VO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationSimpleRespVO {
|
||||
|
||||
@Schema(description = "物料信息ID", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类ID")
|
||||
private Long classesId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -91,6 +91,13 @@ public class QuantityUnitRelationController implements BusinessControllerMarker
|
||||
return success(BeanUtils.toBean(pageResult, QuantityUnitRelationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/simple-page")
|
||||
@Operation(summary = "获得计量单位量与单位关联精简分页")
|
||||
@PreAuthorize("@ss.hasPermission('unitmanagement:quantity-unit-relation:query')")
|
||||
public CommonResult<PageResult<QuantityUnitRelationSimpleRespVO>> getQuantityUnitRelationSimplePage(@Valid QuantityUnitRelationSimplePageReqVO pageReqVO) {
|
||||
return success(quantityUnitRelationService.getQuantityUnitRelationSimplePage(pageReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出计量单位量与单位关联 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('unitmanagement:quantity-unit-relation:export')")
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 计量单位量与单位关联精简分页 Request VO
|
||||
*/
|
||||
@Schema(description = "管理后台 - 计量单位量与单位关联精简分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class QuantityUnitRelationSimplePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "量纲ID")
|
||||
private Long untQtyId;
|
||||
|
||||
@Schema(description = "关键字(量纲/单位名称、符号模糊匹配)")
|
||||
private String keyword;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 精简的量纲-单位关联响应
|
||||
*/
|
||||
@Data
|
||||
public class QuantityUnitRelationSimpleRespVO {
|
||||
|
||||
@Schema(description = "关联关系ID", example = "1001")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "量纲ID", example = "2001")
|
||||
private Long untQtyId;
|
||||
|
||||
@Schema(description = "量纲名称")
|
||||
private String untQtyName;
|
||||
|
||||
@Schema(description = "计量单位ID", example = "3001")
|
||||
private Long untId;
|
||||
|
||||
@Schema(description = "计量单位名称")
|
||||
private String untName;
|
||||
|
||||
@Schema(description = "计量单位符号")
|
||||
private String untSymbol;
|
||||
|
||||
@Schema(description = "是否基准单位:1表示是,0表示否")
|
||||
private Integer isBse;
|
||||
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.zt.plat.module.base.dal.dao.quantityUnitRelation;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo.QuantityUnitRelationPageReqVO;
|
||||
import com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo.QuantityUnitRelationSimplePageReqVO;
|
||||
import com.zt.plat.module.base.dal.dataobject.quantityUnitRelation.QuantityUnitRelationDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 计量单位量与单位关联 Mapper
|
||||
@@ -24,6 +25,10 @@ public interface QuantityUnitRelationMapper extends BaseMapperX<QuantityUnitRela
|
||||
.orderByDesc(QuantityUnitRelationDO::getUntQtyId));
|
||||
}
|
||||
|
||||
default PageResult<QuantityUnitRelationDO> selectSimplePage(QuantityUnitRelationSimplePageReqVO reqVO, LambdaQueryWrapperX<QuantityUnitRelationDO> wrapper) {
|
||||
return BaseMapperX.super.selectPage(reqVO, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据量纲ID查询所有关联关系
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import jakarta.validation.*;
|
||||
import com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo.*;
|
||||
import com.zt.plat.module.base.dal.dataobject.quantityUnitRelation.QuantityUnitRelationDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo.QuantityUnitRelationSimplePageReqVO;
|
||||
|
||||
/**
|
||||
* 计量单位量与单位关联 Service 接口
|
||||
@@ -85,4 +86,12 @@ public interface QuantityUnitRelationService {
|
||||
*/
|
||||
void deleteUnitWithRelation(@Valid DeleteUnitWithRelationReqVO deleteReqVO);
|
||||
|
||||
/**
|
||||
* 查询精简的量纲-单位关联分页,用于下拉框
|
||||
*
|
||||
* @param pageReqVO 分页查询条件
|
||||
* @return 关联关系列表
|
||||
*/
|
||||
PageResult<QuantityUnitRelationSimpleRespVO> getQuantityUnitRelationSimplePage(QuantityUnitRelationSimplePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zt.plat.module.base.service.quantityUnitRelation;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -11,11 +12,19 @@ import com.zt.plat.module.base.controller.admin.quantityUnitRelation.vo.*;
|
||||
import com.zt.plat.module.base.dal.dataobject.quantityUnitRelation.QuantityUnitRelationDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
|
||||
import com.zt.plat.module.base.dal.dao.quantityUnitRelation.QuantityUnitRelationMapper;
|
||||
import com.zt.plat.module.base.dal.dao.unitQuantity.UnitQuantityMapper;
|
||||
import com.zt.plat.module.base.dal.dao.untInfo.UntInfoMapper;
|
||||
import com.zt.plat.module.base.service.untInfo.UntInfoService;
|
||||
import com.zt.plat.module.base.controller.admin.untInfo.vo.UntInfoSaveReqVO;
|
||||
import com.zt.plat.module.base.controller.admin.untInfo.vo.UntInfoRespVO;
|
||||
import com.zt.plat.module.base.dal.dataobject.unitQuantity.UnitQuantityDO;
|
||||
import com.zt.plat.module.base.dal.dataobject.untInfo.UntInfoDO;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||
@@ -36,6 +45,12 @@ public class QuantityUnitRelationServiceImpl implements QuantityUnitRelationServ
|
||||
@Resource
|
||||
private UntInfoService untInfoService;
|
||||
|
||||
@Resource
|
||||
private UnitQuantityMapper unitQuantityMapper;
|
||||
|
||||
@Resource
|
||||
private UntInfoMapper untInfoMapper;
|
||||
|
||||
@Override
|
||||
public QuantityUnitRelationRespVO createQuantityUnitRelation(QuantityUnitRelationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@@ -170,4 +185,90 @@ public class QuantityUnitRelationServiceImpl implements QuantityUnitRelationServ
|
||||
untInfoService.deleteUntInfo(deleteReqVO.getUntId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<QuantityUnitRelationSimpleRespVO> getQuantityUnitRelationSimplePage(QuantityUnitRelationSimplePageReqVO pageReqVO) {
|
||||
LambdaQueryWrapperX<QuantityUnitRelationDO> wrapper = new LambdaQueryWrapperX<>();
|
||||
wrapper.eqIfPresent(QuantityUnitRelationDO::getUntQtyId, pageReqVO.getUntQtyId());
|
||||
|
||||
if (StrUtil.isNotBlank(pageReqVO.getKeyword())) {
|
||||
String keyword = pageReqVO.getKeyword();
|
||||
List<Long> matchedQtyIds = unitQuantityMapper.selectList(new LambdaQueryWrapperX<UnitQuantityDO>()
|
||||
.like(UnitQuantityDO::getName, keyword))
|
||||
.stream()
|
||||
.map(UnitQuantityDO::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
List<Long> matchedUntIds = untInfoMapper.selectList(new LambdaQueryWrapperX<UntInfoDO>()
|
||||
.like(UntInfoDO::getName, keyword)
|
||||
.or()
|
||||
.like(UntInfoDO::getSmb, keyword))
|
||||
.stream()
|
||||
.map(UntInfoDO::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isEmpty(matchedQtyIds) && CollUtil.isEmpty(matchedUntIds)) {
|
||||
return new PageResult<>(Collections.emptyList(), 0L);
|
||||
}
|
||||
|
||||
wrapper.and(w -> {
|
||||
boolean hasCondition = false;
|
||||
if (CollUtil.isNotEmpty(matchedQtyIds)) {
|
||||
w.in(QuantityUnitRelationDO::getUntQtyId, matchedQtyIds);
|
||||
hasCondition = true;
|
||||
}
|
||||
if (CollUtil.isNotEmpty(matchedUntIds)) {
|
||||
if (hasCondition) {
|
||||
w.or();
|
||||
}
|
||||
w.in(QuantityUnitRelationDO::getUntId, matchedUntIds);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
wrapper.orderByAsc(QuantityUnitRelationDO::getUntQtyId).orderByAsc(QuantityUnitRelationDO::getId);
|
||||
|
||||
PageResult<QuantityUnitRelationDO> pageResult = quantityUnitRelationMapper.selectSimplePage(pageReqVO, wrapper);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return new PageResult<>(Collections.emptyList(), pageResult.getTotal());
|
||||
}
|
||||
|
||||
Set<Long> qtyIds = pageResult.getList().stream()
|
||||
.map(QuantityUnitRelationDO::getUntQtyId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
Set<Long> unitIds = pageResult.getList().stream()
|
||||
.map(QuantityUnitRelationDO::getUntId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<Long, UnitQuantityDO> qtyMap = qtyIds.isEmpty() ? Collections.emptyMap()
|
||||
: unitQuantityMapper.selectBatchIds(qtyIds).stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(UnitQuantityDO::getId, Function.identity()));
|
||||
Map<Long, UntInfoDO> unitMap = unitIds.isEmpty() ? Collections.emptyMap()
|
||||
: untInfoMapper.selectBatchIds(unitIds).stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(UntInfoDO::getId, Function.identity()));
|
||||
|
||||
List<QuantityUnitRelationSimpleRespVO> respList = pageResult.getList().stream().map(item -> {
|
||||
QuantityUnitRelationSimpleRespVO vo = new QuantityUnitRelationSimpleRespVO();
|
||||
vo.setId(item.getId());
|
||||
vo.setUntQtyId(item.getUntQtyId());
|
||||
UnitQuantityDO quantityDO = qtyMap.get(item.getUntQtyId());
|
||||
if (quantityDO != null) {
|
||||
vo.setUntQtyName(quantityDO.getName());
|
||||
}
|
||||
vo.setUntId(item.getUntId());
|
||||
UntInfoDO untInfoDO = unitMap.get(item.getUntId());
|
||||
if (untInfoDO != null) {
|
||||
vo.setUntName(untInfoDO.getName());
|
||||
vo.setUntSymbol(untInfoDO.getSmb());
|
||||
}
|
||||
vo.setIsBse(item.getIsBse());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return new PageResult<>(respList, pageResult.getTotal());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user