Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
a59e2e2b
Commit
a59e2e2b
authored
Apr 13, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步优化初步2
parent
f0d23320
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
24 deletions
+97
-24
DealSyncOperationApiService.java
...aoban/manage/api/service/DealSyncOperationApiService.java
+8
-2
DealSyncOperationApiServiceImpl.java
...ice/service/out/impl/DealSyncOperationApiServiceImpl.java
+86
-3
SyncDealContoller.java
...m/gic/haoban/manage/web/controller/SyncDealContoller.java
+3
-19
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DealSyncOperationApiService.java
View file @
a59e2e2b
...
...
@@ -32,8 +32,14 @@ public interface DealSyncOperationApiService {
*/
public
void
dealDepartment
(
String
taskId
,
String
wxEnterpriseId
,
List
<
SyncSingleDealDTO
>
addList
,
List
<
SyncSingleDealDTO
>
editList
);
// public void createTask()
/**
* 创建任务
*
* @param taskName
* @param userId
* @param desc
*/
public
String
createTask
(
String
taskName
,
String
userId
,
String
desc
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DealSyncOperationApiServiceImpl.java
View file @
a59e2e2b
...
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.dto.StoreGroupDTO
;
import
com.gic.enterprise.api.service.StoreGroupService
;
...
...
@@ -80,14 +81,14 @@ public class DealSyncOperationApiServiceImpl extends AbstractTaskAllocationNewOp
}
//部门处理
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
group
.
getVal
()))
{
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectById
(
dataPre
.
getDataId
());
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectBy
Related
Id
(
dataPre
.
getDataId
());
if
(
departmentDTO
!=
null
)
{
logger
.
info
(
"已经同步过了:{}"
,
dataPre
.
getDataId
());
dealExceptionDepartmenr
(
dealParamMqDTO
.
getTaskId
(),
dealParamMqDTO
.
getData
(),
dataPre
.
getEnterpriseId
(),
"该部门不存在"
);
return
;
}
TabHaobanDepartment
pParentDepartment
=
departmentService
.
selectById
(
dataPre
.
getpDataId
());
TabHaobanDepartment
pParentDepartment
=
departmentService
.
selectBy
Related
Id
(
dataPre
.
getpDataId
());
if
(
null
==
pParentDepartment
)
{
logger
.
info
(
"不存在该父部门:c:{},p:{}"
,
dataPre
.
getDataId
(),
dataPre
.
getpDataId
());
return
;
...
...
@@ -130,11 +131,80 @@ public class DealSyncOperationApiServiceImpl extends AbstractTaskAllocationNewOp
}
}
//门店处理
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
group
.
getVal
()))
{
logger
.
info
(
"门店处理:{}"
,
params
);
storeDealSingle
(
dealParamMqDTO
,
dataPre
);
//成员处理
}
else
if
(
dataPre
.
getDataType
().
equals
(
PreDealTypeEnum
.
group
.
getVal
()))
{
logger
.
info
(
"店员处理:{}"
,
params
);
}
else
{
logger
.
info
(
"不是正常数据"
);
}
}
/**
* 门店处理
*
* @param dealParamMqDTO
* @param dataPre
*/
private
void
storeDealSingle
(
DealParamMqDTO
dealParamMqDTO
,
TabHaobanPreDealLog
dataPre
)
{
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectByRelatedId
(
dataPre
.
getDataId
());
if
(
departmentDTO
!=
null
)
{
logger
.
info
(
"已经同步过了:{}"
,
dataPre
.
getDataId
());
dealExceptionDepartmenr
(
dealParamMqDTO
.
getTaskId
(),
dealParamMqDTO
.
getData
(),
dataPre
.
getEnterpriseId
(),
"该部门不存在"
);
return
;
}
TabHaobanDepartment
pParentDepartment
=
departmentService
.
selectByRelatedId
(
dataPre
.
getpDataId
());
if
(
null
==
pParentDepartment
)
{
logger
.
info
(
"不存在该父部门:c:{},p:{}"
,
dataPre
.
getDataId
(),
dataPre
.
getpDataId
());
return
;
}
StoreDTO
store
=
storeService
.
getStore
(
dealParamMqDTO
.
getData
());
if
(
null
==
store
)
{
logger
.
info
(
"该门店不存在"
);
dealExceptionDepartmenr
(
dealParamMqDTO
.
getTaskId
(),
dealParamMqDTO
.
getData
(),
dataPre
.
getEnterpriseId
(),
"该部门不存在"
);
return
;
}
DepartmentDTO
department
=
new
DepartmentDTO
();
department
.
setParentDepartmentId
(
pParentDepartment
.
getDepartmentId
());
department
.
setWxEnterpriseId
(
pParentDepartment
.
getWxEnterpriseId
());
department
.
setDepartmentName
(
store
.
getStoreName
());
department
.
setChainId
(
pParentDepartment
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
dealParamMqDTO
.
getData
());
department
.
setChainName
(
pParentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
department
.
getDepartmentName
());
department
.
setIsStore
(
1
);
department
.
setLevel
(
pParentDepartment
.
getLevel
()
+
1
);
department
.
setRelatedId
(
dealParamMqDTO
.
getData
());
//状态 处理状态
boolean
resultFlag
=
true
;
try
{
ServiceResponse
add
=
departmentApiService
.
add
(
department
);
if
(
add
.
getCode
()
!=
1
)
{
resultFlag
=
false
;
logger
.
info
(
"处理失败"
);
return
;
}
}
catch
(
Exception
e
)
{
resultFlag
=
false
;
e
.
printStackTrace
();
logger
.
info
(
"处理异常"
);
}
finally
{
if
(!
resultFlag
)
{
dealExceptionDepartmenr
(
dealParamMqDTO
.
getTaskId
(),
dealParamMqDTO
.
getData
(),
dataPre
.
getEnterpriseId
(),
"处理异常或失败"
);
}
else
{
dealSuccessDepartmenr
(
dealParamMqDTO
.
getTaskId
(),
dealParamMqDTO
.
getData
(),
dataPre
.
getWxEnterpriseId
());
}
}
}
/**
* 校验部门同步任务成功与否
*
* @param taskId
...
...
@@ -185,7 +255,7 @@ public class DealSyncOperationApiServiceImpl extends AbstractTaskAllocationNewOp
}
/**
* 部门
异常
处理
* 部门
成功
处理
*
* @param dataId
*/
...
...
@@ -240,6 +310,19 @@ public class DealSyncOperationApiServiceImpl extends AbstractTaskAllocationNewOp
}
@Override
public
String
createTask
(
String
taskName
,
String
userId
,
String
desc
)
{
TabHaobanSyncTask
tabHaobanSyncTask
=
new
TabHaobanSyncTask
();
tabHaobanSyncTask
.
setAddUser
(
userId
);
tabHaobanSyncTask
.
setTaskName
(
taskName
);
tabHaobanSyncTask
.
setTaskDesc
(
desc
);
tabHaobanSyncTask
.
setStatusFlag
(
SyncTaskStatusEnum
.
init
.
getVal
());
tabHaobanSyncTask
.
setTaskId
(
ToolUtil
.
randomUUID
());
syncTaskService
.
createTask
(
tabHaobanSyncTask
);
return
tabHaobanSyncTask
.
getTaskId
();
}
/**
* 处理修改数据
*
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/SyncDealContoller.java
View file @
a59e2e2b
...
...
@@ -23,27 +23,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/
sync
"
)
@RequestMapping
(
"/
test
"
)
public
class
SyncDealContoller
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
SyncDealContoller
.
class
);
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
StoreGroupService
storeGroupService
;
@Autowired
private
StoreService
storeService
;
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
...
...
@@ -58,7 +41,8 @@ public class SyncDealContoller extends WebBaseController {
if
(
RedisUtil
.
getCache
(
key
)
!=
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10011
);
}
dealSyncOperationApiService
.
dealDepartment
(
"111"
,
login
.
getWxEnterpriseId
(),
qo
.
getAddDepartment
(),
qo
.
getEditDepartment
());
String
task
=
dealSyncOperationApiService
.
createTask
(
"门店同步"
,
login
.
getStaffDTO
().
getStaffId
(),
"部门同步"
);
dealSyncOperationApiService
.
dealDepartment
(
task
,
login
.
getWxEnterpriseId
(),
qo
.
getAddDepartment
(),
qo
.
getEditDepartment
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
key
);
...
...
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