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
5194faa7
Commit
5194faa7
authored
Jun 11, 2021
by
shiwenbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改合同预警和库存预警的模板消息
parent
2803b252
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
14 deletions
+48
-14
AdvanceBalanceWarningCalculator.java
.../dinas/contract/warn/AdvanceBalanceWarningCalculator.java
+5
-4
ContractExpireWarningCalculator.java
.../dinas/contract/warn/ContractExpireWarningCalculator.java
+6
-4
DinasCountWarningCalculate.java
.../xyst/dinas/contract/warn/DinasCountWarningCalculate.java
+14
-1
DinasCountWarningCalculator.java
...xyst/dinas/contract/warn/DinasCountWarningCalculator.java
+5
-2
StockAmountWarnCalculate.java
.../xyst/dinas/sales/processor/StockAmountWarnCalculate.java
+11
-2
StockAmountWarnCalculator.java
...xyst/dinas/sales/processor/StockAmountWarnCalculator.java
+7
-1
No files found.
backend/xyst.dinas.contract/src/main/java/com/xyst/dinas/contract/warn/AdvanceBalanceWarningCalculator.java
View file @
5194faa7
...
@@ -28,14 +28,15 @@ public class AdvanceBalanceWarningCalculator implements IWarningCalculator{
...
@@ -28,14 +28,15 @@ public class AdvanceBalanceWarningCalculator implements IWarningCalculator{
public
boolean
isWarning
(
WarnSetting
warnSetting
)
{
public
boolean
isWarning
(
WarnSetting
warnSetting
)
{
String
min
=
warnSetting
.
getMin
();
String
min
=
warnSetting
.
getMin
();
String
target
=
warnSetting
.
getTarget
();
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contract
=
contractService
.
getLastContractByInfoId
(
contractInfo
.
getUuid
(
"id"
));
KObject
contract
=
contractService
.
getExecutingContractByContractInfoId
(
contractInfo
.
getUuid
(
"id"
));
String
purchaseSandUnitName
=
contract
.
get
(
"purchaseSandUnit"
).
getString
(
"name"
);
String
projectName
=
contract
.
get
(
"project"
).
getString
(
"projectName"
);
String
contractName
=
contract
.
getString
(
"contractName"
);
advanceBalance
=
contract
.
getDouble
(
ContractConstant
.
ADVANCE_BALANCE
);
advanceBalance
=
contract
.
getDouble
(
ContractConstant
.
ADVANCE_BALANCE
);
if
(
advanceBalance
<
Double
.
valueOf
(
min
))
{
if
(
advanceBalance
<
Double
.
valueOf
(
min
))
{
String
contractCode
=
contract
.
getString
(
ContractConstant
.
CONTRACT_CODE
);
warnMessage
=
purchaseSandUnitName
+
"下"
+
projectName
+
"的"
+
contractName
+
"中预付款余额不足"
+
min
+
"元。"
;
warnMessage
=
"编号["
+
contractCode
+
"]"
+
"的合同"
+
target
+
"为"
+
advanceBalance
+
",已不足"
+
min
+
"!"
;
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
backend/xyst.dinas.contract/src/main/java/com/xyst/dinas/contract/warn/ContractExpireWarningCalculator.java
View file @
5194faa7
...
@@ -35,18 +35,20 @@ public class ContractExpireWarningCalculator implements IWarningCalculator{
...
@@ -35,18 +35,20 @@ public class ContractExpireWarningCalculator implements IWarningCalculator{
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contract
=
contractService
.
getLastContractByInfoId
(
contractInfo
.
getUuid
(
"id"
));
KObject
contract
=
contractService
.
getExecutingContractByContractInfoId
(
contractInfo
.
getUuid
(
"id"
));
String
purchaseSandUnitName
=
contract
.
get
(
"purchaseSandUnit"
).
getString
(
"name"
);
String
projectName
=
contract
.
get
(
"project"
).
getString
(
"projectName"
);
String
contractName
=
contract
.
getString
(
"contractName"
);
Date
endDate
=
contract
.
getDate
(
ContractConstant
.
endDate
);
Date
endDate
=
contract
.
getDate
(
ContractConstant
.
endDate
);
Date
now
=
new
Date
();
Date
now
=
new
Date
();
diffDays
=
(
int
)
((
endDate
.
getTime
()
-
now
.
getTime
())
/
millisOfDay
);
diffDays
=
(
int
)
((
endDate
.
getTime
()
-
now
.
getTime
())
/
millisOfDay
);
if
(
diffDays
<
Integer
.
valueOf
(
min
))
{
if
(
diffDays
<
Integer
.
valueOf
(
min
))
{
int
value
=
diffDays
-
Integer
.
valueOf
(
min
);
int
value
=
diffDays
-
Integer
.
valueOf
(
min
);
String
contractCode
=
contract
.
getString
(
ContractConstant
.
CONTRACT_CODE
);
if
(
value
>=
0
)
{
if
(
value
>=
0
)
{
warnMessage
=
"编号["
+
contractCode
+
"]"
+
"的合同还有"
+
value
+
"天到期!
"
;
warnMessage
=
purchaseSandUnitName
+
"下"
+
projectName
+
"的"
+
contractName
+
"还有"
+
value
+
"天到期。
"
;
}
else
{
}
else
{
warnMessage
=
"编号["
+
contractCode
+
"]"
+
"的合同已经过期"
+
Math
.
abs
(
value
)+
"天!
"
;
warnMessage
=
purchaseSandUnitName
+
"下"
+
projectName
+
"的"
+
contractName
+
"已经过期"
+
Math
.
abs
(
value
)+
"天。
"
;
}
}
return
true
;
return
true
;
}
}
...
...
backend/xyst.dinas.contract/src/main/java/com/xyst/dinas/contract/warn/DinasCountWarningCalculate.java
View file @
5194faa7
package
com
.
xyst
.
dinas
.
contract
.
warn
;
package
com
.
xyst
.
dinas
.
contract
.
warn
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.beecode.bcp.type.KObject
;
import
com.xyst.dinas.biz.warn.IWarningCalculator
;
import
com.xyst.dinas.biz.warn.IWarningCalculator
;
import
com.xyst.dinas.biz.warn.WarnSetting
;
import
com.xyst.dinas.biz.warn.WarnSetting
;
import
com.xyst.dinas.contract.service.ContractService
;
/**
/**
* 砂石余量预警计算器
* 砂石余量预警计算器
...
@@ -16,6 +20,9 @@ public class DinasCountWarningCalculate implements IWarningCalculator{
...
@@ -16,6 +20,9 @@ public class DinasCountWarningCalculate implements IWarningCalculator{
private
String
warnMessage
;
private
String
warnMessage
;
@Autowired
private
ContractService
contractService
;
/**
/**
* 砂石余量预警计算器
* 砂石余量预警计算器
* @param dinsaCount 砂石余量
* @param dinsaCount 砂石余量
...
@@ -31,9 +38,15 @@ public class DinasCountWarningCalculate implements IWarningCalculator{
...
@@ -31,9 +38,15 @@ public class DinasCountWarningCalculate implements IWarningCalculator{
String
min
=
warnSetting
.
getMin
();
String
min
=
warnSetting
.
getMin
();
String
target
=
warnSetting
.
getTarget
();
String
target
=
warnSetting
.
getTarget
();
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contract
=
contractService
.
getExecutingContractByContractInfoId
(
contractInfo
.
getUuid
(
"id"
));
String
purchaseSandUnitName
=
contract
.
get
(
"purchaseSandUnit"
).
getString
(
"name"
);
String
projectName
=
contract
.
get
(
"project"
).
getString
(
"projectName"
);
String
contractName
=
contract
.
getString
(
"contractName"
);
//业务数据与设置的阀值做比较,计算是否预警
//业务数据与设置的阀值做比较,计算是否预警
if
(
dinsaCount
<=
Double
.
valueOf
(
min
))
{
if
(
dinsaCount
<=
Double
.
valueOf
(
min
))
{
warnMessage
=
"["
+
target
+
"]"
+
"的当前余量为"
+
dinsaCount
+
",已不足"
+
min
+
"吨!
"
;
warnMessage
=
purchaseSandUnitName
+
"下"
+
projectName
+
"的"
+
contractName
+
"中"
+
target
+
"余量不足"
+
min
+
"吨。
"
;
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
backend/xyst.dinas.contract/src/main/java/com/xyst/dinas/contract/warn/DinasCountWarningCalculator.java
View file @
5194faa7
...
@@ -36,7 +36,10 @@ public class DinasCountWarningCalculator implements IWarningCalculator{
...
@@ -36,7 +36,10 @@ public class DinasCountWarningCalculator implements IWarningCalculator{
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contractInfo
=
contractService
.
queryContractInfo
(
warnSetting
.
getBillId
());
KObject
contract
=
contractService
.
getLastContractByInfoId
(
contractInfo
.
getUuid
(
"id"
));
KObject
contract
=
contractService
.
getExecutingContractByContractInfoId
(
contractInfo
.
getUuid
(
"id"
));
String
purchaseSandUnitName
=
contract
.
get
(
"purchaseSandUnit"
).
getString
(
"name"
);
String
projectName
=
contract
.
get
(
"project"
).
getString
(
"projectName"
);
String
contractName
=
contract
.
getString
(
"contractName"
);
List
<
KObject
>
details
=
contract
.
get
(
ContractConstant
.
CONTRACT_DETAILS
).
toList
();
List
<
KObject
>
details
=
contract
.
get
(
ContractConstant
.
CONTRACT_DETAILS
).
toList
();
for
(
KObject
detail
:
details
)
{
for
(
KObject
detail
:
details
)
{
String
dinasTypeName
=
detail
.
get
(
ContractConstant
.
dinasType
).
getString
(
DinasTypeConstant
.
DINASTYPE_NAME
);
String
dinasTypeName
=
detail
.
get
(
ContractConstant
.
dinasType
).
getString
(
DinasTypeConstant
.
DINASTYPE_NAME
);
...
@@ -44,7 +47,7 @@ public class DinasCountWarningCalculator implements IWarningCalculator{
...
@@ -44,7 +47,7 @@ public class DinasCountWarningCalculator implements IWarningCalculator{
//业务数据与设置的阀值做比较,计算是否预警
//业务数据与设置的阀值做比较,计算是否预警
dinasAmount
=
detail
.
getDouble
(
ContractConstant
.
DINAS_AMOUNT
);
dinasAmount
=
detail
.
getDouble
(
ContractConstant
.
DINAS_AMOUNT
);
if
(
dinasAmount
<=
Double
.
valueOf
(
min
))
{
if
(
dinasAmount
<=
Double
.
valueOf
(
min
))
{
warnMessage
=
"["
+
target
+
"]"
+
"的当前余量为"
+
dinasAmount
+
",已不足"
+
min
+
"吨!
"
;
warnMessage
=
purchaseSandUnitName
+
"下"
+
projectName
+
"的"
+
contractName
+
"中"
+
target
+
"余量不足"
+
min
+
"吨。
"
;
return
true
;
return
true
;
}
}
}
}
...
...
backend/xyst.dinas.sales/src/main/java/com/xyst/dinas/sales/processor/StockAmountWarnCalculate.java
View file @
5194faa7
package
com
.
xyst
.
dinas
.
sales
.
processor
;
package
com
.
xyst
.
dinas
.
sales
.
processor
;
import
java.util.UUID
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.beecode.bcp.type.KObject
;
import
com.xyst.dinas.biz.service.StationService
;
import
com.xyst.dinas.biz.warn.IWarningCalculator
;
import
com.xyst.dinas.biz.warn.IWarningCalculator
;
import
com.xyst.dinas.biz.warn.WarnSetting
;
import
com.xyst.dinas.biz.warn.WarnSetting
;
...
@@ -17,7 +23,8 @@ public class StockAmountWarnCalculate implements IWarningCalculator{
...
@@ -17,7 +23,8 @@ public class StockAmountWarnCalculate implements IWarningCalculator{
private
String
warnMessage
;
private
String
warnMessage
;
@Autowired
private
StationService
stationService
;
public
StockAmountWarnCalculate
(
double
stockAmount
)
{
public
StockAmountWarnCalculate
(
double
stockAmount
)
{
this
.
stockAmount
=
stockAmount
;
this
.
stockAmount
=
stockAmount
;
...
@@ -26,10 +33,12 @@ public class StockAmountWarnCalculate implements IWarningCalculator{
...
@@ -26,10 +33,12 @@ public class StockAmountWarnCalculate implements IWarningCalculator{
@Override
@Override
public
boolean
isWarning
(
WarnSetting
warnSetting
)
{
public
boolean
isWarning
(
WarnSetting
warnSetting
)
{
String
min
=
warnSetting
.
getMin
();
String
min
=
warnSetting
.
getMin
();
UUID
stationId
=
warnSetting
.
getBillId
();
String
dinasTypeName
=
warnSetting
.
getTarget
();
String
dinasTypeName
=
warnSetting
.
getTarget
();
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
KObject
station
=
stationService
.
getById
(
stationId
);
if
(
stockAmount
<
Double
.
valueOf
(
min
))
{
if
(
stockAmount
<
Double
.
valueOf
(
min
))
{
warnMessage
=
"["
+
dinasTypeName
+
"]"
+
"的当前库存量为"
+
stockAmount
+
",已不足"
+
min
+
"吨!
"
;
warnMessage
=
station
.
getString
(
"stationName"
)
+
"的"
+
dinasTypeName
+
"库存不足"
+
min
+
"吨,请注意。
"
;
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
backend/xyst.dinas.sales/src/main/java/com/xyst/dinas/sales/processor/StockAmountWarnCalculator.java
View file @
5194faa7
...
@@ -4,6 +4,8 @@ import java.util.UUID;
...
@@ -4,6 +4,8 @@ import java.util.UUID;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.beecode.bcp.type.KObject
;
import
com.xyst.dinas.biz.service.StationService
;
import
com.xyst.dinas.biz.warn.IWarningCalculator
;
import
com.xyst.dinas.biz.warn.IWarningCalculator
;
import
com.xyst.dinas.biz.warn.WarnSetting
;
import
com.xyst.dinas.biz.warn.WarnSetting
;
import
com.xyst.dinas.sales.service.InventoryService
;
import
com.xyst.dinas.sales.service.InventoryService
;
...
@@ -19,6 +21,9 @@ public class StockAmountWarnCalculator implements IWarningCalculator{
...
@@ -19,6 +21,9 @@ public class StockAmountWarnCalculator implements IWarningCalculator{
@Autowired
@Autowired
private
InventoryService
inventoryService
;
private
InventoryService
inventoryService
;
@Autowired
private
StationService
stationService
;
//砂石库存量
//砂石库存量
private
double
stockAmount
;
private
double
stockAmount
;
...
@@ -31,8 +36,9 @@ public class StockAmountWarnCalculator implements IWarningCalculator{
...
@@ -31,8 +36,9 @@ public class StockAmountWarnCalculator implements IWarningCalculator{
String
dinasTypeName
=
warnSetting
.
getTarget
();
String
dinasTypeName
=
warnSetting
.
getTarget
();
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
if
(
min
==
null
||
min
.
trim
().
length
()==
0
)
return
false
;
stockAmount
=
inventoryService
.
getStockAmountByDinas
(
stationId
,
dinasTypeName
);
stockAmount
=
inventoryService
.
getStockAmountByDinas
(
stationId
,
dinasTypeName
);
KObject
station
=
stationService
.
getById
(
stationId
);
if
(
stockAmount
<
Double
.
valueOf
(
min
))
{
if
(
stockAmount
<
Double
.
valueOf
(
min
))
{
warnMessage
=
"["
+
dinasTypeName
+
"]"
+
"的当前库存量为"
+
stockAmount
+
",已不足"
+
min
+
"吨!
"
;
warnMessage
=
station
.
getString
(
"stationName"
)
+
"的"
+
dinasTypeName
+
"库存不足"
+
min
+
"吨,请注意。
"
;
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
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