From bd5db854a57c5940030e8976027ae503833e3157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=BA=AF?= <340251836@qq.com> Date: Tue, 7 Apr 2020 09:41:13 +0800 Subject: [PATCH] =?UTF-8?q?[ljw]=202020/03/31=20ljw=20=E4=BE=BF=E6=B0=91?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=A8=A1=E5=9D=97=20[=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=86=85=E5=AE=B9]=20=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatway/pom.xml | 14 ++ .../gatway/filter/PropertyLoginFilter.java | 2 +- .../gatway/filter/PropertySecurityFilter.java | 22 +- gatway/src/main/resources/application.yml | 2 +- .../gatway/GatwayApplicationTests.java | 10 + parkservice/pom.xml | 17 ++ .../parkservice/ParkserviceApplication.java | 4 + .../parkservice/common/CommonResult.java | 105 +++++++++ .../parkservice/common/ResultUtil.java | 32 +++ .../controller/AreaController.java | 27 +++ .../controller/ParkingApplyController.java | 27 +++ .../controller/ParkingInfoController.java | 28 +++ .../ParkingRentRecordsController.java | 47 +++++ .../parkservice/dao/AreaInfoMapper.java | 23 ++ .../dao/OwnerParkingApplyMapper.java | 17 ++ .../parkservice/dao/ParkingInfoMapper.java | 23 ++ .../dao/ParkingRentRecordsMapper.java | 32 +++ .../parkservice/dao/PersonUserMapper.java | 21 ++ .../parkservice/dto/AddParkingApply.java | 26 +++ .../parkservice/dto/MyParkingRecordsDTO.java | 22 ++ .../parkservice/dto/ParkingRentDTO.java | 21 ++ .../parkservice/dto/ParkingRentDateDTO.java | 13 ++ .../parkservice/pojo/AreaInfo.java | 48 +++++ .../parkservice/pojo/OwnerParkingApply.java | 28 +++ .../parkservice/pojo/ParkingInfo.java | 109 ++++++++++ .../parkservice/pojo/ParkingRentRecords.java | 26 +++ .../parkservice/pojo/PersonUser.java | 37 ++++ .../parkservice/service/AreaInfoService.java | 9 + .../service/ParkingApplyService.java | 9 + .../service/ParkingInfoService.java | 9 + .../service/ParkingRentRecordsService.java | 17 ++ .../service/impl/AreaInfoServiceImpl.java | 21 ++ .../service/impl/ParkingApplyServiceImpl.java | 39 ++++ .../service/impl/ParkingInfoServiceImpl.java | 21 ++ .../impl/ParkingRentRecordsServiceImpl.java | 65 ++++++ .../src/main/resources/generatorConfig.xml | 57 +++++ .../main/resources/mapper/AreaInfoMapper.xml | 82 ++++++++ .../mapper/OwnerParkingApplyMapper.xml | 142 +++++++++++++ .../resources/mapper/ParkingInfoMapper.xml | 153 ++++++++++++++ .../mapper/ParkingRentRecordsMapper.xml | 124 +++++++++++ .../resources/mapper/PersonUserMapper.xml | 199 ++++++++++++++++++ .../ParkserviceApplicationTests.java | 13 ++ .../PropertydemoApplicationTests.java | 2 +- .../dao/ParkingInfoMapper.java | 2 +- .../pojo/OwnerParkingApply.java | 2 + .../propertymanagement/pojo/ParkingInfo.java | 15 +- .../propertymanagement/pojo/PpPayservice.java | 23 ++ .../impl/OwnerParkingApplyServiceImpl.java | 2 +- .../mapper/OwnerParkingApplyMapper.xml | 3 +- 49 files changed, 1779 insertions(+), 13 deletions(-) create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java create mode 100644 parkservice/src/main/resources/generatorConfig.xml create mode 100644 parkservice/src/main/resources/mapper/AreaInfoMapper.xml create mode 100644 parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml create mode 100644 parkservice/src/main/resources/mapper/ParkingInfoMapper.xml create mode 100644 parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml create mode 100644 parkservice/src/main/resources/mapper/PersonUserMapper.xml diff --git a/gatway/pom.xml b/gatway/pom.xml index f6d909d..8e4d930 100644 --- a/gatway/pom.xml +++ b/gatway/pom.xml @@ -72,6 +72,20 @@ org.springframework.boot spring-boot-maven-plugin + + + + + + + + + + + + + + diff --git a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java index 4731361..0c1fbf8 100644 --- a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java +++ b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java @@ -31,7 +31,7 @@ public class PropertyLoginFilter extends ZuulFilter { JWTUtils jwtUtils; @Value("${my.auth_verify.duration}") - Integer duration; + Long duration; @Value("${my.propertymanagement.name}") String applicationName; diff --git a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java index 5b239cf..0982a28 100644 --- a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java +++ b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java @@ -13,6 +13,9 @@ import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import sun.misc.Request; +import java.util.ArrayList; +import java.util.List; + @Component public class PropertySecurityFilter extends ZuulFilter { @@ -41,10 +44,15 @@ public class PropertySecurityFilter extends ZuulFilter { */ @Override public boolean shouldFilter() { -// System.out.println(RequestContext.getCurrentContext().getRequest().getRequestURI()); + List list_url = new ArrayList(); + list_url.add("/propertymanagement/user/test2"); + list_url.add("/propertymanagement/area/getone"); +// list_url.add("/propertymanagement/propertyservice"); // 测试 路径 - if (RequestContext.getCurrentContext().getRequest().getRequestURI().contains("/propertymanagement/user/test2")){ - return true; + for(String url: list_url){ + if (RequestContext.getCurrentContext().getRequest().getRequestURI().contains(url)){ + return true; + } } return false; } @@ -52,19 +60,21 @@ public class PropertySecurityFilter extends ZuulFilter { @Override - public Object run() throws ZuulException { + public Object run(){ RequestContext requestContext = RequestContext.getCurrentContext(); // 获取 用户名信息 String username = requestContext.getRequest().getHeader("username"); String token = requestContext.getRequest().getHeader("token"); + System.out.println(token); + System.out.println(username); // 解密 token 信息 String result_name = jwtUtils.unsign(token,String.class); - if(!result_name.equals(username)){ + if(result_name == null || !result_name.equals(username)){ // 认证失败拒绝访问 requestContext.setSendZuulResponse(false); requestContext.setResponseStatusCode(200); - JSONObject jsonObject = (JSONObject) JSONObject.toJSON(CommonResult.failed("登录失败")); + JSONObject jsonObject = (JSONObject) JSONObject.toJSON(CommonResult.failed("abs")); requestContext.setResponseBody(jsonObject.toJSONString()); } return null; diff --git a/gatway/src/main/resources/application.yml b/gatway/src/main/resources/application.yml index f1193bc..1e860ae 100644 --- a/gatway/src/main/resources/application.yml +++ b/gatway/src/main/resources/application.yml @@ -34,7 +34,7 @@ my: AA#$%()(#*!()!KL<>?N<:{LWPW auth_verify: duration: - 3600 + 3600000 propertymanagement: name: propertymanagement \ No newline at end of file diff --git a/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java b/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java index b430dad..15a4c2b 100644 --- a/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java +++ b/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java @@ -1,13 +1,23 @@ package com.team7.happycommunity.gatway; +import com.team7.happycommunity.gatway.utils.JWTUtils; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class GatwayApplicationTests { + @Autowired + JWTUtils jwtUtils; + + private String myusername = "hc123123"; + @Test void contextLoads() { + + String result = jwtUtils.unsign("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODUyMDYxMTQxMjEsInBheWxvYWQiOiJcInJvb3RcIiJ9.IQBCozSDN5in4IXXjP_4othnoUzNsfFhabgBRTkQNMk", String.class); + System.out.println(result); } } diff --git a/parkservice/pom.xml b/parkservice/pom.xml index 9be673c..fca95c2 100644 --- a/parkservice/pom.xml +++ b/parkservice/pom.xml @@ -98,6 +98,23 @@ + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + ${basedir}/src/main/resources/generatorConfig.xml + + + + mysql + mysql-connector-java + 5.1.47 + + + + org.springframework.boot spring-boot-maven-plugin diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java index 5fb2668..05758f9 100644 --- a/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java @@ -1,9 +1,13 @@ package com.team7.happycommunity.parkservice; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication +@MapperScan(value = {"com.team7.happycommunity.parkservice.dao"}) +@EnableEurekaClient public class ParkserviceApplication { public static void main(String[] args) { diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java new file mode 100644 index 0000000..cb397d1 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java @@ -0,0 +1,105 @@ +package com.team7.happycommunity.parkservice.common; + +import java.io.Serializable; + +public class CommonResult implements Serializable { + //状态码 + private Long code; + //提示消息 + private String message; + //响应数据 + private T data; + + public CommonResult(){} + public CommonResult(Long code, String message){ + this.code = code; + this.message = message; + } + + public CommonResult(Long code , String message, T data){ + this.code = code; + this.message = message; + this.data = data; + } + + /** + * 响应成功的结果 + * @return 状态码 200 + */ + public static CommonResult success(){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),ResultUtil.SUCCESS.getMessage()); + } + + public static CommonResult success(String message){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),message); + } + + public static CommonResult success(T data){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),ResultUtil.SUCCESS.getMessage(),data); + } + public static CommonResult success(String message,T data){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),message,data); + } + + /** + * 响应失败 + * @return 状态码500 + */ + public static CommonResult failed(){ + return new CommonResult(ResultUtil.FAILED.getCode(),ResultUtil.FAILED.getMessage()); + } + + public static CommonResult failed(String message){ + return new CommonResult(ResultUtil.FAILED.getCode(),message); + } + /** + * 参数验证失败 + * @return 状态码 400 + */ + public static CommonResult valetateFailed(){ + return new CommonResult(ResultUtil.VALIDATE_FAILED.getCode(),ResultUtil.VALIDATE_FAILED.getMessage()); + } + public static CommonResult valetateFailed(String msg){ + return new CommonResult(ResultUtil.VALIDATE_FAILED.getCode(),msg); + } + + /** + * 未认证 + * @return 状态码401 + */ + public static CommonResult unathorizedFailed(){ + return new CommonResult(ResultUtil.UNAUTORIED.getCode(), ResultUtil.UNAUTORIED.getMessage()); + } + + /** + * 未授权 + * @return 状态码403 + */ + public static CommonResult forbiddenFailed(){ + return new CommonResult(ResultUtil.FORBIDDEN.getCode(),ResultUtil.FORBIDDEN.getMessage()); + } + + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java new file mode 100644 index 0000000..8cfb173 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java @@ -0,0 +1,32 @@ +package com.team7.happycommunity.parkservice.common; + +public enum ResultUtil { + SUCCESS(200L,"操作成功"), + FAILED(500L,"操作失败"), + VALIDATE_FAILED(400L,"参数验证失败"), + UNAUTORIED(401L,"未认证或token过期"), + FORBIDDEN(403L,"未授权"); + private Long code; + private String message; + + private ResultUtil(Long code,String message){ + this.code = code; + this.message = message; + } + + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java new file mode 100644 index 0000000..31d7f38 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java @@ -0,0 +1,27 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.pojo.AreaInfo; +import com.team7.happycommunity.parkservice.service.AreaInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/area") +public class AreaController { + + @Autowired + AreaInfoService areaInfoService; + + @GetMapping("/getall") + @ResponseBody + public CommonResult getAll(){ + List list_areainfo = areaInfoService.selectAll(); + return CommonResult.success(list_areainfo); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java new file mode 100644 index 0000000..d58b96a --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java @@ -0,0 +1,27 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.dto.AddParkingApply; +import com.team7.happycommunity.parkservice.service.ParkingApplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +@Controller +@RequestMapping("/parkingapply") +public class ParkingApplyController { + + @Autowired + ParkingApplyService parkingApplyService; + + @PostMapping("/add") + @ResponseBody + public CommonResult getResult(@RequestBody AddParkingApply addParkingApply){ + System.out.println("123"); + int i = parkingApplyService.add(addParkingApply); + return i==0?CommonResult.failed():CommonResult.success(); + } + +// @Post() + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java new file mode 100644 index 0000000..7f722d0 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java @@ -0,0 +1,28 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import com.team7.happycommunity.parkservice.service.ParkingInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +@Controller +@RequestMapping("/parkinginfo") +public class ParkingInfoController { + + @Autowired + ParkingInfoService parkingInfoService; + + @GetMapping("/mlist") + @ResponseBody + public CommonResult mlist(@RequestParam(defaultValue = "2") int areaid){ + List list = parkingInfoService.getMList(areaid); + return CommonResult.success(list); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java new file mode 100644 index 0000000..c6b2bb5 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java @@ -0,0 +1,47 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.dao.ParkingRentRecordsMapper; +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDateDTO; +import com.team7.happycommunity.parkservice.service.ParkingRentRecordsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Controller +@RequestMapping("/parkingrent") +public class ParkingRentRecordsController { + + + @Autowired + ParkingRentRecordsService parkingRentRecordsService; + + // 获取当前车位所有出租信息 + @GetMapping("/rlist") + @ResponseBody + public CommonResult getRecerdsList(Integer id){ + List list = parkingRentRecordsService.getRecords(id); + return CommonResult.success(list); + } + + // 获取自己的租用车位信息 + @GetMapping("/mylist") + @ResponseBody + public CommonResult getMyRecordsList(String username){ + List list = parkingRentRecordsService.getMyRecords(username); + return CommonResult.success(list); + } + + + @PostMapping("/add") + @ResponseBody + public CommonResult add(@RequestBody ParkingRentDTO parkingRentDTO){ + int i = parkingRentRecordsService.add(parkingRentDTO); + return i == 0?CommonResult.failed():CommonResult.success(); + } + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java new file mode 100644 index 0000000..6eff08e --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java @@ -0,0 +1,23 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.AreaInfo; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface AreaInfoMapper { + int deleteByPrimaryKey(Integer id); + + int insert(AreaInfo record); + + int insertSelective(AreaInfo record); + + AreaInfo selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(AreaInfo record); + + int updateByPrimaryKey(AreaInfo record); + + @Select("select * from areainfo") + List selectAll(); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java new file mode 100644 index 0000000..baff4f7 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java @@ -0,0 +1,17 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.OwnerParkingApply; + +public interface OwnerParkingApplyMapper { + int deleteByPrimaryKey(Integer id); + + int insert(OwnerParkingApply record); + + int insertSelective(OwnerParkingApply record); + + OwnerParkingApply selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(OwnerParkingApply record); + + int updateByPrimaryKey(OwnerParkingApply record); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java new file mode 100644 index 0000000..42da2bf --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java @@ -0,0 +1,23 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface ParkingInfoMapper { + int deleteByPrimaryKey(Integer id); + + int insert(ParkingInfo record); + + int insertSelective(ParkingInfo record); + + ParkingInfo selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ParkingInfo record); + + int updateByPrimaryKey(ParkingInfo record); + + @Select("select * from parking_info where community_id = #{areaid} and status = 0") + List selectByAreaId(Integer areaid); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java new file mode 100644 index 0000000..549f9aa --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java @@ -0,0 +1,32 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.pojo.ParkingRentRecords; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface ParkingRentRecordsMapper { + int deleteByPrimaryKey(Integer id); + + int insert(ParkingRentRecords record); + + int insertSelective(ParkingRentRecords record); + + ParkingRentRecords selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ParkingRentRecords record); + + int updateByPrimaryKey(ParkingRentRecords record); + + @Select("select * from parking_rent_records where parking_info_id = #{id}") + List selectByParkingInfoId(Integer id); + + + @Select("select r.begin_time beginTime, r.end_time endTime, r.carid carId, " + + " a.area_name areaName,p.parking_number parkingNumber,p.cost_per_day costPerDay from parking_rent_records r left join " + + "parking_info p on p.id = r.parking_info_id " + + "left join areainfo a on a.id = p.community_id " + + "where r.user_id = #{id}") + List selectByUserId(Integer id); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java new file mode 100644 index 0000000..e38d6df --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.PersonUser; +import org.apache.ibatis.annotations.Select; + +public interface PersonUserMapper { + int deleteByPrimaryKey(Integer id); + + int insert(PersonUser record); + + int insertSelective(PersonUser record); + + PersonUser selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(PersonUser record); + + int updateByPrimaryKey(PersonUser record); + + @Select("select * from person_user where name = #{usernmae}") + PersonUser selectByUsername(String userName); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java new file mode 100644 index 0000000..224ef32 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java @@ -0,0 +1,26 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class AddParkingApply implements Serializable { + + private String userName; + + private Integer areaid; + + private String parkingNumber; + + private String parkingInfos; + + private Integer costPerDay; + + private Date beginTime; + + private Date endTime; + + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java new file mode 100644 index 0000000..b5bafe2 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java @@ -0,0 +1,22 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class MyParkingRecordsDTO implements Serializable { + + private String parkingNumber; + + private Integer costPerDay; + + private String beginTime; + + private String endTime; + + private String carid; + + private String areaName; +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java new file mode 100644 index 0000000..7538bb6 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ParkingRentDTO implements Serializable { + + private String userName; + + private Integer parkingInfoId; + + private Date beginTime; + + private Date endTime; + + private String carId; + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java new file mode 100644 index 0000000..8097679 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java @@ -0,0 +1,13 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ParkingRentDateDTO implements Serializable { + + private String beginT; + + private String endT; +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java new file mode 100644 index 0000000..8c7951b --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java @@ -0,0 +1,48 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AreaInfo implements Serializable { + private Integer id; + + private String areaName; + + private String areaAddress; + + private String detail1; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getAreaAddress() { + return areaAddress; + } + + public void setAreaAddress(String areaAddress) { + this.areaAddress = areaAddress; + } + + public String getDetail1() { + return detail1; + } + + public void setDetail1(String detail1) { + this.detail1 = detail1; + } +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java new file mode 100644 index 0000000..a0dbb00 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java @@ -0,0 +1,28 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class OwnerParkingApply implements Serializable { + private Integer id; + + private Integer ownerId; + + private String parkingCode; + + private String parkingInfo; + + private Date beginTime; + + private Date endTime; + + private Integer communityId; + + private Integer status; + + private Integer costPerDay; + +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java new file mode 100644 index 0000000..abc901c --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java @@ -0,0 +1,109 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ParkingInfo implements Serializable { + private Integer id; + + private Date beginTime; + + private Date endTime; + + private String parkingNumber; + + private String parkingInfos; + + private Integer costPerDay; + + private Integer communityId; + + private Integer ownerId; + + private Integer type; + + private Integer status; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Date getBeginTime() { + return beginTime; + } + + public void setBeginTime(Date beginTime) { + this.beginTime = beginTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public String getParkingNumber() { + return parkingNumber; + } + + public void setParkingNumber(String parkingNumber) { + this.parkingNumber = parkingNumber; + } + + public String getParkingInfos() { + return parkingInfos; + } + + public void setParkingInfos(String parkingInfos) { + this.parkingInfos = parkingInfos; + } + + public Integer getCostPerDay() { + return costPerDay; + } + + public void setCostPerDay(Integer costPerDay) { + this.costPerDay = costPerDay; + } + + public Integer getCommunityId() { + return communityId; + } + + public void setCommunityId(Integer communityId) { + this.communityId = communityId; + } + + public Integer getOwnerId() { + return ownerId; + } + + public void setOwnerId(Integer ownerId) { + this.ownerId = ownerId; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java new file mode 100644 index 0000000..2a71cb8 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java @@ -0,0 +1,26 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ParkingRentRecords implements Serializable { + private Integer id; + + private String carid; + + private Date beginTime; + + private Date endTime; + + private Integer parkingInfoId; + + private Integer orderId; + + private Integer userId; + + private Integer status; + +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java new file mode 100644 index 0000000..75cd89c --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java @@ -0,0 +1,37 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class PersonUser implements Serializable { + private Integer id; + + private String idNumber; + + private String cellPhNumber; + + private String password; + + private String name; + + private Integer sex; + + private String nickname; + + private String mailbox; + + private Integer plotId; + + private String tag; + + private Integer mailboxStatus; + + private String code; + + private String passwordSalt; + + private Date createTime; +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java new file mode 100644 index 0000000..7153a1c --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java @@ -0,0 +1,9 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.pojo.AreaInfo; + +import java.util.List; + +public interface AreaInfoService { + List selectAll(); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java new file mode 100644 index 0000000..63c0b55 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java @@ -0,0 +1,9 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.dto.AddParkingApply; +import org.springframework.stereotype.Service; + + +public interface ParkingApplyService { + int add(AddParkingApply addParkingApply); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java new file mode 100644 index 0000000..70d8aa1 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java @@ -0,0 +1,9 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; + +import java.util.List; + +public interface ParkingInfoService { + List getMList(int areaid); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java new file mode 100644 index 0000000..81163c2 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java @@ -0,0 +1,17 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDateDTO; + +import java.util.List; + +public interface ParkingRentRecordsService { + + + List getRecords(Integer id); + + int add(ParkingRentDTO parkingRentDTO); + + List getMyRecords(String username); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java new file mode 100644 index 0000000..ac08e76 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.AreaInfoMapper; +import com.team7.happycommunity.parkservice.pojo.AreaInfo; +import com.team7.happycommunity.parkservice.service.AreaInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class AreaInfoServiceImpl implements AreaInfoService { + + @Autowired + AreaInfoMapper areaInfoMapper; + + @Override + public List selectAll() { + return areaInfoMapper.selectAll(); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java new file mode 100644 index 0000000..a4e57f9 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java @@ -0,0 +1,39 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.OwnerParkingApplyMapper; +import com.team7.happycommunity.parkservice.dao.ParkingInfoMapper; +import com.team7.happycommunity.parkservice.dao.PersonUserMapper; +import com.team7.happycommunity.parkservice.dto.AddParkingApply; +import com.team7.happycommunity.parkservice.pojo.OwnerParkingApply; +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import com.team7.happycommunity.parkservice.pojo.PersonUser; +import com.team7.happycommunity.parkservice.service.ParkingApplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ParkingApplyServiceImpl implements ParkingApplyService { + + @Autowired + OwnerParkingApplyMapper ownerParkingApplyMapper; + + @Autowired + PersonUserMapper personUserMapper; + + @Override + public int add(AddParkingApply addParkingApply) { + // 获取personUser的用户id + PersonUser personUser = personUserMapper.selectByUsername(addParkingApply.getUserName()); + // 存入 + OwnerParkingApply ownerParkingApply = new OwnerParkingApply(); + ownerParkingApply.setOwnerId(personUser.getId()); + ownerParkingApply.setBeginTime(addParkingApply.getBeginTime()); + ownerParkingApply.setEndTime(addParkingApply.getEndTime()); + ownerParkingApply.setCommunityId(addParkingApply.getAreaid()); + ownerParkingApply.setCostPerDay(addParkingApply.getCostPerDay()); + ownerParkingApply.setParkingCode(addParkingApply.getParkingNumber()); + ownerParkingApply.setParkingInfo(addParkingApply.getParkingInfos()); + ownerParkingApply.setStatus(0);// 未审核状态 + return ownerParkingApplyMapper.insertSelective(ownerParkingApply); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java new file mode 100644 index 0000000..86ed791 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.ParkingInfoMapper; +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import com.team7.happycommunity.parkservice.service.ParkingInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ParkingInfoServiceImpl implements ParkingInfoService { + + @Autowired + ParkingInfoMapper parkingInfoMapper; + + @Override + public List getMList(int areaid) { + return parkingInfoMapper.selectByAreaId(areaid); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java new file mode 100644 index 0000000..7340944 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java @@ -0,0 +1,65 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.ParkingRentRecordsMapper; +import com.team7.happycommunity.parkservice.dao.PersonUserMapper; +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDateDTO; +import com.team7.happycommunity.parkservice.pojo.ParkingRentRecords; +import com.team7.happycommunity.parkservice.pojo.PersonUser; +import com.team7.happycommunity.parkservice.service.ParkingRentRecordsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@Service +public class ParkingRentRecordsServiceImpl implements ParkingRentRecordsService { + + @Autowired + ParkingRentRecordsMapper parkingRentRecordsMapper; + + @Autowired + PersonUserMapper personUserMapper; + + @Override + public List getRecords(Integer id) { + List list = parkingRentRecordsMapper.selectByParkingInfoId(id); + List list_re = new ArrayList<>(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + for(int i = 0; i < list.size() ; i ++){ + ParkingRentDateDTO parkingRentDateDTO = new ParkingRentDateDTO(); + parkingRentDateDTO.setBeginT(simpleDateFormat.format(list.get(i).getBeginTime())); + parkingRentDateDTO.setEndT(simpleDateFormat.format(list.get(i).getEndTime())); + list_re.add(parkingRentDateDTO); + } + return list_re; + } + + @Override + public int add(ParkingRentDTO parkingRentDTO) { + PersonUser personUser = personUserMapper.selectByUsername(parkingRentDTO.getUserName()); + + ParkingRentRecords parkingRentRecords = new ParkingRentRecords(); + parkingRentRecords.setBeginTime(parkingRentDTO.getBeginTime()); + parkingRentRecords.setEndTime(parkingRentDTO.getEndTime()); + parkingRentRecords.setCarid(parkingRentDTO.getCarId()); + parkingRentRecords.setStatus(0); + parkingRentRecords.setParkingInfoId(parkingRentDTO.getParkingInfoId()); + parkingRentRecords.setUserId(personUser.getId()); + return parkingRentRecordsMapper.insertSelective(parkingRentRecords); + +// return 0; + } + + @Override + public List getMyRecords(String username) { + PersonUser personUser = personUserMapper.selectByUsername(username); + List list = parkingRentRecordsMapper.selectByUserId(personUser.getId()); + return list; + } +} diff --git a/parkservice/src/main/resources/generatorConfig.xml b/parkservice/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..49919ae --- /dev/null +++ b/parkservice/src/main/resources/generatorConfig.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ +
+
+
\ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/AreaInfoMapper.xml b/parkservice/src/main/resources/mapper/AreaInfoMapper.xml new file mode 100644 index 0000000..b95453e --- /dev/null +++ b/parkservice/src/main/resources/mapper/AreaInfoMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + id, area_name, area_address, detail1 + + + + delete from areainfo + where id = #{id,jdbcType=INTEGER} + + + insert into areainfo (id, area_name, area_address, + detail1) + values (#{id,jdbcType=INTEGER}, #{areaName,jdbcType=VARCHAR}, #{areaAddress,jdbcType=VARCHAR}, + #{detail1,jdbcType=VARCHAR}) + + + insert into areainfo + + + id, + + + area_name, + + + area_address, + + + detail1, + + + + + #{id,jdbcType=INTEGER}, + + + #{areaName,jdbcType=VARCHAR}, + + + #{areaAddress,jdbcType=VARCHAR}, + + + #{detail1,jdbcType=VARCHAR}, + + + + + update areainfo + + + area_name = #{areaName,jdbcType=VARCHAR}, + + + area_address = #{areaAddress,jdbcType=VARCHAR}, + + + detail1 = #{detail1,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update areainfo + set area_name = #{areaName,jdbcType=VARCHAR}, + area_address = #{areaAddress,jdbcType=VARCHAR}, + detail1 = #{detail1,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml b/parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml new file mode 100644 index 0000000..5b18122 --- /dev/null +++ b/parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + id, owner_id, parking_code, parking_info, begin_time, end_time, community_id, status, + cost_per_day + + + + delete from owner_parking_apply + where id = #{id,jdbcType=INTEGER} + + + insert into owner_parking_apply (id, owner_id, parking_code, + parking_info, begin_time, end_time, + community_id, status, cost_per_day + ) + values (#{id,jdbcType=INTEGER}, #{ownerId,jdbcType=INTEGER}, #{parkingCode,jdbcType=VARCHAR}, + #{parkingInfo,jdbcType=VARCHAR}, #{beginTime,jdbcType=DATE}, #{endTime,jdbcType=DATE}, + #{communityId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{costPerDay,jdbcType=INTEGER} + ) + + + insert into owner_parking_apply + + + id, + + + owner_id, + + + parking_code, + + + parking_info, + + + begin_time, + + + end_time, + + + community_id, + + + status, + + + cost_per_day, + + + + + #{id,jdbcType=INTEGER}, + + + #{ownerId,jdbcType=INTEGER}, + + + #{parkingCode,jdbcType=VARCHAR}, + + + #{parkingInfo,jdbcType=VARCHAR}, + + + #{beginTime,jdbcType=DATE}, + + + #{endTime,jdbcType=DATE}, + + + #{communityId,jdbcType=INTEGER}, + + + #{status,jdbcType=INTEGER}, + + + #{costPerDay,jdbcType=INTEGER}, + + + + + update owner_parking_apply + + + owner_id = #{ownerId,jdbcType=INTEGER}, + + + parking_code = #{parkingCode,jdbcType=VARCHAR}, + + + parking_info = #{parkingInfo,jdbcType=VARCHAR}, + + + begin_time = #{beginTime,jdbcType=DATE}, + + + end_time = #{endTime,jdbcType=DATE}, + + + community_id = #{communityId,jdbcType=INTEGER}, + + + status = #{status,jdbcType=INTEGER}, + + + cost_per_day = #{costPerDay,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update owner_parking_apply + set owner_id = #{ownerId,jdbcType=INTEGER}, + parking_code = #{parkingCode,jdbcType=VARCHAR}, + parking_info = #{parkingInfo,jdbcType=VARCHAR}, + begin_time = #{beginTime,jdbcType=DATE}, + end_time = #{endTime,jdbcType=DATE}, + community_id = #{communityId,jdbcType=INTEGER}, + status = #{status,jdbcType=INTEGER}, + cost_per_day = #{costPerDay,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/ParkingInfoMapper.xml b/parkservice/src/main/resources/mapper/ParkingInfoMapper.xml new file mode 100644 index 0000000..d3985a5 --- /dev/null +++ b/parkservice/src/main/resources/mapper/ParkingInfoMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + id, begin_time, end_time, parking_number, parking_infos, cost_per_day, community_id, + owner_id, type, status + + + + delete from parking_info + where id = #{id,jdbcType=INTEGER} + + + insert into parking_info (id, begin_time, end_time, + parking_number, parking_infos, cost_per_day, + community_id, owner_id, type, + status) + values (#{id,jdbcType=INTEGER}, #{beginTime,jdbcType=DATE}, #{endTime,jdbcType=DATE}, + #{parkingNumber,jdbcType=VARCHAR}, #{parkingInfos,jdbcType=VARCHAR}, #{costPerDay,jdbcType=INTEGER}, + #{communityId,jdbcType=INTEGER}, #{ownerId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, + #{status,jdbcType=INTEGER}) + + + insert into parking_info + + + id, + + + begin_time, + + + end_time, + + + parking_number, + + + parking_infos, + + + cost_per_day, + + + community_id, + + + owner_id, + + + type, + + + status, + + + + + #{id,jdbcType=INTEGER}, + + + #{beginTime,jdbcType=DATE}, + + + #{endTime,jdbcType=DATE}, + + + #{parkingNumber,jdbcType=VARCHAR}, + + + #{parkingInfos,jdbcType=VARCHAR}, + + + #{costPerDay,jdbcType=INTEGER}, + + + #{communityId,jdbcType=INTEGER}, + + + #{ownerId,jdbcType=INTEGER}, + + + #{type,jdbcType=INTEGER}, + + + #{status,jdbcType=INTEGER}, + + + + + update parking_info + + + begin_time = #{beginTime,jdbcType=DATE}, + + + end_time = #{endTime,jdbcType=DATE}, + + + parking_number = #{parkingNumber,jdbcType=VARCHAR}, + + + parking_infos = #{parkingInfos,jdbcType=VARCHAR}, + + + cost_per_day = #{costPerDay,jdbcType=INTEGER}, + + + community_id = #{communityId,jdbcType=INTEGER}, + + + owner_id = #{ownerId,jdbcType=INTEGER}, + + + type = #{type,jdbcType=INTEGER}, + + + status = #{status,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update parking_info + set begin_time = #{beginTime,jdbcType=DATE}, + end_time = #{endTime,jdbcType=DATE}, + parking_number = #{parkingNumber,jdbcType=VARCHAR}, + parking_infos = #{parkingInfos,jdbcType=VARCHAR}, + cost_per_day = #{costPerDay,jdbcType=INTEGER}, + community_id = #{communityId,jdbcType=INTEGER}, + owner_id = #{ownerId,jdbcType=INTEGER}, + type = #{type,jdbcType=INTEGER}, + status = #{status,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml b/parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml new file mode 100644 index 0000000..5f442f5 --- /dev/null +++ b/parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + id, carid, begin_time, end_time, parking_info_id, order_id, user_id, status + + + + delete from parking_rent_records + where id = #{id,jdbcType=INTEGER} + + + insert into parking_rent_records (id, carid, begin_time, + end_time, parking_info_id, order_id, + user_id) + values (#{id,jdbcType=INTEGER}, #{carid,jdbcType=VARCHAR}, #{beginTime,jdbcType=DATE}, + #{endTime,jdbcType=DATE}, #{parkingInfoId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, + #{userId,jdbcType=INTEGER}) + + + insert into parking_rent_records + + + id, + + + carid, + + + begin_time, + + + end_time, + + + parking_info_id, + + + order_id, + + + user_id, + + + status, + + + + + #{id,jdbcType=INTEGER}, + + + #{carid,jdbcType=VARCHAR}, + + + #{beginTime,jdbcType=DATE}, + + + #{endTime,jdbcType=DATE}, + + + #{parkingInfoId,jdbcType=INTEGER}, + + + #{orderId,jdbcType=INTEGER}, + + + #{userId,jdbcType=INTEGER}, + + + #{status,jdbcType=INTEGER}, + + + + + update parking_rent_records + + + carid = #{carid,jdbcType=VARCHAR}, + + + begin_time = #{beginTime,jdbcType=DATE}, + + + end_time = #{endTime,jdbcType=DATE}, + + + parking_info_id = #{parkingInfoId,jdbcType=INTEGER}, + + + order_id = #{orderId,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update parking_rent_records + set carid = #{carid,jdbcType=VARCHAR}, + begin_time = #{beginTime,jdbcType=DATE}, + end_time = #{endTime,jdbcType=DATE}, + parking_info_id = #{parkingInfoId,jdbcType=INTEGER}, + order_id = #{orderId,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/PersonUserMapper.xml b/parkservice/src/main/resources/mapper/PersonUserMapper.xml new file mode 100644 index 0000000..a12bb2a --- /dev/null +++ b/parkservice/src/main/resources/mapper/PersonUserMapper.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + id, id_number, cell_ph_number, password, name, sex, nickname, mailbox, plot_id, tag, + mailbox_status, code, password_salt, create_time + + + + delete from person_user + where id = #{id,jdbcType=INTEGER} + + + insert into person_user (id, id_number, cell_ph_number, + password, name, sex, + nickname, mailbox, plot_id, + tag, mailbox_status, code, + password_salt, create_time) + values (#{id,jdbcType=INTEGER}, #{idNumber,jdbcType=CHAR}, #{cellPhNumber,jdbcType=CHAR}, + #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, + #{nickname,jdbcType=VARCHAR}, #{mailbox,jdbcType=VARCHAR}, #{plotId,jdbcType=INTEGER}, + #{tag,jdbcType=VARCHAR}, #{mailboxStatus,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, + #{passwordSalt,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) + + + insert into person_user + + + id, + + + id_number, + + + cell_ph_number, + + + password, + + + name, + + + sex, + + + nickname, + + + mailbox, + + + plot_id, + + + tag, + + + mailbox_status, + + + code, + + + password_salt, + + + create_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{idNumber,jdbcType=CHAR}, + + + #{cellPhNumber,jdbcType=CHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{sex,jdbcType=INTEGER}, + + + #{nickname,jdbcType=VARCHAR}, + + + #{mailbox,jdbcType=VARCHAR}, + + + #{plotId,jdbcType=INTEGER}, + + + #{tag,jdbcType=VARCHAR}, + + + #{mailboxStatus,jdbcType=INTEGER}, + + + #{code,jdbcType=VARCHAR}, + + + #{passwordSalt,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + update person_user + + + id_number = #{idNumber,jdbcType=CHAR}, + + + cell_ph_number = #{cellPhNumber,jdbcType=CHAR}, + + + password = #{password,jdbcType=VARCHAR}, + + + name = #{name,jdbcType=VARCHAR}, + + + sex = #{sex,jdbcType=INTEGER}, + + + nickname = #{nickname,jdbcType=VARCHAR}, + + + mailbox = #{mailbox,jdbcType=VARCHAR}, + + + plot_id = #{plotId,jdbcType=INTEGER}, + + + tag = #{tag,jdbcType=VARCHAR}, + + + mailbox_status = #{mailboxStatus,jdbcType=INTEGER}, + + + code = #{code,jdbcType=VARCHAR}, + + + password_salt = #{passwordSalt,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update person_user + set id_number = #{idNumber,jdbcType=CHAR}, + cell_ph_number = #{cellPhNumber,jdbcType=CHAR}, + password = #{password,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, + sex = #{sex,jdbcType=INTEGER}, + nickname = #{nickname,jdbcType=VARCHAR}, + mailbox = #{mailbox,jdbcType=VARCHAR}, + plot_id = #{plotId,jdbcType=INTEGER}, + tag = #{tag,jdbcType=VARCHAR}, + mailbox_status = #{mailboxStatus,jdbcType=INTEGER}, + code = #{code,jdbcType=VARCHAR}, + password_salt = #{passwordSalt,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java b/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java index 6ec5f36..24f5b11 100644 --- a/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java +++ b/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java @@ -1,13 +1,26 @@ package com.team7.happycommunity.parkservice; +import com.team7.happycommunity.parkservice.dao.ParkingRentRecordsMapper; +import com.team7.happycommunity.parkservice.service.ParkingRentRecordsService; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.util.List; + @SpringBootTest class ParkserviceApplicationTests { + @Autowired + ParkingRentRecordsService parkingRentRecordsService; + + @Autowired + ParkingRentRecordsMapper parkingRentRecordsMapper; + @Test void contextLoads() { + List list = parkingRentRecordsMapper.selectByUserId(4); + System.out.println(list.toString()); } } diff --git a/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java b/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java index 358d6db..08dd37d 100644 --- a/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java +++ b/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java @@ -7,7 +7,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootTest @EnableEurekaClient //启动Eureka客户端 class PropertydemoApplicationTests { - + @Test void contextLoads() { } diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java index 0cdbca7..c999e9d 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java @@ -19,7 +19,7 @@ public interface ParkingInfoMapper { int updateByPrimaryKey(ParkingInfo record); - @Select("select * from parking_info where community_id = #{areaid} and status = 0") + @Select("select parking_info.*,areainfo.area_name area_name from parking_info left join areainfo on areainfo.id = parking_info.community_id where parking_info.community_id = #{areaid} and parking_info.status = 0") List selectByPageAndareaId(@Param("currentPage")Integer currentPage, @Param("pageSize") Integer pageSize, @Param("areaid") Integer areaid); diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java index 5f20d21..469c4f3 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java @@ -26,4 +26,6 @@ public class OwnerParkingApply implements Serializable { private String name; private String cellphone; + + private Integer costPerDay; } \ No newline at end of file diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java index a6e8ccb..3f3aeff 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java @@ -22,8 +22,21 @@ public class ParkingInfo implements Serializable { private Integer communityId; private Integer ownerId; - + // 0 小区 1 业主委托 private Integer type; private Integer status; + + private String areaName; + + private String typeStr; + + public void setType(Integer type){ + this.type = type; + if (type == 0){ + typeStr = "小区车位"; + }else{ + typeStr = "业主车位"; + } + } } \ No newline at end of file diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java index 85b0a44..152709f 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java @@ -27,4 +27,27 @@ public class PpPayservice implements Serializable { private Integer payway; private String servicecontext; + + // 衍生属性 支付方式 + private String paywayStr; + // 衍生属性 服务类型 + private String serviceTypeStr; + + public void setServiceType(Integer serviceType){ + this.serviceType = serviceType; + if(serviceType !=null && serviceType == 0){ + serviceTypeStr = "商家服务"; + }else{ + serviceTypeStr = "物业服务"; + } + } + + public void setPayway(Integer payway){ + this.payway = payway; + if(payway == 0){ + paywayStr = "线上"; + }else{ + paywayStr = "线下"; + } + } } \ No newline at end of file diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java index 128c2b6..ef25754 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java @@ -55,7 +55,7 @@ public class OwnerParkingApplyServiceImpl implements OwnerParkingApplyService { parkingInfo.setCommunityId(ownerParkingApplyold.getCommunityId()); parkingInfo.setBeginTime(ownerParkingApplyold.getBeginTime()); parkingInfo.setEndTime(ownerParkingApplyold.getEndTime()); - parkingInfo.setCostPerDay(10); + parkingInfo.setCostPerDay(ownerParkingApplyold.getCostPerDay()); parkingInfo.setParkingNumber(ownerParkingApplyold.getParkingCode()); parkingInfo.setParkingInfos(ownerParkingApplyold.getParkingInfo()); parkingInfoMapper.insertSelective(parkingInfo); diff --git a/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml b/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml index 9dc98c2..d6540bd 100644 --- a/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml +++ b/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml @@ -9,9 +9,10 @@ + - id, owner_id, parking_code, parking_info, begin_time, end_time, community_id + id, owner_id, parking_code, parking_info, begin_time, end_time, community_id, cost_per_day