Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d42b6620
authored
Jun 08, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了工作台-工单变更历史相关的接口逻辑
1 parent
408af837
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
256 additions
and
0 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/WorkbenchController.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderChangeDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderRequestDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/WorkbenchOrderChangeListReqDTO.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/WorkbenchOrderChangeListRespDTO.java
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrderChangeEntity.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/WorkbenchService.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/WorkbenchServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/WorkbenchController.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
controller
;
import
com.alibaba.cloud.integration.common.BusinessException
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListReqDTO
;
import
com.alibaba.cloud.integration.order.service.WorkbenchService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.RestController
;
@Slf4j
@RestController
public
class
WorkbenchController
{
@Autowired
WorkbenchService
workbenchService
;
@PostMapping
(
"/workbench/serviceOrder/change/list"
)
public
Result
<?>
orderChangeList
(
@Validated
@RequestBody
WorkbenchOrderChangeListReqDTO
reqDTO
)
{
Result
<?>
res
=
null
;
try
{
res
=
workbenchService
.
getOrderChangeList
(
reqDTO
.
getLevelType
(),
reqDTO
.
getLevelValue
(),
reqDTO
.
getPage
(),
reqDTO
.
getSize
());
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderChangeDao.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dao
;
import
com.alibaba.cloud.integration.order.entity.OrderChangeEntity
;
import
org.hibernate.annotations.Where
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
@Repository
@Where
(
clause
=
"status = 1"
)
public
interface
OrderChangeDao
extends
JpaRepository
<
OrderChangeEntity
,
Integer
>
{
@Query
(
"select a from OrderChangeEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgClusterId = :clusterId"
)
Page
<
OrderChangeEntity
>
findAllByClusterId
(
Pageable
pageable
,
String
clusterId
);
@Query
(
"select a from OrderChangeEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgBranchId = :branchId"
)
Page
<
OrderChangeEntity
>
findAllByBranchId
(
Pageable
pageable
,
String
branchId
);
@Query
(
"select a from OrderChangeEntity a join OrderRequestEntity b on a.orderId=b.orderId where b.orgGroupId = :groupId"
)
Page
<
OrderChangeEntity
>
findAllByGroupId
(
Pageable
pageable
,
String
groupId
);
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderRequestDao.java
View file @
d42b662
...
...
@@ -2,6 +2,10 @@ package com.alibaba.cloud.integration.order.dao;
import
com.alibaba.cloud.integration.order.entity.OrderRequestEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
OrderRequestDao
extends
JpaRepository
<
OrderRequestEntity
,
Long
>
{
OrderRequestEntity
getByOrderId
(
String
orderId
);
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/WorkbenchOrderChangeListReqDTO.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dto
;
@lombok
.
Data
public
class
WorkbenchOrderChangeListReqDTO
{
/**
* 查询范围:root/cluster/branch/group
*/
private
String
levelType
;
/**
* levelType对应的id值
*/
private
String
levelValue
;
private
int
page
;
private
int
size
;
/**
* 排序
*/
private
String
sort
;
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/WorkbenchOrderChangeListRespDTO.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dto
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@lombok
.
Data
@Accessors
(
chain
=
true
)
public
class
WorkbenchOrderChangeListRespDTO
{
private
List
<?>
content
;
private
long
pageCurrent
;
private
long
pages
;
private
long
pageSize
;
private
long
total
;
@lombok
.
Data
@Accessors
(
chain
=
true
)
public
static
class
Content
{
/**
* 客户姓名
*/
private
String
customerName
;
/**
* 描述
*/
private
String
description
;
/**
* 备注
*/
private
String
memo
;
/**
* 操作员
*/
private
String
operator
;
/**
* 服务单号
*/
private
String
orderId
;
/**
* 更新时间
*/
private
String
updateTime
;
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrderChangeEntity.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.util.Date
;
@Entity
@Data
@Table
(
name
=
"order_change"
)
public
class
OrderChangeEntity
{
/**
* 自增id
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 工单id
*/
private
String
orderId
;
/**
* 子工单id
*/
private
String
suborderId
;
/**
* 变更发起源(bean/pea-web/pea-backend)
*/
private
String
source
;
/**
* 发起人
*/
private
String
operator
;
/**
* 操作内容,指派,规划路线
*/
private
String
content
;
/**
* 变更前的信息
*/
private
String
contentOld
;
/**
* 备注
*/
private
String
memo
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 创建时间
*/
private
Date
updateTime
;
public
OrderChangeEntity
()
{}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/WorkbenchService.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
;
import
com.alibaba.cloud.integration.common.Result
;
public
interface
WorkbenchService
{
Result
<?>
getOrderChangeList
(
String
levelType
,
String
levelId
,
int
page
,
int
pageSize
);
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/WorkbenchServiceImpl.java
0 → 100644
View file @
d42b662
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dao.OrderChangeDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestDao
;
import
com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListRespDTO
;
import
com.alibaba.cloud.integration.order.entity.OrderChangeEntity
;
import
com.alibaba.cloud.integration.order.entity.OrderRequestEntity
;
import
com.alibaba.cloud.integration.order.service.WorkbenchService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Service
;
import
org.springframework.data.domain.Pageable
;
import
java.util.ArrayList
;
import
java.util.List
;
@Slf4j
@Service
public
class
WorkbenchServiceImpl
implements
WorkbenchService
{
@Autowired
OrderChangeDao
orderChangeDao
;
@Autowired
OrderRequestDao
orderRequestDao
;
@Override
public
Result
<?>
getOrderChangeList
(
String
levelType
,
String
levelId
,
int
page
,
int
pageSize
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
pageSize
);
Page
<?>
changes
;
if
(
"cluster"
.
equals
(
levelType
))
{
changes
=
orderChangeDao
.
findAllByClusterId
(
pageable
,
levelId
);
}
else
if
(
"branch"
.
equals
(
levelType
))
{
changes
=
orderChangeDao
.
findAllByBranchId
(
pageable
,
levelId
);
}
else
{
changes
=
orderChangeDao
.
findAllByGroupId
(
pageable
,
levelId
);
}
List
<
WorkbenchOrderChangeListRespDTO
.
Content
>
contents
=
new
ArrayList
<>();
for
(
Object
e1
:
changes
.
getContent
())
{
OrderChangeEntity
e
=
(
OrderChangeEntity
)
e1
;
WorkbenchOrderChangeListRespDTO
.
Content
content
=
new
WorkbenchOrderChangeListRespDTO
.
Content
();
OrderRequestEntity
orderRequestEntity
=
orderRequestDao
.
getByOrderId
(
e
.
getOrderId
());
content
.
setOrderId
(
e
.
getOrderId
())
.
setCustomerName
(
orderRequestEntity
.
getName
())
.
setOperator
(
e
.
getOperator
())
.
setDescription
(
e
.
getContent
())
.
setMemo
(
e
.
getMemo
())
.
setUpdateTime
(
e
.
getUpdateTime
().
toString
());
contents
.
add
(
content
);
}
WorkbenchOrderChangeListRespDTO
resp
=
new
WorkbenchOrderChangeListRespDTO
();
resp
.
setTotal
(
changes
.
getTotalElements
())
.
setPages
(
changes
.
getTotalPages
())
.
setPageSize
(
changes
.
getSize
())
.
setContent
(
contents
);
return
Result
.
success
(
resp
);
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment