|
|
@@ -8,6 +8,7 @@ import com.goafanti.common.dao.*;
|
|
|
import com.goafanti.common.error.BusinessException;
|
|
|
import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.AmbSystem;
|
|
|
+import com.goafanti.common.model.UserRole;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
@@ -27,11 +28,9 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
|
|
|
@Autowired
|
|
|
private AdminMapper adminMapper;
|
|
|
@Autowired
|
|
|
- private AmbInvestLogMapper ambInvestLogMapper;
|
|
|
+ private UserRoleMapper userRoleMapper;
|
|
|
@Autowired
|
|
|
- private AmbInvestMapper ambInvestMapper;
|
|
|
- @Autowired
|
|
|
- private RoleMapper roleMapper;
|
|
|
+ private RoleMapper roleMapper;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -95,11 +94,34 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
|
|
|
StringBuffer str=new StringBuffer();
|
|
|
List<AmbSystem> list=selectByLeader(leader);
|
|
|
Admin a =new Admin();
|
|
|
- for (AmbSystem ambSystem : list) {
|
|
|
- if (ambSystem.getLvl()==5||ambSystem.getLvl()==6){
|
|
|
- a.setAmbManage(1);
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ //不为空就是巴主,如果不是巴主则设置成巴主
|
|
|
+ List<UserRole> al = userRoleMapper.selectAdminRole("巴主");
|
|
|
+ String roleId = roleMapper.selectIdByName("巴主");
|
|
|
+ boolean flag=false;
|
|
|
+ if (al.isEmpty()){
|
|
|
+ flag=true;
|
|
|
+ }else {
|
|
|
+ flag=true;
|
|
|
+ for (UserRole userRole : al) {
|
|
|
+ if (userRole.getUid().equals(leader)){
|
|
|
+ flag=false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ UserRole userRole=new UserRole();
|
|
|
+ userRole.setUid(leader);
|
|
|
+ userRole.setRid(roleId);
|
|
|
+ userRoleMapper.insert(userRole);
|
|
|
+ }
|
|
|
+ for (AmbSystem ambSystem : list) {
|
|
|
+ if (ambSystem.getLvl()==5||ambSystem.getLvl()==6){
|
|
|
+ a.setAmbManage(1);
|
|
|
+ }
|
|
|
+ str.append(ambSystem.getLvl()).append(",");
|
|
|
+
|
|
|
}
|
|
|
- str.append(ambSystem.getLvl()).append(",");
|
|
|
|
|
|
}
|
|
|
a.setId(leader);
|