diff --git a/demo/.idea/misc.xml b/demo/.idea/misc.xml new file mode 100644 index 0000000..d5cd614 --- /dev/null +++ b/demo/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/demo/.idea/uiDesigner.xml b/demo/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/demo/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/src/main/java/com/example/demo/demos/web/controller/BasicController.java b/demo/src/main/java/com/example/demo/demos/web/controller/BasicController.java index 9ff5b6c..398ad22 100644 --- a/demo/src/main/java/com/example/demo/demos/web/controller/BasicController.java +++ b/demo/src/main/java/com/example/demo/demos/web/controller/BasicController.java @@ -17,12 +17,14 @@ package com.example.demo.demos.web.controller; import com.alibaba.fastjson.JSON; +import com.example.demo.model.ElecBindInfoModel; import com.example.demo.model.Response; import com.example.demo.model.User; import com.example.demo.service.BasicService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServlet; @@ -59,10 +61,17 @@ public class BasicController { @PostMapping("/getBindingInfo") @ResponseBody - public Object getBindingInfo(HttpServletRequest request) { - log.info("获取绑定信息入参:token={},地区编码:{}", request.getHeader("x_auth_token"),request.getHeader("areaCode")); - Object response = basicService.getBindingInfo(); - log.info("获取绑定信息入参:{}", JSON.toJSONString(response)); + public Object getBindingInfo(HttpServletRequest request, @RequestBody ElecBindInfoModel model) { + Object response = new Object(); + log.info("获取绑定信息入参:token={},model:{}", request.getHeader("x_auth_token"),JSON.toJSONString(model)); + if (null ==model || !(StringUtils.hasText(model.getPhone()) || StringUtils.hasText(model.getElecNumber())|| StringUtils.hasText(model.getUserNumber())|| + StringUtils.hasText(model.getProvince()) || StringUtils.hasText(model.getCity())|| StringUtils.hasText(model.getCityCode()))){ + String token = request.getHeader("x_auth_token"); + response = basicService.getBindingInfo(model); + } + + response = basicService.getBindingInfo(model); + log.info("获取绑定信息返回:{}", JSON.toJSONString(response)); return response; } diff --git a/demo/src/main/java/com/example/demo/model/ElecBindInfoModel.java b/demo/src/main/java/com/example/demo/model/ElecBindInfoModel.java new file mode 100644 index 0000000..d5c0c66 --- /dev/null +++ b/demo/src/main/java/com/example/demo/model/ElecBindInfoModel.java @@ -0,0 +1,18 @@ +package com.example.demo.model; + +import lombok.Data; +import org.springframework.stereotype.Component; + +@Data +@Component +public class ElecBindInfoModel { + + private String province; + private String city; + private String bindType; + private String elecNumber; + private String phone; + private String electricityAddress; + private String userNumber; + private String cityCode; +} diff --git a/demo/src/main/java/com/example/demo/service/BasicService.java b/demo/src/main/java/com/example/demo/service/BasicService.java index 48898f5..b6fc3ad 100644 --- a/demo/src/main/java/com/example/demo/service/BasicService.java +++ b/demo/src/main/java/com/example/demo/service/BasicService.java @@ -1,5 +1,6 @@ package com.example.demo.service; +import com.example.demo.model.ElecBindInfoModel; import com.example.demo.model.Response; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestBody; @@ -13,5 +14,5 @@ public interface BasicService { Object getElectricityInfo1(Map param); - Object getBindingInfo(); + Object getBindingInfo(ElecBindInfoModel model); } diff --git a/demo/src/main/java/com/example/demo/service/impl/BasicServiceImpl.java b/demo/src/main/java/com/example/demo/service/impl/BasicServiceImpl.java index c3c2a5f..4387822 100644 --- a/demo/src/main/java/com/example/demo/service/impl/BasicServiceImpl.java +++ b/demo/src/main/java/com/example/demo/service/impl/BasicServiceImpl.java @@ -93,8 +93,16 @@ public class BasicServiceImpl implements BasicService { } @Override - public Object getBindingInfo() { + public Object getBindingInfo(ElecBindInfoModel model) { QueryWrapper queryWrapper =new QueryWrapper<>(); + Map map = new HashMap<>(); + map.put("phone",model.getPhone()); + map.put("province","广东省"); + map.put("city",model.getCity()); + map.put("elec_number",model.getElecNumber()); + map.put("city_code",model.getCityCode()); + map.put("user_number",model.getUserNumber()); + queryWrapper.allEq(map,false); return elecBillInfoMapper.selectList(queryWrapper); } diff --git a/demo/src/main/resources/application.properties b/demo/src/main/resources/application.properties index bc92381..263469c 100644 --- a/demo/src/main/resources/application.properties +++ b/demo/src/main/resources/application.properties @@ -2,7 +2,7 @@ server.port=9090 # DataSource configuration using HikariCP (default connection pool in Spring Boot) -spring.datasource.url=jdbc:mysql://120.78.126.4:9200/elec?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true +spring.datasource.url=jdbc:mysql://120.78.126.4:9200/elec?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&characterEncoding=utf8 spring.datasource.username=root spring.datasource.password=AL@2025 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -20,5 +20,5 @@ type-aliases-package: com.example.demo.model #需要配置成你当前包下的 configuration: #开启驼峰命名 map-underscore-to-camel-case: true -log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl