1.灿能云接口移植
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
package com.njcn.cloud.controller.information;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
||||
import com.njcn.cloud.service.user.IAppEventInfoService;
|
||||
import com.njcn.cloud.service.user.IAppEventMsgService;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 暂态消息业务层
|
||||
* @author: denghuajun
|
||||
* @time: 2019-10-17 14:33:55
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/eventmsg")
|
||||
@Api(tags = "暂态消息接口")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EventMsgController extends BaseController {
|
||||
|
||||
private final IAppEventMsgService eventMsgService;
|
||||
private final IAppEventInfoService eventInfoService;
|
||||
|
||||
/**
|
||||
* 暂态消息获取
|
||||
*/
|
||||
@PostMapping("/eventDetailList")
|
||||
@ApiOperation(value = "暂态消息获取入口", notes = "暂态消息")
|
||||
public HttpResult<Page<EventMsgDetailVO>> eventDetailList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailList");
|
||||
if (StrUtil.isBlank(param.getSearchValue())) {
|
||||
throw new BusinessException(EventMsgCodeEnum.USERID_WRONG.getMsg());
|
||||
}
|
||||
Page<EventMsgDetailVO> page = eventMsgService.eventMsgPage(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂态事件基本信息获取
|
||||
*/
|
||||
@PostMapping("/eventDetailBaseInfo")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "eventMsgIndex", value = "暂态消息id", required = true, paramType = "query"),
|
||||
})
|
||||
@ApiOperation(value = "暂态事件基本信息入口", notes = "暂态事件基本信息")
|
||||
public HttpResult<EventInfoDetailVO> eventDetailBaseInfo(String eventMsgIndex) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailBaseInfo");
|
||||
if (StrUtil.isBlank(eventMsgIndex)) {
|
||||
throw new BusinessException(EventMsgCodeEnum.eventDetailIndex_WRONG.getMsg());
|
||||
}
|
||||
EventInfoDetailVO eventInfoList = eventMsgService.eventInfoDetail(eventMsgIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventInfoList, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂态事件特征幅值
|
||||
*/
|
||||
@PostMapping("/eventDetailEigenvalue")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "eventDetailIndex", value = "暂降事件id", required = true, paramType = "query"),
|
||||
})
|
||||
@ApiOperation(value = "暂态事件特征幅值入口", notes = "暂态事件特征幅值")
|
||||
public HttpResult<EventEigDetailVO.Detail> eventDetailEigenvalue(String eventDetailIndex) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailEigenvalue");
|
||||
if (StrUtil.isBlank(eventDetailIndex)) {
|
||||
throw new BusinessException(EventMsgCodeEnum.eventDetailIndex_WRONG.getMsg());
|
||||
}
|
||||
EventEigDetailVO.Detail detail = eventInfoService.eventDetailEigenvalue(eventDetailIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, detail, methodDescribe);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂态事件波形图
|
||||
*/
|
||||
@PostMapping("/eventDetailWave")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "eventDetailIndex", value = "暂降事件id", required = true, paramType = "query"),
|
||||
})
|
||||
@ApiOperation(value = "暂态事件波形图入口", notes = "暂态事件波形图")
|
||||
public HttpResult<EventWaveDetailVO> eventDetailWave(String eventDetailIndex) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailWave");
|
||||
if (StrUtil.isBlank(eventDetailIndex)) {
|
||||
throw new BusinessException(EventMsgCodeEnum.eventDetailIndex_WRONG.getMsg());
|
||||
}
|
||||
EventWaveDetailVO vo = eventInfoService.eventDetailWave(eventDetailIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂态评价
|
||||
*/
|
||||
@PostMapping("/eventDetailEvaluate")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "eventDetailIndex", value = "暂降事件id", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "evaluate", value = "暂态评价", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query"),
|
||||
})
|
||||
@ApiOperation(value = "暂态评价入口", notes = "暂态评价获取")
|
||||
public HttpResult<Boolean> eventDetailEvaluate(String eventDetailIndex, int evaluate, String userId) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailEvaluate");
|
||||
if (StrUtil.isBlank(eventDetailIndex)) {
|
||||
throw new BusinessException(EventMsgCodeEnum.eventDetailIndex_WRONG.getMsg());
|
||||
}
|
||||
Boolean aBoolean = eventInfoService.eventDetailEvaluate(eventDetailIndex, evaluate, userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, aBoolean, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.njcn.cloud.controller.information;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||
import com.njcn.cloud.pojo.vo.AppSteadyMsgVO;
|
||||
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
||||
import com.njcn.cloud.service.user.IAppSteadyMsgService;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @description: 稳态消息详情业务层
|
||||
* @author: gbl
|
||||
* @time: 2019-11-27
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/steadymsg")
|
||||
@Api(tags = "稳态消息接口")
|
||||
@RequiredArgsConstructor
|
||||
public class SteadyMsgController extends BaseController {
|
||||
|
||||
private final IAppSteadyMsgService steadyAssService;
|
||||
|
||||
/**
|
||||
* @Description: 稳态越限列表
|
||||
* @param param
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<com.njcn.cloud.pojo.vo.AppSteadyMsgVO>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 15:02
|
||||
*/
|
||||
@PostMapping("steadyState")
|
||||
@ApiOperation(value = "稳态越限列表", notes = "稳态越限列表")
|
||||
public HttpResult<AppSteadyMsgVO> steadyState(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailList");
|
||||
if (StrUtil.isBlank(param.getSearchValue())) {
|
||||
throw new BusinessException(EventMsgCodeEnum.USERID_WRONG.getMsg());
|
||||
}
|
||||
AppSteadyMsgVO steadyState = steadyAssService.getSteadyState(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, steadyState, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 稳态越限列表详细信息
|
||||
* @param steadyIndex 稳态越限列表ID
|
||||
* @return:
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 15:02
|
||||
*/
|
||||
@PostMapping("steadyStateInfo")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "steadyIndex", value = "稳态越限列表ID", required = true, paramType = "query")
|
||||
})
|
||||
@ApiOperation(value = "稳态越限列表详细信息", notes = "稳态越限详细信息")
|
||||
public HttpResult<List<SteadyMsgDetailVO>> steadyStateInfo(String steadyIndex) {
|
||||
String methodDescribe = getMethodDescribe("steadyStateInfo");
|
||||
List<SteadyMsgDetailVO> steadyDetail = steadyAssService.getSteadyDetail(steadyIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, steadyDetail, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 稳态越限涉及指标
|
||||
* @param lineIndex
|
||||
* @param timeID
|
||||
* @return: ResponseData
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 16:23
|
||||
*/
|
||||
@PostMapping("/steadyTarget")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "lineIndex", value = "监测点ID", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "timeID", value = "统计时间", required = true, paramType = "query")
|
||||
})
|
||||
@ApiOperation(value = "稳态越限涉及指标", notes = "稳态越限指标")
|
||||
public HttpResult<List<SteadyTargetVO>> steadyTarget(String lineIndex,String timeID) {
|
||||
String methodDescribe = getMethodDescribe("steadyTarget");
|
||||
List<SteadyTargetVO> steadyTarget = steadyAssService.getSteadyTarget(lineIndex, timeID);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, steadyTarget, methodDescribe);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 稳态越限指标图形
|
||||
* @param lineIndex
|
||||
* @param timeID
|
||||
* @param typeCode
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<java.util.List<com.njcn.cloud.pojo.vo.SteadyTargetVO>>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 16:25
|
||||
*/
|
||||
@PostMapping("/steadyTargetUrl")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "lineIndex", value = "监测点ID", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "timeID", value = "统计时间", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "typeCode", value = "指标编码", required = true, paramType = "query")
|
||||
})
|
||||
@ApiOperation(value = "稳态越限指标图形", notes = "稳态越限图形")
|
||||
public HttpResult<AppSteadyUrl> steadyTargetUrl(String lineIndex,String timeID,Integer typeCode) {
|
||||
String methodDescribe = getMethodDescribe("steadyTargetUrl");
|
||||
AppSteadyUrl steadyTargetUrl = steadyAssService.getSteadyTargetUrl(lineIndex, timeID, typeCode);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, steadyTargetUrl, methodDescribe);
|
||||
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * @description: 生成稳态越限指标图形
|
||||
// * @author gbl
|
||||
// * @param lineIndex 监测点ID
|
||||
// * @param timeID 统计时间
|
||||
// * @param typeCode
|
||||
// */
|
||||
// @PostMapping("steadyImage")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "lineIndex", value = "监测点ID", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "timeID", value = "统计时间", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "typeCode", value = "指标编码", required = true, paramType = "query")
|
||||
// })
|
||||
// @ApiOperation(value = "生成稳态越限指标图形", notes = "稳态越限图形", response = ResponseData.class)
|
||||
// public ResponseData steadyImage(int lineIndex,Long timeID,int typeCode, HttpServletRequest request) {
|
||||
// ResponseData responseData = new ResponseData();
|
||||
//
|
||||
// try {
|
||||
// SteadyUrl msgs = new SteadyUrl();
|
||||
// String dateTime = PubUtils.timeStamp3Date(timeID,"");
|
||||
// Date time = PubUtils.string2Date(dateTime, "yyyy-MM-dd");
|
||||
// msgs = steadyAssService.getUrl(request,lineIndex,time,typeCode);
|
||||
//
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS,SteadyMsgCodeEnum.GETTARGET_SUCCESS.getCode(), SteadyMsgCodeEnum.GETTARGET_SUCCESS.getMsg(), msgs);
|
||||
// } catch (Exception e) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL,SteadyMsgCodeEnum.GETTARGET_FALL.getCode(), SteadyMsgCodeEnum.GETTARGET_FALL.getMsg(), null);
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.cloud.controller.report;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||
import com.njcn.cloud.service.user.IAppReportService;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/report")
|
||||
@Api(tags = "报告查询接口")
|
||||
@RequiredArgsConstructor
|
||||
public class ShiningReportController extends BaseController {
|
||||
private final IAppReportService shiningReportService;
|
||||
|
||||
|
||||
@PostMapping("/eventDetailReportApply")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query")
|
||||
, @ApiImplicitParam(name = "eventDetailIndex", value = "暂降事件ID", required = true, paramType = "query")})
|
||||
@ApiOperation(value = "暂降事件报告申请入口", notes = "暂降事件报告申请")
|
||||
public HttpResult<String> eventDetailReportApply(@RequestParam("userId") String userId, @RequestParam("eventDetailIndex") String eventDetailIndex) throws Exception {
|
||||
String methodDescribe = getMethodDescribe("eventDetailReportApply");
|
||||
if (StrUtil.isBlank(eventDetailIndex) && StrUtil.isBlank(userId)) {
|
||||
throw new BusinessException(EventMsgCodeEnum.eventDetailIndex_WRONG.getMsg());
|
||||
}
|
||||
String result = shiningReportService.eventDetailReportApply(userId, eventDetailIndex);
|
||||
if ("2".equals(result)) {
|
||||
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTAPPLY_NODATA.getMsg());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/eventDetailReportDownLoad")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query")
|
||||
, @ApiImplicitParam(name = "eventDetailIndex", value = "暂降事件ID", required = true, paramType = "query")})
|
||||
@ApiOperation(value = "暂降事件报告下载入口", notes = "暂降事件报告下载")
|
||||
public HttpResult<String> eventDetailReportDownLoad(@RequestParam("userId") String userId, @RequestParam("eventDetailIndex") String eventDetailIndex) {
|
||||
String methodDescribe = getMethodDescribe("eventDetailReportDownLoad");
|
||||
AppEventInfo downLoadPath = shiningReportService.getDownLoadPath(userId, eventDetailIndex);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, downLoadPath.getReportPath(), methodDescribe);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,594 @@
|
||||
package com.njcn.cloud.controller.user;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||
import com.njcn.cloud.pojo.vo.UserVO;
|
||||
import com.njcn.cloud.service.user.IAppUserService;
|
||||
import com.njcn.cloud.utils.AESUtil;
|
||||
import com.njcn.cloud.utils.RedisDB;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @date: 2019/9/19 18:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@Api(tags = "用户操作接口")
|
||||
@RequiredArgsConstructor
|
||||
public class UserController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||
|
||||
private final IAppUserService appUserService;
|
||||
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* 获取(登录、注册、忘记密码、重新绑定手机)验证码
|
||||
*/
|
||||
@PostMapping("authCode")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "type", value = "验证码类型", required = true, paramType = "query"),
|
||||
})
|
||||
@ApiOperation(value = "获取验证码", notes = "获取验证码")
|
||||
public HttpResult<Boolean> authCode(String phone, String devCode, String type, HttpServletRequest request) {
|
||||
//判断是否为黑客攻击
|
||||
// if (judgeAttachInterface(devCode, request, phone)) {
|
||||
// return HttpResultUtil.assembleResult(UserCodeEnum.SEND_CODE_FAIL.getCode()+"", null, UserCodeEnum.SEND_CODE_FAIL.getMsg());
|
||||
// }
|
||||
System.out.println("获取验证码的请求信息,手机号:" + phone + ",设备码为:" + devCode);
|
||||
try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
appUserService.setMessage(phone, devCode, type);
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.SEND_CODE_SUCCESS.getCode()+"", null, UserCodeEnum.SEND_CODE_SUCCESS.getMsg());
|
||||
} catch (Exception e) {
|
||||
logger.error("发送短信异常,异常为:" + e.getMessage());
|
||||
if (e.getMessage().length() < 10) {
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.getCodeByMsg(e.getMessage())+"", null, e.getMessage());
|
||||
} else {
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.SEND_CODE_FAIL.getCode()+"", null, UserCodeEnum.SEND_CODE_FAIL.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机app登录入口
|
||||
*/
|
||||
@PostMapping("login")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "type", value = "登录类型", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "key", value = "验证码/密码", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
})
|
||||
@ApiOperation(value = "登录入口", notes = "APP登录")
|
||||
public HttpResult<UserVO> login(String phone, String type, String key, String devCode, HttpServletRequest request) {
|
||||
|
||||
if (StringUtils.isBlank(key)) {
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.KEY_WRONG.getCode()+"", null, UserCodeEnum.KEY_WRONG.getMsg());
|
||||
}
|
||||
if (StringUtils.isBlank(devCode)) {
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.DEVCODE_WRONG.getCode()+"", null, UserCodeEnum.DEVCODE_WRONG.getMsg());
|
||||
}
|
||||
UserVO userResult = new UserVO();
|
||||
logger.info("controller更新手机id:" + devCode);
|
||||
try {
|
||||
devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// TokenManager.appLogin(phone, type, key, devCode, ProjectEnum.APP.getItem());
|
||||
// AppUser appUser = (AppUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// userResult.setPhone(appUser.getPhone());
|
||||
// userResult.setRoleCode(appUser.getUserLevel());
|
||||
// userResult.setUserName(StringUtils.isEmpty(appUser.getName()) ? null : appUser.getName());
|
||||
// userResult.setRoleName(UserLevelEnum.getMsgByCode(appUser.getUserLevel()));
|
||||
// userResult.setUserId(appUser.getUserIndex());
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.LOGIN_SUCCESS.getCode()+"", userResult, UserCodeEnum.LOGIN_SUCCESS.getMsg());
|
||||
} catch (Exception e) {
|
||||
logger.error("app用户登录异常:" + e.toString());
|
||||
if (e.getMessage().length() < 10) {
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.getCodeByMsg(e.getMessage())+"", null, e.getMessage());
|
||||
} else {
|
||||
return HttpResultUtil.assembleResult(UserCodeEnum.LOGIN_FAIL.getCode()+"", null, UserCodeEnum.LOGIN_FAIL.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 判断当前请求是否为黑客攻击
|
||||
* @author hongawen
|
||||
* @date 2023/8/25 11:07
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean judgeAttachInterface(String devCode, HttpServletRequest request, String phone) {
|
||||
boolean flag = false;
|
||||
//针对设备码
|
||||
if (judgeDevCode(devCode)) {
|
||||
flag = true;
|
||||
//判断手机号是否在黑名单
|
||||
} else if (judgeSmsPhone(phone)) {
|
||||
flag = true;
|
||||
//针对ip限制,避免盗刷
|
||||
} else if (judgeRequestIp(request)) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/***
|
||||
* 紧急处理,后期app需要加上滑块移动验证
|
||||
* @author hongawen
|
||||
* 加上设备码限制,
|
||||
* 如果同一设备码72小时内超过6次,则立即返回
|
||||
* 如果72小时内超过30次,则彻底封杀该设备码
|
||||
*/
|
||||
private boolean judgeDevCode(String devCode) {
|
||||
boolean flag = true;
|
||||
String valueByPhone = redisUtil.getStringByKey(RedisDB.CODE_DB,RedisDB.SMS_DEV_CODE.concat(devCode));
|
||||
int times = StrUtil.isBlank(valueByPhone) ? 0 : Integer.parseInt(valueByPhone);
|
||||
times++;
|
||||
if (times < 6) {
|
||||
//合理范围内,缓存
|
||||
flag = false;
|
||||
redisUtil.saveByKeyWithExpire(RedisDB.CODE_DB, RedisDB.SMS_DEV_CODE.concat(devCode), String.valueOf(times), RedisDB.THREE_DAYS);
|
||||
} else if (times < 30) {
|
||||
redisUtil.saveByKeyWithExpire(RedisDB.CODE_DB, RedisDB.SMS_DEV_CODE.concat(devCode), String.valueOf(times), RedisDB.THREE_DAYS);
|
||||
} else {
|
||||
redisUtil.saveByKeyWithExpire(RedisDB.CODE_DB, RedisDB.SMS_DEV_CODE.concat(devCode), String.valueOf(times), -1);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
testFloop(i);
|
||||
}
|
||||
}
|
||||
|
||||
private static void testFloop(int i) {
|
||||
i++;
|
||||
if (i < 6) {
|
||||
System.out.println(i);
|
||||
} else if (i > 30) {
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 判断手机号是否在黑名单
|
||||
* @author hongawen
|
||||
* @date 2023/8/24 20:06
|
||||
* @param phone 手机号
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean judgeSmsPhone(String phone) {
|
||||
String valueByPhone = redisUtil.getStringByKey(RedisDB.CODE_DB, RedisDB.SMS_PHONE.concat(phone));
|
||||
return !StrUtil.isBlank(valueByPhone);
|
||||
}
|
||||
|
||||
/***
|
||||
* 紧急处理,后期app需要加上滑块移动验证
|
||||
* @author hongawen
|
||||
* 加上ip限制,
|
||||
* 如果同一ip72小时内超过6次,则立即返回
|
||||
* 如果72小时内超过30次,则彻底封杀该ip
|
||||
*/
|
||||
private boolean judgeRequestIp(HttpServletRequest request) {
|
||||
boolean flag = true;
|
||||
//获取过来的ip可能有多个,通过','分割后,取第一个,并且仅仅关心ip的前两个数据范围xxx.xxx.*.*;
|
||||
String clientIpAddress = RequestUtil.getRealIp(request);
|
||||
String ip = RedisDB.SMS_IP + clientIpAddress;
|
||||
String ipValue = redisUtil.getStringByKey(RedisDB.CODE_DB, ip);
|
||||
int times = StrUtil.isBlank(ipValue) ? 0 : Integer.parseInt(ipValue);
|
||||
logger.error("{}来获取短信验证码,最近72小时内,已经请求了{}次", ip, times);
|
||||
times++;
|
||||
if (times < 6) {
|
||||
//合理范围内,缓存
|
||||
flag = false;
|
||||
redisUtil.saveByKeyWithExpire(RedisDB.CODE_DB, ip, String.valueOf(times), RedisDB.THREE_DAYS);
|
||||
} else if (times < 30) {
|
||||
redisUtil.saveByKeyWithExpire(RedisDB.CODE_DB, ip, String.valueOf(times), RedisDB.THREE_DAYS);
|
||||
}else {
|
||||
redisUtil.saveByKeyWithExpire(RedisDB.CODE_DB, ip, String.valueOf(times), -1);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/***
|
||||
* 查找ip前2个255详细信息
|
||||
* @author hongawen
|
||||
* @date 2023/8/25 9:59
|
||||
* @return int
|
||||
*/
|
||||
public static int findNthCharacterIndex(String input, char targetChar, int n) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
if (input.charAt(i) == targetChar) {
|
||||
count++;
|
||||
if (count == n) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 手机app注册
|
||||
// */
|
||||
// @PostMapping("register")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "注册入口", notes = "用户注册", response = ResponseData.class)
|
||||
// public ResponseData register(String phone, String code, String devCode) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (!PubUtils.patternPhone(XssFilterUtil.dealString(phone))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PHONE_WRONG.getCode(), UserCodeEnum.PHONE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (StringUtils.isBlank(devCode)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.DEVCODE_WRONG.getCode(), UserCodeEnum.DEVCODE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// UserResult userResult;
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// userResult = appUserService.register(phone, code, devCode);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.REGIST_SUCCESS.getCode(), UserCodeEnum.REGIST_SUCCESS.getMsg(), userResult);
|
||||
// } catch (Exception e) {
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.REGIST_FAIL.getCode(), UserCodeEnum.REGIST_FAIL.getMsg(), null);
|
||||
// }
|
||||
// logger.error("app用户注册异常:" + e.toString());
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 手机app密码设置
|
||||
// */
|
||||
// @PostMapping("setPsd")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "userId", value = "用户索引", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "设置密码", notes = "设置密码", response = ResponseData.class)
|
||||
// public ResponseData setPsd(String userId, String password, String devCode) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (StringUtils.isBlank(userId)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.USERID_WRONG.getCode(), UserCodeEnum.USERID_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (!PubUtils.patternPasswordPhone(XssFilterUtil.dealString(password))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PASSWORD_WRONG.getCode(), UserCodeEnum.PASSWORD_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (StringUtils.isBlank(devCode)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.DEVCODE_WRONG.getCode(), UserCodeEnum.DEVCODE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// appUserService.setPsd(userId, devCode, password);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.SETPWD_SUCCESS.getCode(), UserCodeEnum.SETPWD_SUCCESS.getMsg(), null);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("app用户设置密码异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.SETPWD_FAIL.getCode(), UserCodeEnum.SETPWD_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 手机app登录入口
|
||||
// */
|
||||
// @PostMapping("login")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "type", value = "登录类型", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "key", value = "验证码/密码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "登录入口", notes = "APP登录", response = ResponseData.class)
|
||||
// public ResponseData login(String phone, String type, String key, String devCode, HttpServletRequest request) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (!PubUtils.patternPhone(XssFilterUtil.dealString(phone))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PHONE_WRONG.getCode(), UserCodeEnum.PHONE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (StringUtils.isBlank(key)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.KEY_WRONG.getCode(), UserCodeEnum.KEY_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (StringUtils.isBlank(devCode)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.DEVCODE_WRONG.getCode(), UserCodeEnum.DEVCODE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// UserResult userResult = new UserResult();
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// TokenManager.appLogin(phone, type, key, devCode, ProjectEnum.APP.getItem());
|
||||
// AppUser appUser = (AppUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// userResult.setPhone(appUser.getPhone());
|
||||
// userResult.setRoleCode(appUser.getUserLevel());
|
||||
// userResult.setUserName(StringUtils.isEmpty(appUser.getName()) ? null : appUser.getName());
|
||||
// userResult.setRoleName(UserLevelEnum.getMsgByCode(appUser.getUserLevel()));
|
||||
// userResult.setUserId(appUser.getUserIndex());
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.LOGIN_SUCCESS.getCode(), UserCodeEnum.LOGIN_SUCCESS.getMsg(), userResult);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("app用户登录异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.LOGIN_FAIL.getCode(), UserCodeEnum.LOGIN_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 手机app忘记密码-重置密码
|
||||
// */
|
||||
// @PostMapping("resetPsd")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "重置密码", notes = "重置密码", response = ResponseData.class)
|
||||
// public ResponseData resetPsd(String phone, String code, String password, String devCode) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (!PubUtils.patternPhone(XssFilterUtil.dealString(phone))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PHONE_WRONG.getCode(), UserCodeEnum.PHONE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (!PubUtils.patternPasswordPhone(XssFilterUtil.dealString(password))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PASSWORD_WRONG.getCode(), UserCodeEnum.PASSWORD_WRONG.getMsg(), null);
|
||||
// }
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// appUserService.resetPsd(phone, code, password, devCode);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.RESETPWD_SUCCESS.getCode(), UserCodeEnum.RESETPWD_SUCCESS.getMsg(), null);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("忘记密码重置密码异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.RESETPWD_FAIL.getCode(), UserCodeEnum.RESETPWD_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 手机app已登录修改密码
|
||||
// */
|
||||
// @PostMapping("modifyPsd")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "修改密码", notes = "修改密码", response = ResponseData.class)
|
||||
// public ResponseData modifyPsd(String userId, String phone, String code, String password, String devCode) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (!PubUtils.patternPasswordPhone(XssFilterUtil.dealString(password))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PASSWORD_WRONG.getCode(), UserCodeEnum.PASSWORD_WRONG.getMsg(), null);
|
||||
// }
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// appUserService.modifyPsd(userId, phone, code, password, devCode);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.RESETPWD_SUCCESS.getCode(), UserCodeEnum.RESETPWD_SUCCESS.getMsg(), null);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("修改密码异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.RESETPWD_FAIL.getCode(), UserCodeEnum.RESETPWD_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 手机app角色升级
|
||||
// */
|
||||
// @PostMapping("roleUpdate")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "referralCode", value = "推荐码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "角色升级", notes = "角色升级", response = ResponseData.class)
|
||||
// public ResponseData roleUpdate(String userId, String referralCode, String devCode) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (StringUtils.isEmpty(referralCode)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.REFERRAL_CODE_ERROR.getCode(), UserCodeEnum.REFERRAL_CODE_ERROR.getMsg(), null);
|
||||
// }
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// UserResult userResult;
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// userResult = appUserService.roleUpdate(userId, referralCode, devCode);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.UPDATE_ROLE_SUCCESS.getCode(), UserCodeEnum.UPDATE_ROLE_SUCCESS.getMsg(), userResult);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("角色升级异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.UPDATE_ROLE_FAIL.getCode(), UserCodeEnum.UPDATE_ROLE_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 手机app确认旧手机验证码
|
||||
// */
|
||||
// @PostMapping("comfirmCode")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "phone", value = "手机号码号码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "code", value = "短信验证码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "确认旧手机验证码", notes = "确认旧手机验证码", response = ResponseData.class)
|
||||
// public ResponseData comfirmCode(String phone, String devCode, String code) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (!PubUtils.patternPhone(XssFilterUtil.dealString(phone))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PHONE_WRONG.getCode(), UserCodeEnum.PHONE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (StringUtils.isBlank(devCode)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.DEVCODE_WRONG.getCode(), UserCodeEnum.DEVCODE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// logger.info("controller更新手机id:" + devCode);
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// appUserService.comfirmCode(phone, devCode, code);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.MESSAGE_CODE_RIGHT.getCode(), UserCodeEnum.MESSAGE_CODE_RIGHT.getMsg(), null);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("确认旧手机验证码异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.MESSAGE_CODE_WRONG.getCode(), UserCodeEnum.MESSAGE_CODE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 手机app重新绑定手机号
|
||||
// */
|
||||
// @PostMapping("rebindPhone")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "phoneNew", value = "新号码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "code", value = "短信验证码", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "重新绑定手机号", notes = "重新绑定手机号", response = ResponseData.class)
|
||||
// public ResponseData rebindPhone(String userId, String phoneNew, String devCode, String code) {
|
||||
// ResponseData responseData;
|
||||
// //参数校验
|
||||
// if (!PubUtils.patternPhone(XssFilterUtil.dealString(phoneNew))) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.PHONE_WRONG.getCode(), UserCodeEnum.PHONE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// if (StringUtils.isBlank(devCode)) {
|
||||
// return PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.DEVCODE_WRONG.getCode(), UserCodeEnum.DEVCODE_WRONG.getMsg(), null);
|
||||
// }
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// appUserService.rebindPhone(userId, phoneNew, devCode, code);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.REST_PHONE_SUCCESS.getCode(), UserCodeEnum.REST_PHONE_SUCCESS.getMsg(), null);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("重新绑定手机号异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.REST_PHONE_FAIL.getCode(), UserCodeEnum.REST_PHONE_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 手机app用户实时消息配置
|
||||
// */
|
||||
// @PostMapping("msgSet")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "eventInfo", value = "暂态消息模块", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "targetInfo", value = "稳态消息模块", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "deviceInfo", value = "终端消息模块", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "systemInfo", value = "系统消息消息模块", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "用户实时消息配置", notes = "用户实时消息配置", response = ResponseData.class)
|
||||
// public ResponseData msgSet(String userId, String eventInfo, String targetInfo, String deviceInfo, String systemInfo) {
|
||||
// ResponseData responseData;
|
||||
// try {
|
||||
// appUserService.msgSet(userId, eventInfo, targetInfo, deviceInfo, systemInfo);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.SET_INFO_SUCCESS.getCode(), UserCodeEnum.SET_INFO_SUCCESS.getMsg(), null);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("用户实时消息配置异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.SET_INFO_FAIL.getCode(), UserCodeEnum.SET_INFO_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 手机app用户获取消息配置
|
||||
// */
|
||||
// @PostMapping("getMsg")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, paramType = "query"),
|
||||
// @ApiImplicitParam(name = "devCode", value = "设备ID", required = true, paramType = "query"),
|
||||
// })
|
||||
// @ApiOperation(value = "用户获取消息配置", notes = "用户获取消息配置", response = ResponseData.class)
|
||||
// public ResponseData getMsg(String userId, String devCode) {
|
||||
// ResponseData responseData;
|
||||
// MessageResult messageResult;
|
||||
// try {
|
||||
// devCode = AESUtil.aesPKCS5PaddingDecrypt(devCode);
|
||||
// messageResult = appUserService.getMsg(userId, devCode);
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_SUCCESS, UserCodeEnum.GET_MESSAGE_SUCCESS.getCode(), UserCodeEnum.GET_MESSAGE_SUCCESS.getMsg(), messageResult);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("用户获取消息配置异常:" + e.toString());
|
||||
// if (e.getMessage().length() < 10) {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.getCodeByMsg(e.getMessage()), e.getMessage(), null);
|
||||
// } else {
|
||||
// responseData = PubUtils.assignmentAppResponse(ReturnCode.RETURN_FAIL, UserCodeEnum.GET_MESSAGE_FAIL.getCode(), UserCodeEnum.GET_MESSAGE_FAIL.getMsg(), null);
|
||||
// }
|
||||
// }
|
||||
// return responseData;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||
import com.njcn.cloud.pojo.dto.RMpEventDetail;
|
||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 暂态消息详情 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
public interface AppEventInfoMapper extends BaseMapper<AppEventInfo> {
|
||||
|
||||
/**
|
||||
* @Description: 暂态事件基本信息(暂态消息id)
|
||||
* @param id
|
||||
* @return: com.njcn.cloud.pojo.vo.EventInfoDetailVO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:43
|
||||
*/
|
||||
EventInfoDetailVO selectEventInfoDetailByID(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* @Description: 获取监测点相别
|
||||
* @param id 暂降事件id
|
||||
* @return: java.lang.Integer
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:45
|
||||
*/
|
||||
Integer getLinePtType(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* @Description: 获取波形路径
|
||||
* @param eventId 暂降事件id
|
||||
* @return: java.lang.String
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 15:55
|
||||
*/
|
||||
EventWaveDetailVO.Detail selectWavePath(@Param("id")String eventId);
|
||||
|
||||
/**
|
||||
* @Description: 获取暂态信息
|
||||
* @param id
|
||||
* @return: com.njcn.cloud.pojo.vo.EventInfoDetailVO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:43
|
||||
*/
|
||||
RMpEventDetail selectByID(@Param("id") String id);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 暂态事件基本信息(暂态事件id)
|
||||
* @param id
|
||||
* @return: com.njcn.cloud.pojo.vo.EventInfoDetailVO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:43
|
||||
*/
|
||||
EventInfoDetailVO selectEventDetailByID(@Param("id") String id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
||||
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app暂态消息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
public interface AppEventMsgMapper extends BaseMapper<AppEventMsg> {
|
||||
|
||||
/**
|
||||
* @Description: 获取暂态信息
|
||||
* @param page
|
||||
* @param ids
|
||||
* @param userIndex
|
||||
* @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.njcn.cloud.pojo.vo.EventMsgDetailVO>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 10:21
|
||||
*/
|
||||
Page<EventMsgDetailVO> selectEventMsgPage(Page page,
|
||||
@Param("ids") List<String> ids,
|
||||
@Param("userIndex") String userIndex);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppReport;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报告信息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-02
|
||||
*/
|
||||
public interface AppReportMapper extends BaseMapper<AppReport> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
public interface AppSendMsgMapper extends BaseMapper<AppSendMsg> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态消息详情 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface AppSteadyAssMapper extends BaseMapper<AppSteadyAss> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态消息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface AppSteadyMsgMapper extends BaseMapper<AppSteadyMsg> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态图形信息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface AppSteadyUrlMapper extends BaseMapper<AppSteadyUrl> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppUser;
|
||||
import com.njcn.cloud.pojo.dto.DeptLine;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
public interface AppUserMapper extends BaseMapper<AppUser> {
|
||||
|
||||
/**
|
||||
* @Description: 根据app用户id获取app所管理的用户信息
|
||||
* @param appUserID
|
||||
* @return: com.njcn.user.pojo.po.User
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 10:13
|
||||
*/
|
||||
User getUserAndApp(@Param("userIndex") String appUserID);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 部门监测点关系表
|
||||
* @param deptID
|
||||
* @return: java.util.List<com.njcn.cloud.pojo.dto.DeptLine>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 10:33
|
||||
*/
|
||||
List<DeptLine> getUserLine(@Param("deptID") String deptID);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.cloud.mapper;
|
||||
|
||||
|
||||
import com.njcn.cloud.pojo.vo.LineDetailVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 监测点信息
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 14:38
|
||||
*/
|
||||
public interface LineMapper {
|
||||
|
||||
/**
|
||||
* @Description: 获取监测点集合信息
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 14:37
|
||||
*/
|
||||
List<LineDetailVO> selectByIds(@Param("ids") List<String> ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppEventInfoMapper">
|
||||
|
||||
<select id="selectEventInfoDetailByID" resultType="com.njcn.cloud.pojo.vo.EventInfoDetailVO">
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN sagsource IS NULL THEN
|
||||
line.NAME
|
||||
WHEN sagsource = "Upper" THEN
|
||||
CONCAT( line.NAME, " (暂降源位置:上游)" )
|
||||
WHEN sagsource = "Lower" THEN
|
||||
CONCAT( line.NAME, " (暂降源位置:下游)" ) ELSE CONCAT( line.NAME, " (暂降源位置:未知)" )
|
||||
END
|
||||
) AS lineName,
|
||||
gd.NAME gdName,
|
||||
sub.NAME bdzName,
|
||||
dev.NAME devName,
|
||||
dic.NAME scale,
|
||||
pd.ip ip,
|
||||
detail.event_id AS eventDetailIndex,
|
||||
detail.start_time timeID,
|
||||
detail.first_ms ms,
|
||||
detail.duration persistTime,
|
||||
round( detail.feature_amplitude * 100, 2 ) eventValue,
|
||||
info.REPORT_STATE report,
|
||||
info.Evaluate evaluate,
|
||||
info.report_Path reportPath
|
||||
FROM
|
||||
app_event_msg msg
|
||||
INNER JOIN app_event_info info ON msg.EventDetail_Index = info.EventDetail_Index
|
||||
INNER JOIN r_mp_event_detail detail ON msg.EventDetail_Index = detail.event_id
|
||||
INNER JOIN pq_line line ON detail.measurement_point_id = line.id
|
||||
INNER JOIN pq_line_detail pld ON line.Id = pld.Id
|
||||
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||
INNER JOIN pq_voltage vg ON vg.Id = vol.id
|
||||
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||
INNER JOIN pq_device pd ON pd.Id = dev.Id
|
||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||
INNER JOIN pq_line area ON area.Id = gd.Pid
|
||||
INNER JOIN sys_area sys ON area.NAME = sys.id
|
||||
INNER JOIN sys_dict_data dic ON vg.Scale = dic.id
|
||||
<where>
|
||||
<if test="id!=null and id != '' ">
|
||||
AND msg.EventMsg_Index = #{id}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY info.update_time desc
|
||||
</select>
|
||||
<select id="getLinePtType" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
IFNULL(b.PT_Phase_Type ,1)
|
||||
FROM
|
||||
r_mp_event_detail a,
|
||||
pq_line_detail b
|
||||
WHERE
|
||||
a.measurement_point_id = b.Id
|
||||
and
|
||||
a.event_id = #{id}
|
||||
</select>
|
||||
<select id="selectWavePath" resultType="com.njcn.cloud.pojo.vo.EventWaveDetailVO$Detail">
|
||||
SELECT
|
||||
event_id AS eventID,
|
||||
measurement_point_id AS measurementPointId,
|
||||
line.NAME AS measurementPointName,
|
||||
wave_path AS wavePath,
|
||||
pd.ip AS ip,
|
||||
PT1 / PT2 AS pt,
|
||||
CT1 / CT2 AS ct,
|
||||
PT_Type AS ptType
|
||||
FROM
|
||||
r_mp_event_detail a
|
||||
INNER JOIN pq_line line ON a.measurement_point_id = line.id
|
||||
INNER JOIN pq_line_detail pld ON line.Id = pld.Id
|
||||
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||
INNER JOIN pq_voltage vg ON vg.Id = vol.id
|
||||
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||
INNER JOIN pq_device pd ON pd.Id = dev.Id
|
||||
WHERE
|
||||
a.event_id = #{id}
|
||||
</select>
|
||||
<select id="selectByID" resultType="com.njcn.cloud.pojo.dto.RMpEventDetail">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
r_mp_event_detail a
|
||||
WHERE
|
||||
a.event_id = #{id}
|
||||
</select>
|
||||
<select id="selectEventDetailByID" resultType="com.njcn.cloud.pojo.vo.EventInfoDetailVO">
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN sagsource IS NULL THEN
|
||||
line.NAME
|
||||
WHEN sagsource = "Upper" THEN
|
||||
CONCAT( line.NAME, " (暂降源位置:上游)" )
|
||||
WHEN sagsource = "Lower" THEN
|
||||
CONCAT( line.NAME, " (暂降源位置:下游)" ) ELSE CONCAT( line.NAME, " (暂降源位置:未知)" )
|
||||
END
|
||||
) AS lineName,
|
||||
gd.NAME gdName,
|
||||
sub.NAME bdzName,
|
||||
dev.NAME devName,
|
||||
dic.NAME scale,
|
||||
pd.ip ip,
|
||||
detail.event_id AS eventDetailIndex,
|
||||
detail.start_time as timeID,
|
||||
detail.first_ms ms,
|
||||
detail.duration persistTime,
|
||||
round( detail.feature_amplitude * 100, 2 ) eventValue
|
||||
FROM
|
||||
r_mp_event_detail detail
|
||||
INNER JOIN pq_line line ON detail.measurement_point_id = line.id
|
||||
INNER JOIN pq_line_detail pld ON line.Id = pld.Id
|
||||
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||
INNER JOIN pq_voltage vg ON vg.Id = vol.id
|
||||
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||
INNER JOIN pq_device pd ON pd.Id = dev.Id
|
||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||
INNER JOIN pq_line area ON area.Id = gd.Pid
|
||||
INNER JOIN sys_area sys ON area.NAME = sys.id
|
||||
INNER JOIN sys_dict_data dic ON vg.Scale = dic.id
|
||||
<where>
|
||||
<if test="id!=null and id != '' ">
|
||||
AND detail.event_id = #{id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppEventMsgMapper">
|
||||
|
||||
<select id="selectEventMsgPage" resultType="com.njcn.cloud.pojo.vo.EventMsgDetailVO">
|
||||
select
|
||||
line.id as lineIndex,
|
||||
(CASE
|
||||
WHEN sagsource is NULL THEN line.name
|
||||
WHEN sagsource = "Upper" THEN CONCAT(line.name , " (暂降源位置:上游)")
|
||||
WHEN sagsource = "Lower" THEN CONCAT(line.name , " (暂降源位置:下游)")
|
||||
ELSE CONCAT(line.name , " (暂降源位置:未知)")
|
||||
END)as lineName,
|
||||
detail.event_id as eventDetailIndex,
|
||||
detail.start_time timeID,
|
||||
detail.first_ms ms,
|
||||
detail.duration persistTime,
|
||||
round( detail.feature_amplitude * 100, 2 ) eventValue,
|
||||
CONCAT(sys.name,' ',gd.name,' 电压等级:',dic.name,' 网络参数:',pd.ip) lineInfo,
|
||||
msg.eventMsg_Index eventMsgIndex,
|
||||
msg.state
|
||||
from
|
||||
app_event_msg msg
|
||||
INNER JOIN r_mp_event_detail detail ON msg.EventDetail_Index=detail.event_id
|
||||
INNER JOIN pq_line line ON detail.measurement_point_id=line.id
|
||||
INNER JOIN pq_line_detail pld ON line.Id = pld.Id
|
||||
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||
INNER JOIN pq_voltage vg ON vg.Id = vol.id
|
||||
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||
INNER JOIN pq_device pd ON pd.Id = dev.Id
|
||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||
INNER JOIN pq_line area ON area.Id = gd.Pid
|
||||
INNER JOIN sys_area sys ON area.NAME = sys.id
|
||||
INNER JOIN sys_dict_data dic ON vg.Scale = dic.id
|
||||
<where>
|
||||
<if test="ids != null and ids.size > 0">
|
||||
AND line.id IN
|
||||
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userIndex!=null and userIndex != '' ">
|
||||
AND msg.User_Index = #{userIndex}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppReportMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppSendMsgMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppSteadyAssMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppSteadyMsgMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppSteadyUrlMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.AppUserMapper">
|
||||
|
||||
<select id="getUserAndApp" resultType="com.njcn.user.pojo.po.User">
|
||||
select
|
||||
*
|
||||
from
|
||||
sys_user
|
||||
where
|
||||
id = #{userIndex}
|
||||
</select>
|
||||
<select id="getUserLine" resultType="com.njcn.cloud.pojo.dto.DeptLine">
|
||||
select
|
||||
*
|
||||
from
|
||||
pq_dept_line
|
||||
where
|
||||
id = #{deptID}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.cloud.mapper.LineMapper">
|
||||
|
||||
<select id="selectByIds" resultType="com.njcn.cloud.pojo.vo.LineDetailVO">
|
||||
SELECT DISTINCT
|
||||
gd.NAME gdName,
|
||||
substation.NAME subName,
|
||||
device.NAME devName,
|
||||
line.id as lineId,
|
||||
line.NAME lineName,
|
||||
lineDetail.Time_Interval as timeInterval,
|
||||
deviceDetail.ip ip
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line voltage,
|
||||
pq_line device,
|
||||
pq_line substation,
|
||||
pq_line gd,
|
||||
pq_device deviceDetail,
|
||||
pq_line_detail lineDetail
|
||||
WHERE
|
||||
line.pid = voltage.id
|
||||
AND voltage.pid = device.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.pid = gd.id
|
||||
AND device.id = deviceDetail.id
|
||||
AND line.id = lineDetail.id
|
||||
<if test="ids!=null and ids.size()!=0">
|
||||
AND line.id IN
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.advance.api.EventWaveAnalysisFeignClient;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||
import com.njcn.cloud.mapper.AppEventInfoMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
||||
import com.njcn.cloud.service.user.IAppEventInfoService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
import com.njcn.event.file.component.WavePicComponent;
|
||||
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||
import com.njcn.event.file.utils.WaveUtil;
|
||||
import com.njcn.oss.constant.GeneralConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 暂态消息详情 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppEventInfoServiceImpl extends ServiceImpl<AppEventInfoMapper, AppEventInfo> implements IAppEventInfoService {
|
||||
|
||||
private final EventWaveAnalysisFeignClient eventWaveAnalysisFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final WaveFileComponent waveFileComponent;
|
||||
private final WavePicComponent wavePicComponent;
|
||||
@Override
|
||||
public EventEigDetailVO.Detail eventDetailEigenvalue(String eventDetailIndex) {
|
||||
EventEigDetailVO.Detail detail=new EventEigDetailVO.Detail();
|
||||
|
||||
List<EventEigDetailVO> eventInfoDetails = new ArrayList<>();
|
||||
EntityAdvancedData entityAdvancedData = eventWaveAnalysisFeignClient.analysis(eventDetailIndex).getData();
|
||||
|
||||
//根据事件获取监测点接线方式
|
||||
Integer ptType = this.getBaseMapper().getLinePtType(eventDetailIndex);
|
||||
if (entityAdvancedData.backNumber != -1) {
|
||||
detail.setBackNumber( entityAdvancedData.backNumber);
|
||||
for (int i = 0; i < entityAdvancedData.backNumber; i++) {
|
||||
EventEigDetailVO eventEigDetail = new EventEigDetailVO();
|
||||
eventEigDetail.setHold_time_dq(entityAdvancedData.evt_buf[i].hold_time_dq * 1000);
|
||||
eventEigDetail.setPow_a(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].POW_a));
|
||||
eventEigDetail.setPow_b(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].POW_b));
|
||||
eventEigDetail.setPow_c(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].POW_c));
|
||||
|
||||
eventEigDetail.setVoltagechange_Va(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].Voltagechange_Va / 1000));
|
||||
eventEigDetail.setVoltagechange_Vb(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].Voltagechange_Vb / 1000));
|
||||
eventEigDetail.setVoltagechange_Vc(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].Voltagechange_Vc / 1000));
|
||||
|
||||
|
||||
eventEigDetail.setUa_min(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].ua_min[0]));
|
||||
eventEigDetail.setUb_min(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].ub_min[0]));
|
||||
eventEigDetail.setUc_min(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].ua_min[0]));
|
||||
|
||||
eventEigDetail.setAngle_diff_ap(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].angle_diff_ap[0]));
|
||||
eventEigDetail.setAngle_diff_bp(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].angle_diff_bp[0]));
|
||||
eventEigDetail.setAngle_diff_cp(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].angle_diff_cp[0]));
|
||||
|
||||
eventEigDetail.setBph_max_value(PubUtils.floatRound(2, entityAdvancedData.evt_buf[i].bph_max_value[0]));
|
||||
eventEigDetail.setSagReason(entityAdvancedData.sagReason[0]);//暂降原因,暂降原因都一样
|
||||
eventEigDetail.setSagType(entityAdvancedData.sagType[i]);//暂降类型
|
||||
eventInfoDetails.add(eventEigDetail);
|
||||
eventEigDetail.setPttype(ptType);
|
||||
}
|
||||
} else {
|
||||
detail.setBackNumber(0);
|
||||
}
|
||||
detail.setList(eventInfoDetails);
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public EventWaveDetailVO eventDetailWave(String eventDetailIndex) {
|
||||
EventWaveDetailVO vo =new EventWaveDetailVO();
|
||||
AppEventInfo byId = this.getById(eventDetailIndex);
|
||||
vo.setEventDetailIndex(byId.getEventdetailIndex());
|
||||
if(StrUtil.isBlank(byId.getInstantwavePath())){
|
||||
//获取波形数据。然后绘图
|
||||
WaveDataDTO waveDataDTO = this.analyseWave(eventDetailIndex, 2);
|
||||
//数据筛选,如果是双路电压的话,会存在2个波形数据
|
||||
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveDataDTO);
|
||||
String instantPath = wavePicComponent.generateImageShun(waveDataDTO,waveDataDetails);
|
||||
byId.setInstantwavePath(instantPath);
|
||||
if (StrUtil.isBlank(byId.getRmswavePath())) {
|
||||
String rmsPath = wavePicComponent.generateImageRms(waveDataDTO,waveDataDetails);
|
||||
byId.setRmswavePath(rmsPath);
|
||||
}
|
||||
this.updateById(byId);
|
||||
}
|
||||
vo.setInstantWaveUrl(byId.getInstantwavePath());
|
||||
vo.setRmsWaveUrl(byId.getRmswavePath());
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean eventDetailEvaluate(String eventDetailIndex, Integer evaluate, String userId) {
|
||||
boolean fly = this.update(new LambdaUpdateWrapper<AppEventInfo>()
|
||||
.set(AppEventInfo::getEvaluate, evaluate)
|
||||
.set(AppEventInfo::getUserIndex, userId)
|
||||
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
||||
);
|
||||
return fly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 获取波形数据
|
||||
* @return: com.njcn.event.file.pojo.dto.WaveDataDTO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 15:51
|
||||
*/
|
||||
@Override
|
||||
public WaveDataDTO analyseWave(String eventId, int iType) {
|
||||
WaveDataDTO waveDataDTO;
|
||||
//获取暂降事件
|
||||
EventWaveDetailVO.Detail eventDetail = this.baseMapper.selectWavePath(eventId);
|
||||
String waveName = eventDetail.getWavePath();
|
||||
if (StrUtil.isBlank(waveName)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
try (
|
||||
InputStream cfgStream = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + eventDetail.getIp() + StrUtil.SLASH + waveName + GeneralConstant.CFG);
|
||||
InputStream datStream = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + eventDetail.getIp() + StrUtil.SLASH + waveName + GeneralConstant.DAT)
|
||||
) {
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, iType);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getValidData(waveDataDTO);
|
||||
waveDataDTO.setPtType(eventDetail.getPtType());
|
||||
waveDataDTO.setPt(eventDetail.getPt());
|
||||
waveDataDTO.setCt(eventDetail.getCt());
|
||||
waveDataDTO.setMonitorName(eventDetail.getMeasurementPointName());
|
||||
return waveDataDTO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||
import com.njcn.cloud.mapper.AppEventInfoMapper;
|
||||
import com.njcn.cloud.mapper.AppEventMsgMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.mapper.AppUserMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
||||
import com.njcn.cloud.pojo.dto.DeptLine;
|
||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
||||
import com.njcn.cloud.service.user.IAppEventMsgService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app暂态消息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppEventMsgServiceImpl extends ServiceImpl<AppEventMsgMapper, AppEventMsg> implements IAppEventMsgService {
|
||||
|
||||
private final AppUserMapper appUserMapper;
|
||||
private final AppEventInfoMapper appEventInfoMapper;
|
||||
@Override
|
||||
public Page<EventMsgDetailVO> eventMsgPage(BaseParam param) {
|
||||
String searchValue = param.getSearchValue();
|
||||
//根据用户id获取用户部门
|
||||
//todo 用户id
|
||||
User userAndApp = appUserMapper.getUserAndApp(param.getSearchValue());
|
||||
if(ObjectUtil.isNull(userAndApp)){
|
||||
throw new BusinessException(UserCodeEnum.NO_USER.getMsg());
|
||||
}
|
||||
//根据所查询的部门查询出是部门下监测点信息
|
||||
List<DeptLine> userLine = appUserMapper.getUserLine(userAndApp.getDeptId());
|
||||
List<String> ids = userLine.stream().map(DeptLine::getLineId).collect(Collectors.toList());
|
||||
ids.add("2ec9ef4a375b249abc5314e6b7461cab");
|
||||
return this.getBaseMapper().selectEventMsgPage(new Page<>(param.getPageNum(),param.getPageSize()),ids,searchValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public EventInfoDetailVO eventInfoDetail(String id) {
|
||||
EventInfoDetailVO eventInfoDetailVO = appEventInfoMapper.selectEventInfoDetailByID(id);
|
||||
this.update(new LambdaUpdateWrapper<AppEventMsg>()
|
||||
.set(AppEventMsg::getState,1)
|
||||
.eq(AppEventMsg::getEventmsgIndex,id)
|
||||
|
||||
);
|
||||
return eventInfoDetailVO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.cloud.enums.app.EventMsgCodeEnum;
|
||||
import com.njcn.cloud.mapper.AppEventInfoMapper;
|
||||
import com.njcn.cloud.mapper.AppReportMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||
import com.njcn.cloud.pojo.dto.AppReport;
|
||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||
import com.njcn.cloud.service.user.IAppEventInfoService;
|
||||
import com.njcn.cloud.service.user.IAppReportService;
|
||||
import com.njcn.cloud.utils.WordUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.FileUtil;
|
||||
import com.njcn.event.file.component.WavePicComponent;
|
||||
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.event.file.utils.WaveUtil;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报告信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-02
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppReportServiceImpl extends ServiceImpl<AppReportMapper, AppReport> implements IAppReportService {
|
||||
|
||||
private final IAppEventInfoService appEventInfoService;
|
||||
private final AppEventInfoMapper appEventInfoMapper;
|
||||
private final WavePicComponent wavePicComponent;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public String eventDetailReportApply(String userId, String eventDetailIndex) {
|
||||
AppEventInfo info=new AppEventInfo();
|
||||
info.setEventdetailIndex(eventDetailIndex);
|
||||
info.setEvaluate(0);
|
||||
info.setUserIndex(userId);
|
||||
info.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
AppEventInfo one = appEventInfoService.getOne(new LambdaUpdateWrapper<AppEventInfo>()
|
||||
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
||||
.ne(AppEventInfo::getReportState, 4)
|
||||
);
|
||||
if (ObjectUtil.isNull(one)||one.getReportState() != 1) {
|
||||
try {
|
||||
if(ObjectUtil.isNull(one)){
|
||||
one=new AppEventInfo();
|
||||
}
|
||||
Map<String, String> map = this.createEventDetailReport(eventDetailIndex,one);
|
||||
if (map.containsKey("noData")) {
|
||||
return map.get("noData");
|
||||
}
|
||||
info.setInstantwavePath(map.get("instantPath"));
|
||||
info.setRmswavePath(map.get("rmsPath"));
|
||||
info.setReportState(1);
|
||||
info.setReportPath(map.get("reportPath"));
|
||||
appEventInfoService.save(info);
|
||||
return "0";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
info.setReportState(2);
|
||||
appEventInfoService.save(info);
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEventInfo getDownLoadPath(String userId, String eventDetailIndex) {
|
||||
AppEventInfo one = appEventInfoService.getOne(new LambdaQueryWrapper<AppEventInfo>()
|
||||
.eq(AppEventInfo::getUserIndex, userId)
|
||||
.eq(AppEventInfo::getEventdetailIndex, eventDetailIndex)
|
||||
);
|
||||
if(ObjectUtil.isNull(one)){
|
||||
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTDOWNLOAD_NOT_FAIL.getMsg());
|
||||
}
|
||||
if(one.getReportState() == 3){
|
||||
throw new BusinessException(EventMsgCodeEnum.EVENTDETAILREPORTDOWNLOAD_ERROR.getMsg());
|
||||
}
|
||||
return one;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 生成报告
|
||||
* @param eventIndex
|
||||
* @return: java.lang.String
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/2 14:44
|
||||
*/
|
||||
private Map<String,String> createEventDetailReport(String eventIndex,AppEventInfo appEventInfo) throws Exception {
|
||||
Map<String,String> map=new HashMap<>();
|
||||
WaveDataDTO waveData = appEventInfoService.analyseWave(eventIndex, 2);
|
||||
|
||||
if (waveData.getListWaveData().size() == 0) {
|
||||
map.put("noData","2");
|
||||
return map;
|
||||
}
|
||||
//数据筛选,如果是双路电压的话,会存在2个波形数据
|
||||
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveData);
|
||||
WordUtil wordUtil = new WordUtil();
|
||||
//获取瞬时波形
|
||||
String instantPath=appEventInfo.getInstantwavePath();
|
||||
if(StrUtil.isBlank(instantPath)){
|
||||
instantPath = wavePicComponent.generateImageShun(waveData,waveDataDetails);
|
||||
}
|
||||
InputStream instantStream = fileStorageUtil.getFileStream(instantPath);
|
||||
String imageShun64 = Base64.encode(instantStream);
|
||||
//获取rms波形
|
||||
String rmsPath =appEventInfo.getRmswavePath();
|
||||
if(StrUtil.isBlank(rmsPath)){
|
||||
rmsPath = wavePicComponent.generateImageRms(waveData,waveDataDetails);
|
||||
}
|
||||
InputStream rmsStream = fileStorageUtil.getFileStream(rmsPath);
|
||||
String rmsShun64 = Base64.encode(rmsStream);
|
||||
|
||||
wordUtil.translate(imageShun64,rmsShun64);
|
||||
List<EventEigDetailVO> eventDetailEigenvalue =new ArrayList<>();
|
||||
List<String> tmpWaveTitle = waveData.getWaveTitle();
|
||||
int picCounts =(tmpWaveTitle.size()-1)/waveData.getIPhasic();
|
||||
if(picCounts == 3){
|
||||
eventDetailEigenvalue = appEventInfoService.eventDetailEigenvalue(eventIndex).getList();
|
||||
|
||||
}
|
||||
wordUtil.setEventDetailEigenvalue(eventDetailEigenvalue);
|
||||
EventInfoDetailVO eventInfoList = appEventInfoMapper.selectEventDetailByID(eventIndex);
|
||||
wordUtil.setEventInfoList(eventInfoList);
|
||||
wordUtil.createReport();
|
||||
|
||||
//临时缓冲区
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
//创建临时文件
|
||||
wordUtil.getDocument().write(out);
|
||||
byte[] bookByteAry = out.toByteArray();
|
||||
InputStream in = new ByteArrayInputStream(bookByteAry);
|
||||
String reportPath = fileStorageUtil.uploadStream(in, OssPath.RESPONSIBILITY_APP_REPORT,
|
||||
FileUtil.generateFileName("docx")
|
||||
);
|
||||
map.put("instantPath",instantPath);
|
||||
map.put("rmsPath",rmsPath);
|
||||
map.put("reportPath",reportPath);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.mapper.AppSendMsgMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||
import com.njcn.cloud.service.user.IAppSendMsgService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
@Service
|
||||
public class AppSendMsgServiceImpl extends ServiceImpl<AppSendMsgMapper, AppSendMsg> implements IAppSendMsgService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import com.njcn.cloud.mapper.AppSteadyAssMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||
import com.njcn.cloud.service.user.IAppSteadyAssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态消息详情 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
@Service
|
||||
public class AppSteadyAssServiceImpl extends ServiceImpl<AppSteadyAssMapper, AppSteadyAss> implements IAppSteadyAssService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.cloud.enums.app.TypeCodeEnum;
|
||||
import com.njcn.cloud.mapper.AppSteadyMsgMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.mapper.LineMapper;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||
import com.njcn.cloud.pojo.vo.AppSteadyMsgVO;
|
||||
import com.njcn.cloud.pojo.vo.LineDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
||||
import com.njcn.cloud.service.user.IAppSteadyAssService;
|
||||
import com.njcn.cloud.service.user.IAppSteadyMsgService;
|
||||
import com.njcn.cloud.service.user.IAppSteadyUrlService;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态消息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppSteadyMsgServiceImpl extends ServiceImpl<AppSteadyMsgMapper, AppSteadyMsg> implements IAppSteadyMsgService {
|
||||
|
||||
private final IAppSteadyAssService appSteadyAssService;
|
||||
private final IAppSteadyUrlService appSteadyUrlService;
|
||||
private final LineMapper lineMapper;
|
||||
@Override
|
||||
public AppSteadyMsgVO getSteadyState(BaseParam param) {
|
||||
AppSteadyMsgVO appSteadyMsgVO=new AppSteadyMsgVO();
|
||||
Page<AppSteadyMsg> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), new LambdaQueryWrapper<AppSteadyMsg>()
|
||||
.eq(AppSteadyMsg::getUserIndex, param.getSearchValue())
|
||||
.orderByDesc(AppSteadyMsg::getTimeId)
|
||||
);
|
||||
int count = this.count(new LambdaQueryWrapper<AppSteadyMsg>()
|
||||
.eq(AppSteadyMsg::getUserIndex, param.getSearchValue())
|
||||
.eq(AppSteadyMsg::getState, 0)
|
||||
|
||||
);
|
||||
appSteadyMsgVO.setPage(page);
|
||||
appSteadyMsgVO.setUnstate(count);
|
||||
return appSteadyMsgVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SteadyMsgDetailVO> getSteadyDetail(String steadyIndex) {
|
||||
//初始化集合
|
||||
List<SteadyMsgDetailVO> msgDetailList = new ArrayList<>();
|
||||
//获取暂态消息详细信息列表
|
||||
List<AppSteadyAss> steadyAssList = appSteadyAssService.list(new LambdaQueryWrapper<AppSteadyAss>()
|
||||
.eq(AppSteadyAss::getSteadyIndex, steadyIndex)
|
||||
);
|
||||
if(CollUtil.isEmpty(steadyAssList)){
|
||||
return msgDetailList;
|
||||
}
|
||||
//获取监测点id集合
|
||||
List<String> lineIds = steadyAssList.stream().map(AppSteadyAss::getLineIndex).distinct().collect(Collectors.toList());
|
||||
//获取统计时间集合
|
||||
List<LocalDateTime> times = steadyAssList.stream().map(AppSteadyAss::getTimeId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<AppSteadyUrl> lineDetail = appSteadyUrlService.list(new LambdaQueryWrapper<AppSteadyUrl>()
|
||||
.in(AppSteadyUrl::getLineIndex, lineIds)
|
||||
.in(AppSteadyUrl::getTimeId, times)
|
||||
.orderByAsc(AppSteadyUrl::getTypeCode)
|
||||
|
||||
);
|
||||
Map<String, List<AppSteadyUrl>> lineMap = lineDetail.stream()
|
||||
.collect(Collectors.groupingBy(x->x.getLineIndex()+"_"+LocalDateTimeUtil.format(x.getTimeId(), DatePattern.UTC_SIMPLE_MS_PATTERN)));
|
||||
List<String> steadyLineIdList = lineMap.keySet().stream().map(x->x.split("_")[0]).collect(Collectors.toList());
|
||||
List<LineDetailVO> lineDetailVOS = lineMapper.selectByIds(steadyLineIdList);
|
||||
lineMap.forEach((key,value)->{
|
||||
String[] split = key.split("_");
|
||||
List<LineDetailVO> line = lineDetailVOS.stream().filter(x -> x.getLineId().equals(split[0])).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(line)){
|
||||
SteadyMsgDetailVO detailVO=new SteadyMsgDetailVO();
|
||||
detailVO.setLineName(line.get(0).getLineName());
|
||||
detailVO.setSubName(line.get(0).getSubName());
|
||||
detailVO.setSteadyIndex(steadyIndex);
|
||||
detailVO.setLineIndex(line.get(0).getLineId());
|
||||
detailVO.setTimeId(LocalDateTimeUtil.parse(split[1],DatePattern.UTC_SIMPLE_MS_PATTERN));
|
||||
String describe = "";
|
||||
Integer limitNum = 0;
|
||||
for (AppSteadyUrl appSteadyUrl : value) {
|
||||
String typename = TypeCodeEnum.getMsgByCode(appSteadyUrl.getTypeCode());
|
||||
if(appSteadyUrl.getTypeCode()== 5){
|
||||
describe = describe + typename + appSteadyUrl.getLimitNum() * 120 + "分钟,";
|
||||
}else{
|
||||
describe = describe + typename + appSteadyUrl.getLimitNum() * line.get(0).getTimeInterval() + "分钟,";
|
||||
}
|
||||
limitNum = limitNum + appSteadyUrl.getLimitNum();
|
||||
}
|
||||
if(describe.length() > 0){
|
||||
describe = describe.substring(0, describe.length()-1);
|
||||
}
|
||||
detailVO.setLimitNum(limitNum);
|
||||
detailVO.setDescribe(describe);
|
||||
msgDetailList.add(detailVO);
|
||||
}
|
||||
});
|
||||
this.update(new LambdaUpdateWrapper<AppSteadyMsg>()
|
||||
.set(AppSteadyMsg::getState,1)
|
||||
.eq(AppSteadyMsg::getState,0)
|
||||
.eq(AppSteadyMsg::getSteadyIndex,steadyIndex)
|
||||
);
|
||||
return msgDetailList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SteadyTargetVO> getSteadyTarget(String lineIndex, String timeId) {
|
||||
List<SteadyTargetVO> info=new ArrayList<>();
|
||||
SteadyTargetVO vo;
|
||||
List<AppSteadyUrl> list = appSteadyUrlService.list(new LambdaQueryWrapper<AppSteadyUrl>()
|
||||
.eq(AppSteadyUrl::getLineIndex, lineIndex)
|
||||
.eq(AppSteadyUrl::getTimeId, timeId)
|
||||
.orderByAsc(AppSteadyUrl::getTypeCode)
|
||||
);
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
for (AppSteadyUrl appSteadyUrl : list) {
|
||||
vo=new SteadyTargetVO();
|
||||
vo.setTypeCode(appSteadyUrl.getTypeCode());
|
||||
vo.setTypeName(TypeCodeEnum.getMsgByCode(appSteadyUrl.getTypeCode()));
|
||||
vo.setLimitNum(appSteadyUrl.getLimitNum());
|
||||
info.add(vo);
|
||||
}
|
||||
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppSteadyUrl getSteadyTargetUrl(String lineIndex, String timeId,Integer typeCode) {
|
||||
AppSteadyUrl one = appSteadyUrlService.getOne(new LambdaQueryWrapper<AppSteadyUrl>()
|
||||
.eq(AppSteadyUrl::getLineIndex, lineIndex)
|
||||
.eq(AppSteadyUrl::getTimeId, timeId)
|
||||
.eq(AppSteadyUrl::getTypeCode, typeCode)
|
||||
);
|
||||
return one;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import com.njcn.cloud.mapper.AppSteadyUrlMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||
import com.njcn.cloud.service.user.IAppSteadyUrlService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态图形信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
@Service
|
||||
public class AppSteadyUrlServiceImpl extends ServiceImpl<AppSteadyUrlMapper, AppSteadyUrl> implements IAppSteadyUrlService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.njcn.cloud.service.impl.user;
|
||||
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cloud.mapper.AppUserMapper;
|
||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||
import com.njcn.cloud.service.user.IAppSendMsgService;
|
||||
import com.njcn.cloud.service.user.IAppUserService;
|
||||
import com.njcn.cloud.utils.SmsUtil;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.user.enums.MessageEnum;
|
||||
import com.njcn.user.enums.UserResponseEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.njcn.cloud.pojo.dto.AppUser;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @date: 2019/10/17 11:37
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements IAppUserService {
|
||||
|
||||
private final SmsUtil smsUtil;
|
||||
private final RedisUtil redisUtil;
|
||||
private final IAppSendMsgService appSendMsgService;
|
||||
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param devCode 设备ID
|
||||
* @param type 短信类型
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void setMessage(String phone, String devCode, String type) {
|
||||
if (!PubUtils.match(PatternRegex.PHONE_REGEX, phone)) {
|
||||
throw new BusinessException(UserResponseEnum.REGISTER_PHONE_WRONG);
|
||||
}
|
||||
String msgTemplate = SmsUtil.getMessageTemplate(type);
|
||||
String vCode = null;
|
||||
SendSmsResponse sendSmsResponse = null;
|
||||
|
||||
//type为4,账号替换为新手机号
|
||||
if (!msgTemplate.equalsIgnoreCase(MessageEnum.REGISTER.getTemplateCode())) {
|
||||
AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>()
|
||||
.eq(AppUser::getPhone, phone)
|
||||
.ne(AppUser::getState, 0)
|
||||
);
|
||||
if ("4".equalsIgnoreCase(type)) {
|
||||
//注册,无需判断手机号与设备的匹配
|
||||
if (appUser != null) {
|
||||
throw new BusinessException(UserCodeEnum.REGIST_PHONE_FAIL.getMsg());
|
||||
}
|
||||
} else {
|
||||
if (null == appUser) {
|
||||
throw new BusinessException(UserCodeEnum.NO_USER.getMsg());
|
||||
} else {
|
||||
appUser.setDevCode(devCode);
|
||||
this.updateById(appUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
//开始执行短信发送
|
||||
vCode = getMessageCode();
|
||||
sendSmsResponse=new SendSmsResponse();
|
||||
sendSmsResponse.setCode("OK");
|
||||
// sendSmsResponse = smsUtil.sendSms(phone, msgTemplate, "code", vCode);
|
||||
String key = RedisKeyEnum.SMS_LOGIN_KEY.getKey() + phone;
|
||||
if (sendSmsResponse.getCode() != null && "OK".equals(sendSmsResponse.getCode())) {
|
||||
//成功发送短信验证码后,保存进redis,验证码失效为5分钟
|
||||
redisUtil.saveByKeyWithExpire(key, vCode, 300L);
|
||||
} else {
|
||||
throw new BusinessException(UserResponseEnum.SEND_CODE_FAIL);
|
||||
}
|
||||
//短信入库
|
||||
addSendMessage(phone, vCode, sendSmsResponse);
|
||||
} catch (Exception e) {
|
||||
log.error("发送短信异常,异常为:" + e.getMessage());
|
||||
//短信入库
|
||||
addSendMessage(phone, vCode, sendSmsResponse);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义获取验证码,固定为字母和数字的组合
|
||||
*/
|
||||
private String getMessageCode() {
|
||||
String result = "";
|
||||
char[] numbers = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
//填充数字
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int numberIndex = new Random().nextInt(10);
|
||||
result = result + numbers[numberIndex];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码入库
|
||||
*/
|
||||
public void addSendMessage(String phone, String vCode, SendSmsResponse sendSmsResponse) {
|
||||
AppSendMsg appSendMsg = new AppSendMsg();
|
||||
appSendMsg.setPhone(phone);
|
||||
appSendMsg.setMessage(vCode);
|
||||
appSendMsg.setSendTime(LocalDateTime.now());
|
||||
appSendMsg.setSendStatus(sendSmsResponse.getCode() == null ? "无状态" : sendSmsResponse.getCode());
|
||||
appSendMsgService.save(appSendMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||
import com.njcn.cloud.pojo.vo.EventEigDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventWaveDetailVO;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 暂态消息详情 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
public interface IAppEventInfoService extends IService<AppEventInfo> {
|
||||
|
||||
/**
|
||||
* @Description: 暂态事件特征幅值
|
||||
* @param eventDetailIndex
|
||||
* @return: java.util.List<com.njcn.cloud.pojo.vo.EventEigDetailVO>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:44
|
||||
*/
|
||||
EventEigDetailVO.Detail eventDetailEigenvalue(String eventDetailIndex);
|
||||
|
||||
/**
|
||||
* @Description: 暂态事件波形图
|
||||
* @param eventDetailIndex
|
||||
* @return: com.njcn.cloud.pojo.vo.EventWaveDetailVO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 16:28
|
||||
*/
|
||||
EventWaveDetailVO eventDetailWave(String eventDetailIndex) ;
|
||||
|
||||
/**
|
||||
* @Description: 暂态评价
|
||||
* @param eventDetailIndex
|
||||
* @param evaluate
|
||||
* @param userId
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/2 14:45
|
||||
*/
|
||||
Boolean eventDetailEvaluate(String eventDetailIndex, Integer evaluate, String userId);
|
||||
|
||||
/**
|
||||
* @Description: 获取波形数据
|
||||
* @param eventId
|
||||
* @param iType
|
||||
* @return: com.njcn.event.file.pojo.dto.WaveDataDTO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/2 14:46
|
||||
*/
|
||||
WaveDataDTO analyseWave(String eventId, int iType);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppEventMsg;
|
||||
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.EventMsgDetailVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app暂态消息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
public interface IAppEventMsgService extends IService<AppEventMsg> {
|
||||
|
||||
/**
|
||||
* @Description: 暂态消息列表
|
||||
* @param param
|
||||
* @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.njcn.cloud.pojo.vo.EventMsgDetailVO>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 13:36
|
||||
*/
|
||||
Page<EventMsgDetailVO> eventMsgPage(BaseParam param);
|
||||
|
||||
/**
|
||||
* @Description: 暂态事件基本信息
|
||||
* @param id 暂态消息id
|
||||
* @return: com.njcn.cloud.pojo.vo.EventInfoDetailVO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 13:35
|
||||
*/
|
||||
EventInfoDetailVO eventInfoDetail(String id);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppEventInfo;
|
||||
import com.njcn.cloud.pojo.dto.AppReport;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报告信息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-02
|
||||
*/
|
||||
public interface IAppReportService extends IService<AppReport> {
|
||||
|
||||
/**
|
||||
* @Description: 报告申请
|
||||
* @param userId
|
||||
* @param eventDetailIndex
|
||||
* @return: int
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/2 14:38
|
||||
*/
|
||||
String eventDetailReportApply(String userId, String eventDetailIndex) throws Exception;
|
||||
|
||||
/**
|
||||
* @Description: 报告下载入口
|
||||
* @param userId
|
||||
* @param eventDetailIndex
|
||||
* @return: com.njcn.cloud.pojo.dto.AppEventInfo
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 8:53
|
||||
*/
|
||||
AppEventInfo getDownLoadPath(String userId, String eventDetailIndex);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppSendMsg;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-31
|
||||
*/
|
||||
public interface IAppSendMsgService extends IService<AppSendMsg> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyAss;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态消息详情 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface IAppSteadyAssService extends IService<AppSteadyAss> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyMsg;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||
import com.njcn.cloud.pojo.vo.AppSteadyMsgVO;
|
||||
import com.njcn.cloud.pojo.vo.SteadyMsgDetailVO;
|
||||
import com.njcn.cloud.pojo.vo.SteadyTargetVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态消息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface IAppSteadyMsgService extends IService<AppSteadyMsg> {
|
||||
|
||||
/**
|
||||
* @Description: 稳态越线列表
|
||||
* @param param
|
||||
* @return: com.njcn.cloud.pojo.vo.AppSteadyMsgVO
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 9:24
|
||||
*/
|
||||
AppSteadyMsgVO getSteadyState(BaseParam param);
|
||||
|
||||
/**
|
||||
* @Description: 稳态越限列表详细信息
|
||||
* @param steadyIndex
|
||||
* @return: java.util.List<com.njcn.cloud.pojo.vo.SteadyMsgDetailVO>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 13:40
|
||||
*/
|
||||
List<SteadyMsgDetailVO> getSteadyDetail(String steadyIndex);
|
||||
|
||||
/**
|
||||
* @Description: 获取稳态越限指标
|
||||
* @param lineIndex
|
||||
* @param timeId
|
||||
* @return: java.util.List<com.njcn.cloud.pojo.dto.AppSteadyUrl>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 16:08
|
||||
*/
|
||||
List<SteadyTargetVO> getSteadyTarget(String lineIndex, String timeId);
|
||||
|
||||
/**
|
||||
* @Description: 获取稳态越限指标图形
|
||||
* @param lineIndex
|
||||
* @param timeId
|
||||
* @param typeCode
|
||||
* @return: com.njcn.cloud.pojo.dto.AppSteadyUrl
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/3 16:20
|
||||
*/
|
||||
AppSteadyUrl getSteadyTargetUrl(String lineIndex, String timeId,Integer typeCode);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 稳态图形信息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface IAppSteadyUrlService extends IService<AppSteadyUrl> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.njcn.cloud.service.user;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cloud.pojo.dto.AppUser;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @date: 2019/10/17 11:36
|
||||
*/
|
||||
public interface IAppUserService extends IService<AppUser> {
|
||||
void setMessage(String phone, String devCode, String type);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user