设备追溯修改

This commit is contained in:
mashuai 2024-12-24 10:05:57 +08:00
parent 0692590215
commit bdcbca4563
3 changed files with 8 additions and 33 deletions

View File

@ -1,13 +1,9 @@
package com.bonus.material.ma.service.impl;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.core.constant.SecurityConstants;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
@ -15,9 +11,6 @@ import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MachineVo;
import com.bonus.material.purchase.config.RemoteConfig;
import com.bonus.system.api.RemoteUserService;
import com.bonus.system.api.domain.SysUser;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.MachineMapper;
@ -39,9 +32,6 @@ public class MachineServiceImpl implements IMachineService
@Resource
private MachineMapper machineMapper;
@Resource
private RemoteUserService remoteUserService;
@Resource
private RemoteConfig remoteConfig;
@ -55,8 +45,6 @@ public class MachineServiceImpl implements IMachineService
public MachineVo selectMachineByMaId(Long maId)
{
MachineVo machineVo = machineMapper.selectMachineByMaId(maId);
setUserName(machineVo.getKeeperId(), machineVo::setKeeperName);
setUserName(machineVo.getRepairId(), machineVo::setRepairName);
Map<String, String> machineStatus = remoteConfig.getDictValue("ma_machine_status");
if (StringUtils.isNotBlank(machineVo.getMaStatus())) {
machineVo.setStatusName(StringUtils.isBlank(machineStatus.get(machineVo.getMaStatus())) ? "" : machineStatus.get(machineVo.getMaStatus()));
@ -64,24 +52,6 @@ public class MachineServiceImpl implements IMachineService
return machineVo;
}
private void setUserName(Long userId, Consumer<String> setNameFunction) {
try {
AjaxResult ajaxResult = remoteUserService.getInfo(userId, SecurityConstants.INNER);
if (ajaxResult.isSuccess()) {
// ajaxResult.get("data") 返回的是 LinkedHashMap
LinkedHashMap<String, Object> rawDataList = (LinkedHashMap<String, Object>) ajaxResult.get("data");
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
if (rawDataList != null) {
SysUser sysUser = objectMapper.convertValue(rawDataList, SysUser.class);
setNameFunction.accept(sysUser.getNickName() == null ? "" : sysUser.getNickName());
}
}
} catch (IllegalArgumentException e) {
log.error("远程调用查询失败:", e.getMessage());
}
}
/**
* 查询机具设备管理列表
*

View File

@ -38,7 +38,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and (bai.contract_code like concat('%', #{keyWord}, '%') or
bai.agreement_code like concat('%', #{keyWord}, '%') or
auth_person like concat('%', #{keyWord}, '%') or
phone like concat('%', #{keyWord}, '%'))
phone like concat('%', #{keyWord}, '%') or
bu.unit_name like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%')
)
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( bai.plan_start_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>

View File

@ -158,8 +158,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ma.inspect_man as inspectMan,
ma.inspect_status as inspectStatus,
ma.phone as phone,
mtk.user_id as keeperId,
mtr.user_id as repairId,
GROUP_CONCAT( DISTINCT su1.nick_name ORDER BY su1.nick_name SEPARATOR ', ' ) AS keeperName,
GROUP_CONCAT( DISTINCT su2.nick_name ORDER BY su2.nick_name SEPARATOR ', ' ) AS repairName,
baa.asset_name as assetName,
ma.assets_id as assetsId,
ma.remark as remark
@ -174,7 +174,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
and mt4.`level` = '1' and mt4.del_flag = '0'
LEFT JOIN ma_type_keeper mtk on ma.type_id = mtk.type_id
LEFT JOIN sys_user su1 on mtk.user_id = su1.user_id
LEFT JOIN ma_type_repair mtr on ma.type_id = mtr.type_id
LEFT JOIN sys_user su2 on mtr.user_id = su2.user_id
LEFT JOIN bm_asset_attributes baa on ma.assets_id = baa.id
where ma.ma_id = #{maId}
</select>