This commit is contained in:
DirectionOfMind 2021-01-05 17:55:38 +08:00
parent c55cb71302
commit e75f0c36c8
5 changed files with 110 additions and 35 deletions

View File

@ -4,7 +4,9 @@ import com.lz.common.emun.EquipmentState;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.annotation.Login;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.equipment.dao.TCountMapper;
import com.lz.modules.equipment.entity.*;
@ -58,6 +60,8 @@ public class EquipmentController extends AbstractController {
private SpecialApplyInfoService specialApplyInfoService;
@Autowired
private TCountMapper tCountMapper;
@Autowired
private DepartmentsStaffRelateService departmentsStaffRelateService;
@GetMapping("findEquipmentById")
@RequiresPermissions("user:device:pandian")
@ -67,10 +71,6 @@ public class EquipmentController extends AbstractController {
return R.ok();
}
FindEquipmentResModel model = new FindEquipmentResModel();
/*//下面的逻辑有bug下周修复20200925 20200927修复注释掉
EquipmentType equipmentType = iEquipmentTypeService.selectByType(equipmentInfo.getType());
EquipmentBrand equipmentBrand = equipmentBrandService.selectByBrand(equipmentInfo.getBrandName());
EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectSpecs(equipmentInfo.getSpecType());*/
BeanUtils.copyProperties(equipmentInfo,model);
model.setState(equipmentInfo.getEquipmentState());
if(equipmentInfo.getSaiId()!=null){
@ -80,20 +80,22 @@ public class EquipmentController extends AbstractController {
model.setTypeId(equipmentInfo.getTypeId());
model.setBrandId(equipmentInfo.getBrandId());
model.setSpecId(equipmentInfo.getSpecsId());
/*Optional.ofNullable(equipmentType).ifPresent(equipmentType1 -> model.setTypeId(equipmentType1.getId()));
Optional.ofNullable(equipmentBrand).ifPresent(equipmentBrand1 -> model.setBrandId(equipmentBrand1.getId()));
Optional.ofNullable(equipmentSpecs).ifPresent(new Consumer<EquipmentSpecs>() {
@Override
public void accept(EquipmentSpecs equipmentSpecs1) {
model.setSpecId(equipmentSpecs1.getId());
}
});*/
Long departmentId = -1L;
if(equipmentInfo.getSaiId()!=null){
SpecialApplyInfo specialApplyInfo = specialApplyInfoService.selectSpecialApplyInfoById(equipmentInfo.getSaiId());
}
if(equipmentInfo.getUserId()!=null){
DepartmentsStaffRelateEntity entity = departmentsStaffRelateService.selectByStaffId(equipmentInfo.getUserId());
}
model.setDepartId(departmentId);
int i = tCountMapper.selectMaxNum();
if(equipmentInfo.getCount()<i){
logger.info("" + i + "次盘点" + code);
equipmentInfo.setCount(i);
iEquipmentInfoService.insertEquipmentInfo(equipmentInfo);
}
addRecord(equipmentInfo);
model.setId(equipmentInfo.getId());
return R.ok().put("data", model);

View File

@ -1,78 +1,107 @@
package com.lz.modules.equipment.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 菜单权限表
* </p>*设备表
* @author quyixiao
* @since 2020-08-10
* @since 2021-01-05
*/
@Data
@TableName("equipment_info")
@ApiModel(value = "设备表")
public class EquipmentInfo implements java.io.Serializable {
//主键id
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//是否删除
@ApiModelProperty(value = "是否删除", name = "isDelete")
private Integer isDelete;
//生成时间
@ApiModelProperty(value = "生成时间", name = "gmtCreate")
private Date gmtCreate;
//修改时间
@ApiModelProperty(value = "修改时间", name = "gmtModified")
private Date gmtModified;
//设备类型描述
@ApiModelProperty(value = "设备类型描述", name = "brandName")
private String brandName;
//设备规格
@ApiModelProperty(value = "设备规格", name = "specType")
private String specType;
//设备类别
@ApiModelProperty(value = "设备类别", name = "type")
private String type;
//数量
@ApiModelProperty(value = "数量", name = "num")
private Long num;
//单位 /
@ApiModelProperty(value = "单位 件/台", name = "unit")
private String unit;
//使用方
@ApiModelProperty(value = "使用方", name = "user")
private String user;
//所属方
@ApiModelProperty(value = "所属方", name = "owner")
private String owner;
//设备本身标识
@ApiModelProperty(value = "设备本身标识", name = "qr")
private String qr;
//设备原有标识
@ApiModelProperty(value = "设备原有标识", name = "originalCode")
private String originalCode;
//现有生成标识
@ApiModelProperty(value = "现有生成标识", name = "code")
private String code;
//备注
@ApiModelProperty(value = "备注", name = "mark")
private String mark;
//最后一次出库时间
@ApiModelProperty(value = "最后一次出库时间", name = "gmtOutbound")
private Date gmtOutbound;
//第一次入库时间
@ApiModelProperty(value = "第一次入库时间", name = "gmtInbound")
private Date gmtInbound;
//0入库 1售出 2不可用 3:调拨 4:申领
@ApiModelProperty(value = "0入库 1售出 2不可用 3:调拨 4:申领", name = "equipmentState")
private Integer equipmentState;
//买入金额
@ApiModelProperty(value = "买入金额", name = "buyAmount")
private BigDecimal buyAmount;
//出售价格
@ApiModelProperty(value = "出售价格", name = "saleAmount")
private BigDecimal saleAmount;
//流水审批编号
@ApiModelProperty(value = "流水审批编号", name = "no")
private String no;
//使用人id
@ApiModelProperty(value = "使用人id", name = "userId")
private Long userId;
//special_apply_info 表id
@ApiModelProperty(value = "special_apply_info 表id", name = "saiId")
private Long saiId;
//-1代表未分类 0代表库存 其他代表部门id
@ApiModelProperty(value = "-1代表未分类 0代表库存 其他代表部门id", name = "departId")
private Long departId;
//第几次盘点
@ApiModelProperty(value = "第几次盘点", name = "count")
private Integer count;
//类型id
@ApiModelProperty(value = "类型id", name = "typeId")
private Long typeId;
//品牌id
@ApiModelProperty(value = "品牌id", name = "brandId")
private Long brandId;
//规格id
@ApiModelProperty(value = "规格id", name = "specsId")
private Long specsId;
/**
* 主键id
@ -419,6 +448,21 @@ public class EquipmentInfo implements java.io.Serializable {
this.saiId = saiId;
}
/**
* -1代表未分类 0代表库存 其他代表部门id
* @return
*/
public Long getDepartId() {
return departId;
}
/**
* -1代表未分类 0代表库存 其他代表部门id
* @param departId
*/
public void setDepartId(Long departId) {
this.departId = departId;
}
/**
* 第几次盘点
* @return
@ -434,26 +478,47 @@ public class EquipmentInfo implements java.io.Serializable {
this.count = count;
}
/**
* 类型id
* @return
*/
public Long getTypeId() {
return typeId;
}
/**
* 类型id
* @param typeId
*/
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
/**
* 品牌id
* @return
*/
public Long getBrandId() {
return brandId;
}
/**
* 品牌id
* @param brandId
*/
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
/**
* 规格id
* @return
*/
public Long getSpecsId() {
return specsId;
}
/**
* 规格id
* @param specsId
*/
public void setSpecsId(Long specsId) {
this.specsId = specsId;
}
@ -484,6 +549,7 @@ public class EquipmentInfo implements java.io.Serializable {
",no=" + no +
",userId=" + userId +
",saiId=" + saiId +
",departId=" + departId +
",count=" + count +
",typeId=" + typeId +
",brandId=" + brandId +

View File

@ -87,4 +87,7 @@ public class FindEquipmentResModel {
@ApiModelProperty(value = "是否为员工使用", name = "employee")
private boolean employee = true;
private Long departId;
}

View File

@ -27,6 +27,7 @@
<result column="no" property="no"/>
<result column="user_id" property="userId"/>
<result column="sai_id" property="saiId"/>
<result column="depart_id" property="departId"/>
<result column="count" property="count"/>
<result column="type_id" property="typeId"/>
<result column="brand_id" property="brandId"/>
@ -36,7 +37,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, brand_name AS brandName, spec_type AS specType, type AS type, num AS num, unit AS unit, user AS user, owner AS owner, qr AS qr, original_code AS originalCode, code AS code, mark AS mark, gmt_outbound AS gmtOutbound, gmt_inbound AS gmtInbound, equipment_state AS equipmentState, buy_amount AS buyAmount, sale_amount AS saleAmount, no AS no, user_id AS userId, sai_id AS saiId, count AS count, type_id AS typeId, brand_id AS brandId, specs_id AS specsId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, brand_name AS brandName, spec_type AS specType, type AS type, num AS num, unit AS unit, user AS user, owner AS owner, qr AS qr, original_code AS originalCode, code AS code, mark AS mark, gmt_outbound AS gmtOutbound, gmt_inbound AS gmtInbound, equipment_state AS equipmentState, buy_amount AS buyAmount, sale_amount AS saleAmount, no AS no, user_id AS userId, sai_id AS saiId, depart_id AS departId, count AS count, type_id AS typeId, brand_id AS brandId, specs_id AS specsId
</sql>
@ -46,7 +47,6 @@
select * from equipment_info where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertEquipmentInfo" parameterType="EquipmentInfo" useGeneratedKeys="true" keyProperty="id" >
insert into equipment_info(
<if test="brandName != null">brand_name, </if>
@ -68,10 +68,11 @@
<if test="no != null">no, </if>
<if test="userId != null">user_id, </if>
<if test="saiId != null">sai_id, </if>
<if test="departId != null">depart_id, </if>
<if test="count != null">count, </if>
<if test="typeId != null">type_id, </if>
<if test="brandId != null">brand_id, </if>
<if test="specsId != null">specs_id, </if>
<if test="count != null">count, </if>
is_delete,
gmt_create,
gmt_modified
@ -95,10 +96,11 @@
<if test="no != null">#{ no}, </if>
<if test="userId != null">#{ userId}, </if>
<if test="saiId != null">#{ saiId}, </if>
<if test="typeId != null">#{typeId}, </if>
<if test="brandId != null">#{brandId}, </if>
<if test="specsId != null">#{specsId}, </if>
<if test="departId != null">#{ departId}, </if>
<if test="count != null">#{ count}, </if>
<if test="typeId != null">#{ typeId}, </if>
<if test="brandId != null">#{ brandId}, </if>
<if test="specsId != null">#{ specsId}, </if>
0,
now(),
now()
@ -131,10 +133,11 @@
<if test="no != null">no = #{no},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="saiId != null">sai_id = #{saiId},</if>
<if test="typeId != null">type_id=#{typeId}, </if>
<if test="brandId != null">brand_id=#{brandId}, </if>
<if test="specsId != null">specs_id=#{specsId}, </if>
<if test="count != null">count = #{count}</if>
<if test="departId != null">depart_id = #{departId},</if>
<if test="count != null">count = #{count},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="brandId != null">brand_id = #{brandId},</if>
<if test="specsId != null">specs_id = #{specsId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -166,10 +169,11 @@
no = #{no},
user_id = #{userId},
sai_id = #{saiId},
type_id=#{typeId},
brand_id=#{brandId},
specs_id=#{specsId},
count = #{count}
depart_id = #{departId},
count = #{count},
type_id = #{typeId},
brand_id = #{brandId},
specs_id = #{specsId}
,gmt_modified = now()
where id = #{id}
</update>

View File

@ -85,7 +85,7 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_result_score"));
list.add(new TablesBean("equipment_info"));
List<TablesBean> list2 = new ArrayList<TablesBean>();