| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | .in(THouse::getId, houseIds)); |
| | | list.forEach(item -> { |
| | | item.setHouseName(houseList.stream().filter(house -> house.getId().equals(item.getHouseId())).findFirst().orElse(new THouse()).getHouseName()); |
| | | item.setHouseAddress(houseList.stream().filter(house -> house.getId().equals(item.getHouseId())).findFirst().orElse(new THouse()).getHouseAddress()); |
| | | }); |
| | | return R.ok(list); |
| | | } |
| | |
| | | @ApiOperation(value = "添加报修信息") |
| | | @PostMapping(value = "/addFault") |
| | | public R<String> addFault(@RequestBody TFaultRepairMessageDTO dto) { |
| | | dto.setTenantId(tokenService.getLoginUserApplet().getUserId()); |
| | | LocalDate now = LocalDate.now(); |
| | | String replace = (now + "").replace("-", ""); |
| | | int size = tFaultRepairMessageService.list(new LambdaQueryWrapper<TFaultRepairMessage>() |
| | | .likeRight(TFaultRepairMessage::getCreateTime, LocalDate.now())).size(); |
| | | dto.setCode(replace.substring(2)+String.format("%03d", size+1)); |
| | | tFaultRepairMessageService.save(dto); |
| | | return R.ok(); |
| | | } |