|  | @@ -46,8 +46,7 @@ import java.util.*;
 | 
											
												
													
														|  |   */
 |  |   */
 | 
											
												
													
														|  |  @Service
 |  |  @Service
 | 
											
												
													
														|  |  @Slf4j
 |  |  @Slf4j
 | 
											
												
													
														|  | -public class QwTagGroupServiceImpl implements IQwTagGroupService
 |  | 
 | 
											
												
													
														|  | -{
 |  | 
 | 
											
												
													
														|  | 
 |  | +public class QwTagGroupServiceImpl implements IQwTagGroupService {
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private QwTagGroupMapper qwTagGroupMapper;
 |  |      private QwTagGroupMapper qwTagGroupMapper;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
										
											
												
													
														|  | @@ -104,7 +103,6 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |      QwAppContactWayLogsMapper qwAppContactWayLogsMapper;
 |  |      QwAppContactWayLogsMapper qwAppContactWayLogsMapper;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 查询企微客户标签组
 |  |       * 查询企微客户标签组
 | 
											
												
													
														|  |       *
 |  |       *
 | 
											
										
											
												
													
														|  | @@ -112,8 +110,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |       * @return 企微客户标签组
 |  |       * @return 企微客户标签组
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public QwTagGroup selectQwTagGroupById(Long id)
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public QwTagGroup selectQwTagGroupById(Long id) {
 | 
											
												
													
														|  |          return qwTagGroupMapper.selectQwTagGroupById(id);
 |  |          return qwTagGroupMapper.selectQwTagGroupById(id);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -124,8 +121,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |       * @return 企微客户标签组
 |  |       * @return 企微客户标签组
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public List<QwTagGroup> selectQwTagGroupList(QwTagGroup qwTagGroup)
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public List<QwTagGroup> selectQwTagGroupList(QwTagGroup qwTagGroup) {
 | 
											
												
													
														|  |          return qwTagGroupMapper.selectQwTagGroupList(qwTagGroup);
 |  |          return qwTagGroupMapper.selectQwTagGroupList(qwTagGroup);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -136,8 +132,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |       * @return 结果
 |  |       * @return 结果
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public int insertQwTagGroup(QwTagGroup qwTagGroup)
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public int insertQwTagGroup(QwTagGroup qwTagGroup) {
 | 
											
												
													
														|  |          qwTagGroup.setCreateTime(DateUtils.getNowDate());
 |  |          qwTagGroup.setCreateTime(DateUtils.getNowDate());
 | 
											
												
													
														|  |          return qwTagGroupMapper.insertQwTagGroup(qwTagGroup);
 |  |          return qwTagGroupMapper.insertQwTagGroup(qwTagGroup);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -149,8 +144,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |       * @return 结果
 |  |       * @return 结果
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public int updateQwTagGroup(QwTagGroup qwTagGroup)
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public int updateQwTagGroup(QwTagGroup qwTagGroup) {
 | 
											
												
													
														|  |          qwTagGroup.setUpdateTime(DateUtils.getNowDate());
 |  |          qwTagGroup.setUpdateTime(DateUtils.getNowDate());
 | 
											
												
													
														|  |          return qwTagGroupMapper.updateQwTagGroup(qwTagGroup);
 |  |          return qwTagGroupMapper.updateQwTagGroup(qwTagGroup);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -162,14 +156,13 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |       * @return 结果
 |  |       * @return 结果
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public R deleteQwTagGroupByIds(Long[] ids)
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public R deleteQwTagGroupByIds(Long[] ids) {
 | 
											
												
													
														|  |          for (Long id : ids) {
 |  |          for (Long id : ids) {
 | 
											
												
													
														|  |              QwTagGroup qwTagGroup = qwTagGroupMapper.selectQwTagGroupById(id);
 |  |              QwTagGroup qwTagGroup = qwTagGroupMapper.selectQwTagGroupById(id);
 | 
											
												
													
														|  | -            if (qwTagGroup.getGroupFrom()!=null && qwTagGroup.getGroupFrom() == 1 ){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTagGroup.getGroupFrom() != null && qwTagGroup.getGroupFrom() == 1) {
 | 
											
												
													
														|  |                  QwTagParam qwTagParam = new QwTagParam();
 |  |                  QwTagParam qwTagParam = new QwTagParam();
 | 
											
												
													
														|  |                  qwTagParam.setGroup_id(Arrays.asList(qwTagGroup.getGroupId()));
 |  |                  qwTagParam.setGroup_id(Arrays.asList(qwTagGroup.getGroupId()));
 | 
											
												
													
														|  | -                qwApiService.delTag(qwTagParam,qwTagGroup.getCorpId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +                qwApiService.delTag(qwTagParam, qwTagGroup.getCorpId());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  qwTagMapper.deleteQwTagByGroupId(qwTagGroup.getGroupId());
 |  |                  qwTagMapper.deleteQwTagByGroupId(qwTagGroup.getGroupId());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -177,7 +170,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  return R.ok();
 |  |                  return R.ok();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -            }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  |                  //不能删除非本应用创建的标签组
 |  |                  //不能删除非本应用创建的标签组
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -191,8 +184,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |       * @return 结果
 |  |       * @return 结果
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public int deleteQwTagGroupById(Long id)
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public int deleteQwTagGroupById(Long id) {
 | 
											
												
													
														|  |          return qwTagGroupMapper.deleteQwTagGroupById(id);
 |  |          return qwTagGroupMapper.deleteQwTagGroupById(id);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -216,10 +208,10 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |              qwTagGroup.setOrder(group.getOrder());
 |  |              qwTagGroup.setOrder(group.getOrder());
 | 
											
												
													
														|  |              qwTagGroup.setCorpId(corpId);
 |  |              qwTagGroup.setCorpId(corpId);
 | 
											
												
													
														|  |              qwTagGroup.setCreateTime(new Date(group.getCreate_time()));
 |  |              qwTagGroup.setCreateTime(new Date(group.getCreate_time()));
 | 
											
												
													
														|  | -            if (qwTagGroups==null||qwTagGroups.size()<1){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTagGroups == null || qwTagGroups.size() < 1) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  qwTagGroupMapper.insertQwTagGroup(qwTagGroup);
 |  |                  qwTagGroupMapper.insertQwTagGroup(qwTagGroup);
 | 
											
												
													
														|  | -            }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  |                  qwTagGroup.setId(qwTagGroups.get(0).getId());
 |  |                  qwTagGroup.setId(qwTagGroups.get(0).getId());
 | 
											
												
													
														|  |                  qwTagGroupMapper.updateQwTagGroup(qwTagGroup);
 |  |                  qwTagGroupMapper.updateQwTagGroup(qwTagGroup);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
										
											
												
													
														|  | @@ -234,10 +226,10 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                  tag1.setCorpId(corpId);
 |  |                  tag1.setCorpId(corpId);
 | 
											
												
													
														|  |                  tag1.setCreateTime(new Date(tag.getCreate_time()));
 |  |                  tag1.setCreateTime(new Date(tag.getCreate_time()));
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -                if (qwTags==null||qwTags.size()<1){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (qwTags == null || qwTags.size() < 1) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                      qwTagMapper.insertQwTag(tag1);
 |  |                      qwTagMapper.insertQwTag(tag1);
 | 
											
												
													
														|  | -                }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +                } else {
 | 
											
												
													
														|  |                      tag1.setId(qwTags.get(0).getId());
 |  |                      tag1.setId(qwTags.get(0).getId());
 | 
											
												
													
														|  |                      qwTagMapper.updateQwTag(tag1);
 |  |                      qwTagMapper.updateQwTag(tag1);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -309,31 +301,31 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |          qwAddTagParam.setTag(tag);
 |  |          qwAddTagParam.setTag(tag);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          QwAddTagResult result = qwApiService.addTag(qwAddTagParam, qwTagGroup.getCorpId());
 |  |          QwAddTagResult result = qwApiService.addTag(qwAddTagParam, qwTagGroup.getCorpId());
 | 
											
												
													
														|  | -        System.out.println("标签组addTag-result:"+result);
 |  | 
 | 
											
												
													
														|  | -            TagGroup group = result.getTag_group();
 |  | 
 | 
											
												
													
														|  | -            List<InTag> tags = group.getTag();
 |  | 
 | 
											
												
													
														|  | -            QwTagGroup qwTagGroupAdd = new QwTagGroup();
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupAdd.setGroupId(group.getGroup_id());
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupAdd.setName(group.getGroup_name());
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupAdd.setOrder(group.getOrder());
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupAdd.setCorpId(qwTagGroup.getCorpId());
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupAdd.setGroupFrom(1);
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupAdd.setCreateTime(new Date(group.getCreate_time()));
 |  | 
 | 
											
												
													
														|  | -            qwTagGroupMapper.insertQwTagGroup(qwTagGroupAdd);
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -            for (InTag tagA : tags) {
 |  | 
 | 
											
												
													
														|  | -                QwTag tag1 = new QwTag();
 |  | 
 | 
											
												
													
														|  | -                tag1.setGroupId(group.getGroup_id());
 |  | 
 | 
											
												
													
														|  | -                tag1.setTagId(tagA.getId());
 |  | 
 | 
											
												
													
														|  | -                tag1.setOrder(tagA.getOrder());
 |  | 
 | 
											
												
													
														|  | -                tag1.setName(tagA.getName());
 |  | 
 | 
											
												
													
														|  | -                tag1.setCorpId(qwTagGroup.getCorpId());
 |  | 
 | 
											
												
													
														|  | -                tag1.setTagFrom(1);
 |  | 
 | 
											
												
													
														|  | -                tag1.setCreateTime(new Date(tagA.getCreate_time()));
 |  | 
 | 
											
												
													
														|  | -                qwTagMapper.insertQwTag(tag1);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        System.out.println("标签组addTag-result:" + result);
 | 
											
												
													
														|  | 
 |  | +        TagGroup group = result.getTag_group();
 | 
											
												
													
														|  | 
 |  | +        List<InTag> tags = group.getTag();
 | 
											
												
													
														|  | 
 |  | +        QwTagGroup qwTagGroupAdd = new QwTagGroup();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupAdd.setGroupId(group.getGroup_id());
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupAdd.setName(group.getGroup_name());
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupAdd.setOrder(group.getOrder());
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupAdd.setCorpId(qwTagGroup.getCorpId());
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupAdd.setGroupFrom(1);
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupAdd.setCreateTime(new Date(group.getCreate_time()));
 | 
											
												
													
														|  | 
 |  | +        qwTagGroupMapper.insertQwTagGroup(qwTagGroupAdd);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        for (InTag tagA : tags) {
 | 
											
												
													
														|  | 
 |  | +            QwTag tag1 = new QwTag();
 | 
											
												
													
														|  | 
 |  | +            tag1.setGroupId(group.getGroup_id());
 | 
											
												
													
														|  | 
 |  | +            tag1.setTagId(tagA.getId());
 | 
											
												
													
														|  | 
 |  | +            tag1.setOrder(tagA.getOrder());
 | 
											
												
													
														|  | 
 |  | +            tag1.setName(tagA.getName());
 | 
											
												
													
														|  | 
 |  | +            tag1.setCorpId(qwTagGroup.getCorpId());
 | 
											
												
													
														|  | 
 |  | +            tag1.setTagFrom(1);
 | 
											
												
													
														|  | 
 |  | +            tag1.setCreateTime(new Date(tagA.getCreate_time()));
 | 
											
												
													
														|  | 
 |  | +            qwTagMapper.insertQwTag(tag1);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return 1;
 |  |          return 1;
 | 
											
										
											
												
													
														|  | @@ -341,7 +333,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public int updateQwTagGroupParam(QwTagGroupAddParam qwTagGroup) {
 |  |      public int updateQwTagGroupParam(QwTagGroupAddParam qwTagGroup) {
 | 
											
												
													
														|  | -        System.out.println("传参:"+qwTagGroup);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        System.out.println("传参:" + qwTagGroup);
 | 
											
												
													
														|  |          QwEditTagParam qwEditTagParam = new QwEditTagParam();
 |  |          QwEditTagParam qwEditTagParam = new QwEditTagParam();
 | 
											
												
													
														|  |          qwEditTagParam.setName(qwTagGroup.getName());
 |  |          qwEditTagParam.setName(qwTagGroup.getName());
 | 
											
												
													
														|  |          qwEditTagParam.setId(qwTagGroup.getGroupId());
 |  |          qwEditTagParam.setId(qwTagGroup.getGroupId());
 | 
											
										
											
												
													
														|  | @@ -349,7 +341,6 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |          QwResult qwResult = qwApiService.editTag(qwEditTagParam, qwTagGroup.getCorpId());
 |  |          QwResult qwResult = qwApiService.editTag(qwEditTagParam, qwTagGroup.getCorpId());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |          QwTagGroup copy = BeanCopyUtils.copy(qwTagGroup, QwTagGroup.class);
 |  |          QwTagGroup copy = BeanCopyUtils.copy(qwTagGroup, QwTagGroup.class);
 | 
											
												
													
														|  |          qwTagGroupMapper.updateQwTagGroup(copy);
 |  |          qwTagGroupMapper.updateQwTagGroup(copy);
 | 
											
												
													
														|  |          List<QwTag> tag = qwTagGroup.getTag();
 |  |          List<QwTag> tag = qwTagGroup.getTag();
 | 
											
										
											
												
													
														|  | @@ -361,7 +352,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          for (QwTag qwTag : tag) {
 |  |          for (QwTag qwTag : tag) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -            if (qwTag.getTagId()!=null){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTag.getTagId() != null) {
 | 
											
												
													
														|  |                  QwEditTagParam editTagParam = new QwEditTagParam();
 |  |                  QwEditTagParam editTagParam = new QwEditTagParam();
 | 
											
												
													
														|  |                  editTagParam.setName(qwTag.getName());
 |  |                  editTagParam.setName(qwTag.getName());
 | 
											
												
													
														|  |                  editTagParam.setId(qwTag.getTagId());
 |  |                  editTagParam.setId(qwTag.getTagId());
 | 
											
										
											
												
													
														|  | @@ -371,7 +362,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  QwTag QwTagCopy = BeanCopyUtils.copy(qwTag, QwTag.class);
 |  |                  QwTag QwTagCopy = BeanCopyUtils.copy(qwTag, QwTag.class);
 | 
											
												
													
														|  |                  qwTagMapper.updateQwTag(QwTagCopy);
 |  |                  qwTagMapper.updateQwTag(QwTagCopy);
 | 
											
												
													
														|  | -            }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  |                  QwAddTagParam qwAddTagParam = new QwAddTagParam();
 |  |                  QwAddTagParam qwAddTagParam = new QwAddTagParam();
 | 
											
												
													
														|  |                  qwAddTagParam.setGroup_id(qwTagGroup.getGroupId());
 |  |                  qwAddTagParam.setGroup_id(qwTagGroup.getGroupId());
 | 
											
												
													
														|  |                  TagData tagData = new TagData();
 |  |                  TagData tagData = new TagData();
 | 
											
										
											
												
													
														|  | @@ -379,10 +370,10 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                  tagData.setOrder(qwTag.getOrder());
 |  |                  tagData.setOrder(qwTag.getOrder());
 | 
											
												
													
														|  |                  List<TagData> list = Arrays.asList(tagData);
 |  |                  List<TagData> list = Arrays.asList(tagData);
 | 
											
												
													
														|  |                  qwAddTagParam.setTag(list);
 |  |                  qwAddTagParam.setTag(list);
 | 
											
												
													
														|  | -                QwAddTagResult result= qwApiService.addTag(qwAddTagParam, qwTagGroup.getCorpId());
 |  | 
 | 
											
												
													
														|  | -                if (result.getErrcode()==0){
 |  | 
 | 
											
												
													
														|  | -                    List<InTag> addTag= result.getTag_group().getTag();
 |  | 
 | 
											
												
													
														|  | -                    if (addTag!=null&&addTag.size()>0){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                QwAddTagResult result = qwApiService.addTag(qwAddTagParam, qwTagGroup.getCorpId());
 | 
											
												
													
														|  | 
 |  | +                if (result.getErrcode() == 0) {
 | 
											
												
													
														|  | 
 |  | +                    List<InTag> addTag = result.getTag_group().getTag();
 | 
											
												
													
														|  | 
 |  | +                    if (addTag != null && addTag.size() > 0) {
 | 
											
												
													
														|  |                          QwTag addQwTag = new QwTag();
 |  |                          QwTag addQwTag = new QwTag();
 | 
											
												
													
														|  |                          addQwTag.setGroupId(qwTagGroup.getGroupId());
 |  |                          addQwTag.setGroupId(qwTagGroup.getGroupId());
 | 
											
												
													
														|  |                          addQwTag.setTagId(addTag.get(0).getId());
 |  |                          addQwTag.setTagId(addTag.get(0).getId());
 | 
											
										
											
												
													
														|  | @@ -400,13 +391,13 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          ArrayList<String> delTags = new ArrayList<>();
 |  |          ArrayList<String> delTags = new ArrayList<>();
 | 
											
												
													
														|  |          for (QwTag qwTag1 : qwTags) {
 |  |          for (QwTag qwTag1 : qwTags) {
 | 
											
												
													
														|  | -            boolean b=true;
 |  | 
 | 
											
												
													
														|  | 
 |  | +            boolean b = true;
 | 
											
												
													
														|  |              for (QwTag qwTag : tag) {
 |  |              for (QwTag qwTag : tag) {
 | 
											
												
													
														|  | -                if (qwTag.getId()!=null&&qwTag.getId()-qwTag1.getId()==0){
 |  | 
 | 
											
												
													
														|  | -                    b=false;
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (qwTag.getId() != null && qwTag.getId() - qwTag1.getId() == 0) {
 | 
											
												
													
														|  | 
 |  | +                    b = false;
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | -            if (b){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (b) {
 | 
											
												
													
														|  |                  delTags.add(qwTag1.getTagId());
 |  |                  delTags.add(qwTag1.getTagId());
 | 
											
												
													
														|  |                  qwTagMapper.deleteQwTagById(qwTag1.getId());
 |  |                  qwTagMapper.deleteQwTagById(qwTag1.getId());
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
										
											
												
													
														|  | @@ -414,13 +405,13 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |          QwTagParam qwTagParam = new QwTagParam();
 |  |          QwTagParam qwTagParam = new QwTagParam();
 | 
											
												
													
														|  |          qwTagParam.setTag_id(delTags);
 |  |          qwTagParam.setTag_id(delTags);
 | 
											
												
													
														|  |          qwApiService.delTag(qwTagParam, qwTagGroup.getCorpId());
 |  |          qwApiService.delTag(qwTagParam, qwTagGroup.getCorpId());
 | 
											
												
													
														|  | -        System.out.println("delTagqwTagGroup:"+qwTagParam);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        System.out.println("delTagqwTagGroup:" + qwTagParam);
 | 
											
												
													
														|  |          return 1;
 |  |          return 1;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -    public void addTagByTagId(String tagType, String tagId,String corpId) {
 |  | 
 | 
											
												
													
														|  | -        if (tagType.equals("tag")){
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public void addTagByTagId(String tagType, String tagId, String corpId) {
 | 
											
												
													
														|  | 
 |  | +        if (tagType.equals("tag")) {
 | 
											
												
													
														|  |              QwTagParam qwTagParam = new QwTagParam();
 |  |              QwTagParam qwTagParam = new QwTagParam();
 | 
											
												
													
														|  |              qwTagParam.setTag_id(Arrays.asList(tagId));
 |  |              qwTagParam.setTag_id(Arrays.asList(tagId));
 | 
											
												
													
														|  |              QwTagResult tag = qwApiService.getTag(qwTagParam, corpId);
 |  |              QwTagResult tag = qwApiService.getTag(qwTagParam, corpId);
 | 
											
										
											
												
													
														|  | @@ -433,7 +424,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                      tag1.setTagId(inTag.getId());
 |  |                      tag1.setTagId(inTag.getId());
 | 
											
												
													
														|  |                      tag1.setCorpId(corpId);
 |  |                      tag1.setCorpId(corpId);
 | 
											
												
													
														|  |                      List<QwTag> qwTags = qwTagMapper.selectQwTagList(tag1);
 |  |                      List<QwTag> qwTags = qwTagMapper.selectQwTagList(tag1);
 | 
											
												
													
														|  | -                    if (qwTags==null||qwTags.size()<1){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (qwTags == null || qwTags.size() < 1) {
 | 
											
												
													
														|  |                          tag1.setOrder(inTag.getOrder());
 |  |                          tag1.setOrder(inTag.getOrder());
 | 
											
												
													
														|  |                          tag1.setName(inTag.getName());
 |  |                          tag1.setName(inTag.getName());
 | 
											
												
													
														|  |                          tag1.setCorpId(corpId);
 |  |                          tag1.setCorpId(corpId);
 | 
											
										
											
												
													
														|  | @@ -443,7 +434,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | -        }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  |              QwTagParam qwTagParam = new QwTagParam();
 |  |              QwTagParam qwTagParam = new QwTagParam();
 | 
											
												
													
														|  |              qwTagParam.setGroup_id(Arrays.asList(tagId));
 |  |              qwTagParam.setGroup_id(Arrays.asList(tagId));
 | 
											
												
													
														|  |              QwTagResult qwTag = qwApiService.getTag(qwTagParam, corpId);
 |  |              QwTagResult qwTag = qwApiService.getTag(qwTagParam, corpId);
 | 
											
										
											
												
													
														|  | @@ -455,7 +446,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                  qwTagGroup.setGroupId(group.getGroup_id());
 |  |                  qwTagGroup.setGroupId(group.getGroup_id());
 | 
											
												
													
														|  |                  List<QwTagGroup> qwTagGroups = qwTagGroupMapper.selectQwTagGroupList(qwTagGroup);
 |  |                  List<QwTagGroup> qwTagGroups = qwTagGroupMapper.selectQwTagGroupList(qwTagGroup);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -                if (qwTagGroups==null||qwTagGroups.size()<1){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (qwTagGroups == null || qwTagGroups.size() < 1) {
 | 
											
												
													
														|  |                      qwTagGroup.setName(group.getGroup_name());
 |  |                      qwTagGroup.setName(group.getGroup_name());
 | 
											
												
													
														|  |                      qwTagGroup.setOrder(group.getOrder());
 |  |                      qwTagGroup.setOrder(group.getOrder());
 | 
											
												
													
														|  |                      qwTagGroup.setCorpId(corpId);
 |  |                      qwTagGroup.setCorpId(corpId);
 | 
											
										
											
												
													
														|  | @@ -469,7 +460,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                      tag1.setCorpId(corpId);
 |  |                      tag1.setCorpId(corpId);
 | 
											
												
													
														|  |                      List<QwTag> qwTags = qwTagMapper.selectQwTagList(tag1);
 |  |                      List<QwTag> qwTags = qwTagMapper.selectQwTagList(tag1);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -                    if (qwTags==null||qwTags.size()<1){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (qwTags == null || qwTags.size() < 1) {
 | 
											
												
													
														|  |                          tag1.setOrder(tag.getOrder());
 |  |                          tag1.setOrder(tag.getOrder());
 | 
											
												
													
														|  |                          tag1.setName(tag.getName());
 |  |                          tag1.setName(tag.getName());
 | 
											
												
													
														|  |                          tag1.setCorpId(corpId);
 |  |                          tag1.setCorpId(corpId);
 | 
											
										
											
												
													
														|  | @@ -508,7 +499,7 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                  tag1.setCorpId(corpId);
 |  |                  tag1.setCorpId(corpId);
 | 
											
												
													
														|  |                  List<QwTag> qwTags = qwTagMapper.selectQwTagList(tag1);
 |  |                  List<QwTag> qwTags = qwTagMapper.selectQwTagList(tag1);
 | 
											
												
													
														|  |                  for (QwTag qwTag1 : qwTags) {
 |  |                  for (QwTag qwTag1 : qwTags) {
 | 
											
												
													
														|  | -                    if (qwTag1.getTagId().equals(tag.getId())){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (qwTag1.getTagId().equals(tag.getId())) {
 | 
											
												
													
														|  |                          tag1.setId(qwTag1.getId());
 |  |                          tag1.setId(qwTag1.getId());
 | 
											
												
													
														|  |                          tag1.setName(tag.getName());
 |  |                          tag1.setName(tag.getName());
 | 
											
												
													
														|  |                          tag1.setOrder(tag.getOrder());
 |  |                          tag1.setOrder(tag.getOrder());
 | 
											
										
											
												
													
														|  | @@ -523,29 +514,29 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public void deleteTagByTagId(String tagType, String id, String corpId) {
 |  |      public void deleteTagByTagId(String tagType, String id, String corpId) {
 | 
											
												
													
														|  | -        if (tagType.equals("tag")){
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (tagType.equals("tag")) {
 | 
											
												
													
														|  |              QwTag qwTag = new QwTag();
 |  |              QwTag qwTag = new QwTag();
 | 
											
												
													
														|  |              qwTag.setCorpId(corpId);
 |  |              qwTag.setCorpId(corpId);
 | 
											
												
													
														|  |              qwTag.setTagId(id);
 |  |              qwTag.setTagId(id);
 | 
											
												
													
														|  |              List<QwTag> qwTags = qwTagMapper.selectQwTagList(qwTag);
 |  |              List<QwTag> qwTags = qwTagMapper.selectQwTagList(qwTag);
 | 
											
												
													
														|  | -            if (qwTags!=null&&qwTags.size()>0){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTags != null && qwTags.size() > 0) {
 | 
											
												
													
														|  |                  for (QwTag tag : qwTags) {
 |  |                  for (QwTag tag : qwTags) {
 | 
											
												
													
														|  |                      qwTagMapper.deleteQwTagById(tag.getId());
 |  |                      qwTagMapper.deleteQwTagById(tag.getId());
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | -        }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  |              QwTagGroup qwTagGroup = new QwTagGroup();
 |  |              QwTagGroup qwTagGroup = new QwTagGroup();
 | 
											
												
													
														|  |              qwTagGroup.setGroupId(id);
 |  |              qwTagGroup.setGroupId(id);
 | 
											
												
													
														|  |              qwTagGroup.setCorpId(corpId);
 |  |              qwTagGroup.setCorpId(corpId);
 | 
											
												
													
														|  |              List<QwTagGroup> qwTagGroups = qwTagGroupMapper.selectQwTagGroupList(qwTagGroup);
 |  |              List<QwTagGroup> qwTagGroups = qwTagGroupMapper.selectQwTagGroupList(qwTagGroup);
 | 
											
												
													
														|  | -            if (qwTagGroups!=null&&qwTagGroups.size()>0){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTagGroups != null && qwTagGroups.size() > 0) {
 | 
											
												
													
														|  |                  for (QwTagGroup tagGroup : qwTagGroups) {
 |  |                  for (QwTagGroup tagGroup : qwTagGroups) {
 | 
											
												
													
														|  |                      qwTagGroupMapper.deleteQwTagGroupById(tagGroup.getId());
 |  |                      qwTagGroupMapper.deleteQwTagGroupById(tagGroup.getId());
 | 
											
												
													
														|  |                      QwTag qwTag = new QwTag();
 |  |                      QwTag qwTag = new QwTag();
 | 
											
												
													
														|  |                      qwTag.setCorpId(corpId);
 |  |                      qwTag.setCorpId(corpId);
 | 
											
												
													
														|  |                      qwTag.setGroupId(tagGroup.getGroupId());
 |  |                      qwTag.setGroupId(tagGroup.getGroupId());
 | 
											
												
													
														|  |                      List<QwTag> qwTags = qwTagMapper.selectQwTagList(qwTag);
 |  |                      List<QwTag> qwTags = qwTagMapper.selectQwTagList(qwTag);
 | 
											
												
													
														|  | -                    if (qwTags!=null&&qwTags.size()>0){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (qwTags != null && qwTags.size() > 0) {
 | 
											
												
													
														|  |                          for (QwTag tag : qwTags) {
 |  |                          for (QwTag tag : qwTags) {
 | 
											
												
													
														|  |                              qwTagMapper.deleteQwTagById(tag.getId());
 |  |                              qwTagMapper.deleteQwTagById(tag.getId());
 | 
											
												
													
														|  |                          }
 |  |                          }
 | 
											
										
											
												
													
														|  | @@ -558,12 +549,12 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public void updateTagByTagId(String tagType, String id, String corpId) {
 |  |      public void updateTagByTagId(String tagType, String id, String corpId) {
 | 
											
												
													
														|  | -        if (tagType.equals("tag")){
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (tagType.equals("tag")) {
 | 
											
												
													
														|  |              QwTag qwTag = new QwTag();
 |  |              QwTag qwTag = new QwTag();
 | 
											
												
													
														|  |              qwTag.setCorpId(corpId);
 |  |              qwTag.setCorpId(corpId);
 | 
											
												
													
														|  |              qwTag.setTagId(id);
 |  |              qwTag.setTagId(id);
 | 
											
												
													
														|  |              List<QwTag> qwTags = qwTagMapper.selectQwTagList(qwTag);
 |  |              List<QwTag> qwTags = qwTagMapper.selectQwTagList(qwTag);
 | 
											
												
													
														|  | -            if (qwTags!=null&&qwTags.size()>0){
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTags != null && qwTags.size() > 0) {
 | 
											
												
													
														|  |                  for (QwTag tag : qwTags) {
 |  |                  for (QwTag tag : qwTags) {
 | 
											
												
													
														|  |                      QwTagParam qwTagParam = new QwTagParam();
 |  |                      QwTagParam qwTagParam = new QwTagParam();
 | 
											
												
													
														|  |                      qwTagParam.setTag_id(Arrays.asList(id));
 |  |                      qwTagParam.setTag_id(Arrays.asList(id));
 | 
											
										
											
												
													
														|  | @@ -575,15 +566,15 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |                              QwTag tag1 = new QwTag();
 |  |                              QwTag tag1 = new QwTag();
 | 
											
												
													
														|  |                              tag1.setTagId(tag.getTagId());
 |  |                              tag1.setTagId(tag.getTagId());
 | 
											
												
													
														|  |                              tag1.setOrder(inTag.getOrder());
 |  |                              tag1.setOrder(inTag.getOrder());
 | 
											
												
													
														|  | -                             tag1.setName(inTag.getName());
 |  | 
 | 
											
												
													
														|  | -                             tag1.setCorpId(corpId);
 |  | 
 | 
											
												
													
														|  | -                             qwTagMapper.updateQwTag(tag1);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                            tag1.setName(inTag.getName());
 | 
											
												
													
														|  | 
 |  | +                            tag1.setCorpId(corpId);
 | 
											
												
													
														|  | 
 |  | +                            qwTagMapper.updateQwTag(tag1);
 | 
											
												
													
														|  |                          }
 |  |                          }
 | 
											
												
													
														|  |                      }
 |  |                      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | -        }else {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  |              QwTagGroup tagGroup = new QwTagGroup();
 |  |              QwTagGroup tagGroup = new QwTagGroup();
 | 
											
												
													
														|  |              tagGroup.setCorpId(corpId);
 |  |              tagGroup.setCorpId(corpId);
 | 
											
												
													
														|  |              tagGroup.setGroupId(id);
 |  |              tagGroup.setGroupId(id);
 | 
											
										
											
												
													
														|  | @@ -607,32 +598,33 @@ public class QwTagGroupServiceImpl implements IQwTagGroupService
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public void addQwTagByAi(String trimTag, Long extId) {
 |  |      public void addQwTagByAi(String trimTag, Long extId) {
 | 
											
												
													
														|  |          QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactById(extId);
 |  |          QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactById(extId);
 | 
											
												
													
														|  | -        if (qwExternalContact!=null){
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (qwExternalContact != null) {
 | 
											
												
													
														|  |              QwTagVO qwTagVO = qwTagMapper.selectQwTagByName(trimTag, qwExternalContact.getCorpId());
 |  |              QwTagVO qwTagVO = qwTagMapper.selectQwTagByName(trimTag, qwExternalContact.getCorpId());
 | 
											
												
													
														|  | -            if (qwTagVO!=null){
 |  | 
 | 
											
												
													
														|  | -                log.info("Ai添加标签:"+qwTagVO.getName()+":"+qwTagVO.getTagId()+":"+qwExternalContact.getName());
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTagVO != null) {
 | 
											
												
													
														|  | 
 |  | +                log.info("Ai添加标签:" + qwTagVO.getName() + ":" + qwTagVO.getTagId() + ":" + qwExternalContact.getName());
 | 
											
												
													
														|  |                  QwExternalContactAddTagParam qwExternalContactAddTagParam = new QwExternalContactAddTagParam();
 |  |                  QwExternalContactAddTagParam qwExternalContactAddTagParam = new QwExternalContactAddTagParam();
 | 
											
												
													
														|  |                  qwExternalContactAddTagParam.setTagIds(Arrays.asList(qwTagVO.getTagId()));
 |  |                  qwExternalContactAddTagParam.setTagIds(Arrays.asList(qwTagVO.getTagId()));
 | 
											
												
													
														|  |                  qwExternalContactAddTagParam.setUserIds(Arrays.asList(extId));
 |  |                  qwExternalContactAddTagParam.setUserIds(Arrays.asList(extId));
 | 
											
												
													
														|  |                  qwExternalContactAddTagParam.setCorpId(qwExternalContact.getCorpId());
 |  |                  qwExternalContactAddTagParam.setCorpId(qwExternalContact.getCorpId());
 | 
											
												
													
														|  |                  try {
 |  |                  try {
 | 
											
												
													
														|  |                      qwExternalContactService.addUserTag(qwExternalContactAddTagParam);
 |  |                      qwExternalContactService.addUserTag(qwExternalContactAddTagParam);
 | 
											
												
													
														|  | -                }catch (Exception e){
 |  | 
 | 
											
												
													
														|  | -                    log.info("Ai添加标签出错:"+qwTagVO.getName()+":"+qwExternalContact.getName());
 |  | 
 | 
											
												
													
														|  | 
 |  | +                } catch (Exception e) {
 | 
											
												
													
														|  | 
 |  | +                    log.info("Ai添加标签出错:" + qwTagVO.getName() + ":" + qwExternalContact.getName());
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      IQwExternalContactService qwExternalContactService;
 |  |      IQwExternalContactService qwExternalContactService;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public void delQwTagByAi(String trimTag, Long extId) {
 |  |      public void delQwTagByAi(String trimTag, Long extId) {
 | 
											
												
													
														|  |          QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactById(extId);
 |  |          QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactById(extId);
 | 
											
												
													
														|  | -        if (qwExternalContact!=null){
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (qwExternalContact != null) {
 | 
											
												
													
														|  |              QwTagVO qwTagVO = qwTagMapper.selectQwTagByName(trimTag, qwExternalContact.getCorpId());
 |  |              QwTagVO qwTagVO = qwTagMapper.selectQwTagByName(trimTag, qwExternalContact.getCorpId());
 | 
											
												
													
														|  | -            if (qwTagVO!=null){
 |  | 
 | 
											
												
													
														|  | -                log.info("Ai移除标签:"+qwTagVO.getName()+":"+qwTagVO.getTagId()+":"+qwExternalContact.getName());
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (qwTagVO != null) {
 | 
											
												
													
														|  | 
 |  | +                log.info("Ai移除标签:" + qwTagVO.getName() + ":" + qwTagVO.getTagId() + ":" + qwExternalContact.getName());
 | 
											
												
													
														|  |                  QwExternalContactAddTagParam qwExternalContactAddTagParam = new QwExternalContactAddTagParam();
 |  |                  QwExternalContactAddTagParam qwExternalContactAddTagParam = new QwExternalContactAddTagParam();
 | 
											
												
													
														|  |                  qwExternalContactAddTagParam.setTagIds(Arrays.asList(qwTagVO.getTagId()));
 |  |                  qwExternalContactAddTagParam.setTagIds(Arrays.asList(qwTagVO.getTagId()));
 | 
											
												
													
														|  |                  qwExternalContactAddTagParam.setUserIds(Arrays.asList(extId));
 |  |                  qwExternalContactAddTagParam.setUserIds(Arrays.asList(extId));
 |