This commit is contained in:
mashuai 2025-07-25 18:37:34 +08:00
parent fc34e7371c
commit d0f87feffa
8 changed files with 226 additions and 38 deletions

View File

@ -96,15 +96,24 @@ public class MaterialLeaseInfoController extends BaseController {
* 获取领料任务详细信息
* @param id
* @param keyWord
* @param publishTask
* @return
*/
@ApiOperation(value = "获取领料任务详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@NotNull(message = "领料任务ID不能为空") @PathVariable("id") Long id,
@RequestParam(value = "keyWord", required = false) String keyWord,
@RequestParam(value = "publishTask", required = false) String publishTask) {
return materialLeaseInfoService.selectLeaseApplyInfoById(id, keyWord, publishTask);
@RequestParam(value = "keyWord", required = false) String keyWord) {
return materialLeaseInfoService.selectLeaseApplyInfoById(id, keyWord);
}
/**
* 获取领料单信息
* @param leaseApplyInfo
* @return
*/
@ApiOperation(value = "获取领料单信息")
@GetMapping(value = "/getPickList")
public AjaxResult getPickList(MaterialLeaseApplyInfo leaseApplyInfo) {
return materialLeaseInfoService.getPickList(leaseApplyInfo);
}
@ApiOperation(value = "获取领料任务详细信息")

View File

@ -43,10 +43,9 @@ public interface MaterialLeaseInfoService {
* 获取领料任务详细信息
* @param id
* @param keyWord
* @param publishTask
* @return
*/
AjaxResult selectLeaseApplyInfoById(Long id, String keyWord, String publishTask);
AjaxResult selectLeaseApplyInfoById(Long id, String keyWord);
/**
* 获取领料任务详细信息
@ -145,4 +144,12 @@ public interface MaterialLeaseInfoService {
* @return
*/
AjaxResult getMachineById(MaterialLeaseApplyInfo dto);
/**
* 获取领料单信息
* @param leaseApplyInfo
* @return
*/
AjaxResult getPickList(MaterialLeaseApplyInfo leaseApplyInfo);
}

View File

@ -308,11 +308,10 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
*
* @param id
* @param keyWord
* @param publishTask
* @return
*/
@Override
public AjaxResult selectLeaseApplyInfoById(Long id, String keyWord, String publishTask) {
public AjaxResult selectLeaseApplyInfoById(Long id, String keyWord) {
try {
List<MaterialLeaseMaCodeDto> newCodeList = new ArrayList<>();
MaterialLeaseApplyInfo leaseApplyInfo = new MaterialLeaseApplyInfo();
@ -320,18 +319,6 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
Optional<MaterialLeaseApplyInfo> optionalInfo = Optional.ofNullable(materialLeaseInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo));
MaterialLeaseApplyRequestVo leaseApplyRequestVo = new MaterialLeaseApplyRequestVo();
optionalInfo.ifPresent(info -> {
BmFileInfo bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(id);
bmFileInfo.setTaskType(2);
bmFileInfo.setFileType(5L);
List<BmFileInfo> bmFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
if (!CollectionUtils.isEmpty(bmFileInfoList)) {
info.setBmFileInfos(bmFileInfoList);
}
// 电子签名进行base64拼接
if (StringUtils.isNotBlank(info.getLeaseSignUrl())) {
info.setLeaseSignUrl("data:image/png;base64," + info.getLeaseSignUrl());
}
leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情
List<MaterialLeaseApplyDetails> details = materialLeaseInfoMapper.selectLeaseApplyDetailsList(new MaterialLeaseApplyDetails(info.getId(), keyWord, null));
@ -449,12 +436,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
detail.setMaCodeVoList(maCodeVoList);
if (info.getTaskStatus() == 1) {
if (!CollectionUtils.isEmpty(maCodeVoList)) {
// 根据id查询协议id
Long agreementId = materialLeaseInfoMapper.getAgreementId(id);
for (MaterialLeaseMaCodeDto maCodeVo : maCodeVoList) {
if (maCodeVo.getMaId() != null) {
// 根据协议idtypeIdmaId查询设备是否已被领料
maCodeVo.setAgreementId(agreementId);
MaterialLeaseApplyInfo applyInfo = materialLeaseInfoMapper.selectInfoById(maCodeVo);
if (applyInfo != null) {
// 将maCodeList中已领料的收集到新集合中
@ -1411,6 +1395,44 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
return AjaxResult.success(unusedMachines);
}
/**
* 获取领料单信息
* @param leaseApplyInfo
* @return
*/
@Override
public AjaxResult getPickList(MaterialLeaseApplyInfo leaseApplyInfo) {
try {
MaterialLeaseApplyInfo info = materialLeaseInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo);
// 电子签名进行base64拼接
if (StringUtils.isNotBlank(info.getLeaseSignUrl())) {
info.setLeaseSignUrl("data:image/png;base64," + info.getLeaseSignUrl());
}
MaterialLeaseApplyRequestVo leaseApplyRequestVo = new MaterialLeaseApplyRequestVo();
leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情
List<MaterialLeaseApplyDetails> details = materialLeaseInfoMapper.selectLeaseApplyDetailsList(new MaterialLeaseApplyDetails(info.getId(), null, null));
//根据id查询领料单详情
if (!CollectionUtils.isEmpty(details)) {
for (MaterialLeaseApplyDetails detail : details) {
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
// 获取编码详情
List<MaterialLeaseMaCodeDto> maCodeVoList = materialLeaseInfoMapper.getCodeList(leaseApplyInfo.getId(), detail.getTypeId());
if (!CollectionUtils.isEmpty(maCodeVoList)) {
// 将maCodeVoList中的materialModel值赋值给typeName
maCodeVoList.forEach(maCodeVo -> maCodeVo.setTypeName(maCodeVo.getMaterialModel()));
detail.setMaCodeVoList(maCodeVoList);
}
}
}
AjaxResult ajaxResult = AjaxResult.success();
ajaxResult.put("data", leaseApplyRequestVo);
return ajaxResult;
} catch (Exception e) {
throw new RuntimeException("查询失败", e);
}
}
/**
* 插入领料任务
* @param createBy

View File

@ -21,14 +21,12 @@ import com.bonus.material.lease.service.ILeaseApplyInfoService;
import com.bonus.system.api.RemoteFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@ -155,4 +155,18 @@ public interface LeaseApplyInfoMapper {
* @return
*/
LeaseApplyInfo selectLeaseApplyInfoPublishList(LeaseApplyInfo leaseApplyInfo);
/**
* 领用数据查询
* @param leaseApplyInfo
* @return
*/
List<LeaseApplyInfo> selectLeaseOutList(LeaseApplyInfo leaseApplyInfo);
/**
* 领用数据查询
* @param leaseApplyInfo
* @return
*/
List<LeaseApplyInfo> selectPublish(LeaseApplyInfo leaseApplyInfo);
}

View File

@ -248,6 +248,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
Long userId = SecurityUtils.getLoginUser().getUserid();
leaseApplyInfo.setUserId(userId);
LeaseApplyInfo info = leaseApplyInfoMapper.getLeaseInfoById(leaseApplyInfo);
if (StringUtils.isNotBlank(bean.getPublishTask())) {
leaseApplyInfo.setPublishTask(bean.getPublishTask());
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
info = leaseApplyOutList.get(0);
}
}
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
// 查询领用出库数据
/** 设置审批人签名url 防止代码冲突 **/
@ -351,9 +358,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
extracted(leaseApplyInfo, list);
}
}
if (!CollectionUtils.isEmpty(list)) {
// 电子签名列表查询
if (leaseApplyInfo.getHasSign() != null && leaseApplyInfo.getHasSign() == 0) {
// 领料数据查询
list = leaseApplyInfoMapper.selectNoSignList(leaseApplyInfo);
// 领用数据查询
List<LeaseApplyInfo> leaseOutList = leaseApplyInfoMapper.selectLeaseOutList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseOutList)) {
list.addAll(leaseOutList);
}
}
// 使用 Stream API 进行降序排序
@ -477,8 +489,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Override
public List<LeaseApplyInfo> getCompleteOutTaskList(LeaseApplyInfo leaseApplyInfo) {
leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid());
// 领料数据
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectCompleteOutList(leaseApplyInfo);
// 领用数据
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublish(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
list.addAll(leaseApplyOutList);
}
//材料站权限过滤
String username = SecurityUtils.getLoginUser().getUsername();
if(!CollectionUtils.isEmpty(list)){

View File

@ -901,11 +901,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
clz_slt_agreement_info
WHERE
status = '0'
AND agreement_id = #{agreementId}
AND type_id = #{typeId}
<if test="maId != null">
AND ma_id = #{maId}
</if>
</select>
<select id="getMachineById" resultType="com.bonus.material.clz.domain.vo.MaterialMaCodeVo">

View File

@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
tt.task_type as taskType,
lai.release_time as releaseTime,
COALESCE(lai.release_time, lai.create_time) as releaseTime,
GROUP_CONCAT(DISTINCT mt3.type_id) as firstId,
su.sign_type as lease_sign_type,
su.sign_url as lease_sign_url
@ -144,13 +144,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and lai.release_time BETWEEN CONCAT(#{startTime},' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
and COALESCE(lai.release_time, lai.create_time) BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
<if test="directId != null "> and lai.direct_id = #{directId}</if>
<if test="leaseType != null and leaseType != ''"> and lai.lease_type = #{leaseType}</if>
<if test="estimateLeaseTime != null "> and lai.estimate_lease_time = #{estimateLeaseTime}</if>
<if test="costBearingParty != null and costBearingParty != ''"> and lai.cost_bearing_party = #{costBearingParty}</if>
and tt.task_type in (2,19)
and tt.task_type = '2'
</where>
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc
@ -508,7 +508,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.id as id,
lod.type_id as typeId,
lod.parent_id as parentId,
lod.out_num as outNum,
IFNULL( SUM( lod.out_num ), 0 ) as outNum,
DATE_FORMAT(lod.confirm_time, '%Y-%m-%d') as confirmTime,
mt2.type_name as maTypeName,
mt1.type_name as typeName,
@ -527,6 +527,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where lod.parent_id = #{id}
and lod.out_num > 0
and lod.lease_sign_id = #{leaseSignId}
GROUP BY lod.type_id
ORDER BY lod.create_time DESC
</select>
<select id="getLeaseConfirmSign" resultType="com.bonus.common.biz.domain.lease.LeaseConfirmSign">
@ -557,7 +558,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tt.task_type AS taskType,
bp.external_id AS externalId,
bu.bzz_idcard AS idCard,
mt4.type_id AS firstId
mt4.type_id AS firstId,
COALESCE(lai.release_time, lai.create_time) as releaseTime
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
@ -574,6 +576,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0'
WHERE
lod.lease_sign_id is null
and tt.task_type = '2'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
@ -642,6 +645,127 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where lai.id = #{id}
</select>
<select id="selectLeaseOutList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
GROUP_CONCAT( DISTINCT lod.id ) AS ids,
lai.id AS id,
lai.CODE AS CODE,
lai.create_by AS createBy,
lai.create_time AS createTime,
lai.lease_person AS leasePerson,
lai.phone AS phone,
a.unit_id AS leaseUnitId,
a.project_id AS leaseProjectId,
bu.unit_name AS leaseUnit,
bp.pro_name AS leaseProject,
bai.agreement_code AS agreementCode,
IFNULL( sum( lod.out_num ), 0 ) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lai.task_id AS taskId,
tt.task_type AS taskType,
bp.external_id AS externalId,
bu.bzz_idcard AS idCard,
mt4.type_id AS firstId,
a.create_time AS releaseTime
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN (SELECT parent_id, unit_id,project_id,create_time from lease_publish_details
GROUP BY parent_id) a ON a.parent_id = lod.parent_id
LEFT JOIN bm_unit bu ON bu.unit_id = a.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = a.project_id
LEFT JOIN bm_agreement_info bai ON a.unit_id = bai.unit_id
AND a.project_id = bai.project_id
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0'
WHERE
lod.lease_sign_id is null
and tt.task_type = '19'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
GROUP BY
lod.parent_id
ORDER BY
lod.create_time DESC
</select>
<select id="selectPublish" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
lai.id AS id,
lpd.code AS code,
lai.code AS businessCode,
lai.create_by AS createBy,
lai.create_time AS createTime,
sd.dept_name AS impUnitName,
bp.contract_part AS contractPart,
lpd.lease_person AS leasePerson,
lpd.phone AS phone,
lpd.unit_id AS leaseUnitId,
lpd.project_id AS leaseProjectId,
bu.unit_name AS unitName,
bp.pro_name AS projectName,
bai.agreement_code AS agreementCode,
IFNULL( sum( lpd.num ), 0 ) AS preCountNum,
IFNULL(lod.num, 0) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lpd.publish_task AS publishTask,
lai.task_id AS taskId,
su.sign_url AS leaseSignUrl,
su.sign_type AS leaseSignType,
tt.task_type AS taskType,
lai.material_man AS materialMan,
lod.confirm_time AS confirmTime,
lod.confirm_remark AS confirmRemark,
mt3.type_id AS firstId,
lpd.create_time AS releaseTime,
bp.external_id as externalId,
CASE
WHEN IFNULL(sum(lad.pre_num),0) = SUM(CASE WHEN lod.is_confirm = 2 THEN lod.num ELSE 0 END) THEN 2
ELSE 1
END as isConfirm
FROM
lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
LEFT JOIN lease_apply_details lad ON lai.id = lad.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details
GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id
AND lpd.publish_task = lod.publish_task
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id
AND lpd.project_id = bai.project_id
left join sys_user su on lpd.create_by = su.user_id
where
lod.lease_sign_id is not null and bp.external_id is not null
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="id != null ">
AND lai.id = #{id}
</if>
<if test="publishTask != null and publishTask != ''">
AND lpd.publish_task = #{publishTask}
</if>
GROUP BY
lpd.publish_task
ORDER BY
lpd.create_time DESC
</select>
<update id="confirmLeaseTask">
update
lease_out_details