diff --git a/gatway/pom.xml b/gatway/pom.xml index f6d909d58ae6eb4c4fd9b1793f072f2ee87c88be..8e4d9306fd195045242cf9393dec5ee7bf5a7fc2 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 47313611463b1fd05db242779c99f3a9e634f308..0c1fbf8b989ad4ff44f9e51aaf7510fd0241160a 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 5b239cfba70dfa404af622e17a2f2b2be0ba88bf..0982a280427ec01824ecfec89b4a2d3dbe0bdcd7 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 f1193bc6a4cd94ba9e1818fe612c43ffdec91b06..1e860ae44e57097e3c94cfa6d83d1f97f2b77be3 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 b430dad140c8abe0c0da0309b40f06c730c0383a..15a4c2b30d584260e6b452216f8cc0a00199364f 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 9be673c210c550f02843b8df525e5bae7c3b0086..fca95c24510345c92dd81901b8319ecb31fefe32 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 5fb2668bfd3a90a7f669f9f4b2b7d6473d8a9351..05758f91c92dc2b160e2012f096fd2b850e74fb6 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 0000000000000000000000000000000000000000..cb397d1acefe3e9912bf18705e13eac92b5fb6bb --- /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 0000000000000000000000000000000000000000..8cfb173a581f284875216b035dc440d03b037a2f --- /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 0000000000000000000000000000000000000000..31d7f3837840958ab1eeeee50331c2e1f0fa81a1 --- /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 0000000000000000000000000000000000000000..d58b96ab5fe487cab0d98113f65d3078e08f6300 --- /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 0000000000000000000000000000000000000000..7f722d0744b2e538ba5ebcdd1f4de60d23627e5a --- /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 0000000000000000000000000000000000000000..c6b2bb5d32e5598aba5098b5c52ae6a5ce610971 --- /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 0000000000000000000000000000000000000000..6eff08e54c2d4cb97ddea100374b4dae3189e3b7 --- /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 0000000000000000000000000000000000000000..baff4f754343bcbf1fa585870a41ab11aa32ac2f --- /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 0000000000000000000000000000000000000000..42da2bff1c068358108bd59c3f6fcacce3ca3767 --- /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 0000000000000000000000000000000000000000..549f9aa4509c0400be1dfcee9b457bb3ab9bc9b6 --- /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 0000000000000000000000000000000000000000..e38d6df9d1ad8667c458b3553ae810b89c413e22 --- /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 0000000000000000000000000000000000000000..224ef329b41cca668d0bbebe1653c1bacf00d908 --- /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 0000000000000000000000000000000000000000..b5bafe265e0fcf6d30d6c2931ca83d31a08e8f86 --- /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 0000000000000000000000000000000000000000..7538bb6f4ca71f2aaf8b1ef21be2be21585696fe --- /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 0000000000000000000000000000000000000000..80976798f74f4e55a88b361e0d046bfb46814262 --- /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 0000000000000000000000000000000000000000..8c7951bc2664344cc01deeeeb1be18c10018aebe --- /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 0000000000000000000000000000000000000000..a0dbb00d9f418ffae3d6111dd129732e83123c2f --- /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 0000000000000000000000000000000000000000..abc901c75c74d3f11106d79a5923162d0466fb17 --- /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 0000000000000000000000000000000000000000..2a71cb86f74a34cebb2a31b677e54ab2262c170e --- /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 0000000000000000000000000000000000000000..75cd89c3df5ad01c6f535dff7191f26828979581 --- /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 0000000000000000000000000000000000000000..7153a1c2615b2a747372b36f7ac4289092f8c9ec --- /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 0000000000000000000000000000000000000000..63c0b55134717b708046f9ca24cfafe4d006e871 --- /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 0000000000000000000000000000000000000000..70d8aa1f1333e52509e2c4c04244845eebe75fd5 --- /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 0000000000000000000000000000000000000000..81163c2817fd801f8de97a79a1cd5c3bb931112d --- /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 0000000000000000000000000000000000000000..ac08e7613608812711b6b7b89bf8fdf9cd1b04ef --- /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 0000000000000000000000000000000000000000..a4e57f9ac116eb929c7eb8a750008515651fbf9b --- /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 0000000000000000000000000000000000000000..86ed79195261220fdf9115e94a5b3bbadf901a9d --- /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 0000000000000000000000000000000000000000..73409449696ef4f215757cf86ed6da69d1fb13ef --- /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 0000000000000000000000000000000000000000..49919aeaa7e592cbce0ee6bab05734ecc24e7ccb --- /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 0000000000000000000000000000000000000000..b95453ead2fbdc4266b522847009149cb6cb204f --- /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 0000000000000000000000000000000000000000..5b18122c6b2c409ca7c4d6ef9b347a5ff45f5e4b --- /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 0000000000000000000000000000000000000000..d3985a51f83c7eb0477f28acde2aa0a792e935cb --- /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 0000000000000000000000000000000000000000..5f442f545a70c62f1d988a5392e552adabe13056 --- /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 0000000000000000000000000000000000000000..a12bb2a00428278dbf3bf47b893dacf4c445be8f --- /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 6ec5f36f6e4f13d90f3b1ff248c11b21cc2c62cf..24f5b11b579771c0ed54e6f88e43df1d40f33112 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 358d6db27e00feecdc2170fff333690732af6fda..08dd37d1b61952ac39e34dec5e411fcbeaff0d3e 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 0cdbca7b4ff6ee7386a98d03dd9d22ae66f5bc79..c999e9db09eddf5baaf94369cf4824824f43c76b 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 5f20d219435a2619dd6606cb688a872e867afb0e..469c4f35eb3b5c3ec2e04e34e3ce0d7070304050 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 a6e8ccbef7183e2a9610d251308b3e9073dc4ae4..3f3aeff8c532754265dcbae6eb8695d47954f1ea 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 85b0a44effec6e08b0c594a4fef91de23f362d2a..152709fa9a3a6f1f11675dd9cfffba84bc55d064 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 128c2b6988dd49dcf7a10560e908e932380deec5..ef25754f1e1dc280549cc97fdd9b61852aa0e32d 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 9dc98c23c61a6dc79fca841797fd8a994581a15e..d6540bd0b669ba58741e276aba0fa6ee30b6a6eb 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