Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
71eb17f7
Commit
71eb17f7
authored
Dec 21, 2020
by
zhengjiawei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注掉原仓库同步
parent
c5fb067f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
128 additions
and
136 deletions
+128
-136
RiskModelController.java
...oin/amos/fas/business/controller/RiskModelController.java
+13
-13
RiskSourceController.java
...in/amos/fas/business/controller/RiskSourceController.java
+8
-8
EquipManageFeignFallback.java
...oin/amos/fas/business/feign/EquipManageFeignFallback.java
+9
-9
IEquipManageFeign.java
...om/yeejoin/amos/fas/business/feign/IEquipManageFeign.java
+12
-12
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+80
-88
IRiskSourceService.java
...n/amos/fas/business/service/intfc/IRiskSourceService.java
+4
-4
application.properties
...ireAutoSysStart/src/main/resources/application.properties
+2
-2
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskModelController.java
View file @
71eb17f7
...
@@ -86,11 +86,11 @@ public class RiskModelController extends BaseController {
...
@@ -86,11 +86,11 @@ public class RiskModelController extends BaseController {
}
else
{
}
else
{
// 更新的话,就放到前面,更新失败直接阻止本地
// 更新的话,就放到前面,更新失败直接阻止本地
// 如果对于新增修改有什么约束,请添加到远程同步之前
// 如果对于新增修改有什么约束,请添加到远程同步之前
String
synMsg
=
riskSourceService
.
saveToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
//
String synMsg = riskSourceService.saveToEquipManage(getAppKey(), getProduct(), getToken(), SUCCESS,
param
.
getId
(),
param
.
getCode
(),
param
.
getName
(),
param
.
getParentId
());
//
param.getId(), param.getCode(), param.getName(), param.getParentId());
if
(
synMsg
!=
null
)
{
//
if (synMsg != null) {
return
CommonResponseUtil
.
failure
(
synMsg
);
//
return CommonResponseUtil.failure(synMsg);
}
//
}
}
}
AgencyUserModel
user
=
getUserInfo
();
AgencyUserModel
user
=
getUserInfo
();
...
@@ -104,14 +104,14 @@ public class RiskModelController extends BaseController {
...
@@ -104,14 +104,14 @@ public class RiskModelController extends BaseController {
CommonResponse
cr
=
CommonResponseUtil
.
success
(
riskSourceService
.
editRiskSource
(
map
));
CommonResponse
cr
=
CommonResponseUtil
.
success
(
riskSourceService
.
editRiskSource
(
map
));
if
(
id
==
0
)
{
//新增 新增的话,只能放到本地之后,因为必须拿到新增之后的ID才行
if
(
id
==
0
)
{
//新增 新增的话,只能放到本地之后,因为必须拿到新增之后的ID才行
// 如果对于新增修改有什么约束,请添加到远程同步之前
// 如果对于新增修改有什么约束,请添加到远程同步之前
String
synMsg
=
riskSourceService
.
saveToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
//
String synMsg = riskSourceService.saveToEquipManage(getAppKey(), getProduct(), getToken(), SUCCESS,
param
.
getId
(),
param
.
getCode
(),
param
.
getName
(),
param
.
getParentId
());
//
param.getId(), param.getCode(), param.getName(), param.getParentId());
if
(
synMsg
!=
null
)
{
//
if (synMsg != null) {
//远程新增失败,就把本地删了,有点绕,但是没办法
//
//远程新增失败,就把本地删了,有点绕,但是没办法
//由于是刚刚新建的,就直接删除,不做任何不能删校验。
//
//由于是刚刚新建的,就直接删除,不做任何不能删校验。
riskSourceService
.
deleteById
(
param
.
getId
());
//
riskSourceService.deleteById(param.getId());
return
CommonResponseUtil
.
failure
(
synMsg
);
//
return CommonResponseUtil.failure(synMsg);
}
//
}
}
}
return
cr
;
return
cr
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskSourceController.java
View file @
71eb17f7
...
@@ -132,15 +132,15 @@ public class RiskSourceController extends BaseController {
...
@@ -132,15 +132,15 @@ public class RiskSourceController extends BaseController {
public
CommonResponse
synToEquipManage
()
{
public
CommonResponse
synToEquipManage
()
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
compCode
=
getOrgCode
(
reginParams
);
String
compCode
=
getOrgCode
(
reginParams
);
if
(!
riskSourceService
.
isSynEquipManage
())
{
//
if (!riskSourceService.isSynEquipManage()) {
return
CommonResponseUtil
.
failure
(
"同步功能未开启"
);
return
CommonResponseUtil
.
failure
(
"同步功能未开启"
);
}
//
}
List
<
RiskSourceTreeResponse
>
riskSources
=
riskSourceService
.
findRiskSourceTrees
(
compCode
).
stream
().
filter
(
source
->
IS_RISK_AREA
.
equalsIgnoreCase
(
source
.
getIsRegion
())).
collect
(
Collectors
.
toList
());
//
List<RiskSourceTreeResponse> riskSources = riskSourceService.findRiskSourceTrees(compCode).stream().filter(source -> IS_RISK_AREA.equalsIgnoreCase(source.getIsRegion())).collect(Collectors.toList());
String
synMsg
=
riskSourceService
.
synToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
getRiskSourcesTree
(
riskSources
));
//
String synMsg = riskSourceService.synToEquipManage(getAppKey(), getProduct(), getToken(), SUCCESS, getRiskSourcesTree(riskSources));
if
(
synMsg
!=
null
)
{
//
if (synMsg != null) {
return
CommonResponseUtil
.
failure
(
synMsg
);
//
return CommonResponseUtil.failure(synMsg);
}
//
}
return
CommonResponseUtil
.
success
();
//
return CommonResponseUtil.success();
}
}
/**
/**
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/EquipManageFeignFallback.java
View file @
71eb17f7
...
@@ -4,13 +4,13 @@ import com.yeejoin.amos.fas.core.util.CommonResponse;
...
@@ -4,13 +4,13 @@ import com.yeejoin.amos.fas.core.util.CommonResponse;
public
class
EquipManageFeignFallback
implements
IEquipManageFeign
{
public
class
EquipManageFeignFallback
implements
IEquipManageFeign
{
@Override
//
@Override
public
CommonResponse
saveWarehouse
(
String
appKey
,
String
product
,
String
token
,
String
param
)
{
//
public CommonResponse saveWarehouse(String appKey, String product, String token, String param) {
return
null
;
//
return null;
}
//
}
//
@Override
//
@Override
public
CommonResponse
delWarehouse
(
String
appKey
,
String
product
,
String
token
,
String
param
)
{
//
public CommonResponse delWarehouse(String appKey, String product, String token, String param) {
return
null
;
//
return null;
}
//
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/IEquipManageFeign.java
View file @
71eb17f7
...
@@ -23,12 +23,12 @@ public interface IEquipManageFeign {
...
@@ -23,12 +23,12 @@ public interface IEquipManageFeign {
* @author 张展弋
* @author 张展弋
* @date 2020-9-8 15:15:18
* @date 2020-9-8 15:15:18
*/
*/
@RequestMapping
(
value
=
"/equip/warehouse/saveAutoSysSyn"
,
method
=
RequestMethod
.
POST
,
consumes
=
"application/json"
)
//
@RequestMapping(value = "/equip/warehouse/saveAutoSysSyn", method = RequestMethod.POST,consumes = "application/json")
public
CommonResponse
saveWarehouse
(
//
public CommonResponse saveWarehouse(
@RequestHeader
(
name
=
"appKey"
,
required
=
true
)
String
appKey
,
//
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader
(
name
=
"product"
,
required
=
true
)
String
product
,
//
@RequestHeader(name="product",required = true) String product,
@RequestHeader
(
name
=
"token"
,
required
=
true
)
String
token
,
//
@RequestHeader(name="token",required = true) String token,
@RequestBody
String
param
);
//
@RequestBody String param);
/**
/**
*
*
...
@@ -43,11 +43,11 @@ public interface IEquipManageFeign {
...
@@ -43,11 +43,11 @@ public interface IEquipManageFeign {
* @author 张展弋
* @author 张展弋
* @date 2020-9-8 17:43:11
* @date 2020-9-8 17:43:11
*/
*/
@RequestMapping
(
value
=
"/equip/warehouse/deleteAutoSysSyn"
,
method
=
RequestMethod
.
POST
,
consumes
=
"application/json"
)
//
@RequestMapping(value = "/equip/warehouse/deleteAutoSysSyn", method = RequestMethod.POST,consumes = "application/json")
public
CommonResponse
delWarehouse
(
//
public CommonResponse delWarehouse(
@RequestHeader
(
name
=
"appKey"
,
required
=
true
)
String
appKey
,
//
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader
(
name
=
"product"
,
required
=
true
)
String
product
,
//
@RequestHeader(name="product",required = true) String product,
@RequestHeader
(
name
=
"token"
,
required
=
true
)
String
token
,
//
@RequestHeader(name="token",required = true) String token,
@RequestBody
String
riskSourceId
);
//
@RequestBody String riskSourceId);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
71eb17f7
...
@@ -284,77 +284,73 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -284,77 +284,73 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
iRiskSourceDao
.
saveAndFlush
(
riskSource
);
iRiskSourceDao
.
saveAndFlush
(
riskSource
);
return
riskSource
;
return
riskSource
;
}
}
//
// @Value("${equipManage.fegin.isSyn:false}")
// private boolean isSyn;
@Value
(
"${equipManage.fegin.isSyn:false}"
)
// @Override
private
boolean
isSyn
;
// public boolean isSynEquipManage() {
// return isSyn;
@Override
// }
public
boolean
isSynEquipManage
()
{
return
isSyn
;
}
@Override
public
String
synToEquipManage
(
String
appKey
,
String
product
,
String
token
,
String
success
,
List
<
RiskSourceTreeResponse
>
riskSourcesTree
)
{
// 必须使用树形结构,一条一条的树杈到叶子遍历同步,否则底层节点会因为找不到父节点而同步失败
return
doSynToEquipManage
(
appKey
,
product
,
token
,
success
,
riskSourcesTree
);
}
private
String
doSynToEquipManage
(
String
appKey
,
String
product
,
String
token
,
String
success
,
List
<
RiskSourceTreeResponse
>
riskSourcesTree
)
{
// @Override
if
(
riskSourcesTree
==
null
)
{
// public String synToEquipManage(String appKey, String product, String token, String success, List<RiskSourceTreeResponse> riskSourcesTree) {
return
null
;
// // 必须使用树形结构,一条一条的树杈到叶子遍历同步,否则底层节点会因为找不到父节点而同步失败
}
// return doSynToEquipManage(appKey, product, token, success, riskSourcesTree);
String
res
=
null
;
// }
for
(
RiskSourceTreeResponse
rst
:
riskSourcesTree
)
{
//
res
=
saveToEquipManage
(
appKey
,
product
,
token
,
success
,
rst
.
getId
(),
rst
.
getCode
(),
rst
.
getName
(),
rst
.
getParentId
());
// private String doSynToEquipManage(String appKey, String product, String token, String success, List<RiskSourceTreeResponse> riskSourcesTree) {
if
(
res
!=
null
)
{
// if(riskSourcesTree == null) {
return
res
;
// return null;
}
// }
res
=
doSynToEquipManage
(
appKey
,
product
,
token
,
success
,
rst
.
getChildren
());
// String res = null;
if
(
res
!=
null
)
{
// for(RiskSourceTreeResponse rst : riskSourcesTree) {
return
res
;
// res = saveToEquipManage(appKey, product, token, success, rst.getId(), rst.getCode(), rst.getName(), rst.getParentId());
}
// if(res != null) {
}
// return res;
return
null
;
// }
}
// res = doSynToEquipManage(appKey, product, token, success, rst.getChildren());
// if(res != null) {
// return res;
// }
// }
// return null;
// }
/**
/**
*
*
* 风险模型新增及维护时远程同步
* 风险模型新增及维护时远程同步
*
*
* @param id
* @param code
* @param name
* @param parentId
* @return CommonResponse
* @return CommonResponse
* @throws <br>
* @throws <br>
* @author 张展弋
* @author 张展弋
* @date 2020-9-8 15:39:20
* @date 2020-9-8 15:39:20
*/
*/
public
String
saveToEquipManage
(
String
appKey
,
String
product
,
String
token
,
String
success
,
long
id
,
String
code
,
String
name
,
Long
parentId
)
{
//
public String saveToEquipManage(String appKey,String product,String token,String success,long id, String code, String name, Long parentId) {
if
(!
isSynEquipManage
())
{
//
if(!isSynEquipManage()) {
return
null
;
//
return null;
}
//
}
JSONObject
js
=
new
JSONObject
();
//
JSONObject js = new JSONObject();
js
.
put
(
"sourceId"
,
id
);
//
js.put("sourceId", id);
js
.
put
(
"name"
,
name
);
//
js.put("name", name);
js
.
put
(
"sourceCode"
,
code
);
//
js.put("sourceCode", code);
// 这里的parentId和那边系统的不是一回事,这里只是借用传输
//
// 这里的parentId和那边系统的不是一回事,这里只是借用传输
js
.
put
(
"id"
,
parentId
);
//
js.put("id", parentId);
CommonResponse
cr
=
null
;
//
CommonResponse cr = null;
try
{
//
try {
// 父节点id为0表示根节点,对应那边的仓库
//
// 父节点id为0表示根节点,对应那边的仓库
cr
=
equipManageFeign
.
saveWarehouse
(
appKey
,
product
,
token
,
js
.
toString
());
//
cr = equipManageFeign.saveWarehouse(appKey, product, token, js.toString());
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
if
(
cr
==
null
)
{
//
if (cr == null) {
return
"远程调用同步失败,请检查远程系统后重试!"
;
//
return "远程调用同步失败,请检查远程系统后重试!";
}
//
}
if
(!
success
.
equals
(
cr
.
getResult
()))
{
//
if (!success.equals(cr.getResult())) {
return
"远程同步失败,请检查远程系统后重试!附加消息:"
+
cr
.
getMessage
();
//
return "远程同步失败,请检查远程系统后重试!附加消息:" + cr.getMessage();
}
//
}
return
null
;
//
return null;
}
//
}
@Override
@Override
public
void
deleteRiskSource
(
String
appKey
,
String
product
,
String
token
,
String
success
,
Long
[]
riskSourceId
)
throws
Exception
{
public
void
deleteRiskSource
(
String
appKey
,
String
product
,
String
token
,
String
success
,
Long
[]
riskSourceId
)
throws
Exception
{
...
@@ -370,10 +366,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -370,10 +366,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if
(
count
>
0
)
{
if
(
count
>
0
)
{
throw
new
YeeException
(
"该数据有关联子项,请先删除子项数据"
);
throw
new
YeeException
(
"该数据有关联子项,请先删除子项数据"
);
}
}
synMsg
=
deleteToEquipManage
(
appKey
,
product
,
token
,
success
,
rId
);
//
synMsg = deleteToEquipManage(appKey, product, token, success, rId);
if
(
synMsg
!=
null
)
{
//
if(synMsg !=null) {
throw
new
YeeException
(
"远程删除失败,附加消息:"
+
synMsg
);
//
throw new YeeException("远程删除失败,附加消息:" + synMsg);
}
//
}
iRiskSourceDao
.
deleteById
(
rId
);
iRiskSourceDao
.
deleteById
(
rId
);
}
}
//1.重新计算rpn
//1.重新计算rpn
...
@@ -384,6 +380,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -384,6 +380,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
existIds
.
forEach
(
rs:
:
addRiskSourcePointDeleteMessage
);
existIds
.
forEach
(
rs:
:
addRiskSourcePointDeleteMessage
);
}
}
@Override
public
void
deleteById
(
Long
id
)
{
public
void
deleteById
(
Long
id
)
{
iRiskSourceDao
.
deleteById
(
id
);
iRiskSourceDao
.
deleteById
(
id
);
}
}
...
@@ -391,35 +389,30 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -391,35 +389,30 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
*
*
* 风险模型删除时远程同步
* 风险模型删除时远程同步
*
*
* @param appKey
* @param product
* @param token
* @param failed
* @param rId
* @return String
* @return String
* @throws <br>
* @throws <br>
* @author 张展弋
* @author 张展弋
* @date 2020-9-8 17:54:12
* @date 2020-9-8 17:54:12
*/
*/
private
String
deleteToEquipManage
(
String
appKey
,
String
product
,
String
token
,
String
success
,
Long
rId
)
{
//
private String deleteToEquipManage(String appKey,String product,String token,String success,Long rId) {
if
(!
isSynEquipManage
())
{
//
if(!isSynEquipManage()) {
return
null
;
//
return null;
}
//
}
CommonResponse
cr
=
null
;
//
CommonResponse cr = null;
try
{
//
try {
// 父节点id为0表示根节点,对应那边的仓库
//
// 父节点id为0表示根节点,对应那边的仓库
cr
=
equipManageFeign
.
delWarehouse
(
appKey
,
product
,
token
,
rId
.
toString
());
//
cr = equipManageFeign.delWarehouse(appKey, product, token, rId.toString());
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
if
(
cr
==
null
)
{
//
if (cr == null) {
return
"远程调用同步失败,请检查远程系统后重试!"
;
//
return "远程调用同步失败,请检查远程系统后重试!";
}
//
}
if
(!
success
.
equals
(
cr
.
getResult
()))
{
//
if (!success.equals(cr.getResult())) {
return
"远程同步失败,请检查远程系统后重试!附加消息:"
+
cr
.
getMessage
();
//
return "远程同步失败,请检查远程系统后重试!附加消息:" + cr.getMessage();
}
//
}
return
null
;
//
return null;
}
//
}
@Override
@Override
public
Page
<
HashMap
<
String
,
Object
>>
queryRiskSourceByPage
(
CommonPageInfoParam
param
)
{
public
Page
<
HashMap
<
String
,
Object
>>
queryRiskSourceByPage
(
CommonPageInfoParam
param
)
{
...
@@ -1103,7 +1096,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1103,7 +1096,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
/**
/**
* 设备消息规则推送
* 设备消息规则推送
*
*
* @param protalData
*/
*/
@Async
@Async
void
fireEquipRuleMessagePush
(
AlarmParam
deviceData
,
Toke
toke
)
{
void
fireEquipRuleMessagePush
(
AlarmParam
deviceData
,
Toke
toke
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IRiskSourceService.java
View file @
71eb17f7
...
@@ -44,8 +44,8 @@ public interface IRiskSourceService {
...
@@ -44,8 +44,8 @@ public interface IRiskSourceService {
* @author 张展弋
* @author 张展弋
* @date 2020-9-8 17:39:32
* @date 2020-9-8 17:39:32
*/
*/
String
saveToEquipManage
(
String
appKey
,
String
product
,
String
token
,
String
success
,
long
id
,
//
String saveToEquipManage(String appKey, String product, String token, String success, long id,
String
code
,
String
name
,
Long
parentId
);
//
String code, String name, Long parentId);
/**
/**
* 将本地 风险模型推送到远程同步
* 将本地 风险模型推送到远程同步
...
@@ -60,7 +60,7 @@ public interface IRiskSourceService {
...
@@ -60,7 +60,7 @@ public interface IRiskSourceService {
* @author 张展弋
* @author 张展弋
* @date 2020-9-9 15:40:18
* @date 2020-9-9 15:40:18
*/
*/
String
synToEquipManage
(
String
appKey
,
String
product
,
String
token
,
String
success
,
List
<
RiskSourceTreeResponse
>
riskSourcesTree
);
//
String synToEquipManage(String appKey, String product, String token, String success, List<RiskSourceTreeResponse> riskSourcesTree);
/**
/**
*
*
...
@@ -71,7 +71,7 @@ public interface IRiskSourceService {
...
@@ -71,7 +71,7 @@ public interface IRiskSourceService {
* @author 张展弋
* @author 张展弋
* @date 2020-9-8 15:45:34
* @date 2020-9-8 15:45:34
*/
*/
boolean
isSynEquipManage
();
//
boolean isSynEquipManage();
/**
/**
* 删除风险点
* 删除风险点
*/
*/
...
...
YeeAmosFireAutoSysStart/src/main/resources/application.properties
View file @
71eb17f7
spring.application.name
=
AMOS-AUTOSYS
spring.application.name
=
AMOS-AUTOSYS
-1225
server.port
=
8083
server.port
=
8083
spring.profiles.active
=
dev
spring.profiles.active
=
dev
#应用product appkey
#应用product appkey
...
@@ -49,7 +49,7 @@ visual.fegin.name=maas-visual
...
@@ -49,7 +49,7 @@ visual.fegin.name=maas-visual
#值班系统
#值班系统
dutyMode.fegin.name
=
AMOS-DUTYMODE
dutyMode.fegin.name
=
AMOS-DUTYMODE
#队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统
#队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统
equipManage.fegin.name
=
AMOS-EQUIPMANAGE
equipManage.fegin.name
=
AMOS-EQUIPMANAGE
-1225
#jpush 服务名称
#jpush 服务名称
...
...
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