领料管理--详情查询

This commit is contained in:
syruan 2024-11-13 11:08:34 +08:00
parent 9ff5a9958c
commit 13fb09a171
9 changed files with 88 additions and 33 deletions

View File

@ -3,6 +3,7 @@ package com.bonus.material.back.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -16,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.back.domain.BackApplyDetails;
import com.bonus.material.back.service.IBackApplyDetailsService;
import com.bonus.common.core.web.controller.BaseController;

View File

@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -63,7 +64,7 @@ public class LeaseApplyInfoController extends BaseController {
@ApiOperation(value = "获取领料任务详细信息")
//@RequiresPermissions("lease:info:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
public AjaxResult getInfo(@PathVariable("id") @NotNull(message = "领料任务ID不能为空") Long id) {
return success(leaseApplyInfoService.selectLeaseApplyInfoById(id));
}

View File

@ -56,5 +56,20 @@ public class LeaseApplyDetails extends BaseEntity {
@ApiModelProperty(value = "数据所属组织")
private Long companyId;
public LeaseApplyDetails(Long id, Long parentId, Long typeId, Long preNum, Long auditNum, Long alNum, String status, Long companyId) {
this.id = id;
this.parentId = parentId;
this.typeId = typeId;
this.preNum = preNum;
this.auditNum = auditNum;
this.alNum = alNum;
this.status = status;
this.companyId = companyId;
}
public LeaseApplyDetails() {}
public LeaseApplyDetails(Long parentId) {
this.parentId = parentId;
}
}

View File

@ -1,15 +1,12 @@
package com.bonus.material.lease.domain.vo;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.LeaseApplyInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
import java.util.List;
/**
@ -20,6 +17,7 @@ import java.util.List;
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class LeaseApplyRequestVo extends BaseEntity {

View File

@ -32,6 +32,14 @@ public interface LeaseOutDetailsMapper {
*/
public List<LeaseOutDetails> selectLeaseOutDetailsList(LeaseOutDetails leaseOutDetails);
/**
* 查询领料出库详细列表--by任务id
*
* @param parentId 任务id
* @return 领料出库详细集合
*/
List<LeaseOutDetails> selectLeaseOutDetailsListByParentId(String parentId);
/**
* 新增领料出库详细
*

View File

@ -20,7 +20,7 @@ public interface ILeaseApplyInfoService {
* @param id 领料任务主键
* @return 领料任务
*/
public LeaseApplyInfo selectLeaseApplyInfoById(Long id);
LeaseApplyRequestVo selectLeaseApplyInfoById(Long id);
/**
* 查询领料任务列表

View File

@ -1,6 +1,7 @@
package com.bonus.material.lease.service.impl;
import java.util.List;
import java.util.Optional;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
@ -9,12 +10,9 @@ import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.domain.dto.PurchaseCheckDto;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
@ -50,6 +48,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Resource
TmTaskAgreementMapper tmTaskAgreementMapper;
/**
* 查询领料任务
*
@ -57,9 +56,28 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
* @return 领料任务
*/
@Override
public LeaseApplyInfo selectLeaseApplyInfoById(Long id) {
return leaseApplyInfoMapper.selectLeaseApplyInfoById(id);
public LeaseApplyRequestVo selectLeaseApplyInfoById(Long id) {
try {
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(id));
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
optionalInfo.ifPresent(info -> {
leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(id));
if (!CollectionUtils.isEmpty(details)) {
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
}
});
return leaseApplyRequestVo;
} catch (Exception e) {
// 记录异常日志
System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage());
throw new RuntimeException("Failed to select lease apply info", e);
}
}
/**
* 查询领料任务列表

View File

@ -25,25 +25,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectLeaseApplyDetailsVo">
select id, parent_id, type_id, pre_num, audit_num, al_num, status, create_by, create_time, update_by, update_time, remark, company_id from lease_apply_details
select
lad.id, lad.parent_id, lad.type_id, lad.pre_num, lad.audit_num, lad.al_num, lad.status,
lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id
from
lease_apply_details lad
</sql>
<select id="selectLeaseApplyDetailsList" parameterType="com.bonus.material.lease.domain.LeaseApplyDetails" resultMap="LeaseApplyDetailsResult">
<include refid="selectLeaseApplyDetailsVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="preNum != null "> and pre_num = #{preNum}</if>
<if test="auditNum != null "> and audit_num = #{auditNum}</if>
<if test="alNum != null "> and al_num = #{alNum}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="parentId != null "> and lad.parent_id = #{parentId}</if>
<if test="typeId != null "> and lad.type_id = #{typeId}</if>
<if test="preNum != null "> and lad.pre_num = #{preNum}</if>
<if test="auditNum != null "> and lad.audit_num = #{auditNum}</if>
<if test="alNum != null "> and lad.al_num = #{alNum}</if>
<if test="status != null and status != ''"> and lad.status = #{status}</if>
<if test="companyId != null "> and lad.company_id = #{companyId}</if>
</where>
</select>
<select id="selectLeaseApplyDetailsById" parameterType="Long" resultMap="LeaseApplyDetailsResult">
<include refid="selectLeaseApplyDetailsVo"/>
where id = #{id}
where lad.id = #{id}
</select>
<insert id="insertLeaseApplyDetails" parameterType="com.bonus.material.lease.domain.LeaseApplyDetails" useGeneratedKeys="true" keyProperty="id">

View File

@ -21,26 +21,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectLeaseOutDetailsVo">
select id, parent_id, type_id, ma_id, out_num, out_type, create_by, create_time, update_by, update_time, remark, company_id, car_code, push_notifications from lease_out_details
select
lod.id, lod.parent_id, lod.type_id, lod.ma_id, lod.out_num, lod.out_type, lod.create_by, lod.create_time,
lod.update_by, lod.update_time, lod.remark, lod.company_id, lod.car_code, lod.push_notifications
from
lease_out_details lod
</sql>
<select id="selectLeaseOutDetailsList" parameterType="com.bonus.material.lease.domain.LeaseOutDetails" resultMap="LeaseOutDetailsResult">
<include refid="selectLeaseOutDetailsVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="maId != null "> and ma_id = #{maId}</if>
<if test="outNum != null "> and out_num = #{outNum}</if>
<if test="outType != null and outType != ''"> and out_type = #{outType}</if>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="carCode != null and carCode != ''"> and car_code = #{carCode}</if>
<if test="pushNotifications != null "> and push_notifications = #{pushNotifications}</if>
<if test="parentId != null "> and lod.parent_id = #{parentId}</if>
<if test="typeId != null "> and lod.type_id = #{typeId}</if>
<if test="maId != null "> and lod.ma_id = #{maId}</if>
<if test="outNum != null "> and lod.out_num = #{outNum}</if>
<if test="outType != null and outType != ''"> and lod.out_type = #{outType}</if>
<if test="companyId != null "> and lod.company_id = #{companyId}</if>
<if test="carCode != null and carCode != ''"> and lod.car_code = #{carCode}</if>
<if test="pushNotifications != null "> and lod.push_notifications = #{pushNotifications}</if>
</where>
</select>
<select id="selectLeaseOutDetailsById" parameterType="Long" resultMap="LeaseOutDetailsResult">
<include refid="selectLeaseOutDetailsVo"/>
where id = #{id}
where lod.id = #{id}
</select>
<select id="selectLeaseOutDetailsListByParentId" parameterType="com.bonus.material.lease.domain.LeaseOutDetails" resultMap="LeaseOutDetailsResult">
<include refid="selectLeaseOutDetailsVo"/>
<where>
lod.parent_id = #{parentId}
</where>
</select>
<insert id="insertLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails" useGeneratedKeys="true" keyProperty="id">