部门 巷道 重量统计

This commit is contained in:
刘汗青
2026-06-08 10:09:26 +08:00
parent 2ffea4b088
commit aab14ac716
12 changed files with 879 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
package com.ruoyi.search.weight.controller;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
import com.ruoyi.search.weight.service.IViewCargoSpaceWeightService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 各巷道重量统计Controller
*
* @author ruoyi
* @date 2026-06-08
*/
@RestController
@RequestMapping("/search/weight")
public class ViewCargoSpaceWeightController extends BaseController
{
@Autowired
private IViewCargoSpaceWeightService viewCargoSpaceWeightService;
/**
* 查询各巷道重量统计列表
*/
@PreAuthorize("@ss.hasPermi('search:weight:list')")
@GetMapping("/list")
public TableDataInfo list(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
startPage();
List<ViewCargoSpaceWeight> list = viewCargoSpaceWeightService.selectViewCargoSpaceWeightList(viewCargoSpaceWeight);
return getDataTable(list);
}
/**
* 导出各巷道重量统计列表
*/
@PreAuthorize("@ss.hasPermi('search:weight:export')")
@Log(title = "各巷道重量统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ViewCargoSpaceWeight viewCargoSpaceWeight)
{
List<ViewCargoSpaceWeight> list = viewCargoSpaceWeightService.selectViewCargoSpaceWeightList(viewCargoSpaceWeight);
ExcelUtil<ViewCargoSpaceWeight> util = new ExcelUtil<ViewCargoSpaceWeight>(ViewCargoSpaceWeight.class);
util.exportExcel(response, list, "各巷道重量统计数据");
}
/**
* 获取各巷道重量统计详细信息
*/
@PreAuthorize("@ss.hasPermi('search:weight:query')")
@GetMapping(value = "/{warehouseId}")
public AjaxResult getInfo(@PathVariable("warehouseId") String warehouseId)
{
return success(viewCargoSpaceWeightService.selectViewCargoSpaceWeightByWarehouseId(warehouseId));
}
/**
* 新增各巷道重量统计
*/
@PreAuthorize("@ss.hasPermi('search:weight:add')")
@Log(title = "各巷道重量统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return toAjax(viewCargoSpaceWeightService.insertViewCargoSpaceWeight(viewCargoSpaceWeight));
}
/**
* 修改各巷道重量统计
*/
@PreAuthorize("@ss.hasPermi('search:weight:edit')")
@Log(title = "各巷道重量统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return toAjax(viewCargoSpaceWeightService.updateViewCargoSpaceWeight(viewCargoSpaceWeight));
}
/**
* 删除各巷道重量统计
*/
@PreAuthorize("@ss.hasPermi('search:weight:remove')")
@Log(title = "各巷道重量统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{warehouseIds}")
public AjaxResult remove(@PathVariable String[] warehouseIds)
{
return toAjax(viewCargoSpaceWeightService.deleteViewCargoSpaceWeightByWarehouseIds(warehouseIds));
}
}

View File

@@ -0,0 +1,99 @@
package com.ruoyi.search.weight.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 各巷道重量统计对象 view_cargo_space_weight
*
* @author ruoyi
* @date 2026-06-08
*/
public class ViewCargoSpaceWeight extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 仓库id */
@Excel(name = "仓库id")
private String warehouseId;
/** 仓库名称 */
@Excel(name = "仓库名称")
private String warehouseName;
/** 巷道 */
@Excel(name = "巷道")
private String roadwayId;
/** 排 */
@Excel(name = "排")
private BigDecimal thePlatoon;
/** 总量 */
@Excel(name = "总量")
private BigDecimal weightTotal;
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setWarehouseName(String warehouseName)
{
this.warehouseName = warehouseName;
}
public String getWarehouseName()
{
return warehouseName;
}
public void setRoadwayId(String roadwayId)
{
this.roadwayId = roadwayId;
}
public String getRoadwayId()
{
return roadwayId;
}
public void setThePlatoon(BigDecimal thePlatoon)
{
this.thePlatoon = thePlatoon;
}
public BigDecimal getThePlatoon()
{
return thePlatoon;
}
public void setWeightTotal(BigDecimal weightTotal)
{
this.weightTotal = weightTotal;
}
public BigDecimal getWeightTotal()
{
return weightTotal;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("warehouseId", getWarehouseId())
.append("warehouseName", getWarehouseName())
.append("roadwayId", getRoadwayId())
.append("thePlatoon", getThePlatoon())
.append("weightTotal", getWeightTotal())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.search.weight.mapper;
import java.util.List;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
/**
* 各巷道重量统计Mapper接口
*
* @author ruoyi
* @date 2026-06-08
*/
public interface ViewCargoSpaceWeightMapper
{
/**
* 查询各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 各巷道重量统计
*/
public ViewCargoSpaceWeight selectViewCargoSpaceWeightByWarehouseId(String warehouseId);
/**
* 查询各巷道重量统计列表
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 各巷道重量统计集合
*/
public List<ViewCargoSpaceWeight> selectViewCargoSpaceWeightList(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 新增各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int insertViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 修改各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int updateViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 删除各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseId(String warehouseId);
/**
* 批量删除各巷道重量统计
*
* @param warehouseIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseIds(String[] warehouseIds);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.search.weight.service;
import java.util.List;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
/**
* 各巷道重量统计Service接口
*
* @author ruoyi
* @date 2026-06-08
*/
public interface IViewCargoSpaceWeightService
{
/**
* 查询各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 各巷道重量统计
*/
public ViewCargoSpaceWeight selectViewCargoSpaceWeightByWarehouseId(String warehouseId);
/**
* 查询各巷道重量统计列表
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 各巷道重量统计集合
*/
public List<ViewCargoSpaceWeight> selectViewCargoSpaceWeightList(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 新增各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int insertViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 修改各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int updateViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 批量删除各巷道重量统计
*
* @param warehouseIds 需要删除的各巷道重量统计主键集合
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseIds(String[] warehouseIds);
/**
* 删除各巷道重量统计信息
*
* @param warehouseId 各巷道重量统计主键
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseId(String warehouseId);
}

View File

@@ -0,0 +1,118 @@
package com.ruoyi.search.weight.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.search.weight.mapper.ViewCargoSpaceWeightMapper;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
import com.ruoyi.search.weight.service.IViewCargoSpaceWeightService;
/**
* 各巷道重量统计Service业务层处理
*
* @author ruoyi
* @date 2026-06-08
*/
@Service
public class ViewCargoSpaceWeightServiceImpl implements IViewCargoSpaceWeightService
{
@Autowired
private ViewCargoSpaceWeightMapper viewCargoSpaceWeightMapper;
/**
* 查询各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 各巷道重量统计
*/
@Override
public ViewCargoSpaceWeight selectViewCargoSpaceWeightByWarehouseId(String warehouseId)
{
return viewCargoSpaceWeightMapper.selectViewCargoSpaceWeightByWarehouseId(warehouseId);
}
/**
* 查询各巷道重量统计列表
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 各巷道重量统计
*/
@Override
public List<ViewCargoSpaceWeight> selectViewCargoSpaceWeightList(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
if (!"admin".equals(SecurityUtils.getUsername())){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
if (CollUtil.isEmpty(roles)) {
//如果未设置角色 ,直接返回空列表
return new ArrayList<>();
}
Optional<SysRole> first = roles.stream().filter(x -> "role1".equals(x.getRoleKey()) || "role3".equals(x.getRoleKey())).findFirst();
if (first.isPresent()){
//二联合普通人员
viewCargoSpaceWeight.setWarehouseId("02");
}
Optional<SysRole> first1 = roles.stream().filter(x -> "role2".equals(x.getRoleKey()) || "role4".equals(x.getRoleKey())).findFirst();
if (first1.isPresent()){
//三联合普通人员
viewCargoSpaceWeight.setWarehouseId("01");
}
}
return viewCargoSpaceWeightMapper.selectViewCargoSpaceWeightList(viewCargoSpaceWeight);
}
/**
* 新增各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
@Override
public int insertViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return viewCargoSpaceWeightMapper.insertViewCargoSpaceWeight(viewCargoSpaceWeight);
}
/**
* 修改各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
@Override
public int updateViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return viewCargoSpaceWeightMapper.updateViewCargoSpaceWeight(viewCargoSpaceWeight);
}
/**
* 批量删除各巷道重量统计
*
* @param warehouseIds 需要删除的各巷道重量统计主键
* @return 结果
*/
@Override
public int deleteViewCargoSpaceWeightByWarehouseIds(String[] warehouseIds)
{
return viewCargoSpaceWeightMapper.deleteViewCargoSpaceWeightByWarehouseIds(warehouseIds);
}
/**
* 删除各巷道重量统计信息
*
* @param warehouseId 各巷道重量统计主键
* @return 结果
*/
@Override
public int deleteViewCargoSpaceWeightByWarehouseId(String warehouseId)
{
return viewCargoSpaceWeightMapper.deleteViewCargoSpaceWeightByWarehouseId(warehouseId);
}
}

View File

@@ -0,0 +1,75 @@
<?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.ruoyi.search.weight.mapper.ViewCargoSpaceWeightMapper">
<resultMap type="ViewCargoSpaceWeight" id="ViewCargoSpaceWeightResult">
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="roadwayId" column="roadway_id" />
<result property="thePlatoon" column="the_platoon" />
<result property="weightTotal" column="weight_total" />
</resultMap>
<sql id="selectViewCargoSpaceWeightVo">
select warehouse_id, warehouse_name, roadway_id, the_platoon, weight_total from view_cargo_space_weight
</sql>
<select id="selectViewCargoSpaceWeightList" parameterType="ViewCargoSpaceWeight" resultMap="ViewCargoSpaceWeightResult">
<include refid="selectViewCargoSpaceWeightVo"/>
<where>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if>
<if test="thePlatoon != null "> and the_platoon = #{thePlatoon}</if>
<if test="weightTotal != null "> and weight_total = #{weightTotal}</if>
</where>
order by warehouse_id, roadway_id, the_platoon
</select>
<select id="selectViewCargoSpaceWeightByWarehouseId" parameterType="String" resultMap="ViewCargoSpaceWeightResult">
<include refid="selectViewCargoSpaceWeightVo"/>
where warehouse_id = #{warehouseId}
</select>
<insert id="insertViewCargoSpaceWeight" parameterType="ViewCargoSpaceWeight">
insert into view_cargo_space_weight
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehouseId != null and warehouseId != ''">warehouse_id,</if>
<if test="warehouseName != null">warehouse_name,</if>
<if test="roadwayId != null">roadway_id,</if>
<if test="thePlatoon != null">the_platoon,</if>
<if test="weightTotal != null">weight_total,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehouseId != null and warehouseId != ''">#{warehouseId},</if>
<if test="warehouseName != null">#{warehouseName},</if>
<if test="roadwayId != null">#{roadwayId},</if>
<if test="thePlatoon != null">#{thePlatoon},</if>
<if test="weightTotal != null">#{weightTotal},</if>
</trim>
</insert>
<update id="updateViewCargoSpaceWeight" parameterType="ViewCargoSpaceWeight">
update view_cargo_space_weight
<trim prefix="SET" suffixOverrides=",">
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if>
<if test="roadwayId != null">roadway_id = #{roadwayId},</if>
<if test="thePlatoon != null">the_platoon = #{thePlatoon},</if>
<if test="weightTotal != null">weight_total = #{weightTotal},</if>
</trim>
where warehouse_id = #{warehouseId}
</update>
<delete id="deleteViewCargoSpaceWeightByWarehouseId" parameterType="String">
delete from view_cargo_space_weight where warehouse_id = #{warehouseId}
</delete>
<delete id="deleteViewCargoSpaceWeightByWarehouseIds" parameterType="String">
delete from view_cargo_space_weight where warehouse_id in
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
#{warehouseId}
</foreach>
</delete>
</mapper>

View File

@@ -103,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dateEnd != null and dateEnd != ''"> and finish_time &lt;= #{dateEnd}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if>
<if test="deptName != null and deptName != ''"> and dept_name = #{deptName}</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>

View File

@@ -109,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productName != null and productName != ''"> and bs.product_name like concat('%',#{productName},'%')</if>
<if test="warehouseId != null and warehouseId != ''"> and bs.warehouse_id = #{warehouseId}</if>
<if test="trayCode != null and trayCode != ''"> and bs.tray_code = #{trayCode}</if>
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if>
<if test="inDateStart != null and inDateStart != '' and inDateEnd != null and inDateEnd != ''"> and bs.in_date between #{inDateStart} and #{inDateEnd}</if>
</where>