23 Commits

Author SHA1 Message Date
cde34cab6c Merge branch '6170' into prod 2025-12-26 16:22:57 +08:00
7d256df790 Merge branch 'dyf-device' into prod 2025-12-19 16:22:55 +08:00
3d1c2f4e56 Merge branch 'dyf-device' into prod 2025-12-19 14:08:03 +08:00
ccadcb8d4e Merge branch '6170' into prod 2025-12-12 14:59:50 +08:00
b8cb663bbf Merge branch 'jingquan' into prod 2025-12-03 16:56:49 +08:00
56e86b070d Merge branch 'dyf-device' into prod 2025-12-01 13:33:59 +08:00
0898855108 Merge branch '6170' into prod 2025-11-28 10:18:54 +08:00
92b65ce6df Merge branch 'dyf-device' into prod 2025-11-27 11:01:58 +08:00
82399cffed Merge branch 'dyf-device' into prod 2025-08-25 14:33:52 +08:00
5538ac96e5 晶全日志配置 2025-08-06 09:48:00 +08:00
b703f80355 晶全日志配置 2025-08-06 09:44:52 +08:00
b3b249ea07 日志配置 2025-08-06 09:20:41 +08:00
aff424e73b Merge branch 'main' into prod 2025-08-06 09:18:43 +08:00
dc513a858a Merge branch 'main' into prod 2025-08-04 09:08:34 +08:00
df5ce7ddd9 Merge branch 'main' into prod 2025-07-31 09:21:10 +08:00
2174dfdb4d Merge branch 'main' into prod 2025-07-23 19:24:27 +08:00
2800b89e06 Merge branch 'main' into prod 2025-07-23 10:55:30 +08:00
637e46c510 Merge branch 'main' into prod 2025-07-21 08:40:34 +08:00
31c2158c8e Merge branch 'main' into prod 2025-07-19 10:22:33 +08:00
c7c21dc358 Merge branch 'main' into prod 2025-07-18 15:17:54 +08:00
a7e0803b00 Merge branch 'main' into prod 2025-07-17 16:42:14 +08:00
55cacbd322 Merge branch 'main' into prod 2025-07-17 09:24:45 +08:00
99ec6eaff0 prod 2025-07-15 08:40:20 +08:00
10 changed files with 25 additions and 71 deletions

View File

@ -739,7 +739,6 @@ public class DeviceXinghanBizService {
device.setCreateByName(loginUser.getNickname());
device.setTypeName(deviceTypes.getTypeName());
device.setDeviceType(deviceTypes.getId());
device.setDevicePic(deviceTypes.getDevicePic());
if (device.getDeviceImei() != null) {
device.setPubTopic("A/" + device.getDeviceImei());
device.setSubTopic("B/" + device.getDeviceImei());

View File

@ -8,8 +8,8 @@ spring.boot.admin.client:
metadata:
username: ${spring.boot.admin.client.username}
userpassword: ${spring.boot.admin.client.password}
username: @monitor.username@
password: @monitor.password@
username: ${monitor.username}
password: ${monitor.password}
--- # snail-job 配置
snail-job:

View File

@ -11,8 +11,8 @@ spring.boot.admin.client:
metadata:
username: ${spring.boot.admin.client.username}
userpassword: ${spring.boot.admin.client.password}
username: @monitor.username@
password: @monitor.password@
username: ${monitor.username}
password: ${monitor.password}
--- # snail-job 配置
snail-job:

View File

@ -15,7 +15,6 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
/**
@ -51,7 +50,7 @@ public class DeviceTypeController {
// @Log("新增设备类型")
@Operation(summary = "新增设备类型")
@PostMapping(value = "/add")
public R<Void> createDeviceType(@Validated @ModelAttribute DeviceTypeForm resources) throws IOException {
public R<Void> createDeviceType(@Validated @RequestBody DeviceType resources) {
deviceTypeService.create(resources);
return R.ok();
}
@ -60,7 +59,7 @@ public class DeviceTypeController {
// @Log("修改设备类型")
@Operation(summary = "修改设备类型")
@PutMapping(value = "/update")
public R<Void> updateDeviceType(@Validated @ModelAttribute DeviceTypeForm resources) throws IOException {
public R<Void> updateDeviceType(@Validated @RequestBody DeviceTypeForm resources) {
deviceTypeService.update(resources);
return R.ok();
}

View File

@ -85,8 +85,5 @@ public class DeviceType extends TenantEntity {
@Schema(title = "型号字典用于PC页面跳转")
private String pcModelDictionary;
@Schema(title = "设备图片")
private String devicePic;
}

View File

@ -2,7 +2,6 @@ package com.fuyuanshen.equipment.domain.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
/**
* @Description: 设备类型
@ -49,10 +48,5 @@ public class DeviceTypeForm {
*/
@Schema(title = "型号字典用于PC页面跳转")
private String pcModelDictionary;
@Schema(title = "设备图片")
private String devicePic;
@Schema(title = "设备图片")
private MultipartFile file;
}

View File

@ -12,7 +12,6 @@ import com.fuyuanshen.equipment.domain.DeviceType;
import com.fuyuanshen.equipment.domain.dto.DeviceExcelImportDTO;
import com.fuyuanshen.equipment.domain.dto.ImportResult;
import com.fuyuanshen.equipment.domain.form.DeviceForm;
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
import com.fuyuanshen.equipment.handler.ImageWriteHandler;
import com.fuyuanshen.system.domain.vo.SysOssVo;
import lombok.extern.slf4j.Slf4j;
@ -438,10 +437,8 @@ public class UploadDeviceDataListener implements ReadListener<DeviceExcelImportD
newDeviceType.setAppModelDictionary(originalDto.getAppModelDictionary());
newDeviceType.setPcModelDictionary(originalDto.getPcModelDictionary());
DeviceTypeForm deviceTypeForm = new DeviceTypeForm();
BeanUtil.copyProperties(newDeviceType, deviceTypeForm, true);
// 创建新的设备类型
params.getDeviceTypeService().create(deviceTypeForm);
params.getDeviceTypeService().create(newDeviceType);
// 重新查询确保获取到正确的ID
deviceType = params.getDeviceTypeService().queryByName(device.getTypeName());

View File

@ -8,7 +8,6 @@ import com.fuyuanshen.equipment.domain.DeviceType;
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
import java.io.IOException;
import java.util.List;
/**
@ -64,14 +63,14 @@ public interface DeviceTypeService extends IService<DeviceType> {
*
* @param resources /
*/
void create(DeviceTypeForm resources) throws IOException;
void create(DeviceType resources);
/**
* 修改设备类型
*
* @param resources /
*/
void update(DeviceTypeForm resources) throws IOException;
void update(DeviceTypeForm resources);
/**
* 多选删除

View File

@ -19,16 +19,12 @@ import com.fuyuanshen.equipment.mapper.DeviceMapper;
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
import com.fuyuanshen.equipment.service.DeviceTypeService;
import com.fuyuanshen.equipment.utils.FileHashUtil;
import com.fuyuanshen.system.domain.vo.SysOssVo;
import com.fuyuanshen.system.domain.vo.SysRoleVo;
import com.fuyuanshen.system.service.ISysOssService;
import com.fuyuanshen.system.service.ISysRoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -50,8 +46,6 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
private final ISysRoleService roleService;
private final ISysOssService ossService;
private final FileHashUtil fileHashUtil;
/**
@ -187,38 +181,24 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void create(DeviceTypeForm resources) throws IOException {
public void create(DeviceType resources) {
// 校验设备类型名称
List<DeviceType> typeName = deviceTypeMapper.selectList(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
if (CollectionUtil.isNotEmpty(typeName)) {
throw new RuntimeException("设备类型名称已存在,无法新增!!!");
}
// 保存图片并获取URL
if (resources.getFile() != null) {
String fileHash = fileHashUtil.hash(resources.getFile());
SysOssVo upload = ossService.updateHash(resources.getFile(), fileHash);
// 强制将HTTP替换为HTTPS
if (upload.getUrl() != null && upload.getUrl().startsWith("http://")) {
upload.setUrl(upload.getUrl().replaceFirst("^http://", "https://"));
}
// 设置图片路径
resources.setDevicePic(upload.getUrl());
}
DeviceType deviceType = new DeviceType();
BeanUtil.copyProperties(resources, deviceType, true);
LoginUser loginUser = LoginHelper.getLoginUser();
deviceType.setCustomerId(loginUser.getUserId());
deviceType.setOwnerCustomerId(loginUser.getUserId());
deviceType.setOriginalOwnerId(loginUser.getUserId());
deviceType.setCreateByName(loginUser.getNickname());
deviceTypeMapper.insert(deviceType);
resources.setCustomerId(loginUser.getUserId());
resources.setOwnerCustomerId(loginUser.getUserId());
resources.setOriginalOwnerId(loginUser.getUserId());
resources.setCreateByName(loginUser.getNickname());
deviceTypeMapper.insert(resources);
// 自动授权给自己
DeviceTypeGrants deviceTypeGrants = new DeviceTypeGrants();
deviceTypeGrants.setDeviceTypeId(deviceType.getId());
deviceTypeGrants.setDeviceTypeId(resources.getId());
deviceTypeGrants.setCustomerId(loginUser.getUserId());
deviceTypeGrants.setGrantorCustomerId(loginUser.getUserId());
deviceTypeGrants.setGrantedAt(new Date());
@ -233,7 +213,7 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void update(DeviceTypeForm resources) throws IOException {
public void update(DeviceTypeForm resources) {
DeviceTypeGrants deviceTypeGrants = deviceTypeGrantsMapper.selectById(resources.getId());
if (deviceTypeGrants == null) {
throw new RuntimeException("设备类型不存在");
@ -264,17 +244,6 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
throw new RuntimeException("无权修改该设备类型");
}
}
// 保存图片并获取URL
if (resources.getFile() != null) {
String fileHash = fileHashUtil.hash(resources.getFile());
SysOssVo upload = ossService.updateHash(resources.getFile(), fileHash);
// 强制将HTTP替换为HTTPS
if (upload.getUrl() != null && upload.getUrl().startsWith("http://")) {
upload.setUrl(upload.getUrl().replaceFirst("^http://", "https://"));
}
// 设置图片路径
resources.setDevicePic(upload.getUrl());
}
BeanUtil.copyProperties(resources, deviceType);
deviceTypeMapper.updateById(deviceType);

16
pom.xml
View File

@ -85,10 +85,10 @@
<monitor.username>fys</monitor.username>
<monitor.password>123456</monitor.password>
</properties>
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
<!-- <activation> -->
<!-- &lt;!&ndash; 默认环境 &ndash;&gt; -->
<!-- <activeByDefault>true</activeByDefault> -->
<!-- </activation> -->
</profile>
<profile>
<id>prod</id>
@ -98,10 +98,10 @@
<monitor.username>fys</monitor.username>
<monitor.password>123456</monitor.password>
</properties>
<!-- <activation> -->
<!-- &lt;!&ndash; 默认环境 &ndash;&gt; -->
<!-- <activeByDefault>true</activeByDefault> -->
<!-- </activation> -->
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>jingquan</id>