Compare commits
51 Commits
dev_custom
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 52772c4e13 | |||
| 2cb02bc4c7 | |||
| e4d2affa2c | |||
| 44fa58536a | |||
| 8decbd4df0 | |||
| caec81c767 | |||
| f06af34163 | |||
|
|
921a83d5c3 | ||
|
|
652acfea14 | ||
|
|
75ab9620f4 | ||
|
|
a355354d5f | ||
|
|
34c78b0d62 | ||
|
|
31b5b7c8f2 | ||
|
|
136715846c | ||
|
|
c09e6bf680 | ||
|
|
cea88fc351 | ||
|
|
b98ff8fdf3 | ||
|
|
3a5882268d | ||
|
|
f6238fbca7 | ||
|
|
d4c244701b | ||
|
|
0d8561edc7 | ||
|
|
b4d10a7306 | ||
|
|
554aa38576 | ||
|
|
084455fd76 | ||
|
|
9d3d19ef7a | ||
|
|
db85c197a8 | ||
|
|
a48fae5d30 | ||
|
|
79b7dbcadd | ||
|
|
a0fa46f873 | ||
|
|
6003aca88e | ||
|
|
c1dce10d9e | ||
|
|
e78ff52701 | ||
|
|
f3604d9830 | ||
|
|
edc2cbf7ef | ||
|
|
31c36abeaa | ||
|
|
7e0b8840a4 | ||
|
|
489513b766 | ||
|
|
18ebfcc04f | ||
|
|
85b6192ba1 | ||
|
|
27dc6c16af | ||
|
|
2781689e77 | ||
|
|
c2d0d9b647 | ||
|
|
de68066d84 | ||
|
|
fd089d5147 | ||
|
|
2b46184d29 | ||
|
|
e743f616c7 | ||
|
|
ba389a4b80 | ||
|
|
179bc9560f | ||
|
|
0d694db8b8 | ||
|
|
1e9a265ecc | ||
|
|
9e78b3de0d |
3
ReadMe.md
Normal file
3
ReadMe.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## 云岚到家
|
||||||
|
|
||||||
|
飞书讲义:https://mx67xggunk5.feishu.cn/wiki/P93bwwgNoihG7yk7PEzcpKn6nbZ
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jzo2o.api.customer;
|
||||||
|
|
||||||
|
import com.jzo2o.api.customer.dto.response.AddressBookResDTO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部接口 - 地址簿相关接口
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "jzo2o-customer", value = "jzo2o-customer", path = "/customer/inner/address-book")
|
||||||
|
public interface AddressBookApi {
|
||||||
|
/**
|
||||||
|
* 获取指定id对应的地址信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
AddressBookResDTO getById(@PathVariable Long id);
|
||||||
|
}
|
||||||
@@ -4,14 +4,16 @@ import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
|||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部接口 - 服务相关接口
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
@FeignClient(contextId = "jzo2o-foundations", value = "jzo2o-foundations", path = "/foundations/inner/serve")
|
@FeignClient(contextId = "jzo2o-foundations", value = "jzo2o-foundations", path = "/foundations/inner/serve")
|
||||||
public interface ServeApi {
|
public interface ServeApi {
|
||||||
|
/**
|
||||||
|
* 根据服务id获取服务信息
|
||||||
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
ServeAggregationResDTO findById(@PathVariable("id") Long id);
|
ServeAggregationResDTO findById(@PathVariable("id") Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
39
jzo2o-api/src/main/java/com/jzo2o/api/market/CouponApi.java
Normal file
39
jzo2o-api/src/main/java/com/jzo2o/api/market/CouponApi.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.jzo2o.api.market;
|
||||||
|
|
||||||
|
import com.jzo2o.api.market.dto.request.CouponUseBackReqDTO;
|
||||||
|
import com.jzo2o.api.market.dto.request.CouponUseReqDTO;
|
||||||
|
import com.jzo2o.api.market.dto.response.AvailableCouponsResDTO;
|
||||||
|
import com.jzo2o.api.market.dto.response.CouponUseResDTO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部接口 - 优惠卷相关接口
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "jzo2o-market", value = "jzo2o-market", path = "/market/inner/coupon")
|
||||||
|
public interface CouponApi {
|
||||||
|
/**
|
||||||
|
* 根据订单金额获取当前用户可用优惠卷
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAvailable")
|
||||||
|
List<AvailableCouponsResDTO> getAvailableCoupon(@RequestParam BigDecimal totalAmount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户核销优惠卷返回优惠金额
|
||||||
|
*/
|
||||||
|
@PostMapping("/use")
|
||||||
|
CouponUseResDTO useCoupon(@RequestBody CouponUseReqDTO couponUseReqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户取消订单退回使用优惠卷
|
||||||
|
*/
|
||||||
|
@PostMapping("/useBack")
|
||||||
|
void useBack(@RequestBody CouponUseBackReqDTO couponUseBackReqDTO);
|
||||||
|
}
|
||||||
@@ -4,8 +4,8 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ApiModel("优惠券使用退回请求模型")
|
|
||||||
@Data
|
@Data
|
||||||
|
@ApiModel("优惠券使用退回请求模型")
|
||||||
public class CouponUseBackReqDTO {
|
public class CouponUseBackReqDTO {
|
||||||
@ApiModelProperty("优惠券id")
|
@ApiModelProperty("优惠券id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package com.jzo2o.api.market.dto.request;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
@ApiModel("优惠券使用模型")
|
@ApiModel("优惠券使用模型")
|
||||||
public class CouponUseReqDTO {
|
public class CouponUseReqDTO {
|
||||||
@ApiModelProperty("优惠券id")
|
@ApiModelProperty("优惠券id")
|
||||||
|
|||||||
@@ -3,12 +3,17 @@ package com.jzo2o.api.market.dto.response;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("优惠券信息")
|
@ApiModel("优惠券信息")
|
||||||
|
@Accessors(chain = true)
|
||||||
public class AvailableCouponsResDTO {
|
public class AvailableCouponsResDTO {
|
||||||
@ApiModelProperty("优惠券id")
|
@ApiModelProperty("优惠券id")
|
||||||
private Long id;
|
private Long id;
|
||||||
@@ -16,34 +21,34 @@ public class AvailableCouponsResDTO {
|
|||||||
/**
|
/**
|
||||||
* 优惠券名称
|
* 优惠券名称
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "活动名称",required = true)
|
@ApiModelProperty(value = "活动名称", required = true)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动id
|
* 活动id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "活动id",required = true)
|
@ApiModelProperty(value = "活动id", required = true)
|
||||||
private Long activityId;
|
private Long activityId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "使用类型,1:满减,2:折扣",required = true)
|
@ApiModelProperty(value = "使用类型,1:满减,2:折扣", required = true)
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 折扣
|
* 折扣
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "折扣",required = false)
|
@ApiModelProperty(value = "折扣")
|
||||||
private Integer discountRate;
|
private Integer discountRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠金额
|
* 优惠金额
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "优惠金额",required = false)
|
@ApiModelProperty(value = "优惠金额")
|
||||||
private BigDecimal discountAmount;
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 满减金额
|
* 满减金额
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "满减条件,0:表示无门槛",required = true)
|
@ApiModelProperty(value = "满减条件,0:表示无门槛", required = true)
|
||||||
private BigDecimal amountCondition;
|
private BigDecimal amountCondition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,12 +2,16 @@ package com.jzo2o.api.market.dto.response;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("优惠券使用返回信息模型")
|
@ApiModel("优惠券使用返回信息模型")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class CouponUseResDTO {
|
public class CouponUseResDTO {
|
||||||
@ApiModelProperty("优惠金额")
|
@ApiModelProperty("优惠金额")
|
||||||
private BigDecimal discountAmount;
|
private BigDecimal discountAmount;
|
||||||
|
|||||||
@@ -2,13 +2,18 @@ package com.jzo2o.api.trade.dto.request;
|
|||||||
|
|
||||||
import com.jzo2o.api.trade.enums.PayChannelEnum;
|
import com.jzo2o.api.trade.enums.PayChannelEnum;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务请求参数
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
public class NativePayReqDTO {
|
public class NativePayReqDTO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "商户号", required = true)
|
@ApiModelProperty(value = "商户号", required = true)
|
||||||
private Long enterpriseId;
|
private Long enterpriseId;
|
||||||
@ApiModelProperty(value = "业务系统标识", required = true)
|
@ApiModelProperty(value = "业务系统标识", required = true)
|
||||||
@@ -27,5 +32,4 @@ public class NativePayReqDTO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "是否切换支付渠道", required = true)
|
@ApiModelProperty(value = "是否切换支付渠道", required = true)
|
||||||
private boolean changeChannel=false;
|
private boolean changeChannel=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.jzo2o.customer.controller.inner;
|
||||||
|
|
||||||
|
import com.jzo2o.api.customer.AddressBookApi;
|
||||||
|
import com.jzo2o.api.customer.dto.response.AddressBookResDTO;
|
||||||
|
import com.jzo2o.common.utils.BeanUtils;
|
||||||
|
import com.jzo2o.customer.service.IAddressBookService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部接口 - 地址簿相关接口
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/inner/address-book")
|
||||||
|
@Api(tags = "内部接口 - 地址簿相关接口")
|
||||||
|
public class InnerAddressBookController implements AddressBookApi {
|
||||||
|
@Resource
|
||||||
|
private IAddressBookService addressBookService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定id对应的地址信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AddressBookResDTO getById(@PathVariable Long id) {
|
||||||
|
return BeanUtils.toBean(addressBookService.getById(id), AddressBookResDTO.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,11 +41,6 @@
|
|||||||
<artifactId>jzo2o-knife4j-web</artifactId>
|
<artifactId>jzo2o-knife4j-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.jzo2o</groupId>-->
|
|
||||||
<!-- <artifactId>jzo2o-es</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!--单元测试-->
|
<!--单元测试-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@@ -63,23 +58,28 @@
|
|||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-es</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-canal-sync</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jzo2o</groupId>
|
<groupId>com.jzo2o</groupId>
|
||||||
<artifactId>jzo2o-redis</artifactId>
|
<artifactId>jzo2o-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.jzo2o</groupId>-->
|
|
||||||
<!-- <artifactId>jzo2o-canal-sync</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jzo2o</groupId>
|
<groupId>com.jzo2o</groupId>
|
||||||
<artifactId>jzo2o-mysql</artifactId>
|
<artifactId>jzo2o-mysql</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.jzo2o</groupId>-->
|
<dependency>
|
||||||
<!-- <artifactId>jzo2o-xxl-job</artifactId>-->
|
<groupId>com.jzo2o</groupId>
|
||||||
<!-- </dependency>-->
|
<artifactId>jzo2o-xxl-job</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.jzo2o.foundations.controller.consumer;
|
||||||
|
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.service.IServeService;
|
||||||
|
import com.jzo2o.foundations.service.IServeTypeService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端 - 服务相关接口
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@RestController("consumerServeController")
|
||||||
|
@RequestMapping("/customer/serve")
|
||||||
|
@Api(tags = "用户端 - 服务相关接口")
|
||||||
|
public class ServeController {
|
||||||
|
/**
|
||||||
|
* 获取首页服务类型及服务项
|
||||||
|
*/
|
||||||
|
@GetMapping("/firstPageServeList")
|
||||||
|
public List<ServeCategoryResDTO> getFirstPageServeList(@RequestParam Long regionId) {
|
||||||
|
return serveService.getFirstPageServeList(regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部服务类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/serveTypeList")
|
||||||
|
public List<ServeAggregationTypeSimpleResDTO> getServeTypeList(@RequestParam Long regionId) {
|
||||||
|
return serveTypeService.getServeTypeList(regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取热门服务项
|
||||||
|
*/
|
||||||
|
@GetMapping("/hotServeList")
|
||||||
|
public List<ServeAggregationSimpleResDTO> getHotServeList(@RequestParam Long regionId) {
|
||||||
|
return serveService.getHotServeList(regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定id的服务详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ServeAggregationSimpleResDTO getServeById(@PathVariable("id") Long serveId) {
|
||||||
|
return serveService.getServeById(serveId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/search")
|
||||||
|
public List<ServeSimpleResDTO> findServeList(@RequestParam() String cityCode,
|
||||||
|
@RequestParam(required = false) Long serveTypeId,
|
||||||
|
@RequestParam(required = false) String keyword) {
|
||||||
|
return serveService.findServeList(cityCode, serveTypeId, keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IServeService serveService;
|
||||||
|
@Resource
|
||||||
|
private IServeTypeService serveTypeService;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.jzo2o.foundations.controller.inner;
|
||||||
|
|
||||||
|
import com.jzo2o.api.foundations.ServeApi;
|
||||||
|
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||||
|
import com.jzo2o.foundations.service.IServeService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/inner/serve")
|
||||||
|
@Api(tags = "内部接口 - 服务相关接口")
|
||||||
|
public class InnerServeController implements ServeApi {
|
||||||
|
@Resource
|
||||||
|
private IServeService serveService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据服务id获取服务信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ServeAggregationResDTO findById(@PathVariable Long id) {
|
||||||
|
return serveService.getServeAggregationById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -107,7 +107,6 @@ public class RegionController {
|
|||||||
@PutMapping("/refreshRegionRelateCaches/{id}")
|
@PutMapping("/refreshRegionRelateCaches/{id}")
|
||||||
@ApiOperation("刷新区域相关缓存")
|
@ApiOperation("刷新区域相关缓存")
|
||||||
public void refreshRegionRelateCaches(@PathVariable("id") Long id) {
|
public void refreshRegionRelateCaches(@PathVariable("id") Long id) {
|
||||||
//todo
|
regionService.refreshRegionRelateCaches(id);
|
||||||
// homeService.refreshRegionRelateCaches(id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.jzo2o.foundations.handler;
|
||||||
|
|
||||||
|
import com.jzo2o.canal.listeners.AbstractCanalRabbitMqMsgListener;
|
||||||
|
import com.jzo2o.es.core.ElasticSearchTemplate;
|
||||||
|
import com.jzo2o.foundations.constants.IndexConstants;
|
||||||
|
import com.jzo2o.foundations.model.domain.ServeSync;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.*;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接受从Canal发送的MQ消息并解析处理完成ES的索引更新
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class ServeCanalDataSyncHandler extends AbstractCanalRabbitMqMsgListener<ServeSync> {
|
||||||
|
/**
|
||||||
|
* 监听MQ的消息
|
||||||
|
*/
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
exchange = @Exchange(name = "exchange.canal-jzo2o", type = ExchangeTypes.TOPIC),
|
||||||
|
value = @Queue(name = "canal-mq-jzo2o-foundations",
|
||||||
|
// 限制单消费者保证顺序性
|
||||||
|
arguments = @Argument(name = "x-single-active-consumer", value = "true", type = "java.lang.Boolean")),
|
||||||
|
key = "canal-mq-jzo2o-foundations"),
|
||||||
|
// 限制单进程消费保证顺序性
|
||||||
|
concurrency = "1")
|
||||||
|
public void onMessage(Message message) throws Exception {
|
||||||
|
parseMsg(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ElasticSearchTemplate elasticSearchTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batchSave(List<ServeSync> data) {
|
||||||
|
Boolean isSuccess = elasticSearchTemplate.opsForDoc().batchInsert(IndexConstants.SERVE, data);
|
||||||
|
log.warn("[batchSave] status: {} data: {}", isSuccess, data.toString());
|
||||||
|
if (!isSuccess) {
|
||||||
|
// 通过抛出异常自动发送unack消息
|
||||||
|
throw new RuntimeException("同步失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batchDelete(List<Long> ids) {
|
||||||
|
Boolean isSuccess = elasticSearchTemplate.opsForDoc().batchDelete(IndexConstants.SERVE, ids);
|
||||||
|
log.warn("[batchDelete] status: {} ids: {}", isSuccess, ids.toString());
|
||||||
|
if (!isSuccess) {
|
||||||
|
// 通过抛出异常自动发送unack消息
|
||||||
|
throw new RuntimeException("同步失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.jzo2o.foundations.handler;
|
||||||
|
|
||||||
|
import com.jzo2o.api.foundations.dto.response.RegionSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.constants.RedisConstants;
|
||||||
|
import com.jzo2o.foundations.service.IRegionService;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xxl-job定时任务执行器
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class SpringCacheSyncHandler {
|
||||||
|
@XxlJob("activeRegionCacheSync")
|
||||||
|
public void activeRegionCacheSync() {
|
||||||
|
log.info(">>>>>>>>开始进行缓存同步,更新已启用区域");
|
||||||
|
|
||||||
|
// 清理开通服务区域缓存
|
||||||
|
redisTemplate.delete(RedisConstants.CacheName.JZ_CACHE + "::ACTIVE_REGIONS");
|
||||||
|
// 更新开通服务区域缓存
|
||||||
|
List<RegionSimpleResDTO> regionList = regionService.queryActiveRegionListCache();
|
||||||
|
|
||||||
|
// 更新每个区域对应的缓存
|
||||||
|
regionList.forEach(region -> regionService.refreshRegionRelateCaches(region.getId()));
|
||||||
|
|
||||||
|
log.info(">>>>>>>>缓存同步结束,完成更新已启用区域");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
@Resource
|
||||||
|
private IRegionService regionService;
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.jzo2o.foundations.mapper;
|
package com.jzo2o.foundations.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||||
import com.jzo2o.foundations.model.domain.Serve;
|
import com.jzo2o.foundations.model.domain.Serve;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
|
||||||
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
|
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -20,4 +23,21 @@ public interface ServeMapper extends BaseMapper<Serve> {
|
|||||||
* @param regionId 区域id
|
* @param regionId 区域id
|
||||||
*/
|
*/
|
||||||
List<ServeResDTO> queryServeListByRegionId(@Param("regionId") Long regionId);
|
List<ServeResDTO> queryServeListByRegionId(@Param("regionId") Long regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域服务图标查询
|
||||||
|
* @param regionId 区域id
|
||||||
|
*/
|
||||||
|
List<ServeCategoryResDTO> queryServeIconListByRegionId(@Param("regionId") Long regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域热门服务查询
|
||||||
|
* @param regionId 区域id
|
||||||
|
*/
|
||||||
|
List<ServeAggregationSimpleResDTO> queryHotServeListByRegionId(Long regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定id的服务信息
|
||||||
|
*/
|
||||||
|
ServeAggregationResDTO getServeAggregationById(Long id);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.jzo2o.foundations.mapper;
|
package com.jzo2o.foundations.mapper;
|
||||||
|
|
||||||
import com.jzo2o.foundations.model.domain.ServeType;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import com.jzo2o.foundations.model.domain.ServeType;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -13,4 +15,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* @since 2023-07-03
|
* @since 2023-07-03
|
||||||
*/
|
*/
|
||||||
public interface ServeTypeMapper extends BaseMapper<ServeType> {
|
public interface ServeTypeMapper extends BaseMapper<ServeType> {
|
||||||
|
/**
|
||||||
|
* 根据区域id查询简略列表
|
||||||
|
*/
|
||||||
|
List<ServeAggregationTypeSimpleResDTO> getServeTypeListByRegionId(Long regionId);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.jzo2o.foundations.model.domain;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@@ -19,6 +20,7 @@ import java.math.BigDecimal;
|
|||||||
* @since 2023-07-10
|
* @since 2023-07-10
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("serve_sync")
|
@TableName("serve_sync")
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.jzo2o.common.model.PageResult;
|
|||||||
import com.jzo2o.foundations.model.domain.Region;
|
import com.jzo2o.foundations.model.domain.Region;
|
||||||
import com.jzo2o.foundations.model.dto.request.RegionPageQueryReqDTO;
|
import com.jzo2o.foundations.model.dto.request.RegionPageQueryReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.request.RegionUpsertReqDTO;
|
import com.jzo2o.foundations.model.dto.request.RegionUpsertReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.response.RegionDisplayResDTO;
|
|
||||||
import com.jzo2o.foundations.model.dto.response.RegionResDTO;
|
import com.jzo2o.foundations.model.dto.response.RegionResDTO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -61,8 +60,9 @@ public interface IRegionService extends IService<Region> {
|
|||||||
* 区域启用
|
* 区域启用
|
||||||
*
|
*
|
||||||
* @param id 区域id
|
* @param id 区域id
|
||||||
|
* @return 用于更新缓存信息
|
||||||
*/
|
*/
|
||||||
void active(Long id);
|
List<RegionSimpleResDTO> active(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域禁用
|
* 区域禁用
|
||||||
@@ -78,4 +78,9 @@ public interface IRegionService extends IService<Region> {
|
|||||||
*/
|
*/
|
||||||
List<RegionSimpleResDTO> queryActiveRegionListCache();
|
List<RegionSimpleResDTO> queryActiveRegionListCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新区域相关的缓存(首页图标、热门服务、服务类型)
|
||||||
|
* @param id 区域id
|
||||||
|
*/
|
||||||
|
void refreshRegionRelateCaches(Long id);
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,11 @@ import java.util.List;
|
|||||||
* @since 2023-07-03
|
* @since 2023-07-03
|
||||||
*/
|
*/
|
||||||
public interface IServeItemService extends IService<ServeItem> {
|
public interface IServeItemService extends IService<ServeItem> {
|
||||||
|
/**
|
||||||
|
* 查询指定id的服务项并缓存
|
||||||
|
*/
|
||||||
|
ServeItem selectByIdCache(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务项新增
|
* 服务项新增
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.jzo2o.foundations.service;
|
package com.jzo2o.foundations.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||||
import com.jzo2o.common.model.PageResult;
|
import com.jzo2o.common.model.PageResult;
|
||||||
import com.jzo2o.foundations.model.domain.Serve;
|
import com.jzo2o.foundations.model.domain.Serve;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServePageQueryReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServePageQueryReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeUpsertReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeUpsertReqDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
|
||||||
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
|
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,6 +19,11 @@ import java.util.List;
|
|||||||
* @author JIAN
|
* @author JIAN
|
||||||
*/
|
*/
|
||||||
public interface IServeService extends IService<Serve> {
|
public interface IServeService extends IService<Serve> {
|
||||||
|
/**
|
||||||
|
* 查询指定id的服务并缓存
|
||||||
|
*/
|
||||||
|
Serve selectByIdCache(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域服务分页查询
|
* 区域服务分页查询
|
||||||
* @param servePageQueryReqDTO 分页参数
|
* @param servePageQueryReqDTO 分页参数
|
||||||
@@ -40,7 +49,7 @@ public interface IServeService extends IService<Serve> {
|
|||||||
/**
|
/**
|
||||||
* 设置指定的服务下架
|
* 设置指定的服务下架
|
||||||
*/
|
*/
|
||||||
Serve updateOffSale(Long id);
|
void updateOffSale(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除指定的服务
|
* 删除指定的服务
|
||||||
@@ -50,10 +59,37 @@ public interface IServeService extends IService<Serve> {
|
|||||||
/**
|
/**
|
||||||
* 设置指定服务热门
|
* 设置指定服务热门
|
||||||
*/
|
*/
|
||||||
Serve updateOnHot(Long id);
|
void updateOnHot(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消指定服务热门
|
* 取消指定服务热门
|
||||||
*/
|
*/
|
||||||
Serve updateOffHot(Long id);
|
void updateOffHot(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页服务类型及服务项
|
||||||
|
* @param regionId 地区id
|
||||||
|
*/
|
||||||
|
List<ServeCategoryResDTO> getFirstPageServeList(Long regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取首页热门服务
|
||||||
|
* @param regionId 地区id
|
||||||
|
*/
|
||||||
|
List<ServeAggregationSimpleResDTO> getHotServeList(Long regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定id的服务
|
||||||
|
*/
|
||||||
|
ServeAggregationSimpleResDTO getServeById(Long serveId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定区域的服务
|
||||||
|
*/
|
||||||
|
List<ServeSimpleResDTO> findServeList(String cityCode, Long serveTypeId, String keyword);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定id的服务
|
||||||
|
*/
|
||||||
|
ServeAggregationResDTO getServeAggregationById(Long id);
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.jzo2o.common.model.PageResult;
|
|||||||
import com.jzo2o.foundations.model.domain.ServeType;
|
import com.jzo2o.foundations.model.domain.ServeType;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeTypePageQueryReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeTypePageQueryReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeTypeUpsertReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeTypeUpsertReqDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
|
||||||
import com.jzo2o.foundations.model.dto.response.ServeTypeResDTO;
|
import com.jzo2o.foundations.model.dto.response.ServeTypeResDTO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -67,4 +68,9 @@ public interface IServeTypeService extends IService<ServeType> {
|
|||||||
* @return 服务类型列表
|
* @return 服务类型列表
|
||||||
*/
|
*/
|
||||||
List<ServeTypeSimpleResDTO> queryServeTypeListByActiveStatus(Integer activeStatus);
|
List<ServeTypeSimpleResDTO> queryServeTypeListByActiveStatus(Integer activeStatus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据区域id查询简略列表
|
||||||
|
*/
|
||||||
|
List<ServeAggregationTypeSimpleResDTO> getServeTypeList(Long regionId);
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,11 @@ import com.jzo2o.foundations.model.dto.request.RegionUpsertReqDTO;
|
|||||||
import com.jzo2o.foundations.model.dto.response.RegionResDTO;
|
import com.jzo2o.foundations.model.dto.response.RegionResDTO;
|
||||||
import com.jzo2o.foundations.service.IConfigRegionService;
|
import com.jzo2o.foundations.service.IConfigRegionService;
|
||||||
import com.jzo2o.foundations.service.IRegionService;
|
import com.jzo2o.foundations.service.IRegionService;
|
||||||
|
import com.jzo2o.foundations.service.IServeService;
|
||||||
|
import com.jzo2o.foundations.service.IServeTypeService;
|
||||||
import com.jzo2o.mysql.utils.PageUtils;
|
import com.jzo2o.mysql.utils.PageUtils;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.CachePut;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -47,6 +50,10 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
private CityDirectoryMapper cityDirectoryMapper;
|
private CityDirectoryMapper cityDirectoryMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ServeMapper serveMapper;
|
private ServeMapper serveMapper;
|
||||||
|
@Resource
|
||||||
|
private IServeService serveService;
|
||||||
|
@Resource
|
||||||
|
private IServeTypeService serveTypeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域新增
|
* 区域新增
|
||||||
@@ -151,18 +158,18 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
@CacheEvict(value = RedisConstants.CacheName.JZ_CACHE, key = "'ACTIVE_REGIONS'", beforeInvocation = true),
|
@CacheEvict(value = RedisConstants.CacheName.JZ_CACHE, key = "'ACTIVE_REGIONS'", beforeInvocation = true),
|
||||||
@CacheEvict(value = RedisConstants.CacheName.SERVE_ICON, key = "#id", beforeInvocation = true),
|
@CacheEvict(value = RedisConstants.CacheName.SERVE_ICON, key = "#id", beforeInvocation = true),
|
||||||
@CacheEvict(value = RedisConstants.CacheName.HOT_SERVE, key = "#id", beforeInvocation = true),
|
@CacheEvict(value = RedisConstants.CacheName.HOT_SERVE, key = "#id", beforeInvocation = true),
|
||||||
@CacheEvict(value = RedisConstants.CacheName.SERVE_TYPE, key = "#id", beforeInvocation = true)
|
@CacheEvict(value = RedisConstants.CacheName.SERVE_TYPE, key = "#id", beforeInvocation = true)},
|
||||||
})
|
put = @CachePut(value = RedisConstants.CacheName.JZ_CACHE, key = "'ACTIVE_REGIONS'"))
|
||||||
public void active(Long id) {
|
public List<RegionSimpleResDTO> active(Long id) {
|
||||||
//区域信息
|
// 区域信息
|
||||||
Region region = baseMapper.selectById(id);
|
Region region = baseMapper.selectById(id);
|
||||||
//启用状态
|
// 启用状态
|
||||||
Integer activeStatus = region.getActiveStatus();
|
Integer activeStatus = region.getActiveStatus();
|
||||||
//草稿或禁用状态方可启用
|
// 草稿或禁用状态方可启用
|
||||||
if (!(FoundationStatusEnum.INIT.getStatus() == activeStatus || FoundationStatusEnum.DISABLE.getStatus() == activeStatus)) {
|
if (!(FoundationStatusEnum.INIT.getStatus() == activeStatus || FoundationStatusEnum.DISABLE.getStatus() == activeStatus)) {
|
||||||
throw new ForbiddenOperationException("草稿或禁用状态方可启用");
|
throw new ForbiddenOperationException("草稿或禁用状态方可启用");
|
||||||
}
|
}
|
||||||
//如果需要启用区域,需要校验该区域下是否有上架的服务
|
// 如果需要启用区域,需要校验该区域下是否有上架的服务
|
||||||
LambdaQueryWrapper<Serve> queryWrapper = Wrappers.<Serve>lambdaQuery()
|
LambdaQueryWrapper<Serve> queryWrapper = Wrappers.<Serve>lambdaQuery()
|
||||||
.eq(Serve::getRegionId, id)
|
.eq(Serve::getRegionId, id)
|
||||||
.eq(Serve::getSaleStatus, FoundationStatusEnum.ENABLE.getStatus());
|
.eq(Serve::getSaleStatus, FoundationStatusEnum.ENABLE.getStatus());
|
||||||
@@ -170,14 +177,16 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
throw new ForbiddenOperationException("该区域没有上架的服务不可启用");
|
throw new ForbiddenOperationException("该区域没有上架的服务不可启用");
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新启用状态
|
// 更新启用状态
|
||||||
LambdaUpdateWrapper<Region> updateWrapper = Wrappers.<Region>lambdaUpdate()
|
LambdaUpdateWrapper<Region> updateWrapper = Wrappers.<Region>lambdaUpdate()
|
||||||
.eq(Region::getId, id)
|
.eq(Region::getId, id)
|
||||||
.set(Region::getActiveStatus, FoundationStatusEnum.ENABLE.getStatus());
|
.set(Region::getActiveStatus, FoundationStatusEnum.ENABLE.getStatus());
|
||||||
update(updateWrapper);
|
update(updateWrapper);
|
||||||
|
|
||||||
//3.如果是启用操作,刷新缓存:启用区域列表、首页图标、热门服务、服务类型
|
// 刷新区域相关缓存
|
||||||
// todo
|
this.refreshRegionRelateCaches(id);
|
||||||
|
// 通过返回值更新开通服务区域缓存
|
||||||
|
return queryActiveRegionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,19 +199,18 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
@CacheEvict(value = RedisConstants.CacheName.JZ_CACHE, key = "'ACTIVE_REGIONS'", beforeInvocation = true),
|
@CacheEvict(value = RedisConstants.CacheName.JZ_CACHE, key = "'ACTIVE_REGIONS'", beforeInvocation = true),
|
||||||
@CacheEvict(value = RedisConstants.CacheName.SERVE_ICON, key = "#id", beforeInvocation = true),
|
@CacheEvict(value = RedisConstants.CacheName.SERVE_ICON, key = "#id", beforeInvocation = true),
|
||||||
@CacheEvict(value = RedisConstants.CacheName.HOT_SERVE, key = "#id", beforeInvocation = true),
|
@CacheEvict(value = RedisConstants.CacheName.HOT_SERVE, key = "#id", beforeInvocation = true),
|
||||||
@CacheEvict(value = RedisConstants.CacheName.SERVE_TYPE, key = "#id", beforeInvocation = true)
|
@CacheEvict(value = RedisConstants.CacheName.SERVE_TYPE, key = "#id", beforeInvocation = true)})
|
||||||
})
|
|
||||||
public void deactivate(Long id) {
|
public void deactivate(Long id) {
|
||||||
//区域信息
|
// 区域信息
|
||||||
Region region = baseMapper.selectById(id);
|
Region region = baseMapper.selectById(id);
|
||||||
//启用状态
|
// 启用状态
|
||||||
Integer activeStatus = region.getActiveStatus();
|
Integer activeStatus = region.getActiveStatus();
|
||||||
//启用状态方可禁用
|
// 启用状态方可禁用
|
||||||
if (!(FoundationStatusEnum.ENABLE.getStatus() == activeStatus)) {
|
if (!(FoundationStatusEnum.ENABLE.getStatus() == activeStatus)) {
|
||||||
throw new ForbiddenOperationException("启用状态方可禁用");
|
throw new ForbiddenOperationException("启用状态方可禁用");
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果禁用区域下有上架的服务则无法禁用
|
// 如果禁用区域下有上架的服务则无法禁用
|
||||||
LambdaQueryWrapper<Serve> queryWrapper = Wrappers.<Serve>lambdaQuery()
|
LambdaQueryWrapper<Serve> queryWrapper = Wrappers.<Serve>lambdaQuery()
|
||||||
.eq(Serve::getRegionId, id)
|
.eq(Serve::getRegionId, id)
|
||||||
.eq(Serve::getSaleStatus, FoundationStatusEnum.ENABLE.getStatus());
|
.eq(Serve::getSaleStatus, FoundationStatusEnum.ENABLE.getStatus());
|
||||||
@@ -210,7 +218,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
throw new ForbiddenOperationException("该区域存在上架的服务不可禁用");
|
throw new ForbiddenOperationException("该区域存在上架的服务不可禁用");
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新禁用状态
|
// 更新禁用状态
|
||||||
LambdaUpdateWrapper<Region> updateWrapper = Wrappers.<Region>lambdaUpdate()
|
LambdaUpdateWrapper<Region> updateWrapper = Wrappers.<Region>lambdaUpdate()
|
||||||
.eq(Region::getId, id)
|
.eq(Region::getId, id)
|
||||||
.set(Region::getActiveStatus, FoundationStatusEnum.DISABLE.getStatus());
|
.set(Region::getActiveStatus, FoundationStatusEnum.DISABLE.getStatus());
|
||||||
@@ -228,4 +236,19 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
return queryActiveRegionList();
|
return queryActiveRegionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Caching(evict = {
|
||||||
|
@CacheEvict(value = RedisConstants.CacheName.SERVE_ICON, key = "#id", beforeInvocation = true),
|
||||||
|
@CacheEvict(value = RedisConstants.CacheName.HOT_SERVE, key = "#id", beforeInvocation = true),
|
||||||
|
@CacheEvict(value = RedisConstants.CacheName.SERVE_TYPE, key = "#id", beforeInvocation = true)})
|
||||||
|
public void refreshRegionRelateCaches(Long id) {
|
||||||
|
// 更新每个区域对应的首页服务列表
|
||||||
|
serveService.getFirstPageServeList(id);
|
||||||
|
|
||||||
|
// 更新每个区域对应的服务类型列表
|
||||||
|
serveTypeService.getServeTypeList(id);
|
||||||
|
|
||||||
|
// 更新每个区域对应的热门服务列表
|
||||||
|
serveService.getHotServeList(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ import com.jzo2o.foundations.service.IServeSyncService;
|
|||||||
import com.jzo2o.mysql.utils.PageHelperUtils;
|
import com.jzo2o.mysql.utils.PageHelperUtils;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -53,6 +54,12 @@ public class ServeItemServiceImpl extends ServiceImpl<ServeItemMapper, ServeItem
|
|||||||
@Resource
|
@Resource
|
||||||
private ServeMapper serveMapper;
|
private ServeMapper serveMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.SERVE_ITEM, key = "#id", cacheManager = RedisConstants.CacheManager.ONE_DAY)
|
||||||
|
public ServeItem selectByIdCache(Long id) {
|
||||||
|
return baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务项新增
|
* 服务项新增
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,29 +1,49 @@
|
|||||||
package com.jzo2o.foundations.service.impl;
|
package com.jzo2o.foundations.service.impl;
|
||||||
|
|
||||||
|
import co.elastic.clients.elasticsearch._types.SortOrder;
|
||||||
|
import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||||
|
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.extension.toolkit.ChainWrappers;
|
||||||
|
import com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO;
|
||||||
import com.jzo2o.common.expcetions.CommonException;
|
import com.jzo2o.common.expcetions.CommonException;
|
||||||
import com.jzo2o.common.expcetions.ForbiddenOperationException;
|
import com.jzo2o.common.expcetions.ForbiddenOperationException;
|
||||||
import com.jzo2o.common.model.PageResult;
|
import com.jzo2o.common.model.PageResult;
|
||||||
import com.jzo2o.common.utils.BeanUtils;
|
import com.jzo2o.common.utils.BeanUtils;
|
||||||
|
import com.jzo2o.common.utils.CollUtils;
|
||||||
import com.jzo2o.common.utils.ObjectUtils;
|
import com.jzo2o.common.utils.ObjectUtils;
|
||||||
|
import com.jzo2o.es.core.ElasticSearchTemplate;
|
||||||
|
import com.jzo2o.es.utils.SearchResponseUtils;
|
||||||
|
import com.jzo2o.foundations.constants.RedisConstants;
|
||||||
import com.jzo2o.foundations.enums.FoundationStatusEnum;
|
import com.jzo2o.foundations.enums.FoundationStatusEnum;
|
||||||
import com.jzo2o.foundations.enums.HotStatusEnum;
|
import com.jzo2o.foundations.enums.HotStatusEnum;
|
||||||
import com.jzo2o.foundations.mapper.RegionMapper;
|
|
||||||
import com.jzo2o.foundations.mapper.ServeItemMapper;
|
|
||||||
import com.jzo2o.foundations.mapper.ServeMapper;
|
import com.jzo2o.foundations.mapper.ServeMapper;
|
||||||
import com.jzo2o.foundations.model.domain.Serve;
|
import com.jzo2o.foundations.mapper.ServeSyncMapper;
|
||||||
import com.jzo2o.foundations.model.domain.ServeItem;
|
import com.jzo2o.foundations.model.domain.*;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServePageQueryReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServePageQueryReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeUpsertReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeUpsertReqDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
|
||||||
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
|
import com.jzo2o.foundations.model.dto.response.ServeResDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO;
|
||||||
|
import com.jzo2o.foundations.service.IRegionService;
|
||||||
|
import com.jzo2o.foundations.service.IServeItemService;
|
||||||
import com.jzo2o.foundations.service.IServeService;
|
import com.jzo2o.foundations.service.IServeService;
|
||||||
|
import com.jzo2o.foundations.service.IServeTypeService;
|
||||||
import com.jzo2o.mysql.utils.PageHelperUtils;
|
import com.jzo2o.mysql.utils.PageHelperUtils;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域服务实现类
|
* 区域服务实现类
|
||||||
@@ -31,6 +51,12 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements IServeService {
|
public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements IServeService {
|
||||||
|
@Override
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.SERVE, key = "#id", cacheManager = RedisConstants.CacheManager.ONE_DAY)
|
||||||
|
public Serve selectByIdCache(Long id) {
|
||||||
|
return baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ServeResDTO> page(ServePageQueryReqDTO servePageQueryReqDTO) {
|
public PageResult<ServeResDTO> page(ServePageQueryReqDTO servePageQueryReqDTO) {
|
||||||
return PageHelperUtils.selectPage(servePageQueryReqDTO,
|
return PageHelperUtils.selectPage(servePageQueryReqDTO,
|
||||||
@@ -43,7 +69,7 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
for (ServeUpsertReqDTO serveItemDTO : serveItems) {
|
for (ServeUpsertReqDTO serveItemDTO : serveItems) {
|
||||||
// 服务项校验
|
// 服务项校验
|
||||||
Long serveItemId = serveItemDTO.getServeItemId();
|
Long serveItemId = serveItemDTO.getServeItemId();
|
||||||
ServeItem serveItem = serveItemMapper.selectById(serveItemId);
|
ServeItem serveItem = serveItemService.getById(serveItemId);
|
||||||
if (ObjectUtils.isEmpty(serveItem)) {
|
if (ObjectUtils.isEmpty(serveItem)) {
|
||||||
throw new ForbiddenOperationException("服务项不存在");
|
throw new ForbiddenOperationException("服务项不存在");
|
||||||
}
|
}
|
||||||
@@ -62,7 +88,7 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
Serve serve = BeanUtils.toBean(serveItemDTO, Serve.class);
|
Serve serve = BeanUtils.toBean(serveItemDTO, Serve.class);
|
||||||
serve.setCityCode(regionMapper.selectById(regionId).getCityCode());
|
serve.setCityCode(regionService.getById(regionId).getCityCode());
|
||||||
baseMapper.insert(serve);
|
baseMapper.insert(serve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +107,7 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@CachePut(value = RedisConstants.CacheName.SERVE, key = "#id", unless = "#result.saleStatus != 2", cacheManager = RedisConstants.CacheManager.ONE_DAY)
|
||||||
public Serve updatePrice(Long id, BigDecimal price) {
|
public Serve updatePrice(Long id, BigDecimal price) {
|
||||||
// 区域服务检验
|
// 区域服务检验
|
||||||
Serve serve = getServeByIdIfExist(id);
|
Serve serve = getServeByIdIfExist(id);
|
||||||
@@ -92,12 +119,20 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
throw new CommonException("价格更新失败");
|
throw new CommonException("价格更新失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新sync数据同步ES
|
||||||
|
ChainWrappers.lambdaUpdateChain(serveSyncMapper)
|
||||||
|
.eq(ServeSync::getId, id)
|
||||||
|
.set(ServeSync::getPrice, price)
|
||||||
|
.update();
|
||||||
|
|
||||||
|
// 返回修改后对象同步缓存
|
||||||
serve.setPrice(price);
|
serve.setPrice(price);
|
||||||
return serve;
|
return serve;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@CachePut(value = RedisConstants.CacheName.SERVE, key = "#id", cacheManager = RedisConstants.CacheManager.ONE_DAY)
|
||||||
public Serve updateOnSale(Long id) {
|
public Serve updateOnSale(Long id) {
|
||||||
// 区域服务检验
|
// 区域服务检验
|
||||||
Serve serve = getServeByIdIfExist(id);
|
Serve serve = getServeByIdIfExist(id);
|
||||||
@@ -108,7 +143,7 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
throw new ForbiddenOperationException("草稿或下架状态才能上架");
|
throw new ForbiddenOperationException("草稿或下架状态才能上架");
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer activeStatus = serveItemMapper.selectById(serve.getServeItemId()).getActiveStatus();
|
Integer activeStatus = serveItemService.getById(serve.getServeItemId()).getActiveStatus();
|
||||||
if (!ObjectUtils.equal(activeStatus, FoundationStatusEnum.ENABLE.getStatus())) {
|
if (!ObjectUtils.equal(activeStatus, FoundationStatusEnum.ENABLE.getStatus())) {
|
||||||
throw new ForbiddenOperationException("对应的服务项未启用不能上架");
|
throw new ForbiddenOperationException("对应的服务项未启用不能上架");
|
||||||
}
|
}
|
||||||
@@ -121,13 +156,42 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
throw new CommonException("状态更新失败");
|
throw new CommonException("状态更新失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新服务启用状态
|
||||||
serve.setSaleStatus(enableStatus);
|
serve.setSaleStatus(enableStatus);
|
||||||
|
// 服务项信息
|
||||||
|
ServeItem serveItem = serveItemService.getById(serve.getServeItemId());
|
||||||
|
// 服务类型
|
||||||
|
ServeType serveType = serveTypeService.getById(serveItem.getServeTypeId());
|
||||||
|
|
||||||
|
// 插入sync表添加ES索引
|
||||||
|
serveSyncMapper.insert(ServeSync.builder()
|
||||||
|
// serve_type data
|
||||||
|
.serveTypeId(serveType.getId())
|
||||||
|
.serveTypeName(serveType.getName())
|
||||||
|
.serveItemIcon(serveType.getServeTypeIcon())
|
||||||
|
.serveTypeImg(serveType.getImg())
|
||||||
|
.serveTypeSortNum(serveType.getSortNum())
|
||||||
|
// serve_item data
|
||||||
|
.serveItemId(serveItem.getId())
|
||||||
|
.serveItemName(serveItem.getName())
|
||||||
|
.serveItemIcon(serveItem.getServeItemIcon())
|
||||||
|
.serveItemImg(serveItem.getImg())
|
||||||
|
.serveItemSortNum(serveItem.getSortNum())
|
||||||
|
.unit(serveItem.getUnit())
|
||||||
|
.detailImg(serveItem.getDetailImg())
|
||||||
|
// serve data
|
||||||
|
.id(serve.getId())
|
||||||
|
.price(serve.getPrice())
|
||||||
|
.cityCode(serve.getCityCode())
|
||||||
|
.isHot(serve.getIsHot()).build());
|
||||||
|
|
||||||
return serve;
|
return serve;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Serve updateOffSale(Long id) {
|
@CacheEvict(value = RedisConstants.CacheName.SERVE, key = "#id", cacheManager = RedisConstants.CacheManager.ONE_DAY)
|
||||||
|
public void updateOffSale(Long id) {
|
||||||
// 区域服务检验
|
// 区域服务检验
|
||||||
Serve serve = getServeByIdIfExist(id);
|
Serve serve = getServeByIdIfExist(id);
|
||||||
|
|
||||||
@@ -144,8 +208,8 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
throw new CommonException("状态更新失败");
|
throw new CommonException("状态更新失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
serve.setSaleStatus(disableStatus);
|
// 删除sync表数据删除ES索引
|
||||||
return serve;
|
serveSyncMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,7 +227,7 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Serve updateOnHot(Long id) {
|
public void updateOnHot(Long id) {
|
||||||
Serve serve = getServeByIdIfExist(id);
|
Serve serve = getServeByIdIfExist(id);
|
||||||
|
|
||||||
if (serve.getIsHot() != HotStatusEnum.OFF_HOT.getStatus()) {
|
if (serve.getIsHot() != HotStatusEnum.OFF_HOT.getStatus()) {
|
||||||
@@ -177,14 +241,11 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
.update()) {
|
.update()) {
|
||||||
throw new CommonException("热门状态更新失败");
|
throw new CommonException("热门状态更新失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
serve.setIsHot(hotStatus);
|
|
||||||
return serve;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Serve updateOffHot(Long id) {
|
public void updateOffHot(Long id) {
|
||||||
Serve serve = getServeByIdIfExist(id);
|
Serve serve = getServeByIdIfExist(id);
|
||||||
|
|
||||||
if (serve.getIsHot() != HotStatusEnum.ON_HOT.getStatus()) {
|
if (serve.getIsHot() != HotStatusEnum.ON_HOT.getStatus()) {
|
||||||
@@ -198,14 +259,143 @@ public class ServeServiceImpl extends ServiceImpl<ServeMapper, Serve> implements
|
|||||||
.update()) {
|
.update()) {
|
||||||
throw new CommonException("热门状态更新失败");
|
throw new CommonException("热门状态更新失败");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
serve.setIsHot(hotStatus);
|
@Override
|
||||||
return serve;
|
@Caching(cacheable = {
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.SERVE_ICON, key = "#regionId",
|
||||||
|
cacheManager = RedisConstants.CacheManager.THIRTY_MINUTES,
|
||||||
|
unless = "#result.size() != 0"), // 防止缓存穿透
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.SERVE_ICON, key = "#regionId",
|
||||||
|
cacheManager = RedisConstants.CacheManager.FOREVER,
|
||||||
|
unless = "#result.size() == 0")})
|
||||||
|
public List<ServeCategoryResDTO> getFirstPageServeList(Long regionId) {
|
||||||
|
Region region = regionService.getById(regionId);
|
||||||
|
if (ObjectUtils.isEmpty(region)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ServeCategoryResDTO> serveIconList = baseMapper.queryServeIconListByRegionId(regionId);
|
||||||
|
if (CollUtils.isEmpty(serveIconList)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保留最多前两个类型及最多前4个服务项
|
||||||
|
serveIconList = new ArrayList<>(serveIconList.subList(0, Math.min(serveIconList.size(), 2)));
|
||||||
|
serveIconList.forEach(res -> {
|
||||||
|
List<ServeSimpleResDTO> serveResDTOList = res.getServeResDTOList();
|
||||||
|
res.setServeResDTOList(new ArrayList<>(serveResDTOList.subList(0, Math.min(serveResDTOList.size(), 4))));
|
||||||
|
});
|
||||||
|
|
||||||
|
return serveIconList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Caching(cacheable = {
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.HOT_SERVE, key = "#regionId",
|
||||||
|
cacheManager = RedisConstants.CacheManager.THIRTY_MINUTES,
|
||||||
|
unless = "#result.size() != 0"), // 防止缓存穿透
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.HOT_SERVE, key = "#regionId",
|
||||||
|
cacheManager = RedisConstants.CacheManager.FOREVER,
|
||||||
|
unless = "#result.size() == 0")})
|
||||||
|
public List<ServeAggregationSimpleResDTO> getHotServeList(Long regionId) {
|
||||||
|
Region region = regionService.getById(regionId);
|
||||||
|
if (ObjectUtils.isEmpty(region)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ServeAggregationSimpleResDTO> hotServeList = baseMapper.queryHotServeListByRegionId(regionId);
|
||||||
|
if (CollUtils.isEmpty(hotServeList)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return hotServeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServeAggregationSimpleResDTO getServeById(Long serveId) {
|
||||||
|
Serve serve = serveService.selectByIdCache(serveId);
|
||||||
|
if (ObjectUtils.isEmpty(serve)) {
|
||||||
|
return new ServeAggregationSimpleResDTO();
|
||||||
|
}
|
||||||
|
|
||||||
|
ServeItem serveItem = serveItemService.selectByIdCache(serve.getServeItemId());
|
||||||
|
if (ObjectUtils.isEmpty(serveItem)) {
|
||||||
|
return new ServeAggregationSimpleResDTO();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ServeAggregationSimpleResDTO.builder()
|
||||||
|
.id(serve.getId())
|
||||||
|
.serveItemId(serveItem.getId())
|
||||||
|
.serveItemName(serveItem.getName())
|
||||||
|
.serveItemImg(serveItem.getImg())
|
||||||
|
.detailImg(serveItem.getDetailImg())
|
||||||
|
.unit(serveItem.getUnit())
|
||||||
|
.price(serve.getPrice())
|
||||||
|
.cityCode(serve.getCityCode())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ServeSimpleResDTO> findServeList(String cityCode, Long serveTypeId, String keyword) {
|
||||||
|
// 构建ES搜索请求
|
||||||
|
SearchRequest searchRequest = new SearchRequest.Builder()
|
||||||
|
.index("serve_aggregation")
|
||||||
|
.query(query -> query
|
||||||
|
.bool(bool -> {
|
||||||
|
bool = bool.must(must -> must.term(term -> term
|
||||||
|
.field("city_code")
|
||||||
|
.value(cityCode)));
|
||||||
|
|
||||||
|
if (!ObjectUtils.isEmpty(serveTypeId)) {
|
||||||
|
bool = bool.must(must -> must.term(term -> term
|
||||||
|
.field("serve_type_id")
|
||||||
|
.value(serveTypeId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ObjectUtils.isEmpty(keyword)) {
|
||||||
|
bool = bool.must(must -> must.multiMatch(multi -> multi
|
||||||
|
.query(keyword)
|
||||||
|
.fields("serve_item_name", "serve_item_name")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return bool;
|
||||||
|
}))
|
||||||
|
.sort(sort -> sort
|
||||||
|
.field(field -> field
|
||||||
|
.field("serve_item_sort_num")
|
||||||
|
.order(SortOrder.Asc)))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 发送搜索请求获取结果
|
||||||
|
SearchResponse<ServeAggregation> response = elasticSearchTemplate
|
||||||
|
.opsForDoc()
|
||||||
|
.search(searchRequest, ServeAggregation.class);
|
||||||
|
|
||||||
|
if (SearchResponseUtils.isNotSuccess(response)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
} else {
|
||||||
|
return response.hits().hits().stream()
|
||||||
|
.map(hit -> BeanUtils.toBean(hit.source(), ServeSimpleResDTO.class))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServeAggregationResDTO getServeAggregationById(Long id) {
|
||||||
|
return baseMapper.getServeAggregationById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ServeItemMapper serveItemMapper;
|
private IRegionService regionService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RegionMapper regionMapper;
|
private IServeService serveService;
|
||||||
|
@Resource
|
||||||
|
private IServeTypeService serveTypeService;
|
||||||
|
@Resource
|
||||||
|
private IServeItemService serveItemService;
|
||||||
|
@Resource
|
||||||
|
private ServeSyncMapper serveSyncMapper;
|
||||||
|
@Resource
|
||||||
|
private ElasticSearchTemplate elasticSearchTemplate;
|
||||||
}
|
}
|
||||||
@@ -12,21 +12,30 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.jzo2o.api.foundations.dto.response.ServeTypeSimpleResDTO;
|
import com.jzo2o.api.foundations.dto.response.ServeTypeSimpleResDTO;
|
||||||
import com.jzo2o.common.expcetions.ForbiddenOperationException;
|
import com.jzo2o.common.expcetions.ForbiddenOperationException;
|
||||||
import com.jzo2o.common.model.PageResult;
|
import com.jzo2o.common.model.PageResult;
|
||||||
|
import com.jzo2o.common.utils.CollUtils;
|
||||||
|
import com.jzo2o.common.utils.ObjectUtils;
|
||||||
|
import com.jzo2o.foundations.constants.RedisConstants;
|
||||||
import com.jzo2o.foundations.enums.FoundationStatusEnum;
|
import com.jzo2o.foundations.enums.FoundationStatusEnum;
|
||||||
|
import com.jzo2o.foundations.mapper.RegionMapper;
|
||||||
import com.jzo2o.foundations.mapper.ServeTypeMapper;
|
import com.jzo2o.foundations.mapper.ServeTypeMapper;
|
||||||
|
import com.jzo2o.foundations.model.domain.Region;
|
||||||
import com.jzo2o.foundations.model.domain.ServeType;
|
import com.jzo2o.foundations.model.domain.ServeType;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeSyncUpdateReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeSyncUpdateReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeTypePageQueryReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeTypePageQueryReqDTO;
|
||||||
import com.jzo2o.foundations.model.dto.request.ServeTypeUpsertReqDTO;
|
import com.jzo2o.foundations.model.dto.request.ServeTypeUpsertReqDTO;
|
||||||
|
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
|
||||||
import com.jzo2o.foundations.model.dto.response.ServeTypeResDTO;
|
import com.jzo2o.foundations.model.dto.response.ServeTypeResDTO;
|
||||||
import com.jzo2o.foundations.service.IServeItemService;
|
import com.jzo2o.foundations.service.IServeItemService;
|
||||||
import com.jzo2o.foundations.service.IServeSyncService;
|
import com.jzo2o.foundations.service.IServeSyncService;
|
||||||
import com.jzo2o.foundations.service.IServeTypeService;
|
import com.jzo2o.foundations.service.IServeTypeService;
|
||||||
import com.jzo2o.mysql.utils.PageUtils;
|
import com.jzo2o.mysql.utils.PageUtils;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,6 +50,8 @@ public class ServeTypeServiceImpl extends ServiceImpl<ServeTypeMapper, ServeType
|
|||||||
private IServeItemService serveItemService;
|
private IServeItemService serveItemService;
|
||||||
@Resource
|
@Resource
|
||||||
private IServeSyncService serveSyncService;
|
private IServeSyncService serveSyncService;
|
||||||
|
@Resource
|
||||||
|
private RegionMapper regionMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务类型新增
|
* 服务类型新增
|
||||||
@@ -192,4 +203,26 @@ public class ServeTypeServiceImpl extends ServiceImpl<ServeTypeMapper, ServeType
|
|||||||
List<ServeType> serveTypeList = baseMapper.selectList(queryWrapper);
|
List<ServeType> serveTypeList = baseMapper.selectList(queryWrapper);
|
||||||
return BeanUtil.copyToList(serveTypeList, ServeTypeSimpleResDTO.class);
|
return BeanUtil.copyToList(serveTypeList, ServeTypeSimpleResDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Caching(cacheable = {
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.SERVE_TYPE, key = "#regionId",
|
||||||
|
cacheManager = RedisConstants.CacheManager.THIRTY_MINUTES,
|
||||||
|
unless = "#result.size() != 0"), // 防止缓存穿透
|
||||||
|
@Cacheable(value = RedisConstants.CacheName.SERVE_TYPE, key = "#regionId",
|
||||||
|
cacheManager = RedisConstants.CacheManager.FOREVER,
|
||||||
|
unless = "#result.size() == 0")})
|
||||||
|
public List<ServeAggregationTypeSimpleResDTO> getServeTypeList(Long regionId) {
|
||||||
|
Region region = regionMapper.selectById(regionId);
|
||||||
|
if (ObjectUtils.isEmpty(region)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ServeAggregationTypeSimpleResDTO> serveTypeList = baseMapper.getServeTypeListByRegionId(regionId);
|
||||||
|
if (CollUtils.isEmpty(serveTypeList)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return serveTypeList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -41,12 +41,12 @@ spring:
|
|||||||
shared-configs: # 共享配置
|
shared-configs: # 共享配置
|
||||||
- data-id: shared-redis-cluster.yaml # 共享redis配置
|
- data-id: shared-redis-cluster.yaml # 共享redis配置
|
||||||
refresh: false
|
refresh: false
|
||||||
# - data-id: shared-xxl-job.yaml # xxl-job配置
|
- data-id: shared-xxl-job.yaml # xxl-job配置
|
||||||
# refresh: false
|
refresh: false
|
||||||
# - data-id: shared-rabbitmq.yaml # rabbitmq配置
|
- data-id: shared-rabbitmq.yaml # rabbitmq配置
|
||||||
# refresh: false
|
refresh: false
|
||||||
# - data-id: shared-es.yaml # rabbitmq配置
|
- data-id: shared-es.yaml # elasticsearch配置
|
||||||
# refresh: false
|
refresh: false
|
||||||
- data-id: shared-mysql.yaml # mysql配置
|
- data-id: shared-mysql.yaml # mysql配置
|
||||||
refresh: false
|
refresh: false
|
||||||
|
|
||||||
|
|||||||
@@ -19,4 +19,82 @@
|
|||||||
JOIN serve_type st ON si.serve_type_id = st.id
|
JOIN serve_type st ON si.serve_type_id = st.id
|
||||||
WHERE s.region_id = #{regionId}
|
WHERE s.region_id = #{regionId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="ServeCategoryResMap" type="com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO">
|
||||||
|
<id column="serve_type_id" property="serveTypeId"/>
|
||||||
|
<result column="type_name" property="serveTypeName"/>
|
||||||
|
<result column="serve_type_icon" property="serveTypeIcon"/>
|
||||||
|
<result column="city_code" property="cityCode"/>
|
||||||
|
<result column="type_sort_num" property="serveTypeSortNum"/>
|
||||||
|
<collection property="serveResDTOList" ofType="com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO">
|
||||||
|
<id column="serve_id" property="id"/>
|
||||||
|
<result column="serve_item_id" property="serveItemId"/>
|
||||||
|
<result column="item_name" property="serveItemName"/>
|
||||||
|
<result column="serve_item_icon" property="serveItemIcon"/>
|
||||||
|
<result column="item_sort_num" property="serveItemSortNum"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="queryServeIconListByRegionId" resultMap="ServeCategoryResMap">
|
||||||
|
SELECT serve_type_id,
|
||||||
|
type.name type_name,
|
||||||
|
serve_type_icon,
|
||||||
|
city_code,
|
||||||
|
type.sort_num type_sort_num,
|
||||||
|
serve_item_id,
|
||||||
|
item.name item_name,
|
||||||
|
serve_item_icon,
|
||||||
|
item.sort_num item_sort_num,
|
||||||
|
serve.id serve_id
|
||||||
|
FROM serve
|
||||||
|
JOIN serve_item item ON serve.serve_item_id = item.id
|
||||||
|
JOIN serve_type type ON item.serve_type_id = type.id
|
||||||
|
WHERE serve.region_id = #{regionId}
|
||||||
|
AND serve.sale_status = 2 # 保证上架服务
|
||||||
|
ORDER BY type.sort_num, item.sort_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryHotServeListByRegionId"
|
||||||
|
resultType="com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO">
|
||||||
|
SELECT serve.id,
|
||||||
|
serve_item_id,
|
||||||
|
name serve_item_name,
|
||||||
|
img serve_item_img,
|
||||||
|
unit,
|
||||||
|
price,
|
||||||
|
detail_img,
|
||||||
|
city_code
|
||||||
|
FROM serve
|
||||||
|
JOIN serve_item item ON serve.serve_item_id = item.id
|
||||||
|
WHERE serve.region_id = #{regionId}
|
||||||
|
AND serve.sale_status = 2 # 保证上架服务
|
||||||
|
AND serve.is_hot = 1 # 保证热门状态
|
||||||
|
ORDER BY item.sort_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getServeAggregationById" resultType="com.jzo2o.api.foundations.dto.response.ServeAggregationResDTO"
|
||||||
|
parameterType="java.lang.Long">
|
||||||
|
SELECT serve_type_id,
|
||||||
|
type.name serve_type_name,
|
||||||
|
type.serve_type_icon,
|
||||||
|
type.img serve_type_img,
|
||||||
|
type.sort_num serve_type_sort_num,
|
||||||
|
serve_item_id,
|
||||||
|
item.name serve_item_name,
|
||||||
|
item.serve_item_icon,
|
||||||
|
item.img serve_item_img,
|
||||||
|
item.detail_img,
|
||||||
|
item.sort_num serve_item_sort_num,
|
||||||
|
item.unit,
|
||||||
|
serve.id,
|
||||||
|
serve.sale_status,
|
||||||
|
serve.city_code,
|
||||||
|
serve.price,
|
||||||
|
serve.is_hot,
|
||||||
|
serve.hot_time_stamp
|
||||||
|
FROM serve
|
||||||
|
JOIN serve_item item ON serve.serve_item_id = item.id
|
||||||
|
JOIN serve_type type ON item.serve_type_id = type.id
|
||||||
|
WHERE serve.id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,5 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.jzo2o.foundations.mapper.ServeTypeMapper">
|
<mapper namespace="com.jzo2o.foundations.mapper.ServeTypeMapper">
|
||||||
|
<select id="getServeTypeListByRegionId"
|
||||||
|
resultType="com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO">
|
||||||
|
SELECT distinct serve_type_id,
|
||||||
|
type.name serveTypeName,
|
||||||
|
type.img serveTypeImg,
|
||||||
|
type.sort_num serveTypeSortNum
|
||||||
|
FROM serve
|
||||||
|
JOIN serve_item item ON serve.serve_item_id = item.id
|
||||||
|
JOIN serve_type type ON item.serve_type_id = type.id
|
||||||
|
WHERE serve.region_id = #{regionId}
|
||||||
|
AND serve.sale_status = 2 # 保证上架服务
|
||||||
|
ORDER BY type.sort_num
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
9
jzo2o-health/Dockerfile
Normal file
9
jzo2o-health/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM openjdk:11-jdk
|
||||||
|
LABEL maintainer="研究院研发组 <research-maint@itcast.cn>"
|
||||||
|
RUN echo "Asia/Shanghai" > /etc/timezone
|
||||||
|
ARG PACKAGE_PATH=./target/jzo2o-health.jar
|
||||||
|
|
||||||
|
ADD ${PACKAGE_PATH:-./} app.jar
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 9999
|
||||||
|
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS app.jar"]
|
||||||
103
jzo2o-health/pom.xml
Normal file
103
jzo2o-health/pom.xml
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-health</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>jzo2o-health</name>
|
||||||
|
<description>jzo2o-health</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>jzo2o-parent</artifactId>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-mvc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-knife4j-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--单元测试-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-thirdparty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-mysql</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-xxl-job</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jzo2o</groupId>
|
||||||
|
<artifactId>jzo2o-rabbitmq</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build-info</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.jzo2o.health.HealthApplication</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.jzo2o.health;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@MapperScan("com.jzo2o.health.mapper")
|
||||||
|
@SpringBootApplication
|
||||||
|
public class HealthApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(HealthApplication.class, args);
|
||||||
|
log.info("家政服务-健康服务启动");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jzo2o.health.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略token校验的注解
|
||||||
|
* 虽然在注册JwtTokenInterceptor时可以指定忽略的请求路径,但是无法指定请求方式。
|
||||||
|
* 对于同一个请求url,请求方式可以有多种,无法做到区别对待
|
||||||
|
* 例如:请求url为/dish,其中POST方式对应的方法需要进行token校验,GET方式对应的方法不需要进行token校验
|
||||||
|
* 此时就需要通过IgnoreToken注解来标识当前方法不需要校验
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface IgnoreToken {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.jzo2o.health.config;
|
||||||
|
|
||||||
|
import com.jzo2o.health.constant.HealthMqConstants;
|
||||||
|
import com.jzo2o.rabbitmq.config.RabbitMqConfiguration;
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RabbitMQ延时队列
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@Import(RabbitMqConfiguration.class)
|
||||||
|
public class DelayQueueConfiguration {
|
||||||
|
@Bean
|
||||||
|
public Exchange delayExchange() {
|
||||||
|
return ExchangeBuilder
|
||||||
|
.topicExchange(HealthMqConstants.Exchanges.HEALTH_ORDER)
|
||||||
|
.durable(true)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue delayQueueIn() {
|
||||||
|
return QueueBuilder
|
||||||
|
.durable(HealthMqConstants.Queues.DELAY_IN)
|
||||||
|
// 订单默认15分钟超时
|
||||||
|
.ttl((int) TimeUnit.MINUTES.toMillis(15))
|
||||||
|
.deadLetterExchange(HealthMqConstants.Exchanges.HEALTH_ORDER)
|
||||||
|
.deadLetterRoutingKey(HealthMqConstants.RoutingKeys.ORDER_OVERTIME_OUT)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue delayQueueOut() {
|
||||||
|
return QueueBuilder.durable(HealthMqConstants.Queues.DELAY_OUT)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding bindDelayQueueIn() {
|
||||||
|
return BindingBuilder
|
||||||
|
.bind(delayQueueIn())
|
||||||
|
.to(delayExchange())
|
||||||
|
.with(HealthMqConstants.RoutingKeys.ORDER_OVERTIME_IN)
|
||||||
|
.noargs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding bindDelayQueueOut() {
|
||||||
|
return BindingBuilder
|
||||||
|
.bind(delayQueueOut())
|
||||||
|
.to(delayExchange())
|
||||||
|
.with(HealthMqConstants.RoutingKeys.ORDER_OVERTIME_OUT)
|
||||||
|
.noargs();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.jzo2o.health.config;
|
||||||
|
|
||||||
|
import com.jzo2o.common.utils.JwtTool;
|
||||||
|
import com.jzo2o.health.properties.ApplicationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class JwtConfiguration {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ApplicationProperties applicationProperties;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JwtTool jwtTool() {
|
||||||
|
return new JwtTool(applicationProperties.getJwtKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jzo2o.health.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class SecurityConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder passwordEncoder() {
|
||||||
|
return new BCryptPasswordEncoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.jzo2o.health.config;
|
||||||
|
|
||||||
|
import com.jzo2o.health.interceptor.JwtTokenInterceptor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JwtTokenInterceptor jwtTokenInterceptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册拦截器
|
||||||
|
*
|
||||||
|
* @param registry
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(jwtTokenInterceptor)
|
||||||
|
.addPathPatterns("/admin/**", "/user/**")//指定拦截的路径
|
||||||
|
.excludePathPatterns("/open/**");//添加不拦截路径
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.jzo2o.health.constant;
|
||||||
|
|
||||||
|
import com.jzo2o.common.constants.MqConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 即刻体检MQ常量
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
public interface HealthMqConstants extends MqConstants {
|
||||||
|
interface Exchanges extends MqConstants.Exchanges {
|
||||||
|
String HEALTH_ORDER = "health.exchange.topic.order";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Queues extends MqConstants.Queues {
|
||||||
|
String DELAY_IN = "health.queue.orders.delay.in";
|
||||||
|
String DELAY_OUT = "health.queue.orders.delay.out";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RoutingKeys extends MqConstants.RoutingKeys {
|
||||||
|
String ORDER_OVERTIME_IN = "order.overtime.in";
|
||||||
|
String ORDER_OVERTIME_OUT = "order.overtime.out";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jzo2o.health.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付相关常量
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/7 17:46
|
||||||
|
**/
|
||||||
|
public class RedisConstants {
|
||||||
|
/**
|
||||||
|
* 用户端订单滚动分页查询
|
||||||
|
*/
|
||||||
|
public static final String ORDER_PAGE_QUERY = "HEALTH:ORDERS:PAGE_QUERY:PAGE_%s";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端下单订单号生成器
|
||||||
|
*/
|
||||||
|
public static final String ORDER_ID_GENERATOR = "HEALTH:ORDERS:GENERATOR";
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.jzo2o.health.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付相关常量
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/7 17:46
|
||||||
|
**/
|
||||||
|
public class TradeConstants {
|
||||||
|
/**
|
||||||
|
* 支付来源
|
||||||
|
*/
|
||||||
|
public static final String PRODUCT_APP_ID="health";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rabbitmq支付更新状态队列
|
||||||
|
*/
|
||||||
|
public static final String MQ_TRADE_QUEUE="jzo2o.queue.health.trade.update.Status";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.jzo2o.health.controller.admin;
|
||||||
|
|
||||||
|
import com.jzo2o.common.model.PageResult;
|
||||||
|
import com.jzo2o.health.model.dto.request.OrdersPageQueryReqDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.AdminOrdersDetailResDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.OrdersResDTO;
|
||||||
|
import com.jzo2o.health.service.IOrderManagerService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@RestController("adminOrdersQueryController")
|
||||||
|
@RequestMapping("/admin/orders")
|
||||||
|
@Api(tags = "管理端 - 订单查询接口")
|
||||||
|
public class OrdersQueryController {
|
||||||
|
@Resource
|
||||||
|
private IOrderManagerService orderManagerService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public PageResult<OrdersResDTO> pageQuery(OrdersPageQueryReqDTO ordersPageQueryReqDTO) {
|
||||||
|
return orderManagerService.pageQuery(ordersPageQueryReqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@ApiOperation("根据订单id查询")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "订单id", required = true, dataTypeClass = Long.class)
|
||||||
|
})
|
||||||
|
public AdminOrdersDetailResDTO aggregation(@PathVariable("id") Long id) {
|
||||||
|
return orderManagerService.getAggregationInfo(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.jzo2o.health.controller.admin;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.dto.response.OrdersCountResDTO;
|
||||||
|
import com.jzo2o.health.service.IOrderManagerService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@RestController("adminOrdersStatsController")
|
||||||
|
@RequestMapping("/admin/orders")
|
||||||
|
@Api(tags = "管理端 - 根据状态统计订单数量")
|
||||||
|
public class OrdersStatsController {
|
||||||
|
@Resource
|
||||||
|
private IOrderManagerService orderManagerService;
|
||||||
|
|
||||||
|
@GetMapping("/countByStatus")
|
||||||
|
@ApiOperation("根据状态统计数量")
|
||||||
|
public OrdersCountResDTO countByStatus() {
|
||||||
|
return orderManagerService.countByStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.jzo2o.health.controller.admin;
|
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.jzo2o.common.utils.CollUtils;
|
||||||
|
import com.jzo2o.health.model.excel.ReservationImportData;
|
||||||
|
import com.jzo2o.health.service.IReservationSettingService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约设置操作
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController("adminReservationBatchSettingController")
|
||||||
|
@RequestMapping("/admin/reservation-setting")
|
||||||
|
@Api(tags = "管理端 - 批量预约设置相关接口")
|
||||||
|
public class ReservationBatchSettingController {
|
||||||
|
@Resource
|
||||||
|
private IReservationSettingService reservationSettingService;
|
||||||
|
|
||||||
|
@PostMapping("/upload")
|
||||||
|
@ApiOperation("上传文件批量预约设置")
|
||||||
|
public void upload(@RequestPart("file") MultipartFile file) {
|
||||||
|
List<ReservationImportData> reservationDataList;
|
||||||
|
|
||||||
|
try (InputStream inputStream = file.getInputStream()) {
|
||||||
|
reservationDataList = EasyExcel.read(inputStream)
|
||||||
|
.head(ReservationImportData.class)
|
||||||
|
.sheet("预约设置模板")
|
||||||
|
.doReadSync();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 防止过度包装
|
||||||
|
throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollUtils.isNotEmpty(reservationDataList)) {
|
||||||
|
reservationSettingService.editNumberByDateBatch(reservationDataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.jzo2o.health.controller.admin;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.dto.request.ReservationSettingUpsertReqDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.ReservationSettingResDTO;
|
||||||
|
import com.jzo2o.health.service.IReservationSettingService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约设置操作
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController("adminReservationSettingController")
|
||||||
|
@RequestMapping("/admin/reservation-setting")
|
||||||
|
@Api(tags = "管理端 - 预约设置相关接口")
|
||||||
|
public class ReservationSettingController {
|
||||||
|
@Resource
|
||||||
|
private IReservationSettingService reservationSettingService;
|
||||||
|
|
||||||
|
@GetMapping("/getReservationSettingByMonth")
|
||||||
|
@ApiOperation("按月查询预约设置")
|
||||||
|
@ApiImplicitParam(name = "date", value = "月份,格式:yyyy-MM", required = true, dataTypeClass = String.class)
|
||||||
|
public List<ReservationSettingResDTO> getReservationSettingByMonth(@RequestParam("date") String date) {
|
||||||
|
YearMonth yearMonth = YearMonth.parse(date);
|
||||||
|
return reservationSettingService.getReservationSettingByMonth(yearMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/editNumberByDate")
|
||||||
|
@ApiOperation("编辑预约设置")
|
||||||
|
public void editNumberByDate(@RequestBody ReservationSettingUpsertReqDTO reservationSettingUpsertReqDTO) {
|
||||||
|
reservationSettingService.editNumberByDate(reservationSettingUpsertReqDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.jzo2o.health.controller.admin;
|
||||||
|
|
||||||
|
import com.jzo2o.common.model.PageResult;
|
||||||
|
import com.jzo2o.health.model.domain.Setmeal;
|
||||||
|
import com.jzo2o.health.model.dto.request.CommonPageQueryReqDTO;
|
||||||
|
import com.jzo2o.health.service.ISetmealService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检套餐管理
|
||||||
|
*/
|
||||||
|
@RestController("adminSetmealController")
|
||||||
|
@RequestMapping("/admin/setmeal")
|
||||||
|
@Api(tags = "管理端 - 套餐相关接口")
|
||||||
|
public class SetmealController {
|
||||||
|
@Resource
|
||||||
|
private ISetmealService setmealService;
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("新增套餐")
|
||||||
|
@ApiImplicitParam(name = "checkgroupIds", value = "检查组id列表", required = true, dataTypeClass = Integer.class)
|
||||||
|
public void add(@RequestBody Setmeal setmeal, @RequestParam("checkgroupIds") Integer[] checkgroupIds) {
|
||||||
|
setmealService.add(setmeal, checkgroupIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/findPage")
|
||||||
|
@ApiOperation("分页查询套餐")
|
||||||
|
public PageResult<Setmeal> findPage(CommonPageQueryReqDTO commonPageQueryReqDTO) {
|
||||||
|
return setmealService.findPage(commonPageQueryReqDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.jzo2o.health.controller.open;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.dto.request.LoginReqDTO;
|
||||||
|
import com.jzo2o.health.model.dto.request.MemberLoginReqDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.LoginResDTO;
|
||||||
|
import com.jzo2o.health.service.ILoginService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@RestController("openLoginController")
|
||||||
|
@RequestMapping("/open/login")
|
||||||
|
@Api(tags = "白名单接口 - 登录相关接口")
|
||||||
|
public class LoginController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILoginService loginService;
|
||||||
|
|
||||||
|
@PostMapping("/admin")
|
||||||
|
@ApiOperation("管理员登录")
|
||||||
|
public LoginResDTO adminLogin(@RequestBody LoginReqDTO loginReqDTO) {
|
||||||
|
String token = loginService.adminLogin(loginReqDTO);
|
||||||
|
return new LoginResDTO(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/user")
|
||||||
|
@ApiOperation("普通用户登录")
|
||||||
|
public LoginResDTO userLogin(@RequestBody MemberLoginReqDTO memberLoginReqDTO) {
|
||||||
|
String token = loginService.memberLogin(memberLoginReqDTO);
|
||||||
|
return new LoginResDTO(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.jzo2o.health.controller.user;
|
||||||
|
|
||||||
|
import com.jzo2o.api.trade.enums.PayChannelEnum;
|
||||||
|
import com.jzo2o.health.model.dto.request.PlaceOrderReqDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.OrdersPayResDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.PlaceOrderResDTO;
|
||||||
|
import com.jzo2o.health.service.IOrderCreateService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@RestController("userOrdersController")
|
||||||
|
@RequestMapping("/user/orders")
|
||||||
|
@Api(tags = "用户端 - 下单支付相关接口")
|
||||||
|
public class OrdersController {
|
||||||
|
@Resource
|
||||||
|
private IOrderCreateService orderCreateService;
|
||||||
|
|
||||||
|
@ApiOperation("下单接口")
|
||||||
|
@PostMapping("/place")
|
||||||
|
public PlaceOrderResDTO place(@RequestBody PlaceOrderReqDTO placeOrderReqDTO) {
|
||||||
|
return orderCreateService.placeOrder(placeOrderReqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/pay/{id}")
|
||||||
|
@ApiOperation("订单支付")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "订单id", required = true, dataTypeClass = Long.class),
|
||||||
|
@ApiImplicitParam(name = "tradingChannel", value = "支付渠道:ALI_PAY、WECHAT_PAY", required = true, dataTypeClass = PayChannelEnum.class),
|
||||||
|
})
|
||||||
|
public OrdersPayResDTO pay(@PathVariable("id") Long id, @RequestParam("tradingChannel") PayChannelEnum tradingChannel) {
|
||||||
|
return orderCreateService.payOrder(id, tradingChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/pay/{id}/result")
|
||||||
|
@ApiOperation("查询订单支付结果")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "订单id", required = true, dataTypeClass = Long.class)
|
||||||
|
})
|
||||||
|
public OrdersPayResDTO payResult(@PathVariable("id") Long id) {
|
||||||
|
return orderCreateService.getPayResult(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.jzo2o.health.controller.user;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.dto.response.OrdersDetailResDTO;
|
||||||
|
import com.jzo2o.health.model.dto.response.OrdersResDTO;
|
||||||
|
import com.jzo2o.health.service.IOrderManagerService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@RestController("userOrdersQueryController")
|
||||||
|
@RequestMapping("/user/orders")
|
||||||
|
@Api(tags = "用户端 - 订单查询相关接口")
|
||||||
|
public class OrdersQueryController {
|
||||||
|
@Resource
|
||||||
|
private IOrderManagerService orderManagerService;
|
||||||
|
|
||||||
|
@ApiOperation("滚动分页查询")
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "ordersStatus", value = "订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消", dataTypeClass = Integer.class),
|
||||||
|
@ApiImplicitParam(name = "sortBy", value = "排序字段", dataTypeClass = Long.class)
|
||||||
|
})
|
||||||
|
public List<OrdersResDTO> pageQuery(@RequestParam(value = "ordersStatus", required = false) Integer ordersStatus,
|
||||||
|
@RequestParam(value = "sortBy", required = false) Long sortBy) {
|
||||||
|
return orderManagerService.pageQuery(ordersStatus, sortBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@ApiOperation("根据订单id查询")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "订单id", required = true, dataTypeClass = Long.class)
|
||||||
|
})
|
||||||
|
public OrdersDetailResDTO detail(@PathVariable("id") Long id) {
|
||||||
|
return orderManagerService.getOrderById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.jzo2o.health.controller.user;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.dto.request.OrdersCancelReqDTO;
|
||||||
|
import com.jzo2o.health.service.IOrderCancelService;
|
||||||
|
import com.jzo2o.health.service.IOrderRefundService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@RestController("userOrdersRefundController")
|
||||||
|
@RequestMapping("/user/orders")
|
||||||
|
@Api(tags = "用户端 - 取消订单退款相关接口")
|
||||||
|
public class OrdersRefundController {
|
||||||
|
@Resource
|
||||||
|
private IOrderCancelService orderCancelService;
|
||||||
|
@Resource
|
||||||
|
private IOrderRefundService orderRefundService;
|
||||||
|
|
||||||
|
@PutMapping("/cancel")
|
||||||
|
@ApiOperation("订单取消")
|
||||||
|
public void cancel(@RequestBody OrdersCancelReqDTO ordersCancelReqDTO) {
|
||||||
|
orderCancelService.cancelOrder(ordersCancelReqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/refund")
|
||||||
|
@ApiOperation("订单退款")
|
||||||
|
public void refund(@RequestBody OrdersCancelReqDTO ordersCancelReqDTO) {
|
||||||
|
orderRefundService.refundOrder(ordersCancelReqDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.jzo2o.health.controller.user;
|
||||||
|
|
||||||
|
import com.jzo2o.health.annotation.IgnoreToken;
|
||||||
|
import com.jzo2o.health.model.dto.response.ReservationDateResDTO;
|
||||||
|
import com.jzo2o.health.service.IReservationSettingService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约设置操作
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController("userReservationSettingController")
|
||||||
|
@RequestMapping("/user/reservation-setting")
|
||||||
|
@Api(tags = "用户端 - 预约设置相关接口")
|
||||||
|
public class ReservationSettingController {
|
||||||
|
@Resource
|
||||||
|
private IReservationSettingService reservationSettingService;
|
||||||
|
|
||||||
|
@GetMapping("/getReservationDateByMonth")
|
||||||
|
@IgnoreToken
|
||||||
|
@ApiOperation("按月查询可预约日期")
|
||||||
|
@ApiImplicitParam(name = "month", value = "月份,格式:yyyy-MM", required = true, dataTypeClass = String.class)
|
||||||
|
public ReservationDateResDTO getReservationDateByMonth(@RequestParam("month") String month) {
|
||||||
|
YearMonth yearMonth = YearMonth.parse(month);
|
||||||
|
return reservationSettingService.getReservationDateByMonth(yearMonth);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.jzo2o.health.controller.user;
|
||||||
|
|
||||||
|
import com.jzo2o.health.annotation.IgnoreToken;
|
||||||
|
import com.jzo2o.health.model.domain.Setmeal;
|
||||||
|
import com.jzo2o.health.model.dto.response.SetmealDetailResDTO;
|
||||||
|
import com.jzo2o.health.service.ISetmealService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController("userSetmealController")
|
||||||
|
@RequestMapping("/user/setmeal")
|
||||||
|
@Api(tags = "用户端 - 套餐相关接口")
|
||||||
|
public class SetmealController {
|
||||||
|
@Resource
|
||||||
|
private ISetmealService setmealService;
|
||||||
|
|
||||||
|
@GetMapping("/getSetmeal")
|
||||||
|
@IgnoreToken
|
||||||
|
@ApiOperation("获取所有套餐信息")
|
||||||
|
public List<Setmeal> getSetmeal() {
|
||||||
|
return setmealService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/findDetail/{id}")
|
||||||
|
@IgnoreToken
|
||||||
|
@ApiOperation("根据id查询套餐信息")
|
||||||
|
@ApiImplicitParam(name = "id", value = "套餐id", required = true, dataTypeClass = Integer.class)
|
||||||
|
public SetmealDetailResDTO findById(@PathVariable("id") Integer id) {
|
||||||
|
return setmealService.findDetail(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.jzo2o.health.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum OrderPayStatusEnum {
|
||||||
|
NO_PAY(0, "未支付"),
|
||||||
|
PAY_SUCCESS(1, "已支付"),
|
||||||
|
REFUNDING(2, "退款中"),
|
||||||
|
REFUND_SUCCESS(3, "退款成功"),
|
||||||
|
REFUND_FAIL(4, "退款失败");
|
||||||
|
|
||||||
|
@EnumValue
|
||||||
|
@JsonValue
|
||||||
|
private final Integer status;
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.jzo2o.health.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum OrderStatusEnum {
|
||||||
|
NO_PAY(0, "待支付"),
|
||||||
|
WAITING_CHECKUP(100, "待体检"),
|
||||||
|
COMPLETED_CHECKUP(200, "已体检"),
|
||||||
|
CLOSED(300, "已关闭"),
|
||||||
|
CANCELLED(400, "已取消");
|
||||||
|
|
||||||
|
@EnumValue
|
||||||
|
@JsonValue
|
||||||
|
private final Integer status;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据状态值获得对应枚举
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 状态对应枚举
|
||||||
|
*/
|
||||||
|
public static OrderStatusEnum codeOf(Integer status) {
|
||||||
|
for (OrderStatusEnum orderStatusEnum : values()) {
|
||||||
|
if (orderStatusEnum.status.equals(status)) {
|
||||||
|
return orderStatusEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.jzo2o.health.interceptor;
|
||||||
|
|
||||||
|
import com.jzo2o.common.expcetions.RequestUnauthorizedException;
|
||||||
|
import com.jzo2o.common.model.CurrentUserInfo;
|
||||||
|
import com.jzo2o.common.utils.JwtTool;
|
||||||
|
import com.jzo2o.common.utils.StringUtils;
|
||||||
|
import com.jzo2o.health.annotation.IgnoreToken;
|
||||||
|
import com.jzo2o.health.model.UserThreadLocal;
|
||||||
|
import com.jzo2o.health.properties.ApplicationProperties;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.method.HandlerMethod;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token检查拦截器,用于检查后台系统发送的请求
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class JwtTokenInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ApplicationProperties applicationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token header名称
|
||||||
|
*/
|
||||||
|
private static final String HEADER_TOKEN = "Authorization";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
|
log.info("拦截器拦截到请求:{}", request.getRequestURI());
|
||||||
|
|
||||||
|
// 如果不是映射到方法的请求则直接放行,例如 /doc.html
|
||||||
|
if (!(handler instanceof HandlerMethod)) {
|
||||||
|
log.info("{}无需处理,直接放行", request.getRequestURI());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||||
|
//检查当前请求的Controller方法上是否有IgnoreToken注解
|
||||||
|
boolean hasIgnoreToken = handlerMethod.hasMethodAnnotation(IgnoreToken.class);
|
||||||
|
if (hasIgnoreToken) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取前端提交的token
|
||||||
|
String token = request.getHeader(HEADER_TOKEN);
|
||||||
|
if (StringUtils.isEmpty(token)) {
|
||||||
|
throw new RequestUnauthorizedException();
|
||||||
|
}
|
||||||
|
log.info("获取到token:{}", token);
|
||||||
|
|
||||||
|
try {
|
||||||
|
log.info("开始解析token");
|
||||||
|
String tokenKey = applicationProperties.getTokenKey().get(JwtTool.getUserType(token) + "");
|
||||||
|
if (StringUtils.isEmpty(tokenKey)) {
|
||||||
|
throw new RequestUnauthorizedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
JwtTool jwtTool = new JwtTool(tokenKey);
|
||||||
|
CurrentUserInfo currentUserInfo = jwtTool.parseToken(token);
|
||||||
|
UserThreadLocal.set(currentUserInfo);
|
||||||
|
//token解析成功,放行
|
||||||
|
return true;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("token解析失败");
|
||||||
|
//401表示未授权,需要前端配合跳转回登录页面
|
||||||
|
response.setStatus(401);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||||
|
// 清理用户信息
|
||||||
|
UserThreadLocal.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.jzo2o.health.job;
|
||||||
|
|
||||||
|
|
||||||
|
import com.jzo2o.common.utils.CollUtils;
|
||||||
|
import com.jzo2o.health.model.domain.OrdersRefund;
|
||||||
|
import com.jzo2o.health.properties.OrdersJobProperties;
|
||||||
|
import com.jzo2o.health.service.IOrderRefundService;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款任务
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class OrderRefundJob {
|
||||||
|
@Resource
|
||||||
|
private IOrderRefundService orderRefundService;
|
||||||
|
@Resource
|
||||||
|
private OrdersJobProperties ordersJobProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款异步任务
|
||||||
|
*/
|
||||||
|
@XxlJob(value = "handleRefundOrders")
|
||||||
|
public void handleRefundOrders() {
|
||||||
|
List<OrdersRefund> latestRefundInfo = orderRefundService.getLatestRefundInfo(ordersJobProperties.getRefundOrderCount());
|
||||||
|
if (CollUtils.isEmpty(latestRefundInfo)) {
|
||||||
|
log.info("没有需要退款的订单");
|
||||||
|
}
|
||||||
|
|
||||||
|
latestRefundInfo.forEach(refundInfo -> orderRefundService.refundOrder(refundInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.jzo2o.health.listener;
|
||||||
|
|
||||||
|
import com.jzo2o.api.trade.TradingApi;
|
||||||
|
import com.jzo2o.api.trade.dto.response.TradingResDTO;
|
||||||
|
import com.jzo2o.api.trade.enums.TradingStateEnum;
|
||||||
|
import com.jzo2o.common.constants.UserType;
|
||||||
|
import com.jzo2o.common.expcetions.DBException;
|
||||||
|
import com.jzo2o.common.model.msg.TradeStatusMsg;
|
||||||
|
import com.jzo2o.common.utils.CollUtils;
|
||||||
|
import com.jzo2o.common.utils.JsonUtils;
|
||||||
|
import com.jzo2o.common.utils.ObjectUtils;
|
||||||
|
import com.jzo2o.health.constant.HealthMqConstants;
|
||||||
|
import com.jzo2o.health.constant.TradeConstants;
|
||||||
|
import com.jzo2o.health.enums.OrderPayStatusEnum;
|
||||||
|
import com.jzo2o.health.enums.OrderStatusEnum;
|
||||||
|
import com.jzo2o.health.model.OrderUpdateStatusDTO;
|
||||||
|
import com.jzo2o.health.model.domain.Orders;
|
||||||
|
import com.jzo2o.health.model.domain.OrdersCancelled;
|
||||||
|
import com.jzo2o.health.service.IOrderCancelService;
|
||||||
|
import com.jzo2o.health.service.IOrderCommonService;
|
||||||
|
import com.jzo2o.health.service.IOrderCreateService;
|
||||||
|
import com.jzo2o.health.service.IReservationSettingService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听MQ消息
|
||||||
|
* @author itcast
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class OrderStatusListener {
|
||||||
|
@Resource
|
||||||
|
private IOrderCommonService orderCommonService;
|
||||||
|
@Resource
|
||||||
|
private TransactionTemplate transactionTemplate;
|
||||||
|
@Resource
|
||||||
|
private IOrderCancelService orderCancelService;
|
||||||
|
@Resource
|
||||||
|
private IReservationSettingService reservationSettingService;
|
||||||
|
@Resource
|
||||||
|
private TradingApi tradingApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收支付成功信息
|
||||||
|
* @param msg 消息
|
||||||
|
*/
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
value = @Queue(name = TradeConstants.MQ_TRADE_QUEUE),
|
||||||
|
exchange = @Exchange(name = HealthMqConstants.Exchanges.TRADE, type = ExchangeTypes.TOPIC),
|
||||||
|
key = HealthMqConstants.RoutingKeys.TRADE_UPDATE_STATUS))
|
||||||
|
public void listenTradeUpdatePayStatusMsg(String msg) {
|
||||||
|
log.info("接收到支付结果状态的消息 ({})-> {}", HealthMqConstants.Queues.ORDERS_TRADE_UPDATE_STATUS, msg);
|
||||||
|
|
||||||
|
List<TradeStatusMsg> msgList = JsonUtils.parseArray(msg).toList(TradeStatusMsg.class);
|
||||||
|
if (CollUtils.isEmpty(msgList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理当前微服务并且支付成功的订单
|
||||||
|
List<TradeStatusMsg> tradeStatusMsgList = msgList.stream()
|
||||||
|
.filter(statusMsg -> IOrderCreateService.PRODUCT_APP_ID.equals(statusMsg.getProductAppId())
|
||||||
|
&& TradingStateEnum.YJS.getCode().equals(statusMsg.getStatusCode()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
transactionTemplate.executeWithoutResult(status -> {
|
||||||
|
for (TradeStatusMsg tradeStatusMsg : tradeStatusMsgList) {
|
||||||
|
if (!orderCommonService.updateStatus(OrderUpdateStatusDTO.builder()
|
||||||
|
.id(tradeStatusMsg.getProductOrderNo())
|
||||||
|
.originStatus(OrderStatusEnum.NO_PAY)
|
||||||
|
.targetStatus(OrderStatusEnum.WAITING_CHECKUP)
|
||||||
|
.payStatus(OrderPayStatusEnum.PAY_SUCCESS)
|
||||||
|
.tradingOrderNo(tradeStatusMsg.getTradingOrderNo())
|
||||||
|
.transactionId(tradeStatusMsg.getTransactionId())
|
||||||
|
.tradingChannel(tradeStatusMsg.getTradingChannel())
|
||||||
|
.payTime(LocalDateTime.now()).build())) {
|
||||||
|
throw new DBException("更新订单状态失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
value = @Queue(name = HealthMqConstants.Queues.DELAY_OUT),
|
||||||
|
exchange = @Exchange(name = HealthMqConstants.Exchanges.HEALTH_ORDER, type = ExchangeTypes.TOPIC),
|
||||||
|
key = HealthMqConstants.RoutingKeys.ORDER_OVERTIME_OUT))
|
||||||
|
public void handleOverTimeOrder(String msg) {
|
||||||
|
Long orderId = Long.parseLong(msg);
|
||||||
|
if (ObjectUtils.isEmpty(orderId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Orders order = orderCommonService.getById(orderId);
|
||||||
|
if (ObjectUtils.isEmpty(order)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (order.getOrderStatus() == OrderStatusEnum.NO_PAY && order.getPayStatus() == OrderPayStatusEnum.NO_PAY) {
|
||||||
|
Long tradingOrderNo = order.getTradingOrderNo();
|
||||||
|
if (ObjectUtils.isNotEmpty(tradingOrderNo)) {
|
||||||
|
// 再次请求防止已支付
|
||||||
|
TradingResDTO tradingResDTO = tradingApi.findTradResultByTradingOrderNo(tradingOrderNo);
|
||||||
|
if (ObjectUtils.isNotEmpty(tradingResDTO) && tradingResDTO.getTradingState() == TradingStateEnum.YJS) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 事务更新数据表(取消订单)
|
||||||
|
transactionTemplate.executeWithoutResult(status -> {
|
||||||
|
orderCancelService.cancelOrder(OrdersCancelled.builder()
|
||||||
|
.id(orderId)
|
||||||
|
.cancelTime(LocalDateTime.now())
|
||||||
|
.cancelReason("订单超时自动取消")
|
||||||
|
.cancellerType(UserType.SYSTEM)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
// 已预约人数 - 1
|
||||||
|
reservationSettingService.plusReservationCount(order.getReservationDate(), -1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.CheckgroupCheckitem;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
public interface CheckgroupCheckitemMapper extends BaseMapper<CheckgroupCheckitem> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.Checkgroup;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
public interface CheckgroupMapper extends BaseMapper<Checkgroup> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.Checkitem;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
public interface CheckitemMapper extends BaseMapper<Checkitem> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.Member;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 普通用户 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
public interface MemberMapper extends BaseMapper<Member> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.OrdersCancelled;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单取消表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-07
|
||||||
|
*/
|
||||||
|
public interface OrdersCancelledMapper extends BaseMapper<OrdersCancelled> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jzo2o.health.model.domain.Orders;
|
||||||
|
import com.jzo2o.health.model.dto.OrderCountDTO;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
public interface OrdersMapper extends BaseMapper<Orders> {
|
||||||
|
@Select("SELECT order_status AS orderStatus,COUNT(id) AS count FROM orders GROUP BY order_status")
|
||||||
|
List<OrderCountDTO> countStatus();
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.OrdersRefund;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单退款表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-07
|
||||||
|
*/
|
||||||
|
public interface OrdersRefundMapper extends BaseMapper<OrdersRefund> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jzo2o.health.model.domain.ReservationSetting;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-01
|
||||||
|
*/
|
||||||
|
public interface ReservationSettingMapper extends BaseMapper<ReservationSetting> {
|
||||||
|
@Update("UPDATE reservation_setting SET reservations = reservations + #{count} WHERE order_date = #{time} AND reservations < number")
|
||||||
|
Integer plusReservationCount(@Param("time") LocalDate time, @Param("count") Integer count);
|
||||||
|
|
||||||
|
@Select("SELECT order_date FROM reservation_setting WHERE #{start} <= order_date AND order_date <= #{end}")
|
||||||
|
List<String> getReservationDate(@Param("start") LocalDate start, @Param("end") LocalDate end);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.jzo2o.health.model.domain.SetmealCheckgroup;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
public interface SetmealCheckgroupMapper extends BaseMapper<SetmealCheckgroup> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jzo2o.health.model.domain.Setmeal;
|
||||||
|
import com.jzo2o.health.model.dto.response.SetmealDetailResDTO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
public interface SetmealMapper extends BaseMapper<Setmeal> {
|
||||||
|
/**
|
||||||
|
* 查询套餐详情(包含关联检查组、检查项)
|
||||||
|
*
|
||||||
|
* @param id 套餐id
|
||||||
|
* @return 套餐详情
|
||||||
|
*/
|
||||||
|
SetmealDetailResDTO findDetail(@Param("id") Integer id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jzo2o.health.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jzo2o.health.model.domain.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 管理员 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.jzo2o.health.model;
|
||||||
|
|
||||||
|
import com.jzo2o.health.enums.OrderPayStatusEnum;
|
||||||
|
import com.jzo2o.health.enums.OrderStatusEnum;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用订单更新DTO
|
||||||
|
* @author JIAN
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class OrderUpdateStatusDTO {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原订单状态
|
||||||
|
*/
|
||||||
|
private OrderStatusEnum originStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标订单状态
|
||||||
|
*/
|
||||||
|
private OrderStatusEnum targetStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态
|
||||||
|
*/
|
||||||
|
private OrderPayStatusEnum payStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务交易单号
|
||||||
|
*/
|
||||||
|
private Long tradingOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的交易号
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务退款单号
|
||||||
|
*/
|
||||||
|
private Long refundNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的退款单号
|
||||||
|
*/
|
||||||
|
private String refundId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付渠道
|
||||||
|
*/
|
||||||
|
private String tradingChannel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.jzo2o.health.model;
|
||||||
|
|
||||||
|
import com.jzo2o.common.model.CurrentUserInfo;
|
||||||
|
|
||||||
|
public class UserThreadLocal {
|
||||||
|
|
||||||
|
private static final ThreadLocal<CurrentUserInfo> THREAD_LOCAL_USER = new ThreadLocal<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户id
|
||||||
|
*
|
||||||
|
* @return 用户id
|
||||||
|
*/
|
||||||
|
public static Long currentUserId() {
|
||||||
|
return THREAD_LOCAL_USER.get().getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CurrentUserInfo currentUser() {
|
||||||
|
return THREAD_LOCAL_USER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置当前用户id
|
||||||
|
*
|
||||||
|
* @param currentUserInfo 当前用户信息
|
||||||
|
*/
|
||||||
|
public static void set(CurrentUserInfo currentUserInfo) {
|
||||||
|
THREAD_LOCAL_USER.set(currentUserInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理当前线程中的用户信息
|
||||||
|
*/
|
||||||
|
public static void clear() {
|
||||||
|
THREAD_LOCAL_USER.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("checkgroup")
|
||||||
|
public class Checkgroup implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组助记码
|
||||||
|
*/
|
||||||
|
private String helpCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组性别
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组说明
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组注意事项
|
||||||
|
*/
|
||||||
|
private String attention;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("checkgroup_checkitem")
|
||||||
|
public class CheckgroupCheckitem implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组id
|
||||||
|
*/
|
||||||
|
private Integer checkgroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项id
|
||||||
|
*/
|
||||||
|
private Integer checkitemId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("checkitem")
|
||||||
|
public class Checkitem implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项性别,0:不限,1:男,2:女
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项适用年龄
|
||||||
|
*/
|
||||||
|
private String age;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项价格
|
||||||
|
*/
|
||||||
|
private Float price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查检项类型,分为检查和检验两种
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项注意事项
|
||||||
|
*/
|
||||||
|
private String attention;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项说明
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 普通用户
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("member")
|
||||||
|
public class Member implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已删除,0:未删除,1:已删除
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.jzo2o.health.enums.OrderPayStatusEnum;
|
||||||
|
import com.jzo2o.health.enums.OrderStatusEnum;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("orders")
|
||||||
|
public class Orders implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.NONE)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消
|
||||||
|
*/
|
||||||
|
private OrderStatusEnum orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态,0:未支付,1:已支付,2:退款中,3:退款成功,4:退款失败
|
||||||
|
*/
|
||||||
|
private OrderPayStatusEnum payStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐id
|
||||||
|
*/
|
||||||
|
private Integer setmealId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
private String setmealName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐价格
|
||||||
|
*/
|
||||||
|
private BigDecimal setmealPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用性别,0:不限,1:男,2:女
|
||||||
|
*/
|
||||||
|
private Integer setmealSex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用年龄
|
||||||
|
*/
|
||||||
|
private String setmealAge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐图片
|
||||||
|
*/
|
||||||
|
private String setmealImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐说明
|
||||||
|
*/
|
||||||
|
private String setmealRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约日期,格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate reservationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人姓名
|
||||||
|
*/
|
||||||
|
private String checkupPersonName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人性别,0:不限,1:男,2女
|
||||||
|
*/
|
||||||
|
private Integer checkupPersonSex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人电话
|
||||||
|
*/
|
||||||
|
private String checkupPersonPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人身份证号
|
||||||
|
*/
|
||||||
|
private String checkupPersonIdcard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long memberId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户电话
|
||||||
|
*/
|
||||||
|
private String memberPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付渠道
|
||||||
|
*/
|
||||||
|
private String tradingChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务交易单号
|
||||||
|
*/
|
||||||
|
private Long tradingOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的交易号
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务退款单号
|
||||||
|
*/
|
||||||
|
private Long refundNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的退款单号
|
||||||
|
*/
|
||||||
|
private String refundId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序字段(取创建时间的时间戳)
|
||||||
|
*/
|
||||||
|
private Long sortBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单取消表
|
||||||
|
* </p>
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("orders_cancelled")
|
||||||
|
public class OrdersCancelled implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.NONE)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消人
|
||||||
|
*/
|
||||||
|
private Long cancellerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消人名称
|
||||||
|
*/
|
||||||
|
private String cancellerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消人类型,1:普通用户,4管理员
|
||||||
|
*/
|
||||||
|
private Integer cancellerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消原因
|
||||||
|
*/
|
||||||
|
private String cancelReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime cancelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单退款表
|
||||||
|
* </p>
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("orders_refund")
|
||||||
|
public class OrdersRefund implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.NONE)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务交易单号
|
||||||
|
*/
|
||||||
|
private Long tradingOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal realPayAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("reservation_setting")
|
||||||
|
public class ReservationSetting implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate orderDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可预约人数
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已预约人数
|
||||||
|
*/
|
||||||
|
private Integer reservations;
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("setmeal")
|
||||||
|
public class Setmeal implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐助记码
|
||||||
|
*/
|
||||||
|
private String helpCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐助记码
|
||||||
|
*/
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用年龄
|
||||||
|
*/
|
||||||
|
private String age;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐说明
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐注意事项
|
||||||
|
*/
|
||||||
|
private String attention;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐图片
|
||||||
|
*/
|
||||||
|
private String img;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("setmeal_checkgroup")
|
||||||
|
public class SetmealCheckgroup implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐id
|
||||||
|
*/
|
||||||
|
private Integer setmealId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组id
|
||||||
|
*/
|
||||||
|
private Integer checkgroupId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.jzo2o.health.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 管理员
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-10-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("user")
|
||||||
|
public class User implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账户状态:0-禁用 1-正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者id
|
||||||
|
*/
|
||||||
|
private Long createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除,默认0
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.jzo2o.health.model.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单数量响应
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/9 16:54
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class OrderCountDTO {
|
||||||
|
private Integer orderStatus;
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import com.jzo2o.common.model.dto.PageQueryDTO;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组分页查询类
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/7/4 12:43
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("检查组分页查询类")
|
||||||
|
public class CommonPageQueryReqDTO extends PageQueryDTO {
|
||||||
|
@ApiModelProperty("关键词,查询编码或者名称")
|
||||||
|
private String keyword;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ApiModel("管理员登录模型")
|
||||||
|
@Data
|
||||||
|
public class LoginReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员账号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("管理员账号")
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("登录密码")
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通用户登录请求模型
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/2 15:48
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("普通用户登录模型")
|
||||||
|
public class MemberLoginReqDTO {
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "手机号", required = true)
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "验证码", required = true)
|
||||||
|
private String verifyCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单取消或退款模型
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/10 10:04
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单取消或退款请求模型")
|
||||||
|
public class OrdersCancelReqDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单id", required = true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "取消或退款原因", required = true)
|
||||||
|
private String cancelReason;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import com.jzo2o.common.model.dto.PageQueryDTO;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单分页查询请求模型
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/3 19:25
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单分页查询请求模型")
|
||||||
|
public class OrdersPageQueryReqDTO extends PageQueryDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单id列表", hidden = true)
|
||||||
|
private List<Long> ids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消")
|
||||||
|
private Integer orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户电话")
|
||||||
|
private String memberPhone;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import com.jzo2o.api.trade.enums.PayChannelEnum;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单支付请求体
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/9/4 10:00
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单支付请求体")
|
||||||
|
public class OrdersPayReqDTO {
|
||||||
|
@ApiModelProperty(value = "支付渠道", required = true)
|
||||||
|
@NotNull(message = "支付渠道不能为空")
|
||||||
|
private PayChannelEnum tradingChannel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("下单请求信息")
|
||||||
|
public class PlaceOrderReqDTO {
|
||||||
|
@ApiModelProperty(value = "套餐id", required = true)
|
||||||
|
private Integer setmealId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "预约日期", required = true)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate reservationDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "体检人姓名", required = true)
|
||||||
|
private String checkupPersonName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "体检人性别,0:不限,1:男,2女", required = true)
|
||||||
|
private Integer checkupPersonSex;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "体检人电话", required = true)
|
||||||
|
private String checkupPersonPhone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "体检人身份证号", required = true)
|
||||||
|
private String checkupPersonIdcard;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.jzo2o.health.model.dto.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@ApiModel("预约设置更新请求模型")
|
||||||
|
public class ReservationSettingUpsertReqDTO {
|
||||||
|
/**
|
||||||
|
* 预约日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "预约日期,格式:yyyy-MM-dd", required = true)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate orderDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可预约人数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "可预约人数", required = true)
|
||||||
|
private Integer number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理端订单详情
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/6 17:31
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class AdminOrdersDetailResDTO {
|
||||||
|
@ApiModelProperty("订单信息")
|
||||||
|
private OrderInfo orderInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("支付信息")
|
||||||
|
private PayInfo payInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("退款信息")
|
||||||
|
private RefundInfo refundInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("订单取消理由")
|
||||||
|
private CancelInfo cancelInfo;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息模型")
|
||||||
|
public static class OrderInfo {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消")
|
||||||
|
private Integer orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐id")
|
||||||
|
private Integer setmealId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐名称")
|
||||||
|
private String setmealName;
|
||||||
|
/**
|
||||||
|
* 套餐价格
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐价格")
|
||||||
|
private BigDecimal setmealPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约日期,格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("预约日期,格式:yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate reservationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人姓名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人姓名")
|
||||||
|
private String checkupPersonName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人性别,0:不限,1:男,2女
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人性别,0:不限,1:男,2女")
|
||||||
|
private Integer checkupPersonSex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人电话")
|
||||||
|
private String checkupPersonPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人身份证号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人身份证号")
|
||||||
|
private String checkupPersonIdcard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private Long memberId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户电话")
|
||||||
|
private String memberPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("支付记录模型")
|
||||||
|
public static class PayInfo {
|
||||||
|
/**
|
||||||
|
* 支付状态,0:未支付,1:已支付
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付状态,0:未支付,1:已支付")
|
||||||
|
private Integer payStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付渠道,ALI_PAY:支付宝,WECHAT_PAY:微信
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付渠道,ALI_PAY:支付宝,WECHAT_PAY:微信")
|
||||||
|
private String tradingChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三方流水,微信支付订单号或支付宝订单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("三方流水,微信支付订单号或支付宝订单号")
|
||||||
|
private String thirdOrderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@ApiModel("退款信息模型")
|
||||||
|
public static class RefundInfo {
|
||||||
|
/**
|
||||||
|
* 退款状态,2:退款中,3:退款成功,4:退款失败
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("退款状态,2:退款中,3:退款成功,4:退款失败")
|
||||||
|
private Integer refundStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款时间;和取消时间保持一致
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("退款时间;和取消时间保持一致")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime cancelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款理由和取消理由一致
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("退款理由和取消理由一致")
|
||||||
|
private String cancelReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付渠道,ALI_PAY:支付宝,WECHAT_PAY:微信
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付渠道,ALI_PAY:支付宝,WECHAT_PAY:微信")
|
||||||
|
private String tradingChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的退款单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("第三方支付的退款单号")
|
||||||
|
private String refundId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@ApiModel("订单取消模型")
|
||||||
|
public static class CancelInfo {
|
||||||
|
/**
|
||||||
|
* 取消时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("取消时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime cancelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消理由
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("取消理由")
|
||||||
|
private String cancelReason;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/3 18:53
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("检查组详情")
|
||||||
|
public class CheckGroupDetailResDTO {
|
||||||
|
/**
|
||||||
|
* 检查组id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("检查组id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查组名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("检查组名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项列表
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("检查项列表")
|
||||||
|
private List<CheckItemResDTO> checkItemList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("检查项响应模型")
|
||||||
|
public class CheckItemResDTO {
|
||||||
|
/**
|
||||||
|
* 检查项id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("检查项id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("检查项名称")
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("登录结果")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LoginResDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("运营端访问token")
|
||||||
|
private String token;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单数量
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/8 16:02
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel("订单数量响应模型")
|
||||||
|
public class OrdersCountResDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待支付数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("待支付数量")
|
||||||
|
private Integer noPayCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待体检数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("待体检数量")
|
||||||
|
private Integer waitingCheckupCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已体检数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("已体检数量")
|
||||||
|
private Integer completedCheckupCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已关闭数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("已关闭数量")
|
||||||
|
private Integer closedCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已取消数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("已取消数量")
|
||||||
|
private Integer cancelledCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("全部数量")
|
||||||
|
private Integer totalCount = 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.jzo2o.health.enums.OrderPayStatusEnum;
|
||||||
|
import com.jzo2o.health.enums.OrderStatusEnum;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 订单表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @since 2023-11-02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单详情响应体")
|
||||||
|
public class OrdersDetailResDTO {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消")
|
||||||
|
private OrderStatusEnum orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态,0:未支付,1:已支付,2:退款中,3:退款成功,4:退款失败
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付状态,0:未支付,1:已支付,2:退款中,3:退款成功,4:退款失败")
|
||||||
|
private OrderPayStatusEnum payStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐id")
|
||||||
|
private Integer setmealId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐名称")
|
||||||
|
private String setmealName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐价格
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐价格")
|
||||||
|
private BigDecimal setmealPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用性别,0:不限,1:男,2:女
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐适用性别,0:不限,1:男,2:女")
|
||||||
|
private Integer setmealSex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用年龄
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐适用年龄")
|
||||||
|
private String setmealAge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐图片
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐图片")
|
||||||
|
private String setmealImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐说明
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐说明")
|
||||||
|
private String setmealRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约日期,格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("预约日期,格式:yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate reservationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人姓名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人姓名")
|
||||||
|
private String checkupPersonName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人性别,0:不限,1:男,2女
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人性别,0:不限,1:男,2女")
|
||||||
|
private Integer checkupPersonSex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人电话")
|
||||||
|
private String checkupPersonPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人身份证号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人身份证号")
|
||||||
|
private String checkupPersonIdcard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private Long memberId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户电话")
|
||||||
|
private String memberPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付渠道
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付渠道")
|
||||||
|
private String tradingChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务交易单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付服务交易单号")
|
||||||
|
private Long tradingOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的交易号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("第三方支付的交易号")
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付服务退款单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付服务退款单号")
|
||||||
|
private Long refundNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方支付的退款单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("第三方支付的退款单号")
|
||||||
|
private String refundId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序字段(取创建时间的时间戳)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序字段(取创建时间的时间戳)")
|
||||||
|
private Long sortBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消或退款时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("取消或退款时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime cancelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消或退款原因
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("取消或退款原因")
|
||||||
|
private String cancelReason;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单支付响应体
|
||||||
|
*
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/9/4 10:00
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel("订单支付响应体")
|
||||||
|
public class OrdersPayResDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "二维码base64数据")
|
||||||
|
private String qrCode;
|
||||||
|
@ApiModelProperty(value = "业务系统订单号")
|
||||||
|
private Long productOrderNo;
|
||||||
|
@ApiModelProperty(value = "交易系统订单号【对于三方来说:商户订单】")
|
||||||
|
private Long tradingOrderNo;
|
||||||
|
@ApiModelProperty(value = "支付渠道【支付宝、微信、现金、免单挂账】")
|
||||||
|
private String tradingChannel;
|
||||||
|
@ApiModelProperty(value = "支付状态,0:待支付,1:支付成功")
|
||||||
|
private Integer payStatus;
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.jzo2o.health.enums.OrderPayStatusEnum;
|
||||||
|
import com.jzo2o.health.enums.OrderStatusEnum;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单响应
|
||||||
|
* @author itcast
|
||||||
|
* @create 2023/11/3 19:17
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单响应模型")
|
||||||
|
public class OrdersResDTO {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单状态,0:未支付,100:待体检,200:已体检,300:已关闭,400:已取消")
|
||||||
|
private OrderStatusEnum orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态,0:未支付,1:已支付,2:退款中,3:退款成功,4:退款失败
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("支付状态,0:未支付,1:已支付,2:退款中,3:退款成功,4:退款失败")
|
||||||
|
private OrderPayStatusEnum payStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐id")
|
||||||
|
private Integer setmealId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐名称")
|
||||||
|
private String setmealName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐价格
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐价格")
|
||||||
|
private BigDecimal setmealPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用年龄
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐适用年龄")
|
||||||
|
private String setmealAge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐适用性别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐适用性别")
|
||||||
|
private Integer setmealSex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐图片
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐图片")
|
||||||
|
private String setmealImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐说明
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("套餐说明")
|
||||||
|
private String setmealRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("预约日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate reservationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人")
|
||||||
|
private String checkupPersonName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体检人身份证号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("体检人身份证号")
|
||||||
|
private String checkupPersonIdcard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户电话")
|
||||||
|
private String memberPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序字段(取创建时间的时间戳)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序字段(取创建时间的时间戳)")
|
||||||
|
private Long sortBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jzo2o.health.model.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itcast
|
||||||
|
*/
|
||||||
|
@ApiModel("下单响应信息")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PlaceOrderResDTO {
|
||||||
|
@ApiModelProperty("订单id")
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user