Compare commits

...

2 Commits

Author SHA1 Message Date
liang.chao 8997b8df54 Merge remote-tracking branch 'origin/master' 2024-11-23 13:27:26 +08:00
liang.chao 88b969449c 设备管理代码修改 2024-11-23 13:26:26 +08:00
5 changed files with 29 additions and 22 deletions

View File

@ -19,6 +19,7 @@ public class DevInfoVo extends DevInfo {
private Integer pageSize;
private long parentId;
private Long maId;
@ApiModelProperty(value = "装备类别")
private String typeName;

View File

@ -1,6 +1,7 @@
package com.bonus.material.device.mapper;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.biz.domain.TypeInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -16,7 +17,7 @@ public interface BmFileInfoMapper {
* @param id 附件主键
* @return 附件
*/
BmFileInfo selectBmFileInfoById(Long id);
List<BmFileInfo> selectBmFileInfoById(Long id);
/**
* 查询附件列表
@ -69,4 +70,6 @@ public interface BmFileInfoMapper {
* @return 结果
*/
int deleteBmFileInfoByBizInfo(BmFileInfo bmFileInfo);
TypeInfo getTypeInfo(String deviceName);
}

View File

@ -172,8 +172,8 @@ public class DevInfoServiceImpl implements DevInfoService {
//把文件保存到附件中
List<BmFileInfo> fileInfoList = devInfo.getBmFileInfoList();
if (CollectionUtil.isNotEmpty(fileInfoList)){
for (BmFileInfo sysFileInfo: fileInfoList) {
if (CollectionUtil.isNotEmpty(fileInfoList)) {
for (BmFileInfo sysFileInfo : fileInfoList) {
sysFileInfo.setModelId(devInfo.getMaId());
sysFileInfo.setCreateBy(String.valueOf(userId));
bmFileInfoMapper.insertBmFileInfo(sysFileInfo);
@ -184,6 +184,7 @@ public class DevInfoServiceImpl implements DevInfoService {
/**
* 修改设备信息
*
* @param devInfo 设备信息
*/
@Override
@ -199,8 +200,7 @@ public class DevInfoServiceImpl implements DevInfoService {
* @return 结果
*/
@Override
public int deleteDevInfoByMaIds(Long[] maIds)
{
public int deleteDevInfoByMaIds(Long[] maIds) {
return devInfoMapper.deleteDevInfoByMaIds(maIds);
}
@ -211,13 +211,13 @@ public class DevInfoServiceImpl implements DevInfoService {
* @return 结果
*/
@Override
public int deleteDevInfoByMaId(Long maId)
{
public int deleteDevInfoByMaId(Long maId) {
return devInfoMapper.deleteDevInfoByMaId(maId);
}
/**
* 信息录入
*
* @param infoMotionDto 设备信息
*/
@Override
@ -246,7 +246,7 @@ public class DevInfoServiceImpl implements DevInfoService {
//根据key计算每种状态的数量
for (String key : keys) {
List<DevInfo> deviceList = groupedByMaStatus.get(key);
sumTypeMap.put(MaStatusEnum.getNameByCode(Integer.parseInt(key)),deviceList.size());
sumTypeMap.put(MaStatusEnum.getNameByCode(Integer.parseInt(key)), deviceList.size());
}
return sumTypeMap;
}
@ -255,9 +255,9 @@ public class DevInfoServiceImpl implements DevInfoService {
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
List<DevInfoVo> list = devInfoMapper.selectDevInfoLists(devInfo);
//获取设备的附件
for (DevInfoVo devInfoVo: list) {
List<SysFileInfo> fileInfoList = sysFileInfoMapper.selectByMaId(devInfoVo.getMaId());
devInfoVo.setFileList(fileInfoList);
for (DevInfoVo devInfoVo : list) {
List<BmFileInfo> fileInfoList = bmFileInfoMapper.selectBmFileInfoById(devInfoVo.getMaId());
devInfoVo.setBmFileInfoList(fileInfoList);
}
return list;
}
@ -276,7 +276,8 @@ public class DevInfoServiceImpl implements DevInfoService {
public void insertOutType(String devInfo) {
ObjectMapper objectMapper = new ObjectMapper();
try {
Map<String, Object> map = objectMapper.readValue(devInfo, new TypeReference<Map<String, Object>>() {});
Map<String, Object> map = objectMapper.readValue(devInfo, new TypeReference<Map<String, Object>>() {
});
//获取公司名称
String companyName = (String) map.get("companyName");
// TODO 根据公司名称获取公司ID
@ -284,7 +285,7 @@ public class DevInfoServiceImpl implements DevInfoService {
//获取设备类型名称
String deviceName = (String) map.get("deviceName");
//根据设备类型名称获取设备类型ID
TypeInfo typeInfo = sysFileInfoMapper.getTypeInfo(deviceName);
TypeInfo typeInfo = bmFileInfoMapper.getTypeInfo(deviceName);
//获取日租金
Long leasePrice = (Long) map.get("leasePrice");
//设备型号

View File

@ -34,7 +34,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBmFileInfoById" parameterType="Long" resultMap="BmFileInfoResult">
<include refid="selectBmFileInfoVo"/>
where id = #{id}
where model_id = #{id}
</select>
<select id="getTypeInfo" resultType="com.bonus.common.biz.domain.TypeInfo">
select type_id from ma_type where type_name = #{deviceName}
</select>
<insert id="insertBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id">

View File

@ -234,9 +234,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="description != null and description != ''">description,</if>
<if test="gpsCode != null and gpsCode != ''">gps_code,</if>
<if test="ownCo != null and ownCo != ''">own_co,</if>
<if test="createTime != null and createTime != ''">create_time,</if>
<if test="createTime != null">create_time,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="specification != null and specification != ''">specification,</if>
<if test="deposit != null and deposit != ''">deposit,</if>
@ -268,7 +268,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="description != null and description != ''">#{description},</if>
<if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if>
<if test="ownCo != null and ownCo != ''">#{ownCo},</if>
<if test="createTime != null and createTime != ''">#{createTime},</if>
now(),
<if test="creator != null and creator != ''">#{creator},</if>
<if test="updateTime != null and updateTime != ''">#{update_time},</if>
<if test="updateBy != null and updateBy != ''">#{update_by},</if>
@ -386,7 +386,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select name from base_address where status = 1 and id = #{id}
</select>
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,u.type as type,t.group_name as type_name,t.p_id as group_id,t.group_id as company_id
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,t.group_name as type_name,t.p_id as group_id,t.group_id as company_id
from ma_dev_info d
left join (select t.*, p.type_name as parent_name, p.type_id as p_id,mt.type_name as group_name, mt.type_id as group_id
from ma_type_info t
@ -394,7 +394,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type_info mt on p.parent_id = mt.type_id
) t on d.type_id = t.type_id
left join bm_company_info c on d.own_co = c.company_id
left join ma_up_off u on d.ma_id = u.ma_id ORDER BY d.create_time desc
</select>