Reviewed-on: http://39.105.23.186:3000/develop/digimeta-MultiSaas/pulls/20tags/B.1.0.4.0_20230804_alpha
| @@ -166,6 +166,20 @@ services: | |||
| depends_on: | |||
| - xueyi-nacos | |||
| - xueyi-redis | |||
| links: | |||
| - xueyi-nacos | |||
| - xueyi-redis | |||
| xueyi-modules-auth: | |||
| container_name: xueyi-modules-auth | |||
| build: | |||
| context: xueyi-modules/xueyi-modules-auth | |||
| dockerfile: ./Dockerfile | |||
| ports: | |||
| - "9970:9970" | |||
| depends_on: | |||
| - xueyi-nacos | |||
| - xueyi-redis | |||
| links: | |||
| - xueyi-nacos | |||
| - xueyi-redis | |||
| @@ -294,6 +294,13 @@ | |||
| <version>${xueyi.version}</version> | |||
| </dependency> | |||
| <!-- 模块auth模块 --> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-api-modules-auth</artifactId> | |||
| <version>${xueyi.version}</version> | |||
| </dependency> | |||
| <!-- huTool 工具类库 --> | |||
| <dependency> | |||
| <groupId>cn.hutool</groupId> | |||
| @@ -327,6 +334,20 @@ | |||
| </dependencies> | |||
| <profiles> | |||
| <profile> | |||
| <id>local</id> | |||
| <properties> | |||
| <!-- 环境标识,需要与配置文件的名称相对应 --> | |||
| <activatedProperties>local</activatedProperties> | |||
| <nacos.host>127.0.0.1</nacos.host> | |||
| <nacos.port>18848</nacos.port> | |||
| <nacos.namespace></nacos.namespace> | |||
| </properties> | |||
| <activation> | |||
| <!-- 默认环境 --> | |||
| <!-- <activeByDefault>true</activeByDefault>--> | |||
| </activation> | |||
| </profile> | |||
| <profile> | |||
| <id>dev</id> | |||
| <properties> | |||
| @@ -356,7 +377,7 @@ | |||
| <properties> | |||
| <!-- 环境标识,需要与配置文件的名称相对应 --> | |||
| <activatedProperties>prod</activatedProperties> | |||
| <nacos.host>172.17.0.1</nacos.host> | |||
| <nacos.host>123.57.75.177</nacos.host> | |||
| <nacos.port>18848</nacos.port> | |||
| <nacos.namespace></nacos.namespace> | |||
| </properties> | |||
| @@ -14,6 +14,7 @@ | |||
| <module>xueyi-api-tenant</module> | |||
| <module>xueyi-api-file</module> | |||
| <module>xueyi-api-job</module> | |||
| <module>xueyi-api-modules-auth</module> | |||
| </modules> | |||
| @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestPart; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.util.List; | |||
| /** | |||
| * 文件服务 | |||
| * | |||
| @@ -29,6 +31,15 @@ public interface RemoteFileService { | |||
| @PostMapping(value = "/inner/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | |||
| R<SysFile> upload(@RequestPart(value = "file") MultipartFile file); | |||
| /** | |||
| * 上传pdf文件 | |||
| * | |||
| * @param file 文件信息 | |||
| * @return 结果 | |||
| */ | |||
| @PostMapping(value = "/inner/uploadpdf", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | |||
| R<List<SysFile>> uploadPdf(@RequestPart(value = "file") MultipartFile file); | |||
| /** | |||
| * 删除文件 | |||
| * | |||
| @@ -8,6 +8,8 @@ import org.springframework.cloud.openfeign.FallbackFactory; | |||
| import org.springframework.stereotype.Component; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.util.List; | |||
| /** | |||
| * 文件服务 降级处理 | |||
| * | |||
| @@ -26,6 +28,11 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ | |||
| return R.fail("上传文件失败:" + throwable.getMessage()); | |||
| } | |||
| @Override | |||
| public R<List<SysFile>> uploadPdf(MultipartFile file) { | |||
| return R.fail("上传文件失败:" + throwable.getMessage() ); | |||
| } | |||
| @Override | |||
| public R<Boolean> delete(String url) { | |||
| return R.fail("删除文件失败:" + throwable.getMessage()); | |||
| @@ -0,0 +1,28 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xmlns="http://maven.apache.org/POM/4.0.0" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-api</artifactId> | |||
| <version>2.5.0</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>xueyi-api-modules-auth</artifactId> | |||
| <description> | |||
| xueyi-api-modules-auth管理接口模块 | |||
| </description> | |||
| <dependencies> | |||
| <!-- XueYi Common Core --> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-common-core</artifactId> | |||
| </dependency> | |||
| </dependencies> | |||
| </project> | |||
| @@ -0,0 +1,22 @@ | |||
| package com.xueyi.modules.auth.api.domain.vo; | |||
| import lombok.Data; | |||
| import javax.validation.constraints.NotNull; | |||
| /** | |||
| * @author yk | |||
| * @description 意图请求对象DTO | |||
| * @date 2023-07-31 19:50 | |||
| */ | |||
| @Data | |||
| public class IntentionReqDto { | |||
| @NotNull(message = "staffId不能为空") | |||
| private String staffId; | |||
| @NotNull(message = "staffType不能为空") | |||
| private String staffType; | |||
| @NotNull(message = "skillCode不能为空") | |||
| private String skillCode; | |||
| @NotNull(message = "devId不能为空") | |||
| private String devId; | |||
| } | |||
| @@ -0,0 +1,27 @@ | |||
| package com.xueyi.modules.auth.api.feign; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.common.core.constant.basic.ServiceConstants; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.modules.auth.api.domain.vo.IntentionReqDto; | |||
| import com.xueyi.modules.auth.api.feign.factory.RemoteSkillAuthFallbackFactory; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * 数据源服务 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @FeignClient(contextId = "remoteSkillAuthService", value = ServiceConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSkillAuthFallbackFactory.class) | |||
| public interface RemoteSkillAuthService { | |||
| @RequestMapping(value = "/skill/inner/auth", method = {RequestMethod.POST}) | |||
| @ResponseBody | |||
| public AjaxResult skillAuth(@Valid @RequestBody IntentionReqDto intentionSkillAuth, @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.xueyi.modules.auth.api.feign.factory; | |||
| import com.xueyi.modules.auth.api.feign.RemoteSkillAuthService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.cloud.openfeign.FallbackFactory; | |||
| import org.springframework.stereotype.Component; | |||
| /** | |||
| * 数据源服务降级处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Slf4j | |||
| @Component | |||
| public class RemoteSkillAuthFallbackFactory implements FallbackFactory<RemoteSkillAuthService> { | |||
| @Override | |||
| public RemoteSkillAuthService create(Throwable cause) { | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| com.xueyi.modules.auth.api.feign.factory.RemoteSkillAuthFallbackFactory | |||
| @@ -2,6 +2,7 @@ package com.xueyi.system.api.digitalmans.domain.dto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanPo; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanWorktimePo; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo; | |||
| import com.xueyi.system.api.organize.domain.vo.SysDeptExt; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import lombok.Data; | |||
| @@ -22,5 +23,6 @@ public class DmSyncDigitalmanDto extends DmDigitalmanPo { | |||
| protected DmDigitalmanWorktimePo worktime; | |||
| protected SysDeptExt workdayHour; | |||
| protected String iconPos; | |||
| protected DmBroadcastVo broadcast; | |||
| } | |||
| @@ -1,16 +1,15 @@ | |||
| package com.xueyi.system.api.digitalmans.domain.po; | |||
| import com.xueyi.common.core.web.tenant.base.TBaseEntity; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.xueyi.common.core.web.tenant.base.TBaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.STATUS; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.SORT; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.REMARK; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.SORT; | |||
| /** | |||
| * 访客 持久化对象 | |||
| @@ -53,4 +52,6 @@ public class DmSkillPo extends TBaseEntity { | |||
| protected Integer firstCall; | |||
| protected String auth; | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.xueyi.system.api.digitalmans.domain.vo; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import java.util.List; | |||
| @Data | |||
| @NoArgsConstructor | |||
| public class DmBroadcastVo { | |||
| Integer recycle; | |||
| Integer speed; | |||
| List<JSONObject> resource; | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.xueyi.system.api.digitalmans.feign; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.common.core.constant.basic.ServiceConstants; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmReceptionVo; | |||
| import com.xueyi.system.api.organize.feign.factory.RemoteUserFallbackFactory; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| @FeignClient(contextId = "remoteBroadcastService", value = ServiceConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) | |||
| public interface RemoteBroadcastService { | |||
| @GetMapping("/broadcast/inner/list") | |||
| public R<DmBroadcastVo> innerlist(@RequestParam("manCode") String manCode, | |||
| @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| } | |||
| @@ -59,4 +59,12 @@ public class SysUserDto extends SysUserPo { | |||
| return StrUtil.equals(AuthorityConstants.UserType.ADMIN.getCode(), userType); | |||
| } | |||
| @Override | |||
| public String toString(){ | |||
| return "User{" + | |||
| "id=" + id + | |||
| ", username='" + userName + '\'' + | |||
| ", nickName='" + nickName + '\'' + | |||
| ", phone='" + phone + '\''; | |||
| } | |||
| } | |||
| @@ -95,4 +95,12 @@ public class SysUserPo extends TBaseEntity { | |||
| protected LocalDateTime loginDate; | |||
| protected String dept; | |||
| @Override | |||
| public String toString(){ | |||
| return "User{" + | |||
| "id=" + id + | |||
| ", username='" + userName + '\'' + | |||
| ", nickName='" + nickName + '\'' + | |||
| ", phone='" + phone + '\''; | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.xueyi.system.api.staff.domain.dto; | |||
| import lombok.Data; | |||
| /** | |||
| * 熟人介绍的生人数据的 数据传输对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| public class DmStaffCommonDto { | |||
| public static final String TYPE_STRANGER = "6"; | |||
| public static final String TYPE_VIP_STRANGER = "9"; | |||
| private String staffName; | |||
| protected String staffType; | |||
| protected Integer gender; | |||
| private String staffBase64Img; | |||
| private String devId; | |||
| @Override | |||
| public String toString() { | |||
| return | |||
| "staffName:" + staffName + | |||
| "\nstaffType:" + staffType + | |||
| "\nstaffBase64Img:" + staffBase64Img + | |||
| "\ndevId:" + devId + | |||
| "\n"; | |||
| } | |||
| } | |||
| @@ -32,6 +32,8 @@ public class DmVisitCommonDto { | |||
| private Long recordId; | |||
| private String visitorBase64Img; | |||
| @Override | |||
| public String toString() { | |||
| @@ -6,11 +6,15 @@ import com.xueyi.common.core.constant.basic.ServiceConstants; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; | |||
| import com.xueyi.system.api.organize.feign.factory.RemoteUserFallbackFactory; | |||
| import com.xueyi.system.api.staff.domain.dto.DmStaffCommonDto; | |||
| import com.xueyi.system.api.staff.domain.vo.DmStaffFeature; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import java.util.List; | |||
| @@ -22,15 +26,6 @@ import java.util.List; | |||
| @FeignClient(contextId = "remoteStaffService", value = ServiceConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) | |||
| public interface RemoteStaffService { | |||
| /** | |||
| * 新增用户 | |||
| * | |||
| * @param user 用户对象 | |||
| * @param enterpriseId 企业Id | |||
| * @param sourceName 策略源 | |||
| * @param source 请求来源 | |||
| * @return 结果 | |||
| */ | |||
| @GetMapping("/staff/inner/{devId}/{timestamp}") | |||
| R<List<DmStaffFeature>> listInner(@RequestParam(value = "devId") String devId, @RequestParam(value = "timestamp") String timestamp, | |||
| @RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| @@ -41,4 +36,8 @@ public interface RemoteStaffService { | |||
| @GetMapping("/staff/inner/tenantId/{enterpriseName}") | |||
| public R<SysEnterpriseDto> tenantIdInner(@RequestParam(value = "enterpriseName") String enterpriseName) ; | |||
| @PostMapping(value = "/staff/inner-api/new-staff") | |||
| @ResponseBody | |||
| public com.alibaba.fastjson2.JSONObject addStaff(@RequestBody DmStaffCommonDto commonDto,@RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| } | |||
| @@ -25,6 +25,8 @@ public class ServiceConstants { | |||
| /** 系统模块的serviceId */ | |||
| public static final String MESSAGE_SERVICE = "xueyi-message"; | |||
| public static final String MODULES_AUTH_SERVICE = "xueyi-modules-auth"; | |||
| /** 定时任务模块的serviceId */ | |||
| public static final String JOB_SERVICE = "xueyi-job"; | |||
| /** 定时任务模块的serviceId */ | |||
| @@ -24,7 +24,7 @@ public class MimeTypeUtil { | |||
| public static final String[] MEDIA_EXTENSION = {"swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", | |||
| "asf", "rm", "rmvb"}; | |||
| public static final String[] VIDEO_EXTENSION = {"mp4", "avi", "rmvb"}; | |||
| public static final String[] VIDEO_EXTENSION = {"mp4", "avi", "rmvb", "webm"}; | |||
| public static final String[] DEFAULT_ALLOWED_EXTENSION = { | |||
| // 图片 | |||
| @@ -1,22 +0,0 @@ | |||
| package com.xueyi.common.mqtt.service; | |||
| /** | |||
| * @author yk | |||
| * @description | |||
| * @date 2023-05-10 19:19 | |||
| */ | |||
| public class MqttMessageHandlerService{ | |||
| private final MqttService mqttService; | |||
| private final MqttMessageHandler mqttMessageHandler; | |||
| public MqttMessageHandlerService(MqttService mqttService, MqttMessageHandler mqttMessageHandler) { | |||
| this.mqttService = mqttService; | |||
| this.mqttMessageHandler = mqttMessageHandler; | |||
| init(); | |||
| } | |||
| private void init() { | |||
| mqttService.addObserver(mqttMessageHandler); | |||
| } | |||
| } | |||
| @@ -1,108 +0,0 @@ | |||
| package com.xueyi.common.mqtt.service; | |||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.xueyi.common.mqtt.configure.MqttConfig; | |||
| import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; | |||
| import org.eclipse.paho.client.mqttv3.MqttCallback; | |||
| import org.eclipse.paho.client.mqttv3.MqttClient; | |||
| import org.eclipse.paho.client.mqttv3.MqttException; | |||
| import org.eclipse.paho.client.mqttv3.MqttMessage; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Component; | |||
| import java.nio.charset.StandardCharsets; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| /** | |||
| * spring mqtt 工具类 | |||
| * | |||
| * @author xueyi | |||
| **/ | |||
| @Component | |||
| @SuppressWarnings(value = {"unchecked", "rawtypes"}) | |||
| public class MqttService implements MqttCallback{ | |||
| private List<MqttMessageHandler> observers = new ArrayList<>(); | |||
| public void addObserver(MqttMessageHandler observer) { | |||
| observers.add(observer); | |||
| } | |||
| public void removeObserver(MqttMessageHandler observer) { | |||
| observers.remove(observer); | |||
| } | |||
| @Autowired | |||
| private MqttClient mqttClient; | |||
| @Autowired | |||
| private MqttConfig mqttConfig; | |||
| /** | |||
| * 发布消息到指定 topic | |||
| * | |||
| * @param topic 消息主题 | |||
| * @param message 消息内容 | |||
| */ | |||
| public void sendMessage(String topic, Object message) { | |||
| System.out.println("发送消息到 topic: " + topic); | |||
| System.out.println("消息内容: " + message); | |||
| MqttMessage msg = new MqttMessage(); | |||
| msg.setPayload(message.toString().getBytes()); | |||
| try { | |||
| mqttClient.publish(topic, msg); | |||
| } catch (MqttException e) { | |||
| e.printStackTrace(); | |||
| System.err.println(e.getMessage()); | |||
| } | |||
| } | |||
| // @PostConstruct | |||
| public void subscribe() { | |||
| mqttClient.setCallback(this); | |||
| for (String topic : Arrays.stream(mqttConfig.getTopics().split(",")).toList()) { | |||
| if (StringUtils.isNotEmpty(topic)) { | |||
| try { | |||
| mqttClient.subscribe(topic, 0); | |||
| } catch (MqttException e) { | |||
| e.printStackTrace(); | |||
| System.err.println(e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public void connectionLost(Throwable throwable) { | |||
| throwable.printStackTrace(); | |||
| System.out.println("Connection lost: " + throwable.getMessage()); | |||
| try { | |||
| mqttClient.reconnect(); | |||
| subscribe(); | |||
| System.out.println("Reconnected to MQTT broker"); | |||
| } catch (MqttException e) { | |||
| System.out.println("Reconnect failed: " + e.getMessage()); | |||
| } | |||
| } | |||
| @Override | |||
| public void messageArrived(String s, MqttMessage mqttMessage) { | |||
| try{ | |||
| for (MqttMessageHandler observer : observers) { | |||
| observer.handleMessage(s, new String(mqttMessage.getPayload(), StandardCharsets.UTF_8)); | |||
| } | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| System.err.println(e.getMessage()); | |||
| } | |||
| } | |||
| @Override | |||
| public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { | |||
| } | |||
| } | |||
| @@ -68,4 +68,5 @@ public class XueYiMyBatisPlusConfig { | |||
| interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); | |||
| return interceptor; | |||
| } | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.xueyi.common.web.config; | |||
| import com.xueyi.common.web.utils.ResponseCodeUtil; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import java.util.Map; | |||
| /** | |||
| * MP配置 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Configuration | |||
| public class XueYiMyRespConfig { | |||
| @Bean | |||
| public Map<Integer, Map<String, String>> responseMessageMap() { | |||
| return ResponseCodeUtil.getResponseCodeAndMsgMap(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,85 @@ | |||
| package com.xueyi.common.web.controller; | |||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.google.common.collect.Lists; | |||
| import com.xueyi.common.web.constant.ResponseCode; | |||
| import com.xueyi.common.web.response.MyResponse; | |||
| import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo; | |||
| import com.xueyi.system.api.device.feign.RemoteDeviceTenantMergeService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public class BaseApiController { | |||
| @Autowired | |||
| protected Map<Integer, Map<String,String>> responseMessageMap; | |||
| protected final static String EMPTY_STRING = ""; | |||
| protected final static String LANGUAGE_CHINESE = "zh"; | |||
| private MyResponse message = null; | |||
| public DeviceTenantSourceMergeVo getDeviceTenantSourceMergeVo(String devId){ | |||
| return remoteDeviceTenantMergeService.selectDeviceTenantSourceMerge(devId); | |||
| } | |||
| @Autowired | |||
| private RemoteDeviceTenantMergeService remoteDeviceTenantMergeService; | |||
| protected MyResponse outputSuccess(){ | |||
| return outputSuccess(null); | |||
| } | |||
| /** | |||
| * 业务处理成功 | |||
| * @param data | |||
| * @return | |||
| */ | |||
| protected MyResponse outputSuccess(Object data){ | |||
| return output(ResponseCode.SUCCESS, EMPTY_STRING, data); | |||
| } | |||
| protected MyResponse output(final Integer code) { | |||
| return output(code, EMPTY_STRING); | |||
| } | |||
| protected MyResponse output(final Integer code, final String replaceParameter) { | |||
| return output(code, replaceParameter, null); | |||
| } | |||
| protected MyResponse output(final Integer code, final String replaceParameter, final Object data) { | |||
| if (null == replaceParameter) { | |||
| return output(code, Lists.newArrayList(EMPTY_STRING), data, null); | |||
| } | |||
| return output(code, Lists.newArrayList(replaceParameter), data, null); | |||
| } | |||
| protected MyResponse output(final Integer code, final List<String> replaceParameters, final Object data, final String errorMessage){ | |||
| if (ResponseCode.SUCCESS.equals(code)) { | |||
| if (null == data) { | |||
| message = new MyResponse(code); | |||
| } else { | |||
| message = new MyResponse(code, EMPTY_STRING, data); | |||
| } | |||
| } else { | |||
| String reponseText = StringUtils.isEmpty(errorMessage)? responseMessageMap.get(code).get(LANGUAGE_CHINESE) : errorMessage; | |||
| if (null != replaceParameters && replaceParameters.size() > 0) { | |||
| for (int i = 0; i < replaceParameters.size(); i++) { | |||
| reponseText = reponseText.replace("#p" + i + "#", replaceParameters.get(i)); | |||
| } | |||
| }else{ | |||
| reponseText = reponseText.replace("#p0#", ""); | |||
| } | |||
| if (null == data){ | |||
| message = new MyResponse(code, reponseText); | |||
| }else{ | |||
| message = new MyResponse(code, reponseText, data); | |||
| } | |||
| } | |||
| return message; | |||
| } | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| com.xueyi.common.web.config.properties.TenantProperties | |||
| com.xueyi.common.web.config.XueYiMyBatisPlusConfig | |||
| com.xueyi.common.web.config.XueYiMyRespConfig | |||
| com.xueyi.common.web.handler.XueYiMetaObjectHandler | |||
| com.xueyi.common.web.handler.TenantLineHandler | |||
| com.xueyi.common.web.aspect.AutoInjectAspect | |||
| @@ -37,7 +37,7 @@ public class AuthFilter implements GlobalFilter, Ordered { | |||
| @Autowired | |||
| private RedisService redisService; | |||
| private static final String[] whitePrefix = {"/message/api", "/pass/api", "/meeting/api", "/visit/api", "/file/api","/staff/api","/apkversion/api","/man/api","/holiday/api"}; | |||
| private static final String[] whitePrefix = {"/message/api", "/pass/api", "/meeting/api", "/visit/api", "/file/api","/staff/api","/apkversion/api","/man/api","/holiday/api", "/skill/api", "/intent/api"}; | |||
| @Override | |||
| public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { | |||
| @@ -15,6 +15,7 @@ | |||
| <module>xueyi-job</module> | |||
| <module>xueyi-file</module> | |||
| <module>xueyi-message</module> | |||
| <module>xueyi-modules-auth</module> | |||
| </modules> | |||
| <artifactId>xueyi-modules</artifactId> | |||
| @@ -72,6 +72,12 @@ | |||
| <artifactId>xueyi-common-security</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.pdfbox</groupId> | |||
| <artifactId>pdfbox</artifactId> | |||
| <version>2.0.29</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| @@ -12,13 +12,22 @@ import com.xueyi.file.api.domain.SysFile; | |||
| import com.xueyi.file.api.feign.RemoteFileManageService; | |||
| import com.xueyi.file.config.MinioConfig; | |||
| import com.xueyi.file.service.ISysFileService; | |||
| import com.xueyi.file.service.MinioSysFileServiceImpl; | |||
| import com.xueyi.file.utils.PdfToImageUtil; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.bind.annotation.DeleteMapping; | |||
| 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.RestController; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.File; | |||
| import java.time.LocalDate; | |||
| import java.time.format.DateTimeFormatter; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| /** | |||
| * 文件请求处理 | |||
| @@ -38,6 +47,9 @@ public class SysFileController { | |||
| @Autowired | |||
| private MinioConfig minioConfig; | |||
| @Autowired | |||
| private MinioSysFileServiceImpl minioSysFileService; | |||
| /** | |||
| * 文件上传 | 内部调用 | |||
| */ | |||
| @@ -60,6 +72,45 @@ public class SysFileController { | |||
| } | |||
| } | |||
| /** | |||
| * 文件上传 | 内部调用 | |||
| */ | |||
| @PostMapping("/inner/uploadpdf") | |||
| public R<List<SysFile>> uploadPdfInner(MultipartFile file) { | |||
| try { | |||
| System.out.println("文件上传开始:" + file.getName()); | |||
| // pdf文件转成图片集合 | |||
| List<File> fileList = PdfToImageUtil.pdfToTransformationList(file); | |||
| List<SysFile> results = new ArrayList<>(); | |||
| int num = 0; | |||
| // 循环上传并返回日志集合 | |||
| for (File f : fileList) { | |||
| //将file的文件名重命名为file文件名+两位数的num | |||
| String fileName = f.getName(); | |||
| String suffix = fileName.substring(fileName.lastIndexOf(".")); | |||
| String name = fileName.substring(0, fileName.lastIndexOf(".")); | |||
| String newName = name + String.format("%02d", num) + suffix; | |||
| // 上传并返回访问地址 | |||
| String url = sysFileService.uploadFile(newName, f); | |||
| SysFile sysFile = new SysFile(); | |||
| sysFile.setUrl(url); | |||
| sysFile.setSize(f.length()); | |||
| sysFile.setName(FileUtil.getName(url)); | |||
| sysFile.setNick(sysFile.getName()); | |||
| remoteFileManageService.saveFileLog(sysFile, SecurityConstants.INNER); | |||
| results.add(sysFile); | |||
| }; | |||
| return R.ok(results); | |||
| } catch (Exception e) { | |||
| log.error("上传文件失败", e); | |||
| return R.fail(e.getMessage()); | |||
| } | |||
| } | |||
| /** | |||
| * 删除文件 | 内部调用 | |||
| */ | |||
| @@ -100,4 +151,14 @@ public class SysFileController { | |||
| ? AjaxResult.success("上传成功!", R.getData().getUrl()) | |||
| : AjaxResult.error("上传失败!"); | |||
| } | |||
| /** | |||
| * 文件上传请求 | |||
| */ | |||
| @PostMapping("/uploadpdf") | |||
| public AjaxResult uploadPdf(MultipartFile file) { | |||
| R<List<SysFile>> R = uploadPdfInner(file); | |||
| return R.isOk() | |||
| ? AjaxResult.success("上传成功!", R.getData()) | |||
| : AjaxResult.error("上传失败!"); | |||
| } | |||
| } | |||
| @@ -8,6 +8,8 @@ import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.File; | |||
| /** | |||
| * FastDFS 文件存储 | |||
| * | |||
| @@ -39,6 +41,11 @@ public class FastDfsSysFileServiceImpl implements ISysFileService { | |||
| return domain + "/" + storePath.getFullPath(); | |||
| } | |||
| @Override | |||
| public String uploadFile(String fileName, File file) throws Exception { | |||
| return null; | |||
| } | |||
| /** | |||
| * 文件删除接口 | |||
| * | |||
| @@ -2,6 +2,8 @@ package com.xueyi.file.service; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.File; | |||
| /** | |||
| * 文件上传接口 | |||
| * | |||
| @@ -16,6 +18,7 @@ public interface ISysFileService { | |||
| * @return 访问地址 | |||
| */ | |||
| String uploadFile(MultipartFile file) throws Exception; | |||
| String uploadFile(String fileName, File file) throws Exception; | |||
| /** | |||
| * 文件删除接口 | |||
| @@ -2,7 +2,6 @@ package com.xueyi.file.service; | |||
| import com.xueyi.file.utils.FileUploadUtils; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.context.annotation.Primary; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| @@ -41,6 +40,11 @@ public class LocalSysFileServiceImpl implements ISysFileService { | |||
| return domain + localFilePrefix + name; | |||
| } | |||
| @Override | |||
| public String uploadFile(String fileName, File file) throws Exception { | |||
| return null; | |||
| } | |||
| /** | |||
| * 文件删除接口 | |||
| * | |||
| @@ -4,11 +4,17 @@ import com.xueyi.file.config.MinioConfig; | |||
| import com.xueyi.file.utils.FileUploadUtils; | |||
| import io.minio.MinioClient; | |||
| import io.minio.PutObjectArgs; | |||
| import org.apache.commons.io.FileUtils; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Primary; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.InputStream; | |||
| import java.net.URLEncoder; | |||
| /** | |||
| @@ -53,6 +59,64 @@ public class MinioSysFileServiceImpl implements ISysFileService { | |||
| return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; | |||
| } | |||
| @Override | |||
| public String uploadFile(String fileName, File file) throws Exception { | |||
| fileName = FileUploadUtils.extractFilename(fileName); | |||
| InputStream inputStream = FileUtils.openInputStream(file); | |||
| System.out.println("file original filename = " + fileName); | |||
| System.out.println("file size = " + file.length()); | |||
| // 使用IOUtils.toByteArray()方法确保正确地读取输入流中的数据 | |||
| byte[] fileBytes = IOUtils.toByteArray(inputStream); | |||
| // 上传文件到MinIO | |||
| String minioFileName = uploadFileToMinIO(fileName, fileBytes); | |||
| System.out.println("MinIO 文件上传成功,Minio 文件名:" + minioFileName); | |||
| // 获取fileName的最后一个'/'的位置的字符串,并用URLEncoder进行UTF-8编码后,再拼接到fileName中 | |||
| String splitStr = fileName.substring(fileName.lastIndexOf("/") + 1); | |||
| splitStr = URLEncoder.encode(splitStr, "UTF-8"); | |||
| fileName = fileName.substring(0, fileName.lastIndexOf("/") + 1) + splitStr; | |||
| return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; | |||
| } | |||
| // 上传文件到MinIO | |||
| private String uploadFileToMinIO(String fileName, byte[] fileBytes) throws Exception { | |||
| PutObjectArgs args = PutObjectArgs.builder() | |||
| .bucket(minioConfig.getBucketName()) | |||
| .object(fileName) | |||
| .stream(new ByteArrayInputStream(fileBytes), fileBytes.length, -1) | |||
| .contentType("application/octet-stream") | |||
| .build(); | |||
| client.putObject(args); | |||
| return fileName; | |||
| } | |||
| public String uploadFile(File file) throws Exception { | |||
| String fileName = file.getName(); | |||
| // 获取fileName的最后一个'/'的位置的字符串,并用URLEncoder进行UTF-8编码后,再拼接到fileName中 | |||
| // 使用PutObjectArgs上传文件到MinIO | |||
| client.putObject( | |||
| PutObjectArgs.builder() | |||
| .bucket(minioConfig.getBucketName()) | |||
| .object(fileName) | |||
| .stream(new FileInputStream(file), file.length(), -1) | |||
| .contentType("application/octet-stream") | |||
| .build() | |||
| ); | |||
| System.out.println("文件上传到MinIO成功:" + fileName); | |||
| String splitStr = fileName.substring(fileName.lastIndexOf("/") + 1); | |||
| splitStr = URLEncoder.encode(splitStr, "UTF-8"); | |||
| fileName = fileName.substring(0, fileName.lastIndexOf("/") + 1) + splitStr; | |||
| return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; | |||
| } | |||
| /** | |||
| * 文件删除接口 | |||
| * | |||
| @@ -78,6 +78,13 @@ public class FileUploadUtils { | |||
| return StrUtil.format("{}/{}_{}.{}", DateUtil.datePath(), FilenameUtils.getBaseName(file.getOriginalFilename()), IdUtil.simpleUUID(), FileTypeUtil.getExtension(file)); | |||
| } | |||
| /** | |||
| * 编码文件名 | |||
| */ | |||
| public static String extractFilename(String fileName) { | |||
| return StrUtil.format("{}/{}_{}.{}", DateUtil.datePath(), FilenameUtils.getBaseName(fileName.substring(0,fileName.lastIndexOf("."))), IdUtil.simpleUUID(), fileName.substring(fileName.lastIndexOf(".") + 1 , fileName.length())); | |||
| } | |||
| private static File getAbsoluteFile(String uploadDir, String fileName) throws IOException { | |||
| File desc = new File(uploadDir + File.separator + fileName); | |||
| @@ -0,0 +1,145 @@ | |||
| package com.xueyi.file.utils; | |||
| import org.apache.pdfbox.pdmodel.PDDocument; | |||
| import org.apache.pdfbox.pdmodel.PDPage; | |||
| import org.apache.pdfbox.rendering.PDFRenderer; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import javax.imageio.ImageIO; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.awt.image.BufferedImage; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.nio.file.Files; | |||
| import java.nio.file.Path; | |||
| import java.nio.file.Paths; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.zip.ZipEntry; | |||
| import java.util.zip.ZipOutputStream; | |||
| public class PdfToImageUtil { | |||
| private static final String TEMP_DIR = "/home/xueyi/temp"; | |||
| //支持文件格式 | |||
| public static final String SUPPORT_FILE = "pdf"; | |||
| //图片文件格式 | |||
| public static final String IMAGE_SUFFIX = "jpg"; //png | |||
| //压缩文件格式 | |||
| public static final String ZIP_SUFFIX = "zip"; | |||
| //PDF是否为一页 | |||
| private static boolean isImage; | |||
| private static final Logger log = LoggerFactory.getLogger(PdfToImageUtil.class); | |||
| /** | |||
| * 对外的开放接口,用于将PDF文件转换为图片文件压缩包进行下载 | |||
| * @param file SpringMVC获取的图片文件 | |||
| */ | |||
| public static synchronized void pdfToTransformation(MultipartFile file, HttpServletResponse response) throws Exception { | |||
| String fileName = file.getOriginalFilename(); | |||
| if(null == fileName) return; | |||
| String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); | |||
| log.info("文件名称:" + fileName + ",文件后缀:" + suffix); | |||
| if(!SUPPORT_FILE.equals(suffix)) return; | |||
| isImage = false; | |||
| File imageFile = generateFile(file); | |||
| log.info("文件生成成功!"); | |||
| // downloadFile(imageFile, response); | |||
| } | |||
| /** | |||
| * 对外的开放接口 | |||
| * @param file SpringMVC获取的图片文件 | |||
| */ | |||
| public static synchronized List<File> pdfToTransformationList(MultipartFile file) throws Exception { | |||
| List<File> imageFiles = new ArrayList<>(); | |||
| try (PDDocument document = PDDocument.load(file.getInputStream())) { | |||
| PDFRenderer pdfRenderer = new PDFRenderer(document); | |||
| for (int pageIdx = 0; pageIdx < document.getNumberOfPages(); pageIdx++) { | |||
| PDPage page = document.getPage(pageIdx); | |||
| BufferedImage image = pdfRenderer.renderImageWithDPI(pageIdx, 300); // Set the DPI as needed | |||
| // 保存图像到本地临时目录 | |||
| String imageName = "page_" + (pageIdx + 1) + ".png"; | |||
| File imageFile = saveImageToFile(image, imageName); | |||
| imageFiles.add(imageFile); | |||
| } | |||
| } | |||
| return imageFiles; | |||
| } | |||
| /** | |||
| * 将PDF文件转换为多张图片并放入一个压缩包中 | |||
| * @param pdfFile SpringMVC获取的图片文件 | |||
| * @return 图片文件压缩包 | |||
| * @throws Exception 抛出异常 | |||
| */ | |||
| private static File generateFile(MultipartFile pdfFile) throws Exception { | |||
| String fileName = pdfFile.getOriginalFilename(); | |||
| String directoryName = fileName.substring(0, fileName.lastIndexOf(".")); | |||
| File zipFile = new File(directoryName + "." + ZIP_SUFFIX); | |||
| try (PDDocument document = PDDocument.load(pdfFile.getInputStream()); | |||
| ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFile))) { | |||
| PDFRenderer pdfRenderer = new PDFRenderer(document); | |||
| for (int pageIdx = 0; pageIdx < document.getNumberOfPages(); pageIdx++) { | |||
| PDPage page = document.getPage(pageIdx); | |||
| BufferedImage image = pdfRenderer.renderImageWithDPI(pageIdx, 300); // Set the DPI as needed | |||
| // Convert BufferedImage to byte array | |||
| ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |||
| ImageIO.write(image, "png", baos); | |||
| byte[] imageBytes = baos.toByteArray(); | |||
| // Add image to the ZipOutputStream | |||
| ZipEntry zipEntry = new ZipEntry("page_" + (pageIdx + 1) + ".png"); | |||
| zipOut.putNextEntry(zipEntry); | |||
| zipOut.write(imageBytes); | |||
| zipOut.closeEntry(); | |||
| } | |||
| System.out.println("PDF转换完成并压缩为:" + directoryName + "." + ZIP_SUFFIX); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| return zipFile; | |||
| } | |||
| private static File saveImageToFile(BufferedImage image, String imageName) throws IOException { | |||
| Path tempDir = Paths.get(TEMP_DIR); | |||
| if (!Files.exists(tempDir)) { | |||
| Files.createDirectories(tempDir); | |||
| } | |||
| File imageFile = new File(TEMP_DIR, imageName); | |||
| ImageIO.write(image, "png", imageFile); | |||
| return imageFile; | |||
| } | |||
| /** | |||
| * 获取PDF页数 | |||
| * @throws IOException | |||
| */ | |||
| public static Integer getPdfPageSize(MultipartFile file) throws IOException { | |||
| try (PDDocument document = PDDocument.load(file.getInputStream())) { | |||
| return document.getNumberOfPages(); | |||
| } | |||
| } | |||
| } | |||
| @@ -68,7 +68,7 @@ public class MqttMessageHandle implements IMqttMessageHandler { | |||
| if (method.isAnnotationPresent(MqttTopic.class)){ | |||
| // 如果这个方法有 这个注解 | |||
| MqttTopic handleTopic = method.getAnnotation(MqttTopic.class); | |||
| String topicName = "/" + "prod" + handleTopic.value(); | |||
| String topicName = "/" + activeProfile + handleTopic.value(); | |||
| if(isMatch(receivedTopic,topicName)){ | |||
| // 并且 这个 topic 匹配成功 | |||
| try { | |||
| @@ -18,11 +18,9 @@ import com.xueyi.system.api.digitalmans.domain.dto.DmManDeviceDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSyncDigitalmanDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmManDevicePo; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmReceptionVo; | |||
| import com.xueyi.system.api.digitalmans.feign.RemoteDigitalmanService; | |||
| import com.xueyi.system.api.digitalmans.feign.RemoteManDeviceService; | |||
| import com.xueyi.system.api.digitalmans.feign.RemoteReceptionService; | |||
| import com.xueyi.system.api.digitalmans.feign.RemoteSkillService; | |||
| import com.xueyi.system.api.digitalmans.feign.*; | |||
| import com.xueyi.system.api.model.Source; | |||
| import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; | |||
| import com.xueyi.system.api.staff.domain.vo.DmStaffFeature; | |||
| @@ -69,6 +67,9 @@ public class ApiController { | |||
| @Autowired | |||
| RemoteManDeviceService manDeviceService; | |||
| @Autowired | |||
| RemoteBroadcastService remoteBroadcastService; | |||
| @RequestMapping(value = "/heartbeat", method = {RequestMethod.POST}) | |||
| @ResponseBody | |||
| @@ -167,6 +168,12 @@ public class ApiController { | |||
| R<DmSyncDigitalmanDto> syncDmDto = remoteDigitalmanService.listInner(manDeviceDtoR.getData().getManCode(), vo.getTimestamp(), manDeviceDtoR.getData().getTId(), source.getMaster(), SecurityConstants.INNER); | |||
| if (syncDmDto.isFail()) | |||
| return AjaxResult.warn("新增失败,请检查"); | |||
| // 添加播报信息 | |||
| R<DmBroadcastVo> broadcastVoR = remoteBroadcastService.innerlist(manDeviceDtoR.getData().getManCode(), manDeviceDtoR.getData().getTId(), source.getMaster(), SecurityConstants.INNER); | |||
| if (!broadcastVoR.isFail()) { | |||
| syncDmDto.getData().setBroadcast(broadcastVoR.getData()); | |||
| } | |||
| return AjaxResult.success(syncDmDto.getData()).put("timestamp", timestamp); | |||
| case 3: | |||
| R<DmReceptionVo> receptionVo = remoteReceptionService.getReceptionTaskInner(manDeviceDtoR.getData().getManCode(), manDeviceDtoR.getData().getTId(), source.getMaster(), SecurityConstants.INNER); | |||
| @@ -0,0 +1,33 @@ | |||
| # Tomcat | |||
| server: | |||
| port: 9700 | |||
| # Spring | |||
| spring: | |||
| application: | |||
| # 应用名称 | |||
| name: xueyi-message | |||
| profiles: | |||
| # 环境配置 | |||
| active: | |||
| servlet: | |||
| multipart: | |||
| max-request-size: 20MB | |||
| max-file-size: 100MB | |||
| cloud: | |||
| nacos: | |||
| discovery: | |||
| # 服务注册地址 | |||
| # server-addr: 172.17.0.1:18848 | |||
| server-addr: 127.0.0.1:18848 | |||
| config: | |||
| # 配置中心地址 | |||
| # server-addr: 172.17.0.1:18848 | |||
| server-addr: 127.0.0.1:18848 | |||
| # 配置文件格式 | |||
| file-extension: yml | |||
| # 共享配置 | |||
| shared-configs: | |||
| - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| - application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| - application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| @@ -0,0 +1,17 @@ | |||
| # 基础镜像 | |||
| FROM openjdk:17-oracle | |||
| # author | |||
| MAINTAINER xueyi | |||
| # 挂载目录 | |||
| VOLUME /home/xueyi | |||
| # 创建目录 | |||
| RUN mkdir -p /home/xueyi | |||
| RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |||
| # 指定路径 | |||
| WORKDIR /home/xueyi | |||
| # 复制jar文件到路径 | |||
| COPY ./target/xueyi-modules-auth.jar /home/xueyi/xueyi-modules-auth.jar | |||
| # 启动系统服务 | |||
| ENTRYPOINT ["java","-jar","xueyi-modules-auth.jar"] | |||
| @@ -0,0 +1,105 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xmlns="http://maven.apache.org/POM/4.0.0" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-modules</artifactId> | |||
| <version>2.5.0</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>xueyi-modules-auth</artifactId> | |||
| <description> | |||
| xueyi-modules-auth数字人权限管理模块 | |||
| </description> | |||
| <dependencies> | |||
| <!-- SpringCloud Alibaba Nacos --> | |||
| <dependency> | |||
| <groupId>com.alibaba.cloud</groupId> | |||
| <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | |||
| </dependency> | |||
| <!-- SpringCloud Alibaba Nacos Config --> | |||
| <dependency> | |||
| <groupId>com.alibaba.cloud</groupId> | |||
| <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | |||
| </dependency> | |||
| <!-- SpringCloud Alibaba Sentinel --> | |||
| <dependency> | |||
| <groupId>com.alibaba.cloud</groupId> | |||
| <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> | |||
| </dependency> | |||
| <!-- SpringBoot Actuator --> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-actuator</artifactId> | |||
| </dependency> | |||
| <!-- XueYi Common Log --> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-common-log</artifactId> | |||
| </dependency> | |||
| <!-- XueYi Common Web --> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-common-web</artifactId> | |||
| </dependency> | |||
| <!-- XueYi Common Swagger --> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-common-swagger</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-api-system</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-api-modules-auth</artifactId> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <finalName>${project.artifactId}</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||
| <executions> | |||
| <execution> | |||
| <goals> | |||
| <goal>repackage</goal> | |||
| </goals> | |||
| </execution> | |||
| </executions> | |||
| </plugin> | |||
| <plugin> | |||
| <artifactId>maven-resources-plugin</artifactId> | |||
| <groupId>org.apache.maven.plugins</groupId> | |||
| <configuration> | |||
| <delimiters>@</delimiters> | |||
| <useDefaultDelimiters>false</useDefaultDelimiters> | |||
| </configuration> | |||
| </plugin> | |||
| </plugins> | |||
| <resources> | |||
| <resource> | |||
| <directory>src/main/resources</directory> | |||
| <filtering>true</filtering> | |||
| </resource> | |||
| </resources> | |||
| </build> | |||
| </project> | |||
| @@ -0,0 +1,15 @@ | |||
| sonar.projectKey=digimeta-MultiSaas-modules-auth | |||
| sonar.projectName=digimeta-MultiSaas-modules-auth | |||
| sonar.sourceEncoding=UTF-8 | |||
| sonar.projectVersion=0.8 | |||
| sonar.sources=. | |||
| sonar.exclusions=**/test/**,**/target/** | |||
| sonar.java.binaries=. | |||
| sonar.java.source=1.8 | |||
| sonar.java.target=1.8 | |||
| @@ -0,0 +1,32 @@ | |||
| package com.xueyi.modules.auth; | |||
| import com.xueyi.common.security.annotation.EnableCustomConfig; | |||
| import com.xueyi.common.security.annotation.EnableRyFeignClients; | |||
| import com.xueyi.common.swagger.annotation.EnableCustomSwagger; | |||
| import org.springframework.boot.SpringApplication; | |||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
| /** | |||
| * 业务权限模块 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @EnableCustomConfig | |||
| @EnableCustomSwagger | |||
| @EnableRyFeignClients | |||
| @SpringBootApplication | |||
| public class XueYiModulesAuthApplication { | |||
| public static void main(String[] args) { | |||
| SpringApplication.run(XueYiModulesAuthApplication.class, args); | |||
| System.out.println("(♥◠‿◠)ノ゙ 业务权限管理模块启动成功 ლ(´ڡ`ლ)゙ \n" + | |||
| " _____ __ ____ __ \n" + | |||
| " \\ _\\ / / \\ \\ / / \n" + | |||
| " .-./ ). / ' \\ _. / ' \n" + | |||
| " \\ '_ .') .' _( )_ .' \n" + | |||
| " (_ (_) _) ' ___(_ o _)' \n" + | |||
| " / \\ \\ | |(_,_)' \n" + | |||
| " `-'`-' \\| `-' / \n" + | |||
| " / / \\ \\\\ / \n" + | |||
| " '--' '----'`-..-' "); | |||
| } | |||
| } | |||
| @@ -0,0 +1,45 @@ | |||
| package com.xueyi.modules.auth.controller; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.web.controller.BaseApiController; | |||
| import com.xueyi.modules.auth.api.domain.vo.IntentionReqDto; | |||
| import com.xueyi.modules.auth.api.feign.RemoteSkillAuthService; | |||
| import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import javax.validation.Valid; | |||
| @RestController | |||
| @RequestMapping("/skill/api") | |||
| public class SkillAuthApiController extends BaseApiController { | |||
| @Autowired | |||
| private RemoteSkillAuthService skillAuthService; | |||
| /** | |||
| * @Author yangkai | |||
| * @Description 技能权限验证,判断的意图对应的技能和传递的人员进行权限比对 | |||
| * @Date 2023/7/31 | |||
| * @Param IntentionReqDto对象 | |||
| * @return AjaxResult | |||
| **/ | |||
| @RequestMapping(value = "/skillAuth", method = {RequestMethod.POST}) | |||
| @ResponseBody | |||
| public AjaxResult auth(@Valid @RequestBody IntentionReqDto reqDto, HttpServletResponse response) { | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(reqDto.getDevId()); | |||
| return skillAuthService.skillAuth(reqDto, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| } | |||
| @@ -0,0 +1,10 @@ | |||
| Spring Boot Version: ${spring-boot.version} | |||
| Spring Application Name: ${spring.application.name} | |||
| _______ _________ _________ _______ _ _______ _ _________ | |||
| |\ /||\ /|( ____ \|\ /|\__ __/ \__ __/( ____ \( ( /|( ___ )( ( /|\__ __/ | |||
| ( \ / )| ) ( || ( \/( \ / ) ) ( ) ( | ( \/| \ ( || ( ) || \ ( | ) ( | |||
| \ (_) / | | | || (__ \ (_) / | | _____ | | | (__ | \ | || (___) || \ | | | | | |||
| ) _ ( | | | || __) \ / | |(_____)| | | __) | (\ \) || ___ || (\ \) | | | | |||
| / ( ) \ | | | || ( ) ( | | | | | ( | | \ || ( ) || | \ | | | | |||
| ( / \ )| (___) || (____/\ | | ___) (___ | | | (____/\| ) \ || ) ( || ) \ | | | | |||
| |/ \|(_______)(_______/ \_/ \_______/ )_( (_______/|/ )_)|/ \||/ )_) )_( | |||
| @@ -0,0 +1,33 @@ | |||
| # Tomcat | |||
| server: | |||
| port: 9700 | |||
| # Spring | |||
| spring: | |||
| application: | |||
| # 应用名称 | |||
| name: xueyi-message | |||
| profiles: | |||
| # 环境配置 | |||
| active: | |||
| servlet: | |||
| multipart: | |||
| max-request-size: 20MB | |||
| max-file-size: 100MB | |||
| cloud: | |||
| nacos: | |||
| discovery: | |||
| # 服务注册地址 | |||
| # server-addr: 172.17.0.1:18848 | |||
| server-addr: 127.0.0.1:18848 | |||
| config: | |||
| # 配置中心地址 | |||
| # server-addr: 172.17.0.1:18848 | |||
| server-addr: 127.0.0.1:18848 | |||
| # 配置文件格式 | |||
| file-extension: yml | |||
| # 共享配置 | |||
| shared-configs: | |||
| - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| - application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| - application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| @@ -0,0 +1,35 @@ | |||
| # Tomcat | |||
| server: | |||
| port: 9970 | |||
| # Spring | |||
| spring: | |||
| application: | |||
| # 应用名称 | |||
| name: xueyi-modules-auth | |||
| profiles: | |||
| # 环境配置 | |||
| active: @activatedProperties@ | |||
| servlet: | |||
| multipart: | |||
| max-request-size: 20MB | |||
| max-file-size: 100MB | |||
| cloud: | |||
| nacos: | |||
| discovery: | |||
| # 服务注册地址 | |||
| server-addr: @nacos.host@:@nacos.port@ | |||
| namespace: @nacos.namespace@ | |||
| config: | |||
| # 配置中心地址 | |||
| server-addr: @nacos.host@:@nacos.port@ | |||
| namespace: @nacos.namespace@ | |||
| # 配置文件格式 | |||
| file-extension: yml | |||
| # 共享配置 | |||
| shared-configs: | |||
| - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| - application-secret-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| - application-datasource-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | |||
| @@ -0,0 +1,74 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <configuration scan="true" scanPeriod="60 seconds" debug="false"> | |||
| <!-- 日志存放路径 --> | |||
| <property name="log.path" value="logs/xueyi-message" /> | |||
| <!-- 日志输出格式 --> | |||
| <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> | |||
| <!-- 控制台输出 --> | |||
| <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
| <encoder> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| </appender> | |||
| <!-- 系统日志输出 --> | |||
| <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${log.path}/info.log</file> | |||
| <!-- 循环政策:基于时间创建日志文件 --> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <!-- 日志文件名格式 --> | |||
| <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| <!-- 过滤的级别 --> | |||
| <level>INFO</level> | |||
| <!-- 匹配时的操作:接收(记录) --> | |||
| <onMatch>ACCEPT</onMatch> | |||
| <!-- 不匹配时的操作:拒绝(不记录) --> | |||
| <onMismatch>DENY</onMismatch> | |||
| </filter> | |||
| </appender> | |||
| <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${log.path}/error.log</file> | |||
| <!-- 循环政策:基于时间创建日志文件 --> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <!-- 日志文件名格式 --> | |||
| <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> | |||
| <!-- 日志最大的历史 60天 --> | |||
| <maxHistory>60</maxHistory> | |||
| </rollingPolicy> | |||
| <encoder> | |||
| <pattern>${log.pattern}</pattern> | |||
| </encoder> | |||
| <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
| <!-- 过滤的级别 --> | |||
| <level>ERROR</level> | |||
| <!-- 匹配时的操作:接收(记录) --> | |||
| <onMatch>ACCEPT</onMatch> | |||
| <!-- 不匹配时的操作:拒绝(不记录) --> | |||
| <onMismatch>DENY</onMismatch> | |||
| </filter> | |||
| </appender> | |||
| <!-- 系统模块日志级别控制 --> | |||
| <logger name="com.xueyi" level="info" /> | |||
| <!-- Spring日志级别控制 --> | |||
| <logger name="org.springframework" level="warn" /> | |||
| <root level="info"> | |||
| <appender-ref ref="console" /> | |||
| </root> | |||
| <!--系统操作日志--> | |||
| <root level="info"> | |||
| <appender-ref ref="file_info" /> | |||
| <appender-ref ref="file_error" /> | |||
| </root> | |||
| </configuration> | |||
| @@ -81,6 +81,11 @@ | |||
| <version>2.5.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.xueyi</groupId> | |||
| <artifactId>xueyi-api-modules-auth</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.konghq</groupId> | |||
| @@ -3,12 +3,8 @@ package com.xueyi.system; | |||
| import com.xueyi.common.security.annotation.EnableCustomConfig; | |||
| import com.xueyi.common.security.annotation.EnableRyFeignClients; | |||
| import com.xueyi.common.swagger.annotation.EnableCustomSwagger; | |||
| import com.xueyi.common.web.utils.ResponseCodeUtil; | |||
| import org.springframework.boot.SpringApplication; | |||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
| import org.springframework.context.annotation.Bean; | |||
| import java.util.Map; | |||
| /** | |||
| * 系统模块 | |||
| @@ -34,13 +30,4 @@ public class XueYiSystemApplication { | |||
| " '--' '----'`-..-' "); | |||
| } | |||
| /** | |||
| * @Author yangkai | |||
| * @Description 返回错误信息处理 | |||
| * @return | |||
| **/ | |||
| @Bean | |||
| public Map<Integer, Map<String, String>> responseMessageMap() { | |||
| return ResponseCodeUtil.getResponseCodeAndMsgMap(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,136 @@ | |||
| package com.xueyi.system.digitalmans.controller; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.core.web.validate.V_A; | |||
| import com.xueyi.common.core.web.validate.V_E; | |||
| import com.xueyi.common.log.annotation.Log; | |||
| import com.xueyi.common.log.enums.BusinessType; | |||
| import com.xueyi.common.security.annotation.Logical; | |||
| import com.xueyi.common.security.annotation.RequiresPermissions; | |||
| import com.xueyi.common.web.entity.controller.BaseController; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmActionService; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 动作管理 | |||
| 管理 业务处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/action") | |||
| public class DmActionController extends BaseController<DmActionQuery, DmActionDto, IDmActionService> { | |||
| /** 定义节点名称 */ | |||
| @Override | |||
| protected String getNodeName() { | |||
| return "动作管理 "; | |||
| } | |||
| /** | |||
| * 查询动作管理 | |||
| 列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/list") | |||
| @RequiresPermissions(Auth.DM_ACTION_LIST) | |||
| public AjaxResult list(DmActionQuery action) { | |||
| return super.list(action); | |||
| } | |||
| /** | |||
| * 查询动作管理 | |||
| 详细 | |||
| */ | |||
| @Override | |||
| @GetMapping(value = "/{id}") | |||
| @RequiresPermissions(Auth.DM_ACTION_SINGLE) | |||
| public AjaxResult getInfo(@PathVariable Serializable id) { | |||
| return super.getInfo(id); | |||
| } | |||
| /** | |||
| * 动作管理 | |||
| 新增 | |||
| */ | |||
| @Override | |||
| @PostMapping | |||
| @RequiresPermissions(Auth.DM_ACTION_ADD) | |||
| @Log(title = "动作管理", businessType = BusinessType.INSERT) | |||
| public AjaxResult add(@Validated({V_A.class}) @RequestBody DmActionDto action) { | |||
| return super.add(action); | |||
| } | |||
| /** | |||
| * 动作管理 | |||
| 修改 | |||
| */ | |||
| @Override | |||
| @PutMapping | |||
| @RequiresPermissions(Auth.DM_ACTION_EDIT) | |||
| @Log(title = "动作管理", businessType = BusinessType.UPDATE) | |||
| public AjaxResult edit(@Validated({V_E.class}) @RequestBody DmActionDto action) { | |||
| return super.edit(action); | |||
| } | |||
| /** | |||
| * 动作管理 | |||
| 修改状态 | |||
| */ | |||
| @Override | |||
| @PutMapping("/status") | |||
| @RequiresPermissions(value = {Auth.DM_ACTION_EDIT, Auth.DM_ACTION_ES}, logical = Logical.OR) | |||
| @Log(title = "动作管理", businessType = BusinessType.UPDATE_STATUS) | |||
| public AjaxResult editStatus(@RequestBody DmActionDto action) { | |||
| return super.editStatus(action); | |||
| } | |||
| /** | |||
| * 动作管理 | |||
| 批量删除 | |||
| */ | |||
| @Override | |||
| @DeleteMapping("/batch/{idList}") | |||
| @RequiresPermissions(Auth.DM_ACTION_DEL) | |||
| @Log(title = "动作管理", businessType = BusinessType.DELETE) | |||
| public AjaxResult batchRemove(@PathVariable List<Long> idList) { | |||
| return super.batchRemove(idList); | |||
| } | |||
| /** | |||
| * 获取动作管理 | |||
| 选择框列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/option") | |||
| public AjaxResult option() { | |||
| return super.option(); | |||
| } | |||
| interface Auth { | |||
| /** 系统 - 动作管理 | |||
| 管理 - 列表 */ | |||
| String DM_ACTION_LIST = "digitalmans:action:list"; | |||
| /** 系统 - 动作管理 | |||
| 管理 - 详情 */ | |||
| String DM_ACTION_SINGLE = "digitalmans:action:single"; | |||
| /** 系统 - 动作管理 | |||
| 管理 - 新增 */ | |||
| String DM_ACTION_ADD = "digitalmans:action:add"; | |||
| /** 系统 - 动作管理 | |||
| 管理 - 修改 */ | |||
| String DM_ACTION_EDIT = "digitalmans:action:edit"; | |||
| /** 系统 - 动作管理 | |||
| 管理 - 修改状态 */ | |||
| String DM_ACTION_ES = "digitalmans:action:es"; | |||
| /** 系统 - 动作管理 | |||
| 管理 - 删除 */ | |||
| String DM_ACTION_DEL = "digitalmans:action:delete"; | |||
| } | |||
| } | |||
| @@ -0,0 +1,217 @@ | |||
| package com.xueyi.system.digitalmans.controller; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.common.core.utils.core.IdUtil; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.core.web.validate.V_A; | |||
| import com.xueyi.common.core.web.validate.V_E; | |||
| import com.xueyi.common.log.annotation.Log; | |||
| import com.xueyi.common.log.enums.BusinessType; | |||
| import com.xueyi.common.security.annotation.Logical; | |||
| import com.xueyi.common.security.annotation.RequiresPermissions; | |||
| import com.xueyi.common.web.entity.controller.BaseController; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo; | |||
| import com.xueyi.system.api.organize.domain.po.SysUserPo; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto; | |||
| import com.xueyi.system.digitalmans.domain.merge.DmBroadcastResourceMerge; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import com.xueyi.system.digitalmans.domain.query.DmDigitalmanQuery; | |||
| import com.xueyi.system.digitalmans.manager.impl.DmBroadcastManager; | |||
| import com.xueyi.system.digitalmans.service.IDmBroadcastService; | |||
| import com.xueyi.system.digitalmans.service.IDmDigitalmanService; | |||
| import com.xueyi.system.organize.service.ISysUserService; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import com.xueyi.system.resource.domain.model.DmResourcesConverter; | |||
| import com.xueyi.system.resource.mapper.DmResourcesMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.io.Serializable; | |||
| import java.time.LocalDateTime; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| /** | |||
| * 播报管理 业务处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/broadcast") | |||
| public class DmBroadcastController extends BaseController<DmBroadcastQuery, DmBroadcastDto, IDmBroadcastService> { | |||
| @Autowired | |||
| private DmBroadcastManager broadcastManager; | |||
| /** 定义节点名称 */ | |||
| @Override | |||
| protected String getNodeName() { | |||
| return "播报" ; | |||
| } | |||
| @Autowired | |||
| private DmResourcesMapper resourceMapper; | |||
| @Autowired | |||
| private DmResourcesConverter resourcesConverter; | |||
| @Autowired | |||
| private IDmDigitalmanService digitalmanService; | |||
| @Autowired | |||
| private ISysUserService sysUserService; | |||
| /** | |||
| * 查询播报列表 | |||
| */ | |||
| @GetMapping("/inner/list") | |||
| public R<DmBroadcastVo> innerlist(@RequestParam("manCode")String manCode) { | |||
| DmDigitalmanQuery query = new DmDigitalmanQuery(); | |||
| query.setManCode(manCode); | |||
| List<DmDigitalmanDto> manList = digitalmanService.selectList(query); | |||
| DmBroadcastQuery broadcast = new DmBroadcastQuery(); | |||
| broadcast.setManId(manList.get(0).getId()); | |||
| List<DmBroadcastDto> list = baseService.selectListScope(broadcast); | |||
| if (list.size() > 0) { | |||
| // 定义DmBroadcastVo类型变量vo,将list.get(0)赋值给vo | |||
| DmBroadcastDto dto = list.get(0); | |||
| DmBroadcastVo vo = new DmBroadcastVo(); | |||
| vo.setSpeed(dto.getSpeed()); | |||
| vo.setRecycle(dto.getRecycle()); | |||
| List<JSONObject> rList = new ArrayList<>(); | |||
| List<DmBroadcastResourceMerge> mergeDtos = broadcastManager.selectBroadcastResourceMerge(dto.getId()); | |||
| int order = 0; | |||
| for (DmBroadcastResourceMerge merge : mergeDtos) { | |||
| if (merge.getResourceId() != null && merge.getResourceId() > 0) { | |||
| DmResourcesDto resourcesDto = resourcesConverter.mapperDto(resourceMapper.selectById(merge.getResourceId())); | |||
| JSONObject json = new JSONObject(); | |||
| json.put("order",order++); | |||
| json.put("ttsText",merge.getTtsText()); | |||
| json.put("url", resourcesDto.getUrl()); | |||
| rList.add(json); | |||
| } | |||
| } | |||
| vo.setResource(rList); | |||
| return R.ok(vo); | |||
| } | |||
| return R.fail("无法获取播报信息"); | |||
| } | |||
| /** | |||
| * 查询播报列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/list") | |||
| @RequiresPermissions(Auth.DM_BROADCAST_LIST) | |||
| public AjaxResult list(DmBroadcastQuery broadcast) { | |||
| startPage(); | |||
| List<DmBroadcastDto> list = baseService.selectListScope(broadcast); | |||
| for (DmBroadcastDto dto : list) { | |||
| List<DmBroadcastResourceMerge> mergeDtos = broadcastManager.selectBroadcastResourceMerge(dto.getId()); | |||
| SysUserPo user = sysUserService.selectById(dto.getCreateBy()); | |||
| dto.setUserName(user.getUserName()); | |||
| List<JSONObject> temp = new ArrayList<>(); | |||
| for (DmBroadcastResourceMerge merge : mergeDtos) { | |||
| if (merge.getResourceId() != null && merge.getResourceId() > 0) { | |||
| DmResourcesDto resourcesDto = resourcesConverter.mapperDto(resourceMapper.selectById(merge.getResourceId())); | |||
| JSONObject json = JSONObject.from(merge); | |||
| json.put("url", resourcesDto.getUrl()); | |||
| temp.add(json); | |||
| } | |||
| } | |||
| dto.setObjList(temp); | |||
| } | |||
| return getDataTable(list); | |||
| } | |||
| /** | |||
| * 查询播报详细 | |||
| */ | |||
| @Override | |||
| @GetMapping(value = "/{id}") | |||
| @RequiresPermissions(Auth.DM_BROADCAST_SINGLE) | |||
| public AjaxResult getInfo(@PathVariable Serializable id) { | |||
| return super.getInfo(id); | |||
| } | |||
| /** | |||
| * 播报新增 | |||
| */ | |||
| @Override | |||
| @PostMapping | |||
| @RequiresPermissions(Auth.DM_BROADCAST_ADD) | |||
| @Log(title = "播报管理", businessType = BusinessType.INSERT) | |||
| public AjaxResult add(@Validated({V_A.class}) @RequestBody DmBroadcastDto broadcast) { | |||
| Long id = IdUtil.getSnowflakeNextId(); | |||
| broadcast.setId(id); | |||
| broadcast.setCreateTime(LocalDateTime.now()); | |||
| broadcastManager.addBroadcastResourceMerge(id, broadcast.getResourceList()); | |||
| return super.add(broadcast); | |||
| } | |||
| /** | |||
| * 播报修改 | |||
| */ | |||
| @Override | |||
| @PutMapping | |||
| @RequiresPermissions(Auth.DM_BROADCAST_EDIT) | |||
| @Log(title = "播报管理", businessType = BusinessType.UPDATE) | |||
| public AjaxResult edit(@Validated({V_E.class}) @RequestBody DmBroadcastDto broadcast) { | |||
| broadcastManager.editBroadcastResourceMerge(broadcast.getId(), broadcast.getResourceList()); | |||
| broadcast.setUpdateTime(LocalDateTime.now()); | |||
| return super.edit(broadcast); | |||
| } | |||
| /** | |||
| * 播报修改状态 | |||
| */ | |||
| @Override | |||
| @PutMapping("/status") | |||
| @RequiresPermissions(value = {Auth.DM_BROADCAST_EDIT, Auth.DM_BROADCAST_ES}, logical = Logical.OR) | |||
| @Log(title = "播报管理", businessType = BusinessType.UPDATE_STATUS) | |||
| public AjaxResult editStatus(@RequestBody DmBroadcastDto broadcast) { | |||
| return super.editStatus(broadcast); | |||
| } | |||
| /** | |||
| * 播报批量删除 | |||
| */ | |||
| @Override | |||
| @DeleteMapping("/batch/{idList}") | |||
| @RequiresPermissions(Auth.DM_BROADCAST_DEL) | |||
| @Log(title = "播报管理", businessType = BusinessType.DELETE) | |||
| public AjaxResult batchRemove(@PathVariable List<Long> idList) { | |||
| return super.batchRemove(idList); | |||
| } | |||
| /** | |||
| * 获取播报选择框列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/option") | |||
| public AjaxResult option() { | |||
| return super.option(); | |||
| } | |||
| interface Auth { | |||
| /** 系统 - 播报管理 - 列表 */ | |||
| String DM_BROADCAST_LIST = "digitalmans:broadcast:list"; | |||
| /** 系统 - 播报管理 - 详情 */ | |||
| String DM_BROADCAST_SINGLE = "digitalmans:broadcast:single"; | |||
| /** 系统 - 播报管理 - 新增 */ | |||
| String DM_BROADCAST_ADD = "digitalmans:broadcast:add"; | |||
| /** 系统 - 播报管理 - 修改 */ | |||
| String DM_BROADCAST_EDIT = "digitalmans:broadcast:edit"; | |||
| /** 系统 - 播报管理 - 修改状态 */ | |||
| String DM_BROADCAST_ES = "digitalmans:broadcast:es"; | |||
| /** 系统 - 播报管理 - 删除 */ | |||
| String DM_BROADCAST_DEL = "digitalmans:broadcast:delete"; | |||
| } | |||
| } | |||
| @@ -0,0 +1,145 @@ | |||
| package com.xueyi.system.digitalmans.controller; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.core.web.validate.V_A; | |||
| import com.xueyi.common.core.web.validate.V_E; | |||
| import com.xueyi.common.log.annotation.Log; | |||
| import com.xueyi.common.log.enums.BusinessType; | |||
| import com.xueyi.common.security.annotation.Logical; | |||
| import com.xueyi.common.security.annotation.RequiresPermissions; | |||
| import com.xueyi.common.web.entity.controller.BaseController; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmInitSkillsService; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 技能管理管理 业务处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/skillManagement") | |||
| public class DmInitSkillsController extends BaseController<DmInitSkillsQuery, DmInitSkillsDto, IDmInitSkillsService> { | |||
| /** 定义节点名称 */ | |||
| @Override | |||
| protected String getNodeName() { | |||
| return "技能管理" ; | |||
| } | |||
| /** | |||
| * 查询技能管理列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/list") | |||
| @RequiresPermissions(Auth.DM_INIT_SKILLS_LIST) | |||
| public AjaxResult list(DmInitSkillsQuery initSkills) { | |||
| return super.list(initSkills); | |||
| } | |||
| /** | |||
| * 查询技能管理详细 | |||
| */ | |||
| @Override | |||
| @GetMapping(value = "/{id}") | |||
| @RequiresPermissions(Auth.DM_INIT_SKILLS_SINGLE) | |||
| public AjaxResult getInfo(@PathVariable Serializable id) { | |||
| return super.getInfo(id); | |||
| } | |||
| /** | |||
| * 技能管理导出 | |||
| */ | |||
| @Override | |||
| @PostMapping("/export") | |||
| @RequiresPermissions(Auth.DM_INIT_SKILLS_EXPORT) | |||
| @Log(title = "技能管理管理", businessType = BusinessType.EXPORT) | |||
| public void export(HttpServletResponse response, DmInitSkillsQuery initSkills) { | |||
| super.export(response, initSkills); | |||
| } | |||
| /** | |||
| * 技能管理新增 | |||
| */ | |||
| @Override | |||
| @PostMapping | |||
| @RequiresPermissions(Auth.DM_INIT_SKILLS_ADD) | |||
| @Log(title = "技能管理管理", businessType = BusinessType.INSERT) | |||
| public AjaxResult add(@Validated({V_A.class}) @RequestBody DmInitSkillsDto initSkills) { | |||
| return super.add(initSkills); | |||
| } | |||
| /** | |||
| * 技能管理修改 | |||
| */ | |||
| @Override | |||
| @PutMapping | |||
| @RequiresPermissions(Auth.DM_INIT_SKILLS_EDIT) | |||
| @Log(title = "技能管理管理", businessType = BusinessType.UPDATE) | |||
| public AjaxResult edit(@Validated({V_E.class}) @RequestBody DmInitSkillsDto initSkills) { | |||
| return super.edit(initSkills); | |||
| } | |||
| /** | |||
| * 技能管理同步 | |||
| */ | |||
| @PostMapping("/skills_sync") | |||
| public AjaxResult sync(@RequestBody DmInitSkillsDto initSkills) { | |||
| return super.edit(initSkills); | |||
| } | |||
| /** | |||
| * 技能管理修改状态 | |||
| */ | |||
| @Override | |||
| @PutMapping("/status") | |||
| @RequiresPermissions(value = {Auth.DM_INIT_SKILLS_EDIT, Auth.DM_INIT_SKILLS_ES}, logical = Logical.OR) | |||
| @Log(title = "技能管理管理", businessType = BusinessType.UPDATE_STATUS) | |||
| public AjaxResult editStatus(@RequestBody DmInitSkillsDto initSkills) { | |||
| return super.editStatus(initSkills); | |||
| } | |||
| /** | |||
| * 技能管理批量删除 | |||
| */ | |||
| @Override | |||
| @DeleteMapping("/batch/{idList}") | |||
| @RequiresPermissions(Auth.DM_INIT_SKILLS_DEL) | |||
| @Log(title = "技能管理管理", businessType = BusinessType.DELETE) | |||
| public AjaxResult batchRemove(@PathVariable List<Long> idList) { | |||
| return super.batchRemove(idList); | |||
| } | |||
| /** | |||
| * 获取技能管理选择框列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/option") | |||
| public AjaxResult option() { | |||
| return super.option(); | |||
| } | |||
| interface Auth { | |||
| /** 系统 - 技能管理管理 - 列表 */ | |||
| String DM_INIT_SKILLS_LIST = "digitalmans:skillManagement:list"; | |||
| /** 系统 - 技能管理管理 - 详情 */ | |||
| String DM_INIT_SKILLS_SINGLE = "digitalmans:skillManagement:single"; | |||
| /** 系统 - 技能管理管理 - 新增 */ | |||
| String DM_INIT_SKILLS_ADD = "digitalmans:skillManagement:add"; | |||
| /** 系统 - 技能管理管理 - 修改 */ | |||
| String DM_INIT_SKILLS_EDIT = "digitalmans:skillManagement:edit"; | |||
| /** 系统 - 技能管理管理 - 修改状态 */ | |||
| String DM_INIT_SKILLS_ES = "digitalmans:skillManagement:es"; | |||
| /** 系统 - 技能管理管理 - 删除 */ | |||
| String DM_INIT_SKILLS_DEL = "digitalmans:skillManagement:delete"; | |||
| /** 系统 - 技能管理管理 - 导出 */ | |||
| String DM_INIT_SKILLS_EXPORT = "digitalmans:skillManagement:export"; | |||
| /** 系统 - 技能管理管理 - 缓存 */ | |||
| String DM_INIT_SKILLS_CACHE = "digitalmans:skillManagement:cache"; | |||
| } | |||
| } | |||
| @@ -10,20 +10,32 @@ import com.xueyi.common.log.enums.BusinessType; | |||
| import com.xueyi.common.security.annotation.InnerAuth; | |||
| import com.xueyi.common.security.annotation.RequiresPermissions; | |||
| import com.xueyi.common.web.entity.controller.BaseController; | |||
| import com.xueyi.modules.auth.api.domain.vo.IntentionReqDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmSkillPo; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmCustomMadeDto; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanExtDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmDigitalmanExtQuery; | |||
| import com.xueyi.system.digitalmans.domain.query.DmDigitalmanQuery; | |||
| import com.xueyi.system.digitalmans.domain.query.DmSkillQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmDigitalmanExtService; | |||
| import com.xueyi.system.digitalmans.service.IDmDigitalmanService; | |||
| import com.xueyi.system.digitalmans.service.IDmSkillService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 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.PutMapping; | |||
| 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; | |||
| import javax.validation.Valid; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| @@ -84,6 +96,25 @@ public class DmSkillController extends BaseController<DmSkillQuery, DmSkillDto, | |||
| //return success(dmStaffService.selectStaffListByTimestamp(deviceVo)); | |||
| } | |||
| @InnerAuth | |||
| @PostMapping("/inner/auth") | |||
| public AjaxResult skillAuth(@Valid @RequestBody IntentionReqDto intentionReqDto) { | |||
| System.out.println(intentionReqDto.getDevId()); | |||
| DmSkillPo dto = skillService.selectSkillByCode(intentionReqDto.getSkillCode()); | |||
| if (dto == null) { | |||
| return AjaxResult.error("技能不存在"); | |||
| } | |||
| String auth = dto.getAuth(); | |||
| if (StringUtils.isNotEmpty(auth) && (auth.equals(intentionReqDto.getStaffType()) || auth.startsWith(intentionReqDto.getStaffType()+",") || auth.indexOf(","+intentionReqDto.getStaffType()+",")!=-1 || auth.endsWith(","+intentionReqDto.getStaffType()))){ | |||
| return AjaxResult.success(dto); | |||
| } else { | |||
| return AjaxResult.error("权限不足"); | |||
| } | |||
| } | |||
| /** | |||
| * 查询访客列表 | |||
| */ | |||
| @@ -0,0 +1,31 @@ | |||
| package com.xueyi.system.digitalmans.domain.dto; | |||
| import com.xueyi.common.core.annotation.Correlation; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.system.digitalmans.domain.po.DmActionPo; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Action_Resource_GROUP; | |||
| /** | |||
| * 动作管理 | |||
| 数据传输对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmActionDto extends DmActionPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 模块信息 */ | |||
| @Correlation(groupName = Action_Resource_GROUP, keyType = OperateConstants.SubKeyType.RECEIVE) | |||
| private DmResourcesDto resource; | |||
| } | |||
| @@ -0,0 +1,30 @@ | |||
| package com.xueyi.system.digitalmans.domain.dto; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.system.digitalmans.domain.merge.DmBroadcastResourceMerge; | |||
| import com.xueyi.system.digitalmans.domain.po.DmBroadcastPo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import java.util.List; | |||
| /** | |||
| * 播报 数据传输对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmBroadcastDto extends DmBroadcastPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| private List<DmBroadcastResourceMerge> resourceList; | |||
| private List<JSONObject> objList; | |||
| private String userName; | |||
| } | |||
| @@ -0,0 +1,30 @@ | |||
| package com.xueyi.system.digitalmans.domain.dto; | |||
| import com.xueyi.common.core.annotation.Correlation; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.system.digitalmans.domain.po.DmInitSkillsPo; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Skill_Action_GROUP; | |||
| /** | |||
| * 技能管理 数据传输对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmInitSkillsDto extends DmInitSkillsPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 模块信息 */ | |||
| @Correlation(groupName = Skill_Action_GROUP, keyType = OperateConstants.SubKeyType.RECEIVE) | |||
| private DmActionDto actionDto; | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.xueyi.system.digitalmans.domain.merge; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.xueyi.common.core.annotation.Correlation; | |||
| import com.xueyi.common.core.annotation.Correlations; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.common.core.web.tenant.base.TBasisEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.NoArgsConstructor; | |||
| import java.io.Serial; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Broadcast_DmBroadcastResource_GROUP; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Resource_DmBroadcastResource_GROUP; | |||
| /** | |||
| * 播报资源关联 持久化对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @NoArgsConstructor | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @TableName("dm_broadcast_resource_merge") | |||
| public class DmBroadcastResourceMerge extends TBasisEntity { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 播报任务id */ | |||
| @Correlations({ | |||
| @Correlation(groupName = Broadcast_DmBroadcastResource_GROUP, keyType = OperateConstants.SubKeyType.MERGE_MAIN), | |||
| @Correlation(groupName = Resource_DmBroadcastResource_GROUP, keyType = OperateConstants.SubKeyType.MERGE_SLAVE) | |||
| }) | |||
| protected Long broadcastId; | |||
| ; | |||
| /** 资源id */ | |||
| @Correlations({ | |||
| @Correlation(groupName = Broadcast_DmBroadcastResource_GROUP, keyType = OperateConstants.SubKeyType.MERGE_MAIN), | |||
| @Correlation(groupName = Resource_DmBroadcastResource_GROUP, keyType = OperateConstants.SubKeyType.MERGE_SLAVE) | |||
| }) | |||
| protected Long resourceId; | |||
| protected String ttsText; | |||
| public DmBroadcastResourceMerge(Long broadcastId, Long resourceId) { | |||
| this.broadcastId = broadcastId; | |||
| this.resourceId = resourceId; | |||
| } | |||
| } | |||
| @@ -9,5 +9,7 @@ public interface MergeGroup { | |||
| String Reception_Staff_GROUP = "Reception_Staff_GROUP"; | |||
| String Reception_DmReceptionVisitorMerge_GROUP = "Reception_DmReceptionVisitorMerge_GROUP"; | |||
| String Visitor_DmReceptionVisitorMerge_GROUP = "Visitor_DmReceptionVisitorMerge_GROUP"; | |||
| String Broadcast_DmBroadcastResource_GROUP = "Broadcast_DmBroadcastResource_GROUP"; | |||
| String Resource_DmBroadcastResource_GROUP = "Resource_DmBroadcastResource_GROUP"; | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.xueyi.system.digitalmans.domain.model; | |||
| import com.xueyi.common.core.web.entity.model.BaseConverter; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.system.digitalmans.domain.po.DmActionPo; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import org.mapstruct.Mapper; | |||
| import org.mapstruct.MappingConstants; | |||
| /** | |||
| * 动作管理 | |||
| 对象映射器 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Mapper(componentModel = MappingConstants.ComponentModel.SPRING) | |||
| public interface DmActionConverter extends BaseConverter<DmActionQuery, DmActionDto, DmActionPo> { | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.xueyi.system.digitalmans.domain.model; | |||
| import com.xueyi.common.core.web.entity.model.BaseConverter; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.system.digitalmans.domain.po.DmBroadcastPo; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import org.mapstruct.Mapper; | |||
| import org.mapstruct.MappingConstants; | |||
| /** | |||
| * 播报 对象映射器 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Mapper(componentModel = MappingConstants.ComponentModel.SPRING) | |||
| public interface DmBroadcastConverter extends BaseConverter<DmBroadcastQuery, DmBroadcastDto, DmBroadcastPo> { | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.xueyi.system.digitalmans.domain.model; | |||
| import com.xueyi.common.core.web.entity.model.BaseConverter; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.system.digitalmans.domain.po.DmInitSkillsPo; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import org.mapstruct.Mapper; | |||
| import org.mapstruct.MappingConstants; | |||
| /** | |||
| * 技能管理 对象映射器 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Mapper(componentModel = MappingConstants.ComponentModel.SPRING) | |||
| public interface DmInitSkillsConverter extends BaseConverter<DmInitSkillsQuery, DmInitSkillsDto, DmInitSkillsPo> { | |||
| } | |||
| @@ -0,0 +1,49 @@ | |||
| package com.xueyi.system.digitalmans.domain.po; | |||
| import com.xueyi.common.core.annotation.Correlation; | |||
| import com.xueyi.common.core.annotation.Correlations; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.common.core.web.entity.base.BaseEntity; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.Serial; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Action_Resource_GROUP; | |||
| /** | |||
| * 动作管理 | |||
| 持久化对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @TableName("dm_action") | |||
| public class DmActionPo extends BaseEntity { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 备注 */ | |||
| @Excel(name = "备注") | |||
| protected String remark; | |||
| /** 供应商 */ | |||
| @Excel(name = "供应商") | |||
| protected String supplier; | |||
| /** 图片id */ | |||
| @NotNull(message = "resourceId不能为空") | |||
| @Correlations({ | |||
| @Correlation(groupName = Action_Resource_GROUP, keyType = OperateConstants.SubKeyType.MAIN) | |||
| }) | |||
| @Excel(name = "图片id") | |||
| protected Long resourceId; | |||
| } | |||
| @@ -0,0 +1,45 @@ | |||
| package com.xueyi.system.digitalmans.domain.po; | |||
| import com.xueyi.common.core.web.tenant.base.TBaseEntity; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.SORT; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.REMARK; | |||
| /** | |||
| * 播报 持久化对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @TableName(value = "dm_broadcast", excludeProperty = { SORT, REMARK }) | |||
| public class DmBroadcastPo extends TBaseEntity { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 使用状态 */ | |||
| @Excel(name = "使用状态") | |||
| protected String status; | |||
| /** 资源类型 */ | |||
| @Excel(name = "资源类型") | |||
| protected Integer type; | |||
| /** 循环播报(0:不循环;1:循环) */ | |||
| @Excel(name = "循环播报", readConverterExp = "0=:不循环;1:循环") | |||
| protected Integer recycle; | |||
| /** 语速(0:不播报;1:缓慢;2:默认;3:快速) */ | |||
| @Excel(name = "语速", readConverterExp = "0=:不播报;1:缓慢;2:默认;3:快速") | |||
| protected Integer speed; | |||
| protected Long manId; | |||
| } | |||
| @@ -0,0 +1,60 @@ | |||
| package com.xueyi.system.digitalmans.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.xueyi.common.core.annotation.Correlation; | |||
| import com.xueyi.common.core.annotation.Correlations; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.common.core.web.entity.base.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.REMARK; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Skill_Action_GROUP; | |||
| /** | |||
| * 技能管理 持久化对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @TableName(value = "dm_init_skills", excludeProperty = { REMARK }) | |||
| public class DmInitSkillsPo extends BaseEntity { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 技能code */ | |||
| @Excel(name = "技能code") | |||
| protected String skillCode; | |||
| /** 技能描述 */ | |||
| @Excel(name = "技能描述") | |||
| protected String info; | |||
| /** 数字人回复 */ | |||
| @Excel(name = "数字人回复") | |||
| protected String resp; | |||
| @Correlations({ | |||
| @Correlation(groupName = Skill_Action_GROUP, keyType = OperateConstants.SubKeyType.MAIN) | |||
| }) | |||
| /** 数字人动作 */ | |||
| @Excel(name = "数字人动作") | |||
| protected Long motionId; | |||
| /** 动作名称 */ | |||
| @Excel(name = "动作名称") | |||
| protected String motionName; | |||
| /** 执行动作 */ | |||
| @Excel(name = "执行动作") | |||
| protected String executeAction; | |||
| protected String auth; | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.xueyi.system.digitalmans.domain.query; | |||
| import com.xueyi.system.digitalmans.domain.po.DmActionPo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| /** | |||
| * 动作管理 | |||
| 数据查询对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmActionQuery extends DmActionPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.xueyi.system.digitalmans.domain.query; | |||
| import com.xueyi.system.digitalmans.domain.po.DmBroadcastPo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| /** | |||
| * 播报 数据查询对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmBroadcastQuery extends DmBroadcastPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.xueyi.system.digitalmans.domain.query; | |||
| import com.xueyi.system.digitalmans.domain.po.DmInitSkillsPo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| /** | |||
| * 技能管理 数据查询对象 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmInitSkillsQuery extends DmInitSkillsPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.xueyi.system.digitalmans.manager; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import com.xueyi.common.web.entity.manager.IBaseManager; | |||
| /** | |||
| * 动作管理 | |||
| 管理 数据封装层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| public interface IDmActionManager extends IBaseManager<DmActionQuery, DmActionDto> { | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.xueyi.system.digitalmans.manager; | |||
| import com.xueyi.common.web.entity.manager.IBaseManager; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.system.digitalmans.domain.merge.DmBroadcastResourceMerge; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import java.util.List; | |||
| /** | |||
| * 播报管理 数据封装层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| public interface IDmBroadcastManager extends IBaseManager<DmBroadcastQuery, DmBroadcastDto> { | |||
| void addBroadcastResourceMerge(Long broadcastId, List<DmBroadcastResourceMerge> merges); | |||
| void editBroadcastResourceMerge(Long broadcastId, List<DmBroadcastResourceMerge> merges); | |||
| List<DmBroadcastResourceMerge> selectBroadcastResourceMerge(Long broadcastId); | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.xueyi.system.digitalmans.manager; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import com.xueyi.common.web.entity.manager.IBaseManager; | |||
| /** | |||
| * 技能管理管理 数据封装层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| public interface IDmInitSkillsManager extends IBaseManager<DmInitSkillsQuery, DmInitSkillsDto> { | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.xueyi.system.digitalmans.manager.impl; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.common.web.entity.domain.SlaveRelation; | |||
| import com.xueyi.system.digitalmans.domain.po.DmActionPo; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import com.xueyi.system.digitalmans.domain.model.DmActionConverter; | |||
| import com.xueyi.system.digitalmans.mapper.DmActionMapper; | |||
| import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl; | |||
| import com.xueyi.system.digitalmans.manager.IDmActionManager; | |||
| import com.xueyi.system.resource.manager.impl.DmResourcesManager; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Action_Resource_GROUP; | |||
| /** | |||
| * 动作管理 | |||
| 管理 数据封装层处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Component | |||
| public class DmActionManager extends BaseManagerImpl<DmActionQuery, DmActionDto, DmActionPo, DmActionMapper, DmActionConverter> implements IDmActionManager { | |||
| @Override | |||
| protected List<SlaveRelation> subRelationInit() { | |||
| List result = new ArrayList<SlaveRelation>(); | |||
| result.add(new SlaveRelation(Action_Resource_GROUP, DmResourcesManager.class, OperateConstants.SubOperateLimit.ONLY_SEL)); | |||
| return result; | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| package com.xueyi.system.digitalmans.manager.impl; | |||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.system.digitalmans.domain.merge.DmBroadcastResourceMerge; | |||
| import com.xueyi.system.digitalmans.domain.model.DmBroadcastConverter; | |||
| import com.xueyi.system.digitalmans.domain.po.DmBroadcastPo; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import com.xueyi.system.digitalmans.manager.IDmBroadcastManager; | |||
| import com.xueyi.system.digitalmans.mapper.DmBroadcastMapper; | |||
| import com.xueyi.system.digitalmans.mapper.merge.DmBroadcastResourceMergeMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.stream.Collectors; | |||
| /** | |||
| * 播报管理 数据封装层处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Component | |||
| public class DmBroadcastManager extends BaseManagerImpl<DmBroadcastQuery, DmBroadcastDto, DmBroadcastPo, DmBroadcastMapper, DmBroadcastConverter> implements IDmBroadcastManager { | |||
| @Autowired | |||
| private DmBroadcastResourceMergeMapper broadcastResourceMergeMapper; | |||
| @Override | |||
| public void addBroadcastResourceMerge(Long broadcastId, List<DmBroadcastResourceMerge> merges) { | |||
| List<DmBroadcastResourceMerge> broadcastResourceMerges = new ArrayList<DmBroadcastResourceMerge>(); | |||
| if (merges != null && merges.size() > 0) { | |||
| for (DmBroadcastResourceMerge merge : merges) { | |||
| merge.setBroadcastId(broadcastId); | |||
| broadcastResourceMerges.add(merge); | |||
| } | |||
| } | |||
| if (broadcastResourceMerges.size() > 0) { | |||
| broadcastResourceMergeMapper.insertBatch(broadcastResourceMerges); | |||
| } | |||
| } | |||
| @Override | |||
| public void editBroadcastResourceMerge(Long broadcastId, List<DmBroadcastResourceMerge> merges) { | |||
| List<DmBroadcastResourceMerge> broadcastResourceMerges = new ArrayList<DmBroadcastResourceMerge>(); | |||
| List<DmBroadcastResourceMerge> mergeDtos = selectBroadcastResourceMerge(broadcastId); | |||
| if (merges != null && merges.size() > 0) { | |||
| for (DmBroadcastResourceMerge merge : merges) { | |||
| merge.setBroadcastId(broadcastId); | |||
| broadcastResourceMerges.add(merge); | |||
| } | |||
| } | |||
| List<Long> idList = mergeDtos.stream() | |||
| .map(DmBroadcastResourceMerge::getId) | |||
| .collect(Collectors.toList()); | |||
| List<Long> newList = broadcastResourceMerges.stream() | |||
| .map(DmBroadcastResourceMerge::getId) | |||
| .collect(Collectors.toList()); | |||
| idList.removeAll(newList); | |||
| if (idList.size() > 0) { | |||
| broadcastResourceMergeMapper.deleteBatchIds(idList); | |||
| } | |||
| if (broadcastResourceMerges.size() > 0) { | |||
| broadcastResourceMergeMapper.updateBatch(broadcastResourceMerges); | |||
| } | |||
| } | |||
| @Override | |||
| public List<DmBroadcastResourceMerge> selectBroadcastResourceMerge(Long broadcastId) { | |||
| List<DmBroadcastResourceMerge> merges = broadcastResourceMergeMapper.selectList(Wrappers.<DmBroadcastResourceMerge>query().lambda() | |||
| .eq(DmBroadcastResourceMerge::getBroadcastId, broadcastId) | |||
| .orderByAsc(DmBroadcastResourceMerge::getId)); | |||
| return merges; | |||
| } | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.xueyi.system.digitalmans.manager.impl; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.common.web.entity.domain.SlaveRelation; | |||
| import com.xueyi.system.digitalmans.domain.po.DmInitSkillsPo; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import com.xueyi.system.digitalmans.domain.model.DmInitSkillsConverter; | |||
| import com.xueyi.system.digitalmans.mapper.DmInitSkillsMapper; | |||
| import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl; | |||
| import com.xueyi.system.digitalmans.manager.IDmInitSkillsManager; | |||
| import com.xueyi.system.resource.manager.impl.DmResourcesManager; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Action_Resource_GROUP; | |||
| import static com.xueyi.system.digitalmans.domain.merge.MergeGroup.Skill_Action_GROUP; | |||
| /** | |||
| * 技能管理管理 数据封装层处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Component | |||
| public class DmInitSkillsManager extends BaseManagerImpl<DmInitSkillsQuery, DmInitSkillsDto, DmInitSkillsPo, DmInitSkillsMapper, DmInitSkillsConverter> implements IDmInitSkillsManager { | |||
| @Override | |||
| protected List<SlaveRelation> subRelationInit() { | |||
| List result = new ArrayList<SlaveRelation>(); | |||
| result.add(new SlaveRelation(Skill_Action_GROUP, DmActionManager.class, OperateConstants.SubOperateLimit.ONLY_SEL)); | |||
| return result; | |||
| } | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.xueyi.system.digitalmans.mapper; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.system.digitalmans.domain.po.DmActionPo; | |||
| import com.xueyi.common.web.entity.mapper.BaseMapper; | |||
| import com.xueyi.common.datasource.annotation.Master; | |||
| /** | |||
| * 动作管理 | |||
| 管理 数据层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Master | |||
| public interface DmActionMapper extends BaseMapper<DmActionQuery, DmActionDto, DmActionPo> { | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.xueyi.system.digitalmans.mapper; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.system.digitalmans.domain.po.DmBroadcastPo; | |||
| import com.xueyi.common.web.entity.mapper.BaseMapper; | |||
| import com.xueyi.common.datasource.annotation.Isolate; | |||
| /** | |||
| * 播报管理 数据层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Isolate | |||
| public interface DmBroadcastMapper extends BaseMapper<DmBroadcastQuery, DmBroadcastDto, DmBroadcastPo> { | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.xueyi.system.digitalmans.mapper; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.system.digitalmans.domain.po.DmInitSkillsPo; | |||
| import com.xueyi.common.web.entity.mapper.BaseMapper; | |||
| import com.xueyi.common.datasource.annotation.Master; | |||
| /** | |||
| * 技能管理管理 数据层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Master | |||
| public interface DmInitSkillsMapper extends BaseMapper<DmInitSkillsQuery, DmInitSkillsDto, DmInitSkillsPo> { | |||
| } | |||
| @@ -1,15 +1,12 @@ | |||
| package com.xueyi.system.digitalmans.mapper; | |||
| import com.xueyi.common.web.entity.mapper.BaseMapper; | |||
| import com.xueyi.common.datasource.annotation.Isolate; | |||
| import com.xueyi.message.api.transfer.domain.vo.DmActiveVo; | |||
| import com.xueyi.common.web.entity.mapper.BaseMapper; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmSkillPo; | |||
| import com.xueyi.system.digitalmans.domain.query.DmSkillQuery; | |||
| import com.xueyi.system.digitalmans.domain.vo.DmSyncDigitalmanVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| @@ -23,4 +20,6 @@ public interface DmSkillMapper extends BaseMapper<DmSkillQuery, DmSkillDto, DmSk | |||
| //public List<DmSkillDto> selectSkillListByH5(@Param("manId")Long manId, @Param("timestamp") String timestamp); | |||
| public List<DmSkillDto> selectSkillListByH5(DmSyncDigitalmanVo vo); | |||
| public DmSkillPo selectSkillByCode(String skillCode); | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.xueyi.system.digitalmans.mapper.merge; | |||
| import com.xueyi.common.datasource.annotation.Isolate; | |||
| import com.xueyi.common.web.entity.mapper.BasicMapper; | |||
| import com.xueyi.system.digitalmans.domain.merge.DmBroadcastResourceMerge; | |||
| /** | |||
| * 播报文件关联 数据层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Isolate | |||
| public interface DmBroadcastResourceMergeMapper extends BasicMapper<DmBroadcastResourceMerge> { | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.xueyi.system.digitalmans.service; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| /** | |||
| * 动作管理 | |||
| 管理 服务层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| public interface IDmActionService extends IBaseService<DmActionQuery, DmActionDto> { | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.xueyi.system.digitalmans.service; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| /** | |||
| * 播报管理 服务层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| public interface IDmBroadcastService extends IBaseService<DmBroadcastQuery, DmBroadcastDto> { | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.xueyi.system.digitalmans.service; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| /** | |||
| * 技能管理管理 服务层 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| public interface IDmInitSkillsService extends IBaseService<DmInitSkillsQuery, DmInitSkillsDto> { | |||
| } | |||
| @@ -1,10 +1,11 @@ | |||
| package com.xueyi.system.digitalmans.service; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmSkillPo; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmCustomMadeDto; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmSkillQuery; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| import java.util.List; | |||
| @@ -16,6 +17,8 @@ import java.util.List; | |||
| public interface IDmSkillService extends IBaseService<DmSkillQuery, DmSkillDto> { | |||
| List<DmSkillDto> selectSkillListByTimestamp(Long manId,String timestamp); | |||
| DmSkillPo selectSkillByCode(String skillCode); | |||
| int customInsert(DmCustomMadeDto dto); | |||
| int batchInitInsert(DmDigitalmanDto digitalmanDto); | |||
| @@ -0,0 +1,36 @@ | |||
| package com.xueyi.system.digitalmans.service.impl; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmActionDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmActionQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmActionService; | |||
| import com.xueyi.system.digitalmans.manager.IDmActionManager; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| /** | |||
| * 动作管理 | |||
| 管理 服务层处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Service | |||
| public class DmActionServiceImpl extends BaseServiceImpl<DmActionQuery, DmActionDto, IDmActionManager> implements IDmActionService { | |||
| /** | |||
| * 查询动作管理 | |||
| 对象列表 | 数据权限 | |||
| * | |||
| * @param action 动作管理 | |||
| 对象 | |||
| * @return 动作管理 | |||
| 对象集合 | |||
| */ | |||
| @Override | |||
| //@DataScope(userAlias = "createBy", mapperScope = {"DmActionMapper"}) | |||
| public List<DmActionDto> selectListScope(DmActionQuery action) { | |||
| return baseManager.selectList(action); | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.xueyi.system.digitalmans.service.impl; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmBroadcastDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmBroadcastQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmBroadcastService; | |||
| import com.xueyi.system.digitalmans.manager.IDmBroadcastManager; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| /** | |||
| * 播报管理 服务层处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Service | |||
| public class DmBroadcastServiceImpl extends BaseServiceImpl<DmBroadcastQuery, DmBroadcastDto, IDmBroadcastManager> implements IDmBroadcastService { | |||
| /** | |||
| * 查询播报对象列表 | 数据权限 | |||
| * | |||
| * @param broadcast 播报对象 | |||
| * @return 播报对象集合 | |||
| */ | |||
| @Override | |||
| //@DataScope(userAlias = "createBy", mapperScope = {"DmBroadcastMapper"}) | |||
| public List<DmBroadcastDto> selectListScope(DmBroadcastQuery broadcast) { | |||
| return baseManager.selectList(broadcast); | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.xueyi.system.digitalmans.service.impl; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmInitSkillsDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillsQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmInitSkillsService; | |||
| import com.xueyi.system.digitalmans.manager.IDmInitSkillsManager; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| /** | |||
| * 技能管理管理 服务层处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Service | |||
| public class DmInitSkillsServiceImpl extends BaseServiceImpl<DmInitSkillsQuery, DmInitSkillsDto, IDmInitSkillsManager> implements IDmInitSkillsService { | |||
| /** | |||
| * 查询技能管理对象列表 | 数据权限 | |||
| * | |||
| * @param initSkills 技能管理对象 | |||
| * @return 技能管理对象集合 | |||
| */ | |||
| @Override | |||
| //@DataScope(userAlias = "createBy", mapperScope = {"DmInitSkillsMapper"}) | |||
| public List<DmInitSkillsDto> selectListScope(DmInitSkillsQuery initSkills) { | |||
| return baseManager.selectList(initSkills); | |||
| } | |||
| } | |||
| @@ -1,8 +1,9 @@ | |||
| package com.xueyi.system.digitalmans.service.impl; | |||
| import com.xueyi.common.core.constant.basic.EntityConstants; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmInitSkillDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmSkillPo; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmCustomMadeDto; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmInitSkillQuery; | |||
| @@ -11,10 +12,8 @@ import com.xueyi.system.digitalmans.domain.vo.DmSyncDigitalmanVo; | |||
| import com.xueyi.system.digitalmans.manager.IDmSkillManager; | |||
| import com.xueyi.system.digitalmans.manager.impl.DmInitSkillManager; | |||
| import com.xueyi.system.digitalmans.manager.impl.DmSkillManager; | |||
| import com.xueyi.system.digitalmans.mapper.DmCustomMadeMapper; | |||
| import com.xueyi.system.digitalmans.mapper.DmSkillMapper; | |||
| import com.xueyi.system.digitalmans.service.IDmSkillService; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -39,9 +38,9 @@ public class DmSkillServiceImpl extends BaseServiceImpl<DmSkillQuery, DmSkillDto | |||
| DmSkillManager skillManager; | |||
| /** | |||
| * 查询访客对象列表 | 数据权限 | |||
| * 查询技能对象列表 | 数据权限 | |||
| * | |||
| * @param dmVisitors 访客对象 | |||
| * @param dmSkill 技能对象 | |||
| * @return 访客对象集合 | |||
| */ | |||
| @Override | |||
| @@ -59,6 +58,11 @@ public class DmSkillServiceImpl extends BaseServiceImpl<DmSkillQuery, DmSkillDto | |||
| return list; | |||
| } | |||
| @Override | |||
| public DmSkillPo selectSkillByCode(String skillCode) { | |||
| return skillMapper.selectSkillByCode(skillCode); | |||
| } | |||
| @Override | |||
| public int customInsert(DmCustomMadeDto dto) { | |||
| @@ -92,7 +92,7 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController { | |||
| e.printStackTrace(); | |||
| return output(ResponseCode.ILLEGAL_PARAMETER, "timestamp").toJSON(); | |||
| } | |||
| if (type.equals(DmRecognizedRecordsDto.TYPE_STRANGER)) { | |||
| if (!type.equals(DmRecognizedRecordsDto.TYPE_STRANGER)) { | |||
| DmStaffPo emp = dmStaffMapper.selectById(userId); | |||
| if (ObjectUtils.anyNotNull(emp)) { | |||
| cr.setUserName(emp.getUserName()); | |||
| @@ -167,7 +167,6 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe | |||
| } | |||
| dto.setFileSize(fileResult.getData().getSize()); | |||
| iDmResourcesService.addOne(dto); | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put(PARAM_RESOURCE_ID, dto.getId()); | |||
| @@ -180,6 +179,45 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe | |||
| return error("上传图片异常,请联系管理员!"); | |||
| } | |||
| /** | |||
| * 头像上传 | |||
| */ | |||
| @PostMapping("/uploadpdf") | |||
| @Log(title = "资源管理 - 上传资源", businessType = BusinessType.UPDATE) | |||
| public AjaxResult uploadPdf(@RequestParam("file") MultipartFile file) { | |||
| if (!file.isEmpty()) { | |||
| String extension = FileTypeUtil.getExtension(file); | |||
| if (!CharSequenceUtil.equalsAnyIgnoreCase(extension, MimeTypeUtil.DEFAULT_ALLOWED_EXTENSION) | |||
| ) { | |||
| return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + Arrays.toString(MimeTypeUtil.IMAGE_EXTENSION) + "格式"); | |||
| } | |||
| R<List<SysFile>> fileResult = remoteFileService.uploadPdf(file); | |||
| if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData())) | |||
| return error("文件服务异常,请联系管理员!"); | |||
| JSONArray ja = new JSONArray(); | |||
| for (SysFile sf : fileResult.getData()) { | |||
| String url = sf.getUrl(); | |||
| // 预留人脸识别与图像质量监测接口,如果监测异常返回错误 | |||
| DmResourcesDto dto = new DmResourcesDto(); | |||
| dto.setName(file.getOriginalFilename()); | |||
| dto.setUrl(url); | |||
| dto.setType(DmResourcesPo.TYPE_PIC); | |||
| dto.setFileSize(sf.getSize()); | |||
| iDmResourcesService.addOne(dto); | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put(PARAM_RESOURCE_ID, dto.getId()); | |||
| jo.put(PARAM_URL, url); | |||
| ja.add(jo); | |||
| } | |||
| AjaxResult ajax = success(); | |||
| ajax.put(AjaxResult.RESULT_TAG, ja); | |||
| return ajax; | |||
| } | |||
| return error("上传图片异常,请联系管理员!"); | |||
| } | |||
| /** | |||
| * 头像上传 | |||
| */ | |||
| @@ -4,11 +4,8 @@ import com.alibaba.fastjson2.JSONObject; | |||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.fasterxml.jackson.core.type.TypeReference; | |||
| import com.fasterxml.jackson.databind.ObjectMapper; | |||
| import com.google.common.collect.Lists; | |||
| import com.xueyi.common.web.constant.ResponseCode; | |||
| import com.xueyi.common.web.response.MyResponse; | |||
| import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo; | |||
| import com.xueyi.system.api.device.feign.RemoteDeviceTenantMergeService; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto; | |||
| import com.xueyi.system.digitalmans.mapper.DmDigitalmanMapper; | |||
| import com.xueyi.system.digitalmans.service.impl.DmDigitalmanServiceImpl; | |||
| @@ -17,82 +14,10 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.io.BufferedReader; | |||
| import java.io.IOException; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.TreeMap; | |||
| public class BaseApiController { | |||
| @Autowired | |||
| protected Map<Integer, Map<String,String>> responseMessageMap; | |||
| protected final static String EMPTY_STRING = ""; | |||
| protected final static String LANGUAGE_CHINESE = "zh"; | |||
| private MyResponse message = null; | |||
| public DeviceTenantSourceMergeVo getDeviceTenantSourceMergeVo(String devId){ | |||
| return remoteDeviceTenantMergeService.selectDeviceTenantSourceMerge(devId); | |||
| } | |||
| @Autowired | |||
| private RemoteDeviceTenantMergeService remoteDeviceTenantMergeService; | |||
| protected MyResponse outputSuccess(){ | |||
| return outputSuccess(null); | |||
| } | |||
| /** | |||
| * 业务处理成功 | |||
| * @param data | |||
| * @return | |||
| */ | |||
| protected MyResponse outputSuccess(Object data){ | |||
| return output(ResponseCode.SUCCESS, EMPTY_STRING, data); | |||
| } | |||
| protected MyResponse output(final Integer code) { | |||
| return output(code, EMPTY_STRING); | |||
| } | |||
| protected MyResponse output(final Integer code, final String replaceParameter) { | |||
| return output(code, replaceParameter, null); | |||
| } | |||
| protected MyResponse output(final Integer code, final String replaceParameter, final Object data) { | |||
| if (null == replaceParameter) { | |||
| return output(code, Lists.newArrayList(EMPTY_STRING), data, null); | |||
| } | |||
| return output(code, Lists.newArrayList(replaceParameter), data, null); | |||
| } | |||
| protected MyResponse output(final Integer code, final List<String> replaceParameters, final Object data, final String errorMessage){ | |||
| if (ResponseCode.SUCCESS.equals(code)) { | |||
| if (null == data) { | |||
| message = new MyResponse(code); | |||
| } else { | |||
| message = new MyResponse(code, EMPTY_STRING, data); | |||
| } | |||
| } else { | |||
| String reponseText = StringUtils.isEmpty(errorMessage)? responseMessageMap.get(code).get(LANGUAGE_CHINESE) : errorMessage; | |||
| if (null != replaceParameters && replaceParameters.size() > 0) { | |||
| for (int i = 0; i < replaceParameters.size(); i++) { | |||
| reponseText = reponseText.replace("#p" + i + "#", replaceParameters.get(i)); | |||
| } | |||
| }else{ | |||
| reponseText = reponseText.replace("#p0#", ""); | |||
| } | |||
| if (null == data){ | |||
| message = new MyResponse(code, reponseText); | |||
| }else{ | |||
| message = new MyResponse(code, reponseText, data); | |||
| } | |||
| } | |||
| return message; | |||
| } | |||
| public class BaseApiController extends com.xueyi.common.web.controller.BaseApiController { | |||
| @Autowired | |||
| @@ -1,9 +1,10 @@ | |||
| package com.xueyi.system.resource.service; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import com.xueyi.system.resource.domain.query.DmResourcesQuery; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| import com.xueyi.system.resource.domain.query.DmResourcesQuery; | |||
| /** | |||
| * 静态资源管理 服务层 | |||
| @@ -15,4 +16,6 @@ public interface IDmResourcesService extends IBaseService<DmResourcesQuery, DmRe | |||
| Long addOne(DmResourcesPo dmResourcesPo); | |||
| Long initAdd(DmResourcesPo dto); | |||
| R addBase64Img(String base64Img, String name); | |||
| } | |||
| @@ -1,12 +1,19 @@ | |||
| package com.xueyi.system.resource.service.impl; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import cn.hutool.core.util.ObjectUtil; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import com.xueyi.file.api.domain.SysFile; | |||
| import com.xueyi.file.api.feign.RemoteFileService; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import com.xueyi.system.resource.domain.query.DmResourcesQuery; | |||
| import com.xueyi.system.resource.manager.IDmResourcesManager; | |||
| import com.xueyi.system.resource.mapper.DmResourcesMapper; | |||
| import com.xueyi.system.resource.service.IDmResourcesService; | |||
| import com.xueyi.system.resource.manager.IDmResourcesManager; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import com.xueyi.system.utils.common.ImageUtil; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -22,6 +29,16 @@ public class DmResourcesServiceImpl extends BaseServiceImpl<DmResourcesQuery, Dm | |||
| @Autowired | |||
| DmResourcesMapper dmResourcesMapper; | |||
| @Autowired | |||
| private RemoteFileService fileService; | |||
| @Autowired | |||
| private FaceServiceImpl faceService; | |||
| @Autowired | |||
| private ImageUtil imageUtil; | |||
| /** | |||
| * 查询静态资源对象列表 | 数据权限 | |||
| * | |||
| @@ -43,4 +60,33 @@ public class DmResourcesServiceImpl extends BaseServiceImpl<DmResourcesQuery, Dm | |||
| public Long initAdd(DmResourcesPo po) { | |||
| return this.addOne(po); | |||
| } | |||
| @Override | |||
| public R addBase64Img(String base64Img, String name) { | |||
| DmResourcesDto dmResourcesDto = new DmResourcesDto(); | |||
| if (StringUtils.isNotEmpty(base64Img)) { | |||
| String imgBase64 = base64Img; | |||
| R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64)); | |||
| if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData())) | |||
| return R.fail(fileResult.getMsg()); | |||
| String url = fileResult.getData().getUrl(); | |||
| dmResourcesDto.setType(DmResourcesDto.TYPE_PIC); | |||
| dmResourcesDto.setUrl(url); | |||
| dmResourcesDto.setName(name); | |||
| com.alibaba.fastjson.JSONObject json = faceService.getFaceExtraction("", "", imgBase64); | |||
| if (0!=json.getInteger("status")) { | |||
| return R.fail(json.getString("errMsg")); | |||
| } else { | |||
| JSONArray obj = json.getJSONArray("result").getJSONObject(0).getJSONArray("faces").getJSONObject(0).getJSONArray("feature"); | |||
| dmResourcesDto.setFeature(obj.toJSONString()); | |||
| } | |||
| addOne(dmResourcesDto); | |||
| } | |||
| return R.ok(dmResourcesDto); | |||
| } | |||
| } | |||
| @@ -3,11 +3,14 @@ package com.xueyi.system.staff.controller.api; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.system.api.device.domain.vo.DeviceTenantSourceMergeVo; | |||
| import com.xueyi.system.api.staff.domain.dto.DmStaffCommonDto; | |||
| import com.xueyi.system.api.staff.feign.RemoteStaffService; | |||
| import com.xueyi.system.resource.controller.api.BaseApiController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| 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.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -31,4 +34,11 @@ public class DmStaffApiController extends BaseApiController { | |||
| return staffService.fetchStaff(staffId, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| @PostMapping(value = "new-staff") | |||
| @ResponseBody | |||
| public com.alibaba.fastjson2.JSONObject newStaff(@RequestBody DmStaffCommonDto commonDto){ | |||
| DeviceTenantSourceMergeVo vo = super.getDeviceTenantSourceMergeVo(commonDto.getDevId()); | |||
| return staffService.addStaff(commonDto, vo.getTenantId(), vo.getSourceSlave(), SecurityConstants.INNER); | |||
| } | |||
| } | |||
| @@ -1,16 +1,29 @@ | |||
| package com.xueyi.system.staff.controller.api; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.xueyi.common.core.constant.basic.SqlConstants; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.security.annotation.InnerAuth; | |||
| import com.xueyi.common.web.constant.ResponseCode; | |||
| import com.xueyi.file.api.feign.RemoteFileService; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmVisitorsDto; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmVisitorsPo; | |||
| import com.xueyi.system.api.staff.domain.dto.DmStaffCommonDto; | |||
| import com.xueyi.system.api.staff.domain.po.DmStaffPo; | |||
| import com.xueyi.system.resource.controller.api.BaseApiController; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import com.xueyi.system.resource.service.impl.DmResourcesServiceImpl; | |||
| import com.xueyi.system.resource.service.impl.FaceServiceImpl; | |||
| import com.xueyi.system.staff.mapper.DmStaffMapper; | |||
| import com.xueyi.system.staff.mapper.DmVisitorsMapper; | |||
| import com.xueyi.system.utils.common.ImageUtil; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| 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.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -27,6 +40,24 @@ public class DmStaffInnerApiController extends BaseApiController { | |||
| @Autowired | |||
| private DmStaffMapper dmStaffMapper; | |||
| @Autowired | |||
| private RemoteFileService fileService; | |||
| @Autowired | |||
| private FaceServiceImpl faceService; | |||
| @Autowired | |||
| private ImageUtil imageUtil; | |||
| @Autowired | |||
| private DmResourcesServiceImpl iDmResourcesService; | |||
| @Autowired | |||
| private DmVisitorsMapper dmVisitorsMapper; | |||
| @Autowired | |||
| private DmStaffMapper staffMapper; | |||
| @InnerAuth | |||
| @GetMapping(value = "selectOne/{staffId}") | |||
| @ResponseBody | |||
| @@ -38,4 +69,53 @@ public class DmStaffInnerApiController extends BaseApiController { | |||
| return output(ResponseCode.DATA_NOT_EXISTS,"指定ID的员工").toJSON(); | |||
| } | |||
| @InnerAuth | |||
| @PostMapping(value = "new-staff") | |||
| @ResponseBody | |||
| public com.alibaba.fastjson2.JSONObject newStaff(@RequestBody DmStaffCommonDto commonDto){ | |||
| //访客 | |||
| if (commonDto.getStaffType().equals(DmStaffCommonDto.TYPE_STRANGER) || commonDto.getStaffType().equals(DmStaffCommonDto.TYPE_VIP_STRANGER)) { | |||
| DmVisitorsPo v = new DmVisitorsPo(); | |||
| v.setName(commonDto.getStaffName()); | |||
| v.setNickname(commonDto.getStaffName()); | |||
| v.setType(DmVisitorsDto.TYPE_NORMAL_VISITOR); | |||
| v.setGender(commonDto.getGender()); | |||
| v.setType(Long.parseLong(commonDto.getStaffType())); | |||
| //兼容熟人介绍生人,传递访客照片 | |||
| if (StringUtils.isNotEmpty(commonDto.getStaffBase64Img())) { | |||
| R r = iDmResourcesService.addBase64Img(commonDto.getStaffBase64Img(), "stranger-"+commonDto.getStaffName()); | |||
| if (r.getData() instanceof DmResourcesDto) { | |||
| DmResourcesDto dmResourcesDto = (DmResourcesDto) r.getData(); | |||
| v.setResourceId(dmResourcesDto.getId()); | |||
| } else { | |||
| return output(ResponseCode.FILE_UPLOAD_FAIL, r.getMsg()).toJSON(); | |||
| } | |||
| } | |||
| dmVisitorsMapper.addOne(v); | |||
| } else {//员工 | |||
| DmStaffPo staffPo = new DmStaffPo(); | |||
| staffPo.setNickName(commonDto.getStaffName()); | |||
| staffPo.setUserName(commonDto.getStaffName()); | |||
| staffPo.setUserType(commonDto.getStaffType()); | |||
| staffPo.setSex(commonDto.getGender()!=null ? String.valueOf(commonDto.getGender()):null); | |||
| if (StringUtils.isNotEmpty(commonDto.getStaffBase64Img())) { | |||
| R r = iDmResourcesService.addBase64Img(commonDto.getStaffBase64Img(), "staff-"+commonDto.getStaffName()); | |||
| if (r.getData() instanceof DmResourcesDto) { | |||
| DmResourcesDto dmResourcesDto = (DmResourcesDto) r.getData(); | |||
| staffPo.setResourceId(dmResourcesDto.getId()); | |||
| } else { | |||
| return output(ResponseCode.FILE_UPLOAD_FAIL, r.getMsg()).toJSON(); | |||
| } | |||
| } | |||
| dmStaffMapper.insert(staffPo); | |||
| } | |||
| return outputSuccess().toJSON(); | |||
| } | |||
| } | |||
| @@ -1,5 +1,7 @@ | |||
| package com.xueyi.system.staff.controller.api; | |||
| import cn.hutool.core.util.ObjectUtil; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | |||
| @@ -8,10 +10,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.xueyi.common.cache.utils.DictUtil; | |||
| import com.xueyi.common.core.constant.basic.SqlConstants; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.security.annotation.InnerAuth; | |||
| import com.xueyi.common.sms.configure.SmsProperties; | |||
| import com.xueyi.common.web.constant.ResponseCode; | |||
| import com.xueyi.common.web.utils.DateUtils; | |||
| import com.xueyi.file.api.domain.SysFile; | |||
| import com.xueyi.file.api.feign.RemoteFileService; | |||
| import com.xueyi.system.api.dict.domain.dto.SysDictDataDto; | |||
| import com.xueyi.system.api.dict.domain.po.SysDictDataPo; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmVisitRecordsDto; | |||
| @@ -30,6 +35,9 @@ import com.xueyi.system.meeting.constant.VisitRecordStatus; | |||
| import com.xueyi.system.receiver.domain.po.DmTenantReceiverPo; | |||
| import com.xueyi.system.receiver.mapper.DmTenantReceiverMapper; | |||
| import com.xueyi.system.resource.controller.api.BaseApiController; | |||
| import com.xueyi.system.resource.domain.dto.DmResourcesDto; | |||
| import com.xueyi.system.resource.service.impl.DmResourcesServiceImpl; | |||
| import com.xueyi.system.resource.service.impl.FaceServiceImpl; | |||
| import com.xueyi.system.staff.domain.model.DmVisitRecordsConverter; | |||
| import com.xueyi.system.staff.domain.model.DmVisitorSmsConfigConverter; | |||
| import com.xueyi.system.staff.domain.po.DmVisitorSmsConfigPo; | |||
| @@ -38,6 +46,7 @@ import com.xueyi.system.staff.mapper.DmVisitRecordsMapper; | |||
| import com.xueyi.system.staff.mapper.DmVisitorSmsConfigMapper; | |||
| import com.xueyi.system.staff.mapper.DmVisitorsMapper; | |||
| import com.xueyi.system.staff.service.impl.DmVisitRecordsServiceImpl; | |||
| import com.xueyi.system.utils.common.ImageUtil; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.DeleteMapping; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| @@ -93,6 +102,18 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| @Autowired | |||
| DmTenantReceiverMapper receiverMapper; | |||
| @Autowired | |||
| private RemoteFileService fileService; | |||
| @Autowired | |||
| private FaceServiceImpl faceService; | |||
| @Autowired | |||
| private DmResourcesServiceImpl iDmResourcesService; | |||
| @Autowired | |||
| private ImageUtil imageUtil; | |||
| @InnerAuth | |||
| @PostMapping(value = "confirm-visitor") | |||
| public com.alibaba.fastjson2.JSONObject queryVisit(String visitorName/*, Long empId*/){ | |||
| @@ -143,7 +164,6 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| Wrappers.<DmVisitorsPo>query().lambda() | |||
| .eq(DmVisitorsPo::getPhone, commonDto.getVisitorTel()).last(SqlConstants.LIMIT_ONE)); | |||
| } | |||
| System.err.println("exec===1"); | |||
| if (v == null) { | |||
| v = new DmVisitorsPo(); | |||
| v.setName(commonDto.getVisitorName()); | |||
| @@ -151,6 +171,32 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| v.setVisitorCompany(commonDto.getVisitCompany()); | |||
| v.setPhone(commonDto.getVisitorTel()); | |||
| v.setType(DmVisitorsDto.TYPE_NORMAL_VISITOR); | |||
| //兼容熟人介绍生人,传递访客照片 | |||
| if (StringUtils.isNotEmpty(commonDto.getVisitorBase64Img())) { | |||
| String imgBase64 = commonDto.getVisitorBase64Img(); | |||
| R<SysFile> fileResult = fileService.upload(imageUtil.base64ToMultipartFile(imgBase64)); | |||
| if (ObjectUtil.isNull(fileResult) || ObjectUtil.isNull(fileResult.getData())) | |||
| return output(ResponseCode.FILE_SERVICE_ERROR).toJSON(); | |||
| String url = fileResult.getData().getUrl(); | |||
| DmResourcesDto dmResourcesDto = new DmResourcesDto(); | |||
| dmResourcesDto.setType(DmResourcesDto.TYPE_PIC); | |||
| dmResourcesDto.setUrl(url); | |||
| dmResourcesDto.setName("stranger"); | |||
| com.alibaba.fastjson.JSONObject json = faceService.getFaceExtraction("", "", imgBase64); | |||
| if (0!=json.getInteger("status")) { | |||
| return output(-1, json.getString("errMsg")).toJSON(); | |||
| } else { | |||
| JSONArray obj = json.getJSONArray("result").getJSONObject(0).getJSONArray("faces").getJSONObject(0).getJSONArray("feature"); | |||
| dmResourcesDto.setFeature(obj.toJSONString()); | |||
| } | |||
| iDmResourcesService.addOne(dmResourcesDto); | |||
| v.setResourceId(dmResourcesDto.getId()); | |||
| } | |||
| dmVisitorsMapper.addOne(v); | |||
| } else { | |||
| v.setName(commonDto.getVisitorName()); | |||
| @@ -159,34 +205,23 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| dmVisitorsMapper.updateById(v); | |||
| } | |||
| DmVisitRecordsPo visitRecords = new DmVisitRecordsPo(); | |||
| System.err.println("exec===2"); | |||
| try { | |||
| DmStaffPo emp = dmStaffMapper.selectOne( | |||
| Wrappers.<DmStaffPo>query().lambda() | |||
| .eq(DmStaffPo::getId, commonDto.getEmpId()).last(SqlConstants.LIMIT_ONE)); | |||
| System.err.println("exec===2111-"); | |||
| System.err.println(emp); | |||
| System.err.println("emp===end"); | |||
| System.err.println(commonDto); | |||
| if (ObjectUtils.isNotEmpty(emp)) { | |||
| visitRecords.setDeptId(emp.getDeptId()); | |||
| visitRecords.setVisitorId(v.getId()); | |||
| System.err.println("emp===111"); | |||
| if (StringUtils.isNotEmpty(commonDto.getVisitDate())) { | |||
| visitRecords.setVisitDate(DateUtils.parseStrToDate(commonDto.getVisitDate(), "yyyy-MM-dd")); | |||
| } | |||
| System.err.println("emp===2222"); | |||
| visitRecords.setUserId(commonDto.getEmpId()); | |||
| visitRecords.setRecordStatus(VisitRecordStatus.getRecordStatusStart()); | |||
| System.err.println("emp===333"); | |||
| String code = visitRecordsService.genVisitorCode(); | |||
| System.err.println("emp===444"); | |||
| visitRecords.setVisitorCode(code); | |||
| visitRecords.setReceiverName(commonDto.getEmpName()); | |||
| visitRecords.setReceiverPhone(commonDto.getEmpTel()); | |||
| System.err.println("emp===555"); | |||
| dmVisitRecordsMapper.insert(visitRecords); | |||
| System.err.println("exec===3--"+commonDto.getVisitorTel()); | |||
| JSONObject json = new JSONObject(); | |||
| if (null != commonDto.getVisitorTel()){ | |||
| @@ -205,13 +240,11 @@ public class DmVisitorInnerApiController extends BaseApiController { | |||
| json.put("parkInfo", dmVisitorSmsConfigPo!=null?dmVisitorSmsConfigPo.getParkPrompt():""); | |||
| //给访客发送短信 | |||
| SmsReqEntity send = new SmsReqEntity(); | |||
| System.err.println(json.toJSONString()); | |||
| System.err.println("exec===4"); | |||
| send.setPhone(commonDto.getVisitorTel()); | |||
| send.setTemplate(smsProperties.getVisitorTemplate()); | |||
| send.setDataMap(json.toJSONString()); | |||
| remoteSmsService.sendSms(send); | |||
| send.setPhone(commonDto.getVisitorTel()); | |||
| send.setTemplate(smsProperties.getVisitorTemplate()); | |||
| send.setDataMap(json.toJSONString()); | |||
| remoteSmsService.sendSms(send); | |||
| } | |||
| @@ -23,4 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| select s.id, s.man_id,s.status, s.first_call, s.skill_code, s.info, s.del_flag, s.resp, s.motion_id, s.motion_name from dm_skills s | |||
| where (UNIX_TIMESTAMP(s.update_time) * 1000 > #{timestamp} or UNIX_TIMESTAMP(s.create_time) * 1000 > #{timestamp} ) and man_id = #{manId} | |||
| </select> | |||
| <select id="selectSkillByCode" parameterType="String" resultMap="DmSkillResult"> | |||
| select s.id, s.man_id,s.status, s.first_call, s.skill_code, s.info, s.del_flag, s.resp, s.motion_id, s.motion_name, s.auth from dm_skills s | |||
| where s.skill_code = #{skillCode} limit 1 | |||
| </select> | |||
| </mapper> | |||
| @@ -9,13 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> | |||
| select LAST_INSERT_ID() | |||
| </selectKey> | |||
| insert into dm_visitors(name,nickname,phone,visitor_company,type) values | |||
| insert into dm_visitors(name,nickname,phone,visitor_company,type,resource_id) values | |||
| ( | |||
| #{name}, | |||
| #{nickname}, | |||
| #{phone}, | |||
| #{visitorCompany}, | |||
| #{type} | |||
| #{type}, | |||
| #{resourceId} | |||
| ) | |||
| </insert > | |||
| </mapper> | |||