feat():设备信息

master
jiyufei 2 months ago
parent 9c224ed3d1
commit c96c89bbfe

@ -11,6 +11,7 @@ import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysDeviceEntity;
import jnpf.entity.YysDeviceMaterialEntity;
import jnpf.mapper.YysDeviceMapper;
import jnpf.model.QueryModel;
import jnpf.model.yysdevice.YysDeviceConstant;
@ -326,6 +327,11 @@ public class YysDeviceServiceImpl extends ServiceImpl<YysDeviceMapper, YysDevice
}
boolean result = this.saveOrUpdate(entity);
if (result) {
//删掉绑定物料重新添加
LambdaQueryWrapper<YysDeviceMaterialEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YysDeviceMaterialEntity::getDeviceCode, entity.getDeviceCode());
yysDeviceMaterialService.remove(wrapper);
yysDeviceMaterialService.saveBatch(yysDeviceForm.getData());
//向设备维保表同步数据
yysDeviceUpkeepService.syncSaveOrUpdate(entity);
}

@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.*;
@ -78,6 +79,8 @@ public class YysDeviceController {
@Autowired
private YysDeviceService yysDeviceService;
@Resource
private YysDeviceMaterialService yysDeviceMaterialService;
@Autowired
private ConfigValueUtil configValueUtil;
@ -93,9 +96,15 @@ public class YysDeviceController {
public ActionResult list(@RequestBody YysDevicePagination yysDevicePagination) throws IOException {
List<YysDeviceEntity> list = yysDeviceService.getList(yysDevicePagination);
List<Map<String, Object>> realList = new ArrayList<>();
//查询设备绑定物料信息
List<YysDeviceMaterialEntity> list1 = yysDeviceMaterialService.list();
Map<String, List<YysDeviceMaterialEntity>> collect = list1.stream().collect(Collectors.groupingBy(YysDeviceMaterialEntity::getDeviceCode));
for (YysDeviceEntity entity : list) {
Map<String, Object> yysDeviceMap = JsonUtil.entityToMap(entity);
yysDeviceMap.put("id", yysDeviceMap.get("id"));
if (collect.containsKey(entity.getDeviceCode())) {
yysDeviceMap.put("data", collect.get(entity.getDeviceCode()));
}
//副表数据
//子表数据
realList.add(yysDeviceMap);

Loading…
Cancel
Save