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 3943076f
authored
Oct 20, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop-16542
2 parents
0452f5e2
fdb96df7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
17 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
project-order/src/main/java/com/dituhui/pea/order/dao/BeanMqMessageDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessTeamsDTO.java
project-order/src/main/java/com/dituhui/pea/order/entity/BeanMqMessageEntity.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessTeamServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
View file @
3943076
...
...
@@ -18,8 +18,10 @@ import javax.validation.constraints.NotNull;
import
java.io.IOException
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Random
;
/**
* PEA 对外接口
...
...
@@ -35,6 +37,10 @@ public class PeaApiController {
private
static
final
String
capacity
=
"{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\":\"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 3500}, {\"maxDuration\": 45, \"name\": \"上午\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 11:59:59\", \"status\": 1, \"remain\": 2500}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 0, \"remain\": 1000}, {\"maxDuration\": 60, \"name\": \"时间段\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 15:00:00\", \"status\": 1, \"remain\": 480}]}]}"
;
private
static
final
String
day_capacity
=
"{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 3500}]}]}"
;
private
static
final
String
half_capacity
=
"{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-22\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-22 08:00:00\", \"endTime\": \"2023-07-22 17:59:59\", \"status\": 1, \"remain\": 3500}, {\"maxDuration\": 45, \"name\": \"上午\", \"beginTime\": \"2023-07-22 08:00:00\", \"endTime\": \"2023-07-22 11:59:59\", \"status\": 1, \"remain\": 2500}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-22 13:00:00\", \"endTime\": \"2023-07-22 17:59:59\", \"status\": 0, \"remain\": 1000}]}]}"
;
private
static
final
String
half_capacity2
=
"{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 1000}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 0, \"remain\": 1000}]}]}"
;
private
static
final
String
date_capacity
=
"{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\": \"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-23\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-23 08:00:00\", \"endTime\": \"2023-07-23 17:59:59\", \"status\": 1, \"remain\": 480}, {\"maxDuration\": 60, \"name\": \"时间段\", \"beginTime\": \"2023-07-23 13:00:00\", \"endTime\": \"2023-07-23 15:00:00\", \"status\": 1, \"remain\": 480}]}]}"
;
private
static
final
String
stage
=
"{\"orderId\": \"X10001\", \"engineerCode\": \"E12005\", \"engineerName\": \"祝枝山\", \"engineerCodeAssist\": \"E12446\", \"engineerNameAssist\": \"李晓阳\", \"planVisitTime\": \"2023-07-27 12:00:00\", \"realtimeInfo\": {\"engineerLocation\": {\"latitude\": 31.349701, \"longitude\": 120.675945, \"address\": \"江苏省苏州市苏州工业园区和顺路\", \"name\": \"和顺大酒店\"}, \"estimate\": {\"distance\": 2300, \"arriveTime\": \"2023-07-27 12:12:00\"}}}"
;
...
...
@@ -110,8 +116,16 @@ public class PeaApiController {
public
Result
<
CapacityQueryDTO
.
Result
>
capacityQuery
(
@Validated
@RequestBody
CapacityQueryDTO
.
Request
reqDTO
)
throws
IOException
{
//查询日期起止参数限制为一月
ArrayList
<
String
>
strings
=
new
ArrayList
<>();
strings
.
add
(
half_capacity
);
strings
.
add
(
day_capacity
);
strings
.
add
(
half_capacity2
);
strings
.
add
(
date_capacity
);
CapacityQueryDTO
.
Result
result
=
JsonUtil
.
parse
(
capacity
,
CapacityQueryDTO
.
Result
.
class
).
get
();
Random
random
=
new
Random
();
int
i
=
random
.
nextInt
(
4
);
CapacityQueryDTO
.
Result
result
=
JsonUtil
.
parse
(
strings
.
get
(
i
),
CapacityQueryDTO
.
Result
.
class
).
get
();
result
.
setParams
(
reqDTO
);
return
Result
.
success
(
result
);
}
...
...
@@ -135,7 +149,16 @@ public class PeaApiController {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
Date
endDate
)
throws
IOException
{
CapacityQueryDTO
.
Result
resultTemp
=
JsonUtil
.
parse
(
capacity
,
CapacityQueryDTO
.
Result
.
class
).
get
();
ArrayList
<
String
>
strings
=
new
ArrayList
<>();
strings
.
add
(
half_capacity
);
strings
.
add
(
day_capacity
);
strings
.
add
(
half_capacity2
);
strings
.
add
(
date_capacity
);
Random
random
=
new
Random
();
int
i
=
random
.
nextInt
(
4
);
CapacityQueryDTO
.
Result
resultTemp
=
JsonUtil
.
parse
(
strings
.
get
(
i
),
CapacityQueryDTO
.
Result
.
class
).
get
();
CapacityQueryDTO
.
PersonalResult
result
=
new
CapacityQueryDTO
.
PersonalResult
();
result
.
setDatas
(
resultTemp
.
getDatas
());
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/BeanMqMessageDao.java
0 → 100644
View file @
3943076
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.dituhui.pea.order.entity.BeanMqMessageEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.repository.CrudRepository
;
public
interface
BeanMqMessageDao
extends
JpaRepository
<
BeanMqMessageEntity
,
String
>,
JpaSpecificationExecutor
<
BeanMqMessageEntity
>,
CrudRepository
<
BeanMqMessageEntity
,
String
>
{
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessTeamsDTO.java
View file @
3943076
...
...
@@ -38,7 +38,7 @@ public class BusinessTeamsDTO {
/**
* 总条数
*/
private
Integer
total
;
private
Long
total
;
}
@lombok
.
Data
...
...
project-order/src/main/java/com/dituhui/pea/order/entity/BeanMqMessageEntity.java
0 → 100644
View file @
3943076
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* bean mq消息储存表
*/
@Data
@Entity
@Table
(
name
=
"bean_mq_message"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
BeanMqMessageEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8806128881082006267L
;
/**
* 主键
*/
@Id
@GeneratedValue
(
generator
=
"uuid"
)
@GenericGenerator
(
name
=
"uuid"
,
strategy
=
"uuid"
)
@Column
(
name
=
"ID"
,
unique
=
true
,
nullable
=
false
,
length
=
32
)
private
String
id
;
/**
* 消息
*/
@Column
(
name
=
"msg"
,
nullable
=
false
)
private
String
msg
;
/**
* 是否同步成功,0:失败,1:成功 默认成功
*/
@Column
(
name
=
"success"
)
private
Integer
success
=
1
;
@Column
(
name
=
"create_time"
,
nullable
=
false
,
updatable
=
false
,
columnDefinition
=
"timestamp default current_timestamp"
)
private
LocalDateTime
createTime
=
LocalDateTime
.
now
();
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessTeamServiceImpl.java
View file @
3943076
...
...
@@ -12,6 +12,7 @@ import com.dituhui.pea.order.entity.OrgWarehouseInfoEntity;
import
com.dituhui.pea.order.service.BusinessTeamService
;
import
com.dituhui.pea.order.service.CommonService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
...
...
@@ -80,7 +81,7 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
contents
.
add
(
content
);
}
BusinessTeamsDTO
.
Result
rs
=
new
BusinessTeamsDTO
.
Result
();
rs
.
setContent
(
contents
).
set
Total
(
page
.
getTotalPage
s
()).
setPageSize
(
page
.
getSize
());
rs
.
setContent
(
contents
).
set
Pages
(
page
.
getTotalPages
()).
setTotal
(
page
.
getTotalElement
s
()).
setPageSize
(
page
.
getSize
());
return
Result
.
success
(
rs
);
}
...
...
@@ -173,6 +174,9 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
if
(
req
.
getWarehouseId
()
!=
null
)
{
entity
.
setWarehouseId
(
req
.
getWarehouseId
());
}
if
(
StringUtils
.
isNotBlank
(
req
.
getGroupId
()))
{
entity
.
setGroupId
(
req
.
getGroupId
());
}
entity
.
setUpdateTime
(
LocalDateTime
.
now
());
orgTeamDao
.
save
(
entity
);
...
...
@@ -215,19 +219,19 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
}
// 遍历新的关系映射,创建新的关系
for
(
OrgTeamEngineerEntity
newRelation
:
newRelationsMap
.
values
())
{
if
(!
existingRelations
.
contains
(
newRelation
))
{
// 检查是否存在,已经存在的,只需要set status=1就可以了
OrgTeamEngineerEntity
exist
=
orgTeamEngineerDao
.
findByTeamIdAndEngineerCode
(
newRelation
.
getTeamId
(),
newRelation
.
getEngineerCode
());
if
(
null
!=
exist
&&
exist
.
getId
()
!=
null
)
{
exist
.
setStatus
(
1
);
orgTeamEngineerDao
.
save
(
exist
);
}
else
{
orgTeamEngineerDao
.
save
(
newRelation
);
}
}
}
for
(
OrgTeamEngineerEntity
newRelation
:
newRelationsMap
.
values
())
{
if
(!
existingRelations
.
contains
(
newRelation
))
{
// 检查是否存在,已经存在的,只需要set status=1就可以了
OrgTeamEngineerEntity
exist
=
orgTeamEngineerDao
.
findByTeamIdAndEngineerCode
(
newRelation
.
getTeamId
(),
newRelation
.
getEngineerCode
());
if
(
null
!=
exist
&&
exist
.
getId
()
!=
null
)
{
exist
.
setStatus
(
1
);
orgTeamEngineerDao
.
save
(
exist
);
}
else
{
orgTeamEngineerDao
.
save
(
newRelation
);
}
}
}
}
@Override
...
...
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