home il y a 2 ans
Parent
commit
bac502dbd3

+ 8 - 1
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/base/StorageBaseService.java

@@ -94,10 +94,17 @@ public interface StorageBaseService<T> extends IService<T> {
     /**
      * 按指定规则删除
      */
-    default boolean remove(SFunction<T, ?> column, Object val) {
+    default boolean remove(SFunction<T, ?> column, Long val) {
         return remove(Wrappers.<T>lambdaQuery().eq(column, val));
     }
 
+    /**
+     * 按指定规则删除
+     */
+    default boolean remove(SFunction<T, ?> column, List<Long> val) {
+        return remove(Wrappers.<T>lambdaQuery().in(column, val));
+    }
+
     @Override
     default boolean save(T entity) {
         setCreateInfo(entity);

+ 5 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/supplier/Supplier.java

@@ -33,6 +33,11 @@ public class Supplier extends StorageBaseEntity {
     private Long bindUserId;
 
     /**
+     * 绑定用户账号
+     */
+    private Long bindUserAccount;
+
+    /**
      * 物料类型
      */
     private String materialClassifyId;

+ 4 - 4
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/supplier/SupplierBank.java

@@ -28,7 +28,7 @@ public class SupplierBank extends StorageBaseEntity {
     /**
      * 对公户名
      */
-    private String accoutName;
+    private String accountName;
 
     /**
      * 开户银行
@@ -38,12 +38,12 @@ public class SupplierBank extends StorageBaseEntity {
     /**
      * 对公账号
      */
-    private String bankAccout;
+    private String bankAccount;
 
     /**
      * 对私户名
      */
-    private String privateAccoutName;
+    private String privateAccountName;
 
     /**
      * 开户银行
@@ -53,7 +53,7 @@ public class SupplierBank extends StorageBaseEntity {
     /**
      * 对私账号
      */
-    private String privateBankAccout;
+    private String privateBankAccount;
 
     /**
      * 逻辑删除 0未删除 1已删除

+ 49 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/supplier/SupplierPriceController.java

@@ -0,0 +1,49 @@
+package com.fjhx.controller.supplier;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.params.supplier.SupplierPriceVo;
+import com.fjhx.service.supplier.SupplierPriceService;
+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.Map;
+
+/**
+ * <p>
+ * 供应商价格维护 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-07
+ */
+@RestController
+@RequestMapping("/supplierPrice")
+public class SupplierPriceController {
+
+    @Autowired
+    private SupplierPriceService supplierPriceService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition) {
+        Page<Map<String, Object>> result = supplierPriceService.getPage(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/add")
+    public R add(@RequestBody SupplierPriceVo supplierPriceVo) {
+        supplierPriceService.add(supplierPriceVo);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody SupplierPriceVo supplierPriceVo) {
+        supplierPriceService.delete(supplierPriceVo);
+        return R.success();
+    }
+
+}
+

+ 23 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/supplier/SupplierPriceMapper.java

@@ -0,0 +1,23 @@
+package com.fjhx.mapper.supplier;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.supplier.SupplierPrice;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商价格维护 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-07
+ */
+public interface SupplierPriceMapper extends BaseMapper<SupplierPrice> {
+
+    Page<Map<String, Object>> getPage(@Param("page") Page<SupplierPrice> page, @Param("ew") QueryWrapper<?> wrapper);
+
+}

+ 20 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/supplier/SupplierPriceMapper.xml

@@ -0,0 +1,20 @@
+<?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.supplier.SupplierPriceMapper">
+
+    <select id="getPage" resultType="java.util.LinkedHashMap">
+        select sp.id,
+               m.code            materialCode,
+               m.name            materialName,
+               m.width,
+               m.unit_weight     unitWeight,
+               s.name            supplierName,
+               sp.price,
+               m.safety_warn_day safetyWarnDay
+        from supplier_price sp
+                 inner join supplier s on sp.material_id = s.id
+                 inner join material m on sp.material_id = m.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 2 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/common/CommonFileService.java

@@ -25,4 +25,6 @@ public interface CommonFileService extends StorageBaseService<CommonFile> {
 
     void delete(Long id);
 
+    void delete(List<Long> idList);
+
 }

+ 5 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/common/impl/CommonFileServiceImpl.java

@@ -83,4 +83,9 @@ public class CommonFileServiceImpl extends ServiceImpl<CommonFileMapper, CommonF
         remove(CommonFile::getBusinessId, id);
     }
 
+    @Override
+    public void delete(List<Long> idList) {
+        remove(CommonFile::getBusinessId, idList);
+    }
+
 }

+ 28 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/SupplierPriceService.java

@@ -0,0 +1,28 @@
+package com.fjhx.service.supplier;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.supplier.SupplierPrice;
+import com.fjhx.params.supplier.SupplierPriceVo;
+import com.fjhx.base.StorageBaseService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商价格维护 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-07
+ */
+public interface SupplierPriceService extends StorageBaseService<SupplierPrice> {
+
+    Page<Map<String, Object>> getPage(Map<String, String> condition);
+
+    void add(SupplierPriceVo supplierPriceVo);
+
+    void edit(SupplierPriceVo supplierPriceVo);
+
+    void delete(SupplierPriceVo supplierPriceVo);
+
+}

+ 53 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -0,0 +1,53 @@
+package com.fjhx.service.supplier.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.entity.supplier.SupplierPrice;
+import com.fjhx.mapper.supplier.SupplierPriceMapper;
+import com.fjhx.params.supplier.SupplierPriceVo;
+import com.fjhx.service.supplier.SupplierPriceService;
+import com.fjhx.utils.WrapperUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商价格维护 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-07
+ */
+@Service
+public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, SupplierPrice> implements SupplierPriceService {
+
+    @Override
+    public Page<Map<String, Object>> getPage(Map<String, String> condition) {
+
+        QueryWrapper<?> wrapper = WrapperUtil.init(condition)
+                .keyword("m.name", "m.code")
+                .eq("s.id", "supplierId")
+                .createTimeDesc()
+                .getWrapper();
+
+        return baseMapper.getPage(createPage(condition), wrapper);
+    }
+
+    @Override
+    public void add(SupplierPriceVo supplierPriceVo) {
+        save(supplierPriceVo);
+    }
+
+    @Override
+    public void edit(SupplierPriceVo supplierPriceVo) {
+        updateById(supplierPriceVo);
+    }
+
+    @Override
+    public void delete(SupplierPriceVo supplierPriceVo) {
+        removeById(supplierPriceVo.getId());
+    }
+
+}

+ 10 - 1
hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/impl/SupplierServiceImpl.java

@@ -67,6 +67,9 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void add(SupplierVo supplierVo) {
+
+        // TODO 创建供应商账号
+
         save(supplierVo);
 
         Long id = supplierVo.getId();
@@ -159,8 +162,14 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
 
         supplierBankService.remove(SupplierBank::getSupplierId, id);
         supplierContactsService.remove(SupplierContacts::getSupplierId, id);
+
+        List<SupplierKeep> list = supplierKeepService.list(SupplierKeep::getSupplierId, id);
+        List<Long> fileList = list.stream().map(SupplierKeep::getFileLinkedId).collect(Collectors.toList());
+
         supplierKeepService.remove(SupplierKeep::getSupplierId, id);
-        commonFileService.delete(id);
+
+        fileList.add(id);
+        commonFileService.delete(fileList);
     }
 
 }