Browse Source

新增业务模块代码

oyq28 2 years ago
parent
commit
fa186b0c1e

+ 27 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/record/dao/EquRecordMapper.java

@@ -0,0 +1,27 @@
+package com.github.zuihou.business.record.dao;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.github.zuihou.base.mapper.SuperMapper;
+import com.github.zuihou.business.record.entity.EquRecord;
+
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.tomcat.util.bcel.classfile.Constant;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ * Mapper 接口
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @date 2022-08-15
+ */
+@Repository
+public interface EquRecordMapper extends SuperMapper<EquRecord> {
+
+    IPage<EquRecord> pageList(IPage<EquRecord> page, @Param(Constants.WRAPPER) LbqWrapper<EquRecord> recordQueryWrap, DataScope dataScope);
+}

+ 20 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/record/service/EquRecordService.java

@@ -0,0 +1,20 @@
+package com.github.zuihou.business.record.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.service.SuperService;
+import com.github.zuihou.business.record.entity.EquRecord;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+
+/**
+ * <p>
+ * 业务接口
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @date 2022-08-15
+ */
+public interface EquRecordService extends SuperService<EquRecord> {
+
+    IPage<EquRecord> pageList(IPage<EquRecord> page, LbqWrapper<EquRecord> recordQueryWrap);
+}

+ 32 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/record/service/impl/EquRecordServiceImpl.java

@@ -0,0 +1,32 @@
+package com.github.zuihou.business.record.service.impl;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.business.record.dao.EquRecordMapper;
+import com.github.zuihou.business.record.entity.EquRecord;
+import com.github.zuihou.business.record.service.EquRecordService;
+import com.github.zuihou.base.service.SuperServiceImpl;
+
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 业务实现类
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @date 2022-08-15
+ */
+@Slf4j
+@Service
+
+public class EquRecordServiceImpl extends SuperServiceImpl<EquRecordMapper, EquRecord> implements EquRecordService {
+    @Override
+    public IPage<EquRecord> pageList(IPage<EquRecord> page, LbqWrapper<EquRecord> recordQueryWrap) {
+        return baseMapper.pageList(page, recordQueryWrap, new DataScope());
+    }
+}

+ 39 - 0
imcs-bt-be/imcs-business-biz/src/main/resources/mapper_business/base/record/EquRecordMapper.xml

@@ -0,0 +1,39 @@
+<?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.github.zuihou.business.record.dao.EquRecordMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.github.zuihou.business.record.entity.EquRecord">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="create_user" jdbcType="BIGINT" property="createUser"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="update_user" jdbcType="BIGINT" property="updateUser"/>
+        <result column="equ_id" jdbcType="BIGINT" property="equId"/>
+        <result column="material_id" jdbcType="BIGINT" property="materialId"/>
+        <result column="current_material" jdbcType="VARCHAR" property="currentMaterial"/>
+        <result column="replace_material" jdbcType="VARCHAR" property="replaceMaterial"/>
+        <result column="surplus" jdbcType="DECIMAL" property="surplus"/>
+        <result column="specs" jdbcType="VARCHAR" property="specs"/>
+        <result column="date" jdbcType="VARCHAR" property="date"/>
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id,create_time,create_user,update_time,update_user, mt_name, mtrName,barrel_code,
+        equ_id, material_id, current_material, replace_material, surplus, specs, date
+    </sql>
+
+
+    <select id="pageList" resultMap="BaseResultMap" parameterType="String">
+        select
+        <include refid="Base_Column_List"/>
+        from (
+           select r.*, b.barrel_code, m.mt_name, m2.mt_name as mtrName, p.org_id from bt_equ_record r left join bt_material m on r.current_material = m.id
+            left join bt_material m2 on r.replace_material = m2.id
+            left join bt_equ_barrel b on r.material_id = b.id
+            left join imcs_tenant_productionresource p on r.equ_id = p.id
+        ) s ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 53 - 0
imcs-bt-be/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/record/EquRecordController.java

@@ -0,0 +1,53 @@
+package com.github.zuihou.business.controller.record;
+
+import com.github.zuihou.business.record.entity.EquRecord;
+import com.github.zuihou.business.record.dto.EquRecordSaveDTO;
+import com.github.zuihou.business.record.dto.EquRecordUpdateDTO;
+import com.github.zuihou.business.record.dto.EquRecordPageDTO;
+import com.github.zuihou.business.record.service.EquRecordService;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import com.github.zuihou.base.controller.SuperController;
+import com.github.zuihou.base.R;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.github.zuihou.security.annotation.PreAuth;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 前端控制器
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @date 2022-08-15
+ */
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/equRecord")
+@Api(value = "EquRecord", tags = "")
+@PreAuth(replace = "equRecord:")
+public class EquRecordController extends SuperController<EquRecordService, Long, EquRecord, EquRecordPageDTO, EquRecordSaveDTO, EquRecordUpdateDTO> {
+
+    /**
+     * Excel导入后的操作
+     *
+     * @param list
+     */
+    @Override
+    public R<Boolean> handlerImport(List<Map<String, String>> list){
+        List<EquRecord> equRecordList = list.stream().map((map) -> {
+            EquRecord equRecord = EquRecord.builder().build();
+            //TODO 请在这里完成转换
+            return equRecord;
+        }).collect(Collectors.toList());
+
+        return R.success(baseService.saveBatch(equRecordList));
+    }
+}

+ 84 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/record/dto/EquRecordPageDTO.java

@@ -0,0 +1,84 @@
+package com.github.zuihou.business.record.dto;
+
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.zuihou.base.entity.Entity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.Range;
+import lombok.Data;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.github.zuihou.common.constant.DictionaryType;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 实体类
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @since 2022-08-15
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@ApiModel(value = "EquRecordPageDTO", description = "")
+public class EquRecordPageDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 料筒ID
+     */
+    @ApiModelProperty(value = "料筒ID")
+    private Long equId;
+    @ApiModelProperty(value = "")
+    private Long materialId;
+    /**
+     * 当前原料
+     */
+    @ApiModelProperty(value = "当前原料")
+    @NotEmpty(message = "当前原料不能为空")
+    @Length(max = 255, message = "当前原料长度不能超过255")
+    private String currentMaterial;
+    /**
+     * 被换原料
+     */
+    @ApiModelProperty(value = "被换原料")
+    @Length(max = 255, message = "被换原料长度不能超过255")
+    private String replaceMaterial;
+    /**
+     * 余量
+     */
+    @ApiModelProperty(value = "余量")
+    private BigDecimal surplus;
+    /**
+     * 规格
+     */
+    @ApiModelProperty(value = "规格")
+    @Length(max = 10, message = "规格长度不能超过10")
+    private BigDecimal specs;
+    @ApiModelProperty(value = "")
+    @Length(max = 20, message = "长度不能超过20")
+    private String date;
+
+    @ApiModelProperty(value = "原料名称")
+    @Length(max = 255, message = "原料名称长度不能超过255")
+    private String mtName;
+
+}

+ 80 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/record/dto/EquRecordSaveDTO.java

@@ -0,0 +1,80 @@
+package com.github.zuihou.business.record.dto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.zuihou.base.entity.Entity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.Range;
+import lombok.Data;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.github.zuihou.common.constant.DictionaryType;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 实体类
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @since 2022-08-15
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@ApiModel(value = "EquRecordSaveDTO", description = "")
+public class EquRecordSaveDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 料筒ID
+     */
+    @ApiModelProperty(value = "料筒ID")
+    private Long equId;
+    @ApiModelProperty(value = "")
+    private Long materialId;
+    /**
+     * 当前原料
+     */
+    @ApiModelProperty(value = "当前原料")
+    @NotEmpty(message = "当前原料不能为空")
+    @Length(max = 255, message = "当前原料长度不能超过255")
+    private String currentMaterial;
+    /**
+     * 被换原料
+     */
+    @ApiModelProperty(value = "被换原料")
+    @Length(max = 255, message = "被换原料长度不能超过255")
+    private String replaceMaterial;
+    /**
+     * 余量
+     */
+    @ApiModelProperty(value = "余量")
+    private BigDecimal surplus;
+    /**
+     * 规格
+     */
+    @ApiModelProperty(value = "规格")
+    @Length(max = 10, message = "规格长度不能超过10")
+    private BigDecimal specs;
+    @ApiModelProperty(value = "")
+    @Length(max = 20, message = "长度不能超过20")
+    private String date;
+
+
+}

+ 84 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/record/dto/EquRecordUpdateDTO.java

@@ -0,0 +1,84 @@
+package com.github.zuihou.business.record.dto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.zuihou.base.entity.Entity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.Range;
+import com.github.zuihou.base.entity.SuperEntity;
+import lombok.Data;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.github.zuihou.common.constant.DictionaryType;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 实体类
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @since 2022-08-15
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@ApiModel(value = "EquRecordUpdateDTO", description = "")
+public class EquRecordUpdateDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    @NotNull(message = "id不能为空", groups = SuperEntity.Update.class)
+    private Long id;
+
+    /**
+     * 料筒ID
+     */
+    @ApiModelProperty(value = "料筒ID")
+    private Long equId;
+    @ApiModelProperty(value = "")
+    private Long materialId;
+    /**
+     * 当前原料
+     */
+    @ApiModelProperty(value = "当前原料")
+    @NotEmpty(message = "当前原料不能为空")
+    @Length(max = 255, message = "当前原料长度不能超过255")
+    private String currentMaterial;
+    /**
+     * 被换原料
+     */
+    @ApiModelProperty(value = "被换原料")
+    @Length(max = 255, message = "被换原料长度不能超过255")
+    private String replaceMaterial;
+    /**
+     * 余量
+     */
+    @ApiModelProperty(value = "余量")
+    private BigDecimal surplus;
+    /**
+     * 规格
+     */
+    @ApiModelProperty(value = "规格")
+    @Length(max = 10, message = "规格长度不能超过10")
+    private BigDecimal specs;
+    @ApiModelProperty(value = "")
+    @Length(max = 20, message = "长度不能超过20")
+    private String date;
+
+}

+ 142 - 0
imcs-bt-be/imcs-business-entity/src/main/java/com/github/zuihou/business/record/entity/EquRecord.java

@@ -0,0 +1,142 @@
+package com.github.zuihou.business.record.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.zuihou.base.entity.Entity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.Range;
+import java.time.LocalDateTime;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.github.zuihou.common.constant.DictionaryType;
+import static com.github.zuihou.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+/**
+ * <p>
+ * 实体类
+ * 
+ * </p>
+ *
+ * @author zuihou
+ * @since 2022-08-15
+ */
+@Data
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("bt_equ_record")
+@ApiModel(value = "EquRecord", description = "")
+@AllArgsConstructor
+public class EquRecord extends Entity<Long> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 料筒ID
+     */
+    @ApiModelProperty(value = "料筒ID")
+    @TableField("equ_id")
+    @Excel(name = "料筒ID")
+    private Long equId;
+
+    @ApiModelProperty(value = "")
+    @TableField("material_id")
+    @Excel(name = "")
+    private Long materialId;
+
+    /**
+     * 当前原料
+     */
+    @ApiModelProperty(value = "当前原料")
+    @NotEmpty(message = "当前原料不能为空")
+    @Length(max = 255, message = "当前原料长度不能超过255")
+    @TableField(value = "current_material", condition = LIKE)
+    @Excel(name = "当前原料")
+    private String currentMaterial;
+
+    /**
+     * 被换原料
+     */
+    @ApiModelProperty(value = "被换原料")
+    @Length(max = 255, message = "被换原料长度不能超过255")
+    @TableField(value = "replace_material", condition = LIKE)
+    @Excel(name = "被换原料")
+    private String replaceMaterial;
+
+    /**
+     * 余量
+     */
+    @ApiModelProperty(value = "余量")
+    @TableField("surplus")
+    @Excel(name = "余量")
+    private BigDecimal surplus;
+
+    /**
+     * 规格
+     */
+    @ApiModelProperty(value = "规格")
+    @Length(max = 10, message = "规格长度不能超过10")
+    @TableField(value = "specs", condition = LIKE)
+    @Excel(name = "规格")
+    private BigDecimal specs;
+
+    @ApiModelProperty(value = "原料名称")
+    @Length(max = 255, message = "原料名称不能超过255")
+    @TableField(exist = false)
+    @Excel(name = "原料名称")
+    private String mtName;
+
+    @ApiModelProperty(value = "")
+    @Length(max = 20, message = "长度不能超过20")
+    @TableField(value = "date", condition = LIKE)
+    @Excel(name = "")
+    private String date;
+
+
+    @ApiModelProperty(value = "替换原料名称")
+    @Length(max = 255, message = "替换原料不能超过255")
+    @TableField(exist = false)
+    @Excel(name = "替换原料名称")
+    private String mtrName;
+
+    @ApiModelProperty(value = "料筒编号")
+    @Length(max = 255, message = "料筒编号不能超过255")
+    @TableField(exist = false)
+    @Excel(name = "料筒编号")
+    private String barrelCode;
+
+
+    @Builder
+    public EquRecord(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, 
+                    Long equId, Long materialId, String currentMaterial, String replaceMaterial, BigDecimal surplus,
+                    BigDecimal specs, String date) {
+        this.id = id;
+        this.createTime = createTime;
+        this.createUser = createUser;
+        this.updateTime = updateTime;
+        this.updateUser = updateUser;
+        this.equId = equId;
+        this.materialId = materialId;
+        this.currentMaterial = currentMaterial;
+        this.replaceMaterial = replaceMaterial;
+        this.surplus = surplus;
+        this.specs = specs;
+        this.date = date;
+    }
+
+}