|
@@ -10,6 +10,7 @@ import com.dgtly.common.utils.DateUtils;
|
|
|
import com.dgtly.common.utils.StringUtils;
|
|
|
import com.dgtly.system.domain.*;
|
|
|
import com.dgtly.system.mapper.SysUserAuthorRelMapper;
|
|
|
+import com.dgtly.system.mapper.SysUserExtMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.dgtly.system.mapper.SysUserOrderAuthorMapper;
|
|
@@ -31,6 +32,9 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
|
|
|
@Autowired
|
|
|
private SysUserAuthorRelMapper userAuthorRelMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserExtMapper userExtMapper;
|
|
|
+
|
|
|
|
|
|
* 查询权限
|
|
|
*
|
|
@@ -105,6 +109,7 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
|
|
|
return sysUserOrderAuthorMapper.deleteSysUserOrderAuthorById(authorId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public int insertRel(SysUserAuthorRel role)
|
|
|
{
|
|
|
userAuthorRelMapper.deleteSysUserAuthorRelById(role.getUserId());
|
|
@@ -241,7 +246,59 @@ public class SysUserOrderAuthorServiceImpl implements ISysUserOrderAuthorService
|
|
|
|
|
|
@Override
|
|
|
public void initUserAuthor() {
|
|
|
+ return;
|
|
|
+
|
|
|
+ List<SysUserOrderAuthor> userOrderAuthorList=new ArrayList<>();
|
|
|
+ List<SysUserOrderAuthor> userOrderAuthorDiyList=sysUserOrderAuthorMapper.selectAuthorIdByCode("tuc_diy");
|
|
|
+ List<SysUserOrderAuthor> userOrderAuthorCwList=sysUserOrderAuthorMapper.selectAuthorIdByCode("tuc_cw");
|
|
|
+ userExtMapper.selectUserExtList().forEach(sysUserExt -> {
|
|
|
+ String sales=sysUserExt.getSalesLevel();
|
|
|
+ if(sales==null){
|
|
|
+ sales="diy_level";
|
|
|
+ userOrderAuthorList.addAll(userOrderAuthorDiyList);
|
|
|
+ }
|
|
|
+ int index = sales.indexOf("_");
|
|
|
+ String intNumber = sales.substring(0,index);
|
|
|
+ if(intNumber=="cw"){
|
|
|
+ userOrderAuthorList.addAll(userOrderAuthorCwList);
|
|
|
+ }else{
|
|
|
+ userOrderAuthorList.addAll(userOrderAuthorDiyList);
|
|
|
+ }
|
|
|
+ List<SysUserOrderAuthor> ordList=new ArrayList<>();
|
|
|
+ for (int i = 0; i < userOrderAuthorList.size(); i++) {
|
|
|
+ SysUserAuthorRel user=userAuthorRelMapper.selectSysUserAuthorRelByUIdAndAId(sysUserExt.getUserId(),userOrderAuthorList.get(i).getAuthorId());
|
|
|
+ if(user==null && !userOrderAuthorList.get(i).getAuthorId().equals(userOrderAuthorList.get(0).getParentId())){
|
|
|
+ if(i==0){
|
|
|
+ SysUserOrderAuthor userOrderAuthor=new SysUserOrderAuthor();
|
|
|
+ userOrderAuthor.setAuthorId(userOrderAuthorList.get(0).getParentId());
|
|
|
+ userOrderAuthorList.add(userOrderAuthor);
|
|
|
+ }
|
|
|
+ ordList.addAll(userOrderAuthorList);
|
|
|
+ List<SysUserOrderAuthor> OrderAuthorList= sysUserOrderAuthorMapper.selectAuthorIdByParentId(userOrderAuthorList.get(i).getAuthorId());
|
|
|
+ if(OrderAuthorList.size()>0){
|
|
|
+ ordList.addAll(OrderAuthorList);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ordList.size()>0){
|
|
|
+ ordList.forEach(author->{
|
|
|
+ SysUserAuthorRel role=new SysUserAuthorRel();
|
|
|
+ role.setUserId(sysUserExt.getUserId());
|
|
|
+ role.setAuthorId(author.getAuthorId());
|
|
|
+ userAuthorRelList.add(role);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(userAuthorRelList.size()>0){
|
|
|
+ userAuthorRelList.forEach(sysUserAuthorRel -> {
|
|
|
+ userAuthorRelMapper.insertSysUserAuthorRel(sysUserAuthorRel);
|
|
|
+ });
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|