|
|
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.OrganizationIdentityMapper;
|
|
|
-import com.goafanti.common.dao.OrganizationInfoMapper;
|
|
|
+import com.goafanti.common.dao.UserIdentityMapper;
|
|
|
import com.goafanti.common.dao.UserMapper;
|
|
|
import com.goafanti.common.model.OrganizationIdentity;
|
|
|
import com.goafanti.common.model.User;
|
|
|
@@ -29,23 +29,20 @@ import com.goafanti.user.bo.UserNames;
|
|
|
import com.goafanti.user.bo.UserPageHomeBo;
|
|
|
import com.goafanti.user.service.UserService;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Service
|
|
|
public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserService {
|
|
|
@Autowired
|
|
|
- UserMapper userMapper;
|
|
|
+ private UserMapper userMapper;
|
|
|
@Autowired
|
|
|
- OrganizationInfoMapper organizationInfoMapper;
|
|
|
+ private OrganizationIdentityMapper organizationIdentityMapper;
|
|
|
@Autowired
|
|
|
- OrganizationIdentityMapper organizationIdentityMapper;
|
|
|
-
|
|
|
-
|
|
|
+ private UserIdentityMapper userIdentityMapper;
|
|
|
+
|
|
|
@Override
|
|
|
- public User insertRegister(User user,String contacts,String unitName) {
|
|
|
+ public User insertRegister(User user, String contacts, String unitName) {
|
|
|
userMapper.insert(user);
|
|
|
- if (null != user.getType() && 1 == user.getType()){
|
|
|
- if (!StringUtils.isBlank(unitName) || !StringUtils.isBlank(contacts)){
|
|
|
+ if (null != user.getType() && 1 == user.getType()) {
|
|
|
+ if (!StringUtils.isBlank(unitName) || !StringUtils.isBlank(contacts)) {
|
|
|
OrganizationIdentity organizationIdentity = new OrganizationIdentity();
|
|
|
organizationIdentity.setUid(user.getId());
|
|
|
organizationIdentity.setUnitName(StringUtils.isBlank(unitName) ? "" : unitName);
|
|
|
@@ -59,15 +56,15 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
organizationIdentity.setListedType(0);
|
|
|
organizationIdentityMapper.insert(organizationIdentity);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
return user;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public User selectByMobieAndType(java.lang.String mobile, Integer type) {
|
|
|
- return userMapper.selectByMobieAndType(mobile,type);
|
|
|
+ return userMapper.selectByMobieAndType(mobile, type);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public User selectByPrimaryKey(String id) {
|
|
|
return userMapper.selectByPrimaryKey(id);
|
|
|
@@ -101,47 +98,47 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public Pagination<UserListBo> listUser(String mobile, String email, String[] pDate, Integer number,
|
|
|
- String unitName, Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
|
|
|
+ public Pagination<UserListBo> listUser(String mobile, String email, String[] pDate, Integer number, String unitName,
|
|
|
+ Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
Date pStart = null;
|
|
|
Date pEnd = null;
|
|
|
-
|
|
|
- if (null != pDate ){
|
|
|
+
|
|
|
+ if (null != pDate) {
|
|
|
pStart = DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
|
|
|
- if (pDate.length == 2){
|
|
|
+ if (pDate.length == 2) {
|
|
|
pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (null != pStart){
|
|
|
+
|
|
|
+ if (null != pStart) {
|
|
|
params.put("pStart", pStart);
|
|
|
}
|
|
|
-
|
|
|
- if (null != pEnd){
|
|
|
+
|
|
|
+ if (null != pEnd) {
|
|
|
params.put("pEnd", pEnd);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(mobile)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(mobile)) {
|
|
|
params.put("mobile", mobile);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(email)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(email)) {
|
|
|
params.put("email", email);
|
|
|
}
|
|
|
-
|
|
|
- if (null != number ){
|
|
|
+
|
|
|
+ if (null != number) {
|
|
|
params.put("number", number);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(unitName)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(unitName)) {
|
|
|
params.put("unitName", unitName);
|
|
|
}
|
|
|
-
|
|
|
- if (null != auditStatus){
|
|
|
+
|
|
|
+ if (null != auditStatus) {
|
|
|
params.put("auditStatus", auditStatus);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (pageNo == null || pageNo < 0) {
|
|
|
pageNo = 1;
|
|
|
}
|
|
|
@@ -149,10 +146,9 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
if (pageSize == null || pageSize < 0) {
|
|
|
pageSize = 10;
|
|
|
}
|
|
|
- return (Pagination<UserListBo>) findPage("findUserListByPage","findUserCount", params, pageNo,
|
|
|
- pageSize);
|
|
|
+ return (Pagination<UserListBo>) findPage("findUserListByPage", "findUserCount", params, pageNo, pageSize);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
public Pagination<OrgListBo> listOrg(String uid, String mobile, String email, String[] pDate, Integer number,
|
|
|
@@ -160,49 +156,50 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
Date pStart = null;
|
|
|
Date pEnd = null;
|
|
|
-
|
|
|
- if (null != pDate && pDate.length > 0){
|
|
|
+
|
|
|
+ if (null != pDate && pDate.length > 0) {
|
|
|
pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
|
|
|
- pEnd = StringUtils.isBlank(pDate[1]) ? null : DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
|
|
|
-
|
|
|
+ pEnd = StringUtils.isBlank(pDate[1]) ? null
|
|
|
+ : DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
|
|
|
+
|
|
|
pStart = DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
|
|
|
- if (pDate.length == 2){
|
|
|
+ if (pDate.length == 2) {
|
|
|
pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (null != pStart){
|
|
|
+
|
|
|
+ if (null != pStart) {
|
|
|
params.put("pStart", pStart);
|
|
|
}
|
|
|
-
|
|
|
- if (null != pEnd){
|
|
|
+
|
|
|
+ if (null != pEnd) {
|
|
|
params.put("pEnd", pEnd);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(mobile)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(mobile)) {
|
|
|
params.put("mobile", mobile);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(uid)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(uid)) {
|
|
|
params.put("uid", uid);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(email)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(email)) {
|
|
|
params.put("email", email);
|
|
|
}
|
|
|
-
|
|
|
- if (null != number ){
|
|
|
+
|
|
|
+ if (null != number) {
|
|
|
params.put("number", number);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(aftUsername)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(aftUsername)) {
|
|
|
params.put("aftUsername", aftUsername);
|
|
|
}
|
|
|
-
|
|
|
- if (null != auditStatus){
|
|
|
+
|
|
|
+ if (null != auditStatus) {
|
|
|
params.put("auditStatus", auditStatus);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (pageNo == null || pageNo < 0) {
|
|
|
pageNo = 1;
|
|
|
}
|
|
|
@@ -210,8 +207,7 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
if (pageSize == null || pageSize < 0) {
|
|
|
pageSize = 10;
|
|
|
}
|
|
|
- return (Pagination<OrgListBo>) findPage("findOrgListByPage","findOrgCount", params, pageNo,
|
|
|
- pageSize);
|
|
|
+ return (Pagination<OrgListBo>) findPage("findOrgListByPage", "findOrgCount", params, pageNo, pageSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -222,10 +218,10 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
@Override
|
|
|
public List<OrgUnitNames> selectDemandUnitNames() {
|
|
|
String aid = TokenManager.getAdminId();
|
|
|
- if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)){
|
|
|
+ if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
|
|
|
return organizationIdentityMapper.selectManagerUnitNames(aid);
|
|
|
} else {
|
|
|
- if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
|
|
|
+ if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
aid = null;
|
|
|
}
|
|
|
return organizationIdentityMapper.selectAllOrgIndentity(aid);
|
|
|
@@ -235,30 +231,50 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
|
|
|
@Override
|
|
|
public List<UserNames> selectDemandUserNames() {
|
|
|
String aid = TokenManager.getAdminId();
|
|
|
- if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)){
|
|
|
- return organizationIdentityMapper.selectManagerUserNames(aid);
|
|
|
+ if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
|
|
|
+ return userIdentityMapper.selectManagerUserNames(aid);
|
|
|
} else {
|
|
|
- if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
|
|
|
+ if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
aid = null;
|
|
|
}
|
|
|
- return organizationIdentityMapper.selectAllUserNames(aid);
|
|
|
+ return userIdentityMapper.selectAllUserNames(aid);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public Map<String, String> selectAchievementUserOwner(String name) {
|
|
|
+ String aid = TokenManager.getAdminId();
|
|
|
+ if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
|
|
|
+ return disposeAchievementUserOwner(userIdentityMapper.selectManagerAchievementUserOwner(aid, name));
|
|
|
+ } else {
|
|
|
+ if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
+ aid = null;
|
|
|
+ }
|
|
|
+ return disposeAchievementUserOwner(userIdentityMapper.selectAchievementUserOwner(aid, name));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ public List<OrgUnitNames> selectAchievementOrgOwner(String name){
|
|
|
+ String aid = TokenManager.getAdminId();
|
|
|
+ if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
|
|
|
+ return organizationIdentityMapper.selectManagerAchievementOrgOwner(aid, name);
|
|
|
+ } else {
|
|
|
+ if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
+ aid = null;
|
|
|
+ }
|
|
|
+ return organizationIdentityMapper.selectAchievementOrgOwner(aid, name);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ private Map<String, String> disposeAchievementUserOwner(List<UserNames> list) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ for(UserNames u : list){
|
|
|
+ map.put(u.getUid(), u.getUsername() + " " + u.getMobile());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|