功能优化
This commit is contained in:
parent
bbb6cc4a9a
commit
33992fef85
|
|
@ -23,7 +23,13 @@ public enum TmTaskTypeEnum {
|
|||
|
||||
TM_TASK_DIRECT(16, "直转任务"),
|
||||
//盘点报废
|
||||
TM_TASK_PART_SCRAP(15, "盘点报废");
|
||||
TM_TASK_PART_SCRAP(15, "盘点报废"),
|
||||
// 机具分公司领料任务
|
||||
TM_TASK_JJ_LEASE(16, "领料任务"),
|
||||
//安全工器具领料任务
|
||||
TM_TASK_SAFE_LEASE(17, "安全工器具领料任务"),
|
||||
// 宏源领料领料任务
|
||||
TM_TASK_HY_LEASE(18, "宏源领料任务");
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ public class UseStorageInfo {
|
|||
@ApiModelProperty(value = "规格ID")
|
||||
private Integer typeId;
|
||||
|
||||
@ApiModelProperty(value = "领料ID")
|
||||
private Long leaseId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
|
|
|||
|
|
@ -96,4 +96,17 @@ public interface ComplexQueryMapper {
|
|||
*/
|
||||
List<StorageInfo> selectMaCodeByTypeId(StorageInfo bean);
|
||||
|
||||
/**
|
||||
* 查询库管员
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
UseStorageInfo selectMaTypeName(UseStorageInfo bean);
|
||||
|
||||
/**
|
||||
* 查询机具编码
|
||||
* @param useStorageInfo
|
||||
* @return
|
||||
*/
|
||||
UseStorageInfo selectInFo(UseStorageInfo useStorageInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,7 +351,50 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
*/
|
||||
@Override
|
||||
public List<UseStorageInfo> getUserRecords(UseStorageInfo bean) {
|
||||
return complexQueryMapper.getUserRecords(bean);
|
||||
try {
|
||||
// 查询库管员
|
||||
UseStorageInfo info = complexQueryMapper.selectMaTypeName(bean);
|
||||
List<UseStorageInfo> list = complexQueryMapper.getUserRecords(bean);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (UseStorageInfo useStorageInfo : list) {
|
||||
useStorageInfo.setMaKeeper(info.getMaKeeper() == null ? "" : info.getMaKeeper());
|
||||
// 查询出库信息
|
||||
if (useStorageInfo.getLeaseId() != null) {
|
||||
UseStorageInfo dto = complexQueryMapper.selectInFo(useStorageInfo);
|
||||
if (dto != null) {
|
||||
useStorageInfo.setCreator(dto.getCreator());
|
||||
useStorageInfo.setOutTime(dto.getOutTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
String keyWord = bean.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!com.bonus.common.core.utils.StringUtils.isBlank(keyWord)) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("查询在用设备详情失败", e);
|
||||
throw new RuntimeException("查询在用设备详情失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断item是否包含关键字
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsKeyword(UseStorageInfo item, String keyWord) {
|
||||
return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
|
||||
(item.getTypeModelName() != null && item.getTypeModelName().contains(keyWord)) ||
|
||||
(item.getCreator() != null && item.getCreator().equals(keyWord)) ||
|
||||
(item.getMaCode() != null && item.getMaCode().contains(keyWord)) ||
|
||||
(item.getProjectName() != null && item.getProjectName().contains(keyWord)) ||
|
||||
(item.getCode() != null && item.getCode().contains(keyWord)) ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -632,45 +632,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getUserRecords" resultType="com.bonus.material.basic.domain.UseStorageInfo">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
sai.num AS usNum,
|
||||
mm.ma_code AS maCode,
|
||||
lai.`code` AS code,
|
||||
bp.pro_name AS projectName,
|
||||
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper,
|
||||
lod.create_by AS creator,
|
||||
lod.create_time AS outTime
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
sai.num AS usNum,
|
||||
mm.ma_code AS maCode,
|
||||
bp.pro_name AS projectName,
|
||||
sai.lease_id AS leaseId,
|
||||
sai.type_id AS typeId
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = sai.type_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 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
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_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
|
||||
WHERE
|
||||
sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
<if test="typeId != null">
|
||||
AND sai.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||
mt.type_name like concat('%',#{keyWord},'%') or
|
||||
mm.ma_code like concat('%',#{keyWord},'%') or
|
||||
lai.`code` like concat('%',#{keyWord},'%') or
|
||||
lod.create_by like concat('%',#{keyWord},'%') or
|
||||
su.nick_name like concat('%',#{keyWord},'%') or
|
||||
bp.pro_name like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY mm.ma_code,lai.`code`,mt.type_id
|
||||
</select>
|
||||
|
||||
<select id="getRepairRecordList" resultType="com.bonus.material.basic.domain.RepairStorageInfo">
|
||||
|
|
@ -804,4 +786,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ma_status = '1' and type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<select id="selectMaTypeName" resultType="com.bonus.material.basic.domain.UseStorageInfo">
|
||||
SELECT
|
||||
GROUP_CONCAT(DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ') AS maKeeper
|
||||
FROM ma_type_keeper mtk
|
||||
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||
WHERE 1 = 1
|
||||
<if test="typeId != null">
|
||||
AND mtk.type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectInFo" resultType="com.bonus.material.basic.domain.UseStorageInfo">
|
||||
SELECT
|
||||
create_time as outTime,
|
||||
GROUP_CONCAT( DISTINCT create_by ) AS creator
|
||||
FROM
|
||||
lease_out_details
|
||||
WHERE parent_id = #{leaseId}
|
||||
GROUP BY parent_id
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -94,17 +94,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (bu.unit_name like concat('%', #{keyWord}, '%') or
|
||||
bp.pro_name like concat('%', #{keyWord}, '%') or
|
||||
lai.code like concat('%', #{keyWord}, '%') or
|
||||
lai.create_by like concat('%', #{keyWord}, '%') or
|
||||
lai.lease_person like concat('%', #{keyWord}, '%') or
|
||||
lai.phone like concat('%', #{keyWord}, '%') or
|
||||
bp.contract_part like concat('%', #{keyWord}, '%') or
|
||||
sd.dept_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -357,17 +357,6 @@
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (bu.unit_name like concat('%', #{keyWord}, '%') or
|
||||
bp.pro_name like concat('%', #{keyWord}, '%') or
|
||||
lai.code like concat('%', #{keyWord}, '%') or
|
||||
lai.create_by like concat('%', #{keyWord}, '%') or
|
||||
lai.lease_person like concat('%', #{keyWord}, '%') or
|
||||
lai.phone like concat('%', #{keyWord}, '%') or
|
||||
bp.contract_part like concat('%', #{keyWord}, '%') or
|
||||
sd.dept_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="facModel" column="fac_model" />
|
||||
<result property="intelligentCode" column="intelligent_code" />
|
||||
<result property="isTest" column="is_test" />
|
||||
<result property="companyId" column="company_id" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.bonus.material.ma.domain.vo.MaTypeVo" id="MaTypeVoResult">
|
||||
|
|
@ -503,7 +504,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IFNULL(subquery0.num, 0)
|
||||
ELSE
|
||||
IFNULL(m.storage_num, 0)
|
||||
END as storage_num
|
||||
END as storage_num,
|
||||
m.company_id as companyId
|
||||
from ma_type m
|
||||
left join (SELECT mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue