Commit 9f2927c3 by 朱淼

Merge branch 'dev' of http://git.xmmakeit.com/huangjiay/iot-platform-server into dev

# Conflicts:
#	server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
parents 83e47f38 a6e3e7f8
Showing with 1171 additions and 143 deletions
......@@ -3,13 +3,17 @@ package com.makeit.controller.device;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.service.platform.elder.PlatElderDayReportDayService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeHeartRespiratoryVO;
import com.makeit.vo.platform.elder.report.day.*;
import com.makeit.vo.platform.elder.report.day.PlatElderBehaviorDistributionVO;
import com.makeit.vo.platform.elder.report.day.PlatElderBehaviorExceptionRecordVO;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationRecordVO;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepDiagramVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepEvaluationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,18 +42,21 @@ public class SaasDeviceReportDayController {
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.sleepEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠图表")
@PostMapping("sleepDiagram")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderSleepDiagramVO>> sleepDiagram(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.sleepDiagram(platElderIdDTO));
}
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.heartRespiratoryEvaluation(platElderIdDTO));
}
......@@ -57,15 +64,17 @@ public class SaasDeviceReportDayController {
@ApiOperation("心率异常记录")
@PostMapping("heartExceptionRecordList")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.heartExceptionRecordList(platElderIdDTO));
}
@ApiOperation("呼吸率异常记录")
@PostMapping("respiratoryExceptionRecordList")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.respiratoryExceptionRecordList(platElderIdDTO));
}
@ApiOperation("心率呼吸率")
......
......@@ -2,19 +2,24 @@ package com.makeit.controller.device;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.service.platform.elder.PlatElderReportMonthService;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationVO;
import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepEvaluationVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 长者基本信息 前端控制器
......@@ -28,18 +33,23 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/saas/device/report/month")
public class SaasDeviceReportMonthController {
@Autowired
private PlatElderReportMonthService platElderReportMonthService;
@ApiOperation("综合评价")
@PostMapping("comprehensiveEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderReportMonthService.comprehensiveEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderReportMonthService.sleepEvaluation(platElderIdDTO));
}
......@@ -47,14 +57,16 @@ public class SaasDeviceReportMonthController {
@PostMapping("heartRespiratoryEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderReportMonthService.heartRespiratoryEvaluation(platElderIdDTO));
}
@ApiOperation("月报表")
@PostMapping("reportMonth")
@TenantIdIgnore
public ApiResponseEntity<PlatElderReportMonthVO> reportMonth(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
public ApiResponseEntity<List<PlatElderReportMonthVO>> reportMonth(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderReportMonthService.reportMonth(platElderIdDTO));
}
......
......@@ -45,63 +45,68 @@ public class SaasDeviceReportWeekController {
@PostMapping("comprehensiveEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.comprehensiveEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.sleepEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠图表")
@PostMapping("sleepDiagram")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderSleepDiagramWeekVO>> sleepDiagram(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
public ApiResponseEntity<PlatElderSleepDiagramWeekVO> sleepDiagram(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.sleepDiagram(platElderIdDTO));
}
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
@TenantIdIgnore
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.heartRespiratoryEvaluation(platElderIdDTO));
}
@ApiOperation("心率异常记录")
@PostMapping("heartExceptionRecordList")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.heartExceptionRecordList(platElderIdDTO));
}
@ApiOperation("呼吸率异常记录")
@PostMapping("respiratoryExceptionRecordList")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.respiratoryExceptionRecordList(platElderIdDTO));
}
@ApiOperation("心率呼吸率")
@PostMapping("heartRespiratory")
@TenantIdIgnore
public ApiResponseEntity<PlatElderRealTimeHeartRespiratoryWeekVO> heartRespiratory(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
public ApiResponseEntity<List<PlatElderRealTimeHeartRespiratoryWeekVO>> heartRespiratory(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.heartRespiratory(platElderIdDTO));
}
@ApiOperation("行为异常记录")
@PostMapping("behaviorExceptionRecordList")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderBehaviorExceptionRecordVO>> behaviorExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.behaviorExceptionRecordList(platElderIdDTO));
}
@ApiOperation("跌倒记录")
@PostMapping("failRecordList")
@TenantIdIgnore
public ApiResponseEntity<List<String>> failRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.failRecordList(platElderIdDTO));
}
@ApiOperation("坐标记录")
......@@ -115,7 +120,8 @@ public class SaasDeviceReportWeekController {
@PostMapping("behaviorDistribution")
@TenantIdIgnore
public ApiResponseEntity<List<PlatElderBehaviorDistributionVO>> behaviorDistribution(@RequestBody PlatElderReportDTO platElderIdDTO) {
return null;
return ApiResponseUtils.success(platElderDayReportWeekService.behaviorDistribution(platElderIdDTO));
}
}
......
......@@ -2,6 +2,7 @@ package com.makeit.controller.plat;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.module.admin.dto.plat.PlatMenuDTOVO;
import com.makeit.module.admin.dto.plat.PlatMenuQueryDTO;
import com.makeit.service.saas.PlatMenuService;
......@@ -26,6 +27,7 @@ public class PlatMenuController {
@ApiOperation("树形列表")
@PostMapping("tree")
public ApiResponseEntity<List<PlatMenuDTOVO>> treeAuthIgnore(@RequestBody PlatMenuQueryDTO dto){
dto.setTenantId(TenantIdUtil.getTenantId());
return ApiResponseUtils.success(platMenuService.tree(dto));
}
}
package com.makeit.api.controller.external;
package com.makeit.api.external.controller;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.page.PageReqDTO;
......
package com.makeit.api.external.filter;
import org.apache.commons.io.IOUtils;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @Description: 解决request.getInputStream()只能读取一次的问题
* @PackageName: net.dlet.dhdemo.utils.dhutils
* @Name: MyRequestWrapper
* @Author: cure
* @CreateDate: 2020/09/06 4:44
* @ModifyUser:
* @ModifyDate:
* @ModifyDesc: 修改内容
* @DayNameFull: 星期日
* @ProjectName: dhdemo
* @Version: 1.0
**/
public class MyRequestWrapper extends HttpServletRequestWrapper {
private volatile byte[] body;
public MyRequestWrapper(HttpServletRequest request) throws IOException {
super(request);
body = IOUtils.toByteArray(super.getInputStream());
}
public byte[] getBody() {
return body;
}
public void setBody(byte[] body) {
this.body = body;
}
@Override
public BufferedReader getReader() throws IOException {
return new BufferedReader(new InputStreamReader(getInputStream()));
}
@Override
public ServletInputStream getInputStream() throws IOException {
return new RequestBodyCachingInputStream(body);
}
private class RequestBodyCachingInputStream extends ServletInputStream {
private byte[] body;
private int lastIndexRetrieved = -1;
private ReadListener listener;
public RequestBodyCachingInputStream(byte[] body) {
this.body = body;
}
@Override
public int read() throws IOException {
if (isFinished()) {
return -1;
}
int i = body[lastIndexRetrieved + 1];
lastIndexRetrieved++;
if (isFinished() && listener != null) {
try {
listener.onAllDataRead();
} catch (IOException e) {
listener.onError(e);
throw e;
}
}
return i;
}
@Override
public boolean isFinished() {
return lastIndexRetrieved == body.length - 1;
}
@Override
public boolean isReady() {
return isFinished();
}
@Override
public void setReadListener(ReadListener listener) {
if (listener == null) {
throw new IllegalArgumentException("listener cann not be null");
}
if (this.listener != null) {
throw new IllegalArgumentException("listener has been set");
}
this.listener = listener;
if (!isFinished()) {
try {
listener.onAllDataRead();
} catch (IOException e) {
listener.onError(e);
}
} else {
try {
listener.onAllDataRead();
} catch (IOException e) {
listener.onError(e);
}
}
}
@Override
public int available() throws IOException {
return body.length - lastIndexRetrieved - 1;
}
@Override
public void close() throws IOException {
lastIndexRetrieved = body.length - 1;
body = null;
}
}
}
\ No newline at end of file
package com.makeit.api.external.filter;
import com.makeit.api.external.util.RSAUtils;
import com.makeit.utils.old.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@WebFilter(urlPatterns = { "/iot/external/*"})
public class SignAuthFilter implements Filter {
private static Logger logger = LoggerFactory.getLogger(SignAuthFilter.class);
@Override
public void init(FilterConfig filterConfig) {
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
try {
String sign = request.getHeader("sign");
if (StringUtils.isEmpty(sign)) {
response.sendError(403, "Forbidden");
return;
}
logger.info("getted Authorization is ---> " + sign);
// 获取客户端ip
/* String ip = IpUtil.getIpAddr(request);
logger.info("getted ip is ---> " + ip);*/
MyRequestWrapper requestWrapper = new MyRequestWrapper(request);
String bodyString = new String(requestWrapper.getBody(), StandardCharsets.UTF_8);
logger.info("getted requestbody data is ---> " + bodyString);
String decryptJson = RSAUtils.privateDecrypt(sign, RSAUtils.getPrivateKey(RSAUtils.PRIVATE_KEY), "UTF-8");
boolean couldPass = decryptJson.equals(bodyString);
if (couldPass) {
// 放行
chain.doFilter(requestWrapper, response);
return;
}
response.sendError(403, "Forbidden");
} catch (Exception e) {
logger.error("验证失败: -> " + e.getMessage(), e);
response.sendError(403, "Forbidden");
}
}
@Override
public void destroy() {
}
}
package com.makeit.api.external.util;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
/**
* 1、公钥加密,则用私钥解密
* 2、私钥加密,则用公钥解密
* 3、公钥签名,私钥验签
*/
public class RSAUtils {
public static final String CHARSET = "UTF-8";
public static final String RSA_ALGORITHM = "RSA";
public static final String RSA_ALGORITHM_SIGN = "SHA256WithRSA";
public static final String PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDEjW_RLCPPCeAPWzQWIAwMGNvHf1pat27oH6CZDCG5nLwxyDsUgxdF89IB2_rLURVTkkrB5tq_dcBk5Wi2pmu2yMn8Dpk2XYsm0LJwJe3gg2qqRXQm8DGbf9kvtHUqBLe_24PMHL88YavJdrcS6HNlwwth2YINmViroqMZgqW4bQnmV4t5X4BO1dl3gTB5y8pRXd1zoKsLNgjzbuVBgieA0-e99eMsdjJadZFPzETQW-BO9Q6Kbbx4fIjOkqxiS8KzsiDSvf3KXG9lfvoz67vuNez_QBFauA_MJsUP_bgHLXFV9-XzcjCE2fkDbKbNHPAP20o1IM1S3G43mGzRwAb5AgMBAAECggEAV_nOsNuG86bB6V2zRKv3eHqv9O2l7bDpLXDqm1Z4yfHDsqyi9R1wD1mBCGAEM3kJiKyUVZIVG1mDUiX05rw6vkfFUNLf9RuNq0QCenwfqzxnQ-tuf_dG3Qkul1G4l6Qg8vk4VuYPGuHE2JoQe6Ab9tKEh7mpopievcRAKKz3rEIn4NGGfg4tlTP2hoZ_EhCDMc02UTtjm2YXUux2T2KLZPXMeClbxU1vTMTxFNp9edWyB9syLbfJp34lrnrueKnqpBPUI4oldKj-3QsE4v3Ie8wLTp5leiowzKqZUXqTplWAvROpIvVfj9eeouBPAz_IQR_U77c3m22cisCh-5QT-QKBgQD764Um0miLVQQIrfM9GQiWpiiM75nzmt4QaRkjoNg896b-qjDelG9K_EQ3RjopFuQBKBf7xY304qtD6nY_5IFRlhdB58nrSgPgSxLaShAQ2yUkdDPr00rDBu_9cAT9GZxSRmDhds-87rnz21QMNIofg2cpKNpl1HQQfTcFN9OETwKBgQDHvFvQ0bizfkh4o71pfD0tiiWEeQzV7KMjuwQ3nnUBfgv2Rd1QkOUo3x_dLBTRzacIslQ3DFljXqoBJWJasRFUSAyikR1KUAven7z5D3u-rdye6MLofKkf0YY_qAlNQXEDh9hzhlWqifd4UJTcZujVQNvkuvjldGnMMTK1W49GNwKBgBUbZ52YFYBPEDZ19KJS3aBZrZ4ZWSnK-P4hACU3DccV7Nz7f3q2rxh2SHTlImxc6Z-bL1897yXsc_MNyviRebBPRgWUmRtoqSh6wcqeV_hBlDwYrFz-6A2tICB46UIXijxufyGE5eTrj5L59nHLWSNIzDTroljT0yGqjBiY09ULAoGAN339hGbACh5rxBi55zS9Som3Irb--fBk4uhyo4FCwMdkS2fdtSSMhm53S9uTbTbV0XS6MREdRJ5oXSklykyno-Lgn8nxeVQD-DYpKolCuBdV1FCW1kDMPCraQZVOAEjOPUzgtjf8VQU_3A2HTjTJO3ZpoYLQ4-8T9cc1b22gwMECgYBCq2CPsNMSf55_VCD23b2B_PuppnowWw-k_zl4MkZGLtLJx5qsLRp-hNRvqW2t81fFkOieDdGg_6s7DPinwKfjH8KNgv7ke3kv9euiJ-AmF8HQKlRNCsX_-J7JeB39BHZXU9WPRI4YT8dR6NzZS3D_ug_Coeiq9TIFa2Za6Q6mXg";
public static final String PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxI1v0SwjzwngD1s0FiAMDBjbx39aWrdu6B-gmQwhuZy8Mcg7FIMXRfPSAdv6y1EVU5JKwebav3XAZOVotqZrtsjJ_A6ZNl2LJtCycCXt4INqqkV0JvAxm3_ZL7R1KgS3v9uDzBy_PGGryXa3EuhzZcMLYdmCDZlYq6KjGYKluG0J5leLeV-ATtXZd4EwecvKUV3dc6CrCzYI827lQYIngNPnvfXjLHYyWnWRT8xE0FvgTvUOim28eHyIzpKsYkvCs7Ig0r39ylxvZX76M-u77jXs_0ARWrgPzCbFD_24By1xVffl83IwhNn5A2ymzRzwD9tKNSDNUtxuN5hs0cAG-QIDAQAB";
public static void main(String[] args) throws Exception {
Map<String, String> keys = createKeys(2048);
System.out.println(keys);
RSAPublicKey publicKey = getPublicKey(keys.get("publicKey"));
RSAPrivateKey privateKey = getPrivateKey(keys.get("privateKey"));
String encrypt = publicEncrypt("{\"page\":1,\"limit\":10,\"data\":{}}", publicKey, "UTF-8");
System.out.println(encrypt);
String decrypt = privateDecrypt(encrypt, privateKey, "UTF-8");
System.out.println(decrypt);
}
/**
* 初始化RSA算法密钥对
*
* @param keySize RSA1024已经不安全了,建议2048
* @return 经过Base64编码后的公私钥Map, 键名分别为publicKey和privateKey
*/
private static Map<String, String> createKeys(int keySize) {
//为RSA算法创建一个KeyPairGenerator对象
KeyPairGenerator kpg;
try {
kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
}
//初始化KeyPairGenerator对象,密钥长度
kpg.initialize(keySize);
//生成密匙对
KeyPair keyPair = kpg.generateKeyPair();
//得到公钥
Key publicKey = keyPair.getPublic();
String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
//得到私钥
Key privateKey = keyPair.getPrivate();
String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
Map<String, String> keyPairMap = new HashMap<String, String>();
keyPairMap.put("publicKey", publicKeyStr);
keyPairMap.put("privateKey", privateKeyStr);
return keyPairMap;
}
/**
* 得到公钥
* @param publicKey 密钥字符串(经过base64编码)
* @throws Exception
*/
public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
//通过X509编码的Key指令获得公钥对象
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
return key;
}
/**
* 得到私钥
* @param privateKey 密钥字符串(经过base64编码)
* @throws Exception
*/
public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
//通过PKCS#8编码的Key指令获得私钥对象
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
return key;
}
/**
* 公钥加密
* @param data
* @param publicKey
* @return
*/
public static String publicEncrypt(String data, RSAPublicKey publicKey, String encoding) {
if (StringUtils.isEmpty(encoding)) {
encoding = CHARSET;
}
try {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(encoding), publicKey.getModulus().bitLength()));
} catch (Exception e) {
throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 私钥解密
* @param data
* @param privateKey
* @return
*/
public static String privateDecrypt(String data, RSAPrivateKey privateKey, String encoding) {
if (StringUtils.isEmpty(encoding)) {
encoding = CHARSET;
}
try {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), privateKey.getModulus().bitLength()), encoding);
} catch (Exception e) {
throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 私钥加密
* @param data
* @param privateKey
* @return
*/
public static String privateEncrypt(String data, RSAPrivateKey privateKey, String encoding) {
if (StringUtils.isEmpty(encoding)) {
encoding = CHARSET;
}
try {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(encoding), privateKey.getModulus().bitLength()));
} catch (Exception e) {
throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 公钥解密
* @param data
* @param publicKey
* @return
*/
public static String publicDecrypt(String data, RSAPublicKey publicKey, String encoding) {
if (StringUtils.isEmpty(encoding)) {
encoding = CHARSET;
}
try {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, publicKey);
return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), publicKey.getModulus().bitLength()), encoding);
} catch (Exception e) {
throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 私钥签名
* @param data 需要签名的数据
* @param privateKey 私钥
* @return
*/
public static String sign(String data, RSAPrivateKey privateKey, String encoding) {
if (StringUtils.isEmpty(encoding)) {
encoding = CHARSET;
}
try {
//sign
Signature signature = Signature.getInstance(RSA_ALGORITHM_SIGN);
signature.initSign(privateKey);
signature.update(data.getBytes(encoding));
return Base64.encodeBase64URLSafeString(signature.sign());
} catch (Exception e) {
throw new RuntimeException("签名字符串[" + data + "]时遇到异常", e);
}
}
/**
* 公钥验签
* @param data 需要验签的原始数据
* @param sign 签名
* @param publicKey 公钥
* @return
*/
public static boolean verify(String data, String sign, RSAPublicKey publicKey, String encoding) {
if (StringUtils.isEmpty(encoding)) {
encoding = CHARSET;
}
try {
Signature signature = Signature.getInstance(RSA_ALGORITHM_SIGN);
signature.initVerify(publicKey);
signature.update(data.getBytes(encoding));
return signature.verify(Base64.decodeBase64(sign));
} catch (Exception e) {
throw new RuntimeException("验签字符串[" + data + "]时遇到异常", e);
}
}
private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize) {
int maxBlock = 0;
if (opmode == Cipher.DECRYPT_MODE) {
maxBlock = keySize / 8;
} else {
maxBlock = keySize / 8 - 11;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0;
byte[] buff;
int i = 0;
try {
while (datas.length > offSet) {
if (datas.length - offSet > maxBlock) {
buff = cipher.doFinal(datas, offSet, maxBlock);
} else {
buff = cipher.doFinal(datas, offSet, datas.length - offSet);
}
out.write(buff, 0, buff.length);
i++;
offSet = i * maxBlock;
}
} catch (Exception e) {
throw new RuntimeException("加解密阀值为[" + maxBlock + "]的数据时发生异常", e);
}
byte[] resultDatas = out.toByteArray();
IOUtils.closeQuietly(out);
return resultDatas;
}
}
\ No newline at end of file
......@@ -18,6 +18,8 @@ public enum GlobalCodeMessageEnum {
SYSTEM_ERROR_EXCEPTION(500, "system.error.exception"),
// 请求方法不对
SYSTEM_ERROR_NOT_ALLOWED(405, "system.error.method.not.allowed"),
SYSTEM_ERROR_FORBIDDEN(403, "system.error.forbidden"),
// 未找到
SYSTEM_ERROR_NOT_FOUND(404, "system.error.not.found"),
......
......@@ -35,6 +35,11 @@ public class ExceptionController implements ErrorController {
return ApiResponseUtils.fail(GlobalCodeMessageEnum.SYSTEM_ERROR_NOT_ALLOWED.getCode(),
GlobalCodeMessageEnum.SYSTEM_ERROR_NOT_ALLOWED.getMessage());
}
// 403
if (GlobalCodeMessageEnum.SYSTEM_ERROR_FORBIDDEN.getCode() == statusCode) {
return ApiResponseUtils.fail(GlobalCodeMessageEnum.SYSTEM_ERROR_FORBIDDEN.getCode(),
GlobalCodeMessageEnum.SYSTEM_ERROR_FORBIDDEN.getMessage());
}
return ApiResponseUtils.fail(GlobalCodeMessageEnum.SYSTEM_ERROR_EXCEPTION.getCode(),
GlobalCodeMessageEnum.SYSTEM_ERROR_EXCEPTION.getMessage());
......
package com.makeit.module.iot.service;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.makeit.module.iot.util.HttpRequest;
import com.makeit.module.iot.util.SimpleHttpRequest;
import com.makeit.module.iot.vo.DeviceInstanceEntity;
import com.makeit.module.iot.vo.DeviceProperties;
import com.makeit.module.iot.vo.ResponseMessage;
import com.makeit.utils.data.convert.JsonUtil;
import lombok.extern.slf4j.Slf4j;
......@@ -11,6 +14,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -23,6 +27,23 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
public static final String DEVICE_PREFIX_URL = "/device-instance/";
public DeviceProperties deviceRead(String deviceId, String propertiesName) {
String url = iotUrl + "device/standard/" + deviceId + "/property/" + propertiesName;
HttpRequest request = new SimpleHttpRequest(url, httpClient);
request.headers(headerUtils.createHeadersOfParams(new HashMap<>()));
try {
ResponseMessage responseMessage = sendGet(url, request);
if (responseMessage.getStatus() == 200) {
return JSON.parseObject(responseMessage.getResult().toString(), DeviceProperties.class);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
/**
* 把设备写入属性
*/
......
package com.makeit.module.iot.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DeviceProperties {
private Long createTime;
private String formatValue;
private Integer numberValue;
@ApiModelProperty("属性名称")
private String propertyName;
@ApiModelProperty("属性")
private String property;
private Long timestamp;
private String type;
@ApiModelProperty("属性值")
private Integer value;
}
package com.makeit.utils.data.convert;
import com.makeit.enums.id.TreeConst;
import com.makeit.utils.old.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
......@@ -85,4 +84,37 @@ public class TreeUtil {
}
}
public static String path(String path, List<String> idList) {
// if(StringUtils.isBlank(path)){
// return path;
// }
LinkedHashSet<String> list = new LinkedHashSet<>();
if (StringUtils.isNotBlank(path)) {
list = new LinkedHashSet<>(Arrays.asList(path.split(",")));
}
list.addAll(idList);
return StreamUtil.join(new ArrayList<>(list), Function.identity());
}
public static <T> void fillId(List<BiConsumer<T, String>> consumerList, T t, String path, int start) {
if (StringUtils.isBlank(path)) {
return;
}
String[] arr = path.split(",");
for (int i = start; i < arr.length; i++) {
consumerList.get(i - start).accept(t, arr[i - start]);
}
}
public static <T> void fillId(List<BiConsumer<T, String>> consumerList, T t, String path) {
fillId(consumerList, t, path, 0);
}
}
......@@ -33,7 +33,6 @@ public class PlatUserVO implements Serializable {
private String orgPath;
public PlatUserVO() {
}
......@@ -49,27 +48,25 @@ public class PlatUserVO implements Serializable {
}
private boolean initFlag = false;
public void init(){
if(initFlag){
public void init() {
if (initFlag) {
return;
}
if(StringUtils.isBlank(orgPath)){
if (StringUtils.isBlank(orgPath)) {
return;
}
List<BiConsumer<PlatUserVO,String>> list = Arrays.asList(
List<BiConsumer<PlatUserVO, String>> list = Arrays.asList(
PlatUserVO::setCityOrgId,
PlatUserVO::setDistrictOrgId,
PlatUserVO::setStreetOrgId
);
String[] split = orgPath.split(",");
for (int i = 1; i < split.length; i++) {
BiConsumer<PlatUserVO, String> e = list.get(i-1);
e.accept(this,split[i]);
BiConsumer<PlatUserVO, String> e = list.get(i - 1);
e.accept(this, split[i]);
}
this.initFlag = true;
}
......
......@@ -61,7 +61,7 @@ SYSTEM.ERROR.TENANT.NOT.EXIST=该租户不存在或者被禁用
SYSTEM.ERROR.DUPLICATE.REQUEST=请勿重复请求
#SYSTEM.ERROR.AUTH.USER.HAS.DISABLED=该用户已经离职/冻结
SYSTEM.ERROR.AUTH.USER.HAS.DISABLED=用户不存在/已冻结
SYSTEM.ERROR.AUTH.USER.HAS.DISABLED=用户不存在
SYSTEM.ERROR.AUTH.USER.ACCOUNT.PASSWORD=账号或者密码错误!
SYSTEM.ERROR.AUTH.USER.PASSWORD=密码错误
SYSTEM.ERROR.AUTH.USER.OLD.PASSWORD=旧密码错误
......
package com.makeit.module.controller.children.elder;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.service.platform.elder.PlatElderDayReportDayService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeHeartRespiratoryVO;
import com.makeit.vo.platform.elder.report.day.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 长者基本信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@Api(tags = "子女端小程序-长者报告-日报")
@RestController
@RequestMapping("/children/elder/report/day")
public class PlatElderReportDayChildrenController {
@Autowired
private PlatElderDayReportDayService platElderDayReportDayService;
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.sleepEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠图表")
@PostMapping("sleepDiagram")
public ApiResponseEntity<List<PlatElderSleepDiagramVO>> sleepDiagram(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.sleepDiagram(platElderIdDTO));
}
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.heartRespiratoryEvaluation(platElderIdDTO));
}
@ApiOperation("心率异常记录")
@PostMapping("heartExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.heartExceptionRecordList(platElderIdDTO));
}
@ApiOperation("呼吸率异常记录")
@PostMapping("respiratoryExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.respiratoryExceptionRecordList(platElderIdDTO));
}
@ApiOperation("心率呼吸率")
@PostMapping("heartRespiratory")
public ApiResponseEntity<List<PlatElderRealTimeHeartRespiratoryVO>> heartRespiratory(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.heartRespiratory(platElderIdDTO));
}
@ApiOperation("行为异常记录")
@PostMapping("behaviorExceptionRecordList")
public ApiResponseEntity<List<PlatElderBehaviorExceptionRecordVO>> behaviorExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.behaviorExceptionRecordList(platElderIdDTO));
}
@ApiOperation("跌倒记录")
@PostMapping("failRecordList")
public ApiResponseEntity<List<String>> failRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.failRecordList(platElderIdDTO));
}
@ApiOperation("坐标记录")
@PostMapping("coordinateList")
public ApiResponseEntity<List<PlatElderCoordinateVO>> coordinateList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.coordinateList(platElderIdDTO));
}
@ApiOperation("行为辐射")
@PostMapping("behaviorDistribution")
public ApiResponseEntity<List<PlatElderBehaviorDistributionVO>> behaviorDistribution(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportDayService.behaviorDistribution(platElderIdDTO));
}
}
package com.makeit.module.controller.children.elder;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.service.platform.elder.PlatElderReportMonthService;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationVO;
import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepEvaluationVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 长者基本信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@Api(tags = "子女端小程序-长者报告-月报")
@RestController
@RequestMapping("/children/elder/report/month")
public class PlatElderReportMonthChildrenController {
@Autowired
private PlatElderReportMonthService platElderReportMonthService;
@ApiOperation("综合评价")
@PostMapping("comprehensiveEvaluation")
public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderReportMonthService.comprehensiveEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderReportMonthService.sleepEvaluation(platElderIdDTO));
}
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderReportMonthService.heartRespiratoryEvaluation(platElderIdDTO));
}
@ApiOperation("月报表")
@PostMapping("reportMonth")
public ApiResponseEntity<List<PlatElderReportMonthVO>> reportMonth(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderReportMonthService.reportMonth(platElderIdDTO));
}
}
package com.makeit.module.controller.children.elder;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.elder.PlatElderReportDTO;
import com.makeit.service.platform.elder.PlatElderDayReportWeekService;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import com.makeit.vo.platform.elder.report.day.*;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import com.makeit.vo.platform.elder.report.week.PlatElderRealTimeHeartRespiratoryWeekVO;
import com.makeit.vo.platform.elder.report.week.PlatElderSleepDiagramWeekVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 长者基本信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@Api(tags = "子女端小程序-长者报告-周报")
@RestController
@RequestMapping("/children/elder/report/week")
public class PlatElderReportWeekChildrenController {
@Autowired
private PlatElderDayReportWeekService platElderDayReportWeekService;
@ApiOperation("综合评价")
@PostMapping("comprehensiveEvaluation")
public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.comprehensiveEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.sleepEvaluation(platElderIdDTO));
}
@ApiOperation("睡眠图表")
@PostMapping("sleepDiagram")
public ApiResponseEntity<PlatElderSleepDiagramWeekVO> sleepDiagram(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.sleepDiagram(platElderIdDTO));
}
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.heartRespiratoryEvaluation(platElderIdDTO));
}
@ApiOperation("心率异常记录")
@PostMapping("heartExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.heartExceptionRecordList(platElderIdDTO));
}
@ApiOperation("呼吸率异常记录")
@PostMapping("respiratoryExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.respiratoryExceptionRecordList(platElderIdDTO));
}
@ApiOperation("心率呼吸率")
@PostMapping("heartRespiratory")
public ApiResponseEntity<List<PlatElderRealTimeHeartRespiratoryWeekVO>> heartRespiratory(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.heartRespiratory(platElderIdDTO));
}
@ApiOperation("行为异常记录")
@PostMapping("behaviorExceptionRecordList")
public ApiResponseEntity<List<PlatElderBehaviorExceptionRecordVO>> behaviorExceptionRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.behaviorExceptionRecordList(platElderIdDTO));
}
@ApiOperation("跌倒记录")
@PostMapping("failRecordList")
public ApiResponseEntity<List<String>> failRecordList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.failRecordList(platElderIdDTO));
}
@ApiOperation("坐标记录")
@PostMapping("coordinateList")
public ApiResponseEntity<List<PlatElderCoordinateVO>> coordinateList(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.coordinateList(platElderIdDTO));
}
@ApiOperation("行为辐射")
@PostMapping("behaviorDistribution")
public ApiResponseEntity<List<PlatElderBehaviorDistributionVO>> behaviorDistribution(@RequestBody PlatElderReportDTO platElderIdDTO) {
return ApiResponseUtils.success(platElderDayReportWeekService.behaviorDistribution(platElderIdDTO));
}
}
......@@ -10,6 +10,8 @@ import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.global.annotation.AuthIgnore;
import com.makeit.module.iot.vo.DeviceProperties;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.device.PlatDeviceViewVO;
......@@ -22,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 设备 前端控制器
......@@ -65,6 +69,12 @@ public class PlatDeviceWechatController {
return ApiResponseUtils.success();
}
@ApiOperation("读取设备属性")
@PostMapping("readDeviceProperties")
public ApiResponseEntity<List<DeviceProperties>> readDeviceProperties(@RequestBody PlatDeviceAttrWechatDTO dto) {
return ApiResponseUtils.success(platDeviceService.readDeviceProperties(dto));
}
@ApiOperation("编辑设备属性")
@PostMapping("editDeviceProperties")
public ApiResponseEntity<?> editDeviceProperties(@RequestBody PlatDeviceAttrWechatDTO dto) {
......
package com.makeit.dto.platform.space;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PlatSpaceSplitDTO {
@ApiModelProperty(value = "空间id")
private String spaceId;
@ApiModelProperty(value = "小区/社区/街道空间id")
private String streetSpaceId;
@ApiModelProperty(value = "楼栋空间id")
private String buildingSpaceId;
@ApiModelProperty(value = "单元空间id")
private String unitSpaceId;
@ApiModelProperty(value = "楼层id")
private String floorSpaceId;
@ApiModelProperty(value = "房间id")
private String roomId;
@ApiModelProperty(value = "床位id")
private String bedId;
@ApiModelProperty(value = "空间-房间-床位路径")
private String spacePath;
}
......@@ -13,7 +13,7 @@ import lombok.Data;
* @since 2023-09-05
*/
@Data
@ApiModel(value = "PlatDeviceAttrWechatDTO对象", description = "设备属性")
@ApiModel(value = "PlatDeviceAttrWechatDTO对象", description = "设备属性 跌倒:安装方式 安装高度 空间人体:安装方式 功能模式")
public class PlatDeviceAttrWechatDTO {
@ApiModelProperty(value = "设备id")
......@@ -30,5 +30,6 @@ public class PlatDeviceAttrWechatDTO {
"进\":1,\"单位\":\"cm\"")
private Integer radarHight;
private String readProperties;
}
......@@ -11,6 +11,7 @@ import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.auth.PlatOrgSplitDTO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.entity.platform.auth.PlatUserRole;
import com.makeit.entity.platform.space.PlatSpace;
......@@ -46,6 +47,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Function;
......@@ -436,9 +438,9 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
if (CollectionUtils.isEmpty(roleOrgList)) {
return new HashSet<>();
}
return roleOrgList.stream().map(PlatRoleOrg::getOrgId).collect(Collectors.toSet());
// List<PlatRole> roleList = platRoleService.listByIds(roleOrgList.stream().map(PlatRoleOrg::getRoleId).collect(Collectors.toList()));
// return roleList.stream().flatMap(vo -> Stream.of(Optional.ofNullable(vo.getDataScope()).orElse(new String()) .split(","))).collect(Collectors.toSet());
//return roleOrgList.stream().map(PlatRoleOrg::getOrgId).collect(Collectors.toSet());
List<PlatRole> roleList = platRoleService.listByIds(roleOrgList.stream().map(PlatRoleOrg::getRoleId).collect(Collectors.toList()));
return roleList.stream().flatMap(vo -> Stream.of(Optional.ofNullable(vo.getDataScope()).orElse(new String()) .split(","))).collect(Collectors.toSet());
}
/**
* 租户权限的组织树
......@@ -593,7 +595,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
vo.setChildren(parentMap.get(vo.getId()));
});
return orgList.stream().filter(vo->StringUtils.equals(vo.getParentId(),"1")).collect(Collectors.toList());
return orgList.stream().filter(vo->StringUtils.equals(vo.getParentId(),TreeConst.TOP_LEVEL)).collect(Collectors.toList());
}
/**
......
......@@ -32,6 +32,7 @@ import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.IsTenantAccountEnum;
import com.makeit.enums.biz.auth.SysEnum;
import com.makeit.enums.id.TreeConst;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.global.aspect.tenant.TenantIdUtil;
......@@ -368,9 +369,12 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
PlatUser platUser = getOne(new QueryWrapper<PlatUser>().lambda()
.eq(PlatUser::getAccount, loginDTO.getAccount())
.or()
.eq(PlatUser::getMobile, loginDTO.getAccount())
//.or()
//.eq(PlatUser::getMobile, loginDTO.getAccount())
);
if(platUser == null ){
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_AUTH_USER_HAS_DISABLED);
}
checkTenantOrgStatus(platUser);
......@@ -657,6 +661,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.like(StringUtils.isNotBlank(dto.getMobile()), PlatUser::getMobile, dto.getMobile())
.eq(StringUtils.isNotBlank(dto.getStatus()), PlatUser::getStatus, dto.getStatus())
.like(StringUtils.isNotBlank(dto.getEmail()),PlatUser::getEmail,dto.getEmail())
.eq(StringUtils.isNotBlank(dto.getOrgId()),PlatUser::getOrgId,dto.getOrgId())
.eq(PlatUser::getTenantId, TenantIdUtil.getTenantId());
roleIdFilter(lambdaQueryWrapper, dto);
......@@ -1056,7 +1061,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
LambdaUpdateWrapper<PlatUser> updateWrapper = Wrappers.lambdaUpdate(PlatUser.class)
.set(PlatUser::getTenantId, tenantId)
.set(PlatUser::getOrgId, tenantId)
.set(PlatUser::getOrgPath, tenantId)
.set(PlatUser::getOrgPath, TreeConst.TOP_LEVEL+","+tenantId)
.eq(BaseEntity::getId, platUserId);
this.update(updateWrapper);
}
......
......@@ -11,9 +11,12 @@ import com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.module.iot.vo.DeviceProperties;
import com.makeit.vo.platform.device.PlatDeviceListVO;
import com.makeit.vo.platform.device.PlatDeviceViewVO;
import java.util.List;
/**
* <p>
* 设备 服务类
......@@ -55,4 +58,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
void saasEdit(PlatDeviceEditSaasDTO dto);
void editDeviceProperties(PlatDeviceAttrWechatDTO dto);
List<DeviceProperties> readDeviceProperties(PlatDeviceAttrWechatDTO dto);
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.makeit.common.dto.BaseTenantDTO;
import com.makeit.common.entity.BaseBusEntity;
import com.makeit.common.entity.BaseEntity;
......@@ -25,6 +26,7 @@ import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException;
import com.makeit.mapper.platform.device.PlatDeviceMapper;
import com.makeit.module.iot.service.IotDevicePropertiesOperateService;
import com.makeit.module.iot.vo.DeviceProperties;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.device.PlatDeviceOtherService;
import com.makeit.service.platform.device.PlatDeviceService;
......@@ -244,6 +246,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
deviceCacheUtil.put(db);
other.setOriDeviceId(db.getOriDeviceId());
platDeviceOtherService.saveOrUpdate(other);
}
......@@ -284,4 +287,21 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
devicePropertiesOperateService.deviceWrite(dto.getDeviceId(),dto.getRadarMount(),dto.getRadarMode(),dto.getRadarHight());
}
@Override
public List<DeviceProperties> readDeviceProperties(PlatDeviceAttrWechatDTO dto) {
List<DeviceProperties> devicePropertiesList = Lists.newArrayList();
if (StringUtils.isNotEmpty(dto.getReadProperties())) {
String[] propertiesArr = dto.getReadProperties().split(",");
for (String s : propertiesArr) {
DeviceProperties deviceProperties = devicePropertiesOperateService.deviceRead(dto.getDeviceId(), s);
if (deviceProperties != null) {
deviceProperties.setProperty(s);
devicePropertiesList.add(deviceProperties);
}
}
}
return devicePropertiesList;
}
}
......@@ -366,6 +366,9 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
vo.setX(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setY(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setDistance(i.getProperties().getDistance());
vo.setAngle(i.getProperties().getAngle());
return vo;
})
......
......@@ -186,9 +186,13 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
voList = StreamUtil.map(deviceInfoContentSpaceList, e -> {
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
vo.setX(new BigDecimal(e.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(e.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setY(new BigDecimal(e.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(e.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setDistance(e.getProperties().getDistance());
vo.setAngle(e.getProperties().getAngle());
return vo;
});
......
......@@ -14,6 +14,7 @@ import com.makeit.dto.platform.elder.PlatElderCheckOutDTO;
import com.makeit.dto.platform.elder.PlatElderImportDTO;
import com.makeit.dto.platform.elder.PlatElderQueryDTO;
import com.makeit.dto.platform.elder.add.*;
import com.makeit.dto.platform.space.PlatSpaceSplitDTO;
import com.makeit.dto.platform.space.TreeDTOVO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.device.PlatDevice;
......@@ -29,7 +30,6 @@ import com.makeit.enums.CommonEnum;
import com.makeit.enums.FileSuffixEnum;
import com.makeit.enums.id.TreeConst;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.mapper.platform.elder.PlatElderMapper;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.elder.*;
......@@ -206,6 +206,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
}
vo.setId(e.getId());
vo.setRemark(e.getRemark());
return vo;
});
......@@ -457,6 +458,20 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
if (errorVoList.isEmpty()) {
List<PlatElder> platElderList = BeanDtoVoUtils.listVo(list, PlatElder.class);
platElderList.forEach(e -> {
List<String> spaceIdList = new ArrayList<>(Arrays.asList(e.getStreetSpaceId(), e.getBuildingSpaceId(), e.getUnitSpaceId(), e.getFloorSpaceId()));
List<String> newSpaceIdList = new ArrayList<>(spaceIdList);
Collections.reverse(newSpaceIdList);
e.setSpaceId(newSpaceIdList.stream().filter(StringUtils::isNotBlank).findFirst().orElse(null));
spaceIdList.add(e.getRoomId());
spaceIdList.add(e.getBedId());
e.setSpacePath(spaceIdList.stream().filter(StringUtils::isNotBlank).collect(Collectors.joining(",")));
});
PlatUserVO platUserVO = PlatUserUtil.getUserVO();
platElderList.forEach(e -> {
......@@ -492,6 +507,25 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
}
private void fillSpace(PlatElder platElder) {
if (StringUtils.isBlank(platElder.getBedId())) {
return;
}
PlatSpaceSplitDTO platSpaceSplitDTO = platSpaceService.getSpaceSplitVO(platElder.getBedId());
platElder.setSpaceId(platSpaceSplitDTO.getSpaceId());
platElder.setStreetSpaceId(platSpaceSplitDTO.getStreetSpaceId());
platElder.setBuildingSpaceId(platSpaceSplitDTO.getBuildingSpaceId());
platElder.setUnitSpaceId(platSpaceSplitDTO.getUnitSpaceId());
platElder.setFloorSpaceId(platSpaceSplitDTO.getFloorSpaceId());
platElder.setRoomId(platSpaceSplitDTO.getRoomId());
//platElder.setBedId();
platElder.setSpacePath(platSpaceSplitDTO.getSpacePath());
}
@Override
@Transactional
public void add(PlatElderAddDTO dto) {
......@@ -500,6 +534,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElder platElder = BeanDtoVoUtils.convert(dto, PlatElder.class);
fillSpace(platElder);
PlatUserVO userVO = PlatUserUtil.getUserVO();
platElder.setOrgId(userVO.getOrgId());
......@@ -523,6 +559,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElder platElder = BeanDtoVoUtils.convert(dto, PlatElder.class);
fillSpace(platElder);
PlatUserVO userVO = PlatUserUtil.getUserVO();
platElder.setOrgId(userVO.getOrgId());
......@@ -602,6 +640,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElder platElder = BeanDtoVoUtils.convert(dto, PlatElder.class);
fillSpace(platElder);
updateById(platElder);
addOrEditExt(dto);
......@@ -698,6 +738,8 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElder db = getById(dto.getId());
BeanUtils.copyProperties(dto, db);
fillSpace(db);
db.setCheckInTime(LocalDateTime.now());
updateById(db);
......
......@@ -5,6 +5,7 @@ import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.vo.ExcelImportVo;
import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceSplitDTO;
import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.vo.platform.space.PlatSpaceAndRoomVO;
......@@ -61,6 +62,8 @@ public interface PlatSpaceService extends IService<PlatSpace> {
*/
List<PlatSpaceVO> treeByBed(PlatSpaceQueryDTO dto);
PlatSpaceSplitDTO getSpaceSplitVO(String bedId);
List<PlatSpace> listChild(List<String> spaceIds);
List<PlatSpaceAddDTO> oneLevelList(BaseIdDTO dto);
......@@ -74,7 +77,7 @@ public interface PlatSpaceService extends IService<PlatSpace> {
* @param excelFile
* @return
*/
public ExcelImportVo importSpaceExcel(MultipartFile excelFile);
ExcelImportVo importSpaceExcel(MultipartFile excelFile);
List<PlatSpaceVO> parentListTree(PlatSpaceQueryDTO dto);
}
......@@ -21,6 +21,7 @@ import com.makeit.service.platform.space.PlatBedService;
import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.TreeUtil;
import com.makeit.utils.data.excel.ExcelUtil;
import com.makeit.utils.user.TokenUtil;
import com.makeit.utils.user.plat.PlatUserUtil;
......@@ -37,6 +38,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
/**
......@@ -54,18 +56,18 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
@Autowired
private PlatOrgService platOrgService;
private void check(PlatSpaceAddDTO dto){
private void check(PlatSpaceAddDTO dto) {
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatSpace::getName,dto.getName());
queryWrapper.ne(StringUtil.isNotEmpty(dto.getId()), PlatSpace::getId,dto.getId());
queryWrapper.eq(PlatSpace::getName, dto.getName());
queryWrapper.ne(StringUtil.isNotEmpty(dto.getId()), PlatSpace::getId, dto.getId());
if(StringUtil.isEmpty(dto.getParentId())){
if (StringUtil.isEmpty(dto.getParentId())) {
queryWrapper.isNull(PlatSpace::getParentId);
}else{
queryWrapper.eq(PlatSpace::getParentId,dto.getParentId());
} else {
queryWrapper.eq(PlatSpace::getParentId, dto.getParentId());
}
if(this.count(queryWrapper) > 0){
if (this.count(queryWrapper) > 0) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NAME_DUPLICATE);
}
}
......@@ -76,17 +78,17 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public void add(PlatSpaceAddDTO dto) {
check(dto);
PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class);
if(StringUtil.isEmpty(dto.getParentId())){
if (StringUtil.isEmpty(dto.getParentId())) {
PlatUserVO userVO = PlatUserUtil.getUserVOCanNull();
if(StringUtil.isEmpty(userVO.getOrgId())){
if (StringUtil.isEmpty(userVO.getOrgId())) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_USER_NOT_ADD);
}
space.setOrgId(userVO.getOrgId());
PlatOrg org = platOrgService.getById(space.getOrgId());
if(org!=null){
if (org != null) {
space.setAttribute(org.getType());
}
}else {
} else {
//上级空间
PlatSpace parentSpace = getById(dto.getParentId());
space.setOrgId(parentSpace.getOrgId());
......@@ -112,7 +114,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//上级空间
PlatSpace parentSpace = this.getById(dto.getParentId());
if(parentSpace!=null && parentSpace.getParentPath().contains(dto.getId())){
if (parentSpace!=null && parentSpace.getParentPath().contains(dto.getId())) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_DEL);
}
......@@ -124,14 +126,14 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public void del(String id) {
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatSpace::getParentId,id);
if(count(queryWrapper) > 0){
queryWrapper.eq(PlatSpace::getParentId, id);
if (count(queryWrapper) > 0) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_DEL);
}
LambdaQueryWrapper<PlatRoom> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(PlatRoom::getSpaceId,id);
if(platRoomService.count(queryWrapper1) > 0){
queryWrapper1.eq(PlatRoom::getSpaceId, id);
if (platRoomService.count(queryWrapper1) > 0) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_DEL);
}
......@@ -142,26 +144,26 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public List<PlatSpaceVO> tree(PlatSpaceQueryDTO dto) {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
if (orgs.isEmpty()) {
return new ArrayList<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()),PlatSpace::getName,dto.getName());
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatSpace::getName, dto.getName());
queryWrapper.in(PlatSpace::getOrgId, orgIds);
List<PlatSpace> list = this.list(queryWrapper);
//父级
List<PlatSpace> listParent = list.stream().filter(item->StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
List<PlatSpace> listParent = list.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
//子集
List<PlatSpace> listChild = list.stream().filter(item->item.getParentId() != null).collect(Collectors.toList());
Map<String,List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpace> listChild = list.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
Map<String, List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpaceVO> data = new ArrayList<>();
for(PlatSpace space:listParent){
for (PlatSpace space : listParent) {
PlatSpaceVO vo = convertToVO(space);
vo = child(vo,map);
vo = child(vo, map);
data.add(vo);
}
return data;
......@@ -170,7 +172,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
@Override
public PlatSpaceAddDTO view(String id) {
PlatSpace space = getById(id);
PlatSpaceAddDTO data = BeanDtoVoUtils.convert(space,PlatSpaceAddDTO.class);
PlatSpaceAddDTO data = BeanDtoVoUtils.convert(space, PlatSpaceAddDTO.class);
return data;
}
......@@ -191,10 +193,10 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
LambdaQueryWrapper<PlatBed> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(PlatBed::getStatus, CommonEnum.YES.getValue());
List<PlatBed> listBeds = platBedService.list(queryWrapper1);
Map<String,List<PlatBed>> mapBed = listBeds.stream().collect(Collectors.groupingBy(PlatBed::getRoomId));
Map<String, List<PlatBed>> mapBed = listBeds.stream().collect(Collectors.groupingBy(PlatBed::getRoomId));
List<PlatSpaceVO> listRoomVo = new ArrayList<>();
listRoom.forEach(item->{
listRoom.forEach(item -> {
PlatSpaceVO vo = new PlatSpaceVO();
vo.setId(item.getId());
vo.setName(item.getName());
......@@ -202,7 +204,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
listRoomVo.add(vo);
});
listBeds.forEach(item->{
listBeds.forEach(item -> {
PlatSpaceVO vo = new PlatSpaceVO();
vo.setId(item.getId());
vo.setName(item.getName());
......@@ -211,25 +213,25 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
});
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()),PlatSpace::getName,dto.getName());
queryWrapper.eq(StringUtil.isNotEmpty(userVO.getOrgId()),PlatSpace::getOrgId,userVO.getOrgId());
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatSpace::getName, dto.getName());
queryWrapper.eq(StringUtil.isNotEmpty(userVO.getOrgId()), PlatSpace::getOrgId, userVO.getOrgId());
List<PlatSpace> list = this.list(queryWrapper);
List<PlatSpaceVO> listSpaceVo = BeanDtoVoUtils.listVo(list,PlatSpaceVO.class);
List<PlatSpaceVO> listSpaceVo = BeanDtoVoUtils.listVo(list, PlatSpaceVO.class);
listSpaceVo.addAll(listRoomVo);
//父级
List<PlatSpaceVO> listParent = listSpaceVo.stream().filter(item->StringUtil.isEmpty(item.getParentId())).
List<PlatSpaceVO> listParent = listSpaceVo.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).
collect(Collectors.toList());
//子集
List<PlatSpaceVO> listChild = listSpaceVo.stream().filter(item->item.getParentId() != null).collect(Collectors.toList());
Map<String,List<PlatSpaceVO>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpaceVO::getParentId));
List<PlatSpaceVO> listChild = listSpaceVo.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
Map<String, List<PlatSpaceVO>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpaceVO::getParentId));
List<PlatSpaceVO> data = new ArrayList<>();
for(PlatSpaceVO space:listParent){
for (PlatSpaceVO space : listParent) {
space = childVo(space,map);
space = childVo(space, map);
data.add(space);
}
return data;
......@@ -237,6 +239,39 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
}
@Override
public PlatSpaceSplitDTO getSpaceSplitVO(String bedId) {
PlatBed platBed = platBedService.getById(bedId);
PlatRoom platRoom = platRoomService.getById(platBed.getRoomId());
PlatSpace platSpace = getById(platRoom.getSpaceId());
PlatSpaceSplitDTO platSpaceSplitDTO = new PlatSpaceSplitDTO();
platSpaceSplitDTO.setSpaceId(platSpace.getId());
List<BiConsumer<PlatSpaceSplitDTO, String>> list = Arrays.asList(
PlatSpaceSplitDTO::setStreetSpaceId,
PlatSpaceSplitDTO::setBuildingSpaceId,
PlatSpaceSplitDTO::setUnitSpaceId,
PlatSpaceSplitDTO::setFloorSpaceId
);
String[] split = TreeUtil.path(platSpace.getParentPath(), Arrays.asList(platSpace.getId())).split(",");
for (int i = 0; i < split.length; i++) {
BiConsumer<PlatSpaceSplitDTO, String> e = list.get(i);
e.accept(platSpaceSplitDTO, split[i]);
}
platSpaceSplitDTO.setRoomId(platRoom.getId());
platSpaceSplitDTO.setBedId(platBed.getId());
platSpaceSplitDTO.setSpacePath(TreeUtil.path(platSpace.getParentPath(), Arrays.asList(
platSpace.getId(),
platRoom.getId(),
platBed.getId()
)));
return platSpaceSplitDTO;
}
@Override
public List<PlatSpace> listChild(List<String> spaceIds) {
return baseMapper.listChild(spaceIds);
......@@ -251,7 +286,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
return BeanDtoVoUtils.listVo(spaces, PlatSpaceAddDTO.class);
}
private PlatSpaceVO childVo(PlatSpaceVO vo,Map<String,List<PlatSpaceVO>> map) {
private PlatSpaceVO childVo(PlatSpaceVO vo, Map<String, List<PlatSpaceVO>> map) {
if (!map.containsKey(vo.getId())) {
return vo;
......@@ -269,17 +304,17 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
@Override
public PlatSpaceVO child(PlatSpaceVO vo,Map<String,List<PlatSpace>> map){
public PlatSpaceVO child(PlatSpaceVO vo, Map<String, List<PlatSpace>> map) {
if(!map.containsKey(vo.getId())){
if (!map.containsKey(vo.getId())) {
return vo;
}
List<PlatSpace> list = map.get(vo.getId());
List<PlatSpaceVO> listChild = new ArrayList<>();
for(PlatSpace item:list){
for (PlatSpace item : list) {
PlatSpaceVO dto = convertToVO(item);
this.child(dto,map);
this.child(dto, map);
listChild.add(dto);
}
vo.setChildren(listChild);
......@@ -287,7 +322,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
}
@Override
public PlatSpaceVO convertToVO(PlatSpace space){
public PlatSpaceVO convertToVO(PlatSpace space) {
PlatSpaceVO vo = new PlatSpaceVO();
vo.setName(space.getName());
......@@ -306,18 +341,18 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
try {
List<PlatSpace> listPlatSpace = list(new LambdaQueryWrapper<>());
List<PlatSpace> firstSpace = listPlatSpace.stream().filter(item->item.getParentId() == null).collect(Collectors.toList());
Map<String,String> firstSpaceNameMap = firstSpace.stream().collect(Collectors.toMap(PlatSpace::getName,PlatSpace::getId,(k1,k2)->k1));
List<PlatSpace> firstSpace = listPlatSpace.stream().filter(item -> item.getParentId() == null).collect(Collectors.toList());
Map<String, String> firstSpaceNameMap = firstSpace.stream().collect(Collectors.toMap(PlatSpace::getName, PlatSpace::getId, (k1, k2) -> k1));
List<PlatSpace> listChildren = listPlatSpace.stream().filter(item->item.getParentId() != null).collect(Collectors.toList());
Map<String,List<PlatSpace>> childrenMap = listChildren.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
Map<String,String> childrenIdMap = listChildren.stream().collect(Collectors.toMap(item->item.getParentId()+item.getName(),item->item.getId(),(k1,k2)->k1));
List<PlatSpace> listChildren = listPlatSpace.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
Map<String, List<PlatSpace>> childrenMap = listChildren.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
Map<String, String> childrenIdMap = listChildren.stream().collect(Collectors.toMap(item -> item.getParentId() + item.getName(), item -> item.getId(), (k1, k2) -> k1));
List<PlatSpaceImportDTO> list = ExcelUtil.importExcel(null,3,excelFile,PlatSpaceImportDTO.class);
List<PlatSpaceImportDTO> list = ExcelUtil.importExcel(null, 3, excelFile, PlatSpaceImportDTO.class);
List<ExcelErrorVo> errorVoList = new ArrayList<>(10);
List<String> excelField = Arrays.asList("一级*","二级","三级","四级","房间名*","床位数量");
List<String> excelField = Arrays.asList("一级*", "二级", "三级", "四级", "房间名*", "床位数量");
int startRow = 3;
......@@ -332,77 +367,77 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
Integer errorCount = 0;
Integer successCount = 0;
boolean errorFlag = false;
for(int i=0;i<list.size();i++){
for (int i = 0; i < list.size(); i++) {
PlatSpaceImportDTO item = list.get(i);
if(StringUtil.isEmpty(item.getCommunity())){
errorVoList.add(new ExcelErrorVo(i+3,excelField.get(0),"第一层级必填"));
if (StringUtil.isEmpty(item.getCommunity())) {
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(0), "第一层级必填"));
errorFlag = true;
}
if(StringUtil.isEmpty(item.getRoomName())){
errorVoList.add(new ExcelErrorVo(i+3,excelField.get(4),"房间名必填"));
if (StringUtil.isEmpty(item.getRoomName())) {
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(4), "房间名必填"));
errorFlag = true;
}
String key = item.getCommunity();
//第二层级
if(StringUtil.isNotEmpty(item.getBuilding())){
if (StringUtil.isNotEmpty(item.getBuilding())) {
key = key + "-" + item.getBuilding();
}
//第三层级
if(StringUtil.isNotEmpty(item.getUnit())){
if (StringUtil.isNotEmpty(item.getUnit())) {
key = key + "-" + item.getUnit();
}
//第四层级
if(StringUtil.isNotEmpty(item.getFloor())){
if (StringUtil.isNotEmpty(item.getFloor())) {
key = key + "-" + item.getFloor();
}
if(listKey.contains(key)){
errorVoList.add(new ExcelErrorVo(i+3,excelField.get(0),"该空间下,房间名已存在"));
if (listKey.contains(key)) {
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(0), "该空间下,房间名已存在"));
errorFlag = true;
}
if(errorFlag){
if (errorFlag) {
errorCount++;
}else{
} else {
successCount++;
}
}
String orgId = TokenUtil.getTntUserDetail().getOrgId();
if(errorVoList.isEmpty()){
if (errorVoList.isEmpty()) {
for(int i=0;i<list.size();i++){
for (int i = 0; i < list.size(); i++) {
PlatSpaceImportDTO item = list.get(i);
String spacePath = null;
//第一层级
String firstId = null;
if(!firstSpaceNameMap.containsKey(item.getCommunity())){
if (!firstSpaceNameMap.containsKey(item.getCommunity())) {
PlatSpace platSpace = new PlatSpace();
platSpace.setName(item.getCommunity());
platSpace.setType(PlatSpaceEnum.TypeEnum.COMMUNITY.getValue());
platSpace.setOrgId(orgId);
save(platSpace);
firstSpaceNameMap.put(platSpace.getName(),platSpace.getId());
firstSpaceNameMap.put(platSpace.getName(), platSpace.getId());
firstId = platSpace.getId();
spacePath = firstId;
}else{
} else {
firstId = firstSpaceNameMap.get(item.getCommunity());
}
//第二层级
String secondId = null;
if(StringUtil.isNotEmpty(item.getBuilding())){
if (StringUtil.isNotEmpty(item.getBuilding())) {
String secondKey = firstId + "-" + item.getBuilding();
if(!childrenIdMap.containsKey(secondKey)){
if (!childrenIdMap.containsKey(secondKey)) {
PlatSpace platSpace = new PlatSpace();
platSpace.setName(item.getBuilding());
platSpace.setType(PlatSpaceEnum.TypeEnum.BUILDING.getValue());
......@@ -410,9 +445,9 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
platSpace.setParentId(firstId);
platSpace.setParentPath(firstId);
save(platSpace);
childrenIdMap.put(secondKey,platSpace.getId());
childrenIdMap.put(secondKey, platSpace.getId());
secondId = platSpace.getId();
}else{
} else {
secondId = childrenIdMap.get(secondKey);
}
spacePath = spacePath + "," + secondId;
......@@ -420,20 +455,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//第三级
String threeId = null;
if(StringUtil.isNotEmpty(item.getUnit())){
if (StringUtil.isNotEmpty(item.getUnit())) {
String threeKey = secondId + "-" + item.getUnit();
if(!childrenIdMap.containsKey(threeKey)){
if (!childrenIdMap.containsKey(threeKey)) {
PlatSpace platSpace = new PlatSpace();
platSpace.setName(item.getBuilding());
platSpace.setType(PlatSpaceEnum.TypeEnum.UNIT.getValue());
platSpace.setOrgId(orgId);
platSpace.setParentId(secondId);
platSpace.setParentPath(firstId+","+secondId);
platSpace.setParentPath(firstId + "," + secondId);
save(platSpace);
childrenIdMap.put(threeKey,platSpace.getId());
childrenIdMap.put(threeKey, platSpace.getId());
threeId = platSpace.getId();
}else{
} else {
threeId = childrenIdMap.get(threeKey);
}
spacePath = spacePath + "," + threeId;
......@@ -441,20 +476,20 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//第四级
String fourId = null;
if(StringUtil.isNotEmpty(item.getFloor())){
if (StringUtil.isNotEmpty(item.getFloor())) {
String fourKey = threeId + "-" + item.getFloor();
if(!childrenIdMap.containsKey(fourKey)){
if (!childrenIdMap.containsKey(fourKey)) {
PlatSpace platSpace = new PlatSpace();
platSpace.setName(item.getBuilding());
platSpace.setType(PlatSpaceEnum.TypeEnum.FLOOR.getValue());
platSpace.setOrgId(orgId);
platSpace.setParentId(threeId);
platSpace.setParentPath(firstId+","+secondId + "," + threeId);
platSpace.setParentPath(firstId + "," + secondId + "," + threeId);
save(platSpace);
childrenIdMap.put(fourKey,platSpace.getId());
childrenIdMap.put(fourKey, platSpace.getId());
fourId = platSpace.getId();
}else{
} else {
fourId = childrenIdMap.get(fourKey);
}
spacePath = spacePath + "," + fourId;
......@@ -465,13 +500,13 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
platRoomDTO.setName(item.getRoomName());
platRoomDTO.setBedNumber(item.getBedNumber());
String spaceId = null;
if(firstId != null){
if (firstId != null) {
spaceId = firstId;
}else if(secondId != null){
} else if (secondId != null) {
spaceId = secondId;
}else if(threeId != null){
} else if (threeId != null) {
spaceId = threeId;
}else if(fourId != null){
} else if (fourId != null) {
spaceId = fourId;
}
platRoomDTO.setSpaceId(spaceId);
......@@ -484,7 +519,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
excelImportVo.setSuccessCount(successCount);
excelImportVo.setList(errorVoList);
return excelImportVo;
}catch (Exception e){
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.printStackTrace();
}
......@@ -496,7 +531,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public List<PlatSpaceVO> parentListTree(PlatSpaceQueryDTO dto) {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
if (orgs.isEmpty()) {
return new ArrayList<>();
}
//房间
......@@ -505,27 +540,27 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()),PlatSpace::getName,dto.getName());
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatSpace::getName, dto.getName());
queryWrapper.in(PlatSpace::getOrgId, orgIds);
if(!spaceIds.isEmpty()){
if (!spaceIds.isEmpty()) {
queryWrapper.notIn(PlatSpace::getId, spaceIds);
}
List<PlatSpace> list = this.list(queryWrapper);
list = list.stream()
.filter(s->(StringUtil.isNotEmpty(s.getParentPath()) && s.getParentPath().split(",").length < 3)
|| StringUtil.isEmpty(s.getParentPath()))
.filter(s -> (StringUtil.isNotEmpty(s.getParentPath()) && s.getParentPath().split(",").length < 3)
|| StringUtil.isEmpty(s.getParentPath()))
.collect(Collectors.toList());
//父级
List<PlatSpace> listParent = list.stream().filter(item->StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
List<PlatSpace> listParent = list.stream().filter(item -> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
//子集
List<PlatSpace> listChild = list.stream().filter(item->item.getParentId() != null).collect(Collectors.toList());
Map<String,List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpace> listChild = list.stream().filter(item -> item.getParentId() != null).collect(Collectors.toList());
Map<String, List<PlatSpace>> map = listChild.stream().collect(Collectors.groupingBy(PlatSpace::getParentId));
List<PlatSpaceVO> data = new ArrayList<>();
for(PlatSpace space:listParent){
for (PlatSpace space : listParent) {
PlatSpaceVO vo = convertToVO(space);
vo = child(vo,map);
vo = child(vo, map);
data.add(vo);
}
return data;
......@@ -533,3 +568,5 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
}
......@@ -15,6 +15,7 @@ import com.makeit.entity.saas.PlatTenantMenu;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.IsTenantAccountEnum;
import com.makeit.enums.id.TreeConst;
import com.makeit.enums.redis.RedisConst;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
......@@ -315,9 +316,9 @@ public class PlatTenantServiceImpl extends ServiceImpl<PlatTenantMapper, PlatTen
platOrg.setName(platTenant.getName());
platOrg.setStatus(platTenant.getStatus());
platOrg.setId(platTenant.getId());
platOrg.setPath("1");
platOrg.setPath(TreeConst.TOP_LEVEL);
//租户没有父级
platOrg.setParentId("1");
platOrg.setParentId(TreeConst.TOP_LEVEL);
return platOrg;
}
......
package com.makeit.service.wechat.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.dto.platform.auth.PlatOrgSplitDTO;
import com.makeit.entity.platform.elder.PlatElderChildrenInfo;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.elder.PlatElderChildrenInfoService;
import com.makeit.service.wechat.PlatElderChildrenInfoUserLoginWechatService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
......@@ -24,6 +26,9 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde
@Autowired
private PlatElderChildrenInfoService platElderChildrenInfoService;
@Autowired
private PlatOrgService platOrgService;
@Override
@Transactional
public WechatUserInfo login(WechatLoginPhoneDTO dto) {
......@@ -34,8 +39,19 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde
.eq(PlatElderChildrenInfo::getOpenid, userInfo.getOpenId()));
if (childrenInfo == null) {
childrenInfo = new PlatElderChildrenInfo();
childrenInfo.setOpenid(userInfo.getOpenId());
childrenInfo.setName(userInfo.getNickName());
PlatOrgSplitDTO vo = platOrgService.getOrgSplitVO(dto.getOrgId());
childrenInfo = new PlatElderChildrenInfo();
childrenInfo.setCityOrgId(vo.getCityOrgId());
childrenInfo.setDistrictOrgId(vo.getDistrictOrgId());
childrenInfo.setStreetOrgId(vo.getStreetOrgId());
childrenInfo.setOrgPath(vo.getOrgPath());
}
childrenInfo.setPhone(userInfo.getPhoneNumber());
......
......@@ -33,6 +33,7 @@ public class PlatAlarmRecordVO extends BaseTenantDTO {
private String alarmType;
@ApiModelProperty(value = "告警时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime alarmDate;
@ApiModelProperty(value = "状态 0 待处理 1 已处理")
......
......@@ -14,4 +14,11 @@ public class PlatElderCoordinateVO {
@ApiModelProperty("y")
private BigDecimal y;
@ApiModelProperty("人体目标距离雷达位置 范围:0-1000,单位cm")
private Integer distance;
@ApiModelProperty("人体目标偏离雷达法线角度范围:±60,单位°")
private Integer angle;
}
......@@ -11,6 +11,7 @@
from plat_user_role pur
left join plat_role pr on pur.role_id = pr.id
<where>
pur.del_flag = 0
<if test="userIdList != null and userIdList.size()>0">
AND pur.user_id IN
<foreach collection="userIdList" item="item" separator="," open="(" close=")" index="">
......
......@@ -3,11 +3,13 @@ package com.makeit;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@EnableAsync
@ServletComponentScan
@MapperScan(basePackages = {"com.makeit.**.mapper"})
//@SpringBootApplication(scanBasePackages = {"com.makeit"})
@SpringBootApplication
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment