diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java new file mode 100644 index 00000000..09134ad7 --- /dev/null +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductModelSearchRequest.java @@ -0,0 +1,20 @@ +package com.nflg.mobilebroken.common.pojo.request; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class QuotationProductModelSearchRequest { + + /** + * 类型批次号 + */ + @NotBlank + private String typeNumber; + + /** + * 机型 + */ + private String name; +} diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductTypeSearchRequest.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductTypeSearchRequest.java new file mode 100644 index 00000000..6dcf1057 --- /dev/null +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/QuotationProductTypeSearchRequest.java @@ -0,0 +1,17 @@ +package com.nflg.mobilebroken.common.pojo.request; + +import lombok.Data; + +@Data +public class QuotationProductTypeSearchRequest { + + /** + * 模块id + */ + private Long moduleId; + + /** + * 系列批次号 + */ + private String seriesNumber; +} diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java index 1a2dcb66..3b2360eb 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ProductTypeSimpleVO.java @@ -5,11 +5,26 @@ import lombok.Data; @Data public class ProductTypeSimpleVO { + /** + * 模块名称 + */ + private Integer moduleName; + + /** + * 系列名称 + */ + private String seriesName; + /** * 名称 */ private String name; + /** + * 图片 + */ + private String image; + /** * 批次号 */ diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/QuotationProductModelInfoVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/QuotationProductModelInfoVO.java new file mode 100644 index 00000000..5cadae40 --- /dev/null +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/QuotationProductModelInfoVO.java @@ -0,0 +1,42 @@ +package com.nflg.mobilebroken.common.pojo.vo; + +import lombok.Data; + +@Data +public class QuotationProductModelInfoVO { + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 系列名称 + */ + private String seriesName; + + /** + * 类型名称 + */ + private String typeName; + + /** + * 机型 + */ + private String no; + + /** + * 机型图片 + */ + private String image; + + /** + * 机型介绍 + */ + private String desc; + + /** + * 机型特点 + */ + private String feature; +} diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/QuotationProductModelSearchVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/QuotationProductModelSearchVO.java new file mode 100644 index 00000000..2f811648 --- /dev/null +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/QuotationProductModelSearchVO.java @@ -0,0 +1,43 @@ +package com.nflg.mobilebroken.common.pojo.vo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Objects; + +@Data +public class QuotationProductModelSearchVO { + + private Long id; + + /** + * 机型编号 + */ + private String no; + + /** + * 批次编号 + */ + private Long batchNumber; + + /** + * 是否新品 + */ + private Boolean recommend; + + public Boolean getRecommend() { + return recommend && (Objects.nonNull(recommendExpireTime) && LocalDateTime.now().isBefore(recommendExpireTime)); + } + + /** + * 新品过期时间 + */ + private LocalDateTime recommendExpireTime; + + /** + * 是否有折扣 + */ + @JsonProperty("hasDiscount") + private Boolean hasDiscount; +} diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ProductModelController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ProductModelController.java new file mode 100644 index 00000000..6832cb75 --- /dev/null +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ProductModelController.java @@ -0,0 +1,44 @@ +package com.nflg.mobilebroken.quotation.controller.app; + +import com.nflg.mobilebroken.common.pojo.ApiResult; +import com.nflg.mobilebroken.common.pojo.request.QuotationProductModelSearchRequest; +import com.nflg.mobilebroken.common.pojo.vo.ProductModelInfoVO; +import com.nflg.mobilebroken.common.pojo.vo.QuotationProductModelInfoVO; +import com.nflg.mobilebroken.common.pojo.vo.QuotationProductModelSearchVO; +import com.nflg.mobilebroken.common.util.MultilingualUtil; +import com.nflg.mobilebroken.quotation.controller.ControllerBase; +import com.nflg.mobilebroken.repository.service.IProductModelService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 产品机型 + */ +@RestController +@RequestMapping("/app/product/model") +public class ProductModelController extends ControllerBase { + + @Resource + private IProductModelService productModelService; + + /** + * 搜索 + * @param request + * @return + */ + @PostMapping("/search") + public ApiResult> search(@Valid @RequestBody QuotationProductModelSearchRequest request){ + return ApiResult.success(productModelService.searchForQuotation(request, MultilingualUtil.getLanguage())); + } + + /** + * 获取详情 + */ + @GetMapping("/getInfo") + public ApiResult getInfo(@RequestParam Long id){ + return ApiResult.success(productModelService.getInfoForQuotation(id, MultilingualUtil.getLanguage())); + } +} diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ProductTypeController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ProductTypeController.java new file mode 100644 index 00000000..2f52fd2e --- /dev/null +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ProductTypeController.java @@ -0,0 +1,37 @@ +package com.nflg.mobilebroken.quotation.controller.app; + +import com.nflg.mobilebroken.common.pojo.ApiResult; +import com.nflg.mobilebroken.common.pojo.request.QuotationProductTypeSearchRequest; +import com.nflg.mobilebroken.common.pojo.vo.ProductTypeSimpleVO; +import com.nflg.mobilebroken.common.util.MultilingualUtil; +import com.nflg.mobilebroken.quotation.controller.ControllerBase; +import com.nflg.mobilebroken.repository.service.IProductTypeService; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 产品类型 + */ +@RestController +@RequestMapping("/app/product/type") +public class ProductTypeController extends ControllerBase { + + @Resource + private IProductTypeService productTypeService; + + /** + * 搜索 + * @param request + * @return + */ + @PostMapping("/search") + public ApiResult> search(@Valid @RequestBody QuotationProductTypeSearchRequest request){ + return ApiResult.success(productTypeService.searchSimpleList(request, MultilingualUtil.getLanguage())); + } +} 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 0a5de935..3c294e65 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 @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest; import com.nflg.mobilebroken.common.pojo.request.ProductModelSearchRequest; +import com.nflg.mobilebroken.common.pojo.request.QuotationProductModelSearchRequest; import com.nflg.mobilebroken.common.pojo.vo.*; import com.nflg.mobilebroken.repository.entity.ProductModel; @@ -32,4 +33,8 @@ public interface ProductModelMapper extends BaseMapper { List getListForSort(String typeNumber); Page searchForQuotation(ModelConfigSearchRequest request, Page page); + + List searchForQuotation1(QuotationProductModelSearchRequest request, String language); + + QuotationProductModelInfoVO getInfoForQuotation(Long id, String language); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductTypeMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductTypeMapper.java index d86f4ca4..fbeda675 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductTypeMapper.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/ProductTypeMapper.java @@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nflg.mobilebroken.common.pojo.request.ProductTypeSearchRequest; +import com.nflg.mobilebroken.common.pojo.request.QuotationProductTypeSearchRequest; import com.nflg.mobilebroken.common.pojo.vo.*; import com.nflg.mobilebroken.repository.entity.ProductType; @@ -34,4 +35,6 @@ public interface ProductTypeMapper extends BaseMapper { List getSimpleListByLanguage(String batchNumber, String language); List getListForSort(String seriesNumber); + + List searchSimpleList(QuotationProductTypeSearchRequest request,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 93fe5ca7..f3d3392b 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 @@ -53,4 +53,8 @@ public interface IProductModelService extends IService { Page searchForQuotation(ModelConfigSearchRequest request); List getEffectives(); + + List searchForQuotation(QuotationProductModelSearchRequest request, String language); + + QuotationProductModelInfoVO getInfoForQuotation(Long id, String language); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductTypeService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductTypeService.java index 4b581daa..5c3d4c69 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductTypeService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductTypeService.java @@ -51,4 +51,6 @@ public interface IProductTypeService extends IService { ProductTypeLanguageInfoVO getInfoByLanguage(@Valid @NotNull String typeNumber, String language); List getSimpleListByLanguage(String batchNumber, String language); + + List searchSimpleList(QuotationProductTypeSearchRequest request,String 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 70d9af1a..fce0c458 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 @@ -409,6 +409,16 @@ public class ProductModelServiceImpl extends ServiceImpl searchForQuotation(QuotationProductModelSearchRequest request, String language) { + return baseMapper.searchForQuotation1(request,language); + } + + @Override + public QuotationProductModelInfoVO getInfoForQuotation(Long id, String language) { + return baseMapper.getInfoForQuotation(id,language); + } + private ProductModelCompareInfoVO getModelCompareInfo(Integer modelId, String language){ ProductModel productModel = getById(modelId); VUtils.trueThrowBusinessError(Objects.isNull(productModel)).throwMessage("无效的数据"); 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 a8772de9..3e156e8d 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 @@ -316,6 +316,11 @@ public class ProductTypeServiceImpl extends ServiceImpl searchSimpleList(QuotationProductTypeSearchRequest request,String language) { + return baseMapper.searchSimpleList(request,language); + } + private void delete(Integer typeId){ ProductType info=getById(typeId); removeById(typeId); diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductModelMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductModelMapper.xml index 82d1d8d0..1e2d66fd 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductModelMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductModelMapper.xml @@ -113,4 +113,30 @@ ORDER BY pm.batch_number + + + + diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml index d18d6f83..ff7937f3 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/ProductTypeMapper.xml @@ -101,4 +101,23 @@ where enable=1 and state=1 and series_number=#{seriesNumber} order by seriesName, sort + +