|
|
@@ -9,6 +9,7 @@ import com.goafanti.common.dao.AmbSystemMapper;
|
|
|
import com.goafanti.common.error.BusinessException;
|
|
|
import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.AmbSystem;
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
@@ -33,8 +34,9 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
|
|
|
in.setStatus("0");
|
|
|
in.setCreateBy(TokenManager.getAdminId());
|
|
|
in.setCreateTime(new Date());
|
|
|
+ ambSystemMapper.insertSelective(in);
|
|
|
pushAdminAmbRole(in);
|
|
|
- return ambSystemMapper.insertSelective(in);
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
public void getParentParam(InputAmb in){
|
|
|
@@ -69,22 +71,29 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
|
|
|
* @param in
|
|
|
*/
|
|
|
private void pushAdminAmbRole(InputAmb in) {
|
|
|
- Admin use = adminMapper.selectByPrimaryKey(in.getLeader());
|
|
|
- StringBuffer str=new StringBuffer();
|
|
|
+ //如果是修改,处理原负责人
|
|
|
+ if (in.getId()!=null){
|
|
|
+ AmbSystem use = ambSystemMapper.selectByPrimaryKey(in.getId());
|
|
|
+ if (in.getLeader()!=null){
|
|
|
+ updateAmbRole(use.getLeader());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ updateAmbRole(in.getLeader());
|
|
|
|
|
|
- List<AmbSystem> list=selectByLeader(in.getLeader());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateAmbRole(String leader) {
|
|
|
+ StringBuffer str=new StringBuffer();
|
|
|
+ List<AmbSystem> list=selectByLeader(leader);
|
|
|
for (AmbSystem ambSystem : list) {
|
|
|
str.append(ambSystem.getLvl()).append(",");
|
|
|
}
|
|
|
- Admin a =new Admin();
|
|
|
- if (use.getAmbRole().contains("7")){
|
|
|
- str.append("7").append(",");
|
|
|
- a.setAmbRole(str.toString());
|
|
|
- }else {
|
|
|
+ if (StringUtils.isNotBlank(str)){
|
|
|
+ Admin a =new Admin();
|
|
|
+ a.setId(leader);
|
|
|
a.setAmbRole(str.substring(0,str.length()-1));
|
|
|
+ adminMapper.updateByPrimaryKeySelective(a);
|
|
|
}
|
|
|
- a.setId(in.getLeader());
|
|
|
- adminMapper.updateByPrimaryKeySelective(a);
|
|
|
}
|
|
|
|
|
|
private List<AmbSystem> selectByLeader(String leader) {
|