From ab96d801d6c5e2feea9677367c1b44c2e08b78ee Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期二, 24 十二月 2024 19:02:21 +0800 Subject: [PATCH] 监控视频播放、短信、转运线路设置 --- medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionEquipmentServiceImpl.java | 4 medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwTransitRouteController.java | 84 +++ medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCheckoutRecordServiceImpl.java | 7 medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java | 24 + medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitRouteService.java | 41 + medicalWaste-system/src/main/resources/mapper/system/SysDepartmentMapper.xml | 39 + medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitCarService.java | 10 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwBusinessDeviceServiceImpl.java | 4 medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRouteDTO.java | 41 + medicalWaste-system/src/main/resources/mapper/system/MwTransitCarMapper.xml | 25 + medicalWaste-system/src/main/resources/mapper/system/MwTransitRouteMapper.xml | 33 + medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwMonitorDeviceQuery.java | 3 medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMonitorDeviceMapper.java | 11 pom.xml | 7 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCollectRecordServiceImpl.java | 4 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitRouteServiceImpl.java | 135 ++++++ medicalWaste-admin/src/main/resources/application-prod.yml | 25 + medicalWaste-system/src/main/java/com/sinata/system/config/RestTemplateConfig.java | 25 + medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitCarMapper.java | 10 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStagingRoomServiceImpl.java | 6 medicalWaste-admin/src/main/resources/application-dev.yml | 18 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionTaskServiceImpl.java | 4 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitCarServiceImpl.java | 31 + medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwTransitRouteQuery.java | 22 + medicalWaste-system/src/main/java/com/sinata/system/service/biz/AliSmsService.java | 106 ++++ medicalWaste-system/src/main/java/com/sinata/system/config/DeviceConfig.java | 18 medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRoutePointsDTO.java | 20 medicalWaste-system/src/main/java/com/sinata/system/config/AliSmsConfig.java | 45 ++ medicalWaste-system/src/main/java/com/sinata/system/service/MwMonitorDeviceService.java | 8 medicalWaste-system/src/main/java/com/sinata/system/service/biz/MonitorDeviceApiNewService.java | 279 ++++++++++++ medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoute.java | 12 medicalWaste-common/pom.xml | 6 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwApplicationServiceImpl.java | 9 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStaffServiceImpl.java | 4 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java | 6 medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwMonitorDeviceController.java | 34 + medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwMonitorDeviceVO.java | 2 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMonitorDeviceServiceImpl.java | 22 + medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoutePoints.java | 4 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionRegulationServiceImpl.java | 4 medicalWaste-system/src/main/java/com/sinata/system/service/SysDepartmentService.java | 8 medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysAgreementController.java | 2 medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitRouteMapper.java | 18 medicalWaste-system/src/main/resources/mapper/system/MwMonitorDeviceMapper.xml | 34 + medicalWaste-system/src/main/java/com/sinata/system/mapper/SysDepartmentMapper.java | 8 medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwTransitRouteVO.java | 45 ++ 46 files changed, 1,279 insertions(+), 28 deletions(-) diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwMonitorDeviceController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwMonitorDeviceController.java index b9e10b7..fcbcd18 100644 --- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwMonitorDeviceController.java +++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwMonitorDeviceController.java @@ -6,7 +6,10 @@ import com.sinata.system.domain.query.MwMonitorDeviceQuery; import com.sinata.system.domain.vo.MwMonitorDeviceVO; import com.sinata.system.service.MwMonitorDeviceService; +import com.sinata.system.service.biz.MonitorDeviceApiNewService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; @@ -19,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; +import java.util.Map; /** * <p> @@ -35,6 +39,7 @@ @RequestMapping("/backend/mwMonitorDevice") public class MwMonitorDeviceController { private final MwMonitorDeviceService mwMonitorDeviceService; + private final MonitorDeviceApiNewService monitorDeviceApiNewService; /** * 监控设备分页列表 @@ -98,4 +103,33 @@ mwMonitorDeviceService.removeById(id); return R.ok(); } + + /** + * 实时监控列表 + * + * @param query + * @return + */ + @ApiOperation("实时监控列表") + @PostMapping("/monitor/page") + public R<PageDTO<MwMonitorDeviceVO>> monitorPageList(@Valid @RequestBody MwMonitorDeviceQuery query) { + return R.ok(mwMonitorDeviceService.pageMonitorPage(query)); + } + + /** + * 获取视频服务器设备播放路径 + * + * @param id + * @param channelNum + * @return + */ + @ApiOperation("获取视频服务器设备播放路径") + @GetMapping("/getDeviceUrl") + @ApiImplicitParams({ + @ApiImplicitParam(name = "deviceNumber", value = "设备编号"), + @ApiImplicitParam(name = "channelNum", value = "通道号") + }) + public R<Map<String, Object>> getDeviceUrl(String deviceNumber, Integer channelNum) { + return R.ok(monitorDeviceApiNewService.getDeviceUrl(deviceNumber, channelNum)); + } } diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwTransitRouteController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwTransitRouteController.java index 267eb70..5b3886d 100644 --- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwTransitRouteController.java +++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/MwTransitRouteController.java @@ -1,7 +1,25 @@ package com.sinata.web.controller.backend; +import com.sinata.common.core.domain.R; +import com.sinata.common.entity.PageDTO; +import com.sinata.system.domain.dto.MwTransitRouteDTO; +import com.sinata.system.domain.query.MwTransitRouteQuery; +import com.sinata.system.domain.vo.MwTransitRouteVO; +import com.sinata.system.service.MwTransitRouteService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +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.RestController; + +import javax.validation.Valid; /** * <p> @@ -11,8 +29,74 @@ * @author mitao * @since 2024-12-02 */ +@Validated @RestController +@RequiredArgsConstructor +@Api(tags = {"转运线路设置相关接口"}) @RequestMapping("/backend/mwTransitRoute") public class MwTransitRouteController { + private final MwTransitRouteService mwTransitRouteService; + /** + * 分页列表 + * + * @param query + * @return + */ + @ApiOperation("分页列表") + @PostMapping("/page") + public R<PageDTO<MwTransitRouteVO>> pageList(@Valid @RequestBody MwTransitRouteQuery query) { + return R.ok(mwTransitRouteService.pageList(query)); + } + + /** + * 详情 + * + * @param id + * @return + */ + @ApiOperation("详情") + @GetMapping("/{id}") + public R<MwTransitRouteVO> detail(@ApiParam(name = "id", value = "主键ID", required = true) @PathVariable Long id) { + return R.ok(mwTransitRouteService.detail(id)); + } + + /** + * 新增 + * + * @param dto + * @return + */ + @ApiOperation("新增") + @PostMapping("/add") + public R<?> add(@Valid @RequestBody MwTransitRouteDTO dto) { + mwTransitRouteService.add(dto); + return R.ok(); + } + + /** + * 编辑 + * + * @param dto + * @return + */ + @ApiOperation("编辑") + @PostMapping("/edit") + public R<?> edit(@Valid @RequestBody MwTransitRouteDTO dto) { + mwTransitRouteService.edit(dto); + return R.ok(); + } + + /** + * 删除 + * + * @param id + * @return + */ + @ApiOperation("删除") + @DeleteMapping("/{id}") + public R<?> delete(@ApiParam(name = "id", value = "路线id", required = true) @PathVariable("id") Long id) { + mwTransitRouteService.delete(id); + return R.ok(); + } } diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysAgreementController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysAgreementController.java index 10b525c..0a54c4a 100644 --- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysAgreementController.java +++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysAgreementController.java @@ -26,7 +26,7 @@ @RequiredArgsConstructor @RequestMapping("/backend/sysAgreement") public class SysAgreementController { - private SysAgreementService sysAgreementService; + private final SysAgreementService sysAgreementService; /** * 保存用户注册协议 diff --git a/medicalWaste-admin/src/main/resources/application-dev.yml b/medicalWaste-admin/src/main/resources/application-dev.yml index aa5efa4..df421b5 100644 --- a/medicalWaste-admin/src/main/resources/application-dev.yml +++ b/medicalWaste-admin/src/main/resources/application-dev.yml @@ -212,7 +212,7 @@ excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* - +# 阿里云对象存储 oss: accessKeyId: LTAI4FyQgM99x9JKDtcL3mp2 accessKeySecret: 0qffirCRqugdtnKPvCXz36yvLmYLWX @@ -220,3 +220,19 @@ download-endpoint: https://ja-medical-service.oss-cn-chengdu.aliyuncs.com/ bucketName: ja-medical-service folder: medical + +# 视频监控 +device: + baseUrl: https://video-1.scjakj.com + userName: scjakj + password: 123456 + +sms: + accessKeyId: LTAI5t9Y3BxZj1gRDZvPjuo1 + accessKeySecret: tBidUVHBfU7gYt09BbsvZjVPPcHMcx + signName: 医疗废物信息化 + connectTimeout: 30000 + readTimeout: 30000 + debug: false + loginTemplateCode: SMS_246140477 + auditTemplateCode: SMS_476730213 diff --git a/medicalWaste-admin/src/main/resources/application-prod.yml b/medicalWaste-admin/src/main/resources/application-prod.yml index 70d3e5b..c9b317e 100644 --- a/medicalWaste-admin/src/main/resources/application-prod.yml +++ b/medicalWaste-admin/src/main/resources/application-prod.yml @@ -212,3 +212,28 @@ excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* + +# 阿里云对象存储 +oss: + accessKeyId: LTAI4FyQgM99x9JKDtcL3mp2 + accessKeySecret: 0qffirCRqugdtnKPvCXz36yvLmYLWX + upload-endpoint: https://oss-cn-chengdu.aliyuncs.com + download-endpoint: https://ja-medical-service.oss-cn-chengdu.aliyuncs.com/ + bucketName: ja-medical-service + folder: medical + +# 视频监控 +device: + baseUrl: https://video-1.scjakj.com + userName: scjakj + password: 123456 + +sms: + accessKeyId: LTAI5t9Y3BxZj1gRDZvPjuo1 + accessKeySecret: tBidUVHBfU7gYt09BbsvZjVPPcHMcx + signName: 医疗废物信息化 + connectTimeout: 30000 + readTimeout: 30000 + debug: false + loginTemplateCode: SMS_246140477 + auditTemplateCode: SMS_476730213 diff --git a/medicalWaste-common/pom.xml b/medicalWaste-common/pom.xml index 0fd20c6..ca02754 100644 --- a/medicalWaste-common/pom.xml +++ b/medicalWaste-common/pom.xml @@ -152,7 +152,11 @@ <groupId>com.aliyun.oss</groupId> <artifactId>aliyun-sdk-oss</artifactId> </dependency> - + <!--sms--> + <dependency> + <groupId>com.aliyun</groupId> + <artifactId>dysmsapi20170525</artifactId> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/medicalWaste-system/src/main/java/com/sinata/system/config/AliSmsConfig.java b/medicalWaste-system/src/main/java/com/sinata/system/config/AliSmsConfig.java new file mode 100644 index 0000000..32994e2 --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/config/AliSmsConfig.java @@ -0,0 +1,45 @@ +package com.sinata.system.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "sms") +@Data +public class AliSmsConfig { + + private String accessKeyId; + + private String accessKeySecret; + + /** + * 签名 + */ + private String signName; + + /** + * 登录模板编码 + */ + private String loginTemplateCode; + /** + * 入驻审核通知模板编码 + */ + private String auditTemplateCode; + + /** + * 连接超时ms + */ + private String connectTimeout = "30000"; + + /** + * 读超时ms + */ + private String readTimeout = "30000"; + + /** + * 调试状态 + */ + private boolean debug = false; + +} \ No newline at end of file diff --git a/medicalWaste-system/src/main/java/com/sinata/system/config/DeviceConfig.java b/medicalWaste-system/src/main/java/com/sinata/system/config/DeviceConfig.java new file mode 100644 index 0000000..c7c77e0 --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/config/DeviceConfig.java @@ -0,0 +1,18 @@ +package com.sinata.system.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "device") +@Data +public class DeviceConfig { + + private String baseUrl; + + private String userName; + + private String password; + +} \ No newline at end of file diff --git a/medicalWaste-system/src/main/java/com/sinata/system/config/RestTemplateConfig.java b/medicalWaste-system/src/main/java/com/sinata/system/config/RestTemplateConfig.java new file mode 100644 index 0000000..fe3c340 --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/config/RestTemplateConfig.java @@ -0,0 +1,25 @@ +package com.sinata.system.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory) { + return new RestTemplate(factory); + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory() { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(150000); // ms + factory.setConnectTimeout(150000); // ms + return factory; + } +} + diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoute.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoute.java index 101148e..19acb03 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoute.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoute.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.sinata.common.entity.BaseModel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -21,7 +22,9 @@ @Setter @TableName("MW_TRANSIT_ROUTE") @ApiModel(value = "MwTransitRoute对象", description = "转运线路") -public class MwTransitRoute { +public class MwTransitRoute extends BaseModel { + + private static final long serialVersionUID = -4601079739505977022L; @ApiModelProperty("转运线路id") @TableId(value = "ID", type = IdType.AUTO) @@ -35,5 +38,12 @@ @TableField("ROUTE_NAME") private String routeName; + @ApiModelProperty("医院数量") + @TableField("HOSPITAL_QUANTITY") + private Integer hospitalQuantity; + + @ApiModelProperty("备注") + @TableField("REMARK") + private String remark; } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoutePoints.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoutePoints.java index 6b11d64..962be88 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoutePoints.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitRoutePoints.java @@ -28,6 +28,10 @@ @TableId(value = "ID", type = IdType.AUTO) private Long id; + @ApiModelProperty("转运线路id") + @TableField("ROUTE_ID") + private Long routeId; + @ApiModelProperty("区域id(医院id)") @TableField("DEPARTMENT_ID") private Long departmentId; diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRouteDTO.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRouteDTO.java new file mode 100644 index 0000000..f5235fc --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRouteDTO.java @@ -0,0 +1,41 @@ +package com.sinata.system.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author mitao + * @date 2024/12/24 + */ +@Data +@ApiModel("线路数据传输对象") +public class MwTransitRouteDTO { + + @ApiModelProperty("转运线路id") + private Long id; + + @ApiModelProperty("区域id(处置单位id)") + @NotNull(message = "处置单位id不能为空") + private Long departmentId; + + @ApiModelProperty("线路名称") + @NotBlank(message = "线路名称不能为空") + private String routeName; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("途经点") + @NotEmpty(message = "途经点不能为空") + private List<MwTransitRoutePointsDTO> hostpitalList; + + @ApiModelProperty("关联车辆") + @NotEmpty(message = "关联车辆不能为空") + private List<Long> carIdList; +} diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRoutePointsDTO.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRoutePointsDTO.java new file mode 100644 index 0000000..42f33a0 --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/dto/MwTransitRoutePointsDTO.java @@ -0,0 +1,20 @@ +package com.sinata.system.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author mitao + * @date 2024/12/24 + */ +@Data +@ApiModel("线路途经点数据传输对象") +public class MwTransitRoutePointsDTO { + + @ApiModelProperty("区域id(医院id)") + private Long departmentId; + + @ApiModelProperty("排序") + private Integer sortOrder; +} diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwMonitorDeviceQuery.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwMonitorDeviceQuery.java index 3da39b9..06b3d63 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwMonitorDeviceQuery.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwMonitorDeviceQuery.java @@ -22,4 +22,7 @@ @ApiModelProperty("设备名称") private String deviceName; + @ApiModelProperty("设备状态 1:在线 0:离线") + private Integer status; + } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwTransitRouteQuery.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwTransitRouteQuery.java new file mode 100644 index 0000000..7eaabaf --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/query/MwTransitRouteQuery.java @@ -0,0 +1,22 @@ +package com.sinata.system.domain.query; + +import com.sinata.common.entity.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author mitao + * @date 2024/12/24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("转运路线查询数据传输对象") +public class MwTransitRouteQuery extends BasePage { + + private static final long serialVersionUID = 1085929057879439197L; + + @ApiModelProperty("区域id") + private Long departmentId; +} diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwMonitorDeviceVO.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwMonitorDeviceVO.java index 443eb9f..f88b5b6 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwMonitorDeviceVO.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwMonitorDeviceVO.java @@ -37,6 +37,6 @@ private String remark; @ApiModelProperty("在线状态 1:在线 0:离线") - public Integer onlineStatus = 0; + public Integer status = 0; } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwTransitRouteVO.java b/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwTransitRouteVO.java new file mode 100644 index 0000000..15106f2 --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwTransitRouteVO.java @@ -0,0 +1,45 @@ +package com.sinata.system.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @author mitao + * @date 2024/12/24 + */ +@Data +@ApiModel("转运路线视图对象") +public class MwTransitRouteVO { + + @ApiModelProperty("转运线路id") + private Long id; + + @ApiModelProperty("区域id(处置单位id)") + private Long departmentId; + + @ApiModelProperty("处置单位") + private String departmentName; + + @ApiModelProperty("线路名称") + private String routeName; + + @ApiModelProperty("医院数量") + private Integer hospitalQuantity; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("添加时间") + private Date createTime; + + @ApiModelProperty("途经点") + private List<MedicalInstitutionVO> hostpitalList; + + @ApiModelProperty("关联车辆") + private List<MwTransitCarVO> carList; +} + diff --git a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMonitorDeviceMapper.java b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMonitorDeviceMapper.java index 4ec9bb2..ec29a86 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMonitorDeviceMapper.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMonitorDeviceMapper.java @@ -8,6 +8,8 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * <p> * 监控设备 Mapper 接口 @@ -27,4 +29,13 @@ * @return */ Page<MwMonitorDeviceVO> pageList(Page<MwMonitorDeviceVO> page, @Param("query") MwMonitorDeviceQuery query, @Param("treeCode") String treeCode); + + /** + * 实时监控列表 + * + * @param page + * @param deviceList + * @return + */ + Page<MwMonitorDeviceVO> pageMonitorPage(Page<MwMonitorDeviceVO> page, @Param("status") Integer status, @Param("treeCode") String treeCode, @Param("deviceList") List<String> deviceList); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitCarMapper.java b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitCarMapper.java index fc4795b..eaf384b 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitCarMapper.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitCarMapper.java @@ -8,6 +8,8 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * <p> * 运输车辆 Mapper 接口 @@ -35,4 +37,12 @@ * @return */ MwTransitCarVO detail(Long id); + + /** + * 关联车辆列表 + * + * @param id + * @return + */ + List<MwTransitCarVO> getCarListByRouteId(@Param("id") Long id); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitRouteMapper.java b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitRouteMapper.java index 1344e9a..54994a4 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitRouteMapper.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitRouteMapper.java @@ -1,8 +1,11 @@ package com.sinata.system.mapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.sinata.system.domain.MwTransitRoute; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sinata.system.domain.vo.MwTransitRouteVO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * <p> @@ -14,5 +17,20 @@ */ @Mapper public interface MwTransitRouteMapper extends BaseMapper<MwTransitRoute> { + /** + * 分页列表 + * + * @param page + * @param treeCode + * @return + */ + Page<MwTransitRouteVO> pageList(Page<MwTransitRouteVO> page, @Param("treeCode") String treeCode); + /** + * 详情 + * + * @param id + * @return + */ + MwTransitRouteVO detail(@Param("id") Long id); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/mapper/SysDepartmentMapper.java b/medicalWaste-system/src/main/java/com/sinata/system/mapper/SysDepartmentMapper.java index 047336f..efd72b8 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/mapper/SysDepartmentMapper.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/mapper/SysDepartmentMapper.java @@ -74,4 +74,12 @@ * @return */ DisposalUnitVO getDisposalUnitDetailById(@Param("id") Long id); + + /** + * 路线关联医院列表 + * + * @param id + * @return + */ + List<MedicalInstitutionVO> getHospitalListByRouteId(@Param("id") Long id); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/MwMonitorDeviceService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/MwMonitorDeviceService.java index efef39e..790bb27 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/MwMonitorDeviceService.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/MwMonitorDeviceService.java @@ -47,4 +47,12 @@ * @return */ void edit(MwMonitorDeviceDTO dto); + + /** + * 实时监控列表 + * + * @param query + * @return + */ + PageDTO<MwMonitorDeviceVO> pageMonitorPage(MwMonitorDeviceQuery query); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitCarService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitCarService.java index dae3696..381930d 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitCarService.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitCarService.java @@ -7,6 +7,8 @@ import com.sinata.system.domain.query.TransitCarQuery; import com.sinata.system.domain.vo.MwTransitCarVO; +import java.util.List; + /** * <p> * 运输车辆 服务类 @@ -48,5 +50,11 @@ */ void edit(MwTransitCarDTO dto); - + /** + * 关联车辆列表 + * + * @param id + * @return + */ + List<MwTransitCarVO> getCarListByRouteId(Long id); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitRouteService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitRouteService.java index ff7cad2..218b173 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitRouteService.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitRouteService.java @@ -1,7 +1,11 @@ package com.sinata.system.service; +import com.sinata.common.entity.PageDTO; import com.sinata.system.domain.MwTransitRoute; import com.baomidou.mybatisplus.extension.service.IService; +import com.sinata.system.domain.dto.MwTransitRouteDTO; +import com.sinata.system.domain.query.MwTransitRouteQuery; +import com.sinata.system.domain.vo.MwTransitRouteVO; /** * <p> @@ -12,5 +16,42 @@ * @since 2024-12-02 */ public interface MwTransitRouteService extends IService<MwTransitRoute> { + /** + * 分页列表 + * + * @param query + * @return + */ + PageDTO<MwTransitRouteVO> pageList(MwTransitRouteQuery query); + /** + * 详情 + * + * @param id + * @return + */ + MwTransitRouteVO detail(Long id); + + /** + * 新增 + * + * @param dto + * @return + */ + void add(MwTransitRouteDTO dto); + + /** + * 编辑 + * + * @param dto + * @return + */ + void edit(MwTransitRouteDTO dto); + + /** + * 删除 + * + * @param id + */ + void delete(Long id); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/SysDepartmentService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/SysDepartmentService.java index 7e76bc2..e88b4a2 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/SysDepartmentService.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/SysDepartmentService.java @@ -222,4 +222,12 @@ * @return */ String getTreeCodeByDepartmentId(Long departmentId); + + /** + * 路线关联医院列表 + * + * @param id + * @return + */ + List<MedicalInstitutionVO> getHospitalListByRouteId(Long id); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/biz/AliSmsService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/AliSmsService.java new file mode 100644 index 0000000..58ebb24 --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/AliSmsService.java @@ -0,0 +1,106 @@ +package com.sinata.system.service.biz; + +import com.alibaba.fastjson2.JSON; +import com.aliyun.dysmsapi20170525.Client; +import com.aliyun.dysmsapi20170525.models.SendSmsRequest; +import com.aliyun.dysmsapi20170525.models.SendSmsResponse; +import com.aliyun.teaopenapi.models.Config; +import com.sinata.system.config.AliSmsConfig; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + + +@Service +@Slf4j +public class AliSmsService { + @Resource + private AliSmsConfig aliSmsConfig; + + /** + * 发送验证码短信 + * + * @param phone 手机号 + * @param code 验证码 + * @return + */ + public boolean sendLoginCode(String phone, String code) { + + Map<String, String> param = new HashMap<>(3); + param.put("code", code); + return sendSms(phone, aliSmsConfig.getSignName(), aliSmsConfig.getLoginTemplateCode(), param); + } + + /** + * 审核结果通知短信 + * + * @param phone 手机号 + * @param result 已通过 未通过 + * @return + */ + public boolean sendAuditResult(String phone, String result) { + + Map<String, String> param = new HashMap<>(3); + param.put("code", result); + return sendSms(phone, aliSmsConfig.getSignName(), aliSmsConfig.getAuditTemplateCode(), param); + } + + /** + * 阿里发送短信 + * + * @param phone + * @param signName + * @param templateCode + * @param param + * @return + */ + private boolean sendSms(String phone, String signName, String templateCode, Map<String, String> param) { + // 可自助调整超时时间 + System.setProperty("sun.net.client.defaultConnectTimeout", aliSmsConfig.getConnectTimeout()); + System.setProperty("sun.net.client.defaultReadTimeout", aliSmsConfig.getReadTimeout()); + try { + + // 初始化请求客户端 + Client client = createClient(); + + // 构造请求对象,请填入请求参数值 + SendSmsRequest sendSmsRequest = new SendSmsRequest() + .setPhoneNumbers(phone) + .setSignName(signName) + .setTemplateCode(templateCode) + .setTemplateParam(JSON.toJSONString(param)); + if (aliSmsConfig.isDebug()) { + log.info("短信 DEBUG code= {}", param); + return true; + } + // 获取响应对象 + SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest); + // hint 此处可能会抛出异常,注意catch + if (StringUtils.equalsIgnoreCase("ok", sendSmsResponse.getBody().getCode())) { + return true; + } else { + log.error("{}短信发送失败:{}", phone, sendSmsResponse.getBody().getMessage()); + } + } catch (Exception e) { + throw new RuntimeException("短信发送失败", e); + } + return false; + } + + public Client createClient() throws Exception { + Config config = new Config() + // 配置 AccessKey ID + .setAccessKeyId(aliSmsConfig.getAccessKeyId()) + // 配置 AccessKey Secret + .setAccessKeySecret(aliSmsConfig.getAccessKeySecret()); + + // 配置 Endpoint + config.endpoint = "dysmsapi.aliyuncs.com"; + + return new Client(config); + } +} diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/biz/MonitorDeviceApiNewService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/MonitorDeviceApiNewService.java new file mode 100644 index 0000000..3dd748f --- /dev/null +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/MonitorDeviceApiNewService.java @@ -0,0 +1,279 @@ +package com.sinata.system.service.biz; + +import cn.hutool.crypto.digest.DigestUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.sinata.common.exception.ServiceException; +import com.sinata.system.config.DeviceConfig; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@Slf4j +@RequiredArgsConstructor +public class MonitorDeviceApiNewService { + + @Autowired + private DeviceConfig deviceConfig; + + //登录 + private final String LOGIN_URL = "/api/v1/login?username=%s&password=%s&url_token_only=%s"; + //根据状态获取视频列表 + private final String LIST_URL = "/api/v1/device/list?online=%s"; + //查询设备通道列表接口(新) + private final String channellist_URL = "/api/v1/device/channellist?serial=%s"; + //根据设备号获取视频链接 + private final String STREAM_URL = "/api/v1/stream/start?serial=%s&channel=%s"; + //查询通道录像列表接口(新) + private final String recordlist_URL = "/api/v1/playback/recordlist?serial=%s&channel=%s&starttime=%s&endtime=%s"; + //开始回放接口(新) + private final String playbackStart_URL = "/api/v1/playback/start?serial=%s&channel=%s&starttime=%s&endtime=%s"; + //回放流停止接口(新) + private final String playbackStop_URL = "/api/v1/playback/stop?streamid=%s"; + + //在线数据 + Boolean url_token_only = true; + //获取视频列表参数 + Boolean online = true;//设备是否在线 + + private final RedisTemplate<Object, Object> redisTemplate; + private final RestTemplate restTemplate; + + /** + * 登录 + * type==1 重新调起登录 + * + * @return + */ + public String getJSession(Integer type) { + String key = "monitor:device:jsession:now"; + String jsession = redisTemplate.opsForValue().get(key).toString(); + Long timeOut = 604800L; + if (jsession == null || type == 1) { + String loginUrl = String.format( + deviceConfig.getBaseUrl() + LOGIN_URL, deviceConfig.getUserName(), DigestUtil.md5Hex(deviceConfig.getPassword()), url_token_only); + log.info("视频服务器:登录接口传参数据:{}", loginUrl); + JSONObject result = restTemplate.getForObject(loginUrl, JSONObject.class); + log.info("视频服务器:登录接口返回数据:{}", result); + if (result == null) { + throw new ServiceException("视频服务器连接失败"); + } + if (result != null) { + timeOut = result.getLong("TokenTimeout");//缓存过期时间 + jsession = result.getString("URLToken");//token + } else { + throw new ServiceException("视频服务器连接失败"); + } + } + redisTemplate.opsForValue().set(key, jsession, timeOut); + return jsession; + } + + /** + * 获取设备列表 + * + * @return + */ + public List<String> getDeviceList() { + String token = getJSession(0); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("token", token); + HttpEntity request = new HttpEntity(httpHeaders); + String completeUrl = String.format(deviceConfig.getBaseUrl() + LIST_URL, online); + try { + ResponseEntity<JSONObject> resultEntity = restTemplate.exchange(completeUrl, HttpMethod.GET, request, JSONObject.class, ""); + + if (resultEntity == null) { + throw new ServiceException("视频服务器连接失败"); + } + List<String> list = new ArrayList<>(); + JSONObject jsonBody = resultEntity.getBody(); + //log.info("视频服务器:获取设备状态接口返回数据:{}", jsonBody); + JSONArray jsonArray = jsonBody.getJSONArray("DeviceList"); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String ID = jsonObject.getString("ID"); + list.add(ID); + } + return list; + } catch (Exception e) { + getJSession(1); + return getDeviceList(); + } + } + + /** + * 获取通道列表 + * + * @return + */ + public List<Map<String, String>> getChannelList(String serial) { + String token = getJSession(0); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("token", token); + HttpEntity request = new HttpEntity(httpHeaders); + String completeUrl = String.format(deviceConfig.getBaseUrl() + channellist_URL, serial); + try { + ResponseEntity<JSONObject> resultEntity = restTemplate.exchange(completeUrl, HttpMethod.GET, request, JSONObject.class, ""); + + if (resultEntity == null) { + throw new ServiceException("视频服务器连接失败"); + } + List<Map<String, String>> list = new ArrayList<>(); + JSONObject jsonBody = resultEntity.getBody(); + //log.info("视频服务器:获取设备状态接口返回数据:{}", jsonBody); + JSONArray jsonArray = jsonBody.getJSONArray("ChannelList"); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String channel = jsonObject.getString("Channel"); + Map<String, String> map = new HashMap<>(); + map.put("channel", channel); + list.add(map); + } + return list; + } catch (Exception e) { + getJSession(1); + return getChannelList(serial); + } + } + + /** + * 获取设备播放路径 + * + * @param devIdno + * @return + */ + public Map<String, Object> getDeviceUrl(String devIdno, Integer channelNum) { + String token = getJSession(0); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("token", token); + HttpEntity request = new HttpEntity(httpHeaders); + if (channelNum == null) { + channelNum = 1; + } + String completeUrl = String.format(deviceConfig.getBaseUrl() + STREAM_URL, devIdno, channelNum); + System.out.println(completeUrl); + ResponseEntity<JSONObject> resultEntity = restTemplate.exchange(completeUrl, HttpMethod.GET, request, JSONObject.class, ""); + + if (resultEntity == null) { + throw new ServiceException("视频服务器连接失败"); + } + JSONObject jsonBody = resultEntity.getBody(); + //log.info("视频服务器:获取设备状态接口返回数据:{}", jsonBody); + String flv = jsonBody.getString("FLV"); + String snapURL = jsonBody.getString("SnapURL"); + Map<String, Object> reMap = new HashMap<>(); + reMap.put("flv", flv); + reMap.put("snapURL", deviceConfig.getBaseUrl() + snapURL); + return reMap; + } + + /** + * 查询通道录像列表 + * + * @return + */ + public List<Map<String, String>> getPlaybackRecordlist(String serial, Integer channel, String starttime, String endtime) { + String token = getJSession(0); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("token", token); + HttpEntity request = new HttpEntity(httpHeaders); + String completeUrl = String.format(deviceConfig.getBaseUrl() + recordlist_URL, serial, channel, starttime, endtime); + try { + ResponseEntity<JSONObject> resultEntity = restTemplate.exchange(completeUrl, HttpMethod.GET, request, JSONObject.class, ""); + + if (resultEntity == null) { + throw new ServiceException("视频服务器连接失败"); + } + List<Map<String, String>> list = new ArrayList<>(); + JSONObject jsonBody = resultEntity.getBody(); + //log.info("视频服务器:获取设备状态接口返回数据:{}", jsonBody); + JSONArray jsonArray = jsonBody.getJSONArray("RecordList"); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + Map<String, String> map = JSON.parseObject(jsonObject.toJSONString(), Map.class); + list.add(map); + } + return list; + } catch (Exception e) { + getJSession(1); + return null; + //return getPlaybackRecordlist(serial,channel,starttime,endtime); + } + } + + /** + * 开始回放接口 + * + * @param serial + * @return + */ + public Map<String, Object> playbackStart(String serial, Integer channel, String starttime, String endtime) { + String token = getJSession(0); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("token", token); + HttpEntity request = new HttpEntity(httpHeaders); + if (channel == null) { + channel = 1; + } + String completeUrl = String.format(deviceConfig.getBaseUrl() + playbackStart_URL, serial, channel, starttime, endtime); + System.out.println(completeUrl); + ResponseEntity<JSONObject> resultEntity = restTemplate.exchange(completeUrl, HttpMethod.GET, request, JSONObject.class, ""); + + if (resultEntity == null) { + throw new ServiceException("视频服务器连接失败"); + } + JSONObject jsonBody = resultEntity.getBody(); + //log.info("视频服务器:获取设备状态接口返回数据:{}", jsonBody); + String flv = jsonBody.getString("FLV"); + String snapURL = jsonBody.getString("SnapURL"); + String streamID = jsonBody.getString("StreamID"); + Map<String, Object> reMap = new HashMap<>(); + reMap.put("flv", flv); + reMap.put("snapURL", deviceConfig.getBaseUrl() + snapURL); + reMap.put("streamID", streamID); + return reMap; + } + + /** + * 回放流停止接口 + * + * @param streamID + * @return + */ + public Map<String, Object> playbackStop(String streamID) { + String token = getJSession(0); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("token", token); + HttpEntity request = new HttpEntity(httpHeaders); + String completeUrl = String.format(deviceConfig.getBaseUrl() + playbackStop_URL, streamID); + System.out.println(completeUrl); + ResponseEntity<JSONObject> resultEntity = restTemplate.exchange(completeUrl, HttpMethod.GET, request, JSONObject.class, ""); + + if (resultEntity == null) { + throw new ServiceException("视频服务器连接失败"); + } + JSONObject jsonBody = resultEntity.getBody(); + //log.info("视频服务器:获取设备状态接口返回数据:{}", jsonBody); + String playbackFileURL = jsonBody.getString("PlaybackFileURL"); + Map<String, Object> reMap = new HashMap<>(); + reMap.put("playbackFileURL", playbackFileURL); + return reMap; + } + + +} diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwApplicationServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwApplicationServiceImpl.java index 18b020e..8ccee14 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwApplicationServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwApplicationServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.entity.PageDTO; import com.sinata.common.exception.ServiceException; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwApplication; import com.sinata.system.domain.dto.MwApplicationDTO; import com.sinata.system.domain.query.MwApplicationQuery; @@ -11,6 +12,7 @@ import com.sinata.system.mapper.MwApplicationMapper; import com.sinata.system.service.MwApplicationService; import com.sinata.system.service.SysDepartmentService; +import com.sinata.system.service.biz.AliSmsService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -28,6 +30,7 @@ @RequiredArgsConstructor public class MwApplicationServiceImpl extends ServiceImpl<MwApplicationMapper, MwApplication> implements MwApplicationService { private final SysDepartmentService sysDepartmentService; + private final AliSmsService aliSmsService; /** * 分页列表 @@ -38,6 +41,9 @@ @Override public PageDTO<MwApplicationVO> pageList(MwApplicationQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwApplicationVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } @@ -68,6 +74,7 @@ mwApplication.setAuditStatus(dto.getAuditStatus() == 1 ? 2 : 3); mwApplication.setAuditOpinion(dto.getAuditOpinion()); updateById(mwApplication); - //TODO 发送短信通知 + //发送短信通知 + aliSmsService.sendAuditResult(mwApplication.getPhone(), dto.getAuditStatus() == 1 ? "已通过" : "未通过"); } } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwBusinessDeviceServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwBusinessDeviceServiceImpl.java index 563757a..6a13cf4 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwBusinessDeviceServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwBusinessDeviceServiceImpl.java @@ -5,6 +5,7 @@ import com.sinata.common.entity.PageDTO; import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwBusinessDevice; import com.sinata.system.domain.dto.MwBusinessDeviceDTO; import com.sinata.system.domain.query.MwBusinessDeviceQuery; @@ -39,6 +40,9 @@ @Override public PageDTO<MwBusinessDeviceVO> pageList(MwBusinessDeviceQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwBusinessDeviceVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCheckoutRecordServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCheckoutRecordServiceImpl.java index 8ea4805..1a34578 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCheckoutRecordServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCheckoutRecordServiceImpl.java @@ -1,6 +1,6 @@ package com.sinata.system.service.impl; -import cn.idev.excel.EasyExcel; +import cn.idev.excel.FastExcel; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.entity.PageDTO; @@ -74,7 +74,7 @@ // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName = URLEncoder.encode("转运记录", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), MwCheckoutRecordExcelVO.class).sheet("转运记录").doWrite(mwCheckoutRecordExcelVOS); + FastExcel.write(response.getOutputStream(), MwCheckoutRecordExcelVO.class).sheet("转运记录").doWrite(mwCheckoutRecordExcelVOS); } /** @@ -109,6 +109,9 @@ @Override public PageDTO<MwTransitRecordVO> transitPageList(MwTransitRecordQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwTransitRecordVO> page = baseMapper.transitPageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCollectRecordServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCollectRecordServiceImpl.java index 07b8a98..d8e0d40 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCollectRecordServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCollectRecordServiceImpl.java @@ -1,6 +1,6 @@ package com.sinata.system.service.impl; -import cn.idev.excel.EasyExcel; +import cn.idev.excel.FastExcel; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.entity.PageDTO; @@ -100,6 +100,6 @@ // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName = URLEncoder.encode("医废收集记录", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), MwCollectRecordVO.class).sheet("医废收集记录").doWrite(vo); + FastExcel.write(response.getOutputStream(), MwCollectRecordVO.class).sheet("医废收集记录").doWrite(vo); } } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java index 3c33577..d0a20f7 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java @@ -1,6 +1,6 @@ package com.sinata.system.service.impl; -import cn.idev.excel.EasyExcel; +import cn.idev.excel.FastExcel; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -92,7 +92,7 @@ // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName = URLEncoder.encode("微波设备使用记录", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), MwCollectRecordVO.class).sheet("微波设备使用记录").doWrite(list); + FastExcel.write(response.getOutputStream(), MwCollectRecordVO.class).sheet("微波设备使用记录").doWrite(list); } /** @@ -223,7 +223,7 @@ String fileName = URLEncoder.encode("处置分析报表", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); // 这里需要设置不关闭流 - EasyExcel.write(response.getOutputStream()) + FastExcel.write(response.getOutputStream()) .head(head) .autoCloseStream(Boolean.TRUE) .sheet("处置分析报表") diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMonitorDeviceServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMonitorDeviceServiceImpl.java index e8d10c9..ee26ef9 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMonitorDeviceServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMonitorDeviceServiceImpl.java @@ -5,6 +5,7 @@ import com.sinata.common.entity.PageDTO; import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwMonitorDevice; import com.sinata.system.domain.SysDepartment; import com.sinata.system.domain.dto.MwMonitorDeviceDTO; @@ -13,9 +14,11 @@ import com.sinata.system.mapper.MwMonitorDeviceMapper; import com.sinata.system.service.MwMonitorDeviceService; import com.sinata.system.service.SysDepartmentService; +import com.sinata.system.service.biz.MonitorDeviceApiNewService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Objects; /** @@ -30,6 +33,7 @@ @RequiredArgsConstructor public class MwMonitorDeviceServiceImpl extends ServiceImpl<MwMonitorDeviceMapper, MwMonitorDevice> implements MwMonitorDeviceService { private final SysDepartmentService sysDepartmentService; + private final MonitorDeviceApiNewService monitorDeviceApiNewService; /** * 监控设备分页列表 @@ -40,6 +44,9 @@ @Override public PageDTO<MwMonitorDeviceVO> pageList(MwMonitorDeviceQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwMonitorDeviceVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } @@ -94,4 +101,19 @@ MwMonitorDevice mwMonitorDevice = BeanUtils.copyBean(dto, MwMonitorDevice.class); updateById(mwMonitorDevice); } + + @Override + public PageDTO<MwMonitorDeviceVO> pageMonitorPage(MwMonitorDeviceQuery query) { + //获取视频服务器中的在线设备列表 + List<String> deviceList = monitorDeviceApiNewService.getDeviceList(); + String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + 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 -> { + item.setStatus(1); + }); + return PageDTO.of(page); + } } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionEquipmentServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionEquipmentServiceImpl.java index 828b14d..2c2eb6d 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionEquipmentServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionEquipmentServiceImpl.java @@ -7,6 +7,7 @@ import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; import com.sinata.common.utils.CollUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwAttachment; import com.sinata.system.domain.MwProtectionEquipment; import com.sinata.system.domain.MwProtectionEquipmentRecord; @@ -56,6 +57,9 @@ @Override public PageDTO<MwProtectionEquipmentVO> pageList(MwProtectionEquipmentQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwProtectionEquipmentVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionRegulationServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionRegulationServiceImpl.java index 18a9be4..113921a 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionRegulationServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionRegulationServiceImpl.java @@ -7,6 +7,7 @@ import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; import com.sinata.common.utils.CollUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwAttachment; import com.sinata.system.domain.MwProtectionRegulation; import com.sinata.system.domain.dto.MwProtectionRegulationDTO; @@ -50,6 +51,9 @@ @Override public PageDTO<MwProtectionRegulationVO> pageList(MwProtectionRegulationQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwProtectionRegulationVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionTaskServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionTaskServiceImpl.java index 273776c..c136f29 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionTaskServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwProtectionTaskServiceImpl.java @@ -7,6 +7,7 @@ import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; import com.sinata.common.utils.CollUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwAttachment; import com.sinata.system.domain.MwProtectionTask; import com.sinata.system.domain.MwProtectionTaskEquipment; @@ -54,6 +55,9 @@ @Override public PageDTO<MwProtectionTaskVO> pageList(MwProtectionTaskQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwProtectionTaskVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStaffServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStaffServiceImpl.java index de82e89..d038313 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStaffServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStaffServiceImpl.java @@ -5,6 +5,7 @@ import com.sinata.common.entity.PageDTO; import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwStaff; import com.sinata.system.domain.SysDepartment; import com.sinata.system.domain.dto.MwStaffDTO; @@ -40,6 +41,9 @@ @Override public PageDTO<MwStaffVO> pageList(MwStaffQuery query) { String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwStaffVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStagingRoomServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStagingRoomServiceImpl.java index 6aac02c..f9c2742 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStagingRoomServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwStagingRoomServiceImpl.java @@ -1,6 +1,6 @@ package com.sinata.system.service.impl; -import cn.idev.excel.EasyExcel; +import cn.idev.excel.FastExcel; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.entity.PageDTO; @@ -132,7 +132,7 @@ // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName = URLEncoder.encode("暂存间入库记录", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), MwStorageRecordVO.class).sheet("暂存间入库记录").doWrite(list); + FastExcel.write(response.getOutputStream(), MwStorageRecordVO.class).sheet("暂存间入库记录").doWrite(list); } /** @@ -170,6 +170,6 @@ // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName = URLEncoder.encode("暂存间出库记录", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), MwCheckoutRecordVO.class).sheet("暂存间出库记录").doWrite(list); + FastExcel.write(response.getOutputStream(), MwCheckoutRecordVO.class).sheet("暂存间出库记录").doWrite(list); } } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitCarServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitCarServiceImpl.java index 2abb700..8ecf276 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitCarServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitCarServiceImpl.java @@ -5,16 +5,20 @@ import com.sinata.common.entity.PageDTO; import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MwTransitCar; +import com.sinata.system.domain.SysDepartment; import com.sinata.system.domain.dto.MwTransitCarDTO; import com.sinata.system.domain.query.TransitCarQuery; import com.sinata.system.domain.vo.MwTransitCarVO; +import com.sinata.system.enums.DepartmentEnum; import com.sinata.system.mapper.MwTransitCarMapper; import com.sinata.system.service.MwTransitCarService; import com.sinata.system.service.SysDepartmentService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Objects; /** @@ -38,7 +42,21 @@ */ @Override public PageDTO<MwTransitCarVO> pageList(TransitCarQuery query) { - String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + String treeCode; + if (Objects.isNull(query.getDepartmentId())) { + SysDepartment department = sysDepartmentService.getMyDepartment(); + treeCode = department.getTreeCode(); + } else { + SysDepartment department = sysDepartmentService.getById(query.getDepartmentId()); + //如果是处置单位,则获取父级部门 + if (department.getOrgType().equals(DepartmentEnum.DISPOSAL_UNIT.getCode())) { + department = sysDepartmentService.getDepartmentByParentId(department.getParentId()); + } + treeCode = department.getTreeCode(); + } + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } Page<MwTransitCarVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); return PageDTO.of(page); } @@ -84,4 +102,15 @@ MwTransitCar mwTransitCar = BeanUtils.copyBean(dto, MwTransitCar.class); updateById(mwTransitCar); } + + /** + * 关联车辆列表 + * + * @param id + * @return + */ + @Override + public List<MwTransitCarVO> getCarListByRouteId(Long id) { + return baseMapper.getCarListByRouteId(id); + } } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitRouteServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitRouteServiceImpl.java index adb7119..7962370 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitRouteServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitRouteServiceImpl.java @@ -1,10 +1,30 @@ package com.sinata.system.service.impl; -import com.sinata.system.domain.MwTransitRoute; -import com.sinata.system.mapper.MwTransitRouteMapper; -import com.sinata.system.service.MwTransitRouteService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.sinata.common.entity.PageDTO; +import com.sinata.common.exception.ServiceException; +import com.sinata.common.utils.BeanUtils; +import com.sinata.common.utils.StringUtils; +import com.sinata.system.domain.MwTransitRoute; +import com.sinata.system.domain.MwTransitRouteCar; +import com.sinata.system.domain.MwTransitRoutePoints; +import com.sinata.system.domain.dto.MwTransitRouteDTO; +import com.sinata.system.domain.query.MwTransitRouteQuery; +import com.sinata.system.domain.vo.MwTransitRouteVO; +import com.sinata.system.mapper.MwTransitRouteMapper; +import com.sinata.system.service.MwTransitCarService; +import com.sinata.system.service.MwTransitRouteCarService; +import com.sinata.system.service.MwTransitRoutePointsService; +import com.sinata.system.service.MwTransitRouteService; +import com.sinata.system.service.SysDepartmentService; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; /** * <p> @@ -15,6 +35,115 @@ * @since 2024-12-02 */ @Service +@RequiredArgsConstructor public class MwTransitRouteServiceImpl extends ServiceImpl<MwTransitRouteMapper, MwTransitRoute> implements MwTransitRouteService { + private final SysDepartmentService sysDepartmentService; + private final MwTransitCarService mwTransitCarService; + private final MwTransitRoutePointsService mwTransitRoutePointsService; + private final MwTransitRouteCarService mwTransitRouteCarService; + /** + * 分页列表 + * + * @param query + * @return + */ + @Override + public PageDTO<MwTransitRouteVO> pageList(MwTransitRouteQuery query) { + String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId()); + if (StringUtils.isBlank(treeCode)) { + return PageDTO.empty(0L, 0L); + } + Page<MwTransitRouteVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), treeCode); + return PageDTO.of(page); + } + + /** + * 详情 + * + * @param id + * @return + */ + @Override + public MwTransitRouteVO detail(Long id) { + MwTransitRouteVO vo = baseMapper.detail(id); + //关联医院 + vo.setHostpitalList(sysDepartmentService.getHospitalListByRouteId(vo.getId())); + //关联车辆列表 + vo.setCarList(mwTransitCarService.getCarListByRouteId(vo.getId())); + return vo; + } + + /** + * 新增 + * + * @param dto + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void add(MwTransitRouteDTO dto) { + MwTransitRoute mwTransitRoute = BeanUtils.copyBean(dto, MwTransitRoute.class); + mwTransitRoute.setHospitalQuantity(dto.getHostpitalList().size()); + save(mwTransitRoute); + //关联医院 + List<MwTransitRoutePoints> mwTransitRoutePoints = BeanUtils.copyToList(dto.getHostpitalList(), MwTransitRoutePoints.class); + mwTransitRoutePoints.forEach(points -> points.setRouteId(mwTransitRoute.getId())); + mwTransitRoutePointsService.saveBatch(mwTransitRoutePoints); + //关联车辆 + List<MwTransitRouteCar> mwTransitRouteCars = dto.getCarIdList().stream().map(carId -> { + MwTransitRouteCar routeCar = new MwTransitRouteCar(); + routeCar.setRouteId(mwTransitRoute.getId()); + routeCar.setCarId(carId); + return routeCar; + }).collect(Collectors.toList()); + mwTransitRouteCarService.saveBatch(mwTransitRouteCars); + } + + /** + * 编辑 + * + * @param dto + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void edit(MwTransitRouteDTO dto) { + if (Objects.isNull(dto.getId())) { + throw new ServiceException("线路id不能为空"); + } + MwTransitRoute mwTransitRoute = BeanUtils.copyBean(dto, MwTransitRoute.class); + mwTransitRoute.setHospitalQuantity(dto.getHostpitalList().size()); + updateById(mwTransitRoute); + //移除关联医院 + mwTransitRoutePointsService.lambdaUpdate().eq(MwTransitRoutePoints::getRouteId, dto.getId()).remove(); + //关联医院 + List<MwTransitRoutePoints> mwTransitRoutePoints = BeanUtils.copyToList(dto.getHostpitalList(), MwTransitRoutePoints.class); + mwTransitRoutePoints.forEach(points -> points.setRouteId(mwTransitRoute.getId())); + mwTransitRoutePointsService.saveBatch(mwTransitRoutePoints); + //移除关联车辆 + mwTransitRouteCarService.lambdaUpdate().eq(MwTransitRouteCar::getRouteId, dto.getId()).remove(); + //关联车辆 + List<MwTransitRouteCar> mwTransitRouteCars = dto.getCarIdList().stream().map(carId -> { + MwTransitRouteCar routeCar = new MwTransitRouteCar(); + routeCar.setRouteId(mwTransitRoute.getId()); + routeCar.setCarId(carId); + return routeCar; + }).collect(Collectors.toList()); + mwTransitRouteCarService.saveBatch(mwTransitRouteCars); + } + + /** + * 删除 + * + * @param id + */ + @Override + public void delete(Long id) { + //移除关联医院 + mwTransitRoutePointsService.lambdaUpdate().eq(MwTransitRoutePoints::getRouteId, id).remove(); + //移除关联车辆 + mwTransitRouteCarService.lambdaUpdate().eq(MwTransitRouteCar::getRouteId, id).remove(); + removeById(id); + } } diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java index b796fc1..bd1c738 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java @@ -363,7 +363,18 @@ */ @Override public PageDTO<MedicalInstitutionVO> pageMedicalList(DepartmentQuery query) { - String treeCode = getTreeCodeByDepartmentId(query.getDepartmentId()); + String treeCode; + if (Objects.isNull(query.getDepartmentId())) { + SysDepartment department = getMyDepartment(); + treeCode = department.getTreeCode(); + } else { + SysDepartment department = getById(query.getDepartmentId()); + //如果是处置单位,则获取父级部门 + if (department.getOrgType().equals(DepartmentEnum.DISPOSAL_UNIT.getCode())) { + department = getDepartmentByParentId(department.getParentId()); + } + treeCode = department.getTreeCode(); + } if (StringUtils.isBlank(treeCode)) { return PageDTO.empty(0L, 0L); } @@ -786,4 +797,15 @@ } return null; } + + /** + * 路线关联医院列表 + * + * @param id + * @return + */ + @Override + public List<MedicalInstitutionVO> getHospitalListByRouteId(Long id) { + return baseMapper.getHospitalListByRouteId(id); + } } diff --git a/medicalWaste-system/src/main/resources/mapper/system/MwMonitorDeviceMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/MwMonitorDeviceMapper.xml index a4bbccf..42b8606 100644 --- a/medicalWaste-system/src/main/resources/mapper/system/MwMonitorDeviceMapper.xml +++ b/medicalWaste-system/src/main/resources/mapper/system/MwMonitorDeviceMapper.xml @@ -47,6 +47,40 @@ AND MMD.DEVICE_NAME LIKE CONCAT('%',#{query.deviceName},'%') </if> </where> + ORDER BY MMD.CREATE_TIME DESC + </select> + <select id="pageMonitorPage" resultType="com.sinata.system.domain.vo.MwMonitorDeviceVO"> + SELECT MMD.ID, + MMD.DEPARTMENT_ID, + MMD.DEVICE_NAME, + MMD.DEVICE_NUMBER, + MMD.CHANNEL_NUMBER, + MMD.AUTO_SHUTDOWN_TIME, + MMD.REMARK, + SD.DEPARTMENT_NAME + FROM MW_MONITOR_DEVICE MMD + LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MMD.DEPARTMENT_ID + <where> + MMD.DEL_FLAG = 0 + <if test="treeCode != null and treeCode != ''"> + AND SD.TREE_CODE LIKE CONCAT(#{treeCode},'%') + </if> + <if test="deviceList != null and deviceList.size() > 0"> + <if test="status != null and status == 1"> + AND MMD.DEVICE_NUMBER IN + <foreach collection="deviceList" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + <if test="status != null and status == 0"> + AND MMD.DEVICE_NUMBER NOT IN + <foreach collection="deviceList" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + </if> + </where> + ORDER BY MMD.CREATE_TIME DESC </select> </mapper> diff --git a/medicalWaste-system/src/main/resources/mapper/system/MwTransitCarMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/MwTransitCarMapper.xml index e830dc3..4babfe6 100644 --- a/medicalWaste-system/src/main/resources/mapper/system/MwTransitCarMapper.xml +++ b/medicalWaste-system/src/main/resources/mapper/system/MwTransitCarMapper.xml @@ -92,5 +92,30 @@ MTC.ID = #{id} </where> </select> + <select id="getCarListByRouteId" resultType="com.sinata.system.domain.vo.MwTransitCarVO"> + SELECT MTC.ID, + MTC.DEPARTMENT_ID, + MTC.IMAGE_URL, + MTC.LICENSE_PLATE_NUMBER, + MTC.PERSON_IN_CHARGE, + MTC.PHONE_NUMBER, + MTC.BRAND, + MTC.COLOR, + MTC.CODE, + MTC.MAXIMUM_LOAD, + MTC.REMARK, + MTC.DEL_FLAG, + MTC.CREATE_BY, + MTC.CREATE_TIME, + MTC.UPDATE_BY, + MTC.UPDATE_TIME, + SD.DEPARTMENT_NAME + FROM MW_TRANSIT_ROUTE_CAR MTRC + INNER JOIN MW_TRANSIT_CAR MTC ON MTC.ID = MTRC.CAR_ID + LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MTC.DEPARTMENT_ID + <where> + MTRC.ROUTE_ID = #{id} + </where> + </select> </mapper> diff --git a/medicalWaste-system/src/main/resources/mapper/system/MwTransitRouteMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/MwTransitRouteMapper.xml index 5bacf24..484a0b5 100644 --- a/medicalWaste-system/src/main/resources/mapper/system/MwTransitRouteMapper.xml +++ b/medicalWaste-system/src/main/resources/mapper/system/MwTransitRouteMapper.xml @@ -23,5 +23,38 @@ UPDATE_TIME, ID, DEPARTMENT_ID, ROUTE_NAME </sql> + <select id="pageList" resultType="com.sinata.system.domain.vo.MwTransitRouteVO"> + SELECT MTR.ID, + MTR.DEPARTMENT_ID, + MTR.ROUTE_NAME, + MTR.DEL_FLAG, + MTR.CREATE_TIME, + MTR.HOSPITAL_QUANTITY, + MTR.REMARK, + SD.DEPARTMENT_NAME + FROM MW_TRANSIT_ROUTE MTR + LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MTR.DEPARTMENT_ID + <where> + MTR.DEL_FLAG = 0 + <if test="treeCode != null and treeCode != ''"> + AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%') + </if> + </where> + </select> + <select id="detail" resultType="com.sinata.system.domain.vo.MwTransitRouteVO"> + SELECT MTR.ID, + MTR.DEPARTMENT_ID, + MTR.ROUTE_NAME, + MTR.DEL_FLAG, + MTR.CREATE_TIME, + MTR.HOSPITAL_QUANTITY, + MTR.REMARK, + SD.DEPARTMENT_NAME + FROM MW_TRANSIT_ROUTE MTR + LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MTR.DEPARTMENT_ID + <where> + MTR.ID = #{id} + </where> + </select> </mapper> diff --git a/medicalWaste-system/src/main/resources/mapper/system/SysDepartmentMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/SysDepartmentMapper.xml index 08f61ec..850d7da 100644 --- a/medicalWaste-system/src/main/resources/mapper/system/SysDepartmentMapper.xml +++ b/medicalWaste-system/src/main/resources/mapper/system/SysDepartmentMapper.xml @@ -59,7 +59,7 @@ sdd.DICT_LABEL AS INSTITUTION_LEVEL_STR,sdd2.DICT_LABEL AS INSTITUTION_TYPE_STR FROM SYS_DEPARTMENT sd LEFT JOIN SYS_DEPARTMENT_INFO sdi - ON sd.id = sdi.DEPARTMENT_ID + ON sd.ID = sdi.DEPARTMENT_ID LEFT JOIN SYS_DICT_DATA sdd ON sdi.INSTITUTION_LEVEL = sdd.DICT_CODE LEFT JOIN SYS_DICT_DATA sdd2 @@ -100,7 +100,7 @@ sdd.DICT_LABEL AS INSTITUTION_LEVEL_STR,sdd2.DICT_LABEL AS INSTITUTION_TYPE_STR FROM SYS_DEPARTMENT sd LEFT JOIN SYS_DEPARTMENT_INFO sdi - ON sd.id = sdi.DEPARTMENT_ID + ON sd.ID = sdi.DEPARTMENT_ID LEFT JOIN SYS_DICT_DATA sdd ON sdi.INSTITUTION_LEVEL = sdd.DICT_CODE LEFT JOIN SYS_DICT_DATA sdd2 @@ -127,7 +127,7 @@ sdi.MAXIMUM_STORAGE_CAPACITY FROM SYS_DEPARTMENT sd LEFT JOIN SYS_DEPARTMENT_INFO sdi - ON sd.id = sdi.DEPARTMENT_ID + ON sd.ID = sdi.DEPARTMENT_ID <where> sd.ORG_TYPE = 3 AND sd.TREE_CODE LIKE CONCAT(#{treeCode}, '%') </where> @@ -149,7 +149,7 @@ sdi.MAXIMUM_STORAGE_CAPACITY FROM SYS_DEPARTMENT sd LEFT JOIN SYS_DEPARTMENT_INFO sdi - ON sd.id = sdi.DEPARTMENT_ID + ON sd.ID = sdi.DEPARTMENT_ID <where> sd.ORG_TYPE = 3 <if test="departmentId != null"> @@ -188,9 +188,36 @@ sdi.MAXIMUM_STORAGE_CAPACITY FROM SYS_DEPARTMENT sd LEFT JOIN SYS_DEPARTMENT_INFO sdi - ON sd.id = sdi.DEPARTMENT_ID + ON sd.ID = sdi.DEPARTMENT_ID <where> - sd.id = #{id} + sd.ID = #{id} + </where> + </select> + <select id="getHospitalListByRouteId" resultType="com.sinata.system.domain.vo.MedicalInstitutionVO"> + SELECT SD.ID, + DEPARTMENT_NAME, + PARENT_ID, + TREE_CODE, + ORG_TYPE, + ORG_CODE, + ADDRESS, + LONGITUDE, + LATITUDE, + CONTACT_PERSON, + CONTACT_PHONE, + REMARK, + LEGAL_PERSON, + UNIFIED_SOCIAL_CREDIT_CODE, + DEL_FLAG, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME, + REGION + FROM MW_TRANSIT_ROUTE_POINTS MTRP + INNER JOIN SYS_DEPARTMENT SD ON MTRP.DEPARTMENT_ID = SD.ID + <where> + SD.ORG_TYPE = 2 AND MTRP.ID = #{id} </where> </select> diff --git a/pom.xml b/pom.xml index f69f146..56e7c2d 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ <hutool.version>5.7.17</hutool.version> <fastexcel.version>1.0.0</fastexcel.version> <aliyun-oss.version>3.17.4</aliyun-oss.version> + <dysmsapi.version>3.1.0</dysmsapi.version> </properties> <!-- 依赖声明 --> @@ -221,6 +222,12 @@ <artifactId>aliyun-sdk-oss</artifactId> <version>${aliyun-oss.version}</version> </dependency> + <!--sms--> + <dependency> + <groupId>com.aliyun</groupId> + <artifactId>dysmsapi20170525</artifactId> + <version>${dysmsapi.version}</version> + </dependency> </dependencies> </dependencyManagement> -- Gitblit v1.7.1