diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 97e9bb8..42cc14b 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -157,22 +157,20 @@ // 项目信息 Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); - List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); // 设备信息 DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); - deviceInfoQueryRequest.setProjectCodeList(projectCodeList); - + deviceInfoQueryRequest.setUserId(request.getUserId()); List projectStatisticDetailList= deviceInfoService.statistic(deviceInfoQueryRequest); // 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); - monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); + monitoringWarnRecordQueryRequest.setUserId(request.getUserId()); List historyMonitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); - deviceMonitoringDataRealtimeQueryRequest.setProjectCodeList(projectCodeList); + deviceMonitoringDataRealtimeQueryRequest.setUserId(request.getUserId()); deviceMonitoringDataRealtimeQueryRequest.setYesnoant(EExistsAnt.True.getCode()); List realtimeMonitoringWarnStatisticsList = deviceMonitoringDataRealtimeService.statistics(deviceMonitoringDataRealtimeQueryRequest); diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 97e9bb8..42cc14b 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -157,22 +157,20 @@ // 项目信息 Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); - List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); // 设备信息 DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); - deviceInfoQueryRequest.setProjectCodeList(projectCodeList); - + deviceInfoQueryRequest.setUserId(request.getUserId()); List projectStatisticDetailList= deviceInfoService.statistic(deviceInfoQueryRequest); // 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); - monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); + monitoringWarnRecordQueryRequest.setUserId(request.getUserId()); List historyMonitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); - deviceMonitoringDataRealtimeQueryRequest.setProjectCodeList(projectCodeList); + deviceMonitoringDataRealtimeQueryRequest.setUserId(request.getUserId()); deviceMonitoringDataRealtimeQueryRequest.setYesnoant(EExistsAnt.True.getCode()); List realtimeMonitoringWarnStatisticsList = deviceMonitoringDataRealtimeService.statistics(deviceMonitoringDataRealtimeQueryRequest); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java index 66e2517..339a964 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java @@ -195,14 +195,20 @@ BeanUtils.copyProperties(deviceMonitoringData, deviceMonitoringDataRealtime); deviceMonitoringDataRealtimeService.updateById(deviceMonitoringDataRealtime); - // 添加告警记录 - monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); - // 上传荆楚平台 jingchuExecutorService.execute(() -> jingChuUpload(existedDeviceMonitoringData, dataDto.getYesnoant())); if(EExistsAnt.True.getCode().equals(dataDto.getYesnoant())){ - smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getSn())); + smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getLocation())); + + // 添加告警记录 + monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); + + if(null == deviceInfo.getFirstWarnDatetime()){ + deviceInfo.setFirstWarnDatetime(existedDeviceMonitoringData.getUptime()); + deviceInfoService.updateById(deviceInfo); + } + } return url; diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 97e9bb8..42cc14b 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -157,22 +157,20 @@ // 项目信息 Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); - List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); // 设备信息 DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); - deviceInfoQueryRequest.setProjectCodeList(projectCodeList); - + deviceInfoQueryRequest.setUserId(request.getUserId()); List projectStatisticDetailList= deviceInfoService.statistic(deviceInfoQueryRequest); // 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); - monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); + monitoringWarnRecordQueryRequest.setUserId(request.getUserId()); List historyMonitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); - deviceMonitoringDataRealtimeQueryRequest.setProjectCodeList(projectCodeList); + deviceMonitoringDataRealtimeQueryRequest.setUserId(request.getUserId()); deviceMonitoringDataRealtimeQueryRequest.setYesnoant(EExistsAnt.True.getCode()); List realtimeMonitoringWarnStatisticsList = deviceMonitoringDataRealtimeService.statistics(deviceMonitoringDataRealtimeQueryRequest); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java index 66e2517..339a964 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java @@ -195,14 +195,20 @@ BeanUtils.copyProperties(deviceMonitoringData, deviceMonitoringDataRealtime); deviceMonitoringDataRealtimeService.updateById(deviceMonitoringDataRealtime); - // 添加告警记录 - monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); - // 上传荆楚平台 jingchuExecutorService.execute(() -> jingChuUpload(existedDeviceMonitoringData, dataDto.getYesnoant())); if(EExistsAnt.True.getCode().equals(dataDto.getYesnoant())){ - smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getSn())); + smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getLocation())); + + // 添加告警记录 + monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); + + if(null == deviceInfo.getFirstWarnDatetime()){ + deviceInfo.setFirstWarnDatetime(existedDeviceMonitoringData.getUptime()); + deviceInfoService.updateById(deviceInfo); + } + } return url; diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml index c47db09..e9eb461 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml @@ -80,6 +80,9 @@ and t.first_warn_datetime is not null + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -90,6 +93,7 @@ left join ter_project_info tpi on t.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml index c58f6f4..2af53b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml @@ -53,6 +53,9 @@ and t.yesnoant = #{request.yesnoant} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -64,6 +67,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml index c58f6f4..2af53b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml @@ -53,6 +53,9 @@ and t.yesnoant = #{request.yesnoant} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -64,6 +67,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 97e9bb8..42cc14b 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -157,22 +157,20 @@ // 项目信息 Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); - List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); // 设备信息 DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); - deviceInfoQueryRequest.setProjectCodeList(projectCodeList); - + deviceInfoQueryRequest.setUserId(request.getUserId()); List projectStatisticDetailList= deviceInfoService.statistic(deviceInfoQueryRequest); // 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); - monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); + monitoringWarnRecordQueryRequest.setUserId(request.getUserId()); List historyMonitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); - deviceMonitoringDataRealtimeQueryRequest.setProjectCodeList(projectCodeList); + deviceMonitoringDataRealtimeQueryRequest.setUserId(request.getUserId()); deviceMonitoringDataRealtimeQueryRequest.setYesnoant(EExistsAnt.True.getCode()); List realtimeMonitoringWarnStatisticsList = deviceMonitoringDataRealtimeService.statistics(deviceMonitoringDataRealtimeQueryRequest); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java index 66e2517..339a964 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java @@ -195,14 +195,20 @@ BeanUtils.copyProperties(deviceMonitoringData, deviceMonitoringDataRealtime); deviceMonitoringDataRealtimeService.updateById(deviceMonitoringDataRealtime); - // 添加告警记录 - monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); - // 上传荆楚平台 jingchuExecutorService.execute(() -> jingChuUpload(existedDeviceMonitoringData, dataDto.getYesnoant())); if(EExistsAnt.True.getCode().equals(dataDto.getYesnoant())){ - smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getSn())); + smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getLocation())); + + // 添加告警记录 + monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); + + if(null == deviceInfo.getFirstWarnDatetime()){ + deviceInfo.setFirstWarnDatetime(existedDeviceMonitoringData.getUptime()); + deviceInfoService.updateById(deviceInfo); + } + } return url; diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml index c47db09..e9eb461 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml @@ -80,6 +80,9 @@ and t.first_warn_datetime is not null + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -90,6 +93,7 @@ left join ter_project_info tpi on t.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml index 0ebea88..3cdc137 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml @@ -71,6 +71,9 @@ and t.status = #{request.status} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -82,6 +85,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml index c58f6f4..2af53b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml @@ -53,6 +53,9 @@ and t.yesnoant = #{request.yesnoant} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -64,6 +67,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml index 55c112a..895808a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml @@ -49,7 +49,7 @@ - and date_format(t.create_time,'%y-%m-%d') = #{request.date} + and date_format(t.create_time,'%Y-%m-%d') = #{request.date} diff --git a/newfiber-termites/newfiber-termites-package/pom.xml b/newfiber-termites/newfiber-termites-package/pom.xml index 0351eb1..aa41af1 100644 --- a/newfiber-termites/newfiber-termites-package/pom.xml +++ b/newfiber-termites/newfiber-termites-package/pom.xml @@ -24,6 +24,12 @@ newfiber-termites-dataup + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 97e9bb8..42cc14b 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -157,22 +157,20 @@ // 项目信息 Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); - List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); // 设备信息 DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); - deviceInfoQueryRequest.setProjectCodeList(projectCodeList); - + deviceInfoQueryRequest.setUserId(request.getUserId()); List projectStatisticDetailList= deviceInfoService.statistic(deviceInfoQueryRequest); // 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); - monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); + monitoringWarnRecordQueryRequest.setUserId(request.getUserId()); List historyMonitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); - deviceMonitoringDataRealtimeQueryRequest.setProjectCodeList(projectCodeList); + deviceMonitoringDataRealtimeQueryRequest.setUserId(request.getUserId()); deviceMonitoringDataRealtimeQueryRequest.setYesnoant(EExistsAnt.True.getCode()); List realtimeMonitoringWarnStatisticsList = deviceMonitoringDataRealtimeService.statistics(deviceMonitoringDataRealtimeQueryRequest); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java index 66e2517..339a964 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java @@ -195,14 +195,20 @@ BeanUtils.copyProperties(deviceMonitoringData, deviceMonitoringDataRealtime); deviceMonitoringDataRealtimeService.updateById(deviceMonitoringDataRealtime); - // 添加告警记录 - monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); - // 上传荆楚平台 jingchuExecutorService.execute(() -> jingChuUpload(existedDeviceMonitoringData, dataDto.getYesnoant())); if(EExistsAnt.True.getCode().equals(dataDto.getYesnoant())){ - smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getSn())); + smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getLocation())); + + // 添加告警记录 + monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); + + if(null == deviceInfo.getFirstWarnDatetime()){ + deviceInfo.setFirstWarnDatetime(existedDeviceMonitoringData.getUptime()); + deviceInfoService.updateById(deviceInfo); + } + } return url; diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml index c47db09..e9eb461 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml @@ -80,6 +80,9 @@ and t.first_warn_datetime is not null + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -90,6 +93,7 @@ left join ter_project_info tpi on t.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml index 0ebea88..3cdc137 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml @@ -71,6 +71,9 @@ and t.status = #{request.status} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -82,6 +85,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml index c58f6f4..2af53b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataRealtimeMapper.xml @@ -53,6 +53,9 @@ and t.yesnoant = #{request.yesnoant} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -64,6 +67,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml index 55c112a..895808a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/SmsRecordMapper.xml @@ -49,7 +49,7 @@ - and date_format(t.create_time,'%y-%m-%d') = #{request.date} + and date_format(t.create_time,'%Y-%m-%d') = #{request.date} diff --git a/newfiber-termites/newfiber-termites-package/pom.xml b/newfiber-termites/newfiber-termites-package/pom.xml index 0351eb1..aa41af1 100644 --- a/newfiber-termites/newfiber-termites-package/pom.xml +++ b/newfiber-termites/newfiber-termites-package/pom.xml @@ -24,6 +24,12 @@ newfiber-termites-dataup + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-package/src/main/java/com/newfiber/termite/NewfiberTermiteApplication.java b/newfiber-termites/newfiber-termites-package/src/main/java/com/newfiber/termite/NewfiberTermiteApplication.java index 436c002..3a23264 100644 --- a/newfiber-termites/newfiber-termites-package/src/main/java/com/newfiber/termite/NewfiberTermiteApplication.java +++ b/newfiber-termites/newfiber-termites-package/src/main/java/com/newfiber/termite/NewfiberTermiteApplication.java @@ -14,7 +14,7 @@ @EnableCustomConfig @EnableCustomSwagger2 @EnableCustomFeignClients -@SpringBootApplication(scanBasePackages = {"com.newfiber.termite", "com.newfiber.business"}) +@SpringBootApplication(scanBasePackages = {"com.newfiber.termite", "com.newfiber.system.api"}) public class NewfiberTermiteApplication { public static void main(String[] args){ // SpringApplication.run(NewfiberDrainageApplication.class, args); diff --git a/newfiber-termites/newfiber-termites-package/src/test/java/CommonTest.java b/newfiber-termites/newfiber-termites-package/src/test/java/CommonTest.java index 56b0f90..07dbb1d 100644 --- a/newfiber-termites/newfiber-termites-package/src/test/java/CommonTest.java +++ b/newfiber-termites/newfiber-termites-package/src/test/java/CommonTest.java @@ -4,17 +4,23 @@ import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSONObject; +import com.newfiber.common.core.constant.SecurityConstants; +import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.file.FileUtils; +import com.newfiber.common.core.utils.uuid.IdUtils; import com.newfiber.termite.domain.jingchu.JingChuUpload; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; import com.newfiber.termite.util.CosUtil; +import io.jsonwebtoken.Claims; import java.awt.Color; import java.awt.Font; import java.awt.Image; import java.io.File; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.springframework.web.multipart.MultipartFile; @@ -77,4 +83,27 @@ DeviceInfoStateSyncRequest request = JSONObject.parseObject(str, DeviceInfoStateSyncRequest.class); System.out.println(1); } + + @Test + public void jwtTest(){ + Map claimsMap = new HashMap(); + claimsMap.put(SecurityConstants.USER_KEY, IdUtils.fastUUID()); + claimsMap.put(SecurityConstants.DETAILS_USER_ID, 1); + claimsMap.put(SecurityConstants.DETAILS_USERNAME, "admin"); + + // 接口返回信息 + Map rspMap = new HashMap(); + rspMap.put("access_token", JwtUtils.createToken(claimsMap)); + rspMap.put("expires_in", 1); + + System.out.println(rspMap.get("access_token")); + } + + @Test + public void checkToken(){ + Claims claims = JwtUtils.parseToken("eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjJkNWVlNTM1LWViMDAtNGE3My05ZjY5LWE3YmJhZjY5ZDBhOCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.lNVhnljLEsJKQCtvWazCDpWHDPKCshz6XUgAnpVkCbN0fwM3wZ_wU3aKl8YS3ravoZ1ifW7MVFArphDaQeIAQg"); + + System.out.println("1"); + } + } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java index 00e0ecc..a5969a3 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/RemoteSmsService.java @@ -1,8 +1,8 @@ package com.newfiber.system.api; import com.newfiber.common.core.constant.ServiceNameConstants; -import com.newfiber.common.core.domain.R; -import com.newfiber.system.api.factory.RemoteUserFallbackFactory; +import com.newfiber.common.core.web.domain.Result; +import com.newfiber.system.api.factory.RemoteSmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -12,7 +12,7 @@ * * @author newfiber */ -@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) +@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class) public interface RemoteSmsService { /** @@ -22,5 +22,5 @@ * @param phones 手机号集合 */ @PostMapping("/sms/endpoint/send-message") - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + Result sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); } diff --git a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java index 4b1b16b..199f154 100644 --- a/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java +++ b/newfiber-api/newfiber-api-system/src/main/java/com/newfiber/system/api/factory/RemoteSmsFallbackFactory.java @@ -1,6 +1,6 @@ package com.newfiber.system.api.factory; -import com.newfiber.common.core.domain.R; +import com.newfiber.common.core.web.domain.Result; import com.newfiber.system.api.RemoteSmsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ log.error("短信服务调用失败:{}", throwable.getMessage()); return new RemoteSmsService(){ @Override - public R sendMessage(String code, String params, String phones) { - return R.fail("发送短信失败:" + throwable.getMessage()); + public Result sendMessage(String code, String params, String phones) { + return Result.error("发送短信失败:" + throwable.getMessage()); } }; } diff --git a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java index 158ab98..9954b85 100644 --- a/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java +++ b/newfiber-common/newfiber-common-security/src/main/java/com/newfiber/common/security/service/TokenService.java @@ -40,7 +40,7 @@ /** * 创建令牌 */ - public Map createToken(LoginUser loginUser){ + public Map createToken(LoginUser loginUser, String clientType){ String token = IdUtils.fastUUID(); Long userId = loginUser.getSysUser().getUserId(); String userName = loginUser.getSysUser().getUserName(); diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java index 4b2fb83..539a3ec 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/controller/TokenController.java @@ -1,8 +1,5 @@ package com.newfiber.system.controller; -import com.newfiber.system.domain.auth.LoginBody; -import com.newfiber.system.domain.auth.RegisterBody; -import com.newfiber.system.service.impl.SysLoginService; import com.newfiber.common.core.domain.R; import com.newfiber.common.core.utils.JwtUtils; import com.newfiber.common.core.utils.StringUtils; @@ -10,6 +7,9 @@ import com.newfiber.common.security.service.TokenService; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.system.api.model.LoginUser; +import com.newfiber.system.domain.auth.LoginBody; +import com.newfiber.system.domain.auth.RegisterBody; +import com.newfiber.system.service.impl.SysLoginService; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; @@ -35,7 +35,7 @@ // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); // 获取登录token - return R.ok(tokenService.createToken(userInfo)); + return R.ok(tokenService.createToken(userInfo, form.getClientType())); } @DeleteMapping("logout") diff --git a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java index f658811..d70e1cc 100644 --- a/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java +++ b/newfiber-system/newfiber-system-core/src/main/java/com/newfiber/system/domain/auth/LoginBody.java @@ -16,6 +16,11 @@ */ private String password; + /** + * APP / WEB + */ + private String clientType; + public String getUsername(){ return username; } @@ -31,4 +36,12 @@ public void setPassword(String password){ this.password = password; } + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } } diff --git a/newfiber-termites/newfiber-termites-dataup/pom.xml b/newfiber-termites/newfiber-termites-dataup/pom.xml index 1611366..b6f172b 100644 --- a/newfiber-termites/newfiber-termites-dataup/pom.xml +++ b/newfiber-termites/newfiber-termites-dataup/pom.xml @@ -33,6 +33,12 @@ 5.6.213 + + + com.newfiber + newfiber-api-system + + diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 6b73c03..872489f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -28,7 +28,6 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; -import javax.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -56,7 +55,7 @@ @PostMapping("/termiteDataup") //@RequiresPermissions("business:warningBriefing:list") @ApiOperation(value = "白蚁防治数据接收", position = 60) - public Result termiteDataup(@Valid @RequestBody TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ + public Result termiteDataup(TermiteDataUpRequest dataDto, MultipartFile image) throws Exception{ return success(termiteService.termiteDataup(dataDto,image)); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java index 381c1e8..dd7957f 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceMonitoringDataRealtime/DeviceMonitoringDataRealtimeQueryRequest.java @@ -52,5 +52,11 @@ @ApiModelProperty(value = "是否加热(1是 | 2否)") private String heating; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java index c1fb126..73319d1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/monitoringWarnRecord/MonitoringWarnRecordQueryRequest.java @@ -58,5 +58,11 @@ @ApiModelProperty(value = "") private String status; + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + private List projectCodeList; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java index d78a468..f1d8541 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -1,11 +1,8 @@ package com.newfiber.termite.domain.request.statistic; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * * @author X.K @@ -20,11 +17,4 @@ @ApiModelProperty(value = "用户编号") private Long userId; - - /** - * 累计告警统计 - */ - @ApiModelProperty(value = "累计告警统计") - private List warnListInfo; - } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java index 9fe52c5..6b81289 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/enums/EExistsAnt.java @@ -1,6 +1,5 @@ package com.newfiber.termite.enums; -import com.newfiber.common.core.exception.ServiceException; import lombok.AllArgsConstructor; import lombok.Getter; @@ -19,4 +18,4 @@ private final String code; private final String value; -} +} \ No newline at end of file diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java index 4ba3ffc..f68c88a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/SmsRecordServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.newfiber.common.core.domain.R; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; @@ -76,7 +75,7 @@ SmsRecord smsRecord = selectDetail(smsRecordQueryRequest); // 今日已发送,则不用再发 - if(null == smsRecord){ + if(null != smsRecord){ continue; } @@ -88,7 +87,7 @@ Map params = new HashMap<>(); params.put("1", projectInfo.getProjectName()); params.put("2", sn); - R r = remoteSmsService.sendMessage("2271932", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); + Object r = remoteSmsService.sendMessage("TermiteWarn", JSONObject.toJSONString(params), StringUtils.join(confirmSmsNotifyPhoneList, ',')); saveBatch(smsRecordList); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 97e9bb8..42cc14b 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -157,22 +157,20 @@ // 项目信息 Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); - List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); // 设备信息 DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); - deviceInfoQueryRequest.setProjectCodeList(projectCodeList); - + deviceInfoQueryRequest.setUserId(request.getUserId()); List projectStatisticDetailList= deviceInfoService.statistic(deviceInfoQueryRequest); // 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); - monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); + monitoringWarnRecordQueryRequest.setUserId(request.getUserId()); List historyMonitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); - deviceMonitoringDataRealtimeQueryRequest.setProjectCodeList(projectCodeList); + deviceMonitoringDataRealtimeQueryRequest.setUserId(request.getUserId()); deviceMonitoringDataRealtimeQueryRequest.setYesnoant(EExistsAnt.True.getCode()); List realtimeMonitoringWarnStatisticsList = deviceMonitoringDataRealtimeService.statistics(deviceMonitoringDataRealtimeQueryRequest); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java index 66e2517..339a964 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/TermiteServiceImpl.java @@ -195,14 +195,20 @@ BeanUtils.copyProperties(deviceMonitoringData, deviceMonitoringDataRealtime); deviceMonitoringDataRealtimeService.updateById(deviceMonitoringDataRealtime); - // 添加告警记录 - monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); - // 上传荆楚平台 jingchuExecutorService.execute(() -> jingChuUpload(existedDeviceMonitoringData, dataDto.getYesnoant())); if(EExistsAnt.True.getCode().equals(dataDto.getYesnoant())){ - smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getSn())); + smsExecutorService.execute(() -> smsRecordService.send(deviceInfo.getProjectCode(), deviceInfo.getLocation())); + + // 添加告警记录 + monitoringWarnRecordService.insert(deviceMonitoringDataRealtime, existedDeviceMonitoringData); + + if(null == deviceInfo.getFirstWarnDatetime()){ + deviceInfo.setFirstWarnDatetime(existedDeviceMonitoringData.getUptime()); + deviceInfoService.updateById(deviceInfo); + } + } return url; diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml index c47db09..e9eb461 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml @@ -80,6 +80,9 @@ and t.first_warn_datetime is not null + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -90,6 +93,7 @@ left join ter_project_info tpi on t.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml index 0ebea88..3cdc137 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml @@ -71,6 +71,9 @@ and t.status = #{request.status} + + and pu.user_id = #{request.userId} + and tpi.project_code in @@ -82,6 +85,7 @@ left join ter_device_info di on t.sn = di.sn left join ter_project_info tpi on di.project_code = tpi.project_code + left join ter_project_user pu on tpi.project_code = pu.project_code