更新最新代码
This commit is contained in:
parent
803594ec1b
commit
beba4dae71
|
@ -17,6 +17,7 @@
|
||||||
package com.example.demo.demos.web.controller;
|
package com.example.demo.demos.web.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.example.demo.model.ElePriceInfoModel;
|
||||||
import com.example.demo.model.ElecBindInfoModel;
|
import com.example.demo.model.ElecBindInfoModel;
|
||||||
import com.example.demo.model.Response;
|
import com.example.demo.model.Response;
|
||||||
import com.example.demo.model.User;
|
import com.example.demo.model.User;
|
||||||
|
@ -75,6 +76,16 @@ public class BasicController {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getElePriceInfo")
|
||||||
|
@ResponseBody
|
||||||
|
public Object getElePriceInfo(@RequestBody ElePriceInfoModel model) {
|
||||||
|
Object response = new Object();
|
||||||
|
log.info("获取历史电价信息入参:model:{}", JSON.toJSONString(model));
|
||||||
|
response = basicService.getElePriceInfo(model);
|
||||||
|
log.info("获取绑定信息返回:{}", JSON.toJSONString(response));
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
// http://127.0.0.1:8080/user
|
// http://127.0.0.1:8080/user
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.demo.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.example.demo.model.ElecPriceHistory;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ElecPrivceHistoryMapper extends BaseMapper<ElecPriceHistory> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.example.demo.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
public class ElePriceInfoModel {
|
||||||
|
|
||||||
|
private String province;
|
||||||
|
private String city;
|
||||||
|
private String isSummer;
|
||||||
|
private String elecGradient;
|
||||||
|
private String elecType;
|
||||||
|
private String startTime;
|
||||||
|
private String endTime;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.example.demo.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
public class ElecPriceHistory {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
private String province;
|
||||||
|
private String city;
|
||||||
|
private String isSummer;
|
||||||
|
private String elecGradient;
|
||||||
|
private String elecType;
|
||||||
|
private String effectiveTime;
|
||||||
|
private String elecPrice;
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.example.demo.service;
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
import com.example.demo.model.ElePriceInfoModel;
|
||||||
import com.example.demo.model.ElecBindInfoModel;
|
import com.example.demo.model.ElecBindInfoModel;
|
||||||
import com.example.demo.model.Response;
|
import com.example.demo.model.Response;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -15,4 +16,6 @@ public interface BasicService {
|
||||||
Object getElectricityInfo1(Map<String,Object> param);
|
Object getElectricityInfo1(Map<String,Object> param);
|
||||||
|
|
||||||
Object getBindingInfo(ElecBindInfoModel model);
|
Object getBindingInfo(ElecBindInfoModel model);
|
||||||
|
|
||||||
|
Object getElePriceInfo(ElePriceInfoModel model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
package com.example.demo.service.impl;
|
package com.example.demo.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
|
||||||
import com.example.demo.constant.EleConstant;
|
import com.example.demo.constant.EleConstant;
|
||||||
import com.example.demo.constant.StaConstant;
|
import com.example.demo.constant.StaConstant;
|
||||||
import com.example.demo.mapper.ElecBillInfoMapper;
|
import com.example.demo.mapper.ElecBillInfoMapper;
|
||||||
|
import com.example.demo.mapper.ElecPrivceHistoryMapper;
|
||||||
import com.example.demo.mapper.ElectricityBillMapper;
|
import com.example.demo.mapper.ElectricityBillMapper;
|
||||||
import com.example.demo.model.*;
|
import com.example.demo.model.*;
|
||||||
import com.example.demo.service.BasicService;
|
import com.example.demo.service.BasicService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -30,6 +27,9 @@ public class BasicServiceImpl implements BasicService {
|
||||||
@Autowired
|
@Autowired
|
||||||
ElecBillInfoMapper elecBillInfoMapper;
|
ElecBillInfoMapper elecBillInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ElecPrivceHistoryMapper elecPrivceHistoryMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response getElectricityInfo(Map<String, Object> param) {
|
public Response getElectricityInfo(Map<String, Object> param) {
|
||||||
String keyWord = (String) param.get("kw");
|
String keyWord = (String) param.get("kw");
|
||||||
|
@ -97,7 +97,7 @@ public class BasicServiceImpl implements BasicService {
|
||||||
QueryWrapper<ElecBindInfo> queryWrapper =new QueryWrapper<>();
|
QueryWrapper<ElecBindInfo> queryWrapper =new QueryWrapper<>();
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("phone",model.getPhone());
|
map.put("phone",model.getPhone());
|
||||||
map.put("province","广东省");
|
map.put("province",model.getProvince());
|
||||||
map.put("city",model.getCity());
|
map.put("city",model.getCity());
|
||||||
map.put("elec_number",model.getElecNumber());
|
map.put("elec_number",model.getElecNumber());
|
||||||
map.put("city_code",model.getCityCode());
|
map.put("city_code",model.getCityCode());
|
||||||
|
@ -106,6 +106,28 @@ public class BasicServiceImpl implements BasicService {
|
||||||
return elecBillInfoMapper.selectList(queryWrapper);
|
return elecBillInfoMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElePriceInfo(ElePriceInfoModel model) {
|
||||||
|
QueryWrapper<ElecPriceHistory> queryWrapper =new QueryWrapper<>();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
List<Map<String,String>> result = new ArrayList<>();
|
||||||
|
map.put("is_summer",model.getIsSummer());
|
||||||
|
map.put("elec_gradient",model.getElecGradient());
|
||||||
|
map.put("elec_type",model.getElecType());
|
||||||
|
queryWrapper.allEq(map,false)
|
||||||
|
.between("effective_time",model.getStartTime(),model.getEndTime())
|
||||||
|
.like("province",model.getProvince())
|
||||||
|
.like("city",model.getCity());
|
||||||
|
List<ElecPriceHistory> elecPriceHistories = elecPrivceHistoryMapper.selectList(queryWrapper);
|
||||||
|
elecPriceHistories.stream().forEach(e ->{
|
||||||
|
Map<String,String> priceMap = new HashMap<>();
|
||||||
|
priceMap.put("price",e.getElecPrice());
|
||||||
|
priceMap.put("date",e.getEffectiveTime());
|
||||||
|
result.add(priceMap);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private void analysisKeyWord(String keyWord,TypeAndQuery typeAndQuery){
|
private void analysisKeyWord(String keyWord,TypeAndQuery typeAndQuery){
|
||||||
int querySymbol = 0;
|
int querySymbol = 0;
|
||||||
String type = EleConstant.LINE_TYPE_BG;
|
String type = EleConstant.LINE_TYPE_BG;
|
||||||
|
|
|
@ -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.example.demo.mapper.ElecPrivceHistoryMapper">
|
||||||
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue