|
|
@@ -27,17 +27,16 @@ import com.goafanti.user.bo.UserIdentityBo;
|
|
|
import com.goafanti.user.service.UserIdentityService;
|
|
|
|
|
|
@Service
|
|
|
-public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
+public class UserIdentityServiceImpl implements UserIdentityService {
|
|
|
@Autowired
|
|
|
- private UserIdentityMapper userIdentityMapper;
|
|
|
+ private UserIdentityMapper userIdentityMapper;
|
|
|
@Autowired
|
|
|
- private UserMapper userMapper;
|
|
|
+ private UserMapper userMapper;
|
|
|
@Autowired
|
|
|
- private UserRoleMapper userRoleMapper;
|
|
|
+ private UserRoleMapper userRoleMapper;
|
|
|
@Autowired
|
|
|
- private NoticeMapper noticeMapper;
|
|
|
-
|
|
|
-
|
|
|
+ private NoticeMapper noticeMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public UserIdentity selectUserIdentityByUserId(String uid) {
|
|
|
return userIdentityMapper.selectUserIdentityByUserId(uid);
|
|
|
@@ -75,7 +74,7 @@ public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
return userIdentityMapper.insert(userIdentity);
|
|
|
} else {
|
|
|
userIdentity.setId(identity.getId());
|
|
|
- if (null != userIdentity.getAuditStatus() && 5 == userIdentity.getAuditStatus()){
|
|
|
+ if (null != userIdentity.getAuditStatus() && 5 == userIdentity.getAuditStatus()) {
|
|
|
User u = new User();
|
|
|
u.setId(userIdentity.getUid());
|
|
|
u.setLvl(1);
|
|
|
@@ -87,21 +86,21 @@ public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
|
|
|
@Override
|
|
|
public int updateUserDetail(UserIdentity u, String aid, String mid) {
|
|
|
- if (null != u.getAuditStatus() && 5 == u.getAuditStatus() && !StringUtils.isBlank(u.getUid())){
|
|
|
+ if (null != u.getAuditStatus() && 5 == u.getAuditStatus() && !StringUtils.isBlank(u.getUid())) {
|
|
|
User user = new User();
|
|
|
user.setId(u.getUid());
|
|
|
user.setLvl(UserLevel.CERTIFIED.getCode());
|
|
|
userMapper.updateByPrimaryKeySelective(user);
|
|
|
- }
|
|
|
+ }
|
|
|
User user = userMapper.selectByPrimaryKey(u.getUid());
|
|
|
- if (!TokenManager.hasRole(AFTConstants.AUDITORADMIN) && !TokenManager.hasRole(AFTConstants.SUPERADMIN)){
|
|
|
+ if (!TokenManager.hasRole(AFTConstants.AUDITORADMIN) && !TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
user.setAid(TokenManager.getAdminId());
|
|
|
createAuditorNotice(user);
|
|
|
} else {
|
|
|
- if (!StringUtils.isBlank(aid)){
|
|
|
+ if (!StringUtils.isBlank(aid)) {
|
|
|
user.setAid(aid);
|
|
|
}
|
|
|
- if (!StringUtils.isBlank(mid)){
|
|
|
+ if (!StringUtils.isBlank(mid)) {
|
|
|
user.setMid(mid);
|
|
|
}
|
|
|
createNotice(user, u.getAuditStatus());
|
|
|
@@ -114,15 +113,15 @@ public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
public UserIdentity insertByAdmin(UserIdentity ui, String aid, String mid) {
|
|
|
userIdentityMapper.insert(ui);
|
|
|
User u = userMapper.selectByPrimaryKey(ui.getUid());
|
|
|
- if (!TokenManager.hasRole(AFTConstants.AUDITORADMIN) && !TokenManager.hasRole(AFTConstants.SUPERADMIN)){
|
|
|
+ if (!TokenManager.hasRole(AFTConstants.AUDITORADMIN) && !TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
u.setAid(TokenManager.getAdminId());
|
|
|
userMapper.updateByPrimaryKeySelective(u);
|
|
|
createAuditorNotice(u);
|
|
|
}
|
|
|
- if (TokenManager.hasRole(AFTConstants.AUDITORADMIN) || TokenManager.hasRole(AFTConstants.SUPERADMIN)){
|
|
|
+ if (TokenManager.hasRole(AFTConstants.AUDITORADMIN) || TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
u.setAid(aid);
|
|
|
u.setMid(mid);
|
|
|
- if (IdentityAuditStatus.PASSED.getCode() == ui.getAuditStatus()){
|
|
|
+ if (IdentityAuditStatus.PASSED.getCode() == ui.getAuditStatus()) {
|
|
|
u.setLvl(UserLevel.CERTIFIED.getCode());
|
|
|
}
|
|
|
userMapper.updateByPrimaryKeySelective(u);
|
|
|
@@ -130,39 +129,41 @@ public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
}
|
|
|
return ui;
|
|
|
}
|
|
|
-
|
|
|
- //给业务员及客户经理发送通知
|
|
|
- private void createNotice(User u, Integer status){
|
|
|
- if (!StringUtils.isBlank(u.getAid())){
|
|
|
+
|
|
|
+ // 给业务员及客户经理发送通知
|
|
|
+ private void createNotice(User u, Integer status) {
|
|
|
+ if (!StringUtils.isBlank(u.getAid())) {
|
|
|
Notice n = new Notice();
|
|
|
n.setPid(u.getAid());
|
|
|
n.setAid(u.getAid());
|
|
|
n.setUid(u.getId());
|
|
|
notice(n, status);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(u.getMid())){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(u.getMid())) {
|
|
|
Notice n = new Notice();
|
|
|
n.setUid(u.getId());
|
|
|
n.setAid(u.getMid());
|
|
|
+ if (!StringUtils.isBlank(u.getAid())) {
|
|
|
+ n.setPid(u.getAid());
|
|
|
+ }
|
|
|
notice(n, status);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- //给所有审核员发送审核通知
|
|
|
- private void createAuditorNotice(User u){
|
|
|
+
|
|
|
+ // 给所有审核员发送审核通知
|
|
|
+ private void createAuditorNotice(User u) {
|
|
|
List<String> ids = userRoleMapper.listAuditor();
|
|
|
- if (ids.size() > 0 && null != ids){
|
|
|
- for (String s : ids){
|
|
|
+ if (ids.size() > 0 && null != ids) {
|
|
|
+ for (String s : ids) {
|
|
|
Notice n = new Notice();
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
now.set(Calendar.MILLISECOND, 0);
|
|
|
n.setId(UUID.randomUUID().toString());
|
|
|
n.setCreateTime(now.getTime());
|
|
|
n.setReaded(NoticeReadStatus.UNREAD.getCode());
|
|
|
-
|
|
|
+
|
|
|
if (null != u) {
|
|
|
n.setPid(u.getAid());
|
|
|
}
|
|
|
@@ -179,23 +180,23 @@ public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
public AuditorUserIdentityDetailBo selectAuditorUserIdentityByUserId(String uid) {
|
|
|
return userIdentityMapper.selectAuditorUserIdentityByUserId(uid);
|
|
|
}
|
|
|
-
|
|
|
- private void notice(Notice n, Integer status){
|
|
|
+
|
|
|
+ private void notice(Notice n, Integer status) {
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
now.set(Calendar.MILLISECOND, 0);
|
|
|
n.setId(UUID.randomUUID().toString());
|
|
|
n.setCreateTime(now.getTime());
|
|
|
n.setReaded(NoticeReadStatus.UNREAD.getCode());
|
|
|
String content = NoticeStatus.PERSONALCERTIFY.getDesc();
|
|
|
- if (IdentityAuditStatus.UNCOMMITTED.getCode() == status){
|
|
|
+ if (IdentityAuditStatus.UNCOMMITTED.getCode() == status) {
|
|
|
content = content + " " + IdentityAuditStatus.UNCOMMITTED.getDesc();
|
|
|
- } else if (IdentityAuditStatus.COMMITTED.getCode() == status){
|
|
|
+ } else if (IdentityAuditStatus.COMMITTED.getCode() == status) {
|
|
|
content = content + " " + IdentityAuditStatus.COMMITTED.getDesc();
|
|
|
- } else if (IdentityAuditStatus.UNPAID.getCode() == status){
|
|
|
+ } else if (IdentityAuditStatus.UNPAID.getCode() == status) {
|
|
|
content = content + " " + IdentityAuditStatus.UNPAID.getDesc();
|
|
|
- } else if (IdentityAuditStatus.PAID.getCode() == status){
|
|
|
+ } else if (IdentityAuditStatus.PAID.getCode() == status) {
|
|
|
content = content + " " + IdentityAuditStatus.PAID.getDesc();
|
|
|
- } else if(IdentityAuditStatus.PASSED.getCode() == status){
|
|
|
+ } else if (IdentityAuditStatus.PASSED.getCode() == status) {
|
|
|
content = content + " " + IdentityAuditStatus.PASSED.getDesc();
|
|
|
} else {
|
|
|
content = content + " " + IdentityAuditStatus.NOTPASSED.getDesc();
|
|
|
@@ -205,5 +206,4 @@ public class UserIdentityServiceImpl implements UserIdentityService{
|
|
|
noticeMapper.insert(n);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|