diff --git a/nflg-mobilebroken-admin/pom.xml b/nflg-mobilebroken-admin/pom.xml
index 81c719a7..df5d99ac 100644
--- a/nflg-mobilebroken-admin/pom.xml
+++ b/nflg-mobilebroken-admin/pom.xml
@@ -33,12 +33,6 @@
com.alibaba.cloud
spring-cloud-starter-alibaba-nacos-config
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
org.junit.jupiter
junit-jupiter
diff --git a/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/ProductModelController.java b/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/ProductModelController.java
index 28e188a2..2424f709 100644
--- a/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/ProductModelController.java
+++ b/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/ProductModelController.java
@@ -1,6 +1,5 @@
package com.nflg.mobilebroken.admin.controller;
-import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
@@ -16,6 +15,7 @@ import com.nflg.mobilebroken.common.pojo.PageData;
import com.nflg.mobilebroken.common.pojo.dto.ProductModelParamsExcelDTO;
import com.nflg.mobilebroken.common.pojo.request.*;
import com.nflg.mobilebroken.common.pojo.vo.*;
+import com.nflg.mobilebroken.common.util.AdminUserUtil;
import com.nflg.mobilebroken.common.util.EecExcelUtil;
import com.nflg.mobilebroken.common.util.PageUtil;
import com.nflg.mobilebroken.common.util.VUtils;
@@ -26,16 +26,18 @@ import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.core.io.ClassPathResource;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import org.ttzero.excel.entity.TemplateSheet;
-import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.IOException;
+import java.io.InputStream;
+import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@@ -421,10 +423,7 @@ public class ProductModelController extends ControllerBase{
@GetMapping("/downloadParamImportTemplate")
public void downloadParamImportTemplate(HttpServletResponse response) throws IOException {
EecExcelUtil.setResponseExcelHeader(response, "机型参数导入模版");
- ClassPathResource resource = new ClassPathResource("templates/ProductModelParamImport.xlsx");
- new Workbook()
- .addSheet(new TemplateSheet(resource.getInputStream()))
- .writeTo(response.getOutputStream());
+ StreamUtils.copy(new ClassPathResource("templates/ProductModelParamImport.xlsx").getInputStream(), response.getOutputStream());
}
/**
@@ -608,41 +607,162 @@ public class ProductModelController extends ControllerBase{
/**
* 导入设备技术参数项
- * @param modelId 机型ID
* @param modelParamsId 机型参数ID
* @param file 文件
* @return 机型参数id
*/
+ @Transactional
@PostMapping("/importModelParamsItem")
public ApiResult importModelParamsItem(@Valid @RequestParam @NotNull int modelId
- ,@RequestParam Integer modelParamsId
+ ,@RequestParam(required = false,defaultValue = "0") int modelParamsId
, @Valid @RequestParam(value = "file") @NotNull MultipartFile file) {
- try {
- List datas = EecExcelUtil.getExcelContext(file.getInputStream(), ProductModelParamsExcelDTO.class);
- VUtils.trueThrowBusinessError(CollUtil.isEmpty(datas)).throwMessage("导入文件内容为空");
- Set seen = new HashSet<>();
- StringBuilder sb=new StringBuilder();
- datas.forEach(dto->{
- if(!seen.add(StrUtil.format("{}|{}|{}", dto.getLanguageCode(),dto.getIndexName(),dto.getName()))){
- sb.append(StrUtil.format("语言编码:{},指标名称:{},参数名称:{}\r\n", dto.getLanguageCode(),dto.getIndexName(),dto.getName()));
+ ProductModel model=productModelService.getById(modelId);
+ VUtils.trueThrowBusinessError(Objects.isNull(model)).throwMessage("无效的"+modelId);
+ try (InputStream inputStream = file.getInputStream();org.apache.poi.ss.usermodel.Workbook workbook = new XSSFWorkbook(inputStream)){
+ Sheet sheet=workbook.getSheetAt(0);
+ String no=StrUtil.trim(sheet.getRow(1).getCell(1).getStringCellValue());
+ VUtils.trueThrowBusinessError(!StrUtil.equals(model.getNo(),no)).throwMessage("产品型号不一致");
+ List datas = new ArrayList<>();
+ String indexName = null;
+ for (int index = 3, count = sheet.getLastRowNum(); index <= count; index++) {
+// log.info("处理第{}行", index);
+ Row row = sheet.getRow(index);
+ if (Objects.isNull(row)) {
+ break;
}
- });
+ ProductModelParamsExcelDTO dto=new ProductModelParamsExcelDTO();
+ Cell cell0=row.getCell(0);
+ dto.setIndexName(StrUtil.trim(cell0.getStringCellValue()));
+ if (StrUtil.isBlank(dto.getIndexName())){
+ VUtils.trueThrowBusinessError(StrUtil.isBlank(indexName)).throwMessage("指标名称不能为空");
+ dto.setIndexName(indexName);
+ }else {
+ indexName=dto.getIndexName();
+ }
+ Cell cell1=row.getCell(1);
+ dto.setName(StrUtil.trim(cell1.getStringCellValue()));
+ Cell cell2=row.getCell(2);
+ dto.setValue(StrUtil.trim(cell2.getStringCellValue()));
+ Cell cell3=row.getCell(3);
+ dto.setMain(StrUtil.equals(cell3.getStringCellValue(),"是"));
+ Cell cell4=row.getCell(4);
+ dto.setCompare(StrUtil.equals(cell4.getStringCellValue(),"是"));
+ datas.add(dto);
+ }
+// log.info("导入的数据是:{}", JSONUtil.toJsonStr(datas));
+ VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("数据不能为空");
+ List languages = languageService.getLanguages();
+ languages.removeIf(l->StrUtil.equals(l.getCode(),Constant.DEFAULT_LANGUAGE_CODE));
int resultId;
- VUtils.trueThrowBusinessError(StrUtil.isNotBlank(sb.toString()))
- .throwMessage("以下数据存在重复项:\r\n" + sb);
- if (Objects.isNull(modelParamsId)) {
+ if (modelParamsId == 0) {
resultId = productModelParamsService.add(modelId, IdUtil.getSnowflakeNextIdStr());
- } else {
+ List items=new ArrayList<>();
+ int finalResultId = resultId;
+ datas.forEach(dto -> {
+ String batchNumber = IdUtil.getSnowflakeNextIdStr();
+ ProductModelParamsItem cn=new ProductModelParamsItem()
+ .setModelParamsId(finalResultId)
+ .setLanguageCode(Constant.DEFAULT_LANGUAGE_CODE)
+ .setBatchNumber(batchNumber)
+ .setIndexName(dto.getIndexName())
+ .setName(dto.getName())
+ .setValue(dto.getValue())
+ .setMain(dto.getMain())
+ .setCompare(dto.getCompare())
+ .setCreateBy(AdminUserUtil.getUserName())
+ .setCreateTime(LocalDateTime.now());
+ items.add(cn);
+ languages.forEach(language -> {
+ ProductModelParamsItem item = new ProductModelParamsItem()
+ .setModelParamsId(finalResultId)
+ .setLanguageCode(language.getCode())
+ .setBatchNumber(batchNumber)
+ .setIndexName(translate.translateWord(dto.getIndexName(),language.getTranslateCode()))
+ .setName(translate.translateWord(dto.getName(),language.getTranslateCode()))
+ .setValue(translate.translateWord(dto.getValue(),language.getTranslateCode()))
+ .setMain(dto.getMain())
+ .setCompare(dto.getCompare())
+ .setCreateBy(AdminUserUtil.getUserName())
+ .setCreateTime(LocalDateTime.now());
+ items.add(item);
+ });
+ });
+ productModelParamsItemService.saveBatch(items);
+ }else {
ProductModelParams info = productModelParamsService.getById(modelParamsId);
- VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
+ VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的"+modelParamsId);
resultId = modelParamsId;
if (Objects.equals(info.getState(), PublishState.Published.getState())) {
resultId = productModelParamsService.add(modelId, info.getBatchNumber());
productModelParamsService.copyItems(modelParamsId, resultId);
}
+ List oldItems = productModelParamsItemService.lambdaQuery().eq(ProductModelParamsItem::getModelParamsId, resultId).list();
+ int finalResultId1 = resultId;
+ List items=new ArrayList<>();
+ datas.forEach(dto -> {
+ if (oldItems.stream().noneMatch(it -> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE)
+ && StrUtil.equals(it.getIndexName(), dto.getIndexName())
+ && StrUtil.equals(it.getName(), dto.getName()))) {
+ String batchNumber = IdUtil.getSnowflakeNextIdStr();
+ ProductModelParamsItem cn=new ProductModelParamsItem()
+ .setModelParamsId(finalResultId1)
+ .setLanguageCode(Constant.DEFAULT_LANGUAGE_CODE)
+ .setBatchNumber(batchNumber)
+ .setIndexName(dto.getIndexName())
+ .setName(dto.getName())
+ .setValue(dto.getValue())
+ .setMain(dto.getMain())
+ .setCompare(dto.getCompare())
+ .setCreateBy(AdminUserUtil.getUserName())
+ .setCreateTime(LocalDateTime.now());
+ items.add(cn);
+ languages.forEach(language -> {
+ ProductModelParamsItem item = new ProductModelParamsItem()
+ .setModelParamsId(finalResultId1)
+ .setLanguageCode(language.getCode())
+ .setBatchNumber(batchNumber)
+ .setIndexName(translate.translateWord(dto.getIndexName(), language.getTranslateCode()))
+ .setName(translate.translateWord(dto.getName(), language.getTranslateCode()))
+ .setValue(translate.translateWord(dto.getValue(), language.getTranslateCode()))
+ .setMain(dto.getMain())
+ .setCompare(dto.getCompare())
+ .setCreateBy(AdminUserUtil.getUserName())
+ .setCreateTime(LocalDateTime.now());
+ items.add(item);
+ });
+ }
+ });
+ if (CollectionUtil.isNotEmpty(items)) {
+ productModelParamsItemService.saveBatch(items);
+ }
}
- productModelParamsItemService.importModelParamsItem(resultId, datas);
return ApiResult.success(resultId);
+
+// List datas = EecExcelUtil.getExcelContext(file.getInputStream(), ProductModelParamsExcelDTO.class);
+// VUtils.trueThrowBusinessError(CollUtil.isEmpty(datas)).throwMessage("导入文件内容为空");
+// Set seen = new HashSet<>();
+// StringBuilder sb=new StringBuilder();
+// datas.forEach(dto->{
+// if(!seen.add(StrUtil.format("{}|{}|{}", dto.getLanguageCode(),dto.getIndexName(),dto.getName()))){
+// sb.append(StrUtil.format("语言编码:{},指标名称:{},参数名称:{}\r\n", dto.getLanguageCode(),dto.getIndexName(),dto.getName()));
+// }
+// });
+// int resultId;
+// VUtils.trueThrowBusinessError(StrUtil.isNotBlank(sb.toString()))
+// .throwMessage("以下数据存在重复项:\r\n" + sb);
+// if (Objects.isNull(modelParamsId)) {
+// resultId = productModelParamsService.add(modelId, IdUtil.getSnowflakeNextIdStr());
+// } else {
+// ProductModelParams info = productModelParamsService.getById(modelParamsId);
+// VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
+// resultId = modelParamsId;
+// if (Objects.equals(info.getState(), PublishState.Published.getState())) {
+// resultId = productModelParamsService.add(modelId, info.getBatchNumber());
+// productModelParamsService.copyItems(modelParamsId, resultId);
+// }
+// }
+// productModelParamsItemService.importModelParamsItem(resultId, datas);
+// return ApiResult.success(resultId);
} catch (IOException e) {
throw new NflgException(STATE.BusinessError, "导入失败:" + e.getMessage());
}
diff --git a/nflg-mobilebroken-auth/pom.xml b/nflg-mobilebroken-auth/pom.xml
index 3e54fb45..1c747f4e 100644
--- a/nflg-mobilebroken-auth/pom.xml
+++ b/nflg-mobilebroken-auth/pom.xml
@@ -44,12 +44,6 @@
com.nflg
nflg-mobilebroken-starter
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
org.springframework.boot
spring-boot-starter
diff --git a/nflg-mobilebroken-cfs-app/pom.xml b/nflg-mobilebroken-cfs-app/pom.xml
index e33bfc56..970178db 100644
--- a/nflg-mobilebroken-cfs-app/pom.xml
+++ b/nflg-mobilebroken-cfs-app/pom.xml
@@ -55,12 +55,6 @@
mysql-connector-java
runtime
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
com.nflg
nflg-mobilebroken-repository
diff --git a/nflg-mobilebroken-cfs-app/src/main/java/com/nflg/mobilebroken/cfs/config/JacksonConfig.java b/nflg-mobilebroken-cfs-app/src/main/java/com/nflg/mobilebroken/cfs/config/JacksonConfig.java
deleted file mode 100644
index 539e72b7..00000000
--- a/nflg-mobilebroken-cfs-app/src/main/java/com/nflg/mobilebroken/cfs/config/JacksonConfig.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.nflg.mobilebroken.cfs.config;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-
-@Configuration
-public class JacksonConfig {
-
- // 定义全局日期时间格式
- private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
-
- @Bean
- public ObjectMapper objectMapper() {
- ObjectMapper objectMapper = new ObjectMapper();
-
- // 创建并注册 JavaTimeModule,设置日期格式化
- JavaTimeModule javaTimeModule = new JavaTimeModule();
- javaTimeModule.addSerializer(
- java.time.LocalDateTime.class,
- new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT))
- );
- javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT)));
-
- objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- // 注册模块到 ObjectMapper
- objectMapper.registerModule(javaTimeModule);
-
- // 禁用时间戳(默认是 true,会序列化为数组)
- objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-
- return objectMapper;
- }
-}
diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/dto/ProductModelParamsExcelDTO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/dto/ProductModelParamsExcelDTO.java
index ef2fa927..ae676956 100644
--- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/dto/ProductModelParamsExcelDTO.java
+++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/dto/ProductModelParamsExcelDTO.java
@@ -2,45 +2,33 @@ package com.nflg.mobilebroken.common.pojo.dto;
import lombok.Data;
import lombok.experimental.Accessors;
-import org.ttzero.excel.annotation.ExcelColumn;
@Data
@Accessors(chain = true)
public class ProductModelParamsExcelDTO {
- /**
- * 语言编码
- */
- @ExcelColumn("语言编码")
- private String languageCode;
-
/**
* 指标名称
*/
- @ExcelColumn("指标名称")
private String indexName;
/**
* 参数名称
*/
- @ExcelColumn("参数名称")
private String name;
/**
* 参数指标
*/
- @ExcelColumn("参数指标")
private String value;
/**
* 是否主要参数
*/
- @ExcelColumn("是否主要参数")
private Boolean main;
/**
* 是否参与比较
*/
- @ExcelColumn("是否参与比较")
private Boolean compare;
}
\ No newline at end of file
diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductSeriesSearchVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductSeriesSearchVO.java
index 766b7f8c..a3efe9d5 100644
--- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductSeriesSearchVO.java
+++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductSeriesSearchVO.java
@@ -12,6 +12,11 @@ public class FrontendProductSeriesSearchVO {
*/
private Integer moduleId;
+ /**
+ * 批次号
+ */
+ private String batchNumber;
+
/**
* 名称
*/
diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductTypeSearchVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductTypeSearchVO.java
index 93a6c0f9..1d71494a 100644
--- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductTypeSearchVO.java
+++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/FrontendProductTypeSearchVO.java
@@ -10,9 +10,9 @@ import java.util.List;
public class FrontendProductTypeSearchVO extends FrontendProductSeriesSearchVO{
/**
- * 批次号
+ * 系列批次号
*/
- private String batchNumber;
+ private String seriesNumber;
/**
* 机型说明
diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ModuleVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ModuleVO.java
new file mode 100644
index 00000000..11a97c1b
--- /dev/null
+++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ModuleVO.java
@@ -0,0 +1,21 @@
+package com.nflg.mobilebroken.common.pojo.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+public class ModuleVO {
+
+ private Integer id;
+
+ private String name;
+
+ /**
+ * 系列
+ */
+ private List series;
+}
+
diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductHonorVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductHonorVO.java
index 049284b5..273dafbc 100644
--- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductHonorVO.java
+++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductHonorVO.java
@@ -5,6 +5,8 @@ import lombok.Data;
@Data
public class ProductHonorVO {
+ private Integer id;
+
/**
* 年份
**/
diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductModelInfoVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductModelInfoVO.java
index 5445c821..b0b435d6 100644
--- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductModelInfoVO.java
+++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductModelInfoVO.java
@@ -16,6 +16,11 @@ public class ProductModelInfoVO {
*/
private Integer moduleId;
+ /**
+ * 系列批次号
+ */
+ private String seriesNumber;
+
/**
* 类型批次号
*/
@@ -62,10 +67,15 @@ public class ProductModelInfoVO {
private ProductHotImageInfoVO hotImage;
/**
- * 主要参数列表
+ * 所有技术参数列表
*/
private List params;
+ /**
+ * 主要技术参数
+ */
+ private List mainParams;
+
/**
* 产品图册
*/
diff --git a/nflg-mobilebroken-gateway/pom.xml b/nflg-mobilebroken-gateway/pom.xml
index 2985f924..5a2300dc 100644
--- a/nflg-mobilebroken-gateway/pom.xml
+++ b/nflg-mobilebroken-gateway/pom.xml
@@ -41,12 +41,6 @@
org.springframework.boot
spring-boot-starter-web
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
diff --git a/nflg-mobilebroken-product/src/main/java/com/nflg/mobilebroken/product/controller/InfoController.java b/nflg-mobilebroken-product/src/main/java/com/nflg/mobilebroken/product/controller/InfoController.java
index 6d4013e2..b47ce6f0 100644
--- a/nflg-mobilebroken-product/src/main/java/com/nflg/mobilebroken/product/controller/InfoController.java
+++ b/nflg-mobilebroken-product/src/main/java/com/nflg/mobilebroken/product/controller/InfoController.java
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
+import java.util.stream.Collectors;
/**
* 基础信息
@@ -72,8 +73,12 @@ public class InfoController extends BaseController{
* 获取模块列表
*/
@GetMapping("/getModuleList")
- public ApiResult> getModuleList(){
- return ApiResult.success(dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_PRODUCT_MODULE));
+ public ApiResult> getModuleList(){
+ List items = dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_PRODUCT_MODULE);
+ return ApiResult.success(items.stream().map(it -> new ModuleVO()
+ .setId(it.getId())
+ .setName(it.getName())
+ .setSeries(productSeriesService.getSimpleList(it.getId(), MultilingualUtil.getLanguage()))).collect(Collectors.toList()));
}
/**
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelMapper.java
index afdb810a..3414c39e 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelMapper.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelMapper.java
@@ -26,5 +26,5 @@ public interface ProductModelMapper extends BaseMapper {
Page search(String name, String language, Page> page);
- List getSimpleList(Integer moduleId,String typeNumber);
+ List getSimpleList(String typeNumber);
}
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelParamsMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelParamsMapper.java
index ce1a0ed3..dccf9277 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelParamsMapper.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductModelParamsMapper.java
@@ -2,6 +2,7 @@ package com.nflg.mobilebroken.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelParamVO;
+import com.nflg.mobilebroken.common.pojo.vo.ProductParamsItemVO;
import com.nflg.mobilebroken.repository.entity.ProductModelParams;
import java.util.List;
@@ -21,4 +22,6 @@ public interface ProductModelParamsMapper extends BaseMapper
List getAllListByLanguage(Integer modelId, String language);
void copyItems(Integer oldId, Integer newId);
+
+ List getMainListByLanguage(Integer modelId, String language);
}
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductSeriesMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductSeriesMapper.java
index b45be62e..339730ba 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductSeriesMapper.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductSeriesMapper.java
@@ -31,4 +31,6 @@ public interface ProductSeriesMapper extends BaseMapper {
Page search(String name, String language, Page> page);
List getSimpleList(Integer moduleId);
+
+ List getSimpleListByLanguage(Integer moduleId, String language);
}
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsItemService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsItemService.java
index daa48547..54ede619 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsItemService.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsItemService.java
@@ -1,7 +1,6 @@
package com.nflg.mobilebroken.repository.service;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.nflg.mobilebroken.common.pojo.dto.ProductModelParamsExcelDTO;
import com.nflg.mobilebroken.common.pojo.request.*;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelMainParamsItemVO;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelParamsItemVO;
@@ -9,7 +8,6 @@ import com.nflg.mobilebroken.repository.entity.ProductModelParamsItem;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
import java.util.List;
/**
@@ -40,7 +38,7 @@ public interface IProductModelParamsItemService extends IService datas);
+// void importModelParamsItem(@Valid @NotNull Integer modelParamsId, List datas);
void updateItem(@Valid ProductModelParamsItemUpdateRequest1 request);
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsService.java
index b85cc169..c1740a43 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsService.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelParamsService.java
@@ -7,6 +7,7 @@ import com.nflg.mobilebroken.common.pojo.request.ProductModelIntroSearchRequest;
import com.nflg.mobilebroken.common.pojo.request.ProductPublishRequest;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelMainParamsItemChildrenVO;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelParamVO;
+import com.nflg.mobilebroken.common.pojo.vo.ProductParamsItemVO;
import com.nflg.mobilebroken.repository.entity.ProductModelParams;
import javax.validation.Valid;
@@ -49,4 +50,6 @@ public interface IProductModelParamsService extends IService
List getAListByLanguage(Integer modelId, String language);
List getCNList(Integer modelId);
+
+ List getMainListByLanguage(Integer modelId, String language);
}
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelService.java
index a7c71760..7943fcf0 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelService.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelService.java
@@ -48,5 +48,5 @@ public interface IProductModelService extends IService {
Page search(@Valid ProductSeriesSearchRequest request, String language);
- List getSimpleList(Integer moduleId,String typeNumber);
+ List getSimpleList(String typeNumber);
}
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductSeriesService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductSeriesService.java
index 0e767108..fdc1e8a7 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductSeriesService.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductSeriesService.java
@@ -36,6 +36,8 @@ public interface IProductSeriesService extends IService {
List getSimpleList(Integer moduleId);
+ List getSimpleList(Integer moduleId,String language);
+
ProductSeriesInfoVO getInfo(@Valid @NotNull Integer seriesId);
List getListForSort();
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsItemServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsItemServiceImpl.java
index 8a12fb9c..02bf286c 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsItemServiceImpl.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsItemServiceImpl.java
@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.constant.Constant;
-import com.nflg.mobilebroken.common.pojo.dto.ProductModelParamsExcelDTO;
import com.nflg.mobilebroken.common.pojo.request.*;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelMainParamsItemChildrenVO;
import com.nflg.mobilebroken.common.pojo.vo.ProductModelMainParamsItemVO;
@@ -25,10 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -153,12 +149,15 @@ public class ProductModelParamsItemServiceImpl extends ServiceImpl StrUtil.isNotBlank(pi.getName()))
.map(pi -> Convert.convert(ProductParamsItemVO.class, pi))
.collect(Collectors.toList()));
vo.getItems().add(ivo);
});
+ vo.getItems().sort(Comparator.comparing(ProductModelMainParamsItemChildrenVO::getIndexName));
});
+ vos.sort(Comparator.comparing(ProductModelParamsItemVO::getLanguageCode));
return vos;
}
@@ -218,43 +217,43 @@ public class ProductModelParamsItemServiceImpl extends ServiceImpl datas) {
- List list = lambdaQuery().eq(ProductModelParamsItem::getModelParamsId, modelParamsId).list();
- List forAdd=new ArrayList<>();
- datas.forEach(data -> {
- ProductModelParamsItem item = list.stream().filter(li -> StrUtil.equals(li.getLanguageCode(), data.getLanguageCode())
- && StrUtil.equals(li.getIndexName(), data.getIndexName())
- && StrUtil.equals(li.getName(), data.getName()))
- .findFirst()
- .orElse(null);
- if (Objects.nonNull(item)){
- item.setValue(data.getValue());
- item.setMain(data.getMain());
- item.setCompare(data.getCompare());
- item.setUpdateBy(AdminUserUtil.getUserName());
- item.setUpdateTime(LocalDateTime.now());
- }else {
- forAdd.add(new ProductModelParamsItem()
- .setModelParamsId(modelParamsId)
- .setLanguageCode(data.getLanguageCode())
- .setIndexName(data.getIndexName())
- .setName(data.getName())
- .setValue(data.getValue())
- .setMain(data.getMain())
- .setCompare(data.getCompare())
- .setCreateBy(AdminUserUtil.getUserName())
- .setCreateTime(LocalDateTime.now()));
- }
- });
- if (CollectionUtil.isNotEmpty(list)){
- updateBatchById(list);
- }
- if (CollectionUtil.isNotEmpty(forAdd)){
- saveBatch(forAdd);
- }
- }
+// @Transactional
+// @Override
+// public void importModelParamsItem(Integer modelParamsId, List datas) {
+// List list = lambdaQuery().eq(ProductModelParamsItem::getModelParamsId, modelParamsId).list();
+// List forAdd=new ArrayList<>();
+// datas.forEach(data -> {
+// ProductModelParamsItem item = list.stream().filter(li -> StrUtil.equals(li.getLanguageCode(), data.getLanguageCode())
+// && StrUtil.equals(li.getIndexName(), data.getIndexName())
+// && StrUtil.equals(li.getName(), data.getName()))
+// .findFirst()
+// .orElse(null);
+// if (Objects.nonNull(item)){
+// item.setValue(data.getValue());
+// item.setMain(data.getMain());
+// item.setCompare(data.getCompare());
+// item.setUpdateBy(AdminUserUtil.getUserName());
+// item.setUpdateTime(LocalDateTime.now());
+// }else {
+// forAdd.add(new ProductModelParamsItem()
+// .setModelParamsId(modelParamsId)
+// .setLanguageCode(data.getLanguageCode())
+// .setIndexName(data.getIndexName())
+// .setName(data.getName())
+// .setValue(data.getValue())
+// .setMain(data.getMain())
+// .setCompare(data.getCompare())
+// .setCreateBy(AdminUserUtil.getUserName())
+// .setCreateTime(LocalDateTime.now()));
+// }
+// });
+// if (CollectionUtil.isNotEmpty(list)){
+// updateBatchById(list);
+// }
+// if (CollectionUtil.isNotEmpty(forAdd)){
+// saveBatch(forAdd);
+// }
+// }
@Override
public void updateItem(ProductModelParamsItemUpdateRequest1 request) {
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java
index 94b67b8f..af195c9f 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelParamsServiceImpl.java
@@ -235,4 +235,9 @@ public class ProductModelParamsServiceImpl extends ServiceImpl getMainListByLanguage(Integer modelId, String language) {
+ return baseMapper.getMainListByLanguage(modelId,language);
+ }
}
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java
index 28923ce8..d9e6b9a1 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java
@@ -105,6 +105,9 @@ public class ProductModelServiceImpl extends ServiceImpl getSimpleList(Integer moduleId, String typeNumber) {
- return baseMapper.getSimpleList(moduleId,typeNumber);
+ public List getSimpleList(String typeNumber) {
+ return baseMapper.getSimpleList(typeNumber);
}
private ProductModelCompareInfoVO getModelCompareInfo(Integer modelId, String language){
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductSeriesServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductSeriesServiceImpl.java
index 3ff94639..fcbbbf0e 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductSeriesServiceImpl.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductSeriesServiceImpl.java
@@ -203,6 +203,11 @@ public class ProductSeriesServiceImpl extends ServiceImpl getSimpleList(Integer moduleId, String language) {
+ return baseMapper.getSimpleListByLanguage(moduleId,language);
+ }
+
@Override
public ProductSeriesInfoVO getInfo(Integer seriesId) {
ProductSeries series = getById(seriesId);
diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductTypeServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductTypeServiceImpl.java
index a6f5f429..58b59cc3 100644
--- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductTypeServiceImpl.java
+++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductTypeServiceImpl.java
@@ -104,6 +104,8 @@ public class ProductTypeServiceImpl extends ServiceImpl get(Integer moduleId, String seriesNumber, String language) {
List vos = baseMapper.get(moduleId, seriesNumber, language);
vos.forEach(vo -> {
- vo.setModels(productModelService.getSimpleList(moduleId,vo.getTypeNumber()));
+ vo.setModels(productModelService.getSimpleList(vo.getTypeNumber()));
});
return vos;
}
@@ -297,7 +299,7 @@ public class ProductTypeServiceImpl extends ServiceImpl search(ProductSeriesSearchRequest request, String language) {
Page datas = baseMapper.search(request.getName(), language, new Page<>(request.getPage(), request.getPageSize()));
datas.getRecords().forEach(it -> {
- it.setModels(productModelService.getSimpleList(it.getModuleId(), it.getBatchNumber()));
+ it.setModels(productModelService.getSimpleList(it.getBatchNumber()));
});
return datas;
}
diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductHonorMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductHonorMapper.xml
index dcf5f589..d3caecbb 100644
--- a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductHonorMapper.xml
+++ b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductHonorMapper.xml
@@ -26,7 +26,7 @@
@@ -30,4 +29,16 @@
FROM product_model_params_item
WHERE model_params_id=#{oldId}
+
+
+ SELECT pmpi.*
+ FROM product_model_params pmp
+ INNER JOIN product_model_params_item pmpi ON pmp.id = pmpi.model_params_id
+ WHERE pmp.model_id = #{modelId}
+ AND pmp.state = 1
+ AND pmpi.main = 1
+ AND pmpi.compare = 1
+ AND pmpi.language_code = #{language}
+ ORDER BY pmp.id DESC
+
diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductSeriesMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductSeriesMapper.xml
index 379f742d..6b214021 100644
--- a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductSeriesMapper.xml
+++ b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductSeriesMapper.xml
@@ -51,7 +51,7 @@
- SELECT ps.id,ps.module_id, psi.`name`, psi.content, psi.image
+ SELECT ps.id,ps.module_id,ps.batch_number, psi.*
FROM product_series ps
INNER JOIN product_series_info psi ON ps.id = psi.series_id
WHERE ps.state = 1
@@ -64,6 +64,14 @@
select distinct batch_number,name
from product_series
- where state!=2
+ where state!=2 and module_id=#{moduleId}
+
+
+
+ select distinct batch_number,psi.name,sort
+ from product_series ps
+ 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}
+ order by ps.sort
diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml
index 467c9683..8cacad16 100644
--- a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml
+++ b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml
@@ -56,7 +56,7 @@
- SELECT pt.id, pti.`name`, pti.content, pti.image, pti.model_desc
+ SELECT pt.id,pt.batch_number,pt.series_number,pt.module_id, pti.*
FROM product_type pt
INNER JOIN product_type_info pti ON pt.id = pti.type_id
WHERE pt.state = 1
diff --git a/nflg-mobilebroken-starter/pom.xml b/nflg-mobilebroken-starter/pom.xml
index 7a9dda64..c212fa1d 100644
--- a/nflg-mobilebroken-starter/pom.xml
+++ b/nflg-mobilebroken-starter/pom.xml
@@ -108,6 +108,10 @@
cn.dev33
sa-token-jwt
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+
diff --git a/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/config/JacksonConfig.java b/nflg-mobilebroken-starter/src/main/java/com/nflg/mobilebroken/starter/config/JacksonConfig.java
similarity index 97%
rename from nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/config/JacksonConfig.java
rename to nflg-mobilebroken-starter/src/main/java/com/nflg/mobilebroken/starter/config/JacksonConfig.java
index 60bcdc0d..04950017 100644
--- a/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/config/JacksonConfig.java
+++ b/nflg-mobilebroken-starter/src/main/java/com/nflg/mobilebroken/starter/config/JacksonConfig.java
@@ -1,4 +1,4 @@
-package com.nflg.mobilebroken.admin.config;
+package com.nflg.mobilebroken.starter.config;
import cn.hutool.core.date.DatePattern;