|
@@ -0,0 +1,75 @@
|
|
|
+package com.om.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.om.entity.dto.AppBrushFileDTO;
|
|
|
+import com.om.entity.dto.GuidDTO;
|
|
|
+import com.om.entity.po.BrushDescription;
|
|
|
+import com.om.entity.po.BrushFile;
|
|
|
+import com.om.entity.vo.AppBrushFileVO;
|
|
|
+import com.om.exception.BadReqException;
|
|
|
+import com.om.mapper.BrushFileMapper;
|
|
|
+import com.om.service.IBrushDescriptionService;
|
|
|
+import com.om.service.IBrushFileService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.om.utils.JwtUtils;
|
|
|
+import com.om.utils.Result;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author bmmx
|
|
|
+ * @since 2024-03-21
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class BrushFileServiceImpl extends ServiceImpl<BrushFileMapper, BrushFile> implements IBrushFileService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private JwtUtils jwtUtils;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBrushDescriptionService brushDescriptionService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result<List<AppBrushFileVO>> getBrushFileList(AppBrushFileDTO dto) {
|
|
|
+ if (BeanUtil.isEmpty(dto)){
|
|
|
+ throw new BadReqException("数据为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String brandCode = dto.getBrandCode();
|
|
|
+ String language = dto.getLanguage();
|
|
|
+ String guid = dto.getGuid();
|
|
|
+ GuidDTO guidDTO = jwtUtils.getGuidDTOFromToken(guid);
|
|
|
+ String clientNum = guidDTO.getClientNum();
|
|
|
+
|
|
|
+ List<BrushFile> brushFileList = this.lambdaQuery()
|
|
|
+ .eq(BrushFile::getBrandCode, brandCode)
|
|
|
+ .list();
|
|
|
+
|
|
|
+ if (brushFileList.isEmpty()){
|
|
|
+ return Result.ok();
|
|
|
+ }
|
|
|
+ List<AppBrushFileVO> brushFileVOList = new ArrayList<>();
|
|
|
+ for (BrushFile brushFile : brushFileList) {
|
|
|
+ AppBrushFileVO appBrushFileVO = BeanUtil.copyProperties(brushFile, AppBrushFileVO.class);
|
|
|
+
|
|
|
+ BrushDescription brushDescription = brushDescriptionService.lambdaQuery()
|
|
|
+ .eq(BrushDescription::getBrushId, brushFile.getId())
|
|
|
+ .eq(BrushDescription::getLanguage, language)
|
|
|
+ .one();
|
|
|
+ if (BeanUtil.isEmpty(brushDescription)){
|
|
|
+ throw new BadReqException("该版本描述不存在");
|
|
|
+ }
|
|
|
+ appBrushFileVO.setDescription(brushDescription.getDescription());
|
|
|
+ brushFileVOList.add(appBrushFileVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.ok(brushFileVOList);
|
|
|
+ }
|
|
|
+}
|