Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
7fab82c0
Commit
7fab82c0
authored
Apr 13, 2020
by
董有沛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合伙人修改和新增活动管理
parent
b59fc9fc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
563 additions
and
276 deletions
+563
-276
common/src/main/java/com/winsun/bean/Partner.java
+0
-20
common/src/main/java/com/winsun/mapper/PartnerMapper.java
+24
-5
common/src/main/java/com/winsun/utils/MD5Utils.java
+51
-2
service-manager/src/main/java/com/winsun/controller/PartnerController.java
+240
-44
service-manager/src/main/java/com/winsun/controller/SchoolManagementController.java
+248
-205
No files found.
common/src/main/java/com/winsun/bean/Partner.java
View file @
7fab82c0
...
...
@@ -27,10 +27,6 @@ public class Partner implements Serializable {
*/
private
String
phoneNum
;
/**
* 学校
*/
private
String
school
;
/**
* 密码
...
...
@@ -68,10 +64,6 @@ public class Partner implements Serializable {
@TableField
(
value
=
"class"
)
private
String
grade
;
/**
* 合伙人对应的微信账号
*/
private
String
wxId
;
/**
* 合伙人的状态
...
...
@@ -82,16 +74,4 @@ public class Partner implements Serializable {
* 预实名账号id
*/
private
int
ysm
;
/**
* 督导id
*/
private
String
leaderId
;
/**
* 学校id
*/
private
int
schoolId
;
}
common/src/main/java/com/winsun/mapper/PartnerMapper.java
View file @
7fab82c0
...
...
@@ -2,8 +2,15 @@ package com.winsun.mapper;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.winsun.bean.Partner
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Update
;
import
org.springframework.stereotype.Component
;
...
...
@@ -11,10 +18,22 @@ import org.springframework.stereotype.Component;
@Component
public
interface
PartnerMapper
extends
BaseMapper
<
Partner
>
{
@Update
(
"update sys_user set phone = #{phone} ,name = #{name} ,account = #{account} ,sex = #{gender} ,substName = #{area} where id=#{id}"
)
int
updateSysUser
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"name"
)
String
name
,
@Param
(
"account"
)
String
account
,
@Param
(
"gender"
)
String
gender
,
@Param
(
"area"
)
String
area
,
@Param
(
"id"
)
String
id
);
@Update
(
"update hhr_user set ysm = #{ysm} ,wx_id = #{wxId} ,id_card = #{idCard} ,school = #{school} where id=#{id}"
)
int
updateHhUser
(
@Param
(
"ysm"
)
String
ysm
,
@Param
(
"wxId"
)
String
wxId
,
@Param
(
"idCard"
)
String
idCard
,
@Param
(
"school"
)
String
school
,
@Param
(
"id"
)
String
id
);
@Update
(
"update sys_user set phone = #{phone} ,name = #{name} ,account = #{account} ,sex = #{sex} where id=#{id}"
)
int
updateSysUser
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"name"
)
String
name
,
@Param
(
"account"
)
String
account
,
@Param
(
"sex"
)
String
sex
,
@Param
(
"id"
)
String
id
);
@Update
(
"update hhr_user set ysm = #{ysm} ,grade = #{grade} ,id_card = #{idCard},position = #{position} ,parent_id = #{parentId} ,parent_ids = #{parentIds} where id=#{id}"
)
int
updateHhUser
(
@Param
(
"ysm"
)
String
ysm
,
@Param
(
"grade"
)
String
grade
,
@Param
(
"idCard"
)
String
idCard
,
@Param
(
"position"
)
String
position
,
@Param
(
"parentId"
)
String
parentId
,
@Param
(
"parentIds"
)
String
parentIds
,
@Param
(
"id"
)
String
id
);
@Update
(
"update hhr_user_school set school_id = #{schoolId} where user_id=#{userId}"
)
int
updateSchoolRef
(
@Param
(
"schoolId"
)
String
schoolId
,
@Param
(
"userId"
)
String
userId
);
@Select
(
"select * from `sys_user` where account = #{account} order by createtime desc"
)
List
<
Map
<
String
,
Object
>>
selectSysUser
(
String
account
);
@Insert
(
" replace into hhr_user_school(user_id,school_id) VALUES(#{userId},#{schoolId})"
)
int
saveSchoolRef
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"schoolId"
)
String
schoolId
);
@Select
(
" select * from hhr_user_school"
)
List
<
Map
<
String
,
Object
>>
getSchoolRef
();
}
common/src/main/java/com/winsun/utils/MD5Utils.java
View file @
7fab82c0
package
com
.
winsun
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
java.math.BigInteger
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.SecureRandom
;
import
org.apache.shiro.crypto.hash.Md5Hash
;
import
org.apache.shiro.crypto.hash.SimpleHash
;
import
org.apache.shiro.util.ByteSource
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
MD5Utils
{
/**
* 加盐参数
*/
public
final
static
String
hashAlgorithmName
=
"MD5"
;
/**
* 循环次数
*/
public
final
static
int
hashIterations
=
1024
;
/**
* shiro密码加密工具类
*
* @param credentials 密码
* @param saltSource 密码盐
* @return
*/
public
static
String
md5
(
String
credentials
,
String
saltSource
)
{
ByteSource
salt
=
new
Md5Hash
(
saltSource
);
return
new
SimpleHash
(
hashAlgorithmName
,
credentials
,
salt
,
hashIterations
).
toString
();
}
/**
* 使用md5的算法进行加密
*/
...
...
@@ -50,4 +78,25 @@ public class MD5Utils {
return
null
;
}
}
/**
* 获取随机位数的字符串
*/
public
static
String
getRandomString
(
int
length
)
{
String
base
=
"abcdefghijklmnopqrstuvwxyz0123456789"
;
SecureRandom
random
;
StringBuffer
sb
=
new
StringBuffer
();
try
{
random
=
SecureRandom
.
getInstance
(
"SHA1PRNG"
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
int
number
=
random
.
nextInt
(
base
.
length
());
sb
.
append
(
base
.
charAt
(
number
));
}
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
return
sb
.
toString
();
}
}
service-manager/src/main/java/com/winsun/controller/PartnerController.java
View file @
7fab82c0
package
com
.
winsun
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.enums.SqlLike
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
...
...
@@ -9,20 +21,19 @@ import com.winsun.auth.core.annotion.Permission;
import
com.winsun.auth.core.base.controller.BaseController
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.auth.core.shiro.ShiroUser
;
import
com.winsun.bean.HhrActivity
;
import
com.winsun.bean.HhrUser
;
import
com.winsun.bean.Partner
;
import
com.winsun.bean.School
;
import
com.winsun.bean.SysUser
;
import
com.winsun.mapper.HhrUserMapper
;
import
com.winsun.mapper.PartnerMapper
;
import
com.winsun.utils.MyBatisPlusUpdateUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.winsun.mapper.SchoolMapper
;
import
com.winsun.mapper.SysUserMapper
;
import
com.winsun.utils.MD5Utils
;
import
com.winsun.utils.MapUtil
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @Author: chancy
...
...
@@ -33,36 +44,221 @@ import java.util.Map;
@RequestMapping
(
"/school/partner"
)
public
class
PartnerController
extends
BaseController
{
private
static
PartnerMapper
partnerMapper
;
@Autowired
public
PartnerController
(
PartnerMapper
partnerMapper
)
{
PartnerController
.
partnerMapper
=
partnerMapper
;
}
@Permission
(
menuname
=
"修改合伙人信息"
,
value
=
"update"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
updatePartner
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"phoneNum"
)
String
phoneNum
,
@RequestParam
(
"school"
)
String
school
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"account"
)
String
account
,
@RequestParam
(
"idCard"
)
String
idCard
,
@RequestParam
(
"ysm"
)
String
ysm
,
@RequestParam
(
"gender"
)
String
gender
,
@RequestParam
(
"area"
)
String
area
,
@RequestParam
(
"wxId"
)
String
wxId
)
{
int
updateSysUse
=
partnerMapper
.
updateSysUser
(
phoneNum
,
name
,
account
,
gender
,
area
,
id
);
int
updateHhUser
=
partnerMapper
.
updateHhUser
(
ysm
,
wxId
,
idCard
,
school
,
id
);
if
(
updateSysUse
==
1
&&
updateHhUser
==
1
){
return
ResponseData
.
success
(
"修改完毕!"
);
}
return
ResponseData
.
error
(
"修改失败"
);
}
@Permission
(
menuname
=
"查询合伙人信息"
,
value
=
"list"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Page
<
Partner
>>
listPartner
(
@RequestParam
(
"school"
)
String
school
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"area"
)
String
area
,
@RequestParam
(
name
=
"pageNo"
,
required
=
false
)
int
pageIndex
,
@RequestParam
(
name
=
"pageSize"
,
required
=
false
)
int
pageSize
)
{
Wrapper
<
Partner
>
wrapper
=
new
EntityWrapper
();
wrapper
.
like
(
StringUtils
.
isNotBlank
(
school
),
"school"
,
school
,
SqlLike
.
DEFAULT
);
wrapper
.
like
(
StringUtils
.
isNotBlank
(
name
),
"name"
,
name
,
SqlLike
.
DEFAULT
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
area
),
"area"
,
area
);
Page
<
Partner
>
page
=
new
Page
<>(
pageIndex
,
pageSize
);
List
<
Partner
>
salespeople
=
partnerMapper
.
selectPage
(
page
,
wrapper
);
page
.
setRecords
(
salespeople
);
return
ResponseData
.
success
(
page
,
"查询完毕!"
);
}
private
static
PartnerMapper
partnerMapper
;
private
static
SysUserMapper
sysUserMapper
;
private
static
HhrUserMapper
hhrUserMapper
;
private
static
SchoolMapper
schoolMapper
;
@Autowired
public
PartnerController
(
PartnerMapper
partnerMapper
,
SysUserMapper
sysUserMapper
,
HhrUserMapper
hhrUserMapper
,
SchoolMapper
schoolMapper
)
{
PartnerController
.
partnerMapper
=
partnerMapper
;
PartnerController
.
sysUserMapper
=
sysUserMapper
;
PartnerController
.
hhrUserMapper
=
hhrUserMapper
;
PartnerController
.
schoolMapper
=
schoolMapper
;
}
@Permission
(
menuname
=
"修改合伙人信息"
,
value
=
"update"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
updatePartner
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"account"
)
String
account
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"idCard"
)
String
idCard
,
@RequestParam
(
"sex"
)
String
sex
,
@RequestParam
(
"grade"
)
String
grade
,
@RequestParam
(
"schoolId"
)
String
schoolId
,
@RequestParam
(
"roleId"
)
String
roleId
,
@RequestParam
(
"ysm"
)
String
ysm
,
@RequestParam
(
name
=
"position"
,
required
=
false
)
String
position
,
@RequestParam
(
name
=
"parentId"
,
required
=
false
)
String
parentId
,
@RequestParam
(
name
=
"parentIds"
,
required
=
false
)
String
parentIds
)
{
int
updateSysUse
=
partnerMapper
.
updateSysUser
(
phone
,
name
,
account
,
sex
,
id
);
int
updateHhUser
=
partnerMapper
.
updateHhUser
(
ysm
,
grade
,
idCard
,
position
,
parentId
,
parentIds
,
id
);
int
updateSchoolRef
=
partnerMapper
.
updateSchoolRef
(
schoolId
,
id
);
if
(
updateSysUse
==
1
&&
updateHhUser
==
1
&&
updateSchoolRef
==
1
)
{
return
ResponseData
.
success
(
"修改完毕!"
);
}
return
ResponseData
.
error
(
"修改失败"
);
}
@SuppressWarnings
(
"unchecked"
)
@Permission
(
menuname
=
"查询合伙人信息"
,
value
=
"list"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Page
<
Map
<
String
,
Object
>>>
listPartner
(
@RequestParam
(
"school"
)
String
school
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"area"
)
String
area
,
@RequestParam
(
name
=
"pageNo"
,
required
=
false
)
int
pageIndex
,
@RequestParam
(
name
=
"pageSize"
,
required
=
false
)
int
pageSize
)
{
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
pageIndex
,
pageSize
);
Wrapper
<
HhrUser
>
wrapperHhr
=
new
EntityWrapper
<
HhrUser
>();
// wrapperHhr.like(StringUtils.isNotBlank(name), "name", name, SqlLike.DEFAULT);
List
<
HhrUser
>
hhrUserList
=
hhrUserMapper
.
selectList
(
wrapperHhr
);
Wrapper
<
SysUser
>
wrapperSys
=
new
EntityWrapper
<
SysUser
>();
wrapperSys
.
like
(
StringUtils
.
isNotBlank
(
name
),
"name"
,
name
,
SqlLike
.
DEFAULT
);
List
<
SysUser
>
sysUserList
=
sysUserMapper
.
selectList
(
wrapperSys
);
Wrapper
<
School
>
wrapperSchool
=
new
EntityWrapper
<
School
>();
// wrapperSchool.like(StringUtils.isNotBlank(name), "name", name, SqlLike.DEFAULT);
List
<
School
>
schoolList
=
schoolMapper
.
selectList
(
wrapperSchool
);
Map
<
String
,
Object
>
refMap
=
MapUtil
.
listToMap
(
partnerMapper
.
getSchoolRef
(),
"user_id"
,
"school_id"
);
List
<
Map
<
String
,
Object
>>
newList
=
new
ArrayList
<>();
// List<Map<String, Object>> sysList = new ArrayList<>();
// for(SysUser sysUser : sysUserList) {
// sysList.add(BeanMap.create(sysUser));
// }
for
(
int
i
=
0
;
i
<
sysUserList
.
size
();
i
++)
{
SysUser
sysUser
=
sysUserList
.
get
(
i
);
String
sysUserId
=
sysUser
.
getId
();
String
schoolRefId
=
(
String
)
refMap
.
get
(
sysUserId
);
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<
String
,
Object
>();
for
(
HhrUser
hhrUser
:
hhrUserList
)
{
String
hhrUserId
=
hhrUser
.
getId
();
if
(
sysUserId
.
equals
(
hhrUserId
))
{
dataMap
.
put
(
"grade"
,
hhrUser
.
getGrade
());
dataMap
.
put
(
"parentId"
,
hhrUser
.
getParentId
());
dataMap
.
put
(
"position"
,
hhrUser
.
getPosition
());
dataMap
.
put
(
"idCard"
,
hhrUser
.
getIdCard
());
dataMap
.
put
(
"ysm"
,
hhrUser
.
getYsm
());
break
;
}
}
for
(
School
schoolEntity
:
schoolList
)
{
String
schoolId
=
Integer
.
toString
(
schoolEntity
.
getId
());
if
(
null
!=
schoolRefId
&&
schoolRefId
.
equals
(
schoolId
))
{
dataMap
.
put
(
"area"
,
schoolEntity
.
getSubName
());
dataMap
.
put
(
"school"
,
schoolEntity
.
getSchoolName
());
dataMap
.
put
(
"schoolId"
,
schoolEntity
.
getId
());
dataMap
.
put
(
"id"
,
sysUserId
);
break
;
}
}
// 需要两个数据表都匹配到,才添加
if
(
null
!=
dataMap
.
get
(
"id"
))
{
dataMap
.
put
(
"name"
,
sysUser
.
getName
());
dataMap
.
put
(
"account"
,
sysUser
.
getAccount
());
dataMap
.
put
(
"phone"
,
sysUser
.
getPhone
());
dataMap
.
put
(
"sex"
,
sysUser
.
getSex
());
dataMap
.
put
(
"status"
,
sysUser
.
getStatus
());
dataMap
.
put
(
"roleid"
,
sysUser
.
getRoleid
());
newList
.
add
(
dataMap
);
}
}
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
if
(
newList
.
size
()
<
pageSize
)
{
dataList
=
newList
;
}
else
{
dataList
=
newList
.
subList
((
pageIndex
-
1
)*
pageSize
,
pageIndex
*
pageSize
);
}
page
.
setRecords
(
dataList
);
page
.
setTotal
(
newList
.
size
());
return
ResponseData
.
success
(
page
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"新增合伙人"
,
value
=
"addPartner"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
addPartner
(
@RequestParam
(
"account"
)
String
account
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"idCard"
)
String
idCard
,
@RequestParam
(
"sex"
)
String
sex
,
@RequestParam
(
"grade"
)
String
grade
,
@RequestParam
(
"password"
)
String
password
,
@RequestParam
(
"schoolId"
)
String
schoolId
,
@RequestParam
(
"roleId"
)
String
roleId
,
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
name
=
"position"
,
required
=
false
)
String
position
,
@RequestParam
(
name
=
"parentId"
,
required
=
false
)
String
parentId
,
@RequestParam
(
name
=
"parentIds"
,
required
=
false
)
String
parentIds
){
// String salt = Integer.toString((int)(Math.random()*100000));
String
salt
=
MD5Utils
.
getRandomString
(
5
);
password
=
MD5Utils
.
md5
(
password
,
salt
);
SysUser
sysUser
=
new
SysUser
();
sysUser
.
setAccount
(
account
);
sysUser
.
setName
(
name
);
sysUser
.
setPassword
(
password
);
sysUser
.
setSalt
(
salt
);
sysUser
.
setSex
(
sex
);
sysUser
.
setPhone
(
phone
);
sysUser
.
setRoleid
(
roleId
);
sysUser
.
setStatus
(
"1"
);
sysUser
.
setRoleid
(
roleId
);
sysUser
.
setCreatetime
(
new
Date
());
sysUser
.
setUpdateTime
(
new
Date
());
int
num
=
sysUserMapper
.
insert
(
sysUser
);
// int num = partnerMapper.insertSysUser(account, name, password, salt, sex, phone, roleId, "1",
// new Date(), new Date());
if
(
num
>
0
)
{
List
<
Map
<
String
,
Object
>>
userList
=
partnerMapper
.
selectSysUser
(
account
);
Map
<
String
,
Object
>
userMap
=
userList
.
get
(
0
);
String
userId
=
userMap
.
get
(
"id"
).
toString
();
HhrUser
hhrUser
=
new
HhrUser
();
hhrUser
.
setId
(
userId
);
hhrUser
.
setIdCard
(
idCard
);
hhrUser
.
setGrade
(
grade
);
hhrUser
.
setPosition
(
position
);
hhrUser
.
setParentId
(
parentId
);
hhrUser
.
setParentIds
(
parentIds
);
hhrUser
.
setYsm
(
"1"
);
int
result
=
hhrUserMapper
.
insert
(
hhrUser
);
//int result = partnerMapper.insertHhrUser(userId, idCard, grade, 1);
if
(
result
==
1
)
{
partnerMapper
.
saveSchoolRef
(
userId
,
schoolId
);
return
ResponseData
.
success
(
"新增完毕!"
);
}
}
return
ResponseData
.
error
(
"新增失败"
);
}
@Permission
(
menuname
=
"查询合伙人信息"
,
value
=
"list1"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Page
<
Partner
>>
listPartner1
(
@RequestParam
(
"school"
)
String
school
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"area"
)
String
area
,
@RequestParam
(
name
=
"pageNo"
,
required
=
false
)
int
pageIndex
,
@RequestParam
(
name
=
"pageSize"
,
required
=
false
)
int
pageSize
)
{
Wrapper
<
Partner
>
wrapper
=
new
EntityWrapper
<
Partner
>();
wrapper
.
like
(
StringUtils
.
isNotBlank
(
school
),
"school"
,
school
,
SqlLike
.
DEFAULT
);
wrapper
.
like
(
StringUtils
.
isNotBlank
(
name
),
"name"
,
name
,
SqlLike
.
DEFAULT
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
area
),
"area"
,
area
);
Page
<
Partner
>
page
=
new
Page
<>(
pageIndex
,
pageSize
);
List
<
Partner
>
salespeople
=
partnerMapper
.
selectPage
(
page
,
wrapper
);
page
.
setRecords
(
salespeople
);
return
ResponseData
.
success
(
page
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"获取学子公司职位下级成员"
,
value
=
"getXzUserList"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
List
<
HhrUser
>>
getXzUserList
(
@RequestParam
(
"position"
)
String
position
)
{
ShiroUser
user
=
getShiroUser
();
if
(!
user
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
// 查询县分列表
Wrapper
<
HhrUser
>
wrapper
=
new
EntityWrapper
<
HhrUser
>();
wrapper
.
setSqlSelect
(
"id,parent_ids parentIds,position "
)
.
eq
(
"position"
,
position
);
List
<
HhrUser
>
list
=
hhrUserMapper
.
selectList
(
wrapper
);
Wrapper
<
SysUser
>
wrapperSys
=
new
EntityWrapper
<
SysUser
>();
wrapperSys
.
setSqlSelect
(
"id,name "
);
List
<
SysUser
>
sysList
=
sysUserMapper
.
selectList
(
wrapperSys
);
for
(
HhrUser
hhrUser
:
list
)
{
for
(
SysUser
sysUser
:
sysList
)
{
if
(
hhrUser
.
getId
().
equals
(
sysUser
.
getId
()))
{
hhrUser
.
setName
(
sysUser
.
getName
());
break
;
}
}
}
return
ResponseData
.
success
(
list
,
"查询完毕!"
);
}
}
service-manager/src/main/java/com/winsun/controller/SchoolManagementController.java
View file @
7fab82c0
...
...
@@ -37,215 +37,258 @@ import java.util.Map;
/**
* @Author: chancy
* @Date: 2020/2/12 17:25
* 学校管理
* @Date: 2020/2/12 17:25 学校管理
*/
@Slf4j
@RestController
@RequestMapping
(
"/school/schoolManagement"
)
public
class
SchoolManagementController
extends
BaseController
{
private
static
SchoolMapper
schoolMapper
;
private
static
SchoolPackageMapper
schoolPackageMapper
;
private
static
PackageMapper
packageMapper
;
private
static
ProductMapper
productMapper
;
//默认路径
private
static
String
DEFAULTPATH
=
"images/schoolPartner/"
;
private
static
String
FILENAME
=
".jpg"
;
@Autowired
public
SchoolManagementController
(
SchoolMapper
schoolMapper
,
SchoolPackageMapper
schoolPackageMapper
,
PackageMapper
packageMapper
,
ProductMapper
productMapper
)
{
SchoolManagementController
.
schoolMapper
=
schoolMapper
;
SchoolManagementController
.
schoolPackageMapper
=
schoolPackageMapper
;
SchoolManagementController
.
packageMapper
=
packageMapper
;
SchoolManagementController
.
productMapper
=
productMapper
;
}
@Permission
(
menuname
=
"添加学校信息"
,
value
=
"insert"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
insertSchool
(
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
"netId"
)
String
netId
,
@RequestParam
(
"lzgh"
)
String
lzgh
,
@RequestParam
(
"bandproductId"
)
String
bandproductId
,
@RequestParam
(
"netPhone"
)
String
netPhone
,
@RequestParam
(
"isShowband"
)
String
isShowband
,
@RequestParam
(
"isShowrh"
)
String
isShowrh
,
@RequestParam
(
"isRecv"
)
String
isRecv
,
@RequestParam
(
"chosePages"
)
String
chosePages
)
{
School
school
=
new
School
();
school
.
setBandproductId
(
bandproductId
);
if
(
StringUtils
.
isNotBlank
(
isRecv
)){
school
.
setIsRecv
(
Integer
.
valueOf
(
isRecv
));
}
school
.
setNetId
(
netId
);
school
.
setLzgh
(
lzgh
);
school
.
setSchoolName
(
schoolName
);
school
.
setSubName
(
subName
);
school
.
setIsShowband
(
isShowband
);
school
.
setIsShowrh
(
isShowrh
);
if
(
StringUtils
.
isNotBlank
(
netPhone
)){
school
.
setNetPhone
(
Integer
.
valueOf
(
netPhone
));
}
Integer
insert
=
schoolMapper
.
insert
(
school
);
//插入中间表
if
(
StringUtils
.
isNotBlank
(
chosePages
)){
String
[]
split
=
chosePages
.
split
(
","
);
if
(
split
.
length
<=
0
)
{
return
ResponseData
.
success
(
"添加成功!"
);
}
for
(
String
s
:
split
)
{
SchoolPackage
schoolPackage
=
new
SchoolPackage
();
schoolPackage
.
setSchoolId
(
String
.
valueOf
(
school
.
getId
()));
schoolPackage
.
setPackageId
(
s
);
schoolPackageMapper
.
insert
(
schoolPackage
);
}
}
if
(
insert
==
1
){
EntityWrapper
<
School
>
schoolwrapper
=
new
EntityWrapper
<>();
schoolwrapper
.
eq
(
"id"
,
school
.
getId
());
String
backgroundpath
=
"/"
+
DEFAULTPATH
+
school
.
getId
()+
FILENAME
;
schoolMapper
.
updateForSet
(
"service_qrcode ='"
+
backgroundpath
+
"'"
,
schoolwrapper
);
log
.
info
(
"学校信息新增完毕,id: {}"
,
school
.
getId
());
return
ResponseData
.
success
(
"添加成功!"
);
}
return
ResponseData
.
error
(
"添加失败!"
);
}
@Permission
(
menuname
=
"删除學校信息"
,
value
=
"hidestatus"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
deleteSchool
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"status"
)
int
status
)
{
Integer
integer
=
schoolMapper
.
updateForSet
(
"status="
+
status
,
new
EntityWrapper
<
School
>().
eq
(
"id"
,
id
));
if
(
integer
==
1
){
return
ResponseData
.
success
(
"修改成功!"
);
}
return
ResponseData
.
error
(
"修改失败"
);
}
/**
*@param id
* @param subName 县分
* @param schoolName 学校
* @param netId 网点id
* @param lzgh 揽装工号
* @param bandproductId 单宽id
* @param netPhone 购机
* @param isShowband 显示宽带
* @param isShowrh 融合
* @param isRecv 收到电信卡
* @param chosePages 套餐id
* @return
*/
@Permission
(
menuname
=
"修改学校信息"
,
value
=
"update"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
updateSchool
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
"netId"
)
String
netId
,
@RequestParam
(
"lzgh"
)
String
lzgh
,
@RequestParam
(
"bandproductId"
)
String
bandproductId
,
@RequestParam
(
"netPhone"
)
String
netPhone
,
@RequestParam
(
"isShowband"
)
String
isShowband
,
@RequestParam
(
"isShowrh"
)
String
isShowrh
,
@RequestParam
(
"isRecv"
)
String
isRecv
,
@RequestParam
(
"chosePages"
)
String
chosePages
)
{
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
id
);
Map
<
String
,
Object
>
dataMapping
=
new
HashMap
<>();
dataMapping
.
put
(
"sub_name"
,
subName
);
dataMapping
.
put
(
"school_name"
,
schoolName
);
dataMapping
.
put
(
"lzgh"
,
lzgh
);
dataMapping
.
put
(
"net_id"
,
netId
);
dataMapping
.
put
(
"is_recv"
,
isRecv
);
dataMapping
.
put
(
"net_phone"
,
netPhone
);
dataMapping
.
put
(
"bandproduct_id"
,
bandproductId
);
dataMapping
.
put
(
"is_showband"
,
isShowband
);
dataMapping
.
put
(
"is_showrh"
,
isShowrh
);
schoolMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
dataMapping
),
wrapper
);
//插入学校与套餐中间表数据
if
(
StringUtils
.
isNotBlank
(
chosePages
)){
String
[]
split
=
chosePages
.
split
(
","
);
if
(
split
.
length
<=
0
)
{
return
ResponseData
.
success
(
"修改完毕!"
);
}
EntityWrapper
<
SchoolPackage
>
schoolPackagewrapper
=
new
EntityWrapper
<>();
schoolPackagewrapper
.
eq
(
"school_id"
,
id
);
schoolPackageMapper
.
delete
(
schoolPackagewrapper
);
for
(
String
s
:
split
)
{
SchoolPackage
schoolPackage
=
new
SchoolPackage
();
schoolPackage
.
setSchoolId
(
id
);
schoolPackage
.
setPackageId
(
s
);
schoolPackageMapper
.
insert
(
schoolPackage
);
}
}
return
ResponseData
.
success
(
"修改完毕!"
);
}
/**
*
* @param subName
* @param status
* @param schoolName
* @param pageIndex
* @param pageSize
* @return
*/
@Permission
(
menuname
=
"查询学校信息"
,
value
=
"findByList"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Page
<
Map
<
String
,
Object
>>>
listSchool
(
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"status"
)
String
status
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
name
=
"pageNo"
,
required
=
false
)
int
pageIndex
,
@RequestParam
(
name
=
"pageSize"
,
required
=
false
)
int
pageSize
)
{
ShiroUser
user
=
getShiroUser
();
if
(!
user
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
();
wrapper
.
like
(
StringUtils
.
isNotBlank
(
schoolName
),
"school_name"
,
schoolName
,
SqlLike
.
DEFAULT
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
subName
),
"sub_name"
,
subName
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
status
),
"status"
,
status
);
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
pageIndex
,
pageSize
);
List
<
Map
<
String
,
Object
>>
maps
=
schoolMapper
.
selectMapsPage
(
page
,
wrapper
);
//查询县分列表
Wrapper
<
School
>
wrapperSubName
=
new
EntityWrapper
();
wrapperSubName
.
setSqlSelect
(
"sub_name as subNameList"
).
groupBy
(
"sub_name"
);
List
<
Map
<
String
,
Object
>>
selectMaps
=
schoolMapper
.
selectMaps
(
wrapperSubName
);
EntityWrapper
<
Package
>
packagewrapper
=
new
EntityWrapper
<>();
packagewrapper
.
setSqlSelect
(
"id,package_name as packageName"
);
List
<
Map
<
String
,
Object
>>
packageselectMaps
=
packageMapper
.
selectMaps
(
packagewrapper
);
//查询单宽学校名称
Wrapper
<
Product
>
productwrapper
=
new
EntityWrapper
();
productwrapper
.
setSqlSelect
(
"product_id as productId,product_university as ProductUniversity"
);
productwrapper
.
eq
(
"product_state"
,
"0"
);
List
<
Map
<
String
,
Object
>>
products
=
productMapper
.
selectMaps
(
productwrapper
);
//存放县分下拉列表和单宽学校名称下拉列表
if
(!
CollectionUtils
.
isEmpty
(
maps
)){
maps
.
get
(
0
).
put
(
"subNameList"
,
selectMaps
);
maps
.
get
(
0
).
put
(
"packageName"
,
packageselectMaps
);
maps
.
get
(
0
).
put
(
"products"
,
products
);
}
page
.
setRecords
(
maps
);
return
ResponseData
.
success
(
page
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"编辑套餐选择回显数据"
,
value
=
"choosepages"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Map
<
String
,
Object
>>
editdisplay
(
@RequestParam
(
"id"
)
String
id
)
{
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
EntityWrapper
<
SchoolPackage
>
schoolPackagewrapper
=
new
EntityWrapper
<>();
schoolPackagewrapper
.
eq
(
"school_id"
,
id
);
List
<
SchoolPackage
>
schoolPackages
=
schoolPackageMapper
.
selectList
(
schoolPackagewrapper
);
ArrayList
<
String
>
arrayList
=
new
ArrayList
<>();
schoolPackages
.
forEach
(
val
->{
arrayList
.
add
(
val
.
getPackageId
());
});
hashMap
.
put
(
"choosepages"
,
arrayList
);
return
ResponseData
.
success
(
hashMap
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"上传二维码"
,
value
=
"qrcodeUpload"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
xiaotuUpload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
String
backgroundpath
=
FilePath
.
BACKGROUNDIMG
.
getValue
()+
"/"
+
DEFAULTPATH
;
boolean
makefile
=
FileUtil
.
makefile
(
backgroundpath
,
file
,
id
+
FILENAME
);
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
id
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"service_qrcode"
,
backgroundpath
+
id
+
FILENAME
);
Integer
integer
=
schoolMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
map
),
wrapper
);
if
(
integer
!=
1
){
return
ResponseData
.
error
(
"上传失败!"
);
}
return
ResponseData
.
success
(
"上传成功"
);
}
private
static
SchoolMapper
schoolMapper
;
private
static
SchoolPackageMapper
schoolPackageMapper
;
private
static
PackageMapper
packageMapper
;
private
static
ProductMapper
productMapper
;
// 默认路径
private
static
String
DEFAULTPATH
=
"images/schoolPartner/"
;
private
static
String
FILENAME
=
".jpg"
;
@Autowired
public
SchoolManagementController
(
SchoolMapper
schoolMapper
,
SchoolPackageMapper
schoolPackageMapper
,
PackageMapper
packageMapper
,
ProductMapper
productMapper
)
{
SchoolManagementController
.
schoolMapper
=
schoolMapper
;
SchoolManagementController
.
schoolPackageMapper
=
schoolPackageMapper
;
SchoolManagementController
.
packageMapper
=
packageMapper
;
SchoolManagementController
.
productMapper
=
productMapper
;
}
@Permission
(
menuname
=
"添加学校信息"
,
value
=
"insert"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
insertSchool
(
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
"netId"
)
String
netId
,
@RequestParam
(
"lzgh"
)
String
lzgh
,
@RequestParam
(
"bandproductId"
)
String
bandproductId
,
@RequestParam
(
"netPhone"
)
String
netPhone
,
@RequestParam
(
"isShowband"
)
String
isShowband
,
@RequestParam
(
"isShowrh"
)
String
isShowrh
,
@RequestParam
(
"isRecv"
)
String
isRecv
,
@RequestParam
(
"chosePages"
)
String
chosePages
)
{
School
school
=
new
School
();
school
.
setBandproductId
(
bandproductId
);
if
(
StringUtils
.
isNotBlank
(
isRecv
))
{
school
.
setIsRecv
(
Integer
.
valueOf
(
isRecv
));
}
school
.
setNetId
(
netId
);
school
.
setLzgh
(
lzgh
);
school
.
setSchoolName
(
schoolName
);
school
.
setSubName
(
subName
);
school
.
setIsShowband
(
isShowband
);
school
.
setIsShowrh
(
isShowrh
);
if
(
StringUtils
.
isNotBlank
(
netPhone
))
{
school
.
setNetPhone
(
Integer
.
valueOf
(
netPhone
));
}
Integer
insert
=
schoolMapper
.
insert
(
school
);
// 插入中间表
if
(
StringUtils
.
isNotBlank
(
chosePages
))
{
String
[]
split
=
chosePages
.
split
(
","
);
if
(
split
.
length
<=
0
)
{
return
ResponseData
.
success
(
"添加成功!"
);
}
for
(
String
s
:
split
)
{
SchoolPackage
schoolPackage
=
new
SchoolPackage
();
schoolPackage
.
setSchoolId
(
String
.
valueOf
(
school
.
getId
()));
schoolPackage
.
setPackageId
(
s
);
schoolPackageMapper
.
insert
(
schoolPackage
);
}
}
if
(
insert
==
1
)
{
EntityWrapper
<
School
>
schoolwrapper
=
new
EntityWrapper
<>();
schoolwrapper
.
eq
(
"id"
,
school
.
getId
());
String
backgroundpath
=
"/"
+
DEFAULTPATH
+
school
.
getId
()
+
FILENAME
;
schoolMapper
.
updateForSet
(
"service_qrcode ='"
+
backgroundpath
+
"'"
,
schoolwrapper
);
log
.
info
(
"学校信息新增完毕,id: {}"
,
school
.
getId
());
return
ResponseData
.
success
(
"添加成功!"
);
}
return
ResponseData
.
error
(
"添加失败!"
);
}
@Permission
(
menuname
=
"删除學校信息"
,
value
=
"hidestatus"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
deleteSchool
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"status"
)
int
status
)
{
Integer
integer
=
schoolMapper
.
updateForSet
(
"status="
+
status
,
new
EntityWrapper
<
School
>().
eq
(
"id"
,
id
));
if
(
integer
==
1
)
{
return
ResponseData
.
success
(
"修改成功!"
);
}
return
ResponseData
.
error
(
"修改失败"
);
}
/**
* @param id
* @param subName 县分
* @param schoolName 学校
* @param netId 网点id
* @param lzgh 揽装工号
* @param bandproductId 单宽id
* @param netPhone 购机
* @param isShowband 显示宽带
* @param isShowrh 融合
* @param isRecv 收到电信卡
* @param chosePages 套餐id
* @return
*/
@Permission
(
menuname
=
"修改学校信息"
,
value
=
"update"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
updateSchool
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
"netId"
)
String
netId
,
@RequestParam
(
"lzgh"
)
String
lzgh
,
@RequestParam
(
"bandproductId"
)
String
bandproductId
,
@RequestParam
(
"netPhone"
)
String
netPhone
,
@RequestParam
(
"isShowband"
)
String
isShowband
,
@RequestParam
(
"isShowrh"
)
String
isShowrh
,
@RequestParam
(
"isRecv"
)
String
isRecv
,
@RequestParam
(
"chosePages"
)
String
chosePages
)
{
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
id
);
Map
<
String
,
Object
>
dataMapping
=
new
HashMap
<>();
dataMapping
.
put
(
"sub_name"
,
subName
);
dataMapping
.
put
(
"school_name"
,
schoolName
);
dataMapping
.
put
(
"lzgh"
,
lzgh
);
dataMapping
.
put
(
"net_id"
,
netId
);
dataMapping
.
put
(
"is_recv"
,
isRecv
);
dataMapping
.
put
(
"net_phone"
,
netPhone
);
dataMapping
.
put
(
"bandproduct_id"
,
bandproductId
);
dataMapping
.
put
(
"is_showband"
,
isShowband
);
dataMapping
.
put
(
"is_showrh"
,
isShowrh
);
schoolMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
dataMapping
),
wrapper
);
// 插入学校与套餐中间表数据
if
(
StringUtils
.
isNotBlank
(
chosePages
))
{
String
[]
split
=
chosePages
.
split
(
","
);
if
(
split
.
length
<=
0
)
{
return
ResponseData
.
success
(
"修改完毕!"
);
}
EntityWrapper
<
SchoolPackage
>
schoolPackagewrapper
=
new
EntityWrapper
<>();
schoolPackagewrapper
.
eq
(
"school_id"
,
id
);
schoolPackageMapper
.
delete
(
schoolPackagewrapper
);
for
(
String
s
:
split
)
{
SchoolPackage
schoolPackage
=
new
SchoolPackage
();
schoolPackage
.
setSchoolId
(
id
);
schoolPackage
.
setPackageId
(
s
);
schoolPackageMapper
.
insert
(
schoolPackage
);
}
}
return
ResponseData
.
success
(
"修改完毕!"
);
}
/**
*
* @param subName
* @param status
* @param schoolName
* @param pageIndex
* @param pageSize
* @return
*/
@Permission
(
menuname
=
"查询学校信息"
,
value
=
"findByList"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Page
<
Map
<
String
,
Object
>>>
listSchool
(
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"status"
)
String
status
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
name
=
"pageNo"
,
required
=
false
)
int
pageIndex
,
@RequestParam
(
name
=
"pageSize"
,
required
=
false
)
int
pageSize
)
{
ShiroUser
user
=
getShiroUser
();
if
(!
user
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
();
wrapper
.
like
(
StringUtils
.
isNotBlank
(
schoolName
),
"school_name"
,
schoolName
,
SqlLike
.
DEFAULT
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
subName
),
"sub_name"
,
subName
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
status
),
"status"
,
status
);
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
pageIndex
,
pageSize
);
List
<
Map
<
String
,
Object
>>
maps
=
schoolMapper
.
selectMapsPage
(
page
,
wrapper
);
// 查询县分列表
Wrapper
<
School
>
wrapperSubName
=
new
EntityWrapper
();
wrapperSubName
.
setSqlSelect
(
"sub_name as subNameList"
).
groupBy
(
"sub_name"
);
List
<
Map
<
String
,
Object
>>
selectMaps
=
schoolMapper
.
selectMaps
(
wrapperSubName
);
EntityWrapper
<
Package
>
packagewrapper
=
new
EntityWrapper
<>();
packagewrapper
.
setSqlSelect
(
"id,package_name as packageName"
);
List
<
Map
<
String
,
Object
>>
packageselectMaps
=
packageMapper
.
selectMaps
(
packagewrapper
);
// 查询单宽学校名称
Wrapper
<
Product
>
productwrapper
=
new
EntityWrapper
();
productwrapper
.
setSqlSelect
(
"product_id as productId,product_university as ProductUniversity"
);
productwrapper
.
eq
(
"product_state"
,
"0"
);
List
<
Map
<
String
,
Object
>>
products
=
productMapper
.
selectMaps
(
productwrapper
);
// 存放县分下拉列表和单宽学校名称下拉列表
if
(!
CollectionUtils
.
isEmpty
(
maps
))
{
maps
.
get
(
0
).
put
(
"subNameList"
,
selectMaps
);
maps
.
get
(
0
).
put
(
"packageName"
,
packageselectMaps
);
maps
.
get
(
0
).
put
(
"products"
,
products
);
}
page
.
setRecords
(
maps
);
return
ResponseData
.
success
(
page
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"编辑套餐选择回显数据"
,
value
=
"choosepages"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
Map
<
String
,
Object
>>
editdisplay
(
@RequestParam
(
"id"
)
String
id
)
{
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
EntityWrapper
<
SchoolPackage
>
schoolPackagewrapper
=
new
EntityWrapper
<>();
schoolPackagewrapper
.
eq
(
"school_id"
,
id
);
List
<
SchoolPackage
>
schoolPackages
=
schoolPackageMapper
.
selectList
(
schoolPackagewrapper
);
ArrayList
<
String
>
arrayList
=
new
ArrayList
<>();
schoolPackages
.
forEach
(
val
->
{
arrayList
.
add
(
val
.
getPackageId
());
});
hashMap
.
put
(
"choosepages"
,
arrayList
);
return
ResponseData
.
success
(
hashMap
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"上传二维码"
,
value
=
"qrcodeUpload"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
xiaotuUpload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
String
backgroundpath
=
FilePath
.
BACKGROUNDIMG
.
getValue
()
+
"/"
+
DEFAULTPATH
;
boolean
makefile
=
FileUtil
.
makefile
(
backgroundpath
,
file
,
id
+
FILENAME
);
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
id
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"service_qrcode"
,
backgroundpath
+
id
+
FILENAME
);
Integer
integer
=
schoolMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
map
),
wrapper
);
if
(
integer
!=
1
)
{
return
ResponseData
.
error
(
"上传失败!"
);
}
return
ResponseData
.
success
(
"上传成功"
);
}
@Permission
(
menuname
=
"获取县分下拉列表"
,
value
=
"substList"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
List
<
Map
<
String
,
Object
>>>
substList
()
{
ShiroUser
user
=
getShiroUser
();
if
(!
user
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
// 查询县分列表
Wrapper
<
School
>
wrapperSubName
=
new
EntityWrapper
<
School
>();
wrapperSubName
.
setSqlSelect
(
"sub_name"
)
.
ne
(
"sub_name"
,
"null"
)
.
groupBy
(
"sub_name"
);
List
<
Map
<
String
,
Object
>>
substNameList
=
schoolMapper
.
selectMaps
(
wrapperSubName
);
return
ResponseData
.
success
(
substNameList
,
"查询完毕!"
);
}
@Permission
(
menuname
=
"获取学校下拉列表"
,
value
=
"schoolList"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
List
<
Map
<
String
,
Object
>>>
schoolList
(
@RequestParam
(
"subName"
)
String
subName
)
{
ShiroUser
user
=
getShiroUser
();
if
(!
user
.
getRoleNames
().
stream
().
anyMatch
(
roleName
->
StringUtils
.
equalsAny
(
roleName
,
"超级管理员"
)))
{
return
ResponseData
.
error
(
"无数据权限"
);
}
// 查询县分列表
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<
School
>();
wrapper
.
setSqlSelect
(
"id,school_name"
)
.
eq
(
"sub_name"
,
subName
)
.
groupBy
(
"school_name"
);
List
<
Map
<
String
,
Object
>>
schoolList
=
schoolMapper
.
selectMaps
(
wrapper
);
return
ResponseData
.
success
(
schoolList
,
"查询完毕!"
);
}
}
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