Browse Source

维多利亚

home 2 years ago
parent
commit
ddb65df3c4
19 changed files with 28 additions and 686 deletions
  1. 0 78
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/material/Material.java
  2. 0 17
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/material/MaterialEx.java
  3. 0 17
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/material/MaterialVo.java
  4. 1 0
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/classify/ClassifyController.java
  5. 0 15
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/excel/ExcelImportLogController.java
  6. 0 61
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/material/MaterialController.java
  7. 0 62
      hx-service/victoriatourist/src/main/java/com/fjhx/listener/EasyExcelListener.java
  8. 1 27
      hx-service/victoriatourist/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseMapper.xml
  9. 0 17
      hx-service/victoriatourist/src/main/java/com/fjhx/mapper/material/MaterialMapper.java
  10. 0 5
      hx-service/victoriatourist/src/main/java/com/fjhx/mapper/material/MaterialMapper.xml
  11. 13 17
      hx-service/victoriatourist/src/main/java/com/fjhx/service/apply/impl/ApplyPurchaseServiceImpl.java
  12. 4 4
      hx-service/victoriatourist/src/main/java/com/fjhx/service/classify/impl/ClassifyServiceImpl.java
  13. 0 33
      hx-service/victoriatourist/src/main/java/com/fjhx/service/excel/ExcelImportLogService.java
  14. 0 124
      hx-service/victoriatourist/src/main/java/com/fjhx/service/excel/impl/ExcelImportLogServiceImpl.java
  15. 0 28
      hx-service/victoriatourist/src/main/java/com/fjhx/service/material/MaterialService.java
  16. 0 170
      hx-service/victoriatourist/src/main/java/com/fjhx/service/material/impl/MaterialServiceImpl.java
  17. 8 7
      hx-service/victoriatourist/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceServiceImpl.java
  18. 0 3
      hx-service/victoriatourist/src/main/java/com/fjhx/uitl/code/CodeEnum.java
  19. 1 1
      hx-service/victoriatourist/src/main/java/com/fjhx/uitl/flow/FlowUserUtil.java

+ 0 - 78
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/material/Material.java

@@ -1,78 +0,0 @@
-package com.fjhx.entity.material;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.fjhx.base.BaseEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.math.BigDecimal;
-
-/**
- * <p>
- * 物料
- * </p>
- *
- * @author ${author}
- * @since 2022-11-24
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class Material extends BaseEntity {
-
-
-    /**
-     * 分类id
-     */
-    private Long classifyId;
-
-    /**
-     * 物料类型
-     */
-    private Integer type;
-
-    /**
-     * 编码
-     */
-    private String code;
-
-    /**
-     * 名称
-     */
-    private String name;
-
-    /**
-     * 单位
-     */
-    private String unit;
-
-    /**
-     * 物料说明
-     */
-    private String introduce;
-
-    /**
-     * 部门ID
-     */
-    private Long deptId;
-
-    /**
-     * 逻辑删除 0未删除 1已删除
-     */
-    @TableField(fill = FieldFill.INSERT)
-    @TableLogic
-    private Integer delFlag;
-
-    /**
-     * 部门名称
-     */
-    @TableField(exist = false)
-    private String deptName;
-
-    /**
-     * 库存数量
-     */
-    @TableField(exist = false)
-    private BigDecimal stockQuantity;
-}

+ 0 - 17
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/material/MaterialEx.java

@@ -1,17 +0,0 @@
-package com.fjhx.params.material;
-
-import com.fjhx.entity.material.Material;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 物料
- *
- * @author ${author}
- * @since 2022-11-24
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class MaterialEx extends Material {
-
-}

+ 0 - 17
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/material/MaterialVo.java

@@ -1,17 +0,0 @@
-package com.fjhx.params.material;
-
-import com.fjhx.entity.material.Material;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 物料
- *
- * @author ${author}
- * @since 2022-11-24
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class MaterialVo extends Material {
-
-}

+ 1 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/controller/classify/ClassifyController.java

@@ -61,5 +61,6 @@ public class ClassifyController {
     public R details(@RequestBody ClassifyVo entity) {
         return R.success(classifyService.getById(entity.getId()));
     }
+
 }
 

+ 0 - 15
hx-service/victoriatourist/src/main/java/com/fjhx/controller/excel/ExcelImportLogController.java

@@ -1,10 +1,8 @@
 package com.fjhx.controller.excel;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.base.Condition;
 import com.fjhx.entity.excel.ExcelImportLog;
-import com.fjhx.params.excel.ExcelProcessingProgress;
 import com.fjhx.service.excel.ExcelImportLogService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,17 +32,4 @@ public class ExcelImportLogController {
         return R.data(result);
     }
 
-    @PostMapping("readRate")
-    public R readRate(@RequestBody JSONObject json) {
-        ExcelProcessingProgress readRate = excelImportLogService.getReadRate(json.getLong("flag"));
-        return R.data(readRate);
-    }
-
-    @PostMapping("stop")
-    public R stop(@RequestBody JSONObject json) {
-        excelImportLogService.stopRead(json.getLong("flag"));
-        return R.success();
-    }
-
 }
-

+ 0 - 61
hx-service/victoriatourist/src/main/java/com/fjhx/controller/material/MaterialController.java

@@ -1,61 +0,0 @@
-package com.fjhx.controller.material;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.springblade.core.tool.api.R;
-import com.fjhx.entity.material.Material;
-import com.fjhx.params.material.MaterialVo;
-import com.fjhx.service.material.MaterialService;
-import org.springframework.beans.factory.annotation.Autowired;
-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 java.util.Map;
-
-/**
- * <p>
- * 物料 前端控制器
- * </p>
- *
- * @author ${author}
- * @since 2022-11-24
- */
-@RestController
-@RequestMapping("/material")
-public class MaterialController {
-
-    @Autowired
-    private MaterialService materialService;
-
-    @PostMapping("/page")
-    public R page(@RequestBody Map<String, Object> condition){
-        Page<Material> result = materialService.getPage(condition);
-        return R.success(result);
-    }
-
-    @PostMapping("/add")
-    public R add(@RequestBody MaterialVo materialVo){
-        materialService.add(materialVo);
-        return R.success();
-    }
-
-    @PostMapping("/edit")
-    public R edit(@RequestBody MaterialVo materialVo){
-        materialService.edit(materialVo);
-        return R.success();
-    }
-
-    @PostMapping("/delete")
-    public R delete(@RequestBody MaterialVo materialVo){
-        materialService.delete(materialVo);
-        return R.success();
-    }
-
-    @PostMapping("/details")
-    public R details(@RequestBody MaterialVo materialVo){
-        return R.success(materialService.getById(materialVo.getId()));
-    }
-
-}
-

+ 0 - 62
hx-service/victoriatourist/src/main/java/com/fjhx/listener/EasyExcelListener.java

@@ -1,62 +0,0 @@
-package com.fjhx.listener;
-
-import com.alibaba.excel.context.AnalysisContext;
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.fjhx.params.excel.BaseExcelVo;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Consumer;
-
-public class EasyExcelListener<T extends BaseExcelVo> extends AnalysisEventListener<T> {
-    private final int pageSize;
-    private final List<T> list;
-    private final IHandleData<T> handleDataFun;
-    private final Consumer<Exception> handleException;
-    private int radeLine = 0;
-    private Integer totalLine;
-    private int lineNumber = 2;
-
-    public EasyExcelListener(int pageSize, IHandleData<T> handleDataFun, Consumer<Exception> handleExceptionFun) {
-        this.pageSize = pageSize;
-        this.handleDataFun = handleDataFun;
-        this.handleException = handleExceptionFun;
-        list = new ArrayList<>(pageSize);
-    }
-
-    @Override
-    public void invoke(T data, AnalysisContext context) {
-        data.setLineNumber(lineNumber++);
-
-        list.add(data);
-        if (list.size() >= pageSize) {
-            if (totalLine == null) {
-                totalLine = context.readSheetHolder().getApproximateTotalRowNumber() - 1;
-            }
-            radeLine += list.size();
-            handleDataFun.execute(list, totalLine, radeLine);
-            list.clear();
-        }
-    }
-
-    @Override
-    public void doAfterAllAnalysed(AnalysisContext context) {
-        if (list.size() > 0) {
-            if (totalLine == null) {
-                totalLine = context.readSheetHolder().getApproximateTotalRowNumber() - 1;
-            }
-            radeLine += list.size();
-            handleDataFun.execute(list, totalLine, radeLine);
-        }
-    }
-
-    @Override
-    public void onException(Exception exception, AnalysisContext context) {
-        handleException.accept(exception);
-    }
-
-    public interface IHandleData<T> {
-        void execute(List<T> list, int totalLine, int radeLine);
-    }
-
-}

+ 1 - 27
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseMapper.xml

@@ -46,32 +46,6 @@
                  left join product_info pi on ap.goods_id = pi.id
                  LEFT JOIN warehouse w ON ap.receipt_warehouse_id = w.id
             ${ew.customSqlSegment}
-        SELECT
-            t1.id,
-            t1.`code`,
-            t1.purchase_id,
-            t1.purchase_code,
-            t1.goods_id,
-            t1.quantity,
-            t1.arrival_quantity,
-            t1.unit_price,
-            t1.apply_price,
-            t1.arrival_price,
-            t1.plan_arrival_time,
-            t1.receipt_warehouse_id,
-            t1.`status`,
-            t1.cause,
-            t1.create_user,
-            t1.create_time,
-            t2.`type` goodsType,
-            t2.`code` goodsCode,
-            t2.`name` goodsName,
-            t2.unit goodsUnit,
-	        t3.`name` warehouseName
-        FROM
-            apply_purchase t1
-            LEFT JOIN product_info t2 ON t1.goods_id = t2.id
-	        LEFT JOIN warehouse t3 ON t1.receipt_warehouse_id = t3.id
-        ${ew.customSqlSegment}
     </select>
+
 </mapper>

+ 0 - 17
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/material/MaterialMapper.java

@@ -1,17 +0,0 @@
-package com.fjhx.mapper.material;
-
-import com.fjhx.entity.material.Material;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.github.yulichang.base.MPJBaseMapper;
-
-/**
- * <p>
- * 物料 Mapper 接口
- * </p>
- *
- * @author ${author}
- * @since 2022-11-24
- */
-public interface MaterialMapper extends MPJBaseMapper<Material> {
-
-}

+ 0 - 5
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/material/MaterialMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.fjhx.mapper.material.MaterialMapper">
-
-</mapper>

+ 13 - 17
hx-service/victoriatourist/src/main/java/com/fjhx/service/apply/impl/ApplyPurchaseServiceImpl.java

@@ -29,12 +29,7 @@ import org.springframework.stereotype.Service;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -133,17 +128,18 @@ public class ApplyPurchaseServiceImpl extends ServiceImpl<ApplyPurchaseMapper, A
     @Override
     public Page<Map<String, Object>> applyInPage(Condition condition) {
         IWrapper<Object> wrapper = IWrapper.getWrapper(condition);
-        wrapper.func(q -> {
-            Integer status = condition.getStatus();
-            if (status == null) {
-                q.in("ap", ApplyPurchase::getStatus,
-                        ApplyPurchaseStatusEnum.STATUS_30.getKey(),
-                        ApplyPurchaseStatusEnum.STATUS_40.getKey(),
-                        ApplyPurchaseStatusEnum.STATUS_50.getKey());
-            } else {
-                q.eq("ap", ApplyPurchase::getStatus);
-            }
-        })
+        wrapper
+                .func(q -> {
+                    Integer status = condition.getStatus();
+                    if (status == null) {
+                        q.in("ap", ApplyPurchase::getStatus,
+                                ApplyPurchaseStatusEnum.STATUS_30.getKey(),
+                                ApplyPurchaseStatusEnum.STATUS_40.getKey(),
+                                ApplyPurchaseStatusEnum.STATUS_50.getKey());
+                    } else {
+                        q.eq("ap", ApplyPurchase::getStatus);
+                    }
+                })
                 .eq("ap", ApplyPurchase::getReceiptWarehouseId, condition.getLong("warehouseId"))
                 .like("ap", ApplyPurchase::getCode)
                 .like("pi", ProductInfo::getName, condition.getStr("productName"))

+ 4 - 4
hx-service/victoriatourist/src/main/java/com/fjhx/service/classify/impl/ClassifyServiceImpl.java

@@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.entity.classify.Classify;
-import com.fjhx.entity.material.Material;
+import com.fjhx.entity.product.ProductInfo;
 import com.fjhx.enums.classify.ClassifyTypeEnum;
 import com.fjhx.mapper.classify.ClassifyMapper;
 import com.fjhx.params.classify.ClassifyVo;
 import com.fjhx.service.classify.ClassifyService;
-import com.fjhx.service.material.MaterialService;
+import com.fjhx.service.product.ProductInfoService;
 import com.fjhx.utils.TreeUtil;
 import com.fjhx.utils.wrapperUtil.IWrapper;
 import org.springblade.core.log.exception.ServiceException;
@@ -33,7 +33,7 @@ import java.util.Map;
 public class ClassifyServiceImpl extends ServiceImpl<ClassifyMapper, Classify> implements ClassifyService {
 
     @Autowired
-    private MaterialService materialService;
+    private ProductInfoService productInfoService;
 
     @Override
     public Page<Classify> getPage(Map<String, Object> condition) {
@@ -70,7 +70,7 @@ public class ClassifyServiceImpl extends ServiceImpl<ClassifyMapper, Classify> i
         } else {
             if (classifyVo.getType() == ClassifyTypeEnum.CLASSIFY_TYPE_2.getKey()) {
                 //查询是否被物料挂钩
-                List<Material> materials = materialService.lambdaQuery().eq(Material::getClassifyId, classifyVo.getId()).list();
+                List<ProductInfo> materials = productInfoService.lambdaQuery().eq(ProductInfo::getClassifyId, classifyVo.getId()).list();
                 if (Func.isNotEmpty(materials)) {
                     throw new ServiceException("有物料绑定,无法删除!");
                 }

+ 0 - 33
hx-service/victoriatourist/src/main/java/com/fjhx/service/excel/ExcelImportLogService.java

@@ -4,13 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.base.BaseService;
 import com.fjhx.base.Condition;
 import com.fjhx.entity.excel.ExcelImportLog;
-import com.fjhx.params.excel.BaseExcelVo;
 import com.fjhx.params.excel.ExcelProcessingProgress;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.List;
-import java.util.function.Consumer;
-
 /**
  * <p>
  * 服务类
@@ -22,35 +18,6 @@ import java.util.function.Consumer;
 public interface ExcelImportLogService extends BaseService<ExcelImportLog> {
 
     /**
-     * 异步分批处理excel数据
-     *
-     * @param pageSize     当次导入数量
-     * @param flag         缓存标记
-     * @param file         excel文件
-     * @param cls          转换对象
-     * @param businessType 业务类型
-     * @param handleFun    读取到数据处理方法
-     * @param errorFun     发生异常处理方法
-     * @param <T>          对象类型
-     */
-    <T extends BaseExcelVo> void asyncRead(int pageSize, Long flag, MultipartFile file, Class<T> cls, Integer businessType,
-                                           Consumer<List<T>> handleFun, Runnable errorFun);
-
-    /**
-     * 查看处理进度
-     *
-     * @param flag 缓存标记
-     */
-    ExcelProcessingProgress getReadRate(Long flag);
-
-    /**
-     * 停止处理
-     *
-     * @param flag 缓存标记
-     */
-    void stopRead(Long flag);
-
-    /**
      * 保存导入记录
      *
      * @param flag         导入标记

+ 0 - 124
hx-service/victoriatourist/src/main/java/com/fjhx/service/excel/impl/ExcelImportLogServiceImpl.java

@@ -1,20 +1,15 @@
 package com.fjhx.service.excel.impl;
 
-import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.base.BaseEntity;
 import com.fjhx.base.Condition;
-import com.fjhx.config.TaskPoolConfig;
 import com.fjhx.constants.VRedisKeyConstant;
 import com.fjhx.entity.FileInfo;
 import com.fjhx.entity.excel.ExcelImportLog;
 import com.fjhx.feign.IFileClient;
-import com.fjhx.listener.EasyExcelListener;
 import com.fjhx.mapper.excel.ExcelImportLogMapper;
-import com.fjhx.params.excel.BaseExcelVo;
 import com.fjhx.params.excel.ExcelProcessingProgress;
 import com.fjhx.service.excel.ExcelImportLogService;
 import com.fjhx.utils.Assert;
@@ -24,20 +19,11 @@ import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-import org.springframework.util.StringUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.Date;
-import java.util.List;
-import java.util.function.Consumer;
 
 /**
  * <p>
@@ -50,10 +36,6 @@ import java.util.function.Consumer;
 @Service
 public class ExcelImportLogServiceImpl extends ServiceImpl<ExcelImportLogMapper, ExcelImportLog> implements ExcelImportLogService {
 
-    @Qualifier(TaskPoolConfig.excelExecutor)
-    @Autowired
-    private ThreadPoolTaskExecutor executor;
-
     @Resource
     private BladeRedis bladeRedis;
 
@@ -61,112 +43,6 @@ public class ExcelImportLogServiceImpl extends ServiceImpl<ExcelImportLogMapper,
     private IFileClient fileClient;
 
     @Override
-    public <T extends BaseExcelVo> void asyncRead(int pageSize, Long flag, MultipartFile file, Class<T> cls, Integer businessType,
-                                                  Consumer<List<T>> handleFun, Runnable errorFun) {
-
-        String filename = file.getOriginalFilename();
-        if (ObjectUtils.isEmpty(filename)) {
-            throw new ExcelException("请上传文件!");
-        }
-        if ((!StringUtils.endsWithIgnoreCase(filename, ".xls") && !StringUtils.endsWithIgnoreCase(filename, ".xlsx"))) {
-            throw new ExcelException("请上传正确的excel文件!");
-        }
-
-        InputStream inputStream;
-        try {
-            inputStream = new BufferedInputStream(file.getInputStream());
-        } catch (IOException e) {
-            throw new ExcelException("文件读取失败!");
-        }
-
-        // 导入信息放入redis缓存
-        ExcelProcessingProgress excelProcessingProgress = new ExcelProcessingProgress();
-        excelProcessingProgress.setStatus(1); // 预处理阶段
-        excelProcessingProgress.setPercentage(5); // 进度 5%
-        setProgress(flag, excelProcessingProgress); // 保存
-
-        executor.execute(() -> {
-            try {
-                // 开始时间
-                long start = System.currentTimeMillis();
-
-                // 信息保存到数据库
-                saveLog(flag, businessType, file);
-
-                // 开始处理 进度 10%
-                verificationAndUpdateProgress(flag, 2, 10);
-
-                EasyExcel.read(inputStream, cls, new EasyExcelListener<T>(
-                        pageSize,
-                        (list, totalLine, readLine) -> {
-
-                            try {
-                                handleFun.accept(list);
-                            } catch (Exception e) {
-                                // 已完成
-                                excelProcessingProgress.setStatus(4);
-                                excelProcessingProgress.setPercentage(0);
-                                excelProcessingProgress.setErrorMsg(e.getMessage());
-                                setProgress(flag, excelProcessingProgress); // 保存
-                                throw e;
-                            }
-
-                            if (totalLine == readLine) {
-                                editLog(start, flag, 1);
-                                // 已完成
-                                verificationAndUpdateProgress(flag, 5, 100);
-                            } else {
-                                // 处理中
-                                verificationAndUpdateProgress(flag, 3, 10 + readLine * 90 / totalLine);
-                            }
-                        },
-                        (exception) -> {
-                            exception.printStackTrace();
-                            errorFun.run();
-                            // 用户取消
-                            if (exception instanceof ExcelException) {
-                                editLog(start, flag, 3);
-                                verificationAndUpdateProgress(flag, 6, 0);
-                            }
-                            // 发生异常
-                            else {
-                                editLog(start, flag, 2);
-                                verificationAndUpdateProgress(flag, 4, 0);
-                                exception.printStackTrace();
-                                throw new ExcelException("导入异常");
-                            }
-                        })).doReadAll();
-            } catch (Exception e) {
-                e.printStackTrace();
-                log.error(e.getMessage());
-            } finally {
-                IoUtil.close(inputStream);
-            }
-        });
-    }
-
-    @Override
-    public ExcelProcessingProgress getReadRate(Long flag) {
-        ExcelProcessingProgress excelProcessingProgress = bladeRedis.get(VRedisKeyConstant.EXCEL_FLAG_KEY + flag);
-
-        // 如果处理完成、用户取消、发生异常,删除缓存
-        if (excelProcessingProgress != null && excelProcessingProgress.getStatus() > 3) {
-            bladeRedis.del(VRedisKeyConstant.EXCEL_FLAG_KEY + flag);
-        }
-
-        return excelProcessingProgress;
-    }
-
-    @Override
-    public void stopRead(Long flag) {
-        // 导入信息放入redis缓存
-        ExcelProcessingProgress excelProcessingProgress = new ExcelProcessingProgress();
-        excelProcessingProgress.setStatus(6); // 预处理阶段
-        excelProcessingProgress.setPercentage(0); // 进度 0%
-        setProgress(flag, excelProcessingProgress);
-    }
-
-    @Override
     public void saveLog(Long flag, Integer businessType, MultipartFile file) {
 
         R<FileInfo> fileInfoR = fileClient.uploadFile(file);

+ 0 - 28
hx-service/victoriatourist/src/main/java/com/fjhx/service/material/MaterialService.java

@@ -1,28 +0,0 @@
-package com.fjhx.service.material;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.entity.material.Material;
-import com.fjhx.params.material.MaterialVo;
-import com.fjhx.base.BaseService;
-
-import java.util.Map;
-
-/**
- * <p>
- * 物料 服务类
- * </p>
- *
- * @author ${author}
- * @since 2022-11-24
- */
-public interface MaterialService extends BaseService<Material> {
-
-    Page<Material> getPage(Map<String, Object> condition);
-
-    void add(MaterialVo materialVo);
-
-    void edit(MaterialVo materialVo);
-
-    void delete(MaterialVo materialVo);
-
-}

+ 0 - 170
hx-service/victoriatourist/src/main/java/com/fjhx/service/material/impl/MaterialServiceImpl.java

@@ -1,170 +0,0 @@
-package com.fjhx.service.material.impl;
-
-import cn.hutool.core.convert.Convert;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fjhx.entity.classify.Classify;
-import com.fjhx.entity.material.Material;
-import com.fjhx.entity.stock.Stock;
-import com.fjhx.mapper.material.MaterialMapper;
-import com.fjhx.params.material.MaterialVo;
-import com.fjhx.service.classify.ClassifyService;
-import com.fjhx.service.material.MaterialService;
-import com.fjhx.service.stock.StockService;
-import com.fjhx.uitl.code.CodeEnum;
-import com.fjhx.utils.wrapperUtil.IWrapper;
-import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.redis.lock.RedisLockClient;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.system.entity.Dept;
-import org.springblade.system.feign.ISysClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 物料 服务实现类
- * </p>
- *
- * @author ${author}
- * @since 2022-11-24
- */
-@Service
-public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
-
-    @Lazy
-    @Autowired
-    private ClassifyService classifyService;
-
-    @Autowired
-    private StockService stockService;
-
-    @Autowired
-    private RedisLockClient redisLockClient;
-
-    @Autowired
-    private ISysClient iSysClient;
-
-    private final String REDIS_LOCK_CACHE_KEY = "seq:lock:" + AuthUtil.getTenantId() + ":material:";
-
-    @Override
-    public Page<Material> getPage(Map<String, Object> condition) {
-
-        IWrapper<Material> wrapper = IWrapper.getWrapper(condition);
-
-        //处理分类
-        List<Long> classifyIds = new ArrayList<>();
-        if (Func.isNotEmpty(condition.get("classifyId"))) {
-            classifyIds.add(Convert.toLong(condition.get("classifyId")));
-            //查询所有子级
-            List<Classify> classifies = classifyService.lambdaQuery().apply("FIND_IN_SET(" + condition.get("classifyId") + ", parent_id_set)").list();
-            if (Func.isNotEmpty(classifies)) {
-                classifyIds.addAll(classifies.stream().map(Classify::getId).distinct().collect(Collectors.toList()));
-            }
-        }
-
-        //处理部门
-        List<Long> deptIds = new ArrayList<>();
-        if (Func.isNotEmpty(condition.get("deptId"))) {
-            deptIds.add(Convert.toLong(condition.get("deptId")));
-            //查询所有子级
-            List<Dept> depts = iSysClient.getDeptAncestorsById(Convert.toLong(condition.get("deptId")));
-            if (Func.isNotEmpty(depts)) {
-                deptIds.addAll(depts.stream().map(Dept::getId).distinct().collect(Collectors.toList()));
-            }
-        }
-
-        wrapper.eq(Material::getType)
-                .in(Material::getClassifyId, classifyIds)
-                .in(Material::getDeptId, deptIds)
-                .apply(Func.isNotEmpty(condition.get("code")), "instr(`code`, '" + condition.get("code") + "') > 0")
-                .apply(Func.isNotEmpty(condition.get("name")), "instr(`name`, '" + condition.get("name") + "') > 0")
-                .and(Func.isNotEmpty(condition.get("keyword")), o -> o.apply("instr(`code`, '" + condition.get("keyword") + "') > 0").or().apply("instr(`name`, '" + condition.get("keyword") + "') > 0"))
-                .orderByDesc(Material::getId);
-
-        Page<Material> page = page(condition, wrapper);
-        if (Func.isNotEmpty(page.getRecords())) {
-            deptIds = page.getRecords().stream().map(Material::getDeptId).distinct().collect(Collectors.toList());
-            //查询部门
-            Map<Long, Dept> deptMap = iSysClient.getDeptByIdsToMap(deptIds);
-
-            Map<Long, Stock> stockMap = new HashMap<>();
-            //查询库存量
-            if (Func.isNotEmpty(condition.get("warehouseId"))) {
-                //物料ID集合
-                List<Long> ids = page.getRecords().stream().map(Material::getId).distinct().collect(Collectors.toList());
-                List<Stock> stocks = stockService.lambdaQuery().eq(Stock::getWarehouseId, condition.get("warehouseId")).in(Stock::getGoodsId, ids).list();
-                if (Func.isNotEmpty(stocks)) {
-                    stockMap = stocks.stream().collect(Collectors.toMap(Stock::getGoodsId, Function.identity(), (key1, key2) -> key2));
-                }
-            }
-
-            for (Material record : page.getRecords()) {
-                if (Func.isNotEmpty(deptMap) && Func.isNotEmpty(deptMap.get(record.getDeptId()))) {
-                    Dept dept = deptMap.get(record.getDeptId());
-                    record.setDeptName(dept.getDeptName());
-                }
-
-                if (Func.isNotEmpty(stockMap) && Func.isNotEmpty(stockMap.get(record.getId()))) {
-                    Stock stock = stockMap.get(record.getId());
-                    record.setStockQuantity(stock.getQuantity());
-                }
-            }
-        }
-
-        return page;
-    }
-
-    @Override
-    public void add(MaterialVo materialVo) {
-        //查询名称是否已存在
-        if (!checkNameIsExist(null, materialVo.getName())) {
-            throw new ServiceException("该物料名称已存在:" + materialVo.getName());
-        }
-
-        if (
-                !redisLockClient.lockFair(REDIS_LOCK_CACHE_KEY, () -> {
-                    //处理编码
-                    materialVo.setCode(CodeEnum.MATERIAL.getCode(materialVo.getCode()));
-                    save(materialVo);
-                    return true;
-                })
-        ) {
-            throw new ServiceException("当前系统繁忙,请稍后重试!");
-        }
-    }
-
-    private Boolean checkNameIsExist(Long id, String name) {
-        List<Material> list = lambdaQuery().ne(Func.isNotEmpty(id), Material::getId, id).eq(Material::getName, name).list();
-        return !Func.isNotEmpty(list);
-    }
-
-    @Override
-    public void edit(MaterialVo materialVo) {
-        //查询名称是否已存在
-        if (!checkNameIsExist(materialVo.getId(), materialVo.getName())) {
-            throw new ServiceException("该物料名称已存在:" + materialVo.getName());
-        }
-        updateById(materialVo);
-    }
-
-    @Override
-    public void delete(MaterialVo materialVo) {
-        //查询是否存在库存
-        List<Stock> stocks = stockService.lambdaQuery().eq(Stock::getGoodsId, materialVo.getId()).list();
-        if (Func.isNotEmpty(stocks)) {
-            throw new ServiceException("该物料还有库存,无法删除!");
-        }
-        removeById(materialVo.getId());
-    }
-
-}

+ 8 - 7
hx-service/victoriatourist/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -3,7 +3,7 @@ package com.fjhx.service.supplier.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fjhx.entity.material.Material;
+import com.fjhx.entity.product.ProductInfo;
 import com.fjhx.entity.supplier.Supplier;
 import com.fjhx.entity.supplier.SupplierPrice;
 import com.fjhx.mapper.supplier.SupplierPriceMapper;
@@ -36,14 +36,15 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
         IWrapper<SupplierPrice> wrapper = IWrapper.getWrapper(condition);
         wrapper.orderByDesc(Supplier::getId)
                 .keyword(new KeywordData("s", Supplier::getName),
-                        new KeywordData("pi", Material::getName),
-                        new KeywordData("pi", Material::getCode))
+                        new KeywordData("pi", ProductInfo::getName),
+                        new KeywordData("pi", ProductInfo::getCode))
                 .eq("s", Supplier::getId, condition.get("supplierId"))
-                .eq("pi", Material::getId, condition.get("materialId"))
                 .like("s", Supplier::getName, condition.get("supplierName"))
-                .like("pi", Material::getName, condition.get("materialName"))
-                .like("pi", Material::getCode, condition.get("materialCode"))
-                .eq("pi", Material::getType, condition.get("materialType"));
+
+                .eq("pi", ProductInfo::getId, condition.get("materialId"))
+                .eq("pi", ProductInfo::getType, condition.get("materialType"))
+                .like("pi", ProductInfo::getName, condition.get("materialName"))
+                .like("pi", ProductInfo::getCode, condition.get("materialCode"));
 
         return baseMapper.getPage(createPage(condition), wrapper);
     }

+ 0 - 3
hx-service/victoriatourist/src/main/java/com/fjhx/uitl/code/CodeEnum.java

@@ -7,7 +7,6 @@ import cn.hutool.extra.spring.SpringUtil;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fjhx.service.apply.ApplyPurchaseService;
 import com.fjhx.service.customer.CustomerInfoService;
-import com.fjhx.service.material.MaterialService;
 import com.fjhx.service.order.OrderJdService;
 import com.fjhx.service.order.OrderSalesService;
 import com.fjhx.service.product.ProductInfoService;
@@ -25,8 +24,6 @@ public enum CodeEnum {
 
     // 供应商
     SUPPLIER("GY", null, "code", 5, SupplierService.class),
-    // 物料
-    MATERIAL("M", null, "code", 5, MaterialService.class),
     // spu
     SPU("SPU", null, "code", 5, ProductSpuService.class),
     //申购单

+ 1 - 1
hx-service/victoriatourist/src/main/java/com/fjhx/uitl/flow/FlowUserUtil.java

@@ -20,7 +20,7 @@ import org.springblade.system.user.feign.IUserClient;
  */
 public class FlowUserUtil {
 
-    private static IUserClient iUserClient = SpringUtil.getBean(IUserClient.class);
+    private static final IUserClient iUserClient = SpringUtil.getBean(IUserClient.class);
 
     /**
      * 获取下一节点处理人信息