Commit 477b0f6a by huangjy

fix:修复bug

parent 70eba14e
package com.makeit.module.controller.wechat.alarm; package com.makeit.module.controller.wechat.alarm;
import com.google.common.collect.Maps;
import com.makeit.common.dto.BaseIdDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO; import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO;
import com.makeit.enums.CommonEnum;
import com.makeit.service.platform.alarm.PlatAlarmRecordService; import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.utils.user.common.CommonUserUtil; import com.makeit.utils.user.common.CommonUserUtil;
import com.makeit.vo.platform.alarm.PlatAlarmRecordVO; import com.makeit.vo.platform.alarm.PlatAlarmRecordVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Api(tags = "平台端小程序-告警记录") @Api(tags = "平台端小程序-告警记录")
@RestController @RestController
@RequestMapping("/wechat/plat/alarm-record") @RequestMapping("/wechat/plat/alarm-record")
...@@ -28,12 +33,18 @@ public class PlatAlarmRecordWechatController { ...@@ -28,12 +33,18 @@ public class PlatAlarmRecordWechatController {
@ApiOperation("列表") @ApiOperation("列表")
@PostMapping("page") @PostMapping("page")
public ApiResponseEntity<PageVO<PlatAlarmRecordVO>> page(@RequestBody PageReqDTO<PlatAlarmRecordQueryDTO> dto) { public ApiResponseEntity<Map<String,Object>> page(@RequestBody PageReqDTO<PlatAlarmRecordQueryDTO> dto) {
//小程序告警记录只看到发给自己的告警 //小程序告警记录只看到发给自己的告警
String userId = CommonUserUtil.getUserId(); String userId = CommonUserUtil.getUserId();
PlatAlarmRecordQueryDTO data = dto.getData(); PlatAlarmRecordQueryDTO data = dto.getData();
data.setNotifyUser(userId); data.setNotifyUser(userId);
return ApiResponseUtils.success(platAlarmRecordService.page(dto));
Map<String,Object> resMap = Maps.newHashMap();
PageVO<PlatAlarmRecordVO> page = platAlarmRecordService.page(dto);
boolean b = page.getList().stream().anyMatch(platAlarmRecord -> StringUtils.equals(CommonEnum.NO.getValue(), platAlarmRecord.getStatus()));
resMap.put("todoFlag",b);
resMap.put("page",page);
return ApiResponseUtils.success(resMap);
} }
@ApiOperation("查看") @ApiOperation("查看")
@PostMapping("view") @PostMapping("view")
......
...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.makeit.common.dto.BaseIdDTO; import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.entity.BaseBusEntity; import com.makeit.common.entity.BaseBusEntity;
import com.makeit.common.entity.BaseEntity; import com.makeit.common.entity.BaseEntity;
...@@ -59,11 +60,7 @@ import org.springframework.stereotype.Service; ...@@ -59,11 +60,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
...@@ -32,6 +32,7 @@ import com.makeit.service.platform.device.PlatDeviceService; ...@@ -32,6 +32,7 @@ import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderService; import com.makeit.service.platform.elder.PlatElderService;
import com.makeit.service.platform.space.PlatBedService; import com.makeit.service.platform.space.PlatBedService;
import com.makeit.service.platform.space.PlatRoomBedDeviceService; import com.makeit.service.platform.space.PlatRoomBedDeviceService;
import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.platform.space.PlatSpaceService; import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.area.AreaUtil; import com.makeit.utils.area.AreaUtil;
import com.makeit.utils.area.ChinaAreaVO; import com.makeit.utils.area.ChinaAreaVO;
...@@ -83,6 +84,8 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -83,6 +84,8 @@ public class DataScreenServiceImpl implements DataScreenService {
private PlatOrgService platOrgService; private PlatOrgService platOrgService;
@Autowired @Autowired
private PlatRoomBedDeviceService platRoomBedDeviceService; private PlatRoomBedDeviceService platRoomBedDeviceService;
@Autowired
private PlatRoomService platRoomService;
@Override @Override
public PlatAgeStatisticsVO ageStatistics(PlatDataScreenQueryDTO dto) { public PlatAgeStatisticsVO ageStatistics(PlatDataScreenQueryDTO dto) {
...@@ -260,13 +263,15 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -260,13 +263,15 @@ public class DataScreenServiceImpl implements DataScreenService {
JoinUtil.joinSplit(list, platSpaceService, PlatElderListVO::getSpacePath, PlatSpace::getId, (e, l) -> { JoinUtil.joinSplit(list, platSpaceService, PlatElderListVO::getSpacePath, PlatSpace::getId, (e, l) -> {
e.setSpacePathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-")); e.setSpacePathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-"));
}); });
/* JoinUtil.join(list, platBedService, PlatElderListVO::getBedId, PlatBed::getId, (e, l) -> { JoinUtil.joinSplit(list, platRoomService, PlatElderListVO::getSpacePath, PlatRoom::getId, (e, l) -> {
e.setBedName(l.getName()); e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatRoom::getName));
});*/ });
JoinUtil.joinSplit(list, platBedService, PlatElderListVO::getSpacePath, PlatBed::getId, (e, l) -> { JoinUtil.joinSplit(list, platBedService, PlatElderListVO::getSpacePath, PlatBed::getId, (e, l) -> {
e.setSpacePathName(e.getSpacePathName() + "-" + StreamUtil.join(l, Objects::nonNull, PlatBed::getName)); e.setSpacePathName(e.getSpacePathName() + "-" + StreamUtil.join(l, Objects::nonNull, PlatBed::getName));
}); });
Map<String, PlatElderListVO> map = list.stream().collect(Collectors.toMap(PlatElderListVO::getId, Function.identity()));
Map<String,
PlatElderListVO> map = list.stream().collect(Collectors.toMap(PlatElderListVO::getId, Function.identity()));
return map; return map;
} }
......
...@@ -147,16 +147,19 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -147,16 +147,19 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
for (PlatDeviceListVO record : records) { for (PlatDeviceListVO record : records) {
String spaceParentPath = record.getSpaceParentPath(); String spaceParentPath = record.getSpaceParentPath();
String spaceName = "";
if (StringUtils.isNotBlank(spaceParentPath)) { if (StringUtils.isNotBlank(spaceParentPath)) {
String spaceNameJoin = Stream.of(spaceParentPath.split(",")).map(vo -> spaceIdNameMap.get(vo)).collect(Collectors.joining("-")); String spaceNameJoin = Stream.of(spaceParentPath.split(",")).map(vo -> spaceIdNameMap.get(vo)).collect(Collectors.joining("-"));
String spaceName = spaceNameJoin + "-" + record.getSpaceName() + "-" + record.getRoomName(); spaceName = spaceNameJoin + "-" + record.getSpaceName() + "-" + record.getRoomName();
} else {
spaceName = record.getSpaceName() + "-" + record.getRoomName();
}
if (StringUtils.isNotBlank(record.getBedName())) { if (StringUtils.isNotBlank(record.getBedName())) {
spaceName = spaceName + "-" + record.getBedName(); spaceName = spaceName + "-" + record.getBedName();
} }
record.setSpaceName(spaceName); record.setSpaceName(spaceName);
} }
}
JoinUtil.join(records, platOrgService, PlatDeviceListVO::getOrgId, PlatOrg::getId, (d, o) -> { JoinUtil.join(records, platOrgService, PlatDeviceListVO::getOrgId, PlatOrg::getId, (d, o) -> {
d.setOrgName(o.getName()); d.setOrgName(o.getName());
......
...@@ -389,6 +389,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -389,6 +389,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
TreeDTOVO::getParentId, Collectors.toMap(TreeDTOVO::getName, Function.identity(),(v1,v2) -> v2) TreeDTOVO::getParentId, Collectors.toMap(TreeDTOVO::getName, Function.identity(),(v1,v2) -> v2)
)); ));
List<SysConfigVO> sysConfigVOS1 = sysConfigService.viewListByCategoryCode(SysConfigCategoryConst.ELDER_CERTIFICATE_TYPE);
ExcelImportVo excelImportVo = ExcelValidatorUtil.validateMain(3, list, l -> { ExcelImportVo excelImportVo = ExcelValidatorUtil.validateMain(3, list, l -> {
int start = 3; int start = 3;
...@@ -397,6 +399,13 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -397,6 +399,13 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
PlatElderImportDTO platElderImportDTO = list.get(i); PlatElderImportDTO platElderImportDTO = list.get(i);
boolean check = check(platElderImportDTO, sysConfigVOS1);
boolean success = true;
if (check) {
errorVoList.add(new ExcelErrorVo(i + start, "证件类型和证件号","证件号不能重复"));
}
List<String> excelField = Arrays.asList( List<String> excelField = Arrays.asList(
"小区", "小区",
"楼栋", "楼栋",
...@@ -413,7 +422,6 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -413,7 +422,6 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
// platElderImportDTO.getBedName() // platElderImportDTO.getBedName()
); );
boolean success = true;
List<String> spaceIdList = new ArrayList<>(10); List<String> spaceIdList = new ArrayList<>(10);
...@@ -592,6 +600,20 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -592,6 +600,20 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
return excelImportVo; return excelImportVo;
} }
private boolean check(PlatElderImportDTO dto,List<SysConfigVO> sysConfigVOS1) {
Optional<SysConfigVO> configVO = sysConfigVOS1.stream().filter(sysConfigVO -> sysConfigVO.getName().equals(dto.getCertificateType())).findFirst();
String type = "";
if (configVO.isPresent()) {
type = configVO.get().getValue();
}
PlatElder old = getOne(new QueryWrapper<PlatElder>().lambda()
.eq(StringUtils.isNotEmpty(type),PlatElder::getCertificateType, type)
.eq(PlatElder::getCertificateNumber, dto.getCertificateNumber())
);
return true;
}
private void check(PlatElderAddDTO dto) { private void check(PlatElderAddDTO dto) {
PlatElder old = getOne(new QueryWrapper<PlatElder>().lambda() PlatElder old = getOne(new QueryWrapper<PlatElder>().lambda()
.eq(PlatElder::getCertificateType, dto.getCertificateType()) .eq(PlatElder::getCertificateType, dto.getCertificateType())
......
...@@ -70,4 +70,5 @@ public interface PlatRoomService extends IService<PlatRoom> { ...@@ -70,4 +70,5 @@ public interface PlatRoomService extends IService<PlatRoom> {
List<PlatSpaceAndRoomVO> spaceList(List<String> orgIds); List<PlatSpaceAndRoomVO> spaceList(List<String> orgIds);
List<PlatSpaceAndRoomVO> roomList(List<String> orgIds); List<PlatSpaceAndRoomVO> roomList(List<String> orgIds);
List<PlatRoom> listBySpaceId(String spaceId);
} }
...@@ -188,5 +188,9 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i ...@@ -188,5 +188,9 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
public List<PlatSpaceAndRoomVO> roomList(List<String> orgIds) { public List<PlatSpaceAndRoomVO> roomList(List<String> orgIds) {
return baseMapper.roomList(orgIds); } return baseMapper.roomList(orgIds); }
@Override
public List<PlatRoom> listBySpaceId(String spaceId) {
return baseMapper.selectList(new QueryWrapper<PlatRoom>().lambda()
.eq(PlatRoom::getSpaceId,spaceId));
}
} }
...@@ -140,6 +140,12 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -140,6 +140,12 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
this.updateById(space); this.updateById(space);
List<PlatRoom> platRoomList = platRoomService.listBySpaceId(space.getId());
for (PlatRoom platRoom : platRoomList) {
platRoom.setSpacePath(dto.getParentPath() + "," + space.getId());
platRoomService.updateById(platRoom);
}
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment