Commit 24057cc6 by HlQ

[add] 备件申请钉钉消息通知添加设备序列号字段

[fix] 解决设备列表查询为空的问题
1 parent 6f9b3715
......@@ -3,6 +3,7 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.lang.Assert;
import org.springframework.web.bind.annotation.*;
import vion.dto.DeviceDTO;
import vion.service.IDeviceService;
......@@ -23,6 +24,7 @@ public class DeviceController {
@GetMapping
@SaCheckPermission(value = "device:list", orRole = "admin")
public Page<DeviceVO> list(DeviceDTO dto) {
Assert.notNull(dto.getStatus(), "status 不能为空!");
return deviceService.list(dto);
}
......
......@@ -6,6 +6,7 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -37,7 +38,7 @@ public class IDeviceServiceImpl extends MPJBaseServiceImpl<DeviceMapper, Device>
.selectAll(Device.class)
.selectAs(Contract::getName, DeviceVO::getContractName)
.leftJoin(Contract.class, Contract::getContractNo, Device::getContractNo)
.like(Contract::getName, dto.getContractName())
.like(StrUtil.isNotBlank(dto.getContractName()), Contract::getName, dto.getContractName())
.orderByDesc(Device::getRecDate);
return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), DeviceVO.class, wrapper);
}
......
......@@ -133,7 +133,7 @@ public class RepairRecServiceImpl extends MPJBaseServiceImpl<RepairRecMapper, Re
.set("userid_list", userid);
var msg = JSONUtil.ofObj();
var content = JSONUtil.ofObj().set("title", "备件已发货");
var content = JSONUtil.ofObj().set("title", "返修设备已发货");
String text = StrUtil.format("""
### 返修设备已发货
### 项目名称:{}
......
......@@ -32,6 +32,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author HlQ
......@@ -120,7 +121,16 @@ public class SparePartServiceImpl extends MPJBaseServiceImpl<SparePartMapper, Sp
@Override
public Boolean notify(Long id, String userid) {
var sparePart = this.getById(id);
MPJLambdaWrapper<SparePart> wrapper = new MPJLambdaWrapper<SparePart>()
.selectAll(SparePart.class)
.selectCollection(RRepairDevice.class, SparePartVO::getRepairDeviceList)
.leftJoin(RRepairDevice.class, on -> on.eq(RRepairDevice::getRId, SparePart::getId).eq(RRepairDevice::getRType, 1))
.eq(SparePart::getId, id);
var sparePartVO = this.selectJoinOne(SparePartVO.class, wrapper);
var deviceNoStr = Opt.ofEmptyAble(sparePartVO.getRepairDeviceList())
.map(l -> l.stream().map(RRepairDevice::getDeviceNo).collect(Collectors.joining(",")))
.orElse("暂无");
var jsonObj = JSONUtil.ofObj()
.set("agent_id", 2358374016L)
......@@ -132,10 +142,12 @@ public class SparePartServiceImpl extends MPJBaseServiceImpl<SparePartMapper, Sp
### 备件已发货
### 项目名称:{}
### 快递单号:{}
### 借出设备序列号:{}
### 发货日期:{}
### 发送时间:{}
""", sparePart.getProjectName(), Opt.ofBlankAble(sparePart.getTrackingNumber()).orElse("暂无"),
Opt.ofBlankAble(DateUtil.formatDate(sparePart.getShipDate())).orElse("暂无"), DateUtil.now());
""", sparePartVO.getProjectName(), Opt.ofBlankAble(sparePartVO.getTrackingNumber()).orElse("暂无"),
deviceNoStr,
Opt.ofBlankAble(DateUtil.formatDate(sparePartVO.getShipDate())).orElse("暂无"), DateUtil.now());
content.set("text", text);
msg.set("msgtype", "markdown").set("markdown", content);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!