接口联调

This commit is contained in:
mashuai 2024-12-26 12:41:39 +08:00
parent 821883ad8d
commit 57bade227a
4 changed files with 41 additions and 10 deletions

View File

@ -58,9 +58,12 @@ public class UseStorageInfo {
private Date outTime; private Date outTime;
@ApiModelProperty(value = "领料单号") @ApiModelProperty(value = "领料单号")
@Excel(name = "领料单号")
private String code; private String code;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String projectName;
@ApiModelProperty(value = "关键字") @ApiModelProperty(value = "关键字")
private String keyWord; private String keyWord;
} }

View File

@ -88,4 +88,12 @@ public interface ComplexQueryMapper {
* @return * @return
*/ */
List<PurchaseInputInfo> selectMaCodeByTaskIdAndTypeId(@Param("taskId") Long taskId, @Param("typeId") Integer typeId); List<PurchaseInputInfo> selectMaCodeByTaskIdAndTypeId(@Param("taskId") Long taskId, @Param("typeId") Integer typeId);
/**
* 查询机具编码
* @param bean
* @return
*/
List<StorageInfo> selectMaCodeByTypeId(StorageInfo bean);
} }

View File

@ -1,5 +1,6 @@
package com.bonus.material.basic.service.impl; package com.bonus.material.basic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.biz.enums.MaTypeManageTypeEnum; import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
@ -279,6 +280,19 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
} }
} }
} }
// 查询在库具体编码code
List<StorageInfo> codeList = complexQueryMapper.selectMaCodeByTypeId(bean);
// 1. 创建一个 Set 存储 codeList 中的 typeId maCode 的组合键
Set<String> validCodes = codeList.stream()
.filter(code -> code.getTypeId() != null && code.getMaCode() != null)
.map(code -> code.getTypeId() + "-" + code.getMaCode())
.collect(Collectors.toSet());
if (CollectionUtil.isNotEmpty(codeList) && CollectionUtil.isNotEmpty(list)) {
list = list.stream()
.filter(item -> validCodes.contains(item.getTypeId() + "-" + item.getMaCode()))
.collect(Collectors.toList());
}
if (StringUtils.isNotBlank(bean.getKeyWord())) { if (StringUtils.isNotBlank(bean.getKeyWord())) {
String keyword = bean.getKeyWord(); String keyword = bean.getKeyWord();
return list.stream().filter(item -> { return list.stream().filter(item -> {

View File

@ -553,14 +553,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null"> <if test="typeId != null">
AND bs.type_id = #{typeId} AND bs.type_id = #{typeId}
</if> </if>
<if test="keyWord != null and keyWord != ''">
AND (
mt1.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%') or
bs.creator like concat('%',#{keyWord},'%') or
su.nick_name like concat('%',#{keyWord},'%')
)
</if>
GROUP BY bs.ma_code, mt.type_id, mt1.type_name, mt.type_name, bs.ma_code, GROUP BY bs.ma_code, mt.type_id, mt1.type_name, mt.type_name, bs.ma_code,
bs.in_num, bs.creator, bs.create_time, tt.CODE, mt.buy_price bs.in_num, bs.creator, bs.create_time, tt.CODE, mt.buy_price
</select> </select>
@ -573,6 +565,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.num AS usNum, sai.num AS usNum,
mm.ma_code AS maCode, mm.ma_code AS maCode,
lai.`code` AS code, lai.`code` AS code,
bp.pro_name AS projectName,
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper, GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
lod.create_by AS creator, lod.create_by AS creator,
lod.create_time AS outTime lod.create_time AS outTime
@ -584,6 +577,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user su ON mtk.user_id = su.user_id LEFT JOIN sys_user su ON mtk.user_id = su.user_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ( SELECT parent_id, create_time, create_by FROM lease_out_details GROUP BY parent_id, create_by ) AS lod ON lod.parent_id = lai.id LEFT JOIN ( SELECT parent_id, create_time, create_by FROM lease_out_details GROUP BY parent_id, create_by ) AS lod ON lod.parent_id = lai.id
WHERE WHERE
sai.end_time IS NULL sai.end_time IS NULL
@ -598,7 +593,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.ma_code like concat('%',#{keyWord},'%') or mm.ma_code like concat('%',#{keyWord},'%') or
lai.`code` like concat('%',#{keyWord},'%') or lai.`code` like concat('%',#{keyWord},'%') or
lod.create_by like concat('%',#{keyWord},'%') or lod.create_by like concat('%',#{keyWord},'%') or
su.nick_name like concat('%',#{keyWord},'%') su.nick_name like concat('%',#{keyWord},'%') or
bp.pro_name like concat('%',#{keyWord},'%')
) )
</if> </if>
GROUP BY mm.ma_code,lai.`code`,mt.type_id GROUP BY mm.ma_code,lai.`code`,mt.type_id
@ -725,4 +721,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND pmi.ma_code IS NOT NULL AND pmi.ma_code IS NOT NULL
</select> </select>
<select id="selectMaCodeByTypeId" resultType="com.bonus.material.basic.domain.StorageInfo">
SELECT
type_id as typeId,
ma_code as maCode
FROM
ma_machine
WHERE
ma_status = '1' and type_id = #{typeId}
</select>
</mapper> </mapper>