瀏覽代碼

生产车间优化

home 2 年之前
父節點
當前提交
4d7516221c
共有 21 個文件被更改,包括 244 次插入314 次删除
  1. 7 0
      hx-common/hx-tool/src/main/java/com/fjhx/base/BaseService.java
  2. 2 6
      hx-service-api/iot-management-api/src/main/java/com/fjhx/entity/production/ProductionLine.java
  3. 0 55
      hx-service-api/iot-management-api/src/main/java/com/fjhx/entity/workshop/Workshop.java
  4. 0 22
      hx-service-api/iot-management-api/src/main/java/com/fjhx/params/workshop/WorkshopEx.java
  5. 0 17
      hx-service-api/iot-management-api/src/main/java/com/fjhx/params/workshop/WorkshopVo.java
  6. 3 0
      hx-service/iot-management/src/main/java/com/fjhx/bom/controller/BomController.java
  7. 2 2
      hx-service/iot-management/src/main/java/com/fjhx/bom/controller/BomDetailsController.java
  8. 28 9
      hx-service/iot-management/src/main/java/com/fjhx/bom/service/impl/BomServiceImpl.java
  9. 1 1
      hx-service/iot-management/src/main/java/com/fjhx/production/controller/ProductionLineController.java
  10. 65 0
      hx-service/iot-management/src/main/java/com/fjhx/production/controller/ProductionWorkshopController.java
  11. 3 3
      hx-service/iot-management/src/main/java/com/fjhx/production/mapper/ProductionLineMapper.xml
  12. 16 0
      hx-service/iot-management/src/main/java/com/fjhx/production/mapper/ProductionWorkshopMapper.java
  13. 1 1
      hx-service/iot-management/src/main/java/com/fjhx/production/mapper/ProductionWorkshopMapper.xml
  14. 32 0
      hx-service/iot-management/src/main/java/com/fjhx/production/service/ProductionWorkshopService.java
  15. 2 3
      hx-service/iot-management/src/main/java/com/fjhx/production/service/impl/ProductionLineServiceImpl.java
  16. 81 0
      hx-service/iot-management/src/main/java/com/fjhx/production/service/impl/ProductionWorkshopServiceImpl.java
  17. 0 64
      hx-service/iot-management/src/main/java/com/fjhx/workshop/controller/WorkshopController.java
  18. 0 16
      hx-service/iot-management/src/main/java/com/fjhx/workshop/mapper/WorkshopMapper.java
  19. 0 32
      hx-service/iot-management/src/main/java/com/fjhx/workshop/service/WorkshopService.java
  20. 0 81
      hx-service/iot-management/src/main/java/com/fjhx/workshop/service/impl/WorkshopServiceImpl.java
  21. 1 2
      hx-service/storage/src/main/java/com/fjhx/stock/service/impl/StockWaterServiceImpl.java

+ 7 - 0
hx-common/hx-tool/src/main/java/com/fjhx/base/BaseService.java

@@ -56,6 +56,13 @@ public interface BaseService<T> extends IService<T> {
     }
 
     /**
+     * 条件查询
+     */
+    default Integer count(SFunction<T, ?> column, Object val) {
+        return lambdaQuery().eq(column, val).count();
+    }
+
+    /**
      * 按指定规则删除
      */
     default boolean remove(SFunction<T, ?> column, Object val) {

+ 2 - 6
hx-service-api/iot-management-api/src/main/java/com/fjhx/entity/production/ProductionLine.java

@@ -1,12 +1,9 @@
 package com.fjhx.entity.production;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fjhx.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -26,7 +23,7 @@ public class ProductionLine extends BaseEntity {
     /**
      * 所属车间id
      */
-    private Long workshopId;
+    private Long productionWorkshopId;
 
     /**
      * 生产线名称
@@ -60,5 +57,4 @@ public class ProductionLine extends BaseEntity {
     @TableLogic
     private Integer delFlag;
 
-
 }

+ 0 - 55
hx-service-api/iot-management-api/src/main/java/com/fjhx/entity/workshop/Workshop.java

@@ -1,55 +0,0 @@
-package com.fjhx.entity.workshop;
-
-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;
-
-/**
- * <p>
- * 车间
- * </p>
- *
- * @author ${author}
- * @since 2022-06-28
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class Workshop extends BaseEntity {
-
-    /**
-     * 车间名称
-     */
-    private String name;
-
-    /**
-     * 负责人id
-     */
-    private Long responsibleUserId;
-
-    /**
-     * 车间说明
-     */
-    private String introduce;
-
-    /**
-     * 启用状态 1启用 0禁用
-     */
-    private Integer status;
-
-    /**
-     * 备注
-     */
-    private String remarks;
-
-    /**
-     * 逻辑删除 0未删除 1已删除
-     */
-    @TableField(fill = FieldFill.INSERT)
-    @TableLogic
-    private Integer delFlag;
-
-
-}

+ 0 - 22
hx-service-api/iot-management-api/src/main/java/com/fjhx/params/workshop/WorkshopEx.java

@@ -1,22 +0,0 @@
-package com.fjhx.params.workshop;
-
-import com.fjhx.entity.workshop.Workshop;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 车间
- *
- * @author ${author}
- * @since 2022-06-28
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class WorkshopEx extends Workshop {
-
-    /**
-     * 负责人名称
-     */
-    private String responsibleUserName;
-
-}

+ 0 - 17
hx-service-api/iot-management-api/src/main/java/com/fjhx/params/workshop/WorkshopVo.java

@@ -1,17 +0,0 @@
-package com.fjhx.params.workshop;
-
-import com.fjhx.entity.workshop.Workshop;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 车间
- *
- * @author ${author}
- * @since 2022-06-28
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class WorkshopVo extends Workshop {
-
-}

+ 3 - 0
hx-service/iot-management/src/main/java/com/fjhx/bom/controller/BomController.java

@@ -53,6 +53,9 @@ public class BomController {
         return R.success();
     }
 
+    /**
+     * 获取bom已关联的产品分类
+     */
     @PostMapping("/getBomRelationProductClassify")
     public R getBomRelationProductClassify() {
         List<Map<String, Object>> result = bomService.getBomRelationProductClassify();

+ 2 - 2
hx-service/iot-management/src/main/java/com/fjhx/bom/controller/BomDetailsController.java

@@ -1,10 +1,10 @@
 package com.fjhx.bom.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.springblade.core.tool.api.R;
+import com.fjhx.bom.service.BomDetailsService;
 import com.fjhx.entity.bom.BomDetails;
 import com.fjhx.params.bom.BomDetailsVo;
-import com.fjhx.bom.service.BomDetailsService;
+import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;

+ 28 - 9
hx-service/iot-management/src/main/java/com/fjhx/bom/service/impl/BomServiceImpl.java

@@ -1,12 +1,13 @@
 package com.fjhx.bom.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.base.BaseEntity;
 import com.fjhx.bom.mapper.BomMapper;
 import com.fjhx.bom.service.BomService;
-import com.fjhx.constant.ProductLibraryLockConstant;
+import com.fjhx.constant.IotManagementLockConstant;
 import com.fjhx.constants.ErrorMsgConstant;
 import com.fjhx.constants.StatusConstant;
 import com.fjhx.entity.bom.Bom;
@@ -81,15 +82,16 @@ public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomSe
         Assert.notEmpty(productId, "产品id不能为空");
         Assert.notEmpty(bomVo.getEdition(), "版本号不能为空");
 
-        save(bomVo);
         // 保证每个租户物料编码唯一
-//        Boolean flag = redisLockClient.lockFair(ProductLibraryLockConstant.MATERIAL_CODE_ONLY_LOCK + productId,
-//                () -> {
-//
-//                    return true;
-//                });
+        Boolean flag = redisLockClient.lockFair(IotManagementLockConstant.BOM_EDITION_LOCK + productId,
+                () -> {
+                    Integer count = count(Bom::getProductId, productId);
+                    bomVo.setCurrentEdition(count == 0 ? StatusConstant.YES : StatusConstant.No);
+                    save(bomVo);
+                    return true;
+                });
 
-//        Assert.eqTrue(flag, ErrorMsgConstant.SYSTEM_BUSY_ERROR);
+        Assert.eqTrue(flag, ErrorMsgConstant.SYSTEM_BUSY_ERROR);
 
         // 绑定文件
         FileClientUtil.bindingFile(bomVo.getId(), bomVo.getFileInfoParam());
@@ -98,7 +100,24 @@ public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomSe
     @Transactional
     @Override
     public void edit(BomVo bomVo) {
-        updateById(bomVo);
+
+        Long productId = bomVo.getProductId();
+
+        Integer currentEdition = bomVo.getCurrentEdition();
+
+        Assert.notEmpty(currentEdition, "是否启用版本不能为空");
+
+        if (StatusConstant.YES.equals(currentEdition)) {
+            // 保证每个租户物料编码唯一
+            Boolean flag = redisLockClient.lockFair(IotManagementLockConstant.BOM_EDITION_LOCK + productId,
+                    () -> {
+                        update(Wrappers.<Bom>lambdaUpdate().set(Bom::getCurrentEdition, StatusConstant.No).eq(Bom::getProductId, productId));
+                        updateById(bomVo);
+                        return true;
+                    });
+            Assert.eqTrue(flag, ErrorMsgConstant.SYSTEM_BUSY_ERROR);
+        }
+
         // 重新绑定
         FileClientUtil.againBindingFile(bomVo.getId(), bomVo.getFileInfoParam());
     }

+ 1 - 1
hx-service/iot-management/src/main/java/com/fjhx/production/controller/ProductionLineController.java

@@ -2,8 +2,8 @@ package com.fjhx.production.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.params.production.ProductionLineEx;
-import com.fjhx.production.service.ProductionLineService;
 import com.fjhx.params.production.ProductionLineVo;
+import com.fjhx.production.service.ProductionLineService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;

+ 65 - 0
hx-service/iot-management/src/main/java/com/fjhx/production/controller/ProductionWorkshopController.java

@@ -0,0 +1,65 @@
+package com.fjhx.production.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.production.ProductionWorkshop;
+import com.fjhx.params.production.ProductionWorkshopEx;
+import com.fjhx.params.production.ProductionWorkshopVo;
+import com.fjhx.production.service.ProductionWorkshopService;
+import org.springblade.core.tool.api.R;
+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.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 生产车间 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-13
+ */
+@RestController
+@RequestMapping("/productionWorkshop")
+public class ProductionWorkshopController {
+
+    @Autowired
+    private ProductionWorkshopService productionWorkshopService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition) {
+        Page<ProductionWorkshopEx> result = productionWorkshopService.getPage(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/add")
+    public R add(@RequestBody ProductionWorkshopVo productionWorkshopVo) {
+        productionWorkshopService.add(productionWorkshopVo);
+        return R.success();
+    }
+
+    @PostMapping("/edit")
+    public R edit(@RequestBody ProductionWorkshopVo productionWorkshopVo) {
+        productionWorkshopService.edit(productionWorkshopVo);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody ProductionWorkshopVo productionWorkshopVo) {
+        productionWorkshopService.delete(productionWorkshopVo);
+        return R.success();
+    }
+
+    @PostMapping("/list")
+    public R list() {
+        List<ProductionWorkshop> result = productionWorkshopService.getList();
+        return R.success(result);
+    }
+
+
+}
+

+ 3 - 3
hx-service/iot-management/src/main/java/com/fjhx/production/mapper/ProductionLineMapper.xml

@@ -4,14 +4,14 @@
 
     <select id="getPage" resultType="com.fjhx.params.production.ProductionLineEx">
         select pl.id,
-               pl.workshop_id,
+               pl.production_workshop_id,
                pl.name,
                pl.capacity,
                pl.introduce,
                pl.status,
-               w.name workshopName
+               pw.name productionWorkshopName
         from production_line pl
-                 left join workshop w on pl.workshop_id = w.id
+                 left join production_workshop pw on pl.production_workshop_id = pw.id
             ${ew.customSqlSegment}
     </select>
 

+ 16 - 0
hx-service/iot-management/src/main/java/com/fjhx/production/mapper/ProductionWorkshopMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.production.mapper;
+
+import com.fjhx.entity.production.ProductionWorkshop;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 生产车间 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-13
+ */
+public interface ProductionWorkshopMapper extends BaseMapper<ProductionWorkshop> {
+
+}

+ 1 - 1
hx-service/iot-management/src/main/java/com/fjhx/workshop/mapper/WorkshopMapper.xml → hx-service/iot-management/src/main/java/com/fjhx/production/mapper/ProductionWorkshopMapper.xml

@@ -1,5 +1,5 @@
 <?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.workshop.mapper.WorkshopMapper">
+<mapper namespace="com.fjhx.production.mapper.ProductionWorkshopMapper">
 
 </mapper>

+ 32 - 0
hx-service/iot-management/src/main/java/com/fjhx/production/service/ProductionWorkshopService.java

@@ -0,0 +1,32 @@
+package com.fjhx.production.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.BaseService;
+import com.fjhx.entity.production.ProductionWorkshop;
+import com.fjhx.params.production.ProductionWorkshopEx;
+import com.fjhx.params.production.ProductionWorkshopVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 生产车间 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-13
+ */
+public interface ProductionWorkshopService extends BaseService<ProductionWorkshop> {
+
+    Page<ProductionWorkshopEx> getPage(Map<String, String> condition);
+
+    void add(ProductionWorkshopVo productionWorkshopVo);
+
+    void edit(ProductionWorkshopVo productionWorkshopVo);
+
+    void delete(ProductionWorkshopVo productionWorkshopVo);
+
+    List<ProductionWorkshop> getList();
+
+}

+ 2 - 3
hx-service/iot-management/src/main/java/com/fjhx/production/service/impl/ProductionLineServiceImpl.java

@@ -5,9 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.entity.production.ProductionLine;
 import com.fjhx.params.production.ProductionLineEx;
+import com.fjhx.params.production.ProductionLineVo;
 import com.fjhx.production.mapper.ProductionLineMapper;
 import com.fjhx.production.service.ProductionLineService;
-import com.fjhx.params.production.ProductionLineVo;
 import com.fjhx.utils.WrapperUtil;
 import org.springframework.stereotype.Service;
 
@@ -33,8 +33,7 @@ public class ProductionLineServiceImpl extends ServiceImpl<ProductionLineMapper,
                 .eqTenantId("pl")
                 .createTimeDesc("pl")
                 .getWrapper();
-        Page<ProductionLineEx> page = baseMapper.getPage(createPage(condition), wrapper);
-        return page;
+        return baseMapper.getPage(createPage(condition), wrapper);
     }
 
     @Override

+ 81 - 0
hx-service/iot-management/src/main/java/com/fjhx/production/service/impl/ProductionWorkshopServiceImpl.java

@@ -0,0 +1,81 @@
+package com.fjhx.production.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.base.BaseEntity;
+import com.fjhx.entity.production.ProductionWorkshop;
+import com.fjhx.params.production.ProductionWorkshopEx;
+import com.fjhx.params.production.ProductionWorkshopVo;
+import com.fjhx.production.mapper.ProductionWorkshopMapper;
+import com.fjhx.production.service.ProductionWorkshopService;
+import com.fjhx.utils.HxBeanUtil;
+import com.fjhx.utils.UserClientUtil;
+import com.fjhx.utils.WrapperUtil;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 生产车间 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-13
+ */
+@Service
+public class ProductionWorkshopServiceImpl extends ServiceImpl<ProductionWorkshopMapper, ProductionWorkshop> implements ProductionWorkshopService {
+
+    @Override
+    public Page<ProductionWorkshopEx> getPage(Map<String, String> condition) {
+
+        QueryWrapper<ProductionWorkshop> wrapper = Wrappers.query();
+
+        WrapperUtil.init(condition, wrapper)
+                .like("name", "keyword") // 关键字(目前只有车间名称)
+                .eq("status", "status") // 车间状态
+                .eqTenantId()
+                .createTimeDesc();
+
+        Page<ProductionWorkshop> page = page(condition, wrapper);
+
+        // 拓展返回值
+        Page<ProductionWorkshopEx> result = HxBeanUtil.copyPageEx(page, ProductionWorkshopEx.class);
+
+        // 赋值车间负责人名称
+        List<ProductionWorkshopEx> records = result.getRecords();
+        Map<Long, String> userNameMap = UserClientUtil.getUserNameMapFunctionLong(records, ProductionWorkshop::getResponsibleUserId);
+        records.forEach(item -> item.setResponsibleUserName(userNameMap.get(item.getResponsibleUserId())));
+
+        return result;
+    }
+
+    @Override
+    public void add(ProductionWorkshopVo productionWorkshopVo) {
+        save(productionWorkshopVo);
+    }
+
+    @Override
+    public void edit(ProductionWorkshopVo productionWorkshopVo) {
+        updateById(productionWorkshopVo);
+    }
+
+    @Override
+    public void delete(ProductionWorkshopVo productionWorkshopVo) {
+        removeById(productionWorkshopVo.getId());
+    }
+
+    @Override
+    public List<ProductionWorkshop> getList() {
+        return lambdaQuery()
+                .eq(BaseEntity::getTenantId, AuthUtil.getTenantId())
+                .orderByDesc(BaseEntity::getId)
+                .select(BaseEntity::getId, ProductionWorkshop::getName)
+                .list();
+    }
+
+}

+ 0 - 64
hx-service/iot-management/src/main/java/com/fjhx/workshop/controller/WorkshopController.java

@@ -1,64 +0,0 @@
-package com.fjhx.workshop.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.entity.workshop.Workshop;
-import com.fjhx.params.workshop.WorkshopEx;
-import com.fjhx.workshop.service.WorkshopService;
-import com.fjhx.params.workshop.WorkshopVo;
-import org.springblade.core.tool.api.R;
-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.List;
-import java.util.Map;
-
-/**
- * <p>
- * 车间 前端控制器
- * </p>
- *
- * @author ${author}
- * @since 2022-06-28
- */
-@RestController
-@RequestMapping("/workshop")
-public class WorkshopController {
-
-    @Autowired
-    private WorkshopService workshopService;
-
-    @PostMapping("/page")
-    public R page(@RequestBody Map<String, String> condition) {
-        Page<WorkshopEx> result = workshopService.getPage(condition);
-        return R.success(result);
-    }
-
-    @PostMapping("/add")
-    public R add(@RequestBody WorkshopVo workshopVo) {
-        workshopService.add(workshopVo);
-        return R.success();
-    }
-
-    @PostMapping("/edit")
-    public R edit(@RequestBody WorkshopVo workshopVo) {
-        workshopService.edit(workshopVo);
-        return R.success();
-    }
-
-    @PostMapping("/delete")
-    public R delete(@RequestBody WorkshopVo workshopVo) {
-        workshopService.delete(workshopVo);
-        return R.success();
-    }
-
-    @PostMapping("/list")
-    public R list() {
-        List<Workshop> result = workshopService.getList();
-        return R.success(result);
-    }
-
-}
-

+ 0 - 16
hx-service/iot-management/src/main/java/com/fjhx/workshop/mapper/WorkshopMapper.java

@@ -1,16 +0,0 @@
-package com.fjhx.workshop.mapper;
-
-import com.fjhx.entity.workshop.Workshop;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- * 车间 Mapper 接口
- * </p>
- *
- * @author ${author}
- * @since 2022-06-28
- */
-public interface WorkshopMapper extends BaseMapper<Workshop> {
-
-}

+ 0 - 32
hx-service/iot-management/src/main/java/com/fjhx/workshop/service/WorkshopService.java

@@ -1,32 +0,0 @@
-package com.fjhx.workshop.service;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.entity.workshop.Workshop;
-import com.fjhx.params.workshop.WorkshopEx;
-import com.fjhx.params.workshop.WorkshopVo;
-import com.fjhx.base.BaseService;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- * 车间 服务类
- * </p>
- *
- * @author ${author}
- * @since 2022-06-28
- */
-public interface WorkshopService extends BaseService<Workshop> {
-
-    Page<WorkshopEx> getPage(Map<String, String> condition);
-
-    void add(WorkshopVo workshopVo);
-
-    void edit(WorkshopVo workshopVo);
-
-    void delete(WorkshopVo workshopVo);
-
-    List<Workshop> getList();
-
-}

+ 0 - 81
hx-service/iot-management/src/main/java/com/fjhx/workshop/service/impl/WorkshopServiceImpl.java

@@ -1,81 +0,0 @@
-package com.fjhx.workshop.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fjhx.utils.UserClientUtil;
-import com.fjhx.base.BaseEntity;
-import com.fjhx.entity.workshop.Workshop;
-import com.fjhx.params.workshop.WorkshopEx;
-import com.fjhx.params.workshop.WorkshopVo;
-import com.fjhx.workshop.mapper.WorkshopMapper;
-import com.fjhx.workshop.service.WorkshopService;
-import com.fjhx.utils.HxBeanUtil;
-import com.fjhx.utils.WrapperUtil;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- * 车间 服务实现类
- * </p>
- *
- * @author ${author}
- * @since 2022-06-28
- */
-@Service
-public class WorkshopServiceImpl extends ServiceImpl<WorkshopMapper, Workshop> implements WorkshopService {
-
-    @Override
-    public Page<WorkshopEx> getPage(Map<String, String> condition) {
-
-        QueryWrapper<Workshop> wrapper = Wrappers.query();
-
-        WrapperUtil.init(condition, wrapper)
-                .like("name", "keyword") // 关键字(目前只有车间名称)
-                .eq("status", "status") // 车间状态
-                .eqTenantId()
-                .createTimeDesc();
-
-        Page<Workshop> page = page(condition, wrapper);
-
-        // 拓展返回值
-        Page<WorkshopEx> result = HxBeanUtil.copyPageEx(page, WorkshopEx.class);
-
-        // 赋值车间负责人名称
-        List<WorkshopEx> records = result.getRecords();
-        Map<Long, String> userNameMap = UserClientUtil.getUserNameMapFunctionLong(records, Workshop::getResponsibleUserId);
-        records.forEach(item -> item.setResponsibleUserName(userNameMap.get(item.getResponsibleUserId())));
-
-        return result;
-    }
-
-    @Override
-    public void add(WorkshopVo workshopVo) {
-        save(workshopVo);
-    }
-
-    @Override
-    public void edit(WorkshopVo workshopVo) {
-        updateById(workshopVo);
-    }
-
-    @Override
-    public void delete(WorkshopVo workshopVo) {
-        removeById(workshopVo.getId());
-    }
-
-    @Override
-    public List<Workshop> getList() {
-        return lambdaQuery()
-                .eq(BaseEntity::getTenantId, AuthUtil.getTenantId())
-                .orderByDesc(BaseEntity::getId)
-                .select(BaseEntity::getId, Workshop::getName)
-                .list();
-    }
-
-}

+ 1 - 2
hx-service/storage/src/main/java/com/fjhx/stock/service/impl/StockWaterServiceImpl.java

@@ -75,6 +75,7 @@ public class StockWaterServiceImpl extends ServiceImpl<StockWaterMapper, StockWa
                 inkStatistics.put("money", value.stream()
                         .map(item -> ((BigDecimal) item.get("changeNum")).multiply((BigDecimal) item.get("materialPrice")))
                         .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP));
+
                 result.put("inkStatistics", inkStatistics);
 
                 // 墨水领料明细
@@ -98,7 +99,6 @@ public class StockWaterServiceImpl extends ServiceImpl<StockWaterMapper, StockWa
                         })).values());
 
                 result.put("inkDetails", inkDetails);
-
             }
             // 面料统计
             else {
@@ -134,7 +134,6 @@ public class StockWaterServiceImpl extends ServiceImpl<StockWaterMapper, StockWa
                 attribute.put("name",
                         key.equals("0") ? "直喷" : key.equals("1") ? "热转" : key.equals("2") ? "打纸" : "其他");
 
-
                 // 查询子集
                 List<HashMap<String, Object>> children = new ArrayList<>(value.stream().collect(Collectors.toMap(
                         item -> item.get("userId").toString(), // 根据用户id分组