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
c767d1ce
Commit
c767d1ce
authored
Jul 07, 2022
by
kretee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 启动类,地址相关接口,订单相关接口,服务子类大类相关接口
parent
13a5020e
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
1399 additions
and
104 deletions
+1399
-104
AttrCopyUtils.java
...n/src/main/java/com/onsiteservice/util/AttrCopyUtils.java
+21
-0
JPushUtils.java
common/src/main/java/com/onsiteservice/util/JPushUtils.java
+0
-101
ServiceOrderConstants.java
...nsiteservice/constant/constant/ServiceOrderConstants.java
+17
-0
BizCodeEnum.java
...in/java/com/onsiteservice/constant/enums/BizCodeEnum.java
+26
-0
ServiceAddress.java
...java/com/onsiteservice/entity/address/ServiceAddress.java
+72
-0
ServiceCategory.java
...va/com/onsiteservice/entity/category/ServiceCategory.java
+71
-0
ServiceSubclass.java
...va/com/onsiteservice/entity/category/ServiceSubclass.java
+77
-0
ServiceOrder.java
...ain/java/com/onsiteservice/entity/order/ServiceOrder.java
+111
-0
MiniAppApplication.java
...in/java/com/onsiteservice/miniapp/MiniAppApplication.java
+22
-0
ServiceAddressController.java
.../miniapp/controller/address/ServiceAddressController.java
+79
-0
SaveServiceAddressDTO.java
...miniapp/controller/address/dto/SaveServiceAddressDTO.java
+29
-0
UpdateServiceAddressDTO.java
...niapp/controller/address/dto/UpdateServiceAddressDTO.java
+32
-0
ServiceAddressVO.java
...rvice/miniapp/controller/address/vo/ServiceAddressVO.java
+32
-0
ServiceCategoryController.java
...iniapp/controller/category/ServiceCategoryController.java
+47
-0
ServiceSubclassController.java
...iniapp/controller/category/ServiceSubclassController.java
+47
-0
PageServiceCategoryDTO.java
...niapp/controller/category/dto/PageServiceCategoryDTO.java
+23
-0
PageServiceSubclassDTO.java
...niapp/controller/category/dto/PageServiceSubclassDTO.java
+19
-0
ServiceCategoryVO.java
...ice/miniapp/controller/category/vo/ServiceCategoryVO.java
+44
-0
ServiceSubclassVO.java
...ice/miniapp/controller/category/vo/ServiceSubclassVO.java
+43
-0
ServiceOrderController.java
...vice/miniapp/controller/order/ServiceOrderController.java
+71
-0
PageServiceOrderDTO.java
...ice/miniapp/controller/order/dto/PageServiceOrderDTO.java
+26
-0
SaveServiceOrderDTO.java
...ice/miniapp/controller/order/dto/SaveServiceOrderDTO.java
+59
-0
ValuationServiceOrderDTO.java
...iniapp/controller/order/dto/ValuationServiceOrderDTO.java
+30
-0
ServiceOrderVO.java
...teservice/miniapp/controller/order/vo/ServiceOrderVO.java
+48
-0
ServiceAddressMapper.java
...eservice/miniapp/mapper/address/ServiceAddressMapper.java
+12
-0
ServiceCategoryMapper.java
...ervice/miniapp/mapper/category/ServiceCategoryMapper.java
+19
-0
ServiceSubclassMapper.java
...ervice/miniapp/mapper/category/ServiceSubclassMapper.java
+19
-0
ServiceOrderMapper.java
...nsiteservice/miniapp/mapper/order/ServiceOrderMapper.java
+19
-0
ServiceAddressService.java
...ervice/miniapp/service/address/ServiceAddressService.java
+72
-0
ServiceCategoryService.java
...vice/miniapp/service/category/ServiceCategoryService.java
+40
-0
ServiceSubclassService.java
...vice/miniapp/service/category/ServiceSubclassService.java
+35
-0
ServiceOrderService.java
...iteservice/miniapp/service/order/ServiceOrderService.java
+86
-0
application.yaml
mini-app/src/main/resources/application.yaml
+4
-0
ServiceAddressMapper.xml
...rc/main/resources/mapper/address/ServiceAddressMapper.xml
+6
-0
ServiceCategoryMapper.xml
.../main/resources/mapper/category/ServiceCategoryMapper.xml
+10
-0
ServiceSubclassMapper.xml
.../main/resources/mapper/category/ServiceSubclassMapper.xml
+10
-0
ServiceOrderMapper.xml
...pp/src/main/resources/mapper/order/ServiceOrderMapper.xml
+18
-0
CodeGenerator.java
test/src/main/java/com/onsiteservice/CodeGenerator.java
+3
-3
No files found.
common/src/main/java/com/onsiteservice/util/AttrCopyUtils.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
util
;
import
org.springframework.beans.BeanUtils
;
/**
* <P>属性值复制工具类</P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 11:27
*/
public
class
AttrCopyUtils
{
public
static
<
T
>
T
copy
(
Object
t1
,
T
t2
)
{
BeanUtils
.
copyProperties
(
t1
,
t2
);
return
t2
;
}
}
common/src/main/java/com/onsiteservice/util/JPushUtils.java
deleted
100644 → 0
View file @
13a5020e
package
com
.
onsiteservice
.
util
;
import
cn.jiguang.common.resp.APIConnectionException
;
import
cn.jiguang.common.resp.APIRequestException
;
import
cn.jpush.api.JPushClient
;
import
cn.jpush.api.push.PushResult
;
import
cn.jpush.api.push.model.Options
;
import
cn.jpush.api.push.model.Platform
;
import
cn.jpush.api.push.model.PushPayload
;
import
cn.jpush.api.push.model.audience.Audience
;
import
cn.jpush.api.push.model.notification.AndroidNotification
;
import
cn.jpush.api.push.model.notification.IosAlert
;
import
cn.jpush.api.push.model.notification.IosNotification
;
import
cn.jpush.api.push.model.notification.Notification
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
OK
;
/**
* @author 潘维吉
* @date 2020/3/3 17:27
* @email 406798106@qq.com
* @description 极光推送工具类
*/
@ConditionalOnProperty
(
prefix
=
"jpush"
,
name
=
{
"enabled"
},
matchIfMissing
=
false
)
@Service
@Slf4j
public
class
JPushUtils
{
private
static
JPushClient
jPushClient
=
null
;
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
@Value
(
"${jpush.app-key}"
)
private
String
appKey
;
@Value
(
"${jpush.master-secret}"
)
private
String
masterSecret
;
public
JPushClient
getJPushClient
()
{
if
(
jPushClient
==
null
)
{
jPushClient
=
new
JPushClient
(
masterSecret
,
appKey
);
}
return
jPushClient
;
}
public
String
push
(
Integer
target
,
Integer
pushType
,
String
title
,
String
content
,
String
extras
,
String
[]
pushObjectList
)
{
PushResult
pushResult
;
String
errorMsg
=
null
;
Map
<
String
,
String
>
extrasMap
=
JSON
.
parseObject
(
extras
,
new
TypeReference
<
HashMap
<
String
,
String
>>()
{
});
IosAlert
iosAlert
=
IosAlert
.
newBuilder
().
setTitleAndBody
(
title
,
null
,
content
).
build
();
PushPayload
pushPayload
=
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
android_ios
())
.
setAudience
(
pushType
==
1
?
Audience
.
tag
(
pushObjectList
)
:
Audience
.
alias
(
pushObjectList
))
// 使用tag或alias
.
setNotification
(
Notification
.
newBuilder
()
.
addPlatformNotification
(
AndroidNotification
.
newBuilder
()
.
setAlert
(
content
)
.
setTitle
(
title
)
.
addExtras
(
extrasMap
)
.
build
()
)
.
addPlatformNotification
(
IosNotification
.
newBuilder
()
.
setAlert
(
iosAlert
)
.
incrBadge
(
1
)
.
setSound
(
"default"
)
.
addExtras
(
extrasMap
)
.
build
()
)
.
build
()
)
.
setOptions
(
Options
.
newBuilder
()
.
setApnsProduction
(
"prod"
.
equals
(
env
))
.
setSendno
(
1
)
.
build
())
.
build
();
try
{
pushResult
=
this
.
getJPushClient
().
sendPush
(
pushPayload
);
// 可以根据不同的客户端判断
if
(
pushResult
.
getResponseCode
()
!=
OK
.
value
())
{
errorMsg
=
pushResult
.
error
.
getMessage
();
}
}
catch
(
APIConnectionException
e
)
{
errorMsg
=
"API连接请求失败"
;
log
.
error
(
"推送消息失败: pushPayload={}, exception={}"
,
pushPayload
,
e
);
}
catch
(
APIRequestException
e
)
{
errorMsg
=
e
.
getErrorMessage
();
log
.
error
(
"推送消息失败: pushPayload={}, exception={}"
,
pushPayload
,
e
);
}
catch
(
Exception
e
)
{
errorMsg
=
e
.
getMessage
();
log
.
error
(
"推送消息失败: pushPayload={}, exception={}"
,
pushPayload
,
e
);
}
return
errorMsg
;
}
}
constant/src/main/java/com/onsiteservice/constant/constant/ServiceOrderConstants.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
constant
.
constant
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 11:46
*/
public
class
ServiceOrderConstants
{
/**
* 全部订单
*/
public
static
final
int
STATUS_0
=
0
;
}
constant/src/main/java/com/onsiteservice/constant/enums/BizCodeEnum.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
constant
.
enums
;
import
lombok.Getter
;
/**
* <P></P>
*
* @author jack
* @version v1.0
* @since 2022/4/11 15:42
*/
public
enum
BizCodeEnum
{
/**
* 订单分组
*/
SERVICE_ORDER_NOT_EXIST
(
"订单不存在"
);
@Getter
private
String
msg
;
private
BizCodeEnum
(
String
msg
){
this
.
msg
=
msg
;
}
}
entity/src/main/java/com/onsiteservice/entity/address/ServiceAddress.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
entity
.
address
;
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_address"
)
public
class
ServiceAddress
implements
Serializable
{
/**
* 主键
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
"主键"
)
private
Long
id
;
/**
* 账号
*/
@Column
(
name
=
"account_no"
)
@ApiModelProperty
(
"账号"
)
private
Long
accountNo
;
/**
* 姓名
*/
@ApiModelProperty
(
"姓名"
)
private
String
name
;
/**
* 手机或电话
*/
@ApiModelProperty
(
"手机或电话"
)
private
String
phone
;
/**
* 地址
*/
@ApiModelProperty
(
"地址"
)
private
String
address
;
/**
* 是否默认:1默认地址,0非默认地址
*/
@ApiModelProperty
(
"是否默认:1默认地址,0非默认地址"
)
private
Integer
def
;
/**
* 创建时间
*/
@Column
(
name
=
"create_time"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 修改时间
*/
@Column
(
name
=
"modify_time"
)
@ApiModelProperty
(
"修改时间"
)
private
Date
modifyTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/category/ServiceCategory.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
entity
.
category
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
@Getter
@Setter
@ToString
@ApiModel
(
"服务大类表"
)
@Table
(
name
=
"service_category"
)
public
class
ServiceCategory
implements
Serializable
{
/**
* 主键
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
"主键"
)
private
Integer
id
;
/**
* 服务名称
*/
@Column
(
name
=
"service_name"
)
@ApiModelProperty
(
"服务名称"
)
private
String
serviceName
;
@Column
(
name
=
"sequence"
)
@ApiModelProperty
(
"顺序"
)
private
Integer
sequence
;
@Column
(
name
=
"img"
)
@ApiModelProperty
(
"大类图片"
)
private
String
img
;
/**
* 创建人
*/
@Column
(
name
=
"create_by"
)
@ApiModelProperty
(
"创建人"
)
private
String
createBy
;
/**
* 创建时间
*/
@Column
(
name
=
"create_time"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 修改人
*/
@Column
(
name
=
"modify_by"
)
@ApiModelProperty
(
"修改人"
)
private
String
modifyBy
;
/**
* 修改时间
*/
@Column
(
name
=
"modify_time"
)
@ApiModelProperty
(
"修改时间"
)
private
Date
modifyTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/category/ServiceSubclass.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
entity
.
category
;
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_subclass"
)
public
class
ServiceSubclass
implements
Serializable
{
/**
* 主键
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
"主键"
)
private
Integer
id
;
/**
* 大类id
*/
@Column
(
name
=
"category_id"
)
@ApiModelProperty
(
"大类id"
)
private
Integer
categoryId
;
/**
* 服务名称
*/
@Column
(
name
=
"service_name"
)
@ApiModelProperty
(
"服务名称"
)
private
String
serviceName
;
@Column
(
name
=
"sequence"
)
@ApiModelProperty
(
"顺序"
)
private
Integer
sequence
;
@Column
(
name
=
"img"
)
@ApiModelProperty
(
"大类图片"
)
private
String
img
;
/**
* 创建人
*/
@Column
(
name
=
"create_by"
)
@ApiModelProperty
(
"创建人"
)
private
String
createBy
;
/**
* 创建时间
*/
@Column
(
name
=
"create_time"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 修改人
*/
@Column
(
name
=
"modify_by"
)
@ApiModelProperty
(
"修改人"
)
private
String
modifyBy
;
/**
* 修改时间
*/
@Column
(
name
=
"modify_time"
)
@ApiModelProperty
(
"修改时间"
)
private
Date
modifyTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/order/ServiceOrder.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
entity
.
order
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.persistence.*
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
@Getter
@Setter
@ToString
@ApiModel
(
"服务订单表"
)
@Table
(
name
=
"service_order"
)
public
class
ServiceOrder
implements
Serializable
{
/**
* 主键
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
"主键"
)
private
Long
id
;
/**
* 账号
*/
@Column
(
name
=
"account_no"
)
@ApiModelProperty
(
"账号"
)
private
Long
accountNo
;
/**
* 服务地址id
*/
@Column
(
name
=
"address_id"
)
@ApiModelProperty
(
"服务地址id"
)
private
Long
addressId
;
/**
* 期望上门时间
*/
@Column
(
name
=
"expect_arrival_time"
)
@ApiModelProperty
(
"期望上门时间"
)
private
Date
expectArrivalTime
;
/**
* 服务数量
*/
@ApiModelProperty
(
"服务数量"
)
private
Integer
num
;
/**
* 服务需求图片
*/
@Column
(
name
=
"demand_img"
)
@ApiModelProperty
(
"服务需求图片"
)
private
String
demandImg
;
/**
* 服务需求说明
*/
@Column
(
name
=
"demand_desc"
)
@ApiModelProperty
(
"服务需求说明"
)
private
String
demandDesc
;
/**
* 是否阅读协议:1已阅读,0未阅读
*/
@Column
(
name
=
"read_agreement"
)
@ApiModelProperty
(
"是否阅读协议:1已阅读,0未阅读"
)
private
Integer
readAgreement
;
/**
* 订单状态:1已预约,2已派单,3进行中,4完成,5取消,6已评价
*/
@Column
(
name
=
"order_status"
)
@ApiModelProperty
(
"订单状态:1已预约,2已派单,3进行中,4完成,5取消,6已评价"
)
private
Integer
orderStatus
;
/**
* 价格
*/
@Column
(
name
=
"price"
)
@ApiModelProperty
(
"订单价格"
)
private
BigDecimal
price
;
/**
* 服务订单备注字段
*/
@Column
(
name
=
"remark"
)
@ApiModelProperty
(
"服务订单备注字段"
)
private
String
remark
;
/**
* 创建时间
*/
@Column
(
name
=
"create_time"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
/**
* 修改时间
*/
@Column
(
name
=
"modify_time"
)
@ApiModelProperty
(
"修改时间"
)
private
Date
modifyTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/MiniAppApplication.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
/**
* <P>启动类</P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 08:51
*/
@SpringBootApplication
@ComponentScan
({
"com.onsiteservice.core"
,
"com.onsiteservice.common"
,
"com.onsiteservice.dao"
,
"com.onsiteservice.util"
})
public
class
MiniAppApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
MiniAppApplication
.
class
,
args
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/address/ServiceAddressController.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
address
;
import
com.onsiteservice.common.annotation.user.CurrentUserId
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
com.onsiteservice.miniapp.controller.address.dto.SaveServiceAddressDTO
;
import
com.onsiteservice.miniapp.controller.address.dto.UpdateServiceAddressDTO
;
import
com.onsiteservice.miniapp.controller.address.vo.ServiceAddressVO
;
import
com.onsiteservice.miniapp.service.address.ServiceAddressService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.NonNull
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
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
;
/**
* <P>服务地址模块</P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 08:51
*/
@Api
(
tags
=
"服务地址模块"
)
@RestController
@RequestMapping
(
"/address/"
)
@Validated
public
class
ServiceAddressController
{
@Autowired
private
ServiceAddressService
serviceAddressService
;
@ApiOperation
(
value
=
"分页查询列表"
)
@PostMapping
(
"get/page"
)
public
Result
<
PageInfoVO
>
getPage
(
@RequestBody
@NonNull
@Validated
PageParams
param
)
{
return
success
(
serviceAddressService
.
getPage
(
param
),
"获取分页列表"
);
}
@ApiOperation
(
value
=
"根据id查询服务地址"
)
@GetMapping
(
"get/{id}"
)
public
Result
<
ServiceAddressVO
>
getDetails
(
@ApiParam
(
name
=
"id"
,
value
=
"服务地址id"
)
@PathVariable
@Positive
Long
id
)
{
return
success
(
serviceAddressService
.
selectById
(
id
));
}
@ApiOperation
(
value
=
"获取用户所有服务地址"
)
@GetMapping
(
"get/all"
)
public
Result
<
List
<
ServiceAddressVO
>>
getAll
(
@CurrentUserId
Long
userId
)
{
return
success
(
serviceAddressService
.
selectByUserId
(
userId
));
}
@ApiOperation
(
value
=
"新增服务地址"
)
@PostMapping
(
"save"
)
public
Result
save
(
@RequestBody
@NonNull
@Validated
SaveServiceAddressDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceAddressService
.
save
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"新增失败"
);
}
@ApiOperation
(
value
=
"修改服务地址"
)
@PutMapping
(
"update"
)
public
Result
saveOrUpdate
(
@RequestBody
@NonNull
@Validated
UpdateServiceAddressDTO
dto
)
{
return
serviceAddressService
.
update
(
dto
)
==
1
?
success
()
:
fail
(
"修改失败"
);
}
@ApiOperation
(
value
=
"根据id删除服务地址"
)
@DeleteMapping
(
"delete/{id}"
)
public
Result
deleteById
(
@ApiParam
(
name
=
"id"
,
value
=
"服务地址id"
)
@PathVariable
@Positive
Long
id
)
{
return
serviceAddressService
.
deleteByPrimaryKey
(
id
)
==
1
?
success
()
:
fail
(
"删除失败"
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/address/dto/SaveServiceAddressDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
address
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"保存服务地址请求模型"
)
public
class
SaveServiceAddressDTO
{
/**
* 姓名
*/
@ApiModelProperty
(
value
=
"姓名"
,
required
=
true
)
private
String
name
;
/**
* 手机或电话
*/
@ApiModelProperty
(
value
=
"手机或电话"
,
required
=
true
)
private
String
phone
;
/**
* 地址
*/
@ApiModelProperty
(
value
=
"地址"
,
required
=
true
)
private
String
address
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/address/dto/UpdateServiceAddressDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
address
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"修改服务地址请求模型"
)
public
class
UpdateServiceAddressDTO
{
@ApiModelProperty
(
value
=
"服务地址id"
,
required
=
true
)
private
Long
id
;
/**
* 姓名
*/
@ApiModelProperty
(
value
=
"姓名"
,
required
=
true
)
private
String
name
;
/**
* 手机或电话
*/
@ApiModelProperty
(
value
=
"手机或电话"
,
required
=
true
)
private
String
phone
;
/**
* 地址
*/
@ApiModelProperty
(
value
=
"地址"
,
required
=
true
)
private
String
address
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/address/vo/ServiceAddressVO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
address
.
vo
;
import
lombok.Data
;
@Data
public
class
ServiceAddressVO
{
/**
* 主键
*/
private
Long
id
;
/**
* 姓名
*/
private
String
name
;
/**
* 手机或电话
*/
private
String
phone
;
/**
* 地址
*/
private
String
address
;
/**
* 是否默认:1默认地址,0非默认地址
*/
private
Integer
def
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/category/ServiceCategoryController.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
category
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
com.onsiteservice.miniapp.controller.category.dto.PageServiceCategoryDTO
;
import
com.onsiteservice.miniapp.controller.category.vo.ServiceCategoryVO
;
import
com.onsiteservice.miniapp.service.category.ServiceCategoryService
;
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.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
success
;
/**
* <P>服务大类模块</P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 08:51
*/
@Api
(
tags
=
"服务大类模块"
)
@RestController
@RequestMapping
(
"/category/"
)
@Validated
public
class
ServiceCategoryController
{
@Resource
private
ServiceCategoryService
serviceCategoryService
;
@ApiOperation
(
value
=
"分页查询服务大类"
)
@PostMapping
(
"page"
)
public
Result
<
PageInfoVO
<
ServiceCategoryVO
>>
getPage
(
@RequestBody
@NonNull
@Validated
PageServiceCategoryDTO
dto
)
{
return
serviceCategoryService
.
getPage
(
dto
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/category/ServiceSubclassController.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
category
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
com.onsiteservice.miniapp.controller.category.dto.PageServiceSubclassDTO
;
import
com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO
;
import
com.onsiteservice.miniapp.service.category.ServiceSubclassService
;
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.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
success
;
/**
* <P>服务大类模块</P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 08:51
*/
@Api
(
tags
=
"服务子类模块"
)
@RestController
@RequestMapping
(
"/subclass/"
)
@Validated
public
class
ServiceSubclassController
{
@Resource
private
ServiceSubclassService
serviceSubclassService
;
@ApiOperation
(
value
=
"分页查询列表"
)
@PostMapping
(
"page"
)
public
Result
<
PageInfoVO
<
ServiceSubclassVO
>>
getPage
(
@RequestBody
@NonNull
@Validated
PageServiceSubclassDTO
dto
)
{
return
serviceSubclassService
.
getPage
(
dto
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/category/dto/PageServiceCategoryDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
category
.
dto
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 16:10
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"分页查询服务大类请求模型"
)
public
class
PageServiceCategoryDTO
extends
PageParams
{
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/category/dto/PageServiceSubclassDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
category
.
dto
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 16:11
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"分页查询服务子类请求模型"
)
public
class
PageServiceSubclassDTO
extends
PageParams
{
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/category/vo/ServiceCategoryVO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
category
.
vo
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
ServiceCategoryVO
{
/**
* 主键
*/
private
Integer
id
;
/**
* 服务名称
*/
private
String
serviceName
;
private
Integer
sequence
;
private
String
img
;
/**
* 创建人
*/
private
String
createBy
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改人
*/
private
String
modifyBy
;
/**
* 修改时间
*/
private
Date
modifyTime
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/category/vo/ServiceSubclassVO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
category
.
vo
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
ServiceSubclassVO
{
/**
* 主键
*/
private
Integer
id
;
private
Integer
categoryId
;
private
String
serviceName
;
private
Integer
sequence
;
private
String
img
;
/**
* 创建人
*/
private
String
createBy
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改人
*/
private
String
modifyBy
;
/**
* 修改时间
*/
private
Date
modifyTime
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/ServiceOrderController.java
0 → 100644
View file @
c767d1ce
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.PageServiceOrderDTO
;
import
com.onsiteservice.miniapp.controller.order.dto.SaveServiceOrderDTO
;
import
com.onsiteservice.miniapp.controller.order.dto.ValuationServiceOrderDTO
;
import
com.onsiteservice.miniapp.controller.order.vo.ServiceOrderVO
;
import
com.onsiteservice.miniapp.service.order.ServiceOrderService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
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
;
/**
* <P>订单模块</P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 08:51
*/
@Api
(
tags
=
"订单模块"
)
@RestController
@RequestMapping
(
"/order/"
)
@Validated
public
class
ServiceOrderController
{
@Resource
private
ServiceOrderService
serviceOrderService
;
@ApiOperation
(
value
=
"根据id查询订单详情"
)
@GetMapping
(
"get/{id}"
)
public
Result
<
ServiceOrderVO
>
getDetail
(
@ApiParam
(
name
=
"id"
,
value
=
"订单id"
)
@PathVariable
@Positive
Long
id
)
{
return
success
(
serviceOrderService
.
selectById
(
id
),
"根据id查询订单详情"
);
}
@ApiOperation
(
value
=
"分页查询订单"
)
@PostMapping
(
"page"
)
public
Result
<
PageInfoVO
<
ServiceOrderVO
>>
getPage
(
@RequestBody
@NonNull
@Validated
PageServiceOrderDTO
dto
,
@CurrentUserId
Long
uid
)
{
return
serviceOrderService
.
selectByUserId
(
dto
,
uid
);
}
@ApiOperation
(
value
=
"订单预约"
)
@PostMapping
(
"reserve"
)
public
Result
save
(
@RequestBody
@NonNull
@Validated
SaveServiceOrderDTO
dto
,
@CurrentUserId
Long
uid
)
{
return
serviceOrderService
.
save
(
dto
,
uid
)
==
1
?
success
()
:
fail
(
"已预约"
);
}
@ApiOperation
(
value
=
"订单估计"
)
@PutMapping
(
"valuation"
)
public
Result
valuation
(
@RequestBody
@NonNull
@Validated
ValuationServiceOrderDTO
dto
)
{
return
serviceOrderService
.
valuation
(
dto
)
==
1
?
success
()
:
fail
(
"估价失败"
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/PageServiceOrderDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
dto
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 14:38
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"分页查询订单请求模型"
)
public
class
PageServiceOrderDTO
extends
PageParams
{
@ApiModelProperty
(
value
=
"订单状态: 0表示全部,1表示..."
,
required
=
true
)
private
Integer
orderStatus
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/SaveServiceOrderDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
java.util.Date
;
@Data
@ApiModel
(
"订单预约请求模型"
)
public
class
SaveServiceOrderDTO
{
/**
* 账号
*/
@ApiModelProperty
(
"账号"
)
private
Long
accountNo
;
/**
* 服务地址id
*/
@ApiModelProperty
(
value
=
"服务地址id"
,
required
=
true
)
private
Long
addressId
;
/**
* 期望上门时间
*/
@ApiModelProperty
(
value
=
"期望上门时间"
,
required
=
true
)
private
Date
expectArrivalTime
;
/**
* 服务数量
*/
@ApiModelProperty
(
value
=
"服务数量"
,
required
=
true
)
private
Integer
num
;
/**
* 服务需求图片
*/
@ApiModelProperty
(
"服务需求图片"
)
private
String
demandImg
;
/**
* 服务需求说明
*/
@ApiModelProperty
(
"服务需求说明"
)
private
String
demandDesc
;
/**
* 是否阅读协议:1已阅读,0未阅读
*/
@ApiModelProperty
(
"是否阅读协议:1已阅读,0未阅读"
)
private
Integer
readAgreement
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/ValuationServiceOrderDTO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.extern.log4j.Log4j2
;
import
org.checkerframework.checker.units.qual.A
;
import
javax.validation.constraints.Min
;
import
java.math.BigDecimal
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 15:20
*/
@Data
@ApiModel
(
"订单估价请求模型"
)
public
class
ValuationServiceOrderDTO
{
@ApiModelProperty
(
value
=
"订单id"
,
required
=
true
)
private
Long
id
;
@ApiModelProperty
(
value
=
"订单价格,维修价格不能低于1元"
,
required
=
true
)
@Min
(
value
=
1
,
message
=
"维修价格不能低于1元"
)
private
BigDecimal
price
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/vo/ServiceOrderVO.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
public
class
ServiceOrderVO
{
private
Long
id
;
private
Long
accountNo
;
/**
* 地址相关信息
*/
private
String
phone
;
private
String
address
;
private
String
name
;
private
Long
addressId
;
private
Date
expectArrivalTime
;
private
Integer
num
;
private
String
demandImg
;
private
String
demandDesc
;
private
Integer
readAgreement
;
private
String
remark
;
private
Integer
orderStatus
;
private
Date
createTime
;
private
Date
modifyTime
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/address/ServiceAddressMapper.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
mapper
.
address
;
/**
* @author 潘维吉
* @date 2022-07-07 08:31
* @description ServiceAddressBizMapper业务接口
*/
public
interface
ServiceAddressMapper
{
}
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/category/ServiceCategoryMapper.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
mapper
.
category
;
import
com.onsiteservice.entity.category.ServiceCategory
;
import
com.onsiteservice.miniapp.controller.category.dto.PageServiceCategoryDTO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author 潘维吉
* @date 2022-07-07 08:31
* @description ServiceCategoryBizMapper业务接口
*/
public
interface
ServiceCategoryMapper
{
List
<
ServiceCategory
>
selectServiceCategoryPage
(
@Param
(
"dto"
)
PageServiceCategoryDTO
dto
);
}
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/category/ServiceSubclassMapper.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
mapper
.
category
;
import
com.onsiteservice.entity.category.ServiceSubclass
;
import
com.onsiteservice.miniapp.controller.category.dto.PageServiceSubclassDTO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author 潘维吉
* @date 2022-07-07 08:31
* @description ServiceSubclassBizMapper业务接口
*/
public
interface
ServiceSubclassMapper
{
List
<
ServiceSubclass
>
selectServiceSubclassPage
(
@Param
(
"dto"
)
PageServiceSubclassDTO
dto
);
}
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/order/ServiceOrderMapper.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
mapper
.
order
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.miniapp.controller.order.dto.PageServiceOrderDTO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author 潘维吉
* @date 2022-07-07 08:31
* @description ServiceOrderBizMapper业务接口
*/
public
interface
ServiceOrderMapper
{
List
<
ServiceOrder
>
selectServiceOrderPage
(
@Param
(
"dto"
)
PageServiceOrderDTO
dto
,
@Param
(
"uid"
)
Long
uid
);
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/address/ServiceAddressService.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
service
.
address
;
import
com.onsiteservice.entity.address.ServiceAddress
;
import
com.onsiteservice.miniapp.controller.address.dto.SaveServiceAddressDTO
;
import
com.onsiteservice.miniapp.controller.address.dto.UpdateServiceAddressDTO
;
import
com.onsiteservice.miniapp.controller.address.vo.ServiceAddressVO
;
import
com.onsiteservice.miniapp.mapper.address.ServiceAddressMapper
;
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
com.onsiteservice.util.AttrCopyUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Condition
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
success
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ServiceAddressService
extends
AbstractMapper
<
ServiceAddress
>
{
@Resource
private
ServiceAddressMapper
serviceAddressMapper
;
/**
* 分页查询列表
*/
public
PageInfoVO
getPage
(
PageParams
param
)
{
PageHelper
.
startPage
(
param
.
getPage
(),
param
.
getSize
());
return
new
PageInfoVO
(
this
.
selectAll
());
}
public
ServiceAddressVO
selectById
(
Long
id
)
{
ServiceAddress
serviceAddress
=
this
.
selectByPrimaryKey
(
id
);
return
AttrCopyUtils
.
copy
(
serviceAddress
,
new
ServiceAddressVO
());
}
public
List
<
ServiceAddressVO
>
selectByUserId
(
Long
userId
)
{
Condition
condition
=
new
Condition
(
ServiceAddress
.
class
);
condition
.
createCriteria
().
andEqualTo
(
"account_no"
,
userId
);
List
<
ServiceAddress
>
serviceAddresses
=
this
.
selectByCondition
(
condition
);
return
serviceAddresses
.
parallelStream
()
.
map
(
e
->
AttrCopyUtils
.
copy
(
e
,
new
ServiceAddressVO
()))
.
collect
(
Collectors
.
toList
());
}
public
int
save
(
SaveServiceAddressDTO
dto
,
Long
userId
)
{
ServiceAddress
serviceAddress
=
AttrCopyUtils
.
copy
(
dto
,
new
ServiceAddress
());
serviceAddress
.
setAccountNo
(
userId
);
return
this
.
insertSelective
(
serviceAddress
);
}
public
int
update
(
UpdateServiceAddressDTO
dto
)
{
ServiceAddress
serviceAddress
=
AttrCopyUtils
.
copy
(
dto
,
new
ServiceAddress
());
return
this
.
updateByPrimaryKey
(
serviceAddress
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/category/ServiceCategoryService.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
service
.
category
;
import
com.github.pagehelper.PageHelper
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.core.result.ResultGenerator
;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.dao.common.page.PageParams
;
import
com.onsiteservice.entity.category.ServiceCategory
;
import
com.onsiteservice.miniapp.controller.category.dto.PageServiceCategoryDTO
;
import
com.onsiteservice.miniapp.controller.category.vo.ServiceCategoryVO
;
import
com.onsiteservice.miniapp.mapper.category.ServiceCategoryMapper
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ServiceCategoryService
extends
AbstractMapper
<
ServiceCategory
>
{
@Resource
private
ServiceCategoryMapper
serviceCategoryMapper
;
/**
* 分页查询列表
*/
public
Result
<
PageInfoVO
<
ServiceCategoryVO
>>
getPage
(
PageServiceCategoryDTO
dto
)
{
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getSize
());
List
<
ServiceCategory
>
serviceCategoryList
=
serviceCategoryMapper
.
selectServiceCategoryPage
(
dto
);
List
<
ServiceCategoryVO
>
serviceCategoryVOList
=
serviceCategoryList
.
parallelStream
()
.
map
(
e
->
AttrCopyUtils
.
copy
(
e
,
new
ServiceCategoryVO
())).
collect
(
Collectors
.
toList
());
return
ResultGenerator
.
success
(
new
PageInfoVO
<>(
serviceCategoryVOList
));
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/category/ServiceSubclassService.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
service
.
category
;
import
com.github.pagehelper.PageHelper
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.core.result.ResultGenerator
;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.entity.category.ServiceSubclass
;
import
com.onsiteservice.miniapp.controller.category.dto.PageServiceSubclassDTO
;
import
com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO
;
import
com.onsiteservice.miniapp.mapper.category.ServiceSubclassMapper
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ServiceSubclassService
extends
AbstractMapper
<
ServiceSubclass
>
{
@Resource
private
ServiceSubclassMapper
serviceSubclassMapper
;
public
Result
<
PageInfoVO
<
ServiceSubclassVO
>>
getPage
(
PageServiceSubclassDTO
dto
)
{
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getSize
());
List
<
ServiceSubclass
>
serviceSubclassList
=
serviceSubclassMapper
.
selectServiceSubclassPage
(
dto
);
List
<
ServiceSubclassVO
>
serviceSubclassVOList
=
serviceSubclassList
.
parallelStream
()
.
map
(
e
->
AttrCopyUtils
.
copy
(
e
,
new
ServiceSubclassVO
())).
collect
(
Collectors
.
toList
());
return
ResultGenerator
.
success
(
new
PageInfoVO
<>(
serviceSubclassVOList
));
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/order/ServiceOrderService.java
0 → 100644
View file @
c767d1ce
package
com
.
onsiteservice
.
miniapp
.
service
.
order
;
import
com.github.pagehelper.PageHelper
;
import
com.onsiteservice.constant.enums.BizCodeEnum
;
import
com.onsiteservice.core.exception.ServiceException
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.core.result.ResultGenerator
;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.miniapp.controller.address.vo.ServiceAddressVO
;
import
com.onsiteservice.miniapp.controller.order.dto.PageServiceOrderDTO
;
import
com.onsiteservice.miniapp.controller.order.dto.SaveServiceOrderDTO
;
import
com.onsiteservice.miniapp.controller.order.dto.ValuationServiceOrderDTO
;
import
com.onsiteservice.miniapp.controller.order.vo.ServiceOrderVO
;
import
com.onsiteservice.miniapp.mapper.order.ServiceOrderMapper
;
import
com.onsiteservice.miniapp.service.address.ServiceAddressService
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ServiceOrderService
extends
AbstractMapper
<
ServiceOrder
>
{
@Resource
private
ServiceOrderMapper
serviceOrderMapper
;
@Resource
private
ServiceAddressService
serviceAddressService
;
public
ServiceOrderVO
selectById
(
Long
id
)
{
// 订单信息
ServiceOrder
serviceOrder
=
this
.
selectByPrimaryKey
(
id
);
ServiceOrderVO
serviceOrderVO
=
AttrCopyUtils
.
copy
(
serviceOrder
,
new
ServiceOrderVO
());
// 订单地址信息
ServiceAddressVO
serviceAddressVO
=
serviceAddressService
.
selectById
(
serviceOrder
.
getAddressId
());
serviceOrderVO
.
setAddress
(
serviceAddressVO
.
getAddress
());
serviceOrderVO
.
setName
(
serviceOrderVO
.
getName
());
serviceOrderVO
.
setPhone
(
serviceOrderVO
.
getPhone
());
return
serviceOrderVO
;
}
public
Result
<
PageInfoVO
<
ServiceOrderVO
>>
selectByUserId
(
PageServiceOrderDTO
dto
,
Long
uid
)
{
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getSize
());
List
<
ServiceOrder
>
serviceOrders
=
serviceOrderMapper
.
selectServiceOrderPage
(
dto
,
uid
);
List
<
ServiceOrderVO
>
serviceOrderVOList
=
serviceOrders
.
parallelStream
()
.
map
(
e
->
AttrCopyUtils
.
copy
(
e
,
new
ServiceOrderVO
())).
collect
(
Collectors
.
toList
());
return
ResultGenerator
.
success
(
new
PageInfoVO
<>(
serviceOrderVOList
));
}
public
int
save
(
SaveServiceOrderDTO
dto
,
Long
uid
)
{
ServiceOrder
serviceOrder
=
AttrCopyUtils
.
copy
(
dto
,
new
ServiceOrder
());
serviceOrder
.
setAccountNo
(
uid
);
return
this
.
insertSelective
(
serviceOrder
);
}
public
int
valuation
(
ValuationServiceOrderDTO
dto
)
{
ServiceOrder
serviceOrder
=
this
.
selectByPrimaryKey
(
dto
.
getId
());
// 找不到订单
if
(
Objects
.
isNull
(
serviceOrder
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_NOT_EXIST
.
getMsg
());
}
// 估价价格
serviceOrder
.
setPrice
(
dto
.
getPrice
());
// TODO 置为以估价状态
// serviceOrder.setOrderStatus();
return
this
.
updateByPrimaryKey
(
serviceOrder
);
}
}
mini-app/src/main/resources/application.yaml
View file @
c767d1ce
...
...
@@ -14,6 +14,10 @@ project:
secret
:
b25zaXRlLXNlcnZpY2UtYXBwLWJhc2U2NC1zZWNyZXQ=
issuer
:
onsite-service-mini-app
expires-time
:
2592000
# 30天有效期 秒
# 安全路径白名单 无需token
ant-paths
:
"
/api/category/page,/api/subclass/page"
# 基础token可以访问的路径白名单
base-token-ant-paths
:
"
/login"
spring
:
profiles
:
...
...
mini-app/src/main/resources/mapper/address/ServiceAddressMapper.xml
0 → 100644
View file @
c767d1ce
<?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.address.ServiceAddressMapper"
>
</mapper>
mini-app/src/main/resources/mapper/category/ServiceCategoryMapper.xml
0 → 100644
View file @
c767d1ce
<?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.category.ServiceCategoryMapper"
>
<select
id=
"selectServiceCategoryPage"
resultType=
"com.onsiteservice.entity.category.ServiceCategory"
>
select * from service_category
order by sequence asc
</select>
</mapper>
mini-app/src/main/resources/mapper/category/ServiceSubclassMapper.xml
0 → 100644
View file @
c767d1ce
<?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.category.ServiceSubclassMapper"
>
<select
id=
"selectServiceSubclassPage"
resultType=
"com.onsiteservice.entity.category.ServiceSubclass"
>
select * from service_subclass
order by sequence asc
</select>
</mapper>
mini-app/src/main/resources/mapper/order/ServiceOrderMapper.xml
0 → 100644
View file @
c767d1ce
<?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.order.ServiceOrderMapper"
>
<select
id=
"selectServiceOrderPage"
resultType=
"com.onsiteservice.entity.order.ServiceOrder"
>
select *
from service_order
where
account_no = #{uid,jdbcType=BIGINT}
<if
test=
"dto.orderStatus != 0"
>
and order_status = #{dto.orderStatus,jdbcType=INTEGER}
</if>
order by create_time asc
</select>
</mapper>
test/src/main/java/com/onsiteservice/CodeGenerator.java
View file @
c767d1ce
...
...
@@ -23,9 +23,9 @@ import java.util.*;
*/
public
class
CodeGenerator
{
//以下几个选项根据项目的实际情况修改
public
static
final
String
CURRENT_MODULE_NAME
=
"
admin
"
;
// 业务模块名称 根据项目修改
public
static
final
String
CURRENT_MODULE_NAME
=
"
mini-app
"
;
// 业务模块名称 根据项目修改
public
static
final
String
BASE_PACKAGE
=
"com.onsiteservice"
;
// 业务基础模块包名称 根据项目修改
public
static
final
String
CURRENT_PACKAGE
=
BASE_PACKAGE
+
".
admin
"
;
// 业务模块包名称 根据项目修改
public
static
final
String
CURRENT_PACKAGE
=
BASE_PACKAGE
+
".
miniapp
"
;
// 业务模块包名称 根据项目修改
private
static
final
String
AUTHOR
=
"潘维吉"
;
// @author
public
static
final
Boolean
IS_GEN_PAGE
=
false
;
// 是否生成分页dao层代码
...
...
@@ -34,7 +34,7 @@ public class CodeGenerator {
//TODO 根据数据库表 自动生成CRUD和分页接口
public
static
void
main
(
String
[]
args
)
{
String
[]
tables
=
new
String
[]{
"service_order"
};
// 输入表名 支持多表 模块目录情况批量代码生成确保表前缀一致 否则建议分批生成
String
[]
tables
=
new
String
[]{
"service_order"
,
"service_address"
,
"service_category"
,
"service_subclass"
};
// 输入表名 支持多表 模块目录情况批量代码生成确保表前缀一致 否则建议分批生成
if
(!
ask
(
tables
))
{
return
;
}
...
...
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