Merge remote-tracking branch 'origin/master'
| | |
| | | package com.sinata.web.controller.applet; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.core.redis.RedisCache; |
| | | import com.sinata.system.domain.MwApplication; |
| | |
| | | @ApiOperation("提交入驻申请") |
| | | @PostMapping("/set") |
| | | public R pageList(@Valid @RequestBody MwApplication mwApplication) { |
| | | log.error("提交入驻申请入参:{}", mwApplication); |
| | | log.debug("提交入驻申请入参:{}", JSONObject.toJSONString(mwApplication)); |
| | | String string = redisCache.getCacheObject(mwApplication.getPhone()).toString(); |
| | | if (!mwApplication.getCode().equals(string)){ |
| | | return R.fail("验证码错误,请重试"); |
| | |
| | | package com.sinata.web.controller.applet; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.core.domain.entity.SysDictData; |
| | | import com.sinata.common.core.domain.entity.SysUser; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.utils.DateUtils; |
| | | import com.sinata.common.utils.SecurityUtils; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.*; |
| | | import com.sinata.system.domain.dto.*; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.service.*; |
| | | import com.sinata.system.domain.MwBox; |
| | | import com.sinata.system.domain.MwCheckoutRecord; |
| | | import com.sinata.system.domain.MwCheckoutRecordItem; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.MwDisposalHandleRecord; |
| | | import com.sinata.system.domain.MwDisposalHandleRecordItem; |
| | | import com.sinata.system.domain.MwDisposalRecord; |
| | | import com.sinata.system.domain.MwDisposalRecordItem; |
| | | import com.sinata.system.domain.MwStagingRoom; |
| | | import com.sinata.system.domain.MwTransitCar; |
| | | import com.sinata.system.domain.MwTransitCarCollectPoint; |
| | | import com.sinata.system.domain.MwTransitRoute; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.BoxListDto; |
| | | import com.sinata.system.domain.dto.CarDto; |
| | | import com.sinata.system.domain.dto.CollectCarTotalUpDto; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.HospitalCollectTotalUp1Dto; |
| | | import com.sinata.system.domain.dto.HospitalCollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.SignCollectDto; |
| | | import com.sinata.system.service.ISysDictDataService; |
| | | import com.sinata.system.service.ISysUserService; |
| | | import com.sinata.system.service.MwBoxService; |
| | | import com.sinata.system.service.MwCheckoutRecordItemService; |
| | | import com.sinata.system.service.MwCheckoutRecordService; |
| | | import com.sinata.system.service.MwCollectRecordService; |
| | | import com.sinata.system.service.MwDisposalHandleRecordItemService; |
| | | import com.sinata.system.service.MwDisposalHandleRecordService; |
| | | import com.sinata.system.service.MwDisposalRecordItemService; |
| | | import com.sinata.system.service.MwDisposalRecordService; |
| | | import com.sinata.system.service.MwStagingRoomService; |
| | | import com.sinata.system.service.MwTransitCarCollectPointService; |
| | | import com.sinata.system.service.MwTransitCarService; |
| | | import com.sinata.system.service.MwTransitRouteService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Random; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @ApiOperation(value = "装车",tags = "运输人员") |
| | | @PostMapping("/box/collect") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<List<CollectDto>> collect(@RequestBody SignCollectDto signCollectDto) { |
| | | SysUser sysUser1 = SecurityUtils.getLoginUser().getUser(); |
| | | SysUser sysUser = userService.getById(sysUser1.getUserId()); |
| | |
| | | |
| | | @ApiOperation(value = "确认接受",tags = "处置人员") |
| | | @PostMapping("/end/down/collect/confirm") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R tanscollecttotal4(@RequestBody BoxListDto boxListDto) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.getById(userId); |
| | | SysDepartment byId = departmentService.getById(sysUser.getDepartmentId()); |
| | | //将record变为已接受 |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStatus,2).in(MwCollectRecord::getBoxNumber, boxListDto.getBoxNum()).list(); |
| | |
| | | List<CollectDto> collectDtos = collectRecordService.getGroupWithStatus(boxNumber,byId.getDepartmentId(),3); |
| | | return R.ok(collectDtos); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "处置操作",tags = "处置人员") |
| | | @PostMapping("/wait/out") |
| | | public R<List<CollectDto>> list2(@RequestBody BoxListDto boxListDto) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.getById(userId); |
| | | SysDepartment byId = departmentService.getById(sysUser.getDepartmentId()); |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStatus, 3).in(MwCollectRecord::getBoxNumber, boxListDto.getBoxNum()).list(); |
| | | if (list.isEmpty()){ |
| | |
| | | @ApiOperation("库存信息") |
| | | @PostMapping("/list") |
| | | public R<List<CollectDto>> list(String boxNumber) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser sysUser = userService.getById(userId); |
| | | List<CollectDto> collectDtos = collectRecordService.getGroup(boxNumber,sysUser.getDepartmentId()); |
| | | return R.ok(collectDtos); |
| | | } |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.util.List; |
| | | import javax.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation("微型设备列表") |
| | | @GetMapping("/list") |
| | | public R<List<MwMicroEquipmentVO>> getList() { |
| | | return R.ok(mwMicroEquipmentService.getList()); |
| | | @GetMapping("/list/{departmentId}") |
| | | public R<List<MwMicroEquipmentVO>> getList( |
| | | @ApiParam(name = "departmentId", value = "医院id", required = true) @PathVariable("departmentId") Long departmentId) { |
| | | return R.ok(mwMicroEquipmentService.getList(departmentId)); |
| | | } |
| | | } |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取全部/区域/医疗机构/处置单位/监管单位树-搜索框用", notes = "0:全部 1:区域 2:医疗机构 3:处置单位 4:监管单位") |
| | | @ApiOperation(value = "获取全部/区域/医疗机构/处置单位/监管单位树-搜索框用", notes = "0:全部 1:区域 2:医疗机构 3:处置单位 4:监管单位 5:医疗机构、监管单位") |
| | | @GetMapping("/departmentSearchTree") |
| | | @ApiImplicitParam(name = "type", value = "查询类型", required = true) |
| | | public R<List<SysDepartmentVO>> getDepartmentSearchTree(@RequestParam(value = "type", required = true) @NotNull(message = "类型不能为空") Integer type) { |
| | |
| | | import com.sinata.RuoYiApplication; |
| | | import com.sinata.system.mapper.SysDepartmentMapper; |
| | | import com.sinata.system.service.ISysDictTypeService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import com.sinata.system.service.biz.TaskService; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | |
| | | private SysDepartmentMapper departmentMapper; |
| | | @Resource |
| | | private ISysDictTypeService sysDictTypeService; |
| | | @Resource |
| | | private TaskService taskService; |
| | | |
| | | @Resource |
| | | private SysDepartmentService sysDepartmentService; |
| | | |
| | | @Test |
| | | public void test(){ |
| | |
| | | |
| | | System.out.println(sysDictTypeService.list()); |
| | | } |
| | | |
| | | @Test |
| | | public void testTask() { |
| | | taskService.checkoutOverTime(); |
| | | } |
| | | |
| | | @Test |
| | | public void test3() { |
| | | System.out.println(sysDepartmentService.getRegionName(sysDepartmentService.getById(21))); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("关键字") |
| | | private String keyword; |
| | | |
| | | @ApiModelProperty("字典类型") |
| | | private String dictType; |
| | | } |
| | |
| | | @ApiModelProperty("设备状态 1:在线 0:离线") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("监控设备编号") |
| | | private String deviceNumber; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "作业时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("附件信息") |
| | | private String nickName; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | DepartmentTagInfoVO getTagInfo(Long id); |
| | | |
| | | DisposalRecordStaticsVO getDisposalData(@Param("query") MwDisposalRecordQuery query, |
| | | @Param("treeCode") String treeCode); |
| | | } |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | List<MwMicroEquipmentVO> getList(); |
| | | List<MwMicroEquipmentVO> getList(Long departmentId); |
| | | } |
| | |
| | | //处置 |
| | | for (SysDictData sysDictData : wasteTypeList) { |
| | | BigDecimal totalWeight = disposaledList.stream().filter(item -> item.getWasteType().equals(sysDictData.getDictCode()) && |
| | | finalSdf.format(item.getReceiveTime()).equals(date)).map(MwDisposalRecordReportVO::getWeight) |
| | | finalSdf.format(item.getDisposalTime()).equals(date)).map(MwDisposalRecordReportVO::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | departmentReportItemVO.getData().add(totalWeight); |
| | | } |
| | |
| | | } |
| | | for (SysDictData sysDictData : wasteTypeList) { |
| | | BigDecimal weight = checkoutRecordList.stream().filter(e -> e.getWasteType().equals(sysDictData.getDictCode()) && |
| | | finalSdf.format(e.getCollectTime()).equals(date)).map(MwCollectRecordVO::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | finalSdf.format(e.getCheckoutTime()).equals(date)).map(MwCollectRecordVO::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | departmentReportItemVO.getData().add(weight); |
| | | } |
| | | for (SysDictData sysDictData : wasteTypeList) { |
| | |
| | | // 过滤出需要预警的记录 |
| | | List<MwCollectRecord> recordList = collectRecordList.stream() |
| | | .filter(item -> item.getWasteType().equals(configItem.getWasteType()) && |
| | | DateUtils.timeDistanceHour(new Date(), item.getCollectTime()) > configItem.getValue()) |
| | | DateUtils.timeDistanceHour(new Date(), item.getCollectTime()) |
| | | >= configItem.getValue()) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (CollUtils.isEmpty(recordList)) { |
| | |
| | | if (Objects.nonNull(mwApplication.getDepartmentId())) { |
| | | mwApplication.setRegion(sysDepartmentService.getRegionName(sysDepartmentService.getById(mwApplication.getDepartmentId()))); |
| | | } |
| | | save(mwApplication); |
| | | } |
| | | } |
| | |
| | | DisposalRecordStaticsVO vo = null; |
| | | if (StringUtils.isNotBlank(treeCode)) { |
| | | vo = baseMapper.getStaticsData(query, treeCode); |
| | | DisposalRecordStaticsVO disposalRecordStaticsVO = baseMapper.getDisposalData(query, |
| | | treeCode); |
| | | vo.setTotalHandledQuantity(disposalRecordStaticsVO.getTotalHandledQuantity()); |
| | | vo.setTotalHandledWeight(disposalRecordStaticsVO.getTotalHandledWeight()); |
| | | } |
| | | return vo; |
| | | } |
| | |
| | | public MwMicroEquipmentRecordVO detail(Long id) { |
| | | MwMicroEquipmentRecordVO mwMicroEquipmentRecordVO = BeanUtils.copyBean(this.getById(id), MwMicroEquipmentRecordVO.class); |
| | | if (Objects.nonNull(mwMicroEquipmentRecordVO)) { |
| | | MwMicroEquipment equipment = mwMicroEquipmentService.getById( |
| | | mwMicroEquipmentRecordVO.getEquipmentId()); |
| | | if (Objects.nonNull(equipment)) { |
| | | mwMicroEquipmentRecordVO.setEquipmentName(equipment.getEquipmentName()); |
| | | } |
| | | mwMicroEquipmentRecordVO.setMedicalWasteList(mwStagingRoomService.queryMedicalWasteList(mwMicroEquipmentRecordVO.getId())); |
| | | } |
| | | return mwMicroEquipmentRecordVO; |
| | |
| | | import com.sinata.common.utils.BeanUtils; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.MwMicroEquipment; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.MwMicroEquipmentDTO; |
| | | import com.sinata.system.domain.query.MwMicroEquipmentQuery; |
| | | import com.sinata.system.domain.query.StorageRecordQuery; |
| | |
| | | import com.sinata.system.mapper.MwMicroEquipmentMapper; |
| | | import com.sinata.system.service.MwMicroEquipmentService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwMicroEquipmentVO> getList() { |
| | | SysDepartment myDepartment = sysDepartmentService.getMyDepartment(); |
| | | //TODO 待完善 |
| | | public List<MwMicroEquipmentVO> getList(Long departmentId) { |
| | | // SysDepartment myDepartment = sysDepartmentService.getMyDepartment(); |
| | | List<MwMicroEquipment> list = this.lambdaQuery() |
| | | .eq(MwMicroEquipment::getStatus, MicroEquipmentStatusEnum.NORMAL.getCode()).list(); |
| | | .eq(MwMicroEquipment::getStatus, MicroEquipmentStatusEnum.NORMAL.getCode()) |
| | | .eq(MwMicroEquipment::getDepartmentId, departmentId).list(); |
| | | return BeanUtils.copyList(list, MwMicroEquipmentVO.class); |
| | | /*if (Objects.nonNull(myDepartment)) { |
| | | if (myDepartment.getOrgType().equals(DepartmentEnum.MEDICAL_INSTITUTION.getCode())) { |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return PageDTO.empty(0L, 0L); |
| | | } |
| | | Page<MwMonitorDeviceVO> page = baseMapper.pageMonitorPage(new Page<>(query.getPageCurr(), query.getPageSize()), query.getStatus(), treeCode, deviceList); |
| | | page.getRecords().stream().filter(item -> deviceList.contains(item.getDeviceNumber())).peek(item -> { |
| | | List<MwMonitorDeviceVO> records = page.getRecords(); |
| | | records = records.stream().filter(item -> deviceList.contains(item.getDeviceNumber())).peek(item -> { |
| | | item.setStatus(1); |
| | | }); |
| | | }).collect(Collectors.toList()); |
| | | return PageDTO.of(page); |
| | | } |
| | | |
| | |
| | | if (Objects.isNull(dto.getId())) { |
| | | throw new ServiceException("车辆id不能为空"); |
| | | } |
| | | Long count = lambdaQuery().eq(MwTransitCar::getLicensePlateNumber, |
| | | dto.getLicensePlateNumber()).ne(MwTransitCar::getId, dto.getId()).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("车牌号已存在"); |
| | | } |
| | | MwTransitCar mwTransitCar = BeanUtils.copyBean(dto, MwTransitCar.class); |
| | | updateById(mwTransitCar); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | mwWarningConfigVO = BeanUtil.copyProperties(mwWarningConfig, MwWarningConfigVO.class); |
| | | List<MwWarningConfigItem> mwWarningConfigItems = mwWarningConfigItemService.lambdaQuery().eq(MwWarningConfigItem::getConfigId, mwWarningConfig.getId()).list(); |
| | | if (type.equals(WarningConfigTypeEnum.MEDICAL_WASTE.getCode())) { |
| | | mwWarningConfigVO.setWarningConfigItemList(BeanUtil.copyToList(mwWarningConfigItems, MwWarningConfigItemVO.class)); |
| | | if (CollUtils.isEmpty(mwWarningConfigItems)) { |
| | | List<SysDictDataVO> sysDictDataVOS = sysDictDataService.medicalWasteTypeList(); |
| | | Map<Long, MwWarningConfigItemVO> configItemMap = new HashMap<>(); |
| | | if (CollUtils.isNotEmpty(mwWarningConfigItems)) { |
| | | List<MwWarningConfigItemVO> mwWarningConfigItemVOS = BeanUtil.copyToList(mwWarningConfigItems, MwWarningConfigItemVO.class); |
| | | configItemMap = mwWarningConfigItemVOS.stream().collect(Collectors.toMap(MwWarningConfigItemVO::getWasteType, Function.identity())); |
| | | } |
| | | Map<Long, MwWarningConfigItemVO> finalConfigItemMap = configItemMap; |
| | | List<MwWarningConfigItemVO> res = sysDictDataVOS.stream().map(item -> { |
| | | MwWarningConfigItemVO vo = new MwWarningConfigItemVO(); |
| | | vo.setWasteType(item.getDictCode()); |
| | | vo.setWasteTypeStr(item.getDictLabel()); |
| | | return vo; |
| | | MwWarningConfigItemVO config = finalConfigItemMap.getOrDefault(item.getDictCode(), new MwWarningConfigItemVO()); |
| | | config.setWasteType(item.getDictCode()); |
| | | config.setWasteTypeStr(item.getDictLabel()); |
| | | return config; |
| | | }).collect(Collectors.toList()); |
| | | mwWarningConfigVO.setWarningConfigItemList(res); |
| | | } |
| | | |
| | | } |
| | | if (type.equals(WarningConfigTypeEnum.STAGING_ROOM_CAPACITY.getCode())) { |
| | | mwWarningConfigVO.setWarningConfigItemList(BeanUtil.copyToList(mwWarningConfigItems, MwWarningConfigItemVO.class)); |
| | |
| | | import com.sinata.system.domain.MwApplication; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.SysDepartmentInfo; |
| | | import com.sinata.system.domain.SysUserDepartment; |
| | | import com.sinata.system.domain.dto.DisposalUnitDTO; |
| | | import com.sinata.system.domain.dto.MedicalInstitutionDTO; |
| | | import com.sinata.system.domain.dto.RegulatoryUnitDTO; |
| | |
| | | import com.sinata.system.domain.vo.SysDepartmentVO; |
| | | import com.sinata.system.enums.DepartmentEnum; |
| | | import com.sinata.system.mapper.SysDepartmentMapper; |
| | | import com.sinata.system.service.ISysUserService; |
| | | import com.sinata.system.service.SysDepartmentInfoService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import com.sinata.system.service.SysUserDepartmentService; |
| | |
| | | private final SysUserDepartmentService sysUserDepartmentService; |
| | | private final RedisTemplate<Object, Object> redisTemplate; |
| | | private final SysDepartmentInfoService sysDepartmentInfoService; |
| | | private final ISysUserService sysUserService; |
| | | /** |
| | | * 获取区域树 |
| | | * @return |
| | |
| | | break; |
| | | case 4: |
| | | childrenMap = getChildrenDepartmentByOrgType(myDepartment, Arrays.asList(DepartmentEnum.REGION.getCode(), DepartmentEnum.REGULATORY_UNIT.getCode())); |
| | | break; |
| | | case 5: |
| | | childrenMap = getChildrenDepartmentByOrgType(myDepartment, Arrays.asList(DepartmentEnum.REGION.getCode(), DepartmentEnum.MEDICAL_INSTITUTION.getCode(), DepartmentEnum.DISPOSAL_UNIT.getCode())); |
| | | break; |
| | | default: |
| | | childrenMap = getChildrenDepartmentByOrgType(myDepartment, null); |
| | |
| | | @NotNull |
| | | private Map<Long, List<SysDepartment>> getChildrenDepartmentByOrgType(SysDepartment myDepartment, List<Integer> orgTypes) { |
| | | List<SysDepartment> sysDepartmentList = this.lambdaQuery() |
| | | .in(CollUtils.isNotEmpty(orgTypes), SysDepartment::getOrgType, orgTypes) |
| | | .likeRight(SysDepartment::getTreeCode, myDepartment.getTreeCode()) |
| | | .orderByDesc(SysDepartment::getCreateTime) |
| | | .list(); |
| | |
| | | .collect(Collectors.groupingBy(SysDepartment::getParentId)); |
| | | } |
| | | |
| | | @NotNull |
| | | private Map<Long, List<SysDepartment>> getChildrenDepartmentMap(SysDepartment myDepartment) { |
| | | List<SysDepartment> sysDepartmentList = this.lambdaQuery() |
| | | .likeRight(SysDepartment::getTreeCode, myDepartment.getTreeCode()) |
| | | .orderByDesc(SysDepartment::getCreateTime) |
| | | .list(); |
| | | return sysDepartmentList.stream() |
| | | .collect(Collectors.groupingBy(SysDepartment::getParentId)); |
| | | } |
| | | @Override |
| | | public SysDepartment getDepartmentByParentId(Long parentId) { |
| | | return this.lambdaQuery().eq(SysDepartment::getId, parentId).one(); |
| | |
| | | // if (!currentDepartment.getOrgType().equals(DepartmentEnum.REGION.getCode())) { |
| | | // return root; |
| | | // } |
| | | Map<Long, List<SysDepartment>> childrenMap = getChildrenDepartmentByOrgType(currentDepartment, Collections.singletonList(DepartmentEnum.REGION.getCode())); |
| | | Map<Long, List<SysDepartment>> childrenMap = getChildrenDepartmentMap(currentDepartment); |
| | | SysDepartmentVO sysDepartmentVO = fillChildrenTreeModel(currentDepartment, childrenMap); |
| | | if (sysDepartmentVO.getTreeCode().length()==10){ |
| | | SysDepartment sysDepartment = this.baseMapper.selectById(sysDepartmentVO.getParentId()); |
| | |
| | | .orderByDesc(SysDepartment::getCreateTime) |
| | | .list(); |
| | | List<Long> departmentIds = sysDepartmentList.stream().map(SysDepartment::getId).collect(Collectors.toList()); |
| | | Long count = sysUserDepartmentService.lambdaQuery().in(SysUserDepartment::getDepartmentId, departmentIds).count(); |
| | | Long count = sysUserService.lambdaQuery().in(SysUser::getDepartmentId, departmentIds).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该区域已存在用户,无法删除"); |
| | | throw new ServiceException("该区域已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void deleteMedical(Long id) { |
| | | Long count = sysUserDepartmentService.lambdaQuery().eq(SysUserDepartment::getDepartmentId, id).count(); |
| | | Long count = sysUserService.lambdaQuery().eq(SysUser::getDepartmentId, id).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该医疗机构已存在用户,无法删除"); |
| | | throw new ServiceException("该医疗机构已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void deleteDisposalUnit(Long id) { |
| | | Long count = sysUserDepartmentService.lambdaQuery().eq(SysUserDepartment::getDepartmentId, id).count(); |
| | | Long count = sysUserService.lambdaQuery().eq(SysUser::getDepartmentId, id).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该处置单位构已存在用户,无法删除"); |
| | | throw new ServiceException("该处置单位构已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void deleteRegulatoryUnit(Long id) { |
| | | Long count = sysUserDepartmentService.lambdaQuery().eq(SysUserDepartment::getDepartmentId, id).count(); |
| | | Long count = sysUserService.lambdaQuery().eq(SysUser::getDepartmentId, id).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该监管单位构已存在用户,无法删除"); |
| | | throw new ServiceException("该监管单位构已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public PageDTO<SysDictDataVO> pageList(KeyWordQuery query) { |
| | | Page<SysDictData> result = this.lambdaQuery().like(StringUtils.isNotBlank(query.getKeyword()), SysDictData::getDictLabel, query.getKeyword()).page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | Page<SysDictData> result = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(query.getKeyword()), SysDictData::getDictLabel, query.getKeyword()) |
| | | .eq(StringUtils.isNotBlank(query.getDictType()), SysDictData::getDictType, query.getDictType()) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | List<String> dictTypeList = result.getRecords().stream().map(SysDictData::getDictType).distinct().collect(Collectors.toList()); |
| | | if (CollUtils.isNotEmpty(dictTypeList)) { |
| | | PageDTO<SysDictDataVO> sysDictDataVOPageDTO = PageDTO.of(result, SysDictDataVO.class); |
| | |
| | | AND MBD.DEVICE_STATUS = #{query.deviceStatus} |
| | | </if> |
| | | </where> |
| | | ORDER BY MBD.CREATE_TIME DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | AND mcr.CHECKOUT_TIME BETWEEN #{query.checkoutTimeStart} AND #{query.checkoutTimeEnd} |
| | | </if> |
| | | </where> |
| | | GROUP BY mcr.DEPARTMENT_ID |
| | | GROUP BY mcr.ID |
| | | ORDER BY mcr.CHECKOUT_TIME DESC |
| | | </select> |
| | | <select id="hospitalDetail" resultType="com.sinata.system.domain.vo.MwCheckoutRecordVO"> |
| | |
| | | </where> |
| | | </select> |
| | | <select id="hospitalDetailPage" resultType="com.sinata.system.domain.vo.MwMedicalWasteBoxVO"> |
| | | SELECT |
| | | mcr.BOX_ID AS id, |
| | | mcr.BOX_NUMBER, |
| | | mcr.WASTE_TYPE_STR, |
| | | SELECT mcr2.BOX_ID AS id, |
| | | mcr2.BOX_NUMBER, |
| | | mcr2.WASTE_TYPE_STR, |
| | | su.NICK_NAME AS COLLECT_USER_NAME, |
| | | COUNT(*) AS bagNum, |
| | | SUM(mcr.WEIGHT) AS totalWeight, |
| | | mcr1.BAG_NUM AS bagNum, |
| | | mcr1.TOTAL_WEIGHT, |
| | | (SELECT MAX(mcr_inner.BOX_TIME) |
| | | FROM MW_COLLECT_RECORD mcr_inner |
| | | WHERE mcr_inner.BOX_ID = mcr.BOX_ID) AS BOX_TIME |
| | | FROM MW_COLLECT_RECORD mcr |
| | | LEFT JOIN SYS_USER su ON mcr.COLLECT_USER_ID = su.USER_ID |
| | | WHERE mcr_inner.BOX_ID = mcr2.BOX_ID) AS BOX_TIME |
| | | FROM MW_CHECKOUT_RECORD mcr1 |
| | | LEFT JOIN |
| | | MW_CHECKOUT_RECORD_ITEM mcri ON mcr1.ID = mcri.CHECKOUT_RECORD_ID |
| | | LEFT JOIN |
| | | MW_COLLECT_RECORD mcr2 ON mcri.COLLECT_RECORD_ID = mcr2.ID |
| | | LEFT JOIN SYS_USER su ON mcr2.COLLECT_USER_ID = su.USER_ID |
| | | LEFT JOIN SYS_DEPARTMENT sd ON su.DEPARTMENT_ID = sd.ID |
| | | <where> |
| | | mcr.STATUS = 2 AND mcr.DEL_FLAG = 0 |
| | | mcr1.DEL_FLAG = 0 |
| | | <if test="departmentId != null and departmentId != ''"> |
| | | AND mcr.DEPARTMENT_ID = #{departmentId} |
| | | AND mcr1.ID = #{departmentId} |
| | | </if> |
| | | </where> |
| | | GROUP BY mcr.BOX_ID |
| | | ORDER BY mcr.CREATE_TIME DESC |
| | | GROUP BY mcr2.BOX_ID |
| | | ORDER BY mcr2.CREATE_TIME DESC |
| | | </select> |
| | | <select id="transitPageList" resultType="com.sinata.system.domain.vo.MwTransitRecordVO"> |
| | | SELECT |
| | |
| | | <select id="transitDetail" resultType="com.sinata.system.domain.vo.MwTransitRecordVO"> |
| | | SELECT |
| | | MTRC.ROUTE_ID AS id, |
| | | MDR.DISPOSAL_UNIT_NAME, |
| | | MDR.DISPOSAL_UNIT_NAME AS departmentName, |
| | | MTC.LICENSE_PLATE_NUMBER, |
| | | SU.NICK_NAME, |
| | | SUM(MCR.BOX_NUM) AS boxNum, |
| | | SUM(MCR.TOTAL_WEIGHT) AS weight, |
| | | SUM(MCR2.WEIGHT) AS weight, |
| | | MIN(MCR2.BOX_TIME) AS startTime, |
| | | MDR.RECEIVE_TIME AS endTime |
| | | FROM MW_CHECKOUT_RECORD MCR |
| | |
| | | AND MC.CONTRACT_NAME LIKE CONCAT('%',#{query.contractName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY MC.CREATE_TIME DESC |
| | | </select> |
| | | <select id="queryListTerminationDateBeforeNow" resultType="com.sinata.system.domain.vo.MwContractVO" |
| | | parameterType="java.util.Date"> |
| | |
| | | ID, DEPARTMENT_ID, DISPOSAL_UNIT_NAME, RECEIVE_QUANTITY, RECEIVE_TIME, RECEIVE_WEIGHT, RECEIVER_ID, UNLOAD_QUANTITY, UNLOAD_WEIGHT, TOTAL_HANDLED_QUANTITY, DISPOSAL_FLAG, TOTAL_HANDLED_WEIGHT, DISPOSAL_TIME, DISPOSAL_USER_ID |
| | | </sql> |
| | | <select id="getStaticsData" resultType="com.sinata.system.domain.vo.DisposalRecordStaticsVO"> |
| | | SELECT COALESCE(SUM(MDR.RECEIVE_QUANTITY),0) AS receivedQuantity, |
| | | COALESCE(SUM(MDR.RECEIVE_WEIGHT),0) AS receivedWeight, |
| | | SELECT COALESCE(SUM(MDR.RECEIVE_QUANTITY),0) AS receiveQuantity, |
| | | COALESCE(SUM(MDR.RECEIVE_WEIGHT),0) AS receiveWeight, |
| | | COALESCE(SUM(MDR.RECEIVE_QUANTITY),0) AS unloadQuantity, |
| | | COALESCE(SUM(MDR.RECEIVE_WEIGHT),0) AS unloadWeight, |
| | | COALESCE(SUM(MCR.WEIGHT),0) AS totalHandledWeight, |
| | | COALESCE(COUNT(DISTINCT MCR.BOX_NUMBER),0) AS totalHandledQuantity |
| | | COALESCE(SUM(MDR.RECEIVE_WEIGHT),0) AS unloadWeight |
| | | FROM MW_DISPOSAL_RECORD MDR |
| | | LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MDR.DEPARTMENT_ID |
| | | LEFT JOIN MW_DISPOSAL_HANDLE_RECORD_ITEM MDHRI ON MDHRI.DISPOSAL_RECORD_ID = MDR.ID |
| | |
| | | MDR.CREATE_TIME, |
| | | MDR.UPDATE_BY, |
| | | MDR.UPDATE_TIME, |
| | | SUM(MCR.WEIGHT) AS totalHandledWeight, |
| | | COUNT(DISTINCT MCR.BOX_NUMBER) AS totalHandledQuantity |
| | | COALESCE(SUM(MCR.WEIGHT),0) AS totalHandledWeight, |
| | | COALESCE(COUNT(DISTINCT MCR.BOX_NUMBER),0)AS totalHandledQuantity |
| | | FROM MW_DISPOSAL_RECORD MDR |
| | | LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MDR.DEPARTMENT_ID |
| | | LEFT JOIN MW_DISPOSAL_HANDLE_RECORD_ITEM MDHRI ON MDHRI.DISPOSAL_RECORD_ID = MDR.ID |
| | |
| | | </where> |
| | | GROUP BY MDR.DEPARTMENT_ID |
| | | </select> |
| | | <select id="getDisposalData" |
| | | resultType="com.sinata.system.domain.vo.DisposalRecordStaticsVO"> |
| | | SELECT |
| | | COALESCE(SUM(MCR.WEIGHT),0) AS totalHandledWeight, |
| | | COALESCE(COUNT(DISTINCT MCR.BOX_NUMBER),0) AS totalHandledQuantity |
| | | FROM MW_DISPOSAL_HANDLE_RECORD_ITEM MDHRI |
| | | LEFT JOIN MW_DISPOSAL_RECORD MDR ON MDR.ID = MDHRI.DISPOSAL_RECORD_ID |
| | | LEFT JOIN MW_COLLECT_RECORD MCR ON MCR.ID = MDHRI.COLLECT_RECORD_ID |
| | | LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MDR.DEPARTMENT_ID |
| | | <where> |
| | | MDR.DEL_FLAG = 0 |
| | | <if test="treeCode != null and treeCode !=''"> |
| | | AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%') |
| | | </if> |
| | | <if test="query.receiveTimeStart!=null and query.receiveTimeEnd != null"> |
| | | AND MDR.RECEIVE_TIME BETWEEN #{query.receiveTimeStart} AND #{query.receiveTimeEnd} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test="query.deviceName!=null and query.deviceName !=''"> |
| | | AND MMD.DEVICE_NAME LIKE CONCAT('%',#{query.deviceName},'%') |
| | | </if> |
| | | <if test="query.deviceNumber!=null and query.deviceNumber !=''"> |
| | | AND MMD.DEVICE_NUMBER LIKE CONCAT('%',#{query.deviceNumber},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY MMD.CREATE_TIME DESC |
| | | </select> |
| | |
| | | MPT.CREATE_TIME, |
| | | SD.DEPARTMENT_NAME, |
| | | WM_CONCAT(MA.FILE_NAME) AS fileName, |
| | | MPT.RELATION |
| | | MPT.RELATION, |
| | | SU.NICK_NAME |
| | | FROM MW_PROTECTION_TASK MPT |
| | | LEFT JOIN SYS_DEPARTMENT SD ON MPT.DEPARTMENT_ID = SD.ID |
| | | LEFT JOIN (SELECT * FROM MW_ATTACHMENT WHERE "TYPE" = 2) MA ON MA.TARGET_ID = MPT.ID |
| | | LEFT JOIN SYS_USER SU ON SU.USER_ID = MPT.CREATE_BY |
| | | <where> |
| | | MPT.DEL_FLAG = 0 |
| | | <if test="treeCode != null and treeCode != ''"> |
| | |
| | | AND MRR.CHECK_DATE BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY MRR.CREATE_TIME DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY MTR.CREATE_TIME DESC |
| | | </select> |
| | | <select id="detail" resultType="com.sinata.system.domain.vo.MwTransitRouteVO"> |
| | | SELECT MTR.ID, |