Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
external
on-site-service
Commits
6aa6990a
Commit
6aa6990a
authored
Jul 11, 2022
by
kretee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 订单接口抽象方法
parent
494a8cee
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
404 additions
and
95 deletions
+404
-95
BizCodeEnum.java
...in/java/com/onsiteservice/constant/enums/BizCodeEnum.java
+11
-15
ServiceOrderStatusEnum.java
.../onsiteservice/constant/enums/ServiceOrderStatusEnum.java
+3
-3
ServiceOrderLogMapper.java
...siteservice/dao/mapper/service/ServiceOrderLogMapper.java
+7
-0
ServiceOrderLogMapper.xml
...c/main/resources/mapper/service/ServiceOrderLogMapper.xml
+17
-0
ServiceOrderLog.java
...ava/com/onsiteservice/entity/service/ServiceOrderLog.java
+74
-0
ServiceAreaController.java
...ervice/miniapp/controller/area/ServiceAreaController.java
+2
-2
ServiceOrderLogController.java
...ice/miniapp/controller/log/ServiceOrderLogController.java
+62
-0
ServiceOrderController.java
...vice/miniapp/controller/order/ServiceOrderController.java
+9
-7
DispatchServiceOrderDTO.java
...miniapp/controller/order/dto/DispatchServiceOrderDTO.java
+31
-0
PayServiceOrderDTO.java
...vice/miniapp/controller/order/dto/PayServiceOrderDTO.java
+26
-0
ReserveServiceOrderDTO.java
.../miniapp/controller/order/dto/ReserveServiceOrderDTO.java
+1
-2
SendServiceOrderDTO.java
...ice/miniapp/controller/order/dto/SendServiceOrderDTO.java
+5
-0
ValuationServiceOrderDTO.java
...iniapp/controller/order/dto/ValuationServiceOrderDTO.java
+0
-5
ServiceOrderLogBizMapper.java
...vice/miniapp/mapper/service/ServiceOrderLogBizMapper.java
+12
-0
ServiceAreaService.java
...nsiteservice/miniapp/service/area/ServiceAreaService.java
+1
-1
ServiceOrderLogService.java
...teservice/miniapp/service/log/ServiceOrderLogService.java
+48
-0
ServiceOrderService.java
...iteservice/miniapp/service/order/ServiceOrderService.java
+89
-60
ServiceOrderLogBizMapper.xml
...ain/resources/mapper/service/ServiceOrderLogBizMapper.xml
+6
-0
No files found.
constant/src/main/java/com/onsiteservice/constant/enums/BizCodeEnum.java
View file @
6aa6990a
...
...
@@ -11,50 +11,46 @@ import lombok.Getter;
*/
public
enum
BizCodeEnum
{
/**
* 订单分组
*/
SERVICE_ORDER_NOT_EXIST
(
"订单不存在"
),
SERVICE_ORDER_NOT_VALUATION
(
"订单未估价,不能发送给客户"
),
SERVICE_ORDER_CANNOT_VALUATION
(
"订单未提交,不能估价"
),
SERVICE_ORDER_CANNOT_SEND
(
"订单未估价,不能发送给客户"
),
SERVICE_ORDER_CANNOT_PAY
(
"订单未受理,暂不能支付"
),
SERVICE_ORDER_CANNOT_CANCEL
(
"订单不能取消"
),
SERVICE_ORDER_CANNOT_REFUND
(
"订单不能申请退款"
),
SERVICE_ORDER_CANNOT_DISPATCH
(
"订单未支付,不能派单"
),
SERVICE_ORDER_CANNOT_FINISH
(
"订单未派单,不能完成本次服务"
),
/**
* 权限相关
*/
NO_AUTH_VALUATION_ORDER
(
"您不能指派估价员"
),
NO_AUTH_SEND_ORDER
(
"您不能发送订单"
),
NO_AUTH_DISPATCH_ORDER
(
"您不能派单"
),
/**
* 区域分组
*/
SERVICE_AREA_NOT_EXIST
(
"区域不存在"
),
/**
* 服务地址模块
*/
SERVICE_ADDRESS_NOT_EXIST
(
"服务地址不存在"
),
/**
* 服务子类
*/
SERVICE_SUBCLASS_NOT_EXIST
(
"服务项目不存在"
),
/**
* 权限相关
*/
NO_AUTH_SEND_ORDER_TO_USER
(
"您不能发送订单"
),
NO_AUTH_DISPATCH_ORDER_TO_USER
(
"您不能派单"
);
SERVICE_SUBCLASS_NOT_EXIST
(
"服务项目不存在"
);
@Getter
private
String
msg
;
private
BizCodeEnum
(
String
msg
){
this
.
msg
=
msg
;
}
}
constant/src/main/java/com/onsiteservice/constant/enums/ServiceOrderStatusEnum.java
View file @
6aa6990a
...
...
@@ -15,15 +15,15 @@ public enum ServiceOrderStatusEnum {
/**
* 已提交
*/
SUBMIT
(
1
,
"
已提交
"
),
SUBMIT
(
1
,
"
用户已下单
"
),
/**
* 已受理:估价+发送客户
*/
VALUATION
(
2
,
"已
估价
"
),
VALUATION
(
2
,
"已
指派估价员
"
),
/**
*
*
已发送
*/
SEND
(
3
,
"已发送"
),
...
...
dao/src/main/java/com/onsiteservice/dao/mapper/service/ServiceOrderLogMapper.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
dao
.
mapper
.
service
;
import
com.onsiteservice.dao.common.Mapper
;
import
com.onsiteservice.entity.service.ServiceOrderLog
;
public
interface
ServiceOrderLogMapper
extends
Mapper
<
ServiceOrderLog
>
{
}
\ No newline at end of file
dao/src/main/resources/mapper/service/ServiceOrderLogMapper.xml
0 → 100644
View file @
6aa6990a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.onsiteservice.dao.mapper.service.ServiceOrderLogMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.service.ServiceOrderLog"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"process_id"
jdbcType=
"INTEGER"
property=
"processId"
/>
<result
column=
"host_id"
jdbcType=
"INTEGER"
property=
"hostId"
/>
<result
column=
"description"
jdbcType=
"VARCHAR"
property=
"description"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
</resultMap>
</mapper>
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/service/ServiceOrderLog.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
entity
.
service
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
@Getter
@Setter
@ToString
@ApiModel
(
"订单流程日志表"
)
@Table
(
name
=
"service_order_log"
)
public
class
ServiceOrderLog
implements
Serializable
{
/**
* 主键
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
"主键"
)
private
Long
id
;
/**
* 订单id
*/
@Column
(
name
=
"order_id"
)
@ApiModelProperty
(
"订单id"
)
private
Long
orderId
;
/**
* 流程id
*/
@Column
(
name
=
"process_id"
)
@ApiModelProperty
(
"流程id"
)
private
Integer
processId
;
/**
* 维修工id或估价员id
*/
@Column
(
name
=
"host_id"
)
@ApiModelProperty
(
"维修工id或估价员id"
)
private
Integer
hostId
;
/**
* 步骤说明
*/
@ApiModelProperty
(
"步骤说明"
)
private
String
description
;
/**
* 备注
*/
@ApiModelProperty
(
"备注"
)
private
String
remark
;
/**
* 创建时间
*/
@Column
(
name
=
"create_time"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 创建人
*/
@Column
(
name
=
"create_by"
)
@ApiModelProperty
(
"创建人"
)
private
String
createBy
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/
service
/ServiceAreaController.java
→
mini-app/src/main/java/com/onsiteservice/miniapp/controller/
area
/ServiceAreaController.java
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
controller
.
service
;
package
com
.
onsiteservice
.
miniapp
.
controller
.
area
;
import
com.onsiteservice.entity.area.ServiceArea
;
import
com.onsiteservice.miniapp.service.
service
.ServiceAreaService
;
import
com.onsiteservice.miniapp.service.
area
.ServiceAreaService
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/log/ServiceOrderLogController.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
controller
.
log
;
import
com.onsiteservice.entity.service.ServiceOrderLog
;
import
com.onsiteservice.miniapp.service.log.ServiceOrderLogService
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.NonNull
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.Positive
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
success
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
fail
;
/**
* @author 潘维吉
* @date 2022-07-11 11:37
* @description ServiceOrderLogController控制类
*/
@ApiIgnore
@Api
(
tags
=
"ServiceOrderLogController"
)
@RestController
@RequestMapping
(
"/service/order/log"
)
@Validated
public
class
ServiceOrderLogController
{
@Resource
private
ServiceOrderLogService
serviceOrderLogService
;
@ApiOperation
(
value
=
"分页查询列表"
,
notes
=
"作者: 潘维吉"
)
@PostMapping
(
"/page"
)
public
Result
<
PageInfoVO
>
getPage
(
@RequestBody
@NonNull
@Validated
PageParams
param
)
{
return
success
(
serviceOrderLogService
.
getPage
(
param
),
"获取分页列表"
);
}
@ApiOperation
(
value
=
"根据id查询"
,
notes
=
"作者: 潘维吉"
)
@GetMapping
(
"/{id}"
)
public
Result
<
ServiceOrderLog
>
getDetails
(
@PathVariable
@Positive
Long
id
)
{
return
success
(
serviceOrderLogService
.
selectByPrimaryKey
(
id
),
"根据id获取详情"
);
}
@ApiOperation
(
value
=
"新增或修改"
,
notes
=
"作者: 潘维吉"
)
@PostMapping
(
"/save-or-update"
)
public
Result
saveOrUpdate
(
@RequestBody
@NonNull
@Validated
ServiceOrderLog
serviceOrderLog
)
{
return
success
(
serviceOrderLogService
.
saveOrUpdate
(
serviceOrderLog
),
serviceOrderLog
.
getId
()
==
null
?
"新增成功"
:
"修改成功"
);
}
@ApiOperation
(
value
=
"根据id删除"
,
notes
=
"作者: 潘维吉"
)
@DeleteMapping
(
"/{id}"
)
public
Result
deleteById
(
@PathVariable
@Positive
Long
id
)
{
return
success
(
serviceOrderLogService
.
deleteByPrimaryKey
(
id
),
"删除成功"
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/ServiceOrderController.java
View file @
6aa6990a
...
...
@@ -3,7 +3,6 @@ package com.onsiteservice.miniapp.controller.order;
import
com.onsiteservice.common.annotation.user.CurrentUserId
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.miniapp.controller.order.dto.*
;
import
com.onsiteservice.miniapp.controller.order.vo.ServiceOrderVO
;
import
com.onsiteservice.miniapp.service.order.ServiceOrderService
;
...
...
@@ -13,13 +12,10 @@ import io.swagger.annotations.ApiParam;
import
lombok.NonNull
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.Positive
;
import
java.util.List
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
fail
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
success
;
...
...
@@ -55,8 +51,8 @@ public class ServiceOrderController {
@ApiOperation
(
value
=
"订单预约"
)
@PostMapping
(
"reserve"
)
public
Result
save
(
@RequestBody
@NonNull
@Validated
Sa
veServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
sa
ve
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"已预约"
);
public
Result
reserve
(
@RequestBody
@NonNull
@Validated
Reser
veServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
reser
ve
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"已预约"
);
}
@ApiOperation
(
value
=
"订单估价"
)
...
...
@@ -74,9 +70,15 @@ public class ServiceOrderController {
return
serviceOrderService
.
sendOrder
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"发送失败"
);
}
@ApiOperation
(
value
=
"支付订单"
)
@PostMapping
(
"pay"
)
public
Result
pay
(
@RequestBody
@NonNull
@Validated
PayServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
pay
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"支付失败"
);
}
@ApiOperation
(
value
=
"派单"
)
@PostMapping
(
"dispatch"
)
public
Result
dispatch
(
@RequestBody
@NonNull
@Validated
Send
ServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
public
Result
dispatch
(
@RequestBody
@NonNull
@Validated
Dispatch
ServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
dispatch
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"派单失败"
);
}
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/DispatchServiceOrderDTO.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 15:20
*/
@Data
@ApiModel
(
"发送订单请求模型"
)
public
class
DispatchServiceOrderDTO
{
@ApiModelProperty
(
value
=
"订单id"
,
required
=
true
)
@NotNull
(
message
=
"请选择订单"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"订单价格,维修价格不能低于1元"
,
required
=
true
)
@Min
(
value
=
1
,
message
=
"维修价格不能低于1元"
)
@NotNull
(
message
=
"请输入维修价格"
)
private
BigDecimal
price
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/PayServiceOrderDTO.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 15:20
*/
@Data
@ApiModel
(
"支付订单请求模型"
)
public
class
PayServiceOrderDTO
{
@ApiModelProperty
(
value
=
"订单id"
,
required
=
true
)
@NotNull
(
message
=
"请选择订单"
)
private
Long
id
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/
Sa
veServiceOrderDTO.java
→
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/
Reser
veServiceOrderDTO.java
View file @
6aa6990a
...
...
@@ -5,13 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
@Data
@ApiModel
(
"订单预约请求模型"
)
public
class
Sa
veServiceOrderDTO
{
public
class
Reser
veServiceOrderDTO
{
@ApiModelProperty
(
value
=
"服务子类id"
,
required
=
true
)
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/SendServiceOrderDTO.java
View file @
6aa6990a
...
...
@@ -23,4 +23,9 @@ public class SendServiceOrderDTO {
@NotNull
(
message
=
"请选择订单"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"订单价格,维修价格不能低于1元"
,
required
=
true
)
@Min
(
value
=
1
,
message
=
"维修价格不能低于1元"
)
@NotNull
(
message
=
"请输入维修价格"
)
private
BigDecimal
price
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/ValuationServiceOrderDTO.java
View file @
6aa6990a
...
...
@@ -25,9 +25,4 @@ public class ValuationServiceOrderDTO {
@NotNull
(
message
=
"请输入订单ID"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"订单价格,维修价格不能低于1元"
,
required
=
true
)
@Min
(
value
=
1
,
message
=
"维修价格不能低于1元"
)
@NotNull
(
message
=
"请输入维修价格"
)
private
BigDecimal
price
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/service/ServiceOrderLogBizMapper.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
mapper
.
service
;
/**
* @author 潘维吉
* @date 2022-07-11 11:37
* @description ServiceOrderLogBizMapper业务接口
*/
public
interface
ServiceOrderLogBizMapper
{
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/
service
/ServiceAreaService.java
→
mini-app/src/main/java/com/onsiteservice/miniapp/service/
area
/ServiceAreaService.java
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
service
.
service
;
package
com
.
onsiteservice
.
miniapp
.
service
.
area
;
import
com.onsiteservice.entity.area.ServiceArea
;
import
com.onsiteservice.dao.mapper.service.ServiceAreaMapper
;
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/log/ServiceOrderLogService.java
0 → 100644
View file @
6aa6990a
package
com
.
onsiteservice
.
miniapp
.
service
.
log
;
import
com.onsiteservice.entity.service.ServiceOrderLog
;
import
com.onsiteservice.dao.mapper.service.ServiceOrderLogMapper
;
import
com.onsiteservice.miniapp.mapper.service.ServiceOrderLogBizMapper
;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.github.pagehelper.PageHelper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
/**
* @author 潘维吉
* @date 2022-07-11 11:37
* @description ServiceOrderLogService服务类
*/
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ServiceOrderLogService
extends
AbstractMapper
<
ServiceOrderLog
>
{
@Resource
private
ServiceOrderLogMapper
serviceOrderLogMapper
;
@Resource
private
ServiceOrderLogBizMapper
serviceOrderLogBizMapper
;
/**
* 分页查询列表
*/
public
PageInfoVO
getPage
(
PageParams
param
)
{
PageHelper
.
startPage
(
param
.
getPage
(),
param
.
getSize
());
return
new
PageInfoVO
(
this
.
selectAll
());
}
/**
* 保存或更新方法
*/
public
int
saveOrUpdate
(
ServiceOrderLog
serviceOrderLog
)
{
if
(
serviceOrderLog
.
getId
()
==
null
)
{
return
this
.
insertSelective
(
serviceOrderLog
);
}
else
{
return
this
.
updateByPrimaryKeySelective
(
serviceOrderLog
);
}
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/order/ServiceOrderService.java
View file @
6aa6990a
...
...
@@ -105,8 +105,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
public
int
save
(
Sa
veServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"order
sa
ve dto: {}, userId: {}"
,
dto
,
userId
);
public
int
reserve
(
Reser
veServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"order
reser
ve dto: {}, userId: {}"
,
dto
,
userId
);
ServiceSubclass
serviceSubclass
=
serviceSubclassMapper
.
selectByPrimaryKey
(
dto
.
getSubclassId
());
if
(
Objects
.
isNull
(
serviceSubclass
))
{
...
...
@@ -130,54 +130,51 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
/**
* 指派估价员 管理员操作
*/
public
int
valuation
(
ValuationServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"order valuation dto: {}, userId: {}"
,
dto
,
userId
);
Condition
c
=
new
Condition
(
ServiceOrder
.
class
);
c
.
createCriteria
().
andEqualTo
(
"id"
,
dto
.
getId
()).
andEqualTo
(
BizConstants
.
UserConstants
.
ACCOUNT_NO
,
userId
);
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_VALUATION_ORDER
);
List
<
ServiceOrder
>
serviceOrderList
=
this
.
selectByCondition
(
c
);
// 找不到订单
if
(
CollectionUtils
.
isEmpty
(
serviceOrderList
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_NOT_EXIST
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
SUBMIT
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_VALUATION
);
}
ServiceOrder
serviceOrder
=
serviceOrderList
.
get
(
0
);
// 估价价格
serviceOrder
.
setPrice
(
dto
.
getPrice
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
());
// TODO 短信通知估价员 去估价
return
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
}
/**
* 发送订单 管理员操作
*/
public
int
sendOrder
(
SendServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"sendOrder dto: {}, userId: {}"
,
dto
,
userId
);
// 判断发送者权限
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
if
(
Objects
.
isNull
(
user
)
||
!
user
.
getAdmin
())
{
throw
new
ServiceException
(
BizCodeEnum
.
NO_AUTH_SEND_ORDER_TO_USER
);
}
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_SEND_ORDER
);
// 判断能发送的状态
ServiceOrder
serviceOrder
=
serviceOrderMapper
.
selectByPrimaryKey
(
dto
.
getId
());
if
(
Objects
.
isNull
(
serviceOrder
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_NOT_EXIST
);
}
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_
NOT_VALUATION
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_
CANNOT_SEND
);
}
// 估价价格
serviceOrder
.
setPrice
(
dto
.
getPrice
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
SEND
.
getStatus
());
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
try
{
// 发短信
log
.
info
(
"sendOrder send msg to phone: {}"
,
serviceOrder
.
getPhone
());
// TODO
// TODO
短信通知客户完成支付
smsUtils
.
send
(
sign
,
""
,
""
,
serviceOrder
.
getPhone
());
}
catch
(
Exception
e
)
{
log
.
error
(
"sendOrder error, "
,
e
);
...
...
@@ -191,32 +188,63 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
public
int
refundOrder
(
Refund
ServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"
refundOrder
dto: {}, userId: {}"
,
dto
,
userId
);
public
int
pay
(
Pay
ServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"
order pay
dto: {}, userId: {}"
,
dto
,
userId
);
// 判断能发送的状态
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
userId
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_
REFUND
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
SEND
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_
PAY
);
}
// 已申请退款
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
REFUND_APPLY
.
getStatus
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
());
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
// TODO 调用微信支付接口
try
{
// TODO 调用微信接口退款 ??
// TODO 通知web
}
catch
(
Exception
e
)
{
return
result
;
}
public
int
dispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"dispatch dto: {}, userId: {}"
,
dto
,
userId
);
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_DISPATCH
);
}
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
());
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
// TODO 小程序通知 您的订单已为您指派维修工~~~
return
result
;
}
/**
* 完成 TODO 任务已派单的 "?天" 自动完成
*/
public
int
finishOrder
(
FinishServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"finishOrder dto: {}, userId: {}"
,
dto
,
userId
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
userId
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_FINISH
);
}
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
return
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
}
public
int
cancelOrder
(
CancelServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"cancelOrder dto: {}, userId: {}"
,
dto
,
userId
);
...
...
@@ -230,54 +258,47 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
public
int
dispatch
(
SendServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"dispatch dto: {}, userId: {}"
,
dto
,
userId
);
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
if
(
Objects
.
isNull
(
user
)
||
!
user
.
getAdmin
())
{
throw
new
ServiceException
(
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER_TO_USER
);
}
ServiceOrder
serviceOrder
=
serviceOrderMapper
.
selectByPrimaryKey
(
dto
.
getId
());
if
(
Objects
.
isNull
(
serviceOrder
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_NOT_EXIST
);
}
public
int
refundOrder
(
RefundServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"refundOrder dto: {}, userId: {}"
,
dto
,
userId
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
userId
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_
DISPATCH
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_
REFUND
);
}
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
());
// 已申请退款
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
REFUND_APPLY
.
getStatus
());
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
// TODO 小程序通知 您的订单已为您指派维修工~~~
try
{
// TODO 调用微信接口退款 ??
// TODO 通知web
}
catch
(
Exception
e
)
{
}
return
result
;
}
public
int
finishOrder
(
FinishServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"finishOrder dto: {}, userId: {}"
,
dto
,
userId
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
userId
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_FINISH
);
}
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
// TODO 调用微信接口付款
return
result
;
}
private
ServiceOrder
checkOrder
(
Long
id
,
Long
userId
)
{
Condition
c
=
new
Condition
(
ServiceOrder
.
class
);
c
.
createCriteria
().
andEqualTo
(
"id"
,
id
).
andEqualTo
(
BizConstants
.
UserConstants
.
ACCOUNT_NO
,
userId
);
c
.
createCriteria
().
andEqualTo
(
"id"
,
id
);
if
(
userId
!=
null
)
{
c
.
createCriteria
().
andEqualTo
(
BizConstants
.
UserConstants
.
ACCOUNT_NO
,
userId
);
}
List
<
ServiceOrder
>
serviceOrderList
=
serviceOrderMapper
.
selectByCondition
(
c
);
if
(
CollectionUtils
.
isEmpty
(
serviceOrderList
))
{
...
...
@@ -288,4 +309,12 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
private
void
checkAuth
(
Long
userId
,
BizCodeEnum
biz
)
{
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
if
(
Objects
.
isNull
(
user
)
||
!
user
.
getAdmin
())
{
throw
new
ServiceException
(
biz
);
}
}
}
mini-app/src/main/resources/mapper/service/ServiceOrderLogBizMapper.xml
0 → 100644
View file @
6aa6990a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.onsiteservice.miniapp.mapper.service.ServiceOrderLogBizMapper"
>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment