优化代码逻辑
This commit is contained in:
parent
107f28a7a6
commit
498802bf47
|
@ -1,5 +1,6 @@
|
|||
package com.example.demo.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.example.demo.constant.EleConstant;
|
||||
import com.example.demo.constant.StaConstant;
|
||||
import com.example.demo.mapper.ElectricityBillMapper;
|
||||
|
@ -30,12 +31,11 @@ public class BasicServiceImpl implements BasicService {
|
|||
Response response = new Response();
|
||||
List<ElectricityBill> bills = new ArrayList<>();
|
||||
TypeAndQuery typeAndQuery = new TypeAndQuery();
|
||||
String type =new String();
|
||||
Integer querySymbol = new Integer(0);
|
||||
analysisKeyWord(keyWord,typeAndQuery);
|
||||
if (0 == typeAndQuery.getQuerySymbol()){
|
||||
log.info("不支持的查询类型");
|
||||
response.setSta(StaConstant.UNSUPPORTED_QUERY_TYPE);
|
||||
response.setMessage("failed");
|
||||
response.setData("暂时还不支持查询此类问题,您可以说查询电费或查询电量");
|
||||
return response;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class BasicServiceImpl implements BasicService {
|
|||
if (1 == typeAndQuery.getQuerySymbol()){
|
||||
log.info("数据库查询电量!");
|
||||
response.setSta(StaConstant.UNSUPPORTED_QUERY_TYPE);
|
||||
response.setMessage("failed");
|
||||
response.setData("电量查询暂未开放!");
|
||||
return response;
|
||||
}else if (2 == typeAndQuery.getQuerySymbol()){
|
||||
|
@ -51,10 +52,12 @@ public class BasicServiceImpl implements BasicService {
|
|||
bills = electricityBillMapper.queryElectricityByDate();
|
||||
dataAndView.setData(bills);
|
||||
response.setSta(StaConstant.SUCCESS);
|
||||
response.setMessage("success");
|
||||
response.setData(dataAndView);
|
||||
}else {
|
||||
log.info("暂时还没有此类查询!");
|
||||
response.setSta(StaConstant.UNSUPPORTED_QUERY_TYPE);
|
||||
response.setMessage("failed");
|
||||
response.setData("暂时还不支持查询此类问题,您可以说查询电费或查询电量");
|
||||
return response;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue