Merge branch 'feature/product' into develop

This commit is contained in:
曹鹏飞 2025-07-14 10:51:45 +08:00
commit fbbf872517
5 changed files with 67 additions and 2 deletions

View File

@ -40,10 +40,60 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<excludeGroupIds>${project.groupId}</excludeGroupIds>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.nflg.mobilebroken.push.PushApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>${project.groupId}:*</include>
</includes>
</artifactSet>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl; package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -173,12 +174,15 @@ public class ProductModelParamsServiceImpl extends ServiceImpl<ProductModelParam
maps.forEach((indexName, data) -> { maps.forEach((indexName, data) -> {
vos.add(new ProductModelMainParamsItemChildrenVO() vos.add(new ProductModelMainParamsItemChildrenVO()
.setIndexName(indexName) .setIndexName(indexName)
.setBatchNumber(CollectionUtil.isNotEmpty(data) ? data.get(0).getBatchNumber() : "")
.setItems(data .setItems(data
.stream() .stream()
.map(it -> Convert.convert(ProductParamsItemVO.class, it)) .map(it -> Convert.convert(ProductParamsItemVO.class, it))
.sorted(Comparator.comparing(ProductParamsItemVO::getBatchNumber))
.collect(Collectors.toList())) .collect(Collectors.toList()))
); );
}); });
vos.sort(Comparator.comparing(ProductModelMainParamsItemChildrenVO::getBatchNumber));
return vos; return vos;
} }
@ -205,12 +209,15 @@ public class ProductModelParamsServiceImpl extends ServiceImpl<ProductModelParam
maps.forEach((indexName, data) -> { maps.forEach((indexName, data) -> {
vos.add(new ProductModelMainParamsItemChildrenVO() vos.add(new ProductModelMainParamsItemChildrenVO()
.setIndexName(indexName) .setIndexName(indexName)
.setBatchNumber(CollectionUtil.isNotEmpty(data) ? data.get(0).getBatchNumber() : "")
.setItems(data .setItems(data
.stream() .stream()
.map(it -> Convert.convert(ProductParamsItemVO.class, it)) .map(it -> Convert.convert(ProductParamsItemVO.class, it))
.sorted(Comparator.comparing(ProductParamsItemVO::getBatchNumber))
.collect(Collectors.toList())) .collect(Collectors.toList()))
); );
}); });
vos.sort(Comparator.comparing(ProductModelMainParamsItemChildrenVO::getBatchNumber));
return vos; return vos;
} }

View File

@ -68,7 +68,7 @@
</select> </select>
<select id="getSimpleListByLanguage" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductSeriesSimpleVO"> <select id="getSimpleListByLanguage" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductSeriesSimpleVO">
select distinct batch_number,psi.name,sort select distinct batch_number,psi.name,ps.sort
from product_series ps from product_series ps
inner join product_series_info psi on ps.id=psi.series_id inner join product_series_info psi on ps.id=psi.series_id
where state=1 and enable=1 and module_id=#{moduleId} and psi.language_code=#{language} where state=1 and enable=1 and module_id=#{moduleId} and psi.language_code=#{language}

View File

@ -91,6 +91,7 @@
and pt.enable = 1 and pt.enable = 1
and pt.series_number = #{batchNumber} and pt.series_number = #{batchNumber}
AND pti.language_code = #{language} AND pti.language_code = #{language}
order by pt.sort
</select> </select>
<select id="getListForSort" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductTypeSearchVO"> <select id="getListForSort" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductTypeSearchVO">

View File

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -24,6 +25,12 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class GlobalRestControllerAdvice { public class GlobalRestControllerAdvice {
@ExceptionHandler(SQLException.class)
public ApiResult<Void> handleSQLException(SQLException ex) {
log.error("数据库错误: ", ex);
return ApiResult.error(STATE.BusinessError,"数据库错误");
}
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
public ApiResult<Void> handleAllExceptions(Exception ex) { public ApiResult<Void> handleAllExceptions(Exception ex) {
log.error("服务器内部错误: ", ex); log.error("服务器内部错误: ", ex);