grs
yjxx 3 weeks ago
parent 59db863195
commit c97c4a15db

@ -4,8 +4,10 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
@Data @Data
public class SendMessageDTO { public class SendMessageDTO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long Id; private Long Id;

@ -56,7 +56,7 @@ public class AdminController {
@DeleteMapping("/delete/{id}") @DeleteMapping("/delete/{id}")
public Result<String> delete(@PathVariable Long id, @RequestParam @NotNull String operation) { public Result<String> delete(@PathVariable Long id, @RequestParam @NotNull String operation) {
User user = userService.getById(id); User user = userService.getById(id);
if(user == null) { if (user == null) {
return new Result<>(401, "账号不存在", ""); return new Result<>(401, "账号不存在", "");
} }
switch (operation) { switch (operation) {
@ -77,12 +77,6 @@ public class AdminController {
// 管理员发送消息 // 管理员发送消息
@PostMapping("/sendMessage") @PostMapping("/sendMessage")
public Result<String> sendMessage(@RequestBody @NotNull SendMessageDTO sendMessageDTO) { public Result<String> sendMessage(@RequestBody @NotNull SendMessageDTO sendMessageDTO) {
LambdaQueryWrapper<User> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
userLambdaQueryWrapper.eq(User::getId, sendMessageDTO.getId());
User user = userService.getOne(userLambdaQueryWrapper);
if(user == null) {
return new Result<>(404, "用户不存在", "");
}
Message message = SendMessageUtil.sendMessage(sendMessageDTO); Message message = SendMessageUtil.sendMessage(sendMessageDTO);
messageService.save(message); messageService.save(message);
return new Result<>(200, "发送成功", ""); return new Result<>(200, "发送成功", "");
@ -96,7 +90,7 @@ public class AdminController {
List<ExpressListDTO> expressListDTOList = new ArrayList<>(); List<ExpressListDTO> expressListDTOList = new ArrayList<>();
// 获取所有的快递记录 // 获取所有的快递记录
List<Records> recordsList = recordsService.list(); List<Records> recordsList = recordsService.list();
for(Records records : recordsList) { for (Records records : recordsList) {
Goods goods = goodsService.getById(records.getGoodsId()); Goods goods = goodsService.getById(records.getGoodsId());
// 查询寄件人、收件人、签收者、快递员信息 // 查询寄件人、收件人、签收者、快递员信息
User sender = userService.getById(records.getSendUserId()); User sender = userService.getById(records.getSendUserId());

Loading…
Cancel
Save