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
95194de3
Commit
95194de3
authored
Feb 12, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
部门同步调整
parent
0b8225c2
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
413 additions
and
8 deletions
+413
-8
DepartmentDTO.java
...ain/java/com/gic/haoban/manage/api/dto/DepartmentDTO.java
+22
-0
DepartmentMapper.java
...ic/haoban/manage/service/dao/mapper/DepartmentMapper.java
+6
-1
StaffDepartmentRelatedMapper.java
...nage/service/dao/mapper/StaffDepartmentRelatedMapper.java
+5
-0
TabHaobanDepartment.java
...gic/haoban/manage/service/entity/TabHaobanDepartment.java
+21
-0
StaffDepartmentRelatedService.java
...manage/service/service/StaffDepartmentRelatedService.java
+6
-0
DepartmentApiServiceImpl.java
...manage/service/service/impl/DepartmentApiServiceImpl.java
+21
-1
DepartmentServiceImpl.java
...anage/service/service/out/impl/DepartmentServiceImpl.java
+11
-1
StaffDepartmentRelatedServiceImpl.java
...e/service/out/impl/StaffDepartmentRelatedServiceImpl.java
+15
-1
DepartmentMapper.xml
...e3-service/src/main/resources/mapper/DepartmentMapper.xml
+34
-3
StaffDepartmentRelatedMapper.xml
...rc/main/resources/mapper/StaffDepartmentRelatedMapper.xml
+9
-0
DepartmentContoller.java
...gic/haoban/manage/web/controller/DepartmentContoller.java
+126
-1
WebBaseController.java
...m/gic/haoban/manage/web/controller/WebBaseController.java
+7
-0
DepartmentAddQO.java
...in/java/com/gic/haoban/manage/web/qo/DepartmentAddQO.java
+49
-0
DepartmentDelQO.java
...in/java/com/gic/haoban/manage/web/qo/DepartmentDelQO.java
+22
-0
DepartmentEditQO.java
...n/java/com/gic/haoban/manage/web/qo/DepartmentEditQO.java
+59
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/DepartmentDTO.java
View file @
95194de3
...
@@ -26,6 +26,10 @@ public class DepartmentDTO implements Serializable {
...
@@ -26,6 +26,10 @@ public class DepartmentDTO implements Serializable {
private
Date
updateTime
;
private
Date
updateTime
;
private
String
wxDepartmentId
;
private
String
wxDepartmentId
;
private
Integer
level
;
private
Integer
sort
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -117,4 +121,22 @@ public class DepartmentDTO implements Serializable {
...
@@ -117,4 +121,22 @@ public class DepartmentDTO implements Serializable {
this
.
wxDepartmentId
=
wxDepartmentId
;
this
.
wxDepartmentId
=
wxDepartmentId
;
}
}
public
Integer
getLevel
()
{
return
level
;
}
public
void
setLevel
(
Integer
level
)
{
this
.
level
=
level
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/DepartmentMapper.java
View file @
95194de3
...
@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper;
...
@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper;
import
java.util.List
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
public
interface
DepartmentMapper
{
public
interface
DepartmentMapper
{
...
@@ -17,5 +19,7 @@ public interface DepartmentMapper {
...
@@ -17,5 +19,7 @@ public interface DepartmentMapper {
int
updateByPrimaryKey
(
TabHaobanDepartment
record
);
int
updateByPrimaryKey
(
TabHaobanDepartment
record
);
List
<
TabHaobanDepartment
>
listByParentId
(
String
parentId
);
List
<
TabHaobanDepartment
>
listByParentId
(
@Param
(
"parentId"
)
String
parentId
);
int
selectMaxSort
(
@Param
(
"parentDepartmentId"
)
String
parentDepartmentId
);
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffDepartmentRelatedMapper.java
View file @
95194de3
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
import
java.util.List
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
public
interface
StaffDepartmentRelatedMapper
{
public
interface
StaffDepartmentRelatedMapper
{
...
@@ -14,4 +16,6 @@ public interface StaffDepartmentRelatedMapper {
...
@@ -14,4 +16,6 @@ public interface StaffDepartmentRelatedMapper {
int
updateByPrimaryKeySelective
(
TabHaobanStaffDepartmentRelated
record
);
int
updateByPrimaryKeySelective
(
TabHaobanStaffDepartmentRelated
record
);
int
updateByPrimaryKey
(
TabHaobanStaffDepartmentRelated
record
);
int
updateByPrimaryKey
(
TabHaobanStaffDepartmentRelated
record
);
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentId
(
String
departmentId
);
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabHaobanDepartment.java
View file @
95194de3
...
@@ -25,6 +25,10 @@ public class TabHaobanDepartment implements Serializable {
...
@@ -25,6 +25,10 @@ public class TabHaobanDepartment implements Serializable {
private
Date
updateTime
;
private
Date
updateTime
;
private
String
wxDepartmentId
;
private
String
wxDepartmentId
;
private
Integer
level
;
private
Integer
sort
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -115,6 +119,22 @@ public class TabHaobanDepartment implements Serializable {
...
@@ -115,6 +119,22 @@ public class TabHaobanDepartment implements Serializable {
public
void
setWxDepartmentId
(
String
wxDepartmentId
)
{
public
void
setWxDepartmentId
(
String
wxDepartmentId
)
{
this
.
wxDepartmentId
=
wxDepartmentId
;
this
.
wxDepartmentId
=
wxDepartmentId
;
}
}
public
Integer
getLevel
()
{
return
level
;
}
public
void
setLevel
(
Integer
level
)
{
this
.
level
=
level
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffDepartmentRelatedService.java
View file @
95194de3
package
com
.
gic
.
haoban
.
manage
.
service
.
service
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
;
import
java.util.List
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
public
interface
StaffDepartmentRelatedService
{
public
interface
StaffDepartmentRelatedService
{
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentId
(
String
departmentId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/DepartmentApiServiceImpl.java
View file @
95194de3
...
@@ -13,13 +13,17 @@ import com.gic.haoban.common.utils.StringUtil;
...
@@ -13,13 +13,17 @@ import com.gic.haoban.common.utils.StringUtil;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
@Service
@Service
public
class
DepartmentApiServiceImpl
implements
DepartmentApiService
{
public
class
DepartmentApiServiceImpl
implements
DepartmentApiService
{
@Autowired
@Autowired
private
DepartmentService
departmentService
;
private
DepartmentService
departmentService
;
@Autowired
private
StaffDepartmentRelatedService
staffDepartmentService
;
@Override
@Override
public
List
<
DepartmentDTO
>
listByParentId
(
String
parentId
)
{
public
List
<
DepartmentDTO
>
listByParentId
(
String
parentId
)
{
...
@@ -46,7 +50,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
...
@@ -46,7 +50,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
return
hr
;
return
hr
;
}
}
department
.
setWxDepartmentId
(
wxDepartmentId
);
department
.
setWxDepartmentId
(
wxDepartmentId
);
departmentService
.
add
(
department
);
String
departmentId
=
departmentService
.
add
(
department
);
department
.
setDepartmentId
(
departmentId
);
hr
.
setResult
(
department
);
return
hr
;
return
hr
;
}
}
...
@@ -77,6 +83,20 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
...
@@ -77,6 +83,20 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
hr
.
setMessage
(
"微信删除部门失败"
);
hr
.
setMessage
(
"微信删除部门失败"
);
return
hr
;
return
hr
;
}
}
List
<
TabHaobanDepartment
>
list
=
departmentService
.
listByParentId
(
departmentId
);
if
(!
list
.
isEmpty
())
{
hr
.
setErrorCode
(
0
);
hr
.
setMessage
(
"存在子部门,删除部门失败"
);
return
hr
;
}
List
<
TabHaobanStaffDepartmentRelated
>
staffList
=
staffDepartmentService
.
listByDepartmentId
(
departmentId
);
if
(!
staffList
.
isEmpty
())
{
hr
.
setErrorCode
(
0
);
hr
.
setMessage
(
"存在成员,删除部门失败"
);
return
hr
;
}
departmentService
.
del
(
departmentId
);
departmentService
.
del
(
departmentId
);
return
hr
;
return
hr
;
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentServiceImpl.java
View file @
95194de3
...
@@ -35,6 +35,11 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -35,6 +35,11 @@ public class DepartmentServiceImpl implements DepartmentService {
public
String
add
(
DepartmentDTO
department
)
{
public
String
add
(
DepartmentDTO
department
)
{
Date
now
=
new
Date
();
Date
now
=
new
Date
();
TabHaobanDepartment
tab
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanDepartment
.
class
,
department
);
TabHaobanDepartment
tab
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanDepartment
.
class
,
department
);
Integer
sort
=
tab
.
getSort
();
if
(
sort
==
null
)
{
int
maxSort
=
mapper
.
selectMaxSort
(
department
.
getParentDepartmentId
());
tab
.
setSort
(
maxSort
+
1
);
}
tab
.
setCreateTime
(
now
);
tab
.
setCreateTime
(
now
);
tab
.
setUpdateTime
(
now
);
tab
.
setUpdateTime
(
now
);
tab
.
setStatusFlag
(
1
);
tab
.
setStatusFlag
(
1
);
...
@@ -55,7 +60,12 @@ public class DepartmentServiceImpl implements DepartmentService {
...
@@ -55,7 +60,12 @@ public class DepartmentServiceImpl implements DepartmentService {
@Override
@Override
public
void
del
(
String
departmentId
)
{
public
void
del
(
String
departmentId
)
{
mapper
.
deleteByPrimaryKey
(
departmentId
);
TabHaobanDepartment
tab
=
mapper
.
selectByPrimaryKey
(
departmentId
);
if
(
tab
!=
null
)
{
tab
.
setStatusFlag
(
0
);
tab
.
setUpdateTime
(
new
Date
());
}
mapper
.
updateByPrimaryKeySelective
(
tab
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffDepartmentRelatedServiceImpl.java
View file @
95194de3
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
@Service
@Service
public
class
StaffDepartmentRelatedServiceImpl
implements
StaffDepartmentRelatedService
{
public
class
StaffDepartmentRelatedServiceImpl
implements
StaffDepartmentRelatedService
{
@Autowired
private
StaffDepartmentRelatedMapper
mapper
;
@Override
public
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentId
(
String
departmentId
)
{
return
mapper
.
listByDepartmentId
(
departmentId
);
}
}
}
haoban-manage3-service/src/main/resources/mapper/DepartmentMapper.xml
View file @
95194de3
...
@@ -13,10 +13,12 @@
...
@@ -13,10 +13,12 @@
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"wx_department_id"
property=
"wxDepartmentId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_department_id"
property=
"wxDepartmentId"
jdbcType=
"VARCHAR"
/>
<result
column=
"sort"
property=
"sort"
jdbcType=
"INTEGER"
/>
<result
column=
"level"
property=
"level"
jdbcType=
"INTEGER"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
department_id, department_name, parent_department_id, related_id, chain_id, is_store,
department_id, department_name, parent_department_id, related_id, chain_id, is_store,
status_flag, recycle_flag, create_time, update_time,wx_department_id
status_flag, recycle_flag, create_time, update_time,wx_department_id
,sort,level
</sql>
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
select
...
@@ -32,11 +34,11 @@
...
@@ -32,11 +34,11 @@
insert into tab_haoban_department (department_id, department_name, parent_department_id,
insert into tab_haoban_department (department_id, department_name, parent_department_id,
related_id, chain_id, is_store,
related_id, chain_id, is_store,
status_flag, recycle_flag, create_time,
status_flag, recycle_flag, create_time,
update_time,wx_department_id)
update_time,wx_department_id
,sort,level
)
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR},
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR},
#{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER},
#{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId})
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId}
,#{sort},#{level}
)
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanDepartment"
>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanDepartment"
>
insert into tab_haoban_department
insert into tab_haoban_department
...
@@ -74,6 +76,12 @@
...
@@ -74,6 +76,12 @@
<if
test=
"wxDepartmentId != null"
>
<if
test=
"wxDepartmentId != null"
>
wx_department_id,
wx_department_id,
</if>
</if>
<if
test=
"sort != null"
>
sort,
</if>
<if
test=
"level != null"
>
level,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"departmentId != null"
>
<if
test=
"departmentId != null"
>
...
@@ -109,6 +117,12 @@
...
@@ -109,6 +117,12 @@
<if
test=
"wxDepartmentId != null"
>
<if
test=
"wxDepartmentId != null"
>
#{wxDepartmentId},
#{wxDepartmentId},
</if>
</if>
<if
test=
"sort != null"
>
#{sort},
</if>
<if
test=
"level != null"
>
#{level},
</if>
</trim>
</trim>
</insert>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanDepartment"
>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanDepartment"
>
...
@@ -144,6 +158,12 @@
...
@@ -144,6 +158,12 @@
<if
test=
"wxDepartmentId != null"
>
<if
test=
"wxDepartmentId != null"
>
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"sort != null"
>
sort = #{sort,jdbcType=INTEGER},
</if>
<if
test=
"level != null"
>
level = #{level,jdbcType=INTEGER},
</if>
</set>
</set>
where department_id = #{departmentId,jdbcType=VARCHAR}
where department_id = #{departmentId,jdbcType=VARCHAR}
</update>
</update>
...
@@ -156,6 +176,8 @@
...
@@ -156,6 +176,8 @@
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
is_store = #{isStore,jdbcType=INTEGER},
is_store = #{isStore,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER},
level = #{level,jdbcType=INTEGER},
recycle_flag = #{recycleFlag,jdbcType=INTEGER},
recycle_flag = #{recycleFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP}
...
@@ -169,4 +191,12 @@
...
@@ -169,4 +191,12 @@
where parent_department_id = #{parentId,jdbcType=VARCHAR}
where parent_department_id = #{parentId,jdbcType=VARCHAR}
and status_flag = 1
and status_flag = 1
</select>
</select>
<select
id=
"selectMaxSort"
resultType=
"java.lang.Integer"
parameterType=
"java.lang.String"
>
select
ifnull(max(sort),0)
from tab_haoban_department
where parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
</mapper>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/StaffDepartmentRelatedMapper.xml
View file @
95194de3
...
@@ -150,4 +150,12 @@
...
@@ -150,4 +150,12 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
</update>
<select
id=
"listByDepartmentId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR}
</select>
</mapper>
</mapper>
\ No newline at end of file
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/DepartmentContoller.java
View file @
95194de3
...
@@ -2,15 +2,20 @@ package com.gic.haoban.manage.web.controller;
...
@@ -2,15 +2,20 @@ package com.gic.haoban.manage.web.controller;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONArray
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.DepartmentAddQO
;
import
com.gic.haoban.manage.web.qo.DepartmentDelQO
;
import
com.gic.haoban.manage.web.qo.DepartmentEditQO
;
@RestController
@RestController
public
class
DepartmentContoller
extends
WebBaseController
{
public
class
DepartmentContoller
extends
WebBaseController
{
...
@@ -75,11 +80,131 @@ public class DepartmentContoller extends WebBaseController{
...
@@ -75,11 +80,131 @@ public class DepartmentContoller extends WebBaseController{
if
(
dto
==
null
||
dto
.
getStatusFlag
()
==
0
)
{
if
(
dto
==
null
||
dto
.
getStatusFlag
()
==
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10003
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10003
);
}
}
HaobanResponse
hr
=
departmentApiService
.
del
(
departmentId
);
if
(
hr
.
getErrorCode
()
==
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_0
,
hr
.
getMessage
());
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
departmentApiService
.
del
(
departmentId
);
@RequestMapping
(
"department-batch-sync"
)
public
HaobanResponse
departmentBatchSync
(
String
editDepartment
,
String
delDepartmentIds
,
String
addDepartment
)
{
if
(
StringUtils
.
isNotBlank
(
addDepartment
))
{
List
<
DepartmentAddQO
>
list
=
JSONArray
.
parseArray
(
addDepartment
,
DepartmentAddQO
.
class
);
for
(
DepartmentAddQO
departmentAddQO
:
list
)
{
String
parentId
=
departmentAddQO
.
getParentId
();
DepartmentDTO
dto
=
departmentApiService
.
selectById
(
parentId
);
if
(
dto
==
null
||
dto
.
getStatusFlag
()
==
0
)
{
continue
;
}
if
(
dto
.
getIsStore
()
==
1
)
{
continue
;
}
DepartmentDTO
department
=
new
DepartmentDTO
();
department
.
setParentDepartmentId
(
parentId
);
department
.
setDepartmentName
(
departmentAddQO
.
getDepartmentName
());
department
.
setChainId
(
dto
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
dto
.
getDepartmentId
());
department
.
setIsStore
(
0
);
department
.
setLevel
(
dto
.
getLevel
()
+
1
);
HaobanResponse
hr
=
departmentApiService
.
add
(
department
);
if
(
hr
.
getErrorCode
()
!=
1
)
{
continue
;
}
DepartmentDTO
departmentAdd
=
(
DepartmentDTO
)
hr
.
getResult
();
String
departmentId
=
departmentAdd
.
getDepartmentId
();
String
sonDepartment
=
departmentAddQO
.
getSonDepartment
();
handler
(
sonDepartment
,
departmentId
);
}
}
if
(
StringUtils
.
isNotBlank
(
editDepartment
))
{
List
<
DepartmentEditQO
>
list
=
JSONArray
.
parseArray
(
editDepartment
,
DepartmentEditQO
.
class
);
for
(
DepartmentEditQO
departmentQO
:
list
)
{
String
parentId
=
departmentQO
.
getCurrDepartment
();
DepartmentDTO
parent
=
departmentApiService
.
selectById
(
parentId
);
if
(
parent
==
null
||
parent
.
getStatusFlag
()
==
0
)
{
continue
;
}
DepartmentDTO
department
=
departmentApiService
.
selectById
(
parentId
);
department
.
setParentDepartmentId
(
parentId
);
department
.
setDepartmentName
(
departmentQO
.
getDepartmentName
());
department
.
setChainId
(
parent
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
parent
.
getDepartmentId
());
department
.
setLevel
(
parent
.
getLevel
()
+
1
);
HaobanResponse
hr
=
departmentApiService
.
edit
(
department
);
}
}
if
(
StringUtils
.
isNotBlank
(
delDepartmentIds
))
{
String
[]
delIds
=
delDepartmentIds
.
split
(
","
);
for
(
String
string
:
delIds
)
{
departmentApiService
.
del
(
string
);
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
private
void
handler
(
String
sonDepartment
,
String
parentId
)
{
if
(
StringUtils
.
isNotBlank
(
sonDepartment
))
{
List
<
DepartmentAddQO
>
list
=
JSONArray
.
parseArray
(
sonDepartment
,
DepartmentAddQO
.
class
);
for
(
DepartmentAddQO
departmentAddQO
:
list
)
{
String
sonParentId
=
""
;
DepartmentDTO
dto
=
departmentApiService
.
selectById
(
parentId
);
if
(
dto
==
null
||
dto
.
getStatusFlag
()
==
0
)
{
continue
;
}
if
(
dto
.
getIsStore
()
==
1
)
{
continue
;
}
String
departmentId
=
departmentAddQO
.
getDepartmentId
();
//在部门下新增部门
if
(
StringUtils
.
isBlank
(
departmentId
))
{
DepartmentDTO
department
=
new
DepartmentDTO
();
department
.
setParentDepartmentId
(
parentId
);
department
.
setDepartmentName
(
departmentAddQO
.
getDepartmentName
());
department
.
setChainId
(
dto
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
dto
.
getDepartmentId
());
department
.
setIsStore
(
0
);
department
.
setLevel
(
dto
.
getLevel
()
+
1
);
HaobanResponse
hr
=
departmentApiService
.
add
(
department
);
if
(
hr
.
getErrorCode
()
!=
1
)
{
continue
;
}
DepartmentDTO
departmentAdd
=
(
DepartmentDTO
)
hr
.
getResult
();
sonParentId
=
departmentAdd
.
getDepartmentId
();
//别的部门调整过来的
}
else
{
DepartmentDTO
department
=
departmentApiService
.
selectById
(
departmentId
);
if
(
department
==
null
||
department
.
getStatusFlag
()
==
0
)
{
continue
;
}
department
.
setParentDepartmentId
(
parentId
);
department
.
setParentDepartmentId
(
parentId
);
department
.
setDepartmentName
(
departmentAddQO
.
getDepartmentName
());
department
.
setChainId
(
dto
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
dto
.
getDepartmentId
());
HaobanResponse
hr
=
departmentApiService
.
edit
(
department
);
if
(
hr
.
getErrorCode
()
!=
1
)
{
continue
;
}
DepartmentDTO
departmentEdit
=
(
DepartmentDTO
)
hr
.
getResult
();
sonParentId
=
departmentEdit
.
getDepartmentId
();
}
sonDepartment
=
departmentAddQO
.
getSonDepartment
();
handler
(
sonDepartment
,
sonParentId
);
}
}
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WebBaseController.java
View file @
95194de3
...
@@ -35,6 +35,13 @@ public class WebBaseController {
...
@@ -35,6 +35,13 @@ public class WebBaseController {
public
HaobanResponse
resultResponse
(
HaoBanErrCode
errCode
)
{
public
HaobanResponse
resultResponse
(
HaoBanErrCode
errCode
)
{
return
resultResponse
(
errCode
,
null
,
null
);
return
resultResponse
(
errCode
,
null
,
null
);
}
}
public
HaobanResponse
resultResponse
(
HaoBanErrCode
errCode
,
String
message
)
{
HaobanResponse
response
=
new
HaobanResponse
();
response
.
setMessage
(
message
);
response
.
setErrorCode
(
errCode
.
getCode
());
return
response
;
}
/**
/**
* 获取登陆信息
* 获取登陆信息
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/DepartmentAddQO.java
0 → 100644
View file @
95194de3
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
;
import
java.io.Serializable
;
public
class
DepartmentAddQO
implements
Serializable
{
private
String
departmentName
;
private
String
departmentId
;
private
String
parentId
;
private
String
sonDepartment
;
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getSonDepartment
()
{
return
sonDepartment
;
}
public
void
setSonDepartment
(
String
sonDepartment
)
{
this
.
sonDepartment
=
sonDepartment
;
}
public
String
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
String
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/DepartmentDelQO.java
0 → 100644
View file @
95194de3
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
;
import
java.io.Serializable
;
public
class
DepartmentDelQO
implements
Serializable
{
private
String
departmentIds
;
public
String
getDepartmentIds
()
{
return
departmentIds
;
}
public
void
setDepartmentIds
(
String
departmentIds
)
{
this
.
departmentIds
=
departmentIds
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/DepartmentEditQO.java
0 → 100644
View file @
95194de3
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
;
import
java.io.Serializable
;
public
class
DepartmentEditQO
implements
Serializable
{
private
String
departmentId
;
private
String
parentId
;
private
String
currDepartment
;
private
String
departmentName
;
private
Integer
sort
;
public
String
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
String
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getCurrDepartment
()
{
return
currDepartment
;
}
public
void
setCurrDepartment
(
String
currDepartment
)
{
this
.
currDepartment
=
currDepartment
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
}
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