Bläddra i källkod

1.供应商管理2.采购、入库整合供应商

lizhenhao 2 år sedan
förälder
incheckning
70969018a6
17 ändrade filer med 844 tillägg och 3 borttagningar
  1. 1 1
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/invoice/mapper/xml/CwFinanceInvoiceMapper.xml
  2. 15 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/purchase/domain/MaterialDetailed.java
  3. 15 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/purchase/service/MaterialService.java
  4. 93 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/controller/MaterialSupplierController.java
  5. 73 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/domain/MaterialSupplier.java
  6. 64 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/domain/MaterialSupplierLink.java
  7. 11 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/MaterialSupplierLinkMapper.java
  8. 20 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/MaterialSupplierMapper.java
  9. 42 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/xml/MaterialSupplierLinkMapper.xml
  10. 131 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/xml/MaterialSupplierMapper.xml
  11. 137 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/MaterialSupplierService.java
  12. 88 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/dto/MaterialSupplierDTO.java
  13. 60 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/dto/MaterialSupplierLinkDTO.java
  14. 17 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/mapstruct/MaterialSupplierLinkWrapper.java
  15. 17 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/mapstruct/MaterialSupplierWrapper.java
  16. 15 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/wareHouse/domain/WareHouseDetailed.java
  17. 45 2
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/wareHouse/service/WareHouseBasicService.java

+ 1 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/invoice/mapper/xml/CwFinanceInvoiceMapper.xml

@@ -255,7 +255,7 @@
         select
         <include refid="Base_Column_List"></include>
         from cw_finance_invoice fi
-        where fi.del_flag = '0' and fi.id = ${id}
+        where fi.del_flag = '0' and fi.id = #{id}
     </select>
 
     <select id="getIdByProjectId" resultType="string">

+ 15 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/purchase/domain/MaterialDetailed.java

@@ -83,4 +83,19 @@ public class MaterialDetailed extends BaseEntity {
      * 备注
      */
     private String remarks;
+
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+
+    /**
+     * 供应商名称
+     */
+    private String supplierName;
+
+    /**
+     * 1手填供应商  2选择供应商
+     */
+    private String isSupplier;
 }

+ 15 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/purchase/service/MaterialService.java

@@ -1,5 +1,6 @@
 package com.jeeplus.test.materialManagement.purchase.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@@ -17,10 +18,13 @@ import com.jeeplus.test.materialManagement.purchase.domain.MaterialDetailed;
 import com.jeeplus.test.materialManagement.purchase.mapper.MaterialBasicMapper;
 import com.jeeplus.test.materialManagement.purchase.mapper.MaterialDetailedMapper;
 import com.jeeplus.test.materialManagement.purchase.service.dto.MaterialInfoDto;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.mapper.MaterialSupplierMapper;
 import com.jeeplus.test.mould.service.SerialnumTplService;
 import com.jeeplus.test.oss.domain.WorkAttachment;
 import com.jeeplus.test.oss.mapper.OssServiceMapper;
 import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import org.springframework.beans.BeanUtils;
@@ -54,6 +58,9 @@ public class MaterialService {
     @Resource
     private FlowTaskService flowTaskService;
 
+    @Resource
+    private MaterialSupplierMapper materialSupplierMapper;
+
     /**
      * 列表查询
      */
@@ -322,6 +329,14 @@ public class MaterialService {
             List<MaterialDetailed> detailedList = detailedMapper.getByBasicId(id);
             if (CollectionUtils.isNotEmpty(detailedList)){
                 detailedList.forEach(detailed->{
+                    // 供应商查询
+                    if (StringUtils.isNotBlank(detailed.getIsSupplier()) && "2".equals(detailed.getIsSupplier()) &&
+                            StringUtils.isNotBlank(detailed.getSupplierId())) {
+                        MaterialSupplier materialSupplier = materialSupplierMapper.selectById(detailed.getSupplierId()); // 供应商信息
+                        if (ObjectUtil.isNotEmpty(materialSupplier)) {
+                            detailed.setSupplierName(materialSupplier.getName());
+                        }
+                    }
                     //附件信息
                     List<WorkAttachmentDto> acList = detailedMapper.getByAttachmentId(detailed.getId());
                     if (CollectionUtils.isNotEmpty(acList)) {

+ 93 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/controller/MaterialSupplierController.java

@@ -0,0 +1,93 @@
+package com.jeeplus.test.materialManagement.supplier.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.sys.constant.enums.LogTypeEnum;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.invoice.service.dto.CwFinanceInvoiceDTO;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.service.MaterialSupplierService;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierDTO;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+@Api("供货商管理")
+@RestController
+@RequestMapping(value = "/material/supplier")
+public class MaterialSupplierController {
+
+    @Autowired
+    private MaterialSupplierService materialSupplierService;
+
+    /**
+     * 查询供应商列表
+     * @param materialSupplierDTO
+     * @param page
+     * @return
+     * @throws Exception
+     */
+    @ApiLog("查询供应商列表")
+//    @PreAuthorize("hasAuthority('material:supplier:list')")
+    @GetMapping("list")
+    public ResponseEntity<IPage<MaterialSupplierDTO>> data(MaterialSupplierDTO materialSupplierDTO, Page<MaterialSupplierDTO> page) throws Exception {
+        IPage<MaterialSupplierDTO> result = new Page<MaterialSupplierDTO>();
+        result = materialSupplierService.findList (page, materialSupplierDTO);
+        return ResponseEntity.ok (result);
+    }
+
+    /**
+     * 查询供应商详情
+     * @param id
+     * @return
+     */
+    @ApiLog("查询供应商详情")
+    @PreAuthorize ("hasAnyAuthority('material:supplier:view','material:supplier:add','material:supplier:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam("id") String id) {
+        MaterialSupplierDTO materialSupplierDTO = materialSupplierService.queryById ( id );
+        return ResponseEntity.ok (materialSupplierDTO);
+    }
+
+    /**
+     * 保存供应商数据
+     * @param materialSupplierDTO
+     * @return
+     */
+    @ApiLog(value = "保存供应商数据", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('material:supplier:add','material:supplier:edit')")
+    @PostMapping("save")
+    public ResponseEntity save(@Valid @RequestBody MaterialSupplierDTO materialSupplierDTO) throws Exception {
+        materialSupplierService.saveSupplier(materialSupplierDTO);
+        return ResponseEntity.ok ("操作成功");
+    }
+
+    /**
+     * 删除供应商
+     * @param ids
+     * @return
+     */
+    @ApiLog(value = "删除供应商", type = LogTypeEnum.SAVE)
+    @PreAuthorize ("hasAuthority('material:supplier:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        return materialSupplierService.deleteByIds(ids);
+    }
+
+    /**
+     * 根据名称查询供应商
+     * @param name
+     * @return
+     */
+    @ApiLog("根据名称查询供应商")
+    @GetMapping("findByName")
+    public ResponseEntity findByName(@RequestParam("name") String name) {
+        MaterialSupplier materialSupplier = materialSupplierService.findByName ( name );
+        return ResponseEntity.ok (materialSupplier);
+    }
+}

+ 73 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/domain/MaterialSupplier.java

@@ -0,0 +1,73 @@
+package com.jeeplus.test.materialManagement.supplier.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.query.Query;
+import com.jeeplus.core.query.QueryType;
+import lombok.Data;
+
+/**
+ * 物资-供应商
+ * @TableName material_supplier
+ */
+@Data
+@TableName("material_supplier")
+public class MaterialSupplier extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 名称
+     */
+    @Query(tableColumn = "ms.name",type = QueryType.LIKE)
+    private String name;
+
+    /**
+     * 是否有社会统一信用代码
+     */
+    private String isUscCode;
+
+    /**
+     * 统一社会信用代码
+     */
+    private String uscCode;
+
+    /**
+     * 归属地区
+     */
+    private String reconciliationArea;
+
+    /**
+     * 供应商性质
+     */
+    private String characterIs;
+
+    /**
+     * 邮政编码
+     */
+    private String zipCode;
+
+    /**
+     * 传真
+     */
+    private String fax;
+
+    /**
+     * 联系电话
+     */
+    @Query(tableColumn = "ms.tel_phone",type = QueryType.LIKE)
+    private String telPhone;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    private static final long serialVersionUID = 1L;
+}

+ 64 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/domain/MaterialSupplierLink.java

@@ -0,0 +1,64 @@
+package com.jeeplus.test.materialManagement.supplier.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 物资-供应商-联系人
+ * @TableName material_supplier_link
+ */
+@Data
+@TableName("material_supplier_link")
+public class MaterialSupplierLink extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 联系人姓名
+     */
+    private String name;
+
+    /**
+     * 部门
+     */
+    private String office;
+
+    /**
+     * 职务
+     */
+    private String position;
+
+    /**
+     * 性别
+     */
+    private String sex;
+
+    /**
+     * 联系方式1
+     */
+    private String linkPhone;
+
+    /**
+     * 联系方式2
+     */
+    private String linkMobile;
+
+    /**
+     * E-mail
+     */
+    private String email;
+
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+
+    private static final long serialVersionUID = 1L;
+}

+ 11 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/MaterialSupplierLinkMapper.java

@@ -0,0 +1,11 @@
+package com.jeeplus.test.materialManagement.supplier.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplierLink;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface MaterialSupplierLinkMapper extends BaseMapper<MaterialSupplierLink> {
+
+
+}

+ 20 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/MaterialSupplierMapper.java

@@ -0,0 +1,20 @@
+package com.jeeplus.test.materialManagement.supplier.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface MaterialSupplierMapper extends BaseMapper<MaterialSupplier> {
+
+    IPage<MaterialSupplierDTO> findList(Page<MaterialSupplierDTO> page, @Param(Constants.WRAPPER) QueryWrapper<MaterialSupplier> queryWrapper);
+
+    MaterialSupplierDTO queryById(@Param("id") String id);
+
+}

+ 42 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/xml/MaterialSupplierLinkMapper.xml

@@ -0,0 +1,42 @@
+<?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="generator.mapper.MaterialSupplierLinkMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierLinkDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="office" column="office" jdbcType="VARCHAR"/>
+            <result property="position" column="position" jdbcType="VARCHAR"/>
+            <result property="sex" column="sex" jdbcType="VARCHAR"/>
+            <result property="linkPhone" column="link_phone" jdbcType="VARCHAR"/>
+            <result property="linkMobile" column="link_mobile" jdbcType="VARCHAR"/>
+            <result property="email" column="email" jdbcType="VARCHAR"/>
+            <result property="supplierId" column="supplier_id" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        msl.id,
+        msl.create_by,
+        msl.create_date,
+        msl.update_by,
+        msl.update_date,
+        msl.del_flag,
+        msl.remarks,
+        msl.name,
+        msl.office,
+        msl.position,
+        msl.sex,
+        msl.link_phone,
+        msl.link_mobile,
+        msl.email,
+        msl.supplier_id
+    </sql>
+</mapper>

+ 131 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/mapper/xml/MaterialSupplierMapper.xml

@@ -0,0 +1,131 @@
+<?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.jeeplus.test.materialManagement.supplier.mapper.MaterialSupplierMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="isUscCode" column="is_usc_code" jdbcType="VARCHAR"/>
+            <result property="uscCode" column="usc_code" jdbcType="VARCHAR"/>
+            <result property="reconciliationArea" column="reconciliation_area" jdbcType="VARCHAR"/>
+            <result property="characterIs" column="character_is" jdbcType="VARCHAR"/>
+            <result property="zipCode" column="zip_code" jdbcType="VARCHAR"/>
+            <result property="fax" column="fax" jdbcType="VARCHAR"/>
+            <result property="telPhone" column="tel_phone" jdbcType="VARCHAR"/>
+            <result property="address" column="address" jdbcType="VARCHAR"/>
+            <result property="createName" column="create_name" jdbcType="VARCHAR"/>
+            <collection property="materialSupplierLinkDTOList" column="id" select="getLinkList" ofType="com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierLinkDTO"></collection>
+            <collection property="workAttachmentDtoList" column="id" select="getFileList" ofType="com.jeeplus.test.workContract.service.dto.WorkAttachmentDto"></collection>
+    </resultMap>
+
+    <resultMap id="AttachmentMap" type="com.jeeplus.test.workContract.service.dto.WorkAttachmentDto">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+        <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+        <result property="createBy.name" column="create_name" jdbcType="VARCHAR"/>
+        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+        <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
+        <result property="url" column="url" jdbcType="VARCHAR"/>
+        <result property="name" column="attachment_name" jdbcType="VARCHAR"/>
+        <result property="size" column="file_size" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        ms.id,
+        ms.create_by,
+        ms.create_date,
+        ms.update_by,
+        ms.update_date,
+        ms.del_flag,
+        ms.remarks,
+        ms.name,
+        ms.is_usc_code,
+        ms.usc_code,
+        ms.reconciliation_area,
+        ms.character_is,
+        ms.zip_code,
+        ms.fax,
+        ms.tel_phone,
+        ms.address
+    </sql>
+
+    <sql id="MSL_Column_List">
+        msl.id,
+        msl.create_by,
+        msl.create_date,
+        msl.update_by,
+        msl.update_date,
+        msl.del_flag,
+        msl.remarks,
+        msl.name,
+        msl.office,
+        msl.position,
+        msl.sex,
+        msl.link_phone,
+        msl.link_mobile,
+        msl.email,
+        msl.supplier_id
+    </sql>
+
+    <sql id="File_Column_List">
+        wa.id,
+        wa.create_by,
+        wa.create_date,
+        wa.update_by,
+        wa.update_date,
+        wa.remarks,
+        wa.del_flag,
+        wa.url,
+        wa.type,
+        wa.attachment_id,
+        wa.attachment_name,
+        wa.attachment_flag,
+        wa.module_type,
+        wa.attachment_type,
+        wa.file_size,
+        wa.sort,
+        wa.description
+    </sql>
+
+    <select id="findList" resultMap="BaseResultMap">
+        select
+            <include refid="Base_Column_List"></include>,
+            su.name as create_name
+        from material_supplier ms
+        left join sys_user su on su.id = ms.create_by
+        ${ew.customSqlSegment}
+        order by ms.create_date desc
+    </select>
+
+    <select id="getLinkList" resultType="com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierLinkDTO">
+        select
+            <include refid="MSL_Column_List"></include>
+        from material_supplier_link msl
+        where msl.del_flag = '0' and msl.supplier_id = #{id}
+    </select>
+
+    <select id="getFileList" resultMap="AttachmentMap">
+        select
+            <include refid="File_Column_List"></include>,
+            su.name as create_name
+        from work_attachment wa
+        left join sys_user su on su.id = wa.create_by and su.del_flag = '0'
+        where wa.del_flag = '0' and wa.attachment_id = #{id}
+    </select>
+
+    <select id="queryById" resultMap="BaseResultMap">
+        select
+            <include refid="Base_Column_List"></include>
+        from material_supplier ms
+        where ms.del_flag = '0' and ms.id = #{id}
+    </select>
+</mapper>

+ 137 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/MaterialSupplierService.java

@@ -0,0 +1,137 @@
+package com.jeeplus.test.materialManagement.supplier.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.jeeplus.core.query.QueryWrapperGenerator;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplierLink;
+import com.jeeplus.test.materialManagement.supplier.mapper.MaterialSupplierLinkMapper;
+import com.jeeplus.test.materialManagement.supplier.mapper.MaterialSupplierMapper;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierDTO;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierLinkDTO;
+import com.jeeplus.test.materialManagement.supplier.service.mapstruct.MaterialSupplierLinkWrapper;
+import com.jeeplus.test.materialManagement.supplier.service.mapstruct.MaterialSupplierWrapper;
+import com.jeeplus.test.oss.domain.WorkAttachment;
+import com.jeeplus.test.oss.service.OssService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class MaterialSupplierService extends ServiceImpl<MaterialSupplierMapper, MaterialSupplier> {
+
+    @Autowired
+    private MaterialSupplierMapper materialSupplierMapper;
+
+    @Autowired
+    private MaterialSupplierLinkMapper materialSupplierLinkMapper;
+
+    @Autowired
+    private OssService ossService;
+
+    public IPage<MaterialSupplierDTO> findList(Page<MaterialSupplierDTO> page, MaterialSupplierDTO materialSupplierDTO) throws Exception{
+        QueryWrapper<MaterialSupplier> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( MaterialSupplierWrapper.INSTANCE.toEntity(materialSupplierDTO), MaterialSupplier.class );
+        queryWrapper.eq("ms.del_flag","0");
+        if (ObjectUtil.isNotEmpty(materialSupplierDTO)) {
+            // 根据联系人名称查询
+            if (StringUtils.isNotBlank(materialSupplierDTO.getLinkName())) {
+                List<String> supplierIdList = new ArrayList<>();
+                List<MaterialSupplierLink> materialSupplierLinks = materialSupplierLinkMapper.selectList(new LambdaQueryWrapper<MaterialSupplierLink>().like(MaterialSupplierLink::getName, materialSupplierDTO.getLinkName()));
+                if (CollectionUtil.isNotEmpty(materialSupplierLinks)) {
+                    supplierIdList.addAll(materialSupplierLinks.stream().map(MaterialSupplierLink::getSupplierId).collect(Collectors.toList()));
+                }
+                if (CollectionUtil.isNotEmpty(supplierIdList)) {
+                    queryWrapper.in("ms.id", supplierIdList);
+                } else {
+                    return new Page<>();
+                }
+            }
+        }
+        return materialSupplierMapper.findList(page,queryWrapper);
+    }
+
+    public MaterialSupplierDTO queryById(String id) {
+
+        MaterialSupplierDTO materialSupplierDTO = materialSupplierMapper.queryById(id);
+
+        return materialSupplierDTO;
+    }
+
+    public MaterialSupplier saveSupplier(MaterialSupplierDTO materialSupplierDTO) throws Exception{
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
+        MaterialSupplier materialSupplier = MaterialSupplierWrapper.INSTANCE.toEntity(materialSupplierDTO);
+        this.saveOrUpdate(materialSupplier);
+
+        if (ObjectUtil.isNotEmpty(materialSupplierDTO)) {
+            // 附件
+            ossService.saveOrUpdateFileList(materialSupplierDTO.getWorkAttachmentDtoList(), materialSupplier.getId(),"material_supplier");
+            // 联系人信息
+            if(CollectionUtil.isNotEmpty(materialSupplierDTO.getMaterialSupplierLinkDTOList())){
+                List<String> delIds = materialSupplierDTO.getMaterialSupplierLinkDTOList().stream().distinct().filter(item -> {
+                    if (StringUtils.isNotBlank(item.getId())) {
+                        return true;
+                    }
+                    return false;
+                }).map(MaterialSupplierLinkDTO::getId).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(delIds)){
+                    materialSupplierLinkMapper.delete(new QueryWrapper<MaterialSupplierLink>().lambda()
+                            .eq(MaterialSupplierLink::getSupplierId, materialSupplier.getId())
+                            .notIn(MaterialSupplierLink::getId,delIds));
+                }else{
+                    materialSupplierLinkMapper.delete(new QueryWrapper<MaterialSupplierLink>().lambda().eq(MaterialSupplierLink::getSupplierId, materialSupplier.getId()));
+                }
+                materialSupplierDTO.getMaterialSupplierLinkDTOList().stream().forEach(item->{
+                    MaterialSupplierLink materialSupplierLink = MaterialSupplierLinkWrapper.INSTANCE.toEntity(item);
+                    if(StringUtils.isNotBlank(materialSupplierLink.getId())){
+                        materialSupplierLinkMapper.updateById(materialSupplierLink);
+                    }else{
+                        materialSupplierLink.setSupplierId(materialSupplier.getId());
+                        materialSupplierLinkMapper.insert(materialSupplierLink);
+                    }
+                });
+            }else{
+                materialSupplierLinkMapper.delete(new QueryWrapper<MaterialSupplierLink>().lambda().eq(MaterialSupplierLink::getSupplierId, materialSupplier.getId()));
+            }
+        }
+        return materialSupplier;
+    }
+
+    public ResponseEntity deleteByIds(String ids) {
+        String idArray[] =ids.split(",");
+        if (idArray.length > 0) {
+            List<String> supplierIds = Arrays.asList(idArray);
+            if (CollectionUtil.isNotEmpty(supplierIds)) {
+                // 删除联系人信息
+                materialSupplierLinkMapper.delete(new LambdaQueryWrapper<MaterialSupplierLink>().in(MaterialSupplierLink::getSupplierId, supplierIds));
+                // 删除附件
+                ossService.remove(new LambdaQueryWrapper<WorkAttachment>().in(WorkAttachment::getAttachmentId,supplierIds));
+                // 删除供应商信息
+                this.removeByIds (Lists.newArrayList (idArray));
+            }
+        }
+        return ResponseEntity.ok ("删除成功");
+    }
+
+    public MaterialSupplier findByName(String name) {
+        MaterialSupplier materialSupplier = this.getOne(new LambdaQueryWrapper<MaterialSupplier>().eq(MaterialSupplier::getName, name));
+        return materialSupplier;
+    }
+
+}

+ 88 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/dto/MaterialSupplierDTO.java

@@ -0,0 +1,88 @@
+package com.jeeplus.test.materialManagement.supplier.service.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.service.dto.BaseDTO;
+import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 物资-供应商
+ */
+@Data
+public class MaterialSupplierDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 是否有社会统一信用代码
+     */
+    private String isUscCode;
+
+    /**
+     * 统一社会信用代码
+     */
+    private String uscCode;
+
+    /**
+     * 归属地区
+     */
+    private String reconciliationArea;
+
+    /**
+     * 供应商性质
+     */
+    private String characterIs;
+
+    /**
+     * 邮政编码
+     */
+    private String zipCode;
+
+    /**
+     * 传真
+     */
+    private String fax;
+
+    /**
+     * 联系电话
+     */
+    private String telPhone;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 联系人信息
+     */
+    private List<MaterialSupplierLinkDTO> materialSupplierLinkDTOList;
+
+    /**
+     * 附件信息
+     */
+    private List<WorkAttachmentDto> workAttachmentDtoList;
+
+    /**
+     * 联系人名称(筛选条件)
+     */
+    private String linkName;
+
+    /**
+     * 创建人名称
+     */
+    private String createName;
+
+    private static final long serialVersionUID = 1L;
+}

+ 60 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/dto/MaterialSupplierLinkDTO.java

@@ -0,0 +1,60 @@
+package com.jeeplus.test.materialManagement.supplier.service.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+
+/**
+ * 物资-供应商-联系人
+ */
+@Data
+public class MaterialSupplierLinkDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 联系人姓名
+     */
+    private String name;
+
+    /**
+     * 部门
+     */
+    private String office;
+
+    /**
+     * 职务
+     */
+    private String position;
+
+    /**
+     * 性别
+     */
+    private String sex;
+
+    /**
+     * 联系方式1
+     */
+    private String linkPhone;
+
+    /**
+     * 联系方式2
+     */
+    private String linkMobile;
+
+    /**
+     * E-mail
+     */
+    private String email;
+
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+
+    private static final long serialVersionUID = 1L;
+}

+ 17 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/mapstruct/MaterialSupplierLinkWrapper.java

@@ -0,0 +1,17 @@
+package com.jeeplus.test.materialManagement.supplier.service.mapstruct;
+
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplierLink;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierDTO;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierLinkDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface MaterialSupplierLinkWrapper extends EntityWrapper<MaterialSupplierLinkDTO, MaterialSupplierLink>{
+
+        MaterialSupplierLinkWrapper INSTANCE = Mappers.getMapper(MaterialSupplierLinkWrapper.class);
+
+}

+ 17 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/supplier/service/mapstruct/MaterialSupplierWrapper.java

@@ -0,0 +1,17 @@
+package com.jeeplus.test.materialManagement.supplier.service.mapstruct;
+
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import com.jeeplus.test.cw.invoice.domain.CwFinanceInvoiceBase;
+import com.jeeplus.test.cw.invoice.service.dto.CwFinanceInvoiceBaseDTO;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.service.dto.MaterialSupplierDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface MaterialSupplierWrapper extends EntityWrapper<MaterialSupplierDTO, MaterialSupplier>{
+
+        MaterialSupplierWrapper INSTANCE = Mappers.getMapper(MaterialSupplierWrapper.class);
+
+}

+ 15 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/wareHouse/domain/WareHouseDetailed.java

@@ -114,6 +114,21 @@ public class WareHouseDetailed extends BaseEntity {
      */
     private String warnFlag;
 
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+
+    /**
+     * 供应商名称
+     */
+    private String supplierName;
+
+    /**
+     * 1手填供应商  2选择供应商
+     */
+    private String isSupplier;
+
     @TableField(exist = false)
     private List<WareHouseDetailed> wareHouseDetailed;
 }

+ 45 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/materialManagement/wareHouse/service/WareHouseBasicService.java

@@ -24,6 +24,8 @@ import com.jeeplus.test.materialManagement.purchase.domain.MaterialBasic;
 import com.jeeplus.test.materialManagement.purchase.domain.MaterialDetailed;
 import com.jeeplus.test.materialManagement.purchase.mapper.MaterialBasicMapper;
 import com.jeeplus.test.materialManagement.purchase.mapper.MaterialDetailedMapper;
+import com.jeeplus.test.materialManagement.supplier.domain.MaterialSupplier;
+import com.jeeplus.test.materialManagement.supplier.mapper.MaterialSupplierMapper;
 import com.jeeplus.test.materialManagement.wareHouse.domain.WareHouseBasic;
 import com.jeeplus.test.materialManagement.wareHouse.domain.WareHouseDetailed;
 import com.jeeplus.test.materialManagement.wareHouse.domain.WareHouseSummary;
@@ -94,6 +96,9 @@ public class WareHouseBasicService {
     @Resource
     private OssService ossService;
 
+    @Resource
+    private MaterialSupplierMapper materialSupplierMapper;
+
     /**
      * 列表查询
      */
@@ -227,7 +232,15 @@ public class WareHouseBasicService {
         }
         if (CollectionUtils.isNotEmpty(wareHouseList)){
             wareHouseList.forEach(detailed->{
-                //附件信息
+                // 供应商查询
+                if (StringUtils.isNotBlank(detailed.getIsSupplier()) && "2".equals(detailed.getIsSupplier()) &&
+                        StringUtils.isNotBlank(detailed.getSupplierId())) {
+                    MaterialSupplier materialSupplier = materialSupplierMapper.selectById(detailed.getSupplierId()); // 供应商信息
+                    if (ObjectUtil.isNotEmpty(materialSupplier)) {
+                        detailed.setSupplierName(materialSupplier.getName());
+                    }
+                }
+                // 附件信息
                 List<WorkAttachmentDto> acList = detailedMapper.getByAttachmentId(detailed.getId());
                 if (CollectionUtils.isNotEmpty(acList)) {
                     for (WorkAttachmentDto i : acList) {
@@ -439,6 +452,8 @@ public class WareHouseBasicService {
                             is = true;
                         } else if (judgmentEquals(detailInfo.getRemarks(),ware.getRemarks())) {
                             is = true;
+                        } else if (checkSupplierIsChange(ware, detailInfo)) { // 判断供应商是否改变
+                            is = true;
                         }
                         if (is) {
                             ware.setUpFlag("1");
@@ -466,6 +481,20 @@ public class WareHouseBasicService {
                 ossService.saveOrUpdateFileList(detailInfo.getFileInfoLost(), detailInfo.getId(),"ware_house_detail");
 
             });
+        } else {
+            // 当入库详情列表为空时,所有数据打删除标记
+            List<WareHouseDetailed> wareHouseDetaileds = detailedMapper.selectList(new LambdaQueryWrapper<WareHouseDetailed>().eq(WareHouseDetailed::getBasicId,info.getId()));
+            wareHouseDetaileds.stream().forEach(d -> {
+                d.setUpFlag("2"); // 已删除标记
+                if(StringUtils.isBlank(d.getSourceId())) {
+                    detailedMapper.updateById(d); // 据修改为 删除标记
+                }else{
+                    WareHouseDetailed wareHouseDetailed = detailedMapper.selectById(d.getSourceId());
+                    wareHouseDetailed.setUpFlag("2");
+                    detailedMapper.updateById(wareHouseDetailed); // 原数据修改为 删除标记
+                    detailedMapper.deleteById(d.getId());
+                }
+            });
         }
         // 修改附件信息列表
         ossService.saveOrUpdateFileList(dto.getFiles(), dto.getId(),"ware_house_basic");
@@ -481,7 +510,21 @@ public class WareHouseBasicService {
         if (StringUtils.isBlank(a) && StringUtils.isNotBlank(b)) { // a空  b非空
             return true;
         }
-        if (StringUtils.isNotBlank(a) && StringUtils.isNotBlank(b) && !a.equals(b)) { // a非空  b非空  a、b相等
+        if (StringUtils.isNotBlank(a) && StringUtils.isNotBlank(b) && !a.equals(b)) { // a非空  b非空  a、b不相等
+            return true;
+        }
+        return false;
+    }
+
+    // 判断供应商是否改变
+    public boolean checkSupplierIsChange(WareHouseDetailed oldData, WareHouseDetailed newData) {
+        if (judgmentEquals(oldData.getSupplierId(),newData.getSupplierId())) {
+            return true;
+        }
+        if (judgmentEquals(oldData.getSupplierName(),newData.getSupplierName())) {
+            return true;
+        }
+        if (judgmentEquals(oldData.getIsSupplier(),newData.getIsSupplier())) {
             return true;
         }
         return false;