| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -17,30 +17,48 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					package com.epmet.modules.act.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.ImgScanParamDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.ImgTaskDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.TextScanParamDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.TextTaskDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.result.SyncScanResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ScanContentUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.UserBaseInfoResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.dao.ActSignInRecordDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.dao.ActSummaryDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.dao.GroupActContentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.dao.GroupActInfoDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.dao.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.entity.ActSummaryContentEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.entity.ActSummaryEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.entity.GroupActInfoEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.act.service.ActSummaryService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.constant.GroupActConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.member.service.ResiGroupMemberService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.act.GroupActIdDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.act.form.ActSummaryDetailFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.act.form.ActSummaryFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.act.form.InitTemplateFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.act.result.ActSummaryTemplateResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.topic.form.FileDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Value; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.ArrayList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.UUID; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 活动总结 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -51,6 +69,13 @@ import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					@Slf4j | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					@Service | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					public class ActSummaryServiceImpl extends BaseServiceImpl<ActSummaryDao, ActSummaryEntity> implements ActSummaryService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Value("${openapi.scan.server.url}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String scanApiUrl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Value("${openapi.scan.method.textSyncScan}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String textSyncScanMethod; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Value("${openapi.scan.method.imgSyncScan}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String imgSyncScanMethod; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GroupActInfoDao groupActInfoDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -59,6 +84,11 @@ public class ActSummaryServiceImpl extends BaseServiceImpl<ActSummaryDao, ActSum | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ActSignInRecordDao actSignInRecordDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ResiGroupMemberService resiGroupMemberService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ActSummaryContentDao actSummaryContentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 012、初始化活动总结模板 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -68,27 +98,202 @@ public class ActSummaryServiceImpl extends BaseServiceImpl<ActSummaryDao, ActSum | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public ActSummaryTemplateResultDTO initTemplate(InitTemplateFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GroupActInfoEntity groupActInfoEntity=groupActInfoDao.selectById(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(null==groupActInfoEntity){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("根据groupActId:%s,查询活动信息为null",formDTO.getGroupActId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GroupActInfoEntity groupActInfoEntity = groupActInfoDao.selectById(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == groupActInfoEntity) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("根据groupActId:%s,查询活动信息为null", formDTO.getGroupActId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ActSummaryTemplateResultDTO resultDTO= ConvertUtils.sourceToTarget(groupActInfoEntity,ActSummaryTemplateResultDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ActSummaryTemplateResultDTO resultDTO = ConvertUtils.sourceToTarget(groupActInfoEntity, ActSummaryTemplateResultDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setTextList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.TEXT)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setImgList(groupActContentDao.selectContentList(formDTO.getGroupActId(),GroupActConstant.IMG)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> signedInUserIds=actSignInRecordDao.selectUserIds(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setImgList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.IMG)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //签到人员姓名集合
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> signedInUserIds = actSignInRecordDao.selectUserIds(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setSignedInUserIds(signedInUserIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(CollectionUtils.isNotEmpty(signedInUserIds)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<List<UserBaseInfoResultDTO>> result = epmetUserOpenFeignClient.queryUserBaseInfo(signedInUserIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!result.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> signedInUsers = querySignedInUsers(signedInUserIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setSignedInUsers(StringUtils.strip(signedInUsers.toString(), "[]").replace(", ", StrConstant.COMMA_ZH)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setGroupActId(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return resultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 013、提交活动总结 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return com.epmet.resi.group.dto.act.GroupActIdDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public GroupActIdDTO submitActSummary(ActSummaryFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GroupActIdDTO result = new GroupActIdDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        result.setGroupActId(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //已经提交,无需重复提交
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GroupActInfoEntity groupActInfoEntity = groupActInfoDao.selectById(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == groupActInfoEntity) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("根据groupActId:%s,查询活动信息为null", formDTO.getGroupActId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (groupActInfoEntity.getSummaryFlag() == NumConstant.ONE) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.warn("已填写活动总结,无需重复提交"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        checkActSummaryFormDTO(formDTO, groupActInfoEntity.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //插入总结主表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ActSummaryEntity insertEntity = new ActSummaryEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setGroupActId(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setShouldAttend(groupActInfoEntity.getShouldAttend()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setUserId(formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //签到人员姓名集合
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> signedInUserIds = actSignInRecordDao.selectUserIds(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> signedInUsers = querySignedInUsers(signedInUserIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setSignedInUsers(StringUtils.strip(signedInUsers.toString(), "[]").replace(", ", StrConstant.COMMA_ZH)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setSignedInNum(signedInUsers.size()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.insert(insertEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //插入补充内容表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int textNum = NumConstant.ONE; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (String content : formDTO.getTextList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ActSummaryContentEntity insert = new ActSummaryContentEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setCustomerId(groupActInfoEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setContent(content); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setContentType(GroupActConstant.TEXT); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setGroupActId(groupActInfoEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setSort(textNum); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setActSummaryId(insertEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            actSummaryContentDao.insert(insert); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            textNum++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int imgNum = NumConstant.ONE; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (FileDTO fileDTO : formDTO.getImgList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ActSummaryContentEntity insert = new ActSummaryContentEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setCustomerId(groupActInfoEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setContent(fileDTO.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setContentType(GroupActConstant.IMG); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setGroupActId(groupActInfoEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setSort(imgNum); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            insert.setActSummaryId(insertEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            actSummaryContentDao.insert(insert); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            imgNum++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //更新总结标识
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        groupActInfoEntity.setSummaryFlag(NumConstant.ONE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        groupActInfoDao.updateById(groupActInfoEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private List<String> querySignedInUsers(List<String> signedInUserIds) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> nameList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(signedInUserIds)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<List<UserBaseInfoResultDTO>> userResult = epmetUserOpenFeignClient.queryUserBaseInfo(signedInUserIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!userResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("调用user服务,获取用户基础数据失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            result.getData().forEach(userBaseInfo->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                resultDTO.setSignedInUsers(userBaseInfo.getSurname().concat(userBaseInfo.getName())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (String signedInUserId : signedInUserIds) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for (UserBaseInfoResultDTO userBaseInfo : userResult.getData()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (signedInUserId.equals(userBaseInfo.getUserId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        nameList.add(userBaseInfo.getSurname().concat(userBaseInfo.getName())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return nameList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void checkActSummaryFormDTO(ActSummaryFormDTO formDTO, String groupId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //只有组长才可以填写活动总结
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getLeaderMember(groupId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!formDTO.getUserId().equals(groupMemberDTO.getCustomerUserId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode(), EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getTextList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //活动文本内容,目前只有一段,限制1000字
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (formDTO.getTextList().get(NumConstant.ZERO).length() > 1000) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException(EpmetErrorCode.GROUP_ACT_CONTENT_MAX.getCode(), EpmetErrorCode.GROUP_ACT_CONTENT_MAX.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getImgList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //最多选择3张图片
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (formDTO.getImgList().size() > NumConstant.THREE) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException(EpmetErrorCode.GROUP_ACT_IMG_MAX.getCode(), EpmetErrorCode.GROUP_ACT_IMG_MAX.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //内容审核
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //补充内容
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getTextList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getTextList().forEach(content -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                TextTaskDTO taskDTO = new TextTaskDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                taskDTO.setContent(content); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                textScanParamDTO.getTasks().add(taskDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!textSyncScanResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!textSyncScanResult.getData().isAllPass()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.warn(String.format("补充内容审核失败【%s】", JSON.toJSONString(formDTO.getTextList()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //补充图片
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getImgList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getImgList().forEach(fileDTO -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ImgTaskDTO task = new ImgTaskDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                task.setDataId(UUID.randomUUID().toString().replace("-", "")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                task.setUrl(fileDTO.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                imgScanParamDTO.getTasks().add(task); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resultDTO.setSignedInUserIds(new ArrayList<>()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resultDTO.setSignedInUsers(StrConstant.EPMETY_STR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!imgScanResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!imgScanResult.getData().isAllPass()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.warn("补充图片审核失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 014、查看活动总结详情 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return com.epmet.resi.group.dto.act.result.ActSummaryDetailResultDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public ActSummaryDetailResultDTO queryActSummaryDetail(ActSummaryDetailFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GroupActInfoEntity groupActInfoEntity = groupActInfoDao.selectById(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == groupActInfoEntity) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("根据groupActId:%s,查询活动信息为null", formDTO.getGroupActId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ActSummaryEntity actSummaryEntity = baseDao.selectUserSummary(formDTO.getGroupActId(),formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == actSummaryEntity || groupActInfoEntity.getSummaryFlag() == NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("根据groupActId:%s,查询活动总结信息为null", formDTO.getGroupActId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ActSummaryDetailResultDTO resultDTO = ConvertUtils.sourceToTarget(groupActInfoEntity, ActSummaryDetailResultDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setTextList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.TEXT)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setImgList(groupActContentDao.selectContentList(formDTO.getGroupActId(), GroupActConstant.IMG)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setActSummaryId(actSummaryEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setSignedInUsers(actSummaryEntity.getSignedInUsers()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //按签到顺序
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setSignedInUserIds(actSignInRecordDao.selectUserIds(formDTO.getGroupActId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setGroupActId(formDTO.getGroupActId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setExtraImgList(actSummaryContentDao.selectContentList(actSummaryEntity.getId(), formDTO.getGroupActId(), GroupActConstant.IMG)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setExtraTextList(actSummaryContentDao.selectContentList(actSummaryEntity.getId(), formDTO.getGroupActId(), GroupActConstant.TEXT)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return resultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |