This commit is contained in:
mashuai 2025-07-16 18:49:44 +08:00
parent 4353aeda95
commit 812387edcc
9 changed files with 89 additions and 13 deletions

View File

@ -318,4 +318,9 @@ public class LeaseApplyInfo extends BaseEntity{
private String ids; private String ids;
private Long leaseSignId; private Long leaseSignId;
private List<Long> typeIdList;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -179,6 +179,11 @@ public class LeaseApplyDetails extends BaseEntity {
private String leaseSignId; private String leaseSignId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
private List<Long> typeIdList;
@ApiModelProperty(value = "领料物资名称汇总") @ApiModelProperty(value = "领料物资名称汇总")
private String maTypeNames; private String maTypeNames;
public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) { public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) {
@ -194,9 +199,10 @@ public class LeaseApplyDetails extends BaseEntity {
public LeaseApplyDetails() {} public LeaseApplyDetails() {}
public LeaseApplyDetails(Long parentId, String keyword, Long userId) { public LeaseApplyDetails(Long parentId, String keyword, Long userId, List<Long> typeIdList) {
this.parentId = parentId; this.parentId = parentId;
this.keyword = keyword; this.keyword = keyword;
this.userId = userId; this.userId = userId;
this.typeIdList = typeIdList;
} }
} }

View File

@ -141,7 +141,8 @@ public interface LeaseApplyDetailsMapper {
* @param publishTask * @param publishTask
* @return * @return
*/ */
List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask); List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask,
@Param("list") List<Long> typeIdList);
/** /**
* 根据领料任务id查询领料任务详细 * 根据领料任务id查询领料任务详细

View File

@ -134,4 +134,11 @@ public interface LeaseApplyInfoMapper {
List<LeaseApplyDetails> getDetailsLeaseList(LeaseApplyDetails bean); List<LeaseApplyDetails> getDetailsLeaseList(LeaseApplyDetails bean);
LeaseConfirmSign getLeaseConfirmSign(LeaseApplyDetails bean); LeaseConfirmSign getLeaseConfirmSign(LeaseApplyDetails bean);
/**
* 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
* @param userId
* @return
*/
List<Long> selectTypeIdList(Long userId);
} }

View File

@ -88,7 +88,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
leaseApplyInfo.setId(id); leaseApplyInfo.setId(id);
Long userId = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
if (!CollectionUtils.isEmpty(typeIdList)) {
leaseApplyInfo.setTypeIdList(typeIdList);
} else {
leaseApplyInfo.setUserId(userId); leaseApplyInfo.setUserId(userId);
}
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo));
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
// 查询领用出库数据 // 查询领用出库数据
@ -134,11 +140,16 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
leaseApplyRequestVo.setLeaseApplyInfo(info); leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情 // 获取领料单详情
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId)); List<LeaseApplyDetails> details = new ArrayList<>();
if (leaseApplyInfo.getUserId() != null) {
details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId, null));
} else {
details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, null, typeIdList));
}
// 走单独的领用详情查询 // 走单独的领用详情查询
if (StringUtils.isNotBlank(publishTask)) { if (StringUtils.isNotBlank(publishTask)) {
// 根据领用批次查询领用详情 // 根据领用批次查询领用详情
details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask); details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask, typeIdList);
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails detail : details) { for (LeaseApplyDetails detail : details) {
if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) { if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) {
@ -270,7 +281,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/ */
@Override @Override
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid());
}
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
// 如果statusList包含345则为领料出库查询需查询领用出库数据进行拼接 // 如果statusList包含345则为领料出库查询需查询领用出库数据进行拼接
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
@ -291,6 +307,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) Comparator.nullsFirst(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!CollectionUtils.isEmpty(sortedList)) { if (!CollectionUtils.isEmpty(sortedList)) {
if (!CollectionUtils.isEmpty(typeIdList)) {
sortedList = sortedList.stream()
.filter(item -> typeIdList.contains(item.getFirstId()))
.collect(Collectors.toList());
}
String keyWord = leaseApplyInfo.getKeyWord(); String keyWord = leaseApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤 // 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) { if (!StringUtils.isBlank(keyWord)) {
@ -946,7 +967,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/ */
@Override @Override
public List<LeaseApplyDetails> selectLeaseApplyDetailsList(LeaseApplyInfo leaseApplyInfo) { public List<LeaseApplyDetails> selectLeaseApplyDetailsList(LeaseApplyInfo leaseApplyInfo) {
return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId())); return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId(), null));
} }
/** /**

View File

@ -448,7 +448,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
if (StringUtils.isNotBlank(record.getPublishTask())) { if (StringUtils.isNotBlank(record.getPublishTask())) {
// 根据领用批次查询领用详情 // 根据领用批次查询领用详情
boolean isFinished = true; boolean isFinished = true;
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask()); List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask(), null);
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails bean : details) { for (LeaseApplyDetails bean : details) {
if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) { if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) {

View File

@ -361,7 +361,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
leaseApplyRequestVo.setLeaseApplyInfo(info); leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情 // 获取领料单详情
List<LeaseApplyDetails> details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId)); List<LeaseApplyDetails> details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId, null));
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
leaseApplyRequestVo.setLeaseApplyDetailsList(details); leaseApplyRequestVo.setLeaseApplyDetailsList(details);
for (LeaseApplyDetails detail : details) { for (LeaseApplyDetails detail : details) {

View File

@ -44,13 +44,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(lad.audit_num,0) as audit_num, IFNULL(lad.audit_num,0) as audit_num,
IFNULL(lad.al_num,0) as al_num, IFNULL(lad.al_num,0) as al_num,
IFNULL(lad.status,0) as status, mt.unit_name,mt.unit_value, IFNULL(lad.status,0) as status, mt.unit_name,mt.unit_value,
lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id,
mt4.type_id as firstId
from from
lease_apply_details lad lease_apply_details lad
left join left join
ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0' ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0'
left join left join
ma_type mt2 on mt2.type_id = mt.parent_id and mt2.`level` = '3' and mt2.del_flag = '0' ma_type mt2 on mt2.type_id = mt.parent_id and mt2.`level` = '3' and mt2.del_flag = '0'
left join ma_type mt3 ON mt2.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'
left join (SELECT mt.type_id, left join (SELECT mt.type_id,
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
@ -79,6 +82,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="alNum != null "> and lad.al_num = #{alNum}</if> <if test="alNum != null "> and lad.al_num = #{alNum}</if>
<if test="status != null and status != ''"> and lad.status = #{status}</if> <if test="status != null and status != ''"> and lad.status = #{status}</if>
<if test="companyId != null "> and lad.company_id = #{companyId}</if> <if test="companyId != null "> and lad.company_id = #{companyId}</if>
<if test="typeIdList != null and typeIdList.size() > 0">
and mt4.type_id in
<foreach item="item" collection="typeIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
</select> </select>
@ -439,13 +448,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(subquery0.num, 0) IFNULL(subquery0.num, 0)
ELSE ELSE
IFNULL(mt.storage_num, 0) IFNULL(mt.storage_num, 0)
END as storageNum END as storageNum,
mt4.type_id as firstId
FROM FROM
lease_publish_details lpd lease_publish_details lpd
LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id
AND mt.del_flag = '0' AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0' 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'
left join (SELECT mt.type_id, left join (SELECT mt.type_id,
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
@ -460,12 +472,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND lpd.publish_task = lod.publish_task AND lpd.publish_task = lod.publish_task
LEFT JOIN (SELECT id, parent_id, type_id from lease_apply_details GROUP BY parent_id, type_id) a LEFT JOIN (SELECT id, parent_id, type_id from lease_apply_details GROUP BY parent_id, type_id) a
on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lpd.new_type AND mtk.user_id = #{userId}
</if>
WHERE WHERE
lpd.publish_task = #{publishTask} lpd.publish_task = #{publishTask}
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND (mt1.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%') AND (mt1.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%')
OR mt.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%')) OR mt.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%'))
</if> </if>
<if test="typeIdList != null and typeIdList.size() > 0">
and mt4.type_id in
<foreach item="item" collection="typeIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY GROUP BY
lpd.new_type lpd.new_type
</select> </select>

View File

@ -57,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames, GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart, bp.contract_part as contractPart,
sd.dept_name as impUnitName, sd.dept_name as impUnitName,
tt.task_type as taskType tt.task_type as taskType,
mt3.type_id as firstId
from from
lease_apply_info lai lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id left join tm_task tt on lai.task_id = tt.task_id
@ -71,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and sda.dict_type = 'lease_task_status' and sda.dict_type = 'lease_task_status'
left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0' left join ma_type mt on lad.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 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'
<if test="userId != null"> <if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if> </if>
@ -334,7 +337,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lai.material_man AS materialMan, lai.material_man AS materialMan,
lai.confirm_time AS confirmTime, lai.confirm_time AS confirmTime,
lai.is_confirm AS isConfirm, lai.is_confirm AS isConfirm,
lai.confirm_remark AS confirmRemark lai.confirm_remark AS confirmRemark,
mt3.type_id AS firstId
FROM FROM
lease_publish_details lpd lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
@ -349,6 +353,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt.del_flag = '0' AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0' 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 LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id
AND lpd.project_id = bai.project_id AND lpd.project_id = bai.project_id
<if test="userId != null"> <if test="userId != null">
@ -558,6 +564,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.create_time DESC lod.create_time DESC
</select> </select>
<select id="selectTypeIdList" resultType="java.lang.Long">
select
type_id
from
ma_type_manage
where
user_id = #{userId}
</select>
<update id="confirmLeaseTask"> <update id="confirmLeaseTask">
update update
lease_out_details lease_out_details