|  |  | @ -20,13 +20,14 @@ package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSON; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.OrderItem; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.AppClientConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.FieldConstant; | 
			
		
	
		
			
				
					|  |  |  | 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.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.ImgScanParamDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.ImgTaskDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.scan.param.TextScanParamDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -35,10 +36,12 @@ 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.commons.tools.utils.SpringContextUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.UserAdviceConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.UserAdviceDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.CustomerDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.CustomerGridDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.OperUserDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.UserAdviceDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.AdviceDetailResultDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -52,6 +55,8 @@ import com.epmet.feign.OperCrmOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.UserAdviceImgService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.UserAdviceService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.UserResiInfoService; | 
			
		
	
		
			
				
					|  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
			
				
					|  |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
			
				
					|  |  |  | import io.jsonwebtoken.lang.Collections; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.logging.log4j.LogManager; | 
			
		
	
	
		
			
				
					|  |  | @ -148,14 +153,13 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @param dto | 
			
		
	
		
			
				
					|  |  |  |      * @param loginUserId | 
			
		
	
		
			
				
					|  |  |  |      * @return void | 
			
		
	
		
			
				
					|  |  |  |      * @Description 回复建议 | 
			
		
	
		
			
				
					|  |  |  |      * @Author liushaowen | 
			
		
	
		
			
				
					|  |  |  |      * @Date 2020/11/6 16:44 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void replyAdvice(ReplyAdviceFormDTO dto, String loginUserId) { | 
			
		
	
		
			
				
					|  |  |  |     public void replyAdvice(ReplyAdviceFormDTO dto) { | 
			
		
	
		
			
				
					|  |  |  |         //检验是否已经回复过
 | 
			
		
	
		
			
				
					|  |  |  |         UserAdviceEntity userAdviceEntity = baseDao.selectById(dto.getAdviceId()); | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(userAdviceEntity.getReplyContent()) || StringUtils.isNotBlank(userAdviceEntity.getReplyUserId())) { | 
			
		
	
	
		
			
				
					|  |  | @ -164,9 +168,16 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  |         //审核图片
 | 
			
		
	
		
			
				
					|  |  |  |         auditPic(dto.getGovImgList()); | 
			
		
	
		
			
				
					|  |  |  |         //审核文字
 | 
			
		
	
		
			
				
					|  |  |  |         auditText(dto.getReplyContent()); | 
			
		
	
		
			
				
					|  |  |  |         // auditText(dto.getReplyContent());// 运营端或者工组人员回复,不需要走内容审核了。
 | 
			
		
	
		
			
				
					|  |  |  |         String replyUserName = StrConstant.EPMETY_STR; | 
			
		
	
		
			
				
					|  |  |  |         if (AppClientConstant.APP_GOV.equals(dto.getApp())) { | 
			
		
	
		
			
				
					|  |  |  |             replyUserName = CustomerStaffRedis.getStaffInfo(userAdviceEntity.getCustomerId(), dto.getReplyUserId()).getRealName(); | 
			
		
	
		
			
				
					|  |  |  |         } else if (AppClientConstant.APP_OPER.equals(dto.getApp())) { | 
			
		
	
		
			
				
					|  |  |  |             OperUserDTO operUserDTO = SpringContextUtils.getBean(OperUserServiceImpl.class).getOperUserDTO(dto.getReplyUserId()); | 
			
		
	
		
			
				
					|  |  |  |             replyUserName = null != operUserDTO ? operUserDTO.getRealName() : StrConstant.EPMETY_STR; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //更新advice表
 | 
			
		
	
		
			
				
					|  |  |  |         baseDao.replyAdvice(dto.getAdviceId(), dto.getReplyContent(), dto.getGovContent(), loginUserId); | 
			
		
	
		
			
				
					|  |  |  |         baseDao.replyAdvice(dto.getAdviceId(), dto.getReplyContent(), dto.getGovContent(), dto.getReplyUserId(),replyUserName); | 
			
		
	
		
			
				
					|  |  |  |         //如果govImg不为空,插入advice_img表
 | 
			
		
	
		
			
				
					|  |  |  |         List<String> govImgList = dto.getGovImgList(); | 
			
		
	
		
			
				
					|  |  |  |         if (!Collections.isEmpty(govImgList)) { | 
			
		
	
	
		
			
				
					|  |  | @ -179,7 +190,7 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  |                 UserAdviceImgEntity entity = new UserAdviceImgEntity(); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setImgUrl(govImgList.get(i)); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setAdviceId(dto.getAdviceId()); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setType("oper"); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setType(dto.getApp()); | 
			
		
	
		
			
				
					|  |  |  |                 userAdviceImgEntities.add(entity); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             userAdviceImgService.insertBatch(userAdviceImgEntities); | 
			
		
	
	
		
			
				
					|  |  | @ -222,9 +233,9 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  |         List<String> govImgList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         List<String> resiImgList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         for (UserAdviceImgEntity entity : imgsByAdviceId) { | 
			
		
	
		
			
				
					|  |  |  |             if ("resi".equals(entity.getType())) { | 
			
		
	
		
			
				
					|  |  |  |             if (AppClientConstant.APP_RESI.equals(entity.getType())) { | 
			
		
	
		
			
				
					|  |  |  |                 resiImgList.add(entity.getImgUrl()); | 
			
		
	
		
			
				
					|  |  |  |             } else if ("oper".equals(entity.getType())) { | 
			
		
	
		
			
				
					|  |  |  |             } else if (AppClientConstant.APP_OPER.equals(entity.getType())||AppClientConstant.APP_GOV.equals(entity.getType())) { | 
			
		
	
		
			
				
					|  |  |  |                 govImgList.add(entity.getImgUrl()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  | @ -242,7 +253,7 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public PageData<AdviceListResultDTO> adviceList(AdviceListFormDTO dto) { | 
			
		
	
		
			
				
					|  |  |  |         //page分页
 | 
			
		
	
		
			
				
					|  |  |  |         /*//page分页
 | 
			
		
	
		
			
				
					|  |  |  |         Page<UserAdviceEntity> page = new Page<>(dto.getPageNo(), dto.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |         //时间降序
 | 
			
		
	
		
			
				
					|  |  |  |         page.addOrder(OrderItem.desc(FieldConstant.CREATED_TIME)); | 
			
		
	
	
		
			
				
					|  |  | @ -300,7 +311,30 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         result.setRecords(records); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         return getPageData(result, AdviceListResultDTO.class); | 
			
		
	
		
			
				
					|  |  |  |         return getPageData(result, AdviceListResultDTO.class);*/ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         PageHelper.startPage(dto.getPageNo(), dto.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |         List<UserAdviceEntity> list = baseDao.selectListAdvice(dto); | 
			
		
	
		
			
				
					|  |  |  |         List<AdviceListResultDTO> records=ConvertUtils.sourceToTarget(list,AdviceListResultDTO.class); | 
			
		
	
		
			
				
					|  |  |  |         //拼接type
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         for (int i = 0; i < records.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |             if (!"*".equals(records.get(i).getAdviceType())) { | 
			
		
	
		
			
				
					|  |  |  |                 StringBuilder type = new StringBuilder(); | 
			
		
	
		
			
				
					|  |  |  |                 if (records.get(i).getAdviceType().contains("gov")) { | 
			
		
	
		
			
				
					|  |  |  |                     type.append(UserAdviceConstant.GOV_TYPE_TEXT); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 if (records.get(i).getAdviceType().contains("software")) { | 
			
		
	
		
			
				
					|  |  |  |                     if (type.length() != 0) { | 
			
		
	
		
			
				
					|  |  |  |                         type.append("\n"); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                     type.append(UserAdviceConstant.SOFTWARE_TYPE_TEXT); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 records.get(i).setAdviceType(type.toString()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         PageInfo<AdviceListResultDTO> pageInfo = new PageInfo<>(records); | 
			
		
	
		
			
				
					|  |  |  |         return new PageData<>(records, pageInfo.getTotal()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
	
		
			
				
					|  |  | @ -387,7 +421,7 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd | 
			
		
	
		
			
				
					|  |  |  |                 UserAdviceImgEntity entity = new UserAdviceImgEntity(); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setImgUrl(govImgList.get(i)); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setAdviceId(userAdviceDTO.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setType("resi"); | 
			
		
	
		
			
				
					|  |  |  |                 entity.setType(AppClientConstant.APP_RESI); | 
			
		
	
		
			
				
					|  |  |  |                 userAdviceImgEntities.add(entity); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             userAdviceImgService.insertBatch(userAdviceImgEntities); | 
			
		
	
	
		
			
				
					|  |  | 
 |