|
|
@@ -660,25 +660,38 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
public int addAssistant(Integer id,String aid) {
|
|
|
PublicRelease p = publicReleaseMapper.selectByPrimaryKey(id);
|
|
|
List<String> list=new ArrayList<>();
|
|
|
- if (p.getAssistantAid()!=null){
|
|
|
- list =Arrays.asList(p.getAssistantAid().split(","));
|
|
|
+ if (StringUtils.isNotEmpty(p.getAssistantAid())){
|
|
|
+ list =new ArrayList<>(Arrays.asList(p.getAssistantAid().split(",")));
|
|
|
if (list.contains(aid)){
|
|
|
throw new BusinessException("人员已经存在");
|
|
|
}
|
|
|
}
|
|
|
String sname = pushAssistant(aid, list,0);
|
|
|
String said =String.join(",",list);
|
|
|
+ p.setAssistantAid(said);
|
|
|
+ p.setAssistantName(sname);
|
|
|
addAssistantPublicRelease(p,aid);
|
|
|
return updateAssistant(p, said, sname);
|
|
|
}
|
|
|
|
|
|
private void addAssistantPublicRelease(PublicRelease p, String aid) {
|
|
|
+ List<PublicRelease> list = publicReleaseMapper.selectByMainId(p.getMainId(), 4, aid);
|
|
|
PublicRelease newP= new PublicRelease();
|
|
|
- BeanUtils.copyProperties(p,newP);
|
|
|
- newP.setId(null);
|
|
|
- newP.setAid(aid);
|
|
|
- newP.setType(4);
|
|
|
- publicReleaseMapper.insertSelective(newP);
|
|
|
+ if(list.isEmpty()){
|
|
|
+ BeanUtils.copyProperties(p,newP);
|
|
|
+ newP.setId(null);
|
|
|
+ newP.setAid(aid);
|
|
|
+ newP.setType(4);
|
|
|
+ publicReleaseMapper.insertSelective(newP);
|
|
|
+ }else {
|
|
|
+ for (PublicRelease pr : list) {
|
|
|
+ newP.setStatus(2);
|
|
|
+ newP.setAssistantAid(p.getAssistantAid());
|
|
|
+ newP.setAssistantName(p.getAssistantName());
|
|
|
+ publicReleaseMapper.updateByPrimaryKeySelective(newP);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
addpublicLog(newP.getId(),PublicReleaseLog.states.fq.getCode(),"发起技术协助。");
|
|
|
addWeChatNotice( aid,1,"发起技术协助。",newP.getId());
|
|
|
}
|
|
|
@@ -745,7 +758,11 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
if(type==0){
|
|
|
list.add(aid);
|
|
|
}else if (type==1){
|
|
|
- list=list.stream().filter(s -> !s.equals(aid)).collect(Collectors.toList());
|
|
|
+ Iterator<String > it =list.iterator();
|
|
|
+ while (it.hasNext()){
|
|
|
+ if (it.next().equals(aid))
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
}
|
|
|
for (String s : list) {
|
|
|
sb.append(adminMapper.selectByPrimaryKey(s).getName());
|
|
|
@@ -758,7 +775,10 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
@Override
|
|
|
public int deleteAssistant(Integer id, String aid) {
|
|
|
PublicRelease p = publicReleaseMapper.selectByPrimaryKey(id);
|
|
|
- List<String> list=Arrays.asList(p.getAssistantAid().split(","));
|
|
|
+ if (p.getAssistantAid()==null){
|
|
|
+ throw new BusinessException("人员不存在");
|
|
|
+ }
|
|
|
+ List<String> list=new ArrayList<>(Arrays.asList(p.getAssistantAid().split(",")));
|
|
|
if (!list.contains(aid)){
|
|
|
throw new BusinessException("人员不存在");
|
|
|
}
|