邱宇豪
2023-09-22 07a07e9072946498a7d37c7345f83f9021f5deeb
新增预埋件管理 库存管理、校正记录、预埋件种类
已修改4个文件
已添加14个文件
786 ■■■■■ 文件已修改
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/entity/SysSegment.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/mapper/SysSegmentMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/resources/mapping/SysProjectMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentCorrectionController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentCorrectionEntity.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentGoodsEntity.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentCorrectionMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentRecordMapper.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java 175 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/entity/SysSegment.java
@@ -88,4 +88,5 @@
     */
    private String duration;
    private Integer completedQuantity;
}
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/mapper/SysSegmentMapper.java
@@ -15,6 +15,8 @@
    String segmentNameByOne(String segmentName);
    String segmentNameByProjectName(String unitProjectName);
    void segmentInsert(@Idkey("segmentId") Map<String, Object> values);
    void segmentNeedInsert(@Idkey("id") HashMap<String,Object> segmentNeed);
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java
@@ -3,13 +3,16 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import com.thhy.engineering.modules.biz.engineering.entity.SysProject;
import com.thhy.engineering.modules.biz.engineering.entity.SysSegmentNeed;
import com.thhy.engineering.modules.biz.engineering.entity.SysSegment;
import com.thhy.engineering.modules.biz.engineering.mapper.SysProjectMapper;
import com.thhy.engineering.modules.biz.engineering.mapper.SysSegmentMapper;
import com.thhy.engineering.modules.biz.engineering.service.SysSegmentService;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UserInfoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -18,6 +21,9 @@
import java.util.List;
import java.util.Map;
/**
 * 单位工程管理(标段)
 */
@Service
public class SysSegmentServiceImpl implements SysSegmentService {
@@ -28,9 +34,9 @@
    @Transactional
    public BasicResult segmentInsert(Map<String, Object> values) {
        String segmentName = values.get("segmentName").toString();
        String unitProjectName = values.get("unitProjectName").toString();
        String segmentId =  segmentMapper.segmentNameByOne(segmentName);
        String segmentId =  segmentMapper.segmentNameByProjectName(unitProjectName);
        if(!StringUtil.isEmpty(segmentId)){
            return  BasicResult.faild("11111","error","标段名称被占用");
        }
@@ -112,6 +118,4 @@
        }
        return BasicResult.success("修改成功");
    }
}
hd/pipe/engineeringManage/src/main/resources/mapping/SysProjectMapper.xml
@@ -310,7 +310,7 @@
      where sp.is_use=1
    <if test="proName!=null and proName!='' ">
        and sp.pro_name like concat('%',#{proName},'%')
    </if>segment/segmentList
    </if>
    <if test="companyId!=null and companyId!='' ">
        and sp.company_id=#{companyId}
    </if>
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentCorrectionController.java
对比新文件
@@ -0,0 +1,31 @@
package com.thhy.materials.modules.biz.embedment.controller;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentGoodsService;
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;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 15:23:59
 * 校正记录控制层
 */
@RestController
@RequestMapping(value = "embedmentCorrection")
public class SysEmbedmentCorrectionController {
    @Autowired
    private SysEmbedmentGoodsService sysEmbedmentGoodsService;
    //校正列表
    @PostMapping("/inventoryList")
    public BasicResult inventoryList(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){
        return sysEmbedmentGoodsService.inventoryList(embedmentGoodsDto);
    }
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java
对比新文件
@@ -0,0 +1,41 @@
package com.thhy.materials.modules.biz.embedment.controller;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentGoodsService;
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;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 15:26:16
 * 预埋件库存控制层
 */
@RestController
@RequestMapping(value = "embedmentGoods")
public class SysEmbedmentGoodsController {
    @Autowired
    private SysEmbedmentGoodsService sysEmbedmentGoodsService;
    //预埋件种类新增
    @PostMapping("/insert")
    public BasicResult insert(@RequestBody SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity){
        return sysEmbedmentGoodsService.insert(sysEmbedmentGoodsEntity);
    }
    //预埋件种类修改
    @PostMapping("/update")
    public BasicResult update(@RequestBody SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity){
        return sysEmbedmentGoodsService.update(sysEmbedmentGoodsEntity);
    }
    //预埋件种类查询、库存管理查询
    @PostMapping("/findAll")
    public BasicResult findAll(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){
        return sysEmbedmentGoodsService.findAll(embedmentGoodsDto);
    }
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java
对比新文件
@@ -0,0 +1,16 @@
package com.thhy.materials.modules.biz.embedment.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 15:39:54
 * 入库记录控制层
 */
@RestController
@RequestMapping(value = "embedmentInsetRecord")
public class SysInsetRecordsController {
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java
对比新文件
@@ -0,0 +1,57 @@
package com.thhy.materials.modules.biz.embedment.controller;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentGoodsService;
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 javax.servlet.http.HttpServletResponse;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 15:33:44
 * 库存管理
 */
@RestController
@RequestMapping(value = "embedmentInventoryManagement")
public class SysInventoryManagementController {
    @Autowired
    private SysEmbedmentGoodsService sysEmbedmentGoodsService;
    @PostMapping("/findAll")
    public BasicResult findAll(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){
        return sysEmbedmentGoodsService.findAll(embedmentGoodsDto);
    }
    @PostMapping("/export")
    public void export(@RequestBody EmbedmentGoodsDto embedmentGoodsDto, HttpServletResponse response){
        sysEmbedmentGoodsService.export(embedmentGoodsDto,response);
    }
    /**
     * 预警设置
     * @param embedmentGoodsDto
     * @return
     */
    @PostMapping("/alarmSet")
    public BasicResult alarmSet(EmbedmentGoodsDto embedmentGoodsDto){
        return sysEmbedmentGoodsService.alarmSet(embedmentGoodsDto);
    }
    /**
     * 库存校正
     * @param embedmentGoodsDto
     * @return
     */
    @PostMapping("/inventoryCorrection")
    public BasicResult inventoryCorrection(EmbedmentGoodsDto embedmentGoodsDto){
        return sysEmbedmentGoodsService.inventoryCorrection(embedmentGoodsDto);
    }
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java
对比新文件
@@ -0,0 +1,43 @@
package com.thhy.materials.modules.biz.embedment.dto;
import lombok.Data;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 11:23:15
 * 查询预埋件库存dto
 */
@Data
public class EmbedmentGoodsDto {
    private String id;
    private Integer pageNum;
    private Integer pageSize;
    private String embedmentGoodsName;
    private String companyId;
    /**
     * 预警数量
     */
    private Integer alarmCount;
    /**
     * 校正前
     */
    private Integer correctionBefore;
    /**
     * 校正数量
     */
    private Integer correctionNum;
    /**
     * 校正后
     */
    private Integer correctionAfter;
    private String remark;
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java
对比新文件
@@ -0,0 +1,23 @@
package com.thhy.materials.modules.biz.embedment.dto;
import com.thhy.general.common.enums.test;
import lombok.Data;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 16:03:50
 * 预埋件出入库dto
 */
@Data
public class EmbedmentRecordDto {
    private String embedmentName;
    private String embedmentId;
    private String companyId;
    private String supplierId;
    private String getDepart;
    private String strTime;
    private String endTime;
    private Integer pageNum;
    private Integer pageSize;
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentCorrectionEntity.java
对比新文件
@@ -0,0 +1,66 @@
package com.thhy.materials.modules.biz.embedment.entity;
import com.thhy.general.annotations.Idkey;
import lombok.Data;
import java.util.Date;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 14:32:34
 * 预埋件校正记录
 */
@Data
public class SysEmbedmentCorrectionEntity {
    /**
     *
     */
    @Idkey
    private String id;
    /**
     * 预埋件ID
     */
    private String embedmentId;
    private String embedmentName;
    private String embedmentModel;
    private String unit;
    /**
     * 校正前
     */
    private Integer correctionBefore;
    /**
     * 校正数量
     */
    private Integer correctionNum;
    /**
     * 校正后
     */
    private Integer correctionAfter;
    /**
     * 校正时间
     */
    private Date createTime;
    /**
     * 校正人
     */
    private String createUser;
    private String realName;
    /**
     * 备注
     */
    private String remark;
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table sys_assist_correction
     *
     * @mbg.generated Tue Apr 11 10:36:03 CST 2023
     */
    private static final long serialVersionUID = 1L;
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentGoodsEntity.java
对比新文件
@@ -0,0 +1,92 @@
package com.thhy.materials.modules.biz.embedment.entity;
import com.thhy.general.annotations.Excel;
import com.thhy.general.annotations.Idkey;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 11:04:06
 * 预埋件库存实体
 */
@Data
public class SysEmbedmentGoodsEntity implements Serializable {
    /**
     *
     */
    @Idkey("id")
    private String id;
    /**
     * 预埋件名称
     */
    @Excel(sort = 1,title = "预埋件名称")
    private String embedmentName;
    /**
     * 预埋件类型  字典
     */
    private String embedmentType;
    private String dictName;
    /**
     * 预埋件规格
     */
    @Excel(sort = 2,title = "规格型号")
    private String embedmentModel;
    /**
     * 计量单位
     */
    @Excel(sort = 3,title = "计量单位")
    private String unit;
    /**
     * 库存数量
     */
    private Integer stock;
    /**
     * 位置
     */
    @Excel(sort = 4,title = "位置")
    private String position;
    /**
     * 报警数量
     */
    private Integer alarmCount;
    /**
     * 1可用2不可用
     */
    private Integer isUse;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 创建人
     */
    private String createUser;
    @Excel(sort = 5,title = "备注")
    private String remark;
    private String companyId;
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table sys_assist_good
     *
     * @mbg.generated Tue Apr 11 08:58:47 CST 2023
     */
    private static final long serialVersionUID = 1L;
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java
对比新文件
@@ -0,0 +1,89 @@
package com.thhy.materials.modules.biz.embedment.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@Getter
@Setter
@ToString
public class SysEmbedmentRecordEntity implements Serializable {
    /**
     *
     */
    private String id;
    /**
     * 预埋件ID
     */
    private String EmbedmentId;
    //预埋件名称
    private String EmbedmentName;
    //预埋件规格
    private String EmbedmentModel;
    /**
     * 1入库2出库
     */
    private String stockType;
    /**
     * 出库量/入库量
     */
    private Integer changeStock;
    /**
     * 供应单位
     */
    private String supplierId;
    //供应商名称
    private String supplierName;
    /**
     * 单价
     */
    private BigDecimal singlePrice;
    /**
     * 金额
     */
    private BigDecimal amount;
    /**
     * 备注
     */
    private String remark;
    /**
     * 领料部门
     */
    private String getDepart;
    //部门名称
    private String departName;
    /**
     * 入库人
     */
    private String createUser;
    private String realName;
    /**
     * 入库时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createTime;
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table sys_assist_record
     *
     * @mbg.generated Tue Apr 11 09:37:48 CST 2023
     */
    private static final long serialVersionUID = 1L;
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentCorrectionMapper.java
对比新文件
@@ -0,0 +1,26 @@
package com.thhy.materials.modules.biz.embedment.mapper;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentCorrectionEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 14:47:57
 * 预埋件校正记录mapper
 */
@Mapper
public interface SysEmbedmentCorrectionMapper {
    void insert(SysEmbedmentCorrectionEntity sysEmbedmentCorrectionEntity);
    /**
     * 校正记录列表查询
     * @param embedmentGoodsDto
     * @return
     */
    List<SysEmbedmentCorrectionEntity> inventoryList(EmbedmentGoodsDto embedmentGoodsDto);
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java
对比新文件
@@ -0,0 +1,32 @@
package com.thhy.materials.modules.biz.embedment.mapper;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 11:17:31
 * 预埋件库存mapper
 */
@Mapper
public interface SysEmbedmentGoodsMapper {
    void insert(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity);
    void delete(String id);
    void update(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity);
    List<SysEmbedmentGoodsEntity> findAll(EmbedmentGoodsDto embedmentGoodsDto);
    SysEmbedmentGoodsEntity findEntity(String id);
    String embedmentNameAndType(@Param("embedmentGoodsName") String embedmentGoodsName, @Param("embedmentType") String embedmentType);
    void alarmSet(EmbedmentGoodsDto embedmentGoodsDto);
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentRecordMapper.java
对比新文件
@@ -0,0 +1,44 @@
package com.thhy.materials.modules.biz.embedment.mapper;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 16:02:20
 * 预埋件出入库mapper
 */
@Mapper
public interface SysEmbedmentRecordMapper {
    void insert(SysEmbedmentRecordEntity sysEmbedmentRecordEntity);
    void embedmentRecordDel(String id);
    void update(SysEmbedmentRecordEntity sysEmbedmentRecordEntity);
    /**
     * 入库列表
     * @param embedmentRecordDto
     * @return
     */
    List<SysEmbedmentRecordEntity> embedmentRecordList(EmbedmentRecordDto embedmentRecordDto);
    /**
     * 出库列表
     * @param embedmentRecordDto
     * @return
     */
    List<SysEmbedmentRecordEntity> embedmentRecordOutList(EmbedmentRecordDto embedmentRecordDto);
    /**
     * 查询单条
     * @param id
     * @return
     */
    SysEmbedmentRecordEntity embedmentRecordInfo(String id);
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java
对比新文件
@@ -0,0 +1,34 @@
package com.thhy.materials.modules.biz.embedment.service;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import javax.servlet.http.HttpServletResponse;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 13:32:21
 * 预埋件库存接口
 */
public interface SysEmbedmentGoodsService {
    BasicResult insert(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity);
    BasicResult delete(String id);
    BasicResult update(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity);
    BasicResult findAll(EmbedmentGoodsDto embedmentGoodsDto);
    BasicResult findEntity(String id);
    void export(EmbedmentGoodsDto embedmentGoodsDto, HttpServletResponse response);
    BasicResult alarmSet(EmbedmentGoodsDto embedmentGoodsDto);
    BasicResult inventoryCorrection(EmbedmentGoodsDto embedmentGoodsDto);
    BasicResult inventoryList(EmbedmentGoodsDto embedmentGoodsDto);
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java
对比新文件
@@ -0,0 +1,175 @@
package com.thhy.materials.modules.biz.embedment.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import com.thhy.general.common.BasicResult;
import com.thhy.general.common.BasicStatus;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.exception.BasicException;
import com.thhy.general.utils.ExcelUtils;
import com.thhy.general.utils.UserInfoUtils;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentGoodsDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentCorrectionEntity;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentCorrectionMapper;
import com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentGoodsMapper;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentGoodsService;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 13:32:52
 * 预埋件库存实现
 */
@Service
public class SysEmbedmentGoodsServiceImpl implements SysEmbedmentGoodsService {
    @Autowired
    private RedissonClient redissonClient;
    @Autowired
    private SysEmbedmentGoodsMapper sysEmbedmentGoodsMapper;
    @Autowired
    private SysEmbedmentCorrectionMapper sysEmbedmentCorrectionMapper;
    //=======================种类到此开始=======================
    @Override
    public BasicResult insert(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        sysEmbedmentGoodsEntity.setCompanyId(sysUserInfo.getCompanyId());
        String embedmentName = sysEmbedmentGoodsEntity.getEmbedmentName();
        String embedmentType = sysEmbedmentGoodsEntity.getEmbedmentType();
        String id =  sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,embedmentType);
        if(!StringUtil.isEmpty(id)){
            return BasicResult.faild("11111","error","名称和规格型号不可重复");
        }
        sysEmbedmentGoodsMapper.insert(sysEmbedmentGoodsEntity);
        return BasicResult.success();
    }
    @Override
    public BasicResult delete(String id) {
        sysEmbedmentGoodsMapper.delete(id);
        return BasicResult.success();
    }
    @Override
    public BasicResult update(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        sysEmbedmentGoodsEntity.setCompanyId(sysUserInfo.getCompanyId());
        String embedmentName = sysEmbedmentGoodsEntity.getEmbedmentName();
        String embedmentType = sysEmbedmentGoodsEntity.getEmbedmentType();
        String id =  sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,embedmentType);
        if(!StringUtil.isEmpty(id)){
            return BasicResult.faild("11111","error","名称和规格型号不可重复");
        }
        sysEmbedmentGoodsMapper.update(sysEmbedmentGoodsEntity);
        return BasicResult.success();
    }
    @Override
    public BasicResult findAll(EmbedmentGoodsDto embedmentGoodsDto) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        embedmentGoodsDto.setCompanyId(sysUserInfo.getCompanyId());
        PageHelper.startPage(embedmentGoodsDto.getPageNum(), embedmentGoodsDto.getPageSize());
        List<SysEmbedmentGoodsEntity> all = sysEmbedmentGoodsMapper.findAll(embedmentGoodsDto);
        PageInfo<SysEmbedmentGoodsEntity> pageInfo = new PageInfo<>(all);
        return BasicResult.success(pageInfo);
    }
    @Override
    public BasicResult findEntity(String id) {
        return BasicResult.success(sysEmbedmentGoodsMapper.findEntity(id));
    }
    //=======================种类到此结束=======================
    //=======================库存管理开始=======================
    @Override
    public void export(EmbedmentGoodsDto embedmentGoodsDto, HttpServletResponse response) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        embedmentGoodsDto.setCompanyId(sysUserInfo.getCompanyId());
        List<SysEmbedmentGoodsEntity> all = sysEmbedmentGoodsMapper.findAll(embedmentGoodsDto);
        ExcelUtils.downExcel(all,SysEmbedmentGoodsEntity.class,response,"库存管理");
    }
    /**
     * 预警值设置
     * @param embedmentGoodsDto
     * @return
     */
    @Override
    public BasicResult alarmSet(EmbedmentGoodsDto embedmentGoodsDto) {
        sysEmbedmentGoodsMapper.alarmSet(embedmentGoodsDto);
        return BasicResult.success();
    }
    /**
     * 库存校正
     * @param embedmentGoodsDto
     * @return
     */
    @Override
    public BasicResult inventoryCorrection(EmbedmentGoodsDto embedmentGoodsDto) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        RLock lock = redissonClient.getLock("embedmentlock");
        try {
            if (lock.tryLock(5, 10, TimeUnit.SECONDS)) {
                //此时参数实体获得的id是库存id 更新库存
                SysEmbedmentGoodsEntity s = new SysEmbedmentGoodsEntity();
                s.setId(embedmentGoodsDto.getId());
                s.setStock(embedmentGoodsDto.getCorrectionAfter());
                sysEmbedmentGoodsMapper.update(s);
            } else {
                throw new BasicException(BasicStatus.OP_IS_TIMEOUT);
            }
        } catch (InterruptedException e) {
            throw new BasicException(BasicStatus.OP_IS_REPEAT);
        } finally {
            if (lock.isLocked()) {
                lock.unlock();
            }
        }
        //添加校正记录
        SysEmbedmentCorrectionEntity sc = new SysEmbedmentCorrectionEntity();
        sc.setEmbedmentId(embedmentGoodsDto.getId());
        sc.setCorrectionNum(embedmentGoodsDto.getCorrectionNum());
        sc.setCorrectionAfter(embedmentGoodsDto.getCorrectionAfter());
        sc.setCorrectionBefore(embedmentGoodsDto.getCorrectionBefore());
        sc.setCreateUser(sysUserInfo.getRealName());
        sc.setRemark(embedmentGoodsDto.getRemark());
        sysEmbedmentCorrectionMapper.insert(sc);
        return BasicResult.success();
    }
    //=======================库存管理结束=======================
    //=======================校正记录结束=======================
    /**
     * 校正记录列表
     * @param embedmentGoodsDto
     * @return
     */
    @Override
    public BasicResult inventoryList(EmbedmentGoodsDto embedmentGoodsDto) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        embedmentGoodsDto.setCompanyId(sysUserInfo.getCompanyId());
        PageHelper.startPage(embedmentGoodsDto.getPageNum(), embedmentGoodsDto.getPageSize());
        List<SysEmbedmentCorrectionEntity> sysEmbedmentCorrectionEntities = sysEmbedmentCorrectionMapper.inventoryList(embedmentGoodsDto);
        PageInfo<SysEmbedmentCorrectionEntity> pageInfo = new PageInfo<>(sysEmbedmentCorrectionEntities);
        return BasicResult.success(pageInfo);
    }
    //=======================校正记录结束=======================
}