Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
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
王衍超
cloud-fb
Commits
aede7c9e
Commit
aede7c9e
authored
Jul 22, 2021
by
高晓磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采区许可证增加可采期校验,同一船只在可采期内只能有一个许可证
parent
a73415c4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
8 deletions
+80
-8
SandMiningDao.java
...ain/java/com/xyst/dinas/production/dao/SandMiningDao.java
+2
-0
SandMiningDaoImpl.java
...xyst/dinas/production/internal/dao/SandMiningDaoImpl.java
+16
-0
DischargingServiceImpl.java
...s/production/internal/service/DischargingServiceImpl.java
+24
-7
ProductionPlanReportServiceImpl.java
...ion/internal/service/ProductionPlanReportServiceImpl.java
+11
-0
SandMiningServiceImpl.java
...as/production/internal/service/SandMiningServiceImpl.java
+5
-0
SandMiningService.java
.../com/xyst/dinas/production/service/SandMiningService.java
+2
-0
ProductionPlanReportController.java
.../dinas/production/web/ProductionPlanReportController.java
+10
-1
SandMiningController.java
...a/com/xyst/dinas/production/web/SandMiningController.java
+10
-0
No files found.
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/dao/SandMiningDao.java
View file @
aede7c9e
...
...
@@ -27,4 +27,6 @@ public interface SandMiningDao extends BaseDao {
List
<
KObject
>
queryByShipId
(
UUID
fromString
);
List
<
KObject
>
getListByShipAndWorkDate
(
KObject
kobject
);
}
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/internal/dao/SandMiningDaoImpl.java
View file @
aede7c9e
...
...
@@ -14,6 +14,7 @@ import com.xyst.dinas.biz.dao.DinasTypeDao;
import
com.xyst.dinas.production.constant.SandMiningConstant
;
import
com.xyst.dinas.production.dao.SandMiningDao
;
import
org.hibernate.criterion.DetachedCriteria
;
import
org.hibernate.criterion.LogicalExpression
;
import
org.hibernate.criterion.Order
;
import
org.hibernate.criterion.Restrictions
;
import
org.hibernate.query.Query
;
...
...
@@ -135,6 +136,21 @@ public class SandMiningDaoImpl extends AbstractBaseDao implements SandMiningDao,
return
(
List
<
KObject
>)
template
.
findByCriteria
(
detachedCriteria
);
}
@Override
public
List
<
KObject
>
getListByShipAndWorkDate
(
KObject
kobject
)
{
DetachedCriteria
detachedCriteria
=
getDetachedCriteria
();
detachedCriteria
.
add
(
Restrictions
.
eq
(
"ship.id"
,
kobject
.
get
(
"ship"
).
getUuid
(
"id"
)));
//判断时间是否有交叉
//俩时间段1-2 A-B 如果1晚于B或者2早于A则说明时间没有交叉 反之如果1早于B并且2晚于A则交叉
detachedCriteria
.
add
(
Restrictions
.
ge
(
"sandMiningEnd"
,
kobject
.
getDate
(
"sandMiningStart"
)));
detachedCriteria
.
add
(
Restrictions
.
le
(
"sandMiningStart"
,
kobject
.
getDate
(
"sandMiningEnd"
)));
if
(
null
!=
kobject
.
getUuid
(
"id"
)){
detachedCriteria
.
add
(
Restrictions
.
ne
(
"id"
,
kobject
.
getUuid
(
"id"
)));
}
return
(
List
<
KObject
>)
template
.
findByCriteria
(
detachedCriteria
);
}
@Override
public
UUID
create
(
KObject
kObject
)
{
...
...
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/internal/service/DischargingServiceImpl.java
View file @
aede7c9e
...
...
@@ -94,15 +94,20 @@ public class DischargingServiceImpl implements DischargingService {
@Override
public
List
<
TimeValueParentEntity
>
getDischargingGroup
(
Date
startDate
,
Date
endDate
,
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Boolean
isGroupByArea
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
,
Integer
showType
)
{
Date
startDateTimeOfMonth
=
DateTimeUtils
.
getStartDateTimeOfMonth
(
startDate
);
Date
endDateTimeOfMonth
=
DateTimeUtils
.
getEndDateTimeOfMonth
(
endDate
);
//对时间进行处理,如果是按月查询则为月初至月末,不按照查询时间操作
if
(
showType
==
1
){
startDate
=
DateTimeUtils
.
getStartDateTimeOfMonth
(
startDate
);
endDate
=
DateTimeUtils
.
getEndDateTimeOfMonth
(
endDate
);
}
else
if
(
showType
==
2
){
startDate
=
DateTimeUtils
.
getYearStart
(
startDate
);
endDate
=
DateTimeUtils
.
getYearEnd
(
endDate
);
}
LocalDateTime
localStartDate
=
LocalDateTime
.
ofInstant
(
startDate
.
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
localEndDate
=
LocalDateTime
.
ofInstant
(
endDate
.
toInstant
(),
ZoneId
.
systemDefault
());
Map
<
UUID
,
TimeValueParentEntity
>
sandMiningAreaTimeValueEntityHashMap
=
new
HashMap
<>(
12
);
List
<
TimeValueParentEntity
>
timeValueParentEntities
=
new
ArrayList
<>();
//处理时间.首先获取时间范围内所有修正数据
groupByRevise
(
stationIds
,
regionalCompanyIds
,
startDate
TimeOfMonth
,
endDateTimeOfMonth
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
groupByRevise
(
stationIds
,
regionalCompanyIds
,
startDate
,
endDate
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
//对非修正数据进行补充
groupByNormal
(
startDate
,
endDate
,
stationIds
,
regionalCompanyIds
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
...
...
@@ -154,12 +159,14 @@ public class DischargingServiceImpl implements DischargingService {
DischargingTypeEnum
.
NORMAL_DATA
.
getValue
(),
true
,
isGroupByRegionalCompany
,
isGroupByArea
,
Boolean
.
TRUE
,
isGroupByStation
);
//将修正数据平均到每一天的数据与非修正数据相加
for
(
HashMap
<
String
,
Object
>
stringObjectHashMap
:
dischargingNormalDataList
)
{
Double
dischargingWeight
=
Double
.
parseDouble
(
stringObjectHashMap
.
get
(
"sumDischargingWeight"
).
toString
());
Date
dischargingTime
=
(
Date
)
stringObjectHashMap
.
get
(
"dischargingTime"
);
UUID
sandMiningAreaId
=
setSandMiningAreaTimeValueEntityHashMap
(
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntityList
,
stringObjectHashMap
);
timeValueParentEntity
=
sandMiningAreaTimeValueEntityHashMap
.
get
(
sandMiningAreaId
);
List
<
TimeValue
>
timeValues
=
timeValueParentEntity
.
getTimeValues
();
List
<
TimeValue
>
timeValueNew
=
new
ArrayList
<>();
boolean
isAdd
=
false
;
for
(
TimeValue
timeValue
:
timeValues
)
{
...
...
@@ -183,9 +190,12 @@ public class DischargingServiceImpl implements DischargingService {
}
}
private
void
groupByRevise
(
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Date
startDate
TimeOfMonth
,
Date
endDateTimeOfMonth
,
private
void
groupByRevise
(
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Date
startDate
,
Date
endDate
,
Map
<
UUID
,
TimeValueParentEntity
>
sandMiningAreaTimeValueEntityHashMap
,
List
<
TimeValueParentEntity
>
timeValueParentEntityList
,
Boolean
isGroupByArea
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
)
{
Date
startDateTimeOfMonth
=
DateTimeUtils
.
getStartDateTimeOfMonth
(
startDate
);
Date
endDateTimeOfMonth
=
DateTimeUtils
.
getEndDateTimeOfMonth
(
endDate
);
//查询修正数据
List
<
HashMap
<
String
,
Object
>>
dischargingReviseList
=
dischargingDao
.
groupInfo
(
stationIds
,
regionalCompanyIds
,
startDateTimeOfMonth
,
endDateTimeOfMonth
,
DischargingTypeEnum
.
REVISE_DATA
.
getValue
(),
...
...
@@ -200,10 +210,17 @@ public class DischargingServiceImpl implements DischargingService {
Date
dischargingTime
=
(
Date
)
stringObjectHashMap
.
get
(
"dischargingTime"
);
LocalDate
localDate
=
LocalDateTime
.
ofInstant
(
DateTimeUtils
.
getStartDateTimeOfDay
(
dischargingTime
).
toInstant
(),
ZoneId
.
systemDefault
()).
toLocalDate
();
int
daysOfMonth
=
DateTimeUtils
.
getDaysOfMonth
(
dischargingTime
);
double
dischargingValue
=
Double
.
parseDouble
(
stringObjectHashMap
.
get
(
"sumDischargingWeight"
).
toString
());
double
v
=
dischargingValue
/
daysOfMonth
;
Stream
.
iterate
(
localDate
,
a
->
a
.
plusDays
(
1
)).
limit
(
daysOfMonth
).
forEach
(
f
->
timeValues
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
Date
.
from
(
f
.
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()),
v
))
LocalDateTime
localStartTime
=
LocalDateTime
.
ofInstant
(
startDate
.
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
localEndTime1
=
LocalDateTime
.
ofInstant
(
endDate
.
toInstant
(),
ZoneId
.
systemDefault
());
long
distance
=
ChronoUnit
.
DAYS
.
between
(
localStartTime
,
localEndTime1
);
if
(
distance
<
1
)
{
continue
;
}
Stream
.
iterate
(
localStartTime
,
a
->
a
.
plusDays
(
1
)).
limit
(
distance
).
forEach
(
f
->
timeValues
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
Date
.
from
(
f
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()),
v
))
);
timeValueParentEntity
.
setTimeValues
(
timeValues
);
}
...
...
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/internal/service/ProductionPlanReportServiceImpl.java
View file @
aede7c9e
...
...
@@ -7,6 +7,7 @@ import com.beecode.bcp.type.KClass;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
import
com.beecode.inz.common.BaseConstants
;
import
com.beecode.inz.common.util.DateTimeUtils
;
import
com.beecode.util.DateUtil
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.xyst.dinas.biz.dao.DinasTypeDao
;
...
...
@@ -224,6 +225,15 @@ public class ProductionPlanReportServiceImpl implements ProductionPlanReportServ
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
,
Integer
showType
)
{
//对时间进行处理,如果是按月查询则为月初至月末,不按照查询时间操作
if
(
showType
==
1
){
startDate
=
DateTimeUtils
.
getStartDateTimeOfMonth
(
startDate
);
endDate
=
DateTimeUtils
.
getEndDateTimeOfMonth
(
endDate
);
}
else
if
(
showType
==
2
){
startDate
=
DateTimeUtils
.
getYearStart
(
startDate
);
endDate
=
DateTimeUtils
.
getYearEnd
(
endDate
);
}
List
<
Map
<
String
,
Object
>>
productionList
=
productionPlanReportDao
.
getProductionGroup
(
startDate
,
endDate
,
ids
,
stationIds
,
isGroupByProductionLine
,
isGroupByRegionalCompany
,
isGroupByStation
);
LocalDateTime
localStartDate
=
startDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
LocalDateTime
localEndDate
=
endDate
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
...
...
@@ -276,6 +286,7 @@ public class ProductionPlanReportServiceImpl implements ProductionPlanReportServ
@Override
public
Map
<
String
,
Object
>
getProductionDinasTypeGroup
(
List
<
UUID
>
stationIds
,
List
<
UUID
>
ids
,
Date
startDate
,
Date
endDate
)
{
Map
<
String
,
String
>
productionLineNameMap
;
Set
<
Map
<
String
,
String
>>
productionLineNameSet
=
new
HashSet
<>();
Map
<
UUID
,
DinasTypeParent
>
dinasTypeMap
=
new
HashMap
<>(
12
);
...
...
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/internal/service/SandMiningServiceImpl.java
View file @
aede7c9e
...
...
@@ -248,6 +248,11 @@ public class SandMiningServiceImpl implements SandMiningService {
}
@Override
public
List
<
KObject
>
getListByShipAndWorkDate
(
KObject
kobject
)
{
return
sandMiningDao
.
getListByShipAndWorkDate
(
kobject
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryByShip
(
List
<
Map
<
String
,
Object
>>
shipsTracking
)
{
for
(
Map
<
String
,
Object
>
stringObjectMap
:
shipsTracking
)
{
Object
shipInfoId
=
stringObjectMap
.
get
(
"shipInfoId"
);
...
...
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/service/SandMiningService.java
View file @
aede7c9e
...
...
@@ -37,4 +37,6 @@ public interface SandMiningService {
Map
<
String
,
Object
>
setAreaMap
(
KObject
sandMiningArea
);
List
<
KObject
>
getListByShipAndWorkDate
(
KObject
kobject
);
}
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/web/ProductionPlanReportController.java
View file @
aede7c9e
...
...
@@ -223,8 +223,17 @@ public class ProductionPlanReportController {
public
ResponseObj
getProductionDinasTypeGroup
(
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@RequestParam
(
"startDate"
)
Date
startDate
,
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@RequestParam
(
"endDate"
)
Date
endDate
,
@RequestParam
(
value
=
"ids"
,
required
=
false
)
List
<
UUID
>
ids
,
@RequestParam
(
value
=
"stationIds"
,
required
=
false
)
List
<
UUID
>
stationIds
@RequestParam
(
value
=
"stationIds"
,
required
=
false
)
List
<
UUID
>
stationIds
,
@RequestParam
(
value
=
"showType"
,
required
=
false
)
Integer
showType
){
if
(
1
==
showType
){
startDate
=
DateTimeUtils
.
getStartDateTimeOfMonth
(
startDate
);
endDate
=
DateTimeUtils
.
getEndDateTimeOfMonth
(
endDate
);
}
else
if
(
2
==
showType
){
startDate
=
DateTimeUtils
.
getYearStart
(
startDate
);
endDate
=
DateTimeUtils
.
getYearEnd
(
endDate
);
}
return
ResponseObj
.
success
(
"查询成功"
,
productionPlanReportService
.
getProductionDinasTypeGroup
(
stationIds
,
ids
,
DateTimeUtils
.
getStartDateTimeOfDay
(
startDate
),
DateTimeUtils
.
getEndDateTimeOfDay
(
endDate
)));
}
...
...
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/web/SandMiningController.java
View file @
aede7c9e
...
...
@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.UUID
;
/**
...
...
@@ -51,9 +52,14 @@ public class SandMiningController {
public
ResponseObj
create
(
@RequestBody
String
body
){
KObject
kobject
=
JSONObjectUtils
.
toObject
(
body
,
Amino
.
getApplicationMetadataContext
().
getBean
(
SandMiningConstant
.
ENTITY
,
KClass
.
class
));
//根据船只id查询时间段内有没有相同的
if
(
kobject
.
getUuid
(
"id"
)
==
null
){
return
ResponseObj
.
error
(
400
,
"'id' must be not null!"
);
}
List
<
KObject
>
a
=
sandMiningService
.
getListByShipAndWorkDate
(
kobject
);
if
(
a
.
size
()>
0
){
return
ResponseObj
.
error
(
"500"
,
"该许可证下的船只许可时间与已有数据交叉,请选择其他船只"
);
}
UUID
id
=
sandMiningService
.
addSandMining
(
kobject
);
return
ResponseObj
.
success
(
"保存成功"
,
id
);
}
...
...
@@ -66,6 +72,10 @@ public class SandMiningController {
@PutMapping
public
ResponseObj
update
(
@RequestBody
String
body
){
KObject
kobject
=
JSONObjectUtils
.
toObject
(
body
,
Amino
.
getApplicationMetadataContext
().
getBean
(
SandMiningConstant
.
ENTITY
,
KClass
.
class
));
List
<
KObject
>
a
=
sandMiningService
.
getListByShipAndWorkDate
(
kobject
);
if
(
a
.
size
()>
0
){
return
ResponseObj
.
error
(
"500"
,
"该许可证下的船只许可时间与已有数据交叉,请选择其他船只"
);
}
sandMiningService
.
update
(
kobject
);
return
ResponseObj
.
success
(
"修改成功"
);
}
...
...
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