|
@@ -73,14 +73,14 @@ public class QueryServiceImpl implements IQueryService {
|
|
@Override
|
|
@Override
|
|
public AjaxResult selectReport(ReportQueryLog reportQueryLog) {
|
|
public AjaxResult selectReport(ReportQueryLog reportQueryLog) {
|
|
//通用校验
|
|
//通用校验
|
|
- AjaxResult validateResult = queryPublic(reportQueryLog);
|
|
|
|
|
|
+ AjaxResult validateResult = queryPublic(reportQueryLog,true);
|
|
if (!UserConstants.QUERY_SUCCESS.equals(validateResult.get(MSG_TAG))) {
|
|
if (!UserConstants.QUERY_SUCCESS.equals(validateResult.get(MSG_TAG))) {
|
|
return validateResult;
|
|
return validateResult;
|
|
}
|
|
}
|
|
//获取查询方式
|
|
//获取查询方式
|
|
String queryMode = reportQueryLog.getQueryMode();
|
|
String queryMode = reportQueryLog.getQueryMode();
|
|
//二维码查询
|
|
//二维码查询
|
|
- if (UserConstants.QUERY_MODE_EQ.equals(queryMode)) {
|
|
|
|
|
|
+ if (UserConstants.QUERY_MODE_QR.equals(queryMode)) {
|
|
return queryByQr(reportQueryLog);
|
|
return queryByQr(reportQueryLog);
|
|
//粗略查询
|
|
//粗略查询
|
|
} else if (UserConstants.QUERY_MODE_ROUGH.equals(queryMode)) {
|
|
} else if (UserConstants.QUERY_MODE_ROUGH.equals(queryMode)) {
|
|
@@ -156,8 +156,8 @@ public class QueryServiceImpl implements IQueryService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public AjaxResult sendQueryNum(ReportQueryLog reportQueryLog) {
|
|
public AjaxResult sendQueryNum(ReportQueryLog reportQueryLog) {
|
|
- //发送查询码前,先校验验证码是否通过
|
|
|
|
- AjaxResult result = queryPublic(reportQueryLog);
|
|
|
|
|
|
+ //发送查询码前,先校验验证码是否通过,且不删除redis中key
|
|
|
|
+ AjaxResult result = queryPublic(reportQueryLog,false);
|
|
if (!UserConstants.QUERY_SUCCESS.equals(result.get(MSG_TAG))) {
|
|
if (!UserConstants.QUERY_SUCCESS.equals(result.get(MSG_TAG))) {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -165,38 +165,47 @@ public class QueryServiceImpl implements IQueryService {
|
|
String reportNumber = reportQueryLog.getReportNumber();
|
|
String reportNumber = reportQueryLog.getReportNumber();
|
|
if (StringUtils.isNotBlank(reportNumber)) {
|
|
if (StringUtils.isNotBlank(reportNumber)) {
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumberDetail(reportNumber);
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumberDetail(reportNumber);
|
|
- //档案拥有者的手机号码
|
|
|
|
- String phonenumber = reportDetail.getPhonenumber();
|
|
|
|
- if (StringUtils.isNotBlank(phonenumber)) {
|
|
|
|
- //给文档创建人发送询问短信
|
|
|
|
- try {
|
|
|
|
- String queryType = reportQueryLog.getQueryType();
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
- String phone = "";
|
|
|
|
- if (UserConstants.QUERY_TYPE_PEOPLE.equals(queryType)) {
|
|
|
|
- sb.append(reportQueryLog.getQueryName()).append("(个人)");
|
|
|
|
- phone = reportQueryLog.getQueryPhone();
|
|
|
|
|
|
+ if (reportDetail != null){
|
|
|
|
+ //档案拥有者的手机号码
|
|
|
|
+ String phonenumber = reportDetail.getPhonenumber();
|
|
|
|
+ if (StringUtils.isNotBlank(phonenumber)) {
|
|
|
|
+ //给文档创建人发送询问短信
|
|
|
|
+ try {
|
|
|
|
+ String queryType = reportQueryLog.getQueryType();
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ String phone = "";
|
|
|
|
+ if (UserConstants.QUERY_TYPE_PEOPLE.equals(queryType)) {
|
|
|
|
+ sb.append(reportQueryLog.getQueryName()).append("(个人)");
|
|
|
|
+ phone = reportQueryLog.getQueryPhone();
|
|
|
|
+ }
|
|
|
|
+ if (UserConstants.QUERY_TYPE_UNIT.equals(queryType)) {
|
|
|
|
+ sb.append(reportQueryLog.getCompanyName()).append("(单位)");
|
|
|
|
+ phone = reportQueryLog.getCompanyPhone();
|
|
|
|
+ }
|
|
|
|
+ //"{\"code\":\"" + code + "\"}"
|
|
|
|
+ //"{\"name\":\"" + sb.toString() + "\",\"reportNumber\":\"" + reportNumber + "\"}"
|
|
|
|
+ String code = "1234";
|
|
|
|
+ SendSmsResponse sendSmsResponse = SendSmsUtils.sendSms(phonenumber, "{\"code\":\"" + code + "\"}", accessKeyId, accessKeySecret, signNameQuery, templateCodeQuery);
|
|
|
|
+ QuerySendDetailsResponse querySendDetailsResponse = SendSmsUtils.querySendDetails(sendSmsResponse.getBizId(), phonenumber, accessKeyId, accessKeySecret);
|
|
|
|
+ String ok = querySendDetailsResponse.getCode();
|
|
|
|
+ if ("OK".equals(ok)) {
|
|
|
|
+ //redis存储查询人的手机号码
|
|
|
|
+ redisCache.setCacheObject(UserConstants.QUERY_NUM_CREATE + phonenumber, phone, 30, TimeUnit.MINUTES);
|
|
|
|
+ return AjaxResult.success("发送成功,请等待对方回复");
|
|
|
|
+ } else {
|
|
|
|
+ return AjaxResult.error(querySendDetailsResponse.getMessage());
|
|
|
|
+ }
|
|
|
|
+ } catch (ClientException e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
- if (UserConstants.QUERY_TYPE_UNIT.equals(queryType)) {
|
|
|
|
- sb.append(reportQueryLog.getCompanyName()).append("(单位)");
|
|
|
|
- phone = reportQueryLog.getCompanyPhone();
|
|
|
|
- }
|
|
|
|
- SendSmsResponse sendSmsResponse = SendSmsUtils.sendSms(phonenumber, "{\"name\":\"" + sb.toString() + "\",\"reportNumber\":\"" + reportNumber + "\"}", accessKeyId, accessKeySecret, signNameQuery, templateCodeQuery);
|
|
|
|
- QuerySendDetailsResponse querySendDetailsResponse = SendSmsUtils.querySendDetails(sendSmsResponse.getBizId(), phonenumber, accessKeyId, accessKeySecret);
|
|
|
|
- String ok = querySendDetailsResponse.getCode();
|
|
|
|
- if ("OK".equals(ok)) {
|
|
|
|
- //redis存储查询人的手机号码
|
|
|
|
- redisCache.setCacheObject(UserConstants.QUERY_NUM_CREATE + phonenumber, phone, 30, TimeUnit.MINUTES);
|
|
|
|
- return AjaxResult.success("发送成功,请等待对方回复");
|
|
|
|
- } else {
|
|
|
|
- return AjaxResult.error(querySendDetailsResponse.getMessage());
|
|
|
|
- }
|
|
|
|
- } catch (ClientException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ }else {
|
|
|
|
+ return AjaxResult.error("文档拥有者暂未填写手机号,无法获得查询码");
|
|
}
|
|
}
|
|
|
|
+ }else {
|
|
|
|
+ return AjaxResult.error("查询的文档编号不存在");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
|
|
+ return AjaxResult.error("未填写查询报告编号");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -233,14 +242,18 @@ public class QueryServiceImpl implements IQueryService {
|
|
return AjaxResult.error(remark);
|
|
return AjaxResult.error(remark);
|
|
}
|
|
}
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumber(reportNumber);
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumber(reportNumber);
|
|
- reportDetail.setReportUrl(null);
|
|
|
|
- reportQueryLog.setIsSuccess("0");
|
|
|
|
- reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
|
|
- return AjaxResult.success(reportDetail);
|
|
|
|
|
|
+ if (reportDetail != null) {
|
|
|
|
+ reportDetail.setReportUrl(null);
|
|
|
|
+ reportQueryLog.setIsSuccess("Y");
|
|
|
|
+ reportQueryLog.setRemark(UserConstants.QUERY_SUCCESS);
|
|
|
|
+ reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
|
|
+ return AjaxResult.success(reportDetail);
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
+ return AjaxResult.error("未查询到对应信息");
|
|
}
|
|
}
|
|
- return AjaxResult.success();
|
|
|
|
|
|
+ return AjaxResult.error("未查询到对应信息");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -252,11 +265,17 @@ public class QueryServiceImpl implements IQueryService {
|
|
*/
|
|
*/
|
|
private AjaxResult queryByRough(ReportQueryLog reportQueryLog) {
|
|
private AjaxResult queryByRough(ReportQueryLog reportQueryLog) {
|
|
String reportNumber = reportQueryLog.getReportNumber();
|
|
String reportNumber = reportQueryLog.getReportNumber();
|
|
- reportQueryLog.setIsSuccess("0");
|
|
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumber(reportNumber);
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumber(reportNumber);
|
|
- reportDetail.setReportUrl(null);
|
|
|
|
|
|
+ if (reportDetail != null) {
|
|
|
|
+ reportDetail.setReportUrl(null);
|
|
|
|
+ reportQueryLog.setRemark(UserConstants.QUERY_SUCCESS);
|
|
|
|
+ reportQueryLog.setIsSuccess("Y");
|
|
|
|
+ reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
|
|
+ return AjaxResult.success(reportDetail);
|
|
|
|
+ }
|
|
|
|
+ reportQueryLog.setRemark("查询的文档编号不存在");
|
|
reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
- return AjaxResult.success(reportDetail);
|
|
|
|
|
|
+ return AjaxResult.error("查询的文档编号不存在");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -283,17 +302,23 @@ public class QueryServiceImpl implements IQueryService {
|
|
return AjaxResult.error(resultNum);
|
|
return AjaxResult.error(resultNum);
|
|
}
|
|
}
|
|
String reportNumber = reportQueryLog.getReportNumber();
|
|
String reportNumber = reportQueryLog.getReportNumber();
|
|
- reportQueryLog.setIsSuccess("0");
|
|
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumber(reportNumber);
|
|
ReportDetail reportDetail = reportDetailMapper.selectReportDetailByReportNumber(reportNumber);
|
|
|
|
+ if (reportDetail != null) {
|
|
|
|
+ reportQueryLog.setIsSuccess("Y");
|
|
|
|
+ reportQueryLog.setRemark(UserConstants.QUERY_SUCCESS);
|
|
|
|
+ reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
|
|
+ return AjaxResult.success(reportDetail);
|
|
|
|
+ }
|
|
|
|
+ reportQueryLog.setRemark("查询的文档编号不存在");
|
|
reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
- return AjaxResult.success(reportDetail);
|
|
|
|
|
|
+ return AjaxResult.error("查询的文档编号不存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询通用校验模块
|
|
* 查询通用校验模块
|
|
*/
|
|
*/
|
|
- private AjaxResult queryPublic(ReportQueryLog reportQueryLog) {
|
|
|
|
|
|
+ private AjaxResult queryPublic(ReportQueryLog reportQueryLog,Boolean isDelKey) {
|
|
//获取查询主体
|
|
//获取查询主体
|
|
String queryType = reportQueryLog.getQueryType();
|
|
String queryType = reportQueryLog.getQueryType();
|
|
String queryMode = reportQueryLog.getQueryMode();
|
|
String queryMode = reportQueryLog.getQueryMode();
|
|
@@ -318,7 +343,7 @@ public class QueryServiceImpl implements IQueryService {
|
|
}
|
|
}
|
|
|
|
|
|
//校验验证码
|
|
//校验验证码
|
|
- String resultCaptcha = validateCaptcha(phone, reportQueryLog.getCode());
|
|
|
|
|
|
+ String resultCaptcha = validateCaptcha(phone, reportQueryLog.getCode(),isDelKey);
|
|
if (!UserConstants.QUERY_SUCCESS.equals(resultCaptcha)) {
|
|
if (!UserConstants.QUERY_SUCCESS.equals(resultCaptcha)) {
|
|
reportQueryLog.setRemark(resultCaptcha);
|
|
reportQueryLog.setRemark(resultCaptcha);
|
|
reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
reportQueryLogMapper.insertReportQueryLog(reportQueryLog);
|
|
@@ -333,7 +358,7 @@ public class QueryServiceImpl implements IQueryService {
|
|
* @param queryPhone 查询者手机号
|
|
* @param queryPhone 查询者手机号
|
|
* @return 结果
|
|
* @return 结果
|
|
*/
|
|
*/
|
|
- public String validateCaptcha(String queryPhone, String code) {
|
|
|
|
|
|
+ public String validateCaptcha(String queryPhone, String code,Boolean isDelKey) {
|
|
String verifyKey = UserConstants.QUERY_CODE_KEY + queryPhone;
|
|
String verifyKey = UserConstants.QUERY_CODE_KEY + queryPhone;
|
|
String captcha = redisCache.getCacheObject(verifyKey);
|
|
String captcha = redisCache.getCacheObject(verifyKey);
|
|
if (captcha == null) {
|
|
if (captcha == null) {
|
|
@@ -342,7 +367,9 @@ public class QueryServiceImpl implements IQueryService {
|
|
if (!code.equalsIgnoreCase(captcha)) {
|
|
if (!code.equalsIgnoreCase(captcha)) {
|
|
return "验证码不正确,请检查";
|
|
return "验证码不正确,请检查";
|
|
}
|
|
}
|
|
- redisCache.deleteObject(verifyKey);
|
|
|
|
|
|
+ if (isDelKey){
|
|
|
|
+ redisCache.deleteObject(verifyKey);
|
|
|
|
+ }
|
|
return UserConstants.QUERY_SUCCESS;
|
|
return UserConstants.QUERY_SUCCESS;
|
|
}
|
|
}
|
|
|
|
|